// JavaScript Document
var req;
var divid;
function carat_calculate(prod_id,per_price)
	{
	//alert(prod_id);
	//alert(per_price);
	var txtid="caratqty"+prod_id;
	var qty=document.getElementById(txtid).value;
	var totprice=(qty*per_price)*100;
	totprice=Math.round(totprice);
	totprice=(totprice/100);
	divid="carat"+prod_id;
	//document.getElementById(divid).innerHTML="The requied price="+totprice;
	var req=createobj();
	var str="calc_carat.php?prod_id="+prod_id+"&totprice="+totprice ;			
	divid="carat"+prod_id;
	
					if(req)
						{
							
							req.onreadystatechange=ProcessRequestCarat;
							//alert(str);
							req.open("GET",str,true);
							//alert(divid);
							req.send(null);	
						}
					return false;
	
	
	
	
	}
function carat(prod_id)
	{
	// alert(prod_id);
	var req=createobj();
	var str="carat.php?prod_id="+prod_id ;			
	divid="carat"+prod_id;
	
					if(req)
						{
							
							req.onreadystatechange=ProcessRequestCarat;
							//alert(str);
							req.open("GET",str,true);
							//alert(divid);
							req.send(null);	
						}
					return false;
				
	}
function ProcessRequestCarat()
		{
			//alert(prod_id);alert(divid);
			if(req.readyState==4)
				{
					
						if(req.status==200)
						{
							document.getElementById(divid).innerHTML=req.responseText;
						}
				}
		}
	
	function createobj()
		{
		if(window.XMLHttpRequest)
						{
							req = new XMLHttpRequest();
						}
					if(window.ActiveXObject)
						{
							req = new ActiveXObject("Microsoft.XMLHTTP");
						}
				return req;
		}
