function popupWindow(url)
{
    window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=YES,resizable=no,copyhistory=no,width=500,height=500,screenX=200,screenY=100,top=100,left=200')
}function total_price(price,quantity,id)
{	
	if(data_change(document.getElementById("product_price["+id+"]")))
	{
		grand_total=(document.getElementById("div_grand_total").innerHTML);
		initial_total=parseInt(document.getElementById("div_total"+id).innerHTML);
		new_total=quantity*price;
		new_grand_total=grand_total-initial_total+new_total;	
		document.getElementById("div_total"+id).innerHTML=new_total;
		document.getElementById("div_grand_total").innerHTML=new_grand_total;
		document.getElementById("grand_total").value=new_grand_total;
	}
	/*alert("GT="+grand_total+" IT="+initial_total+" NT="+new_total+" NGT="+new_grand_total);*/
}
			
			
function data_change(field)
 {
	  var check = true;
	  var value = field.value; //get characters
	  //check that all characters are digits, ., -, or ""
	  for(var i=0;i < field.value.length; ++i)
	  {
		   var new_key = value.charAt(i); //cycle through characters
		   if(((new_key < "0") || (new_key > "9")) && 
				!(new_key == ""))
		   {
				check = false;
				break;
		   }
	  }
	  //apply appropriate colour based on value
	  if(!check)
	  {
		   field.style.backgroundColor = "#ff7777";		   
		   return false;
	  }
	  else
	  {
		   field.style.backgroundColor = "white";
		   return true;
	  }
 }			


	

