function makeWindowInnovation(selectedLang) {
	var x=screen.width/2-390;
	var y=screen.height/2-240;
	var fenster=window.open("testo_innovation_2007_"+selectedLang+".html?"+selectedLang,"testo845","width=800,height=600,screenX="+x+",screenY="+y+",location=no,resizable=no,toolbar=no,status=yes,menubar=no,scrollbars=no,dependent=yes");
	fenster.moveTo(x,y);
	fenster.focus();
}


/*Start: Productlist functions*/
function showInfos (id)
{
	hide(id);
	show(id + '-open');
}

function hideInfos (id)
{
	show(id);
	hide(id + '-open');
}

function show(element)
{
	element = $(element);
	element.style.display="block";
}

function hide(element)
{
	element = $(element);
	element.style.display="none";
}
/*END: Productlist functions*/

/*Start: getElementByID by Prototype*/
function $() {
  var elements = new Array();
  
  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1)
      return element;

    elements.push(element);
  }
  return elements;
}
/*END: getElementByID by Prototype*/

function initList(currentState, startCountry)
{
	myObj = document.getElementById('dist-req-state');
	switch (startCountry)
	{
		case "CAN":
			staaten = states_CAN();
			break;
		case "USA":
			staaten = states_USA();
			break;
		default:
			staaten = states_USA();
			break;
	}
	myObj.length = 0;
	for( var i = 0; i < staaten.length; i++){
		auswahl = new Option(staaten[i], staaten[i], false, false);
		if (auswahl.value==currentState)
		{
			auswahl.selected='selected';
		}
		myObj.options[myObj.length] = auswahl;
	}
}

function states_USA()
{
	return new Array('','Alabama','Alaska','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','District of Columbia','Florida','Georgia','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virginia','Washington','West Virginia','Wisconsin','Wyoming');		
}

function states_CAN()
{
	return new Array('','Alberta','British Columbia','Manitoba','New Brunswick','Newfoundland and Labrador','Northwest Territories','Nova Scotia','Nunavut','Ontario','Prince Edward Island','Quebec','Saskatchewan','Yukon');
}

function forward(link)
{
	alert("The testo 523 is radically changing the way AC & refrigeration systems are being serviced. Don't get left behind!");
	popup = window.open(link.href);
	if (popup==null)
	{
		alert("Please disable your popup blocker");
	}
	return false;
}

function showImage(pictureName)
{
	if(pictureName == '')
	{
		document.getElementById("rollover").src = "img/transparent.gif";
	}
	else
	{
		document.getElementById("rollover").src = "img/" + pictureName;
	}
}

function showInput(input)
{
	if(input.checked == false)
	{
		document.getElementById(input.id + "-more-info").style.display = "none";
	}
	else
	{
		document.getElementById(input.id + "-more-info").style.display = "block";
	}
}

function switchSelectContent(country)
{
	myObj = document.getElementById('dist-req-state');
	
	if(country == "can")
	{
		staaten_can = states_CAN();
		myObj.length = 0;
		for( var i = 0; i < staaten_can.length; i++){
			auswahl = new Option(staaten_can[i], staaten_can[i], false, false);
			myObj.options[myObj.length] = auswahl;
		}
	}
	
	if(country == "usa")
	{
		staaten_usa = states_USA();
		myObj.length = 0;
		for( var i = 0; i < staaten_usa.length; i++){
			auswahl = new Option(staaten_usa[i], staaten_usa[i], false, false);
			myObj.options[myObj.length] = auswahl;
		}
	}
}


function goToUrl()
{
	myObj = document.getElementById('new-products');
	if (myObj.selectedIndex > 0)
	{
		var target = (myObj.options[myObj.selectedIndex].value);
		window.location.href = target; 
		return;
	}
}
		


pressButton = "";

function buttonPressed(that)
{
	pressButton = that;
	buttonOver(that);
}

function buttonOver(that)
{
	if (pressButton==that) {
		if (that.src) {
			that.src = that.src.replace(/.gif/,"_pressed.gif");
		} else {
			that.style.borderLeft = "1px solid #333";
			that.style.borderTop = "1px solid #333";
		}
	}
}

function buttonOut(that)
{
	if (that.src) {
		that.src = that.src.replace(/_pressed.gif/,".gif");
	} else {
		that.style.borderLeft = "1px solid #d6d6d6";
		that.style.borderTop = "1px solid #d6d6d6";
	}
}

function buttonReleased(that)
{
	buttonOut(that)
	pressButton = "";
}

function outsideReleased()
{
	pressButton = "";
}

if (navigator.userAgent.toLowerCase().indexOf("msie") != -1) {
	//document.onmouseup=outsideReleased;
} else {
	//window.captureEvents(Event.MOUSEUP);
	//window.onmouseup = outsideReleased;
}

