<!--
var xmlHttp

function GetXmlHttpObject(){
	var xmlHttp=null;
	try{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}catch (e){
		// Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function getWidth(){
	var y;
	if(self.pageYOffset){
		y = self.pageYOffset;
	}else if(document.documentElement && document.documentElement.scrollTop){
		y = document.documentElement.scrollTop;
	}else if(document.body){
		y = document.body.scrollTop;
	}

	y = new Array('',y);
	return y;
}


function getPgSize(){
	var x, y;
	if(window.innerHeight && window.scrollMaxY){
		x = document.body.scrollWidth;
		y = window.innerHeight + window.scrollMaxY;
	}else if(document.body.scrollHeight > document.body.offsetHeight){
		x = document.body.scrollWidth;
		y = document.body.scrollHeight;
	}else{
		x = document.body.offsetWidth;
		y = document.body.offsetHeight;
	}
	
	var winX, winY;
	if(self.innerHeight){
		winX = self.innerWidth;
		winY = self.innerHeight;
	}else if(document.documentElement && document.documentElement.clientHeight){
		winX = document.documentElement.clientWidth;
		winY = document.documentElement.clientHeight;
	}else if(document.body){
		winX = document.body.clientWidth;
		winY = document.body.clientHeight;
	}
	
	// for small pages with total height less then height of the viewport
	if(y < x){
		var pgH = winY;
	}else{ 
		var pgH = y;
	}

	// for small pages with total width less then width of the viewport
	if(x < winX){
		var pgW = winX;
	}else{
		var pgW = x;
	}

	var PgSize = new Array(pgW,pgH,winX,winY);
	return PgSize;
}

function parseScript(_source) {
	var source = _source;
	var scripts = new Array();
		
	// Strip out tags
	while(source.indexOf("<script") > -1 || source.indexOf("</script") > -1){
		var s = source.indexOf("<script");
		var s_e = source.indexOf(">", s);
		var e = source.indexOf("</script", s);
		var e_e = source.indexOf(">", e);
//		alert("s_e: " + s_e + " e_e:" + e_e);
		// Add to scripts array
		scripts.push(source.substring(s_e+1, e));
		// Strip from source
		source = source.substring(0, s) + source.substring(e_e+1);
	}
	
	// Loop through every script collected and eval it
	for(var i=0; i<scripts.length; i++){
		alert(scripts[i]);
		try {
			eval(scripts[i]);
		}
		catch(ex) {
			// do what you want here when a script fails
		}
	}
		
	// Return the cleaned source
	return source;
}//end parseScript

function stateChanged(){
	if(xmlHttp.readyState==4 && xmlHttp.status==200){
		var pgSize = getPgSize();
		var wide = getWidth();

		document.getElementById('page-wrap').style.opacity = '.4';
		document.getElementById('page-wrap').style.filter = "alpha(opacity=40)";
		document.getElementById('popupwindow').style.display = 'block';
		document.getElementById('closeimg').style.display = 'block';
		if(navigator.appVersion.search("MSIE 6") > -1){
			 document.getElementById('ieframe').style.display = 'block';
		}

		var popW = parseInt(document.getElementById('popupwindow').style.width);
		var popH = parseInt(document.getElementById('popupwindow').style.height);

		document.getElementById('popupwindow').style.top = (wide[1] + ((pgSize[3] - 35 - popH) / 2) + 'px');
		document.getElementById("popupwindow").style.left = (((pgSize[0] - 20 - popW) / 2) + 'px');
		if(navigator.appVersion.search("MSIE 6") > -1){
			document.getElementById('ieframe').style.top = (wide[1] + ((pgSize[3] - 35 - popH) / 2) + 'px');
			document.getElementById("ieframe").style.left = (((pgSize[0] - 20 - popW) / 2) + 'px');
		}
		var poptop = wide[1] + ((pgSize[3] - 35 - popH) / 2);
		var popleft = ((pgSize[0] - 20 - popW) / 2);
		
		document.getElementById('popupwindow').style.top = (poptop < 0) ? "0px" : poptop + "px";
		document.getElementById("popupwindow").style.left = (popleft < 0) ? "0px" : popleft + "px";
		var imgtop = poptop;
		var imgleft = popleft+popW-18;
		document.getElementById('closeimg').style.top = (poptop < 0) ? "0px" : imgtop + "px";
		document.getElementById("closeimg").style.left = (popleft < 0) ? "0px" : imgleft + "px";
		if(navigator.appVersion.search("MSIE 6") > -1){
			document.getElementById('ieframe').style.top = (poptop < 0) ? "0px" : poptop + "px";
			document.getElementById("ieframe").style.left = (popleft < 0) ? "0px" : popleft + "px";
		}

		document.getElementById("popupwindow").style.width = popW + 'px';
		var result = xmlHttp.responseText;
		result=parseScript(result);
//		alert(result);
		document.getElementById("popupwindow").innerHTML=result;
	}
}

function closepopup(){
		document.getElementById('page-wrap').style.opacity = '1';
		document.getElementById('page-wrap').style.filter = "alpha(opacity=100)";
		document.getElementById('popupwindow').style.display = 'none';
		document.getElementById('ieframe').style.display = 'none';
		document.getElementById('closeimg').style.display = 'none';
}//end if

function popUp(url, winName, wid, hgt){
//	newwindow=window.open(URL, winName,'resizable=yes, width='+wid+', height='+hgt+', scrollbars=yes');
//	if(window.focus){newwindow.focus()}
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
		alert ("Your browser does not support AJAX!");
		return;
	}
	document.getElementById('popupwindow').style.width = wid + "px";
	document.getElementById('popupwindow').style.height = hgt + "px";

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}

