var xmlHttp

function shs(str)
{ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
  		return;
  	}   
	//alert (str);
	var url="showhset.asp";
	url=url+"?q="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
 	{ 
  		document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
 	}
}

function hsets(i)
{ 
	xmlHttp=GetXmlHttpObject();	
	var url1=""
	var flag=0
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 

	//alert (str);
	var hsid=document.form1.hsid.value;
	url1=url1+"hsid="+hsid+"&"
	if( i=='1' )
	{ 
		var net1 = document.form1.selnet.selectedIndex; 
		var net = document.form1.selnet.options[net1].value;
		
		document.form1.seltariff.selectedIndex=0;
		document.form1.selline.selectedIndex=0; 
		document.form1.selcont.selectedIndex=0; 
		url1=url1+"net="+net+"&"	
	}
		
	if( i=='2' )
	{ 
		var tariff1 = document.form1.seltariff.selectedIndex; 
		var tariff = document.form1.seltariff.options[tariff1].value;
			
		document.form1.selnet.selectedIndex=0; 
		document.form1.selline.selectedIndex=0; 
		document.form1.selcont.selectedIndex=0;
		url1=url1+"tariff="+tariff+"&"	  
	}

	if( i=='3' )
	{ 
		var line1 = document.form1.selline.selectedIndex; 
		var line = document.form1.selline.options[line1].value;
		
		document.form1.selnet.selectedIndex=0;
		document.form1.seltariff.selectedIndex=0; 
		document.form1.selcont.selectedIndex=0;
		url1=url1+"line="+line+"&"	  
	}

	if( i=='4' )
	{ 
		var contract1 = document.form1.selcont.selectedIndex; 
		var contract = document.form1.selcont.options[contract1].value;
			
		document.form1.selnet.selectedIndex=0;
		document.form1.seltariff.selectedIndex=0; 
		document.form1.selline.selectedIndex=0;
		url1=url1+"contract="+contract+"&"	  
	}
		
	var url="script/handsetajaxdeals.asp";
	showLoading();
	url=url+"?"+url1+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=stateChanged1;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function showLoading() 
{ 
	document.getElementById("dealTab").innerHTML="<table><tr><td align='center'><img src='http://www.bestcontractmobilephonedeal.co.uk/images/loading.gif'></br><br></td></tr></table>";
}

function stateChanged1() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("dealTab").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;
}
