/* Grömo - Javascript Datei */
var browser = navigator.userAgent.toLowerCase();
var integer_value = parseInt(navigator.appVersion);
var value = parseFloat(navigator.appVersion);
//ist es netscape
var netscap = ((browser.indexOf('mozilla')!=-1) && (browser.indexOf('spoofer')==-1) && (browser.indexOf('compatible') == -1) && (browser.indexOf('opera')==-1) && (browser.indexOf('webtv')==-1) && (browser.indexOf('hotjava')==-1));
var netscap4 = (netscap && (integer_value == 4));
var netscap4up = (netscap && (integer_value >= 4));
var netscaponly = (netscap && ((browser.indexOf(";nav") != -1) || (browser.indexOf("; nav") != -1)));
//ist es netscape 6
var netscap6 = (netscap && (integer_value == 5));
var netscap6up = (netscap && (integer_value >= 5));
var is_gecko = (browser.indexOf('gecko') != -1);
//ist es internet explorer

var explorer = ((browser.indexOf("msie") != -1) && (browser.indexOf("opera") == -1));
var explorer3 = (explorer && (integer_value < 4));
var explorer4 = (explorer && (integer_value == 4) && (browser.indexOf("msie 5")==-1));
var explorer4up = (explorer && (integer_value >= 4));
var explorer5 = (explorer && (integer_value == 4) && (browser.indexOf("msie 5.0")!=-1));
var explorer5_5 = (explorer && (integer_value == 4) && (browser.indexOf("msie 5.5") !=-1));
var explorer5up = (explorer && !explorer3 && !explorer4);
var explorer5_5up =(explorer && !explorer3 && !explorer4 && !explorer5);
var explorer6 = (explorer && (integer_value == 4) && (browser.indexOf("msie 6.0") !=-1));
var explorer6up = (explorer && !explorer3 && !explorer4 && !explorer5 && !explorer6);
var explorer7 = (explorer && (integer_value == 4) && (browser.indexOf("msie 7.0") !=-1));
var explorer8 =  (explorer && (integer_value == 4) && (browser.indexOf("msie 8.0") !=-1));
var explorer8up =  (explorer && !explorer3 && !explorer4 && !explorer5 && !explorer6 && !explorer7 && !explorer8);
//ist es opera
var opera = (browser.indexOf("opera") != -1);
var opera4 = (browser.indexOf("opera 4") != -1);
var opera5 = (opera && (integer_value == 5));
var opera5up = (opera && (integer_value >=5));

var timeoutArray = new Array();
Array.prototype.contains = function(obj) {
	var i, listed = false;
	for (i=0; i<this.length; i++) {
		if (this[i] === obj) {
			listed = true;
			break;
		}
	}
	return listed;
};
var topSubnaviArray = Array();
for (var i = 1; i <= 1 ; i++) {
	myName = "topSubNavi_0"+i;

	topSubnaviArray.push(myName);
}


if(explorer) {
	if (explorer7 || explorer8 || explorer8up) {
		document.write('<link rel="stylesheet" type="text/css" href="/css/load_css.css">')
	}
	else {
		document.write('<link rel="Stylesheet"  type="text/css" href="/css/load_css_IE6_lt.css" />')
	}
}
else {
	document.write('<link rel="stylesheet" type="text/css" href="/css/load_css.css">')
}



function GoSelect_location_language(x) {
	var splitValues = x.split("|");
	document.location.href= splitValues[2]+"&location="+splitValues[0]+"&language="+splitValues[1];
}

/*
function GoPartnerCountry (continent, country, id, language) {
	document.location.href = "index.php?id="+id+"&partnerContinent="+continent+"&partnerCountry="+country+"&language="+language;
}

function GoPartnerContinent (country, id, language) {
	document.location.href = "index.php?id="+id+"&partnerContinent="+country+"&language="+language;
}

function GoPartnerZip (continent, country, zip, id, language) {
	document.location.href = "index.php?id="+id+"&partnerContinent="+continent+"&partnerCountry="+country+"&partnerZIP="+zip+"&language="+language;
}
function GoPartnerAgentZip (continent, country, zip, agentZIP, id, language) {
	document.location.href = "index.php?id="+id+"&partnerContinent="+continent+"&partnerCountry="+country+"&partnerZIP="+zip+"&partnerAgentZIP="+agentZIP+"&language="+language;
}


function GoContactPLZ (country, id, plz) {
	document.location.href = "index.php?id="+id+"&contactCountry="+country+"&plz="+plz;
}

function GoContactState (country, id,state) {
	document.location.href = "index.php?id="+id+"&contactCountry="+country+"&contactState="+state;
}
*/
function GoContactDistributionArea (value, url, language) {
	if (value !="") {
	url = url+"&distributionArea="+value;
	}
	if (language != "") {
		url = url+"&language="+language;
	}
	document.location.href = url;
}

function GoContactDistributionCountry (value, url, language) {
	if (value !="") {
	url = url+"&distributionCountry="+value;
	}
	if (language != "") {
		url = url+"&language="+language;
	}
	document.location.href = url;
	
}

function openWindow (url, windowName, setoptions) {
	if (setoptions == 1) {
		options = "width=800,height=600,left=100,top=100,resizable=yes,status=yes,toolbar=yes,scrollbars=yes,menubar=yes";
	}
	else if (setoptions == "") {
		options = "width=800,height=600,left=100,top=100,resizable=yes,scrollbars=yes;";
	}
	else {
		options = setoptions;
	}
	
	myWindow = window.open(url, windowName, options);
	myWindow.focus();
}

