
var xmlHttp

function leftnavpop(str)
{
if (str.length==0)
  { 
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/Scripts/leftnavmagic2.php";
url=url+"?q="+str;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("leftnavmagic").innerHTML=xmlHttp.responseText;
}
}

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 highlightwords(q){
	var highlightwords = "";
	if(q == "cc_slb" || q == "c_cb" || q == "st_slb" || q == "sv_c" || q == "sv_pf" || q == "st_sb" || q == "wt_sb"){
		document.getElementById("het").style.backgroundColor="yellow";
		document.getElementById("etn").style.backgroundColor="yellow";
		document.getElementById("hrt").style.backgroundColor="yellow";
		document.getElementById("hrn").style.backgroundColor="yellow";
		document.getElementById("manualpumpkits").style.backgroundColor="yellow";
		document.getElementById("aoh").style.backgroundColor="yellow";
		document.getElementById("hoses").style.backgroundColor="yellow";
	} else if(q == "m_cb" || q == "m_mt" || q == "m_f" || q == "p_fb" || q == "pv_fb" || q == "re_ch" || q == "re_pm" || q == "re_c" || q == "re_ch2" || q == "re_dp" || q == "re_fm") {
		document.getElementById("het").style.backgroundColor="yellow";
		document.getElementById("etn").style.backgroundColor="yellow";
		document.getElementById("hrt").style.backgroundColor="yellow";
		document.getElementById("hrn").style.backgroundColor="yellow";
		document.getElementById("manualpumpkits").style.backgroundColor="yellow";
		document.getElementById("aoh").style.backgroundColor="yellow";
	} else if(q == "gt_slb") {
		document.getElementById("het").style.backgroundColor="yellow";
		document.getElementById("etn").style.backgroundColor="yellow";
		document.getElementById("hrt").style.backgroundColor="yellow";
		document.getElementById("hrn").style.backgroundColor="yellow";
		document.getElementById("aoh").style.backgroundColor="yellow";
	} else if(q == "gt_lcb") {
		document.getElementById("rfb").style.backgroundColor="yellow";
		document.getElementById("engstuds").style.backgroundColor="yellow";
		document.getElementById("manualpumpkits").style.backgroundColor="yellow";
		document.getElementById("aoh").style.backgroundColor="yellow";
	} else if(q == "gt_tp") {
		document.getElementById("tb").style.backgroundColor="yellow";
		document.getElementById("ps").style.backgroundColor="yellow";
		document.getElementById("htc").style.backgroundColor="yellow";
		
	} else if(q == "gt_m" || q == "st_m") {
		document.getElementById("torqueandvibe").style.backgroundColor="yellow";
	} else if(q == "g_tp") {
		document.getElementById("tb").style.backgroundColor="yellow";
	} else if(q == "g_lcb") {
		document.getElementById("rfb").style.backgroundColor="yellow";
		document.getElementById("engstuds").style.backgroundColor="yellow";
		document.getElementById("manualpumpkits").style.backgroundColor="yellow";
		document.getElementById("aoh").style.backgroundColor="yellow";
	} else if(q == "re_tm") {
		document.getElementById("ps").style.backgroundColor="yellow";
		document.getElementById("torqueandvibe").style.backgroundColor="yellow";
		document.getElementById("vrd").style.backgroundColor="yellow";
	} else if(q == "rm_tp") {
		document.getElementById("tb").style.backgroundColor="yellow";
		document.getElementById("manualpumpkits").style.backgroundColor="yellow";
		document.getElementById("aoh").style.backgroundColor="yellow";
	} else if(q == "rm_br") {
		document.getElementById("het").style.backgroundColor="yellow";
		document.getElementById("etn").style.backgroundColor="yellow";
		document.getElementById("hrt").style.backgroundColor="yellow";
		document.getElementById("hrn").style.backgroundColor="yellow";
		document.getElementById("engstuds").style.backgroundColor="yellow";
		document.getElementById("manualpumpkits").style.backgroundColor="yellow";
		document.getElementById("aoh").style.backgroundColor="yellow";
	} else if(q == "sc_hm" || q == "wt_hm") {
		document.getElementById("htc").style.backgroundColor="yellow";
		document.getElementById("isc").style.backgroundColor="yellow";
		document.getElementById("pushers").style.backgroundColor="yellow";
		document.getElementById("pullers").style.backgroundColor="yellow";
		document.getElementById("plugs").style.backgroundColor="yellow";
		document.getElementById("laps").style.backgroundColor="yellow";
		document.getElementById("manualpumpkits").style.backgroundColor="yellow";
		document.getElementById("hoses").style.backgroundColor="yellow";
		document.getElementById("customfittings").style.backgroundColor="yellow";
	} else if(q == "sc_tp") {
		document.getElementById("tb").style.backgroundColor="yellow";
		document.getElementById("ps").style.backgroundColor="yellow";
		document.getElementById("torqueandvibe").style.backgroundColor="yellow";
		document.getElementById("vrd").style.backgroundColor="yellow";
	} else if(q == "st_lcb") {
		document.getElementById("het").style.backgroundColor="yellow";
		document.getElementById("hrn").style.backgroundColor="yellow";
		document.getElementById("rfb").style.backgroundColor="yellow";
		document.getElementById("manualpumpkits").style.backgroundColor="yellow";
		document.getElementById("aoh").style.backgroundColor="yellow";
		document.getElementById("hoses").style.backgroundColor="yellow";
	} else if(q == "wt_tm") {
		document.getElementById("tb").style.backgroundColor="yellow";
		document.getElementById("ps").style.backgroundColor="yellow";
	}		
	
}
function unhighlightwords(){
	document.getElementById("manualpumpkits").style.backgroundColor="";
	document.getElementById("aoh").style.backgroundColor="";
	document.getElementById("hoses").style.backgroundColor="";
	document.getElementById("tb").style.backgroundColor="";
	document.getElementById("ps").style.backgroundColor="";
	document.getElementById("htc").style.backgroundColor="";
	document.getElementById("isc").style.backgroundColor="";
	document.getElementById("het").style.backgroundColor="";
	document.getElementById("etn").style.backgroundColor="";
	document.getElementById("hrt").style.backgroundColor="";
	document.getElementById("hrn").style.backgroundColor="";
	document.getElementById("rfb").style.backgroundColor="";
	document.getElementById("pushers").style.backgroundColor="";
	document.getElementById("pullers").style.backgroundColor="";
	document.getElementById("plugs").style.backgroundColor="";
	document.getElementById("laps").style.backgroundColor="";
	document.getElementById("torqueandvibe").style.backgroundColor="";
	document.getElementById("vrd").style.backgroundColor="";
	document.getElementById("customfittings").style.backgroundColor="";
	document.getElementById("engstuds").style.backgroundColor="";
	
	
	
	
	document.getElementById("torqueandvib").style.backgroundColor="";
	document.getElementById("vrd").style.backgroundColor="";
	
	
	
	
}
function wordhighlight(aSourceObject, aWords){
	//Extract HTML Tags
	regexp=/<[^<>]*>/ig;
	vHTMLArray = aSourceObject.innerHTML.match(regexp);
	//Replace HTML tags
	vStrippedHTML = aSourceObject.innerHTML.replace(regexp,"$!$");
	
	//alert(vStrippedHTML);
	
	//Replace search words
	regexp= new RegExp ("(" + aWords + ")", "gi");
	vTemp = vStrippedHTML.replace(regexp,'<span class="highlight">$1</span>');
	
	//Reinsert HTML
	for(i=0;vTemp.indexOf("$!$") > -1;i++){
	vTemp = vTemp.replace("$!$", vHTMLArray[i]);
	}
	//Diaply Result
	aSourceObject.innerHTML = vTemp;
	//alert(vTemp);
}
function removehighlight2(aSourceObject){
	regexp=/(<span class\=highlight>)([^<>]*)(<\/span>)/ig;
	aSourceObject.innerHTML = aSourceObject.innerHTML.replace(regexp, "$2");
}
function showEnlargedImage(obj, type){
	setTimeout('showEnlargedImage2("' + obj + '","' + type + '")', 1500);
}
function showEnlargedImage2(obj, type) { //v6.0
  if(type == "show"){
  	document.getElementById(obj).style.visibility="visible";
  } else {
  	document.getElementById(obj).style.visibility="hidden";
  }
}
function openwin(imagename, urltoopen){
	urltoload = "homepage_pop.php?imagename="+imagename+"&urltoload="+urltoopen; 
	window.open(urltoload,"enlargedimage","width=400,height=400");
}