function custompopUp(URL, name, width, height){
	newwindow=window.open(URL,name,'resizable=yes,width=' + width + ',height=' + height + ',scrollbars=yes');
	if(window.focus){newwindow.focus()}
}

function showTmold(){
	if(document.product2.Qualifier1.value == "t-mold(CTM)"){
		document.product2.Qualifier2.style.visibility="visible";
	}
	else{
		document.product2.Qualifier2.style.visibility="hidden";
		document.product2.Qualifier2.selectedIndex=0;
	}
}


var lrgimg = new Array();

function preloadimg(image, num){
	lrgimg[num]= new Image(); 
	lrgimg[num].src=image; 

}

function hoverdisplayon(image, text, num, hov){
//	lrgimg.src = image;
	ImgWidth=lrgimg[num].width;
	ImgHeight=lrgimg[num].height;

	if(hov == null){
		hdisplayimg=document.getElementById("hoverdisplayimg");
		hdisplay = document.getElementById("hoverdisplay");
	}else{
		hdisplayimg=document.getElementById("hoverdisplayimg"+hov);
		hdisplay = document.getElementById("hoverdisplay"+hov);
	}

	hdisplayimg.src=lrgimg[num].src;
	hdisplayimg.width=ImgWidth;
	hdisplayimg.height=ImgHeight;

	hdisplay.alt=text;

	hdisplay.style.position = "absolute";

	hdisplay.style.display="block";
	if(hov == null){
		document.getElementById("colortext").innerHTML=text;
	}else{
		document.getElementById("colortext"+hov).innerHTML=text;
	}
}

function hoverdisplayoff(hov){
	if(hov == null){
		document.getElementById("hoverdisplay").style.display="none";
		document.getElementById("colortext").innerHTML="";
	}else{
		document.getElementById("hoverdisplay"+hov).style.display="none";
		document.getElementById("colortext"+hov).innerHTML="";
	}
}

function showhide(area){
	if(document.getElementById(area).style.display == "none"){
		document.getElementById(area).style.display = "block";
	}else{
		document.getElementById(area).style.display = "none";
	}
}

function getformfield(formname, url){
    var parm = "?";
    for(i=0; i<formname.getElementsByTagName("input").length; i++){
		switch(formname.getElementsByTagName("input")[i].type){
			case "checkbox":
				if(formname.getElementsByTagName("input")[i].checked){
					parm += formname.getElementsByTagName("input")[i].name + "=" + formname.getElementsByTagName("input")[i].value + "&";
				}else{
					parm += formname.getElementsByTagName("input")[i].name + "=&";
				}
				break;
			case "radio":
				if(formname.getElementsByTagName("input")[i].checked){
					parm += formname.getElementsByTagName("input")[i].name + "=" + formname.getElementsByTagName("input")[i].value + "&";
				}
				break;
			default:
				parm += formname.getElementsByTagName("input")[i].name + "=" + formname.getElementsByTagName("input")[i].value + "&";
				break;
		}//end switch
	}//end for

    for(i=0; i<formname.getElementsByTagName("textarea").length; i++){
		parm += formname.getElementsByTagName("textarea")[i].name + "=" + formname.getElementsByTagName("textarea")[i].value + "&";
	}//end for

//	alert(parm);
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url+parm,true);
	xmlHttp.send(null);
}//end getformfield
function qa(div, q, e, p, c, s, pid){ 
//alert(str1);
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
		alert ("Your browser does not support AJAX!");
		return;
	}
//	alert(s + " " + l + " " + d + " " + w);
	var url="../include/questions-form.html";
	url=url+"?q="+q;
	url=url+"&e="+e;
	url=url+"&p="+p;
	url=url+"&div="+div;
	url=url+"&c="+c;
	url=url+"&pid="+pid
	if(s=="Y"){
		url=url+"&submit=Submit";
	}
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4){
			document.getElementById(div).innerHTML=xmlHttp.responseText;
		}else{
		}
	};
	xmlHttp.open("get",url,true);
	xmlHttp.send(null);
}
function switchtab(num){
	tab = new Array("0","1","2","3","4","6","7","9","10");
	for(x=0; x<tab.length; x++){
		if(document.getElementById('tab'+tab[x])){
			if(tab[x] != num){
				document.getElementById('tabtext'+tab[x]).style.display = "none";
				document.getElementById('tab'+tab[x]).className = "";
			}else{
				document.getElementById('tabtext'+tab[x]).style.display = "block";
				document.getElementById('tab'+tab[x]).className = "active";
			}
		}
	}
}
//-->

