/* .product - Höhe */
function productHeight() {
	var maxHeight = 0;
	var producs = document.getElementsByClassName("product");
	if (producs.length > 0) {
		for(var i=0;i<producs.length;i++) {
			var height = producs[i].offsetHeight;
			if (height > maxHeight) maxHeight = height;
			var height = producs[i].clientHeight;
			if (height > maxHeight) maxHeight = height;

			var imgs = producs[i].getElementsByTagName("img");
			if (imgs.length > 0) {
				for(var j=0;j<imgs.length;j++) {
					var height = imgs[j].offsetHeight;
					if (height > maxHeight) maxHeight = height;
				}
			}
		}
		for(var i=0;i<producs.length;i++) {
			producs[i].style.height = maxHeight + "px";
		}

	}
}

/* Navigation */
function showHide(element) {
	var children = element.getElementsByTagName("DIV");
	if (children.length > 0) {
		var firstList=children[0];
		if (!element.className.match("childselected")) {
			if (firstList.style.display == 'block') {
				firstList.style.display = 'none'
			} else {
				firstList.style.display = 'block'
			}
		} else {
		 if (!element.className.match("level1") && !element.className.match("level2"))
			if (firstList.style.display == 'block') {
				firstList.style.display = 'none'
				alert(element.className);
			} else {
				firstList.style.display = 'block'
			}
		}
	}
	return true;
}

/* Sprache */
function languageSelection_mouseOver(evt) {
 document.getElementById("languageSelectionMenu").style.display = "block";
}
function languageSelection_mouseOut() {
	document.getElementById("languageSelectionMenu").style.display = "none";
}


/**
 * Nur ein Beispiel, außerdem deprecated, weil Hadaikum-Prototype
 * @todo Objekt in der Form Dauphin.Trendoffice.toogleProduct(e) anlegen und schön öffnen / schließen / blenden und sonstige wundersame Effekte implementieren!
 * @var DOMElement
 */ 
function elementStandardToggl(element) {
	var parent = element.parentNode.parentNode;
	if(parent) {
		var targets = parent.getElementsByTagName("DIV");
		for(var i=0;i<targets.length;i++) {
			if(targets[i].className.match("elementStandardToggl")) {
				targets[i].style.display = "block";
			}
			if(targets[i].className.match("elementStandardTogglLink")) {
				targets[i].style.display = "none";
			}
		}
	}
}
function maskEmail(name, domain) {
	document.writeln('<a href="mailto:'+name+'@'+domain+'">'+name+'@'+domain+'</a>');
}

function popUp1(wintype) {
  var nwl = (screen.width-1000)/2;
  var nwh = (screen.height-790)/2;
  popUp=window.open(wintype, 'PopUp','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1000,height=790,left='+nwl+',top='+nwh+''); 
  popUp.window.focus(); 
}

// Popup Chairfinder
function popUp2(wintype) {
  var nwl = (screen.width-1050)/2;
  var nwh = (screen.height-800)/2;
  popUp=window.open(wintype, 'PopUp','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=1050,height=800,left='+nwl+',top='+nwh+''); 
  popUp.window.focus(); 
}



function init() {
	productHeight();
	try{
		wNav_OpenFix.fix(document.getElementById("nMenu"));
	} catch (e) {}

}
window.onload = init;