function displayLang(country)
{
	var objCountryList = document.getElementById("country-list");
	var lis = objCountryList.getElementsByTagName('li');
	var objLink = document.getElementById(country);

	for ( var i=0; i < lis.length; i++ ) {
		if(lis.item(i).getElementsByTagName('a')[0] != null) {
			lis.item(i).getElementsByTagName('a')[0].style.fontWeight = "normal";
			lis.item(i).getElementsByTagName('a')[0].style.color = "#333333";
		}

		if(lis.item(i).getElementsByTagName('span')[0] != null) {
			lis.item(i).getElementsByTagName('span')[0].style.visibility = "hidden";
		}
	}

	objLink.style.fontWeight = "bold";
	objLink.style.color = "#ff6600";
	objLink.nextSibling.style.visibility = "visible";
}

function pressReview(sImage, title, iWidth, iHeight)
{
	var windowHeight = iHeight;
	var windowWidth = iWidth+26;			//Addition wegen Fensterrand und resize
	
	sParameter = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,left=0,top=0,height='+windowHeight+',width='+windowWidth;
	if ( typeof openWin=="undefined" || openWin.closed ) {
		openWin = window.open("", "", sParameter);
	}
	
	openWin.resizeTo(windowWidth,windowHeight);
	openWin.document.open();
	openWin.document.writeln('<html><head>');
	openWin.document.writeln('<meta http-equiv=\"imagetoolbar\" content=\"no\" />');
	openWin.document.writeln('<title>' + title + '</title>');
	openWin.document.writeln('<style>html,body{margin: 0;}</style></head>');
	openWin.document.writeln('<body>');
	openWin.document.writeln('<img src="'+sImage+'" alt="'+title+'" />');
	openWin.document.writeln('</body></html>');
	openWin.document.close();
	openWin.focus();
}

function displayForms(that)
{
	//only for radio buttons
	if(that.type == 'radio') {
		var elementName = that.name;
		var elements = document.getElementsByName(elementName);
		
		for (var i=0; i<elements.length; i++) {
			var singleElementId = 'table-'+elements[i].id;
			var singleElement = document.getElementById(singleElementId);
			if (singleElement)
				singleElement.style.display = "none";
		}
	}

	//for radio buttons and checkboxes
	var elementId = 'table-'+that.id;
	var element = document.getElementById(elementId);
	if (element) {
		if(that.checked) {
			element.style.display = "block";
		} else {
			element.style.display = "none";
		}
	}
}

function getPos(id)
{
	var obj = document.getElementById(id);
	var pos = {left:0, top:0};

	if(typeof obj.offsetLeft != 'undefined') {

		while (obj) {
			pos.left += obj.offsetLeft;
			pos.top += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} else {
		pos.left = obj.left;
		pos.top = obj.top;
	}
	return pos;
}

function getPosObj(obj)
{
	var pos = {left:0, top:0};

	if(typeof obj.offsetLeft != 'undefined') {

		while (obj) {
			pos.left += obj.offsetLeft;
			pos.top += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} else {
		pos.left = obj.left;
		pos.top = obj.top;
	}
	return pos;
}

function getBottom(obj)
{
	var pos=getPosObj(obj);
	return pos.top+obj.offsetHeight;
}

function getBottomForId(id)
{
	var obj = document.getElementById(id);
	if (!obj)
		return 0;		
	var pos=getPos(id);
	return pos.top+obj.offsetHeight;
}

function setContentTDHeight(id)
{
	var iHeight = 149;			//-149 for Header Height + Breadcrumb Height
	if (getPos(id).top > parseInt(iHeight)) {
		document.getElementById('wrapper-content').style.height = getPos(id).top - iHeight + "px";
	}
}

function setContentTDHeightTeaser(id)
{
	var iHeight = getBottomForId("headline");	//-149 for Header Height + Breadcrumb Height
	if (iHeight<149) iHeight=149;
	if (getPos(id).top > parseInt(iHeight)) {
		document.getElementById('wrapper-content-teaser').style.height = getPos(id).top - iHeight + "px";
	}
	
	var lc=null;
	var childNodes=document.getElementById("wrapper-content").childNodes;
	for (i=0;i<childNodes.length;i++)
	{
		if (childNodes[i].nodeType==1)
			lc=childNodes[i];
	}
	var lcBottom = getBottom(lc);
	var middleBottom = getBottomForId("wrapper-content");
	var diff=middleBottom-lcBottom;
	var newHeight=middleBottom-getPosObj(lc).top;
	if (diff>1)
	{
		lc.style.height=newHeight+"px";	
	}
}


function setContentTDHeightHome(id)
{	
	var lc=null;
	var childNodes=document.getElementById("content").childNodes;
	for (i=0;i<childNodes.length;i++)
	{
		if (childNodes[i].nodeType==1)
			lc=childNodes[i];
	}
	var lcBottom = getBottom(lc);
	var middleBottom = getBottomForId("content");
	var diff=middleBottom-lcBottom;
	var newHeight=middleBottom-getPosObj(lc).top;
	if (diff>1)
	{
		lc.style.height=newHeight+"px";	
	}
}

function setPriceTDHeight(id)
{		
	var iWrapperDetail = getBottomForId("wrapper-content");
	var iPricePlaceholder = getBottomForId("price-pos");
	var diff = iWrapperDetail-iPricePlaceholder+17;
	
	if (diff > 1)
		document.getElementById('price-placeholder').style.height = diff+"px";
}

function addEvent( 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] );
		 }
		}
