// JavaScript Document
calc = function(prodNum) {
	var total = prices[0];
	total += (document.getElementById("motion").value * prices[1]);
	total += (document.getElementById("vibration").value * prices[2]);
	total += (document.getElementById("door").value * prices[3]);
	total += (document.getElementById("bell").value * prices[4]);
	total += (document.getElementById("keypad").value * prices[5]);
	total += (document.getElementById("panic").value * prices[6]);
	total += (document.getElementById("smoke").value * prices[7]);
	if (prodNum==3) {
		total += (document.getElementById("floodDetectors").value * prices[8]);
	}
	document.getElementById("Total_Cost").innerHTML = ""+total+".00";
}






function getResults(what){
	xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
		
	var what = document.getElementById("what").options[document.getElementById("what").selectedIndex].value;
	
	if(document.getElementById("search-results").style.display != "block"){
	showMe('search-results')
	}

	var url="http://www.kentalarms.co.uk/panel/ajax/search.php";
	url=url+"?sid="+Math.random()
	url=url+"&what="+what
	xmlHttp.onreadystatechange=activeUpdate4;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)

}


function activeUpdate4() 
{ 
if (xmlHttp.readyState==4)
{ 

document.getElementById("search-results").innerHTML=xmlHttp.responseText;

}
}




function insertIt(valued, which, hider){
	
		var info = valued;
		var insert = which;
		var boxtohide = hider;
		document.getElementById(insert).value=info;
		
		hideBox(boxtohide); 		
}



function showHint5(str)
{
if (str.length==0)
  { 
  document.getElementById("txtHint5").innerHTML="";
  return;
  }
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="http://www.kentalarms.co.uk/ajax/getHintSearch.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged5;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged5() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("txtHint5").innerHTML=xmlHttp.responseText;
document.getElementById("txtHint5").style.display = "block";
}
}



