<!--
/*====================================================================================================*/
function setHighlights() {
	xInputs=document.getElementsByTagName("input");
	for (i=0;i<xInputs.length;i++) {
		if (xInputs[i].type=="text") {
			xInputs[i].onfocus=function() {
					if (this.defaultValue==this.value) {
						this.select();
					}//end if ()
				}//end function
			xInputs[i].onmouseup=function(){return false};//because safari is special
		}//end if (xInputs[i].type=="text")
	}//next i<xInputs.length
	xTextAreas=document.getElementsByTagName("textarea");
	for (i=0;i<xTextAreas.length;i++) {
		xTextAreas[i].onfocus=function() {
				if (this.defaultValue==this.value) {
					this.select();
				}//end if ()
			}//end function
		xTextAreas[i].onmouseup=function(){return false};//because safari is special
	}//next i<xTextAreas.length
}//end function
/*====================================================================================================*/
function showemaillink() {
	var email="enquiries@trenchex.com"
	var subject="website%20enquiry"
	document.write ("<a href=mailto:" +email+ "?subject=" +subject+ ">" +email+ "</a>")
}//end function
/*====================================================================================================*/
var xmlhttp;
var xmlResponse;
var strPredictions;
var xs;
/*====================================================================================================*/
function LoadFile(url) {
	xmlhttp=null;
	if (window.XMLHttpRequest) {// Firefox, Opera, IE7
		xmlhttp=new XMLHttpRequest();
	} else if (window.ActiveXObject) {// IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}//end if (window.XMLHttpRequest)
	if (xmlhttp!=null) {
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}//end if (xmlhttp!=null)
	return xmlResponse;
}//end function
/*====================================================================================================*/
function FindParts(xSEARCHstr) {
	xRESULTdiv=document.getElementById("partsfound");
	if (xSEARCHstr.length>2) {
		xSEARCHstr=xSEARCHstr.replace("&", "[and]")
		LoadFile("/includes/ajaxsearch.asp?xSEARCHstr="+xSEARCHstr);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {// 4 = "loaded"
				if (xmlhttp.status==200) {// 200 = "OK"
					xmlResponse=xmlhttp.responseText;
					xRESULTdiv.innerHTML=xmlResponse;
				}//end if (xmlhttp.status==200)
			}//end if (xmlhttp.readyState==4)
		}//end function
	} else {
		xRESULTdiv.innerHTML="";
	}//end if (xSEARCHstr.length>2)
/*	xTable=document.getElementById("partlist");
	if (xTable) {
		xTRs=xTable.getElementsByTagName("tr");
		if (xTRs) {
			for (tr=1;tr<xTRs.length;tr++) {
				xFound=0;
				xTDs=xTRs[tr].getElementsByTagName("td");
				if (xTDs) {
					for (td=0;td<xTDs.length;td++) {
						if (xTDs[td].innerHTML.toLowerCase().indexOf(xSEARCHstr.toLowerCase())>-1) {
							xFound=1;							
						}//end if (xTDs[td].innerHTML.indexOf(xSEARCHstr)>-1)
					}//next td<xTDs.length
				}//end if (xTDs)
				if (xFound==1) {
					xTRs[tr].style.display="block";
				} else {
					xTRs[tr].style.display="none";
				}//end if (xFound==1)
			}//next tr<xTRs.length
		}//end if (xTRs)
	}//end if (xTable)
*/
}//end function
/*====================================================================================================*/
function PartSee(xPARTno) {
	xPARTsearch=document.getElementById("xPARTsearch");
	if (xPARTsearch) {
		xPARTsearch.value=xPARTno;
		FindParts(xPARTno);
	}//end if (xPARTsearch)
}//end function
/*====================================================================================================*/
function CopyAddress() {
	document.getElementById("xDELadd1").value=document.getElementById("xCUSTadd1").value;
	document.getElementById("xDELadd2").value=document.getElementById("xCUSTadd2").value;
	document.getElementById("xDELadd3").value=document.getElementById("xCUSTadd3").value;
	document.getElementById("xDELadd4").value=document.getElementById("xCUSTadd4").value;
	document.getElementById("xDELpostcode").value=document.getElementById("xCUSTpostcode").value;
}//end function
/*====================================================================================================*/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}
function addUnLoadEvent(func) {
	var oldonunload = window.onunload;
	if (typeof window.onunload != 'function') {
	  window.onunload = func;
	} else {
	  window.onunload = function() {
	    oldonunload();
	    func();
	  }
	}
}
addLoadEvent(setHighlights);
//window.onload=function() {
//	setHighlights();
//}//end function
/*====================================================================================================*/
-->
