var xmlHttp;







function http_1addToCart(productId,sizeId,cartPrice,cartQuantity){ 

	document.getElementById("cart").innerHTML = "[loading]...";


	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request");
		return;
	} 

	var url="_1cartAdd.php";
	url=url+"?productId="+productId+"&sizeId="+sizeId+"&cartPrice="+cartPrice+"&cartQuantity="+cartQuantity;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged ;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged() { 


	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		document.getElementById("cart").value=xmlHttp.responseText ;

	} 
}












function http_1deleteFromCart(index){ 

	document.getElementById("cartMessage").innerHTML = "[loading]...";


	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request");
		return;
	} 

	var url="_1cartDelete.php";
	url=url+"?index="+index;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged1 ;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged1() { 


	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		document.getElementById("cart").innerHTML=xmlHttp.responseText ;
		document.getElementById("cartMessage").innerHTML = "&nbsp;";


	} 
}

















function http_5VerifyCode(str)
{ 
	
	document.getElementById("antispam").value="[loading...]" ;

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 } 

var url="private/_5verifySpamCode.php";
url=url+"?codeCheck="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged2 ;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged2() 
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 

	document.getElementById("spamPass").value=xmlHttp.responseText ;
	if (document.getElementById("spamPass").value!==""){
		document.getElementById("antispam").value="Verified" ;
		document.getElementById("antispam").style.borderColor="";
		clearMessage();
		document.proceedForm.submit();		

	}else{

		document.getElementById("antispam").value="Incorrect, please re-enter" ;
		document.getElementById("antispam").style.borderColor="#ff0000";
		writeErrorMessage (" The code");

	}


 } 
}









function httpChangeCode(){ 
	
	document.getElementById("codePic").innerHTML="[loading...]" ;

	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request");
		return;
	} 

	var url="private/_5changeCodePic.php";
	url=url+"?nothing=1";
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged3 ;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged3(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 

	document.getElementById("codePic").innerHTML=xmlHttp.responseText ;

	document.getElementById("spamPass").value="";
	document.getElementById("antispam").value="[enter code on left]";

	} 
}









function httpMessage(message){ 
	
	document.getElementById("message1").innerHTML="[loading...]" ;

	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request");
		return;
	} 

	var url="private/_6getMessage.php";
	url=url+"?message="+message;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged4 ;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged4(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 

	document.getElementById("message1").innerHTML=xmlHttp.responseText ;


	} 
}











function httpLoadImage(img){ 
	
	document.getElementById("imageView").innerHTML="<h3>[loading...]</h3>" ;

	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request");
		return;
	} 

	var url="private/_6getImage.php";
	url=url+"?img="+img;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged5 ;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged5(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 

	document.getElementById("imageView").innerHTML=xmlHttp.responseText ;


	} 
}










//this function is commont to all of above
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;

}