function stateChangedQuestion()
{
	
	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
	document.getElementById("hantar").innerHTML=xmlHTML=xmlHttp.responseText
	}
}

function stateChangedReview()
{
	
	
	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
	document.getElementById("hantar").innerHTML=xmlHTML=xmlHttp.responseText
	}
}

function stateSearch()
{

	if((xmlHttp.readyState==4 || xmlHttp.readyState=="complete"))
	{
	document.getElementById("framework").innerHTML=xmlHTML=xmlHttp.responseText
	}
}

function searchitem(cari)
{
		var d = new Date();
		var randomnumber=Math.floor(Math.random()*101)+d.getTime();
		xmlHttp = GetXmlHttpObject();
		var url = "search.php";
		url=url+"?cari="+cari+"&random="+randomnumber;

		xmlHttp.onreadystatechange=stateSearch
		xmlHttp.open( "GET", url, true ); 
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); 
		xmlHttp.send(null);
	
}


function stateChangedShipping()
{
	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
	document.getElementById("shipping").innerHTML=xmlHTML=xmlHttp.responseText
	document.getElementById("shipping_cost").innerHTML=xmlHTML="0.00"
	document.getElementById("total").innerHTML=xmlHTML="0.00"
	var totalcost = document.getElementById("total_cost_hidden").value - document.getElementById("shipping_cost_hidden").value
	document.getElementById("total_cost_hidden").value = totalcost.toFixed(2);
	document.getElementById("shipping_cost_hidden").value="0.00"
	document.getElementById("total").innerHTML=xmlHTML= totalcost.toFixed(2); 
	}
}

function stateChangedShippingCost()
{
	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById("shipping_cost").innerHTML=xmlHTML=xmlHttp.responseText
		document.form.shipping_cost.value=xmlHTML=xmlHttp.responseText
	}
}

function stateChangedTotalCost()
{
	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById("total").innerHTML=xmlHTML=xmlHttp.responseText
		document.form.total_cost.value=xmlHTML=xmlHttp.responseText
	}
}

function stateChangedPaymentType()
{
	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
	document.getElementById("payment").innerHTML=xmlHTML=xmlHttp.responseText
	}
}




function checkpaymenttype(no)
{
	var d = new Date();
	var randomnumber=Math.floor(Math.random()*101)+d.getTime();
	xmlHttp = GetXmlHttpObject();
	var url = "cart/payment.php";
	url=url+"?no="+no+"&random="+randomnumber;
	xmlHttp.onreadystatechange=stateChangedPaymentType
	xmlHttp.open( "GET", url, true ); 
   	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); 
   	xmlHttp.send(null);
}

function checktotal(shipping,subtotal)
{
	var d = new Date();
	var randomnumber=Math.floor(Math.random()*101)+d.getTime();
	xmlHttp = GetXmlHttpObject();
	var url = "cart/total_cost.php";
	url=url+"?shipping="+shipping+"&subtotal="+subtotal+"&random="+randomnumber;
	xmlHttp.onreadystatechange=stateChangedTotalCost
	xmlHttp.open( "GET", url, true ); 
   	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); 
   	xmlHttp.send(null);
}


function checkshippingcost(no,subtotal)
{
	var d = new Date();
	var randomnumber=Math.floor(Math.random()*101)+d.getTime();
	xmlHttp = GetXmlHttpObject();
	var url = "cart/shipping_cost.php";
	url=url+"?no="+no+"&random="+randomnumber;
	xmlHttp.onreadystatechange=stateChangedShippingCost
	xmlHttp.open( "GET", url, true ); 
   	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); 
   	xmlHttp.send(null);
	//checktotal(no,subtotal)	
}

function checkshipping2(no,language_id)
{
	var d = new Date();
	var randomnumber=Math.floor(Math.random()*101)+d.getTime();
	xmlHttp = GetXmlHttpObject();
	if(document.form.delivery_country.options[document.form.delivery_country.selectedIndex].value == '')
	{
		var state = document.form.customers_country.options[document.form.customers_country.selectedIndex].value;
	}
	else
	{
		var state = document.form.delivery_country.options[document.form.delivery_country.selectedIndex].value;
	}
	
	var total = document.form.total_cost.value;
	
	var url = "cart/shipping_method.php";
	url=url+"?state="+no+"&no="+state+"&language_id="+language_id+"&total="+total+"&random="+randomnumber;
	
	xmlHttp.onreadystatechange=stateChangedShipping
	xmlHttp.open( "GET", url, true ); 
   	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); 
   	xmlHttp.send(null); 
}

function checkshipping(no,language_id)
{
	var d = new Date();
	var randomnumber=Math.floor(Math.random()*101)+d.getTime();
	xmlHttp = GetXmlHttpObject();
	if(document.form.delivery_state.options[document.form.delivery_state.selectedIndex].value == '')
	{
		var state = document.form.customers_state.options[document.form.customers_state.selectedIndex].value;
	}
	else
	{
		var state = document.form.delivery_state.options[document.form.delivery_state.selectedIndex].value;
	}
	
	var total = document.form.total_cost.value;
	
	var url = "cart/shipping_method.php";
	url=url+"?no="+no+"&state="+state+"&language_id="+language_id+"&total="+total+"&random="+randomnumber;
	xmlHttp.onreadystatechange=stateChangedShipping
	xmlHttp.open( "GET", url, true ); 
   	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); 
   	xmlHttp.send(null); 
}

function question(no,sec)
{
	var d = new Date();
	var randomnumber=Math.floor(Math.random()*101)+d.getTime();
	xmlHttp = GetXmlHttpObject();
	var url = "products/sendquestion.php";
	url=url+"?no="+no+"&sec="+sec+"&random="+randomnumber;
	xmlHttp.onreadystatechange=stateChangedQuestion
	xmlHttp.open( "GET", url, true ); 
   	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); 
   	xmlHttp.send(null); 
}

function email(no,sec)
{
	var d = new Date();
	var randomnumber=Math.floor(Math.random()*101)+d.getTime();
	xmlHttp = GetXmlHttpObject();
	var url = "products/emailfriend.php";
	url=url+"?no="+no+"&sec="+sec+"&random="+randomnumber;
	xmlHttp.onreadystatechange=stateChangedQuestion
	xmlHttp.open( "GET", url, true ); 
   	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); 
   	xmlHttp.send(null); 
}

function review(no,sec)
{
	var d = new Date();
	var randomnumber=Math.floor(Math.random()*101)+d.getTime();
	xmlHttp = GetXmlHttpObject();
	var url = "products/review.php";
	url=url+"?no="+no+"&sec="+sec+"&random="+randomnumber;
	xmlHttp.onreadystatechange=stateChangedReview
	xmlHttp.open( "GET", url, true ); 
   	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); 
   	xmlHttp.send(null); 
}


function sendquestion()
{
	
	var poststr = "name=" + encodeURI( document.getElementById("name").value ) +
                  "&email=" + encodeURI( document.getElementById("email").value ) + 
				  "&question=" + encodeURI( document.getElementById("question").value ) + 
				  "&no=" + encodeURI( document.getElementById("no").value );
				  
	var d = new Date();
	var randomnumber=Math.floor(Math.random()*101)+d.getTime();
	xmlHttp = GetXmlHttpObject();
	var url = "sendquestion.php";
	url=url+"?s=1&random="+randomnumber;
	http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);

}

function get(obj) {
      var poststr = "mytextarea1=" + encodeURI( document.getElementById("mytextarea1").value ) +
                    "&mytextarea2=" + encodeURI( document.getElementById("mytextarea2").value );
      makePOSTRequest('post.php', poststr);
   }

