//rest Input

function ResetInput(InputObj) {
				 if(InputObj.value == "Suche" || InputObj.value == "Search" || InputObj.value == "Rechercher") {
					 InputObj.value = "";
					}
				}

linkHover = function() {	// Setzt auf alle Links onmouse over die klasse linkhover
	var linkEls = document.getElementById("ContentPosition").getElementsByTagName("a");
	for (var i=0; i<linkEls.length; i++) {
		linkEls[i].onmouseover=function() {
			this.className+=" linkhover";
		}
		linkEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" linkhover\\b"), "");
		}
	}
}
if (window.attachEvent){window.attachEvent("onload", linkHover);}

function reSize() {
	 
	if(window.innerHeight) { 	// Wenn Firefox
		winHeight = window.innerHeight; OutContent = 502;
	} else if (document.body && document.body.clientHeight) {	// Wenn IE
		winHeight = document.body.clientHeight;
		OutContent = 498;
	}
	 if(window.XMLHttpRequest) { // Wenn NICHT IE 6
		document.getElementById('ContentPosition').style.minHeight = (winHeight - OutContent) + 'px';
	 } else {	// Wenn IE 6
		document.getElementById('ContentPosition').style.height = (winHeight - OutContent) + 'px';
	 }
}
window.onresize = reSize;

// Menu
menu = Class.create();
Object.extend(menu.prototype, {
	
	loNav: null,
	lbWorking: false,
	loTimeout: null,


	initialize: function() {
		this.loNav = $('Nav');
		var laLi = this.loNav.getElementsByTagName('li');

		

		
		for (var i = 0; i < laLi.length; i++) {
			Event.observe(laLi[i], 'mouseover', this.openMenu.bind(this, laLi[i]));
			Event.observe(laLi[i], 'mouseout', this.cancelMenu.bind(this));
		}
	},

	cancelMenu: function() {
		if (this.lbWorking) {
			clearTimeout(this.loTimeout);
			this.lbWorking = false;
		}
	},

	openMenu: function(loLi) {

		//var loUl = loLi.getElementsByTagName('ul')[0];
		if (this.lbWorking || (loLi && loLi.className == "sfhover")) return;

		var self = this;
		this.loTimeout = setTimeout( function() { self.toggleMenu(loLi); }, 200);
		this.lbWorking = true;
	},
	
	toggleMenu: function(loLi) {
		var laLi = loLi.parentNode.getElementsByTagName('li');

		for (var i = 0; i < laLi.length; i++){
			laLi[i].className = laLi[i].className.replace("sfhover", "");
		}

		// var loUl = loLi.getElementsByTagName('ul')[0];
	  if (loLi) loLi.className+=" sfhover"; // Element.show(loUl);
		this.lbWorking = false;
	}
});

// fontSize

// Cookie verwenden

if(document.cookie.search(/fontSize=.+/) != -1)
{
	var Wertstart = document.cookie.indexOf("fontSize=") + 9;
    var Wertende = Wertstart + 2;
	if (Wertende == -1) Wertende = document.cookie.length;
    var fontSize = document.cookie.substring(Wertstart, Wertende);
	fontSize = parseInt(fontSize); // Stringt in Zahl umwandeln
}
else { var fontSize = 12;  } // Wenn Cookie nicht gesetzt

function fontButton() {	// [+] [-] incaktive
	document.getElementById('Content').style.fontSize = fontSize +'px';
	if(fontSize >= 16)	{document.getElementById('Larger').className = "Inactive"}
	if(fontSize <= 11)	{document.getElementById('Smaller').className = "Inactive"; }
}

function larger()
{
	if(fontSize < 16)
	{
		fontSize++;
		
		// Set Fontsize
		document.getElementById('Content').style.fontSize = fontSize +'px';
		// Save Cookie
		document.cookie = "fontSize=" + fontSize;

		// Active / Deactive Buttons
		if(fontSize >= 16)	{document.getElementById('Larger').className = "Inactive"}
		if(fontSize >= 11)	{document.getElementById('Smaller').className = ""}
	}
}
function smaller() // on press [-]
{
	if(fontSize > 11)
	{
		fontSize--;
		
		// Set Fontsize
		document.getElementById('Content').style.fontSize = fontSize +'px';
		// Save Cookie
		document.cookie = "fontSize=" + fontSize;
		
		// Active / Deactive Buttons
		if(fontSize <= 11)	{document.getElementById('Smaller').className = "Inactive"}
		if(fontSize <= 16)	{document.getElementById('Larger').className = ""}
	}
}