function Go(url) {
	if (url !="") {
		document.location.href = url;
	}
}



function show(obj, id, image, imagePath) {
	if (obj && id) {
		/*showBorder (obj, id)*/
	}

	document.getElementById(id).style.zIndex = 1;
}

function showBorder (obj, id) {
	document.getElementById(obj.id).style.borderRight = "solid black 1px";
}

function hide(obj, id, image, imagePath) {
	if (obj && id) {
		/*hideBorder (obj, id)*/
	}
	document.getElementById(id).src =imagePath + image;
}

function hideBorder(obj, id) {
	document.getElementById(obj.id).style.borderRight = "solid transparent 1px";
}



if(window.navigator.systemLanguage && !window.navigator.language) {
	function hoverIE() {
		if (document.getElementById("Navigation1")) {
			var LI = document.getElementById("Navigation1").firstChild;
			do {
				if (sucheUL(LI.firstChild)) {
					LI.onmouseover=einblenden; LI.onmouseout=ausblenden;
				}
				LI = LI.nextSibling;
			}

			while(LI);
		}
		if (document.getElementById("Navigation2")) {

			var LI = document.getElementById("Navigation2").firstChild;
			do {
				if (sucheUL(LI.firstChild)) {
					LI.onmouseover=einblenden; LI.onmouseout=ausblenden;
				}
				LI = LI.nextSibling;
			}
			while(LI);
		}
		if (document.getElementById("Navigation3")) {
			var LI = document.getElementById("Navigation3").firstChild;

			do {
				if (sucheUL(LI.firstChild)) {
					LI.onmouseover=einblenden; LI.onmouseout=ausblenden;
				}
				LI = LI.nextSibling;
			}
		while(LI);
		}
		if (document.getElementById("Navigation4")) {

			var LI = document.getElementById("Navigation4").firstChild;
			do {
				if (sucheUL(LI.firstChild)) {
					LI.onmouseover=einblenden; LI.onmouseout=ausblenden;
				}
				LI = LI.nextSibling;
			}
			while(LI);
		}
	}


	function sucheUL(UL) {
		do {
			if(UL) UL = UL.nextSibling;
			if(UL && UL.nodeName == "UL") return UL;
		}
		while(UL);
		return false;
	}

	function einblenden() {
		var UL = sucheUL(this.firstChild);
		UL.style.display = "block";

	}
	function ausblenden() {
		sucheUL(this.firstChild).style.display = "none";
	}

	function changeLocation (selectionId, languageId) {
		setQuestionMark = "?";
		setAnd = "";
		if (languageId) {
			set = setQuestionMark+"language="+languageId;
			setQuestionMark = "";
			setAnd = "&";
		}
		if (selectionId) {
			set = set+setQuestionMark+setAnd+"location="+selectionId;
		}

		document.location.href =  "<?=$_SERVER['PHP_SELF']?>"+set;

	}


	window.onload=hoverIE;
}


function showTopSubNavi(divId, NaviNameID, NaviColorValue) {
	
	document.getElementById(NaviNameID).style.background = NaviColorValue;
	document.getElementById(divId).style.display = "block";
	for (var i = 0; i < topSubnaviArray.length ; i++) {
		if (divId != topSubnaviArray[i]) {
			document.getElementById(topSubnaviArray[i]).style.display = "none";
		}
	}
	clearTimeouts();
}

function resetSubNavi (divId, NaviNameID, NaviColorValue) {
	document.getElementById(NaviNameID).style.background = NaviColorValue;
	for (var i = 0; i < topSubnaviArray.length ; i++) {
		if (divId == topSubnaviArray[i]) {
			document.getElementById(topSubnaviArray[i]).style.display = "none";
		}
		else {
			document.getElementById(topSubnaviArray[i]).style.display = "block";
		}
	}
	/*document.getElementById('subMenu_produkte').style.display = "none";*/
}

function clearTimeouts () {
	for (var i = 0; i < timeoutArray.length ; i++) {
		window.clearTimeout(timeoutArray[i]);
	}
	timeoutArray = new Array();
}

function addTimeout (divId, NaviNameID, NaviColorValue) {
	if (NaviNameID != "") {
		ID = window.setTimeout (function() {resetSubNavi(divId, NaviNameID,NaviColorValue )}, 500);
		timeoutArray.push(ID);
		//alert(myName+" "+ ID+"-->"+ timeoutArray);
	}

}

function clearField (obj, checkValue) {
	if (obj.value ==  checkValue) {
		obj.value = "";
	}
}

function temp_05 (data) {

	var result = temp_04(data);
	if (result !="") {
		document.location.href = "mailto:"+result;
	}
}

function temp_04 (data) {
	delimiter = new Array("\\$","\\?","%","&");
	for (var i = 0; i < delimiter.length ; i++) {
		var search = "/("+ delimiter[i] +")/gi";
		data = data.replace(eval(search), "|");
	}
	var dataNeu = data.split("|");
	var dataLength = dataNeu.length;
	var result = "";
	var key = dataNeu[(dataLength-1)];

	for (var i = 0; i < (dataLength-1) ; i++) {
		var charcode = dataNeu[i]/key;
		charcode = Math.round(charcode);
		result = result+ String.fromCharCode(charcode);
	}
	return result;
}


function resetForm (formName) {
	document[formName].form_delete.value = 1;
	document[formName].submit();
}
