// JavaScript Document
var xmlHttp=null;
function GetXmlHttpObject()
{
	try
 	{
	 	xmlHttp=new XMLHttpRequest();
 	}
	catch (e)
 	{
	 	try
	 	{
	  		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  	}
	 	catch (e)
	  	{
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  	}
	}
	return xmlHttp;
}
function console_Data(str)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
  	{
		alert ("Browser does not support HTTP Request")
  		return
  	} 
	xmlHttp.open("GET","drop_down_ajax.php?type="+str,true);
	xmlHttp.onreadystatechange=stateChanged1
	xmlHttp.send(null);	
}
function stateChanged1()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
		var resp=xmlHttp.responseText;
		document.getElementById("show_fault").innerHTML=resp;
	}
}

function fault_Data(str)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
  	{
		alert ("Browser does not support HTTP Request")
  		return
  	} 
	xmlHttp.open("GET","price_ajax.php?type="+str,true);
	xmlHttp.onreadystatechange=stateChanged2
	xmlHttp.send(null);	
}
function stateChanged2()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
		var resp=xmlHttp.responseText;
		var temp=resp.split("#");
		if(temp[0]=="temp")
		{
			document.getElementById("other").innerHTML=temp[1];
			document.getElementById("show_price").innerHTML="";
		}
		else
		{
			document.getElementById("show_price").innerHTML="&pound;"+resp;
			document.getElementById("price").value=resp;
			document.getElementById("other").innerHTML="";
		}
	}
}

function shipping_Data(str)
{
	if(str=="19.98")
	{
		document.getElementById("coll_date").style.display="block";
	}
	else
	{
		document.getElementById("coll_date").style.display="none";
	}
}

function shipping_Data2(str)
{
	if(str=="21.00")
	{
		document.getElementById("coll_date").style.display="block";
	}
	else
	{
		document.getElementById("coll_date").style.display="none";
	}
}

function screen_Data(str)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
  	{
		alert ("Browser does not support HTTP Request")
  		return
  	} 
	xmlHttp.open("GET","screen_price_ajax.php?type="+str,true);
	xmlHttp.onreadystatechange=stateChanged3
	xmlHttp.send(null);	
}
function stateChanged3()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
		var resp=xmlHttp.responseText;
		var temp=resp.split("#");
		if(temp[0]=="temp")
		{
			document.getElementById("other").innerHTML=temp[1];
			document.getElementById("show_price").innerHTML="";
		}
		else
		{
			var temp1=resp.split("-");
			if(temp1[1]=="Per Month")
			{
				document.getElementById("show_price").innerHTML="&pound;"+temp1[0]+" Per Month";
				document.getElementById("price").value=temp1[0];
			}
			else
			{
				document.getElementById("show_price").innerHTML="&pound;"+resp;
				document.getElementById("price").value=resp;
				document.getElementById("other").innerHTML="";
			}
		}
	}
}

function repair_Type(str)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
  	{
		alert ("Browser does not support HTTP Request")
  		return
  	} 
	xmlHttp.open("GET","screen_repair_type_ajax.php?type="+str,true);
	xmlHttp.onreadystatechange=stateChanged4
	xmlHttp.send(null);	
}
function stateChanged4()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
		var resp=xmlHttp.responseText;		
	}
}
