// JavaScript Document
function add_to_cart(pkid,typ)
{

	Form = document.createElement("form");
	Form.name = "frm";
	Form.id = "frm";
	
	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "pkid";
	Input.id = "pkid";
	Input.value = pkid;
	Form.appendChild(Input);

if(typ=="A")
	var e="ADurId_"+pkid
else
	var e="DurId_"+pkid

var f=document.getElementById(e).options[document.getElementById(e).selectedIndex].value;

	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "DurId";
	Input.id = "DurId";
	Input.value = f;
	Form.appendChild(Input);
	
	document.body.appendChild(Form);
	Form.action = "add_cart.asp";
	Form.method="post"
	Form.submit();
}



function view_cart(CtId,Chk)
{
	Form = document.createElement("form");
	Form.name = "frm";
	Form.id = "frm";
	
	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "CtId";
	Input.id = "CtId";
	Input.value = CtId;
	Form.appendChild(Input);

	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "Chk";
	Input.id = "Chk";
	Input.value = Chk;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "shopping-cart.asp";
	Form.method="post"
	Form.submit();
}


function remove_cart(CtId,PkId)
{
 	var VarChoic = confirm("Are you sure!.. want to delete");
	if(VarChoic)
	{
	
	Form = document.createElement("form");
	Form.name = "frm";
	Form.id = "frm";
	
	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "CtId";
	Input.id = "CtId";
	Input.value = CtId;
	Form.appendChild(Input);

	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "PkId";
	Input.id = "PkId";
	Input.value = PkId;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "remove_cart.asp";
	Form.method="post"
	Form.submit();
	}
}




function addme()
{
Para=GetPara()
if(Para)
{	
	Form = document.createElement("form");
	Form.name = "frm";
	Form.id = "frm";
	
	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "UrName";
	Input.id = "UrName";
	Input.value = document.getElementById("UrName").value;
	Form.appendChild(Input);

	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "UrComp";
	Input.id = "UrComp";
	Input.value = document.getElementById("UrComp").value;
	Form.appendChild(Input);
	
	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "UrEmail";
	Input.id = "UrEmail";
	Input.value = document.getElementById("UrEmail").value;
	Form.appendChild(Input);

	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "UrPh";
	Input.id = "UrPh";
	Input.value = document.getElementById("UrPh").value;
	Form.appendChild(Input);

	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "UrAdd";
	Input.id = "UrAdd";
	Input.value = document.getElementById("UrAdd").value;
	Form.appendChild(Input);
	
	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "UrCity";
	Input.id = "UrCity";
	Input.value = document.getElementById("UrCity").value;
	Form.appendChild(Input);	

	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "CtId";
	Input.id = "CtId";
	Input.value = document.getElementById("CtId").value;
	Form.appendChild(Input);		

	document.body.appendChild(Form);
	Form.action = "add_user.asp";
	Form.method="post"
	Form.submit();
}	
}


function addme1()
  {	
		Para=GetPara()
		if(Para)
		{
			objXMLHttpRequest.onreadystatechange=addme_Output;
			var Url = "add_user.asp";
			objXMLHttpRequest.open("POST",Url,true);
			objXMLHttpRequest.setRequestHeader("Host","localhost");
			objXMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			objXMLHttpRequest.setRequestHeader("Content-Length","12");
			objXMLHttpRequest.send(Para); 
  		}
  }
  
function addme_Output()
  {
	if(objXMLHttpRequest.readyState == "4" )	
	{
		var MsgDet = objXMLHttpRequest.responseText.split("*");
		document.getElementById("a").innerHTML = objXMLHttpRequest.responseText
//alert(objXMLHttpRequest.responseText)
		if(parseInt(MsgDet[1])==1)
			document.location.href="thanks.asp?output=1"
		else if(parseInt(MsgDet[1])==2)
			document.location.href="shopping-cart.asp?output=2"
		else
			document.location.href="shopping-cart.asp?output=2"

	}
}  
  
  
function view_order(OdId)
{
	
	Form = document.createElement("form");
	Form.name = "frm";
	Form.id = "frm";
	
	Input = document.createElement("input");	
	Input.type = "hidden";
	Input.name = "OdId";
	Input.id = "OdId";
	Input.value = OdId;
	Form.appendChild(Input);

	document.body.appendChild(Form);
	Form.action = "quote-confirmation.asp";
	Form.method="post"
	Form.submit();
}

function paypal_submit()
{
	document.paypal_ph.submit();
}
		