// Kleinofen 2010 - JavaScript Standard Funktionen

$(document).ready(function(){ 
	// thumbs
	$("#main img.thumb").hover(function(){
	$(this).fadeTo("slow", 0.85);
	},function(){
	$(this).fadeTo("slow", 1.0);
	});
	
	$("ul.sf-menu").superfish(); 

	// zebra listen
	$("ul.liste1 li:odd").addClass("evenItem");
	$("ul.liste2 li:odd").addClass("evenItem");
	$("ul.termine li:odd").addClass("evenItem");
	$("ul.liste2 ul.liste2 li:odd").addClass("evenItem");
	$(".formularzeile:odd").addClass("evenItem");

	// Slideshow
	$('.slides').cycle({
		fx: 'fade', timeout: 10000   // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	// Slideshow Banner klein
	$('.slides2').cycle({
		fx: 'fade', timeout: 16000   // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	
		
	
}); 


/*
addPrintLink function by Roger Johansson, www.456bereastreet.com
*/
var addPrintLink = {
	init:function(sTargetEl,sLinkText) {
		if (!document.getElementById || !document.createTextNode) {return;} // Check for DOM support
		if (!document.getElementById(sTargetEl)) {return;} // Check that the target element actually exists
		if (!window.print) {return;} // Check that the browser supports window.print
		var oTarget = document.getElementById(sTargetEl);
		var oLink = document.createElement('a');
		oLink.id = 'print-link'; // Give the link an id to allow styling
		oLink.href = '#'; // Make the link focusable for keyboard users
		oLink.appendChild(document.createTextNode(sLinkText));
		oLink.onclick = function() {window.print(); return false;} // Return false prevents the browser from following the link and jumping to the top of the page after printing
		oTarget.appendChild(oLink);
	},
/*
addEvent function included here for portability. Replace with your own addEvent function if you use one.
*/
/* addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html */
	addEvent:function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() {obj["e"+type+fn](window.event);}
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};
addPrintLink.addEvent(window, 'load', function(){addPrintLink.init('article','Print this page');});


function verify() {
var themessage = "Die folgenden Pflichtfelder sind noch leer: ";
if (document.form.NAME.value=="") {
themessage = themessage + " Name ";
}

if (document.form.MAIL.value=="") {
themessage = themessage + " E-Mail ";
}

//alert if fields are empty and cancel form submit
if (themessage == "Die folgenden Pflichtfelder sind noch leer: ") {
document.form.submit();
}
else {
alert(themessage);
return false;
   }
}



