function GetPrice(id)
{
	var ob = document.forms[0].elements["product"+id];//产品下拉表
	var obPrice = document.forms[0].elements["price"+id];//价格框
	var obQuantity = document.forms[0].elements["quan"+id];//数量框
	//var obPrice = document.forms[0].elements[ob.getAttribute("p")];
	//var obQuantity = document.forms[0].elements[ob.getAttribute("q")];
	var s = ob.value;
	if ( s != "" )
	{
		var n = s.indexOf("|",0);
		obPrice.value = s.substring(0,n);
		obQuantity.value = "1";
	}
	else
	{
		obPrice.value = "";
		obQuantity.value = "";
	}
	CalcSum();
}
function CalcSum()
{
	var nSum = 0;
	var p,n;
	var i;
	for(i=0;i<document.forms[0].elements.length;i++)
	{
		var ob = document.forms[0].elements[i];
		var s = ob.name.toString();
		if (s.substr(0,5)=="price")
		{
			var obQuantity = document.forms[0].elements["quan"+s.substr(5)];
			p = ob.value;
			n = obQuantity.value;
			if ( p.toString().length>0 && n.toString().length>0 )
			{
				if (IsInteger(p)&&IsInteger(n))
				{
					p = parseInt(p);
					n = parseInt(n);
					if ( isNaN(p)||isNaN(n) )
					{
						nSum = "####";
						break;
					}
					else
					{
						nSum = nSum+p*n;
					}
				}
				else
				{
					nSum = "####";
					break;
				}
			}
		}
	}
	document.forms[0].sum.value = nSum;
}
function IsInteger(str)
{
	var b = true;
	var v = str.toString();
	for (var i=0;i<v.length;i++)
	{
		var s = v.charAt(i).toString();
		if ( s!="0" )
			if ( !parseInt(v.charAt(i)) )
			{
				b = false;
				break;
			}
	}
	return b;
}
function ShowDialog(url,ob)
{
	var r = window.showModalDialog(url,ob.value,"dialogWidth:755px;dialogHeight:300px;scroll:yes;status:no;help:no");
	if (r!=null&&r.toString()!="")
	{
		ob.value = r;
	}
}
function InflateHeight(ob,step)
{
	var h = parseInt(ob.height);
	var newheight = parseInt(h+step);
	if (newheight<0)
		newheight = 0;
	ob.height = newheight;
}
function GoSubmit(url)
{
	document.forms[0].action = url;
	document.forms[0].target = "_blank";
	document.forms[0].submit();
}