function init() {
	smallWindow();
	CloseDivsOnToggle.init();
}

var PM = {
	/**
	 * @param newImg image-src to fade-in
	 * @param siblingImg img to fade out
	 */
	mainMenu_mouseover : function(newImg, siblingImg) {
		siblingImg.parentNode.style.position = "relative";
		siblingImg.parentNode.style.display = "block";
		siblingImg.parentNode.style.width = siblingImg.clientWidth+"px";

		var imgToFadeIn = document.createElement("img");
		imgToFadeIn.src = newImg;
		imgToFadeIn.style.display = "none";
		imgToFadeIn.style.position = "absolute";
		imgToFadeIn.style.left = "0";
		siblingImg.parentNode.appendChild(imgToFadeIn);

		Event.observe(imgToFadeIn,"mouseout", PM.mainMenu_mouseout);

		Effect.Fade(siblingImg, {duration:0.1});
		Effect.Appear(imgToFadeIn, {duration:0.1});
	},
	/**
	 * @param e Event
	 */
	mainMenu_mouseout : function(e) {
		var overImg = Event.element(e);
		var comeAgain = overImg.parentNode.getElementsByTagName("IMG")[0];
		Effect.Fade(overImg, { queue: 'end', duration:0.1 });
//		overImg.style.display = "none";
//		comeAgain.style.display = "block";
		Effect.Appear(comeAgain, { queue: 'end', duration:0.1 });
	}
}
var CloseDivsOnToggle = {
	divs : Array(),
	init : function () {
		var divs = document.getElementsByTagName("DIV");
		for(var i=0;i<divs.length;i++) {
			if(divs[i].className.match(/togglediv/)) {
				CloseDivsOnToggle.divs.push(divs[i]);
			}
		}
	},
	_toggle : function(idDiv) {
		for(i=0;i<CloseDivsOnToggle.divs.length;i++) {
			if(idDiv == CloseDivsOnToggle.divs[i].id) {
				Effect.toggle(idDiv,'blind', {duration:0.3 });
			} else {
				if(CloseDivsOnToggle.divs[i].style.overflow == "visible") {
					Effect.BlindUp(CloseDivsOnToggle.divs[i], {duration:0.3 });
				}
			}
		}
// 		var div = div;
// 		if (! div) { return; }
	}
}

function openPopup(url){
	var wstatic = '400';
	var hstatic = '300';
  var newleft =(screen.width-wstatic)/2;
  var newtop =(screen.height-hstatic)/2;
	var optionsPopup = "scrollbars=yes,resizable=yes,menubar=yes,location=no,width="+wstatic+",height="+hstatic+",left="+newleft+",top="+newtop+"";
 window.open(url, "popup", optionsPopup);
}

function openLightboxPopup() {
  return false;
}


function viewportGetHeight() {
    var retval = 0;
    if (window.innerHeight)
        retval = window.innerHeight - 18;
    else if (document.documentElement && document.documentElement.clientHeight)
        retval = document.documentElement.clientHeight;
    else if (document.body && document.body.clientHeight)
        retval = document.body.clientHeight;
    return retval;
}

function smallWindow() {
if (viewportGetHeight() <= 655){
	document.body.className = "smallWindow";
}
}

 window.onload = init;

jQuery.noConflict();
jQuery(document).ready(function() {
	 	
  		jQuery("li.Sonstiges input").attr("disabled","disabled");
			jQuery("li.Zeitschriften input").attr("disabled","disabled");
					 	 		
 			jQuery("li.Wie_haben_Sie_von_Pinimenthol_erfahren").change(
			 function(){
 		
				 	var s = jQuery("input#x6").attr('checked');
				 	var z = jQuery("input#x5").attr('checked');
	
	
		 				if(z){
						 	jQuery("li.Zeitschriften input").attr("disabled","");
					 	} else {
						 	jQuery("li.Zeitschriften input").attr("disabled","disabled");
						 	jQuery("li.Zeitschriften input").val("");
						 }
						 
		 				if(s){
						 	jQuery("li.Sonstiges input").attr("disabled","");
					 	} else {
						 	jQuery("li.Sonstiges input").attr("disabled","disabled");
						 	jQuery("li.Sonstiges input").val("");
						 }
			 	
			 }
			 );				 		 
			jQuery("ul.level2 li:last").addClass("item99");
});

