var xmlHttp;
var xmlHttp2;
var xmlHttp3;

{
var but2=new Array();
	but2[1] = new Image();
	but2[1].src = ("images/se_sl_bg.gif");
}

function disableEnterKey(e)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
          {showresults(document.getElementById("st").value,1,1,document.getElementById("so").value);
          return false;}
     else
		if (document.getElementById("st").className=="seputi")
			{document.getElementById("st").value="";
			document.getElementById("st").className="seput";}
     return true;
}

function setFocus()
{
document.getElementById("st").focus();
}

function advoo()
{
var v=document.getElementById("advp").innerHTML;
	if (v=="+")
		{
		document.getElementById("advp").innerHTML="-";
		document.getElementById("adv").style.display="";
		}
		else
		{
		document.getElementById("advp").innerHTML="+";
		document.getElementById("adv").style.display="none";
		}
}

function showresults(str,pge,typ,sor)
{
setFocus();
document.getElementById("product").value="";
if (document.getElementById("st").value!="Type your search here" || str!="Type your search here")
{
xmlHttp=GetXmlHttpObject();
if (typ==1)
{
document.getElementById("st").className="seput";
}
else
{
document.getElementById("st").className="seputi";
}
if (typ==2 || typ==3)
{
document.getElementById("st").value="";
}
else
{
document.getElementById("st").value=str;
}
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
document.getElementById("results").innerHTML="&nbsp;<br><table border="+'"'+"0"+'"'+" cellspacing="+'"'+"0"+'"'+" cellpadding="+'"'+"0"+'"'+" bgcolor="+'"'+"#FFFFFF"+'"'+"><tr><td valign="+'"'+"top"+'"'+" class="+'"'+"blef"+'"'+"><img src="+'"'+"images/tl.gif"+'"'+" border="+'"'+"0"+'"'+"></td><td rowspan="+'"'+"2"+'"'+"><table border="+'"'+"0"+'"'+" cellspacing="+'"'+"0"+'"'+" cellpadding="+'"'+"0"+'"'+"><tr><td class="+'"'+"btop"+'"'+" height="+'"'+"4"+'"'+"></td></tr><tr><td><table border="+'"'+"0"+'"'+" cellspacing="+'"'+"0"+'"'+" cellpadding="+'"'+"0"+'"'+"><tr><td align="+'"'+"center"+'"'+" height="+'"'+"100%"+'"'+" class="+'"'+"searching"+'"'+">SEARCHING</td></tr></table></td></tr><tr><td class="+'"'+"bbot"+'"'+" height="+'"'+"6"+'"'+"></td></tr></table></td><td class="+'"'+"brig"+'"'+" valign="+'"'+"top"+'"'+"><img src="+'"'+"images/tr.gif"+'"'+" border="+'"'+"0"+'"'+"></td></tr><tr><td valign="+'"'+"bottom"+'"'+" class="+'"'+"blef"+'"'+"><img src="+'"'+"images/bl.gif"+'"'+" border="+'"'+"0"+'"'+"></td><td valign="+'"'+"bottom"+'"'+" class="+'"'+"brig"+'"'+"><img src="+'"'+"images/br.gif"+'"'+" border="+'"'+"0"+'"'+"></td></tr></table>";
document.getElementById("details").innerHTML="";
if (str.length=="1")
{
document.getElementById("searchurl").innerHTML="<a href="+'"'+"mailto:?body=Below is a link to a search on The Keyboard Company's web site.%0A%0Ahttp://www.keyboardco.com/keyboard_search.asp%3FSR="+encodeURI(encodeURI(str))+"%26SG="+typ+"%26SP="+pge+"%26SS="+sor+"%0A%0AIf the link does not open in your web browser when clicked, open your web browser and paste the link into the address bar.&subject=Search results from The Keyboard Company"+'"'+"><image src="+'"'+"images/email_this_search.gif"+'"'+" border="+'"'+"0"+'"'+"></a>";
}
else
{
document.getElementById("searchurl").innerHTML="<a href="+'"'+"mailto:?body=Below is a link to a search for '"+str+"' products on The Keyboard Company's web site.%0A%0Ahttp://www.keyboardco.com/keyboard_search.asp%3FSR="+encodeURI(encodeURI(str))+"%26SG="+typ+"%26SP="+pge+"%26SS="+sor+"%0A%0AIf the link does not open in your web browser when clicked, open your web browser and paste the link into the address bar.&subject='"+str+"' products from The Keyboard Company"+'"'+"><image src="+'"'+"images/email_this_search.gif"+'"'+" border="+'"'+"0"+'"'+"></a>";
}
var url="search.asp";
url=url+"?q="+str;
if (str!='') {
url=url+"&p="+pge;
url=url+"&t="+typ; }
if (sor!=undefined) {
url=url+"&s="+sor; }
else {
url=url+"&s="+document.getElementById("so").value; }
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChangedS;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChangedS() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("results").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 showdetails(iid,cid,str,kbc)
{
if (document.getElementById("results").innerHTML.length!=8490000000)
{
var prev
if (document.getElementById("product")!=null)
{
prev=document.getElementById("product").value;
}
if (prev!=str) 
{
document.getElementById("product").value=str;
xmlHttp2=GetXmlHttpObject();
if (xmlHttp2==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
for (i=1;i<=10;i++)
	{
		if (i!=cid)
		{
			if (document.getElementById("I"+iid+"C"+i)!=null)
			{
			document.getElementById("I"+iid+"C"+i).className="se";
			}
		}
	}
if (document.getElementById("I"+iid+"C"+cid)!=null)
	{
	document.getElementById("I"+iid+"C"+cid).className="sehl";
	}
document.getElementById("details").innerHTML="<img src="+'"'+"images/350.gif"+'"'+" border="+'"'+"0"+'"'+"><br>&nbsp;<br><table border="+'"'+"0"+'"'+" cellspacing="+'"'+"0"+'"'+" cellpadding="+'"'+"0"+'"'+" bgcolor="+'"'+"#FFFFFF"+'"'+"><tr><td valign="+'"'+"top"+'"'+" class="+'"'+"blef"+'"'+"><img src="+'"'+"images/tl.gif"+'"'+" border="+'"'+"0"+'"'+"></td><td rowspan="+'"'+"2"+'"'+"><table border="+'"'+"0"+'"'+" cellspacing="+'"'+"0"+'"'+" cellpadding="+'"'+"0"+'"'+"><tr><td class="+'"'+"btop"+'"'+" height="+'"'+"4"+'"'+"></td></tr><tr><td><table border="+'"'+"0"+'"'+" cellspacing="+'"'+"0"+'"'+" cellpadding="+'"'+"0"+'"'+"><tr><td align="+'"'+"center"+'"'+" height="+'"'+"100%"+'"'+" class="+'"'+"searching"+'"'+">Retrieving data on<br>"+kbc+"</td></tr></table></td></tr><tr><td class="+'"'+"bbot"+'"'+" height="+'"'+"6"+'"'+"></td></tr></table></td><td class="+'"'+"brig"+'"'+" valign="+'"'+"top"+'"'+"><img src="+'"'+"images/tr.gif"+'"'+" border="+'"'+"0"+'"'+"></td></tr><tr><td valign="+'"'+"bottom"+'"'+" class="+'"'+"blef"+'"'+"><img src="+'"'+"images/bl.gif"+'"'+" border="+'"'+"0"+'"'+"></td><td valign="+'"'+"bottom"+'"'+" class="+'"'+"brig"+'"'+"><img src="+'"'+"images/br.gif"+'"'+" border="+'"'+"0"+'"'+"></td></tr></table>";
var url="details.asp";
url=url+"?q="+str;
url=url+"&c="+cid;
url=url+"&sid="+Math.random();
xmlHttp2.onreadystatechange=stateChangedD;
xmlHttp2.open("GET",url,true);
xmlHttp2.send(null);
}
}
else
{
pausecomp(100);
showdetails(iid,cid,str,kbc);
}
}


function stateChangedD()
{
if (xmlHttp2.readyState==4)
{ 
document.getElementById("details").innerHTML=xmlHttp2.responseText;
}
}

function showqs(str)
{
xmlHttp3=GetXmlHttpObject();
if (xmlHttp3==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var x;
var v;
var cha;
var pm = new Array();
var buts = "com,cat,lan,lanj,lans,mana,mank";
pm = (buts.split(","));
for (x in pm)
{
v=document.getElementById(pm[x]+"p").innerHTML;
	if (pm[x]==str)
	{
		if (v=="+")
		{
		document.getElementById(pm[x]+"p").innerHTML="-";
		cha=1;
		}
		else
		{
		document.getElementById(pm[x]+"p").innerHTML="+";
		document.getElementById(pm[x]).innerHTML="";
		cha=0;
		}
	}
	else
	{
	document.getElementById(pm[x]+"p").innerHTML="+";
	document.getElementById(pm[x]).innerHTML="";
	}
}
var url="qsterm.asp";
url=url+"?q="+str;
url=url+"&s="+cha;
url=url+"&sid="+Math.random();
xmlHttp3.onreadystatechange=function()
    {
    if(xmlHttp3.readyState==4)
      {
      document.getElementById(str).innerHTML=xmlHttp3.responseText;
      }
    }
xmlHttp3.open("GET",url,true);
xmlHttp3.send(null);
}

function stateChangedQ(str) 
{ 
if (xmlHttp3.readyState==4)
{ 
document.getElementById(str).innerHTML=xmlHttp3.responseText;
}
}

function pausecomp(millis) 
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); } 
while(curDate-date < millis);
}