
window.onload = function() {
	if(document.getElementById("searchkeywords")) {
		document.getElementById("searchkeywords").focus();
	}
}


function setResultsValue(searchresultsdiv,imghostdiv)
{
    window.imghostdiv = imghostdiv;
    window.resultsdiv = searchresultsdiv;
}

var SrchxmlHttp;
var resultsdiv;
var imghostdiv;


function showHowTo(str,name,results,imghostdiv)
{ 

setResultsValue(results,imghostdiv)
document.getElementById(window.resultsdiv).innerHTML = "";

if (SrchxmlHttp != null && SrchxmlHttp.readyState != 0 && SrchxmlHttp.readyState != 4)
 {
   SrchxmlHttp.abort();
 }
 
 try
 {
   SrchxmlHttp = new XMLHttpRequest();
 } 
 catch (error)
 {
   try
   {
     SrchxmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
   }
   catch (error)
   {
     SrchxmlHttp = null;

     return false;
   }
 }
str=str.replace(/[%\^\?\!\*\/<>\$]/ig,"");		
str=str.replace(/^\s+/g,"").replace(/\s+$/g,"");

var url="http://www.toolkitsupport.co.uk/gethowto.asp"
url=url+"?keywords="+str
SrchxmlHttp.onreadystatechange=SearchStateChanged;
SrchxmlHttp.open("GET",url,true)
SrchxmlHttp.send(null)

}

function SearchStateChanged() 
{ 
if (SrchxmlHttp.readyState==4 || SrchxmlHttp.readyState=="complete")
{ 
 /* If the data was retrieved successfully */
   if (SrchxmlHttp.status == 200)
   {
     //document.getElementById(window.imghostdiv).style.display = "none";
	document.getElementById(window.imghostdiv).src= "http://www.toolkitsupport.co.uk/skin_images/searchimages/search_close.gif";

     document.getElementById(window.resultsdiv).innerHTML=SrchxmlHttp.responseText;
     //alert (SrchxmlHttp.responseText)
   }
   /* IE returns a status code of 0 on some occasions, so ignore this case */
   else if (SrchxmlHttp.status != 0)
   {
     document.getElementById(window.imghostdiv).style.display = "none";
     alert("There was an error whilst retrieving your results: " + SrchxmlHttp.statusText);
   } 
} 
else {
document.getElementById(window.imghostdiv).style.display = "block";
document.getElementById(window.imghostdiv).src= "http://www.toolkitsupport.co.uk/skin_images/searchimages/spinner.gif";
}
} 

function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}