function addPerson(num,type)
{
	var a = parseInt(num);
	var result = "",tmpId="PersonList";
	var base = "<div style=\"line-height:20px\">{5} 删除乘机人</div><div style=\"line-height:30px\"><span class=\"yellow\">*</span>姓名：<input name=\"{0}\" class=\"re_search_input\" id=\"{0}\" style=\"vertical-align:middle\"><img style=\"margin-left: -22px\" src=\"../Themes/images/login/xiala.gif\" align=\"absMiddle\" />&nbsp;&nbsp;<span class=\"yellow\">*</span>证件:<select id=\"{1}\"style=\"vertical: middle; width: 90px\" name=\"{1}\"><option value=1 selected>身份证</option><option value=2>护照</option><option value=4>军人证</option><option value=5>回乡证</option><option value=6>同包证</option><option value=7>港澳通行证</option><option value=8>其他</option></select>&nbsp;&nbsp;证件号码：<input name=\"{2}\" class=\"re_search_input\" id=\"{2}\" style=\"vertical-align: middle; width: 130px\" />&nbsp;&nbsp;保险：<select id=\"{3}\" name=\"{3}\"><option value=0>0</option><option value=1 selected>1</option></select>份&nbsp;&nbsp;<input style=\"vertical-align: middle\" id=\"{4}\" name=\"{4}\" type=\"checkbox\" checked=\"checked\" value=\"1\" />保存名单</div>";
	for(var i=0;i<a;i++)
	{
		if(type == 2)
		{
			
			tmpStr = base.replace("{0}","CPerson"+i);
			tmpStr = tmpStr.replace("{1}","CCardType"+i);
			tmpStr = tmpStr.replace("{2}","CCardNo"+i);
			tmpStr = tmpStr.replace("{3}","CBiaoX"+i);
			tmpStr = tmpStr.replace("{4}","CPerSave"+i);
			tmpStr = tmpStr.replace("{5}","儿童");
			tmpId = "ChildList";
		}
		else if(type==1)
		{
			
			tmpStr = base.replace("{0}","Person"+i);
			tmpStr = tmpStr.replace("{1}","CardType"+i);
			tmpStr = tmpStr.replace("{2}","CardNo"+i);
			tmpStr = tmpStr.replace("{3}","BiaoX"+i);
			tmpStr = tmpStr.replace("{4}","PerSave"+i);
			tmpStr = tmpStr.replace("{5}","成人");
		}
		result += tmpStr;
	}
	GetPrice(num,type);
	if(num==0)
	{
		document.getElementById("ChildList").innerHTML = "";
	}
	else
	{
		document.getElementById(tmpId).innerHTML = result;
	}
}


function GetPrice(num,type)
{
	var AdultPrice=form1.AdultPrice.value;
	var ChildPrice=form1.ChildPrice.value;
	var TaxPrice=form1.BuildPrice.value;
	var OilPrice=form1.PetroPrice.value;
	if(type == 1)//成人
	{
		AdultPrice = parseInt(AdultPrice)*num;
		TaxPrice = parseInt(TaxPrice)*num;
		OilPrice = parseInt(OilPrice)*num;
		//显示信息
		document.getElementById("AduPrice").innerHTML = AdultPrice;//成人价格
		document.getElementById("AduNum").innerHTML = num;//成人数量
		
		document.getElementById("TaxPrice").innerHTML = TaxPrice;//机建
		document.getElementById("OilPrice").innerHTML = OilPrice;//燃油
		document.form1.TaxCost.value = TaxPrice;//机建
		document.form1.OilCost.value = OilPrice;//燃油
		document.form1.AdultNo.value = num;
		document.form1.AdultCost.value = AdultPrice;
	}
	else if(type == 2)//儿童
	{
		ChildPrice = parseInt(ChildPrice)*num;
		document.getElementById("ChiPrice").innerHTML = ChildPrice;	
		document.getElementById("ChiNum").innerHTML = num;
		document.form1.ChildNo.value = num;	
 		document.form1.ChildCost.value = ChildPrice;
	}
	document.getElementById("PriceTotal").innerText = parseInt(document.form1.ChildCost.value)+parseInt(document.form1.AdultCost.value)+parseInt(document.form1.TaxCost.value)+parseInt(document.form1.OilCost.value = OilPrice);
}


function chechForm()
{
	var pi = document.form1.AdultNo.value;
	var ci = document.form1.ChildNo.value;
	with(form1)
	{
		for(var i=0;i<pi;i++)
		{
			var p = eval("Person"+i);
			var c = eval("CardNo"+i);
			if(p.value == "")
			{
				alert("请填写乘机人姓名");
				p.focus();
				return;
			}
			if(c.value == "")
			{
				alert("请填写证件号码");
				c.focus();
				return;
			}
		}
		for(var i=0;i<ci;i++)
		{
			var p = eval("CPerson"+i);
			var c = eval("CCardNo"+i);
			if(p.value == "")
			{
				alert("请填写乘机人姓名");
				p.focus();
				return;
			}
			if(c.value == "")
			{
				alert("请填写证件号码");
				c.focus();
				return;
			}
		}
		if(LinkMan.value == "")
		{
			alert("请填写联系人姓名");
			LinkMan.focus();
			return;
		}
		if(Mobile.value == "")
		{
			alert("请填写联系人手机号码");
			Mobile.focus();
			return;
		}
		if(Email.value == "")
		{
			alert("请填写联系人邮箱地址");
			Email.focus();
			return;
		}
	}
	form1.submit();
}