



function QueryDistance(from,to){
  d0=new Array("北京")
  d1=new Array("天津",118)
  d2=new Array("锦州", 483, 470)
  d3=new Array("沈阳", 717, 704, 234)
  d4=new Array("长春", 1032, 1019, 549, 315)
  d5=new Array("哈尔滨", 1392, 1379, 909, 675, 360)
  d6=new Array("齐齐哈尔", 1739, 1726, 1256, 1022, 707, 347)
  d7=new Array("牡丹江", 1582, 1569, 1099, 865, 550, 344, 691)
  d8=new Array("吉林", 1142, 1129, 659, 425, 110, 250, 597, 440)
  d9=new Array("丹东", 965, 962, 482, 285, 600, 930, 1277, 1048, 680)
  d10=new Array("大连", 903, 890, 420, 419, 734, 1094, 1441, 1284, 844, 323)
  d11=new Array("济南", 457, 347, 817, 1051, 1366, 1726, 2073, 1916, 1476, 1299, 1237)
  d12=new Array("青岛", 832, 722, 1192, 1426, 1741, 2101, 2448, 2291, 1851, 1674, 1612, 375)
  d13=new Array("徐州", 787, 677, 1147, 1381, 1696, 2056, 2403, 2246, 1806, 1629, 1567, 330, 424)
  d14=new Array("合肥", 1106, 996, 1466, 1700, 2015, 2375, 2732, 2565, 2125, 1948, 1886, 649, 743, 319)
  d15=new Array("南京", 1141, 1031, 1501, 1735, 2050, 2410, 2757, 2600, 2160, 1983, 1921, 684, 657, 354, 162)
  d16=new Array("上海", 1490, 1380, 1850, 2084, 2399, 2759, 3106, 2949, 2509, 2332, 2270, 1033, 1006, 703, 511, 349)
  d17=new Array("杭州", 1493, 1383, 1853, 2087, 2402, 2762, 3109, 2952, 2512, 2335, 2273, 1036, 1009, 706, 514, 352, 213)
  d18=new Array("南昌", 1609, 1499, 1969, 2203, 2518, 2878, 3225, 3068, 2628, 2451, 2389, 1152, 1246, 822, 503, 665, 837, 624)
  d19=new Array("福州", 2257, 2147, 2617, 2851, 3166, 3256, 3873, 3716, 3276, 3099, 3037, 1800, 1773, 1491, 1172, 1116, 1107, 894, 725)
  d20=new Array("石家庄", 279, 333, 762, 996, 1311, 1671, 2018, 1861, 1421, 1244, 1182, 314, 689, 635, 954, 989, 1338, 1341, 1406, 2131)
  d21=new Array("郑州", 722, 734, 1204, 1438, 1753, 2113, 2460, 2303, 1863, 1686, 1624, 434, 809, 392, 649, 746, 1095, 1098, 963, 1688, 443)
  d22=new Array("武汉", 1253, 1193, 1663, 1897, 2212, 2572, 2919, 2762, 2322, 2145, 2083, 893, 1151, 727, 512, 674, 919, 875, 432, 1157, 974, 531)
  d23=new Array("长沙", 1645, 1585, 2055, 2289, 2604, 2964, 3311, 3154, 2714, 2537, 2475, 1285, 1543, 1119, 904, 1066, 1223, 1010, 405, 1130, 1366, 923, 392)
  d24=new Array("株洲", 1686, 1626, 2096, 2330, 2645, 3005, 3352, 3195, 2755, 2578, 2516, 1326, 1584, 1160, 867, 1029, 1182, 969, 364, 1089, 1407, 964, 433, 41)
  d25=new Array("广州", 2478, 2374, 2844, 3078, 3393, 3753, 4100, 3943, 3503, 3326, 3264, 2027, 2121, 1697, 1378, 1540, 1653, 1440, 875, 985, 2199, 1756, 1225, 833, 796)
  d26=new Array("深圳", 2639, 2535, 3005, 3239, 3554, 3914, 4261, 4104, 3664, 3487, 3425, 2188, 2282, 1858, 1539, 1701, 1814, 1512, 1036, 880, 2360, 1917, 1386, 994, 954, 161)
  d27=new Array("柳州", 2399, 2339, 2809, 3043, 3358, 3718, 4055, 3908, 3468, 3291, 3229, 2039, 2297, 1873, 1603, 1765, 1937, 1724, 1100, 1593, 2120, 1677, 1146, 754, 736, 700, 861)
  d28=new Array("南宁", 2657, 2597, 3067, 3301, 3616, 3976, 4323, 4166, 3726, 3549, 3487, 2297, 2555, 2131, 1861, 2023, 2195, 1982, 1358, 1714, 2378, 1935, 1404, 1012, 994, 729, 890, 258)
  d29=new Array("桂林", 2190, 2130, 2600, 2834, 3149, 3509, 3856, 3699, 3259, 3082, 3020, 1830, 2088, 1644, 1394, 1556, 1728, 1515, 891, 1565, 1911, 1468, 937, 545, 527, 672, 833, 209, 467)
  d30=new Array("西安", 1224, 1276, 1707, 1941, 2256, 2616, 1963, 2806, 2366, 2189, 2127, 976, 1351, 934, 987, 1149, 1498, 1501, 1298, 2023, 945, 542, 866, 1200, 1241, 2033, 2194, 2082, 2073, 2147)
  d31=new Array("兰州", 1782, 1837, 2265, 2499, 1814, 3122, 3276, 3364, 2924, 2747, 2685, 1667, 2042, 1625, 1678, 1840, 2189, 2192, 1989, 2714, 1504, 1233, 1557, 1891, 1932, 2724, 2885, 2448, 2439, 2563, 691)
  d32=new Array("西宁", 2006, 2061, 2489, 2723, 3038, 3346, 3500, 3588, 3148, 2971, 2909, 1891, 2266, 1849, 1902, 2064, 2413, 2416, 2213, 2938, 1728, 1457, 1781, 2115, 2156, 2948, 3109, 2672, 2663, 2787, 915, 224)
  d33=new Array("乌鲁木齐", 3820, 3875, 4303, 4537, 4852, 5160, 5314, 5402, 4962, 4785, 4723, 3705, 4080, 3663, 3716, 3878, 4227, 4230, 4027, 4752, 3542, 3271, 3595, 3929, 3970, 4762, 4923, 4486, 4477, 4601, 2729, 2038, 1824)
  d34=new Array("拉萨", 3896, 3951, 4379, 4613, 4928, 5236, 5390, 5478, 5038, 4861, 4799, 3781, 4156, 3739, 3792, 3954, 4303, 4306, 4074, 4799, 3618, 3347, 3642, 3902, 3895, 403, 4192, 3560, 3302, 3730, 2805, 2114, 1890, 2650)
  d35=new Array("成都", 2161, 2213, 2644, 2878, 3193, 3553, 3900, 3743, 3303, 3126, 3064, 1913, 2288, 1871, 2004, 2166, 2411, 2367, 1924, 2649, 1882, 1479, 1492, 1752, 1793, 2200, 2361, 1500, 1491, 1615, 937, 1084, 1308, 3122, 2150)
  d36=new Array("重庆", 2136, 2188, 2619, 2853, 3168, 3528, 3875, 3718, 3278, 3101, 3039, 1888, 2263, 1846, 1743, 1905, 2150, 2106, 1760, 2485, 1857, 1454, 1231, 1355, 1396, 1870, 2031, 1170, 1161, 1285, 912, 1278, 1502, 3316, 2547, 340)
  d37=new Array("贵阳", 2618, 2630, 3100, 3334, 3649, 4009, 4356, 4199, 3759, 3582, 3520, 2270, 2528, 2104, 1806, 1968, 2121, 1908, 1303, 2028, 2339, 1896, 1377, 957, 939, 1359, 1520, 659, 650, 774, 1423, 1789, 2013, 3827, 2956, 841, 511)
  d38=new Array("昆明", 3228, 3280, 3711, 3945, 4260, 4620, 4967, 4810, 4370, 4193, 4131, 2907, 3165, 2741, 2471, 2633, 2786, 2573, 1968, 2691, 2949, 2546, 2014, 1622, 1604, 1706, 1867, 1235, 977, 1444, 2004, 2178, 2402, 4216, 2325, 1094, 1092, 714)
  d39=new Array("太原", 503, 557, 986, 1220, 1535, 1895, 2242, 2085, 1645, 1468, 1406, 538, 913, 859, 1144, 1213, 1562, 1565, 1458, 2183, 224, 495, 1026, 1418, 1459, 2251, 2412, 2172, 2430, 1963, 721, 1280, 1504, 3318, 3808, 1658, 1632, 2144, 2725)
  d40=new Array("呼和浩特", 578, 696, 1061, 1295, 1610, 1918, 2072, 2160, 1700, 1543, 1481, 1035, 1410, 1365, 1684, 1719, 2068, 2071, 2047, 2772, 813, 1084, 1615, 2007, 2048, 2840, 3001, 2761, 3019, 2552, 1152, 1204, 1428, 3242, 4239, 2089, 2064, 2575, 3156, 589)
  d41=new Array("银川", 1253, 1371, 1736, 1970, 2285, 2593, 2747, 2835, 2375, 2218, 2156, 1433, 1808, 1598, 1667, 1829, 2178, 2181, 1978, 2703, 1119, 1206, 1546, 1880, 1921, 2713, 2874, 2762, 2753, 2827, 680, 529, 753, 2567, 2643, 1613, 1592, 2103, 2684, 895, 675)
  d42=new Array("二连浩特", 710, 828, 999, 1201, 1236, 1526, 1569, 1786, 1346, 1455, 1459, 1167, 1542, 1497, 1816, 1851, 2200, 2203, 2395, 3120, 989, 1432, 1963, 2355, 2396, 3188, 3349, 3109, 3367, 2900, 1568, 1620, 1844, 3658, 3734, 2505, 2480, 2991, 3572, 1005, 416, 1091)
  ds=new Array(d0,d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,d20,d21,d22,d23,d24,d25,d26,d27,d28,d29,d30,d31,d32,d33,d34,d35,d36,d37,d38,d39,d40,d41,d42);
  
  
  var From;
  var To;
  
  for(var i=0;i<ds.length;i++)
  {
  	var temp =ds[i][0];  
  	if(temp==from)
  	{
  		From=i;
  	}
  	
  	if(temp==to)
  	{
  		To=i;
  	}
  	
  	
  }
  
  if (From>To)
	{
		tmp=To
		To=From
		From=tmp
	}
  if (From==To){
	tmp=0
	}
  else {
		  if(From==null||To==null)
		  {
		  	tmp=-1;
		  }else
		  {
		  		tmp=(ds[To])[From+1];
		  }
	
	}
  return tmp;
}






function show(str){
	if (str == "Single"){ 		
		document.all("flightDate1").style.display="none";
        document.all("avvCity1").style.display="none";
	}
	if(str == "Double"){
        document.all("flightDate1").style.display="";
        document.all("avvCity1").style.display="none";
	}
	if(str == "Mult"){
        document.all("flightDate1").style.display="";
        document.all("avvCity1").style.display="";
	}
}

function wait()
{
	document.all("wait").style.display="";
    document.all("chaxun").style.display="none";
}
function indexsubForm(){
	//document.forms[0].action="planeQuery.do?menuId=3";
    var date = new Date();
	//var month = 
	var str = date.getYear()+"-"+date.getMonth()+"-"+date.getDay();
	var obj = document.forms[0];	
	
	if(obj.startCity.value == ""){
		alert("出发城市不能为空！");
		return ;
	}
	if(obj.startDate1.value == ""){
		alert("出发日期不能为空！");
		return;
	}
	//alert("cc");
	if(!chkDate(obj.startDate1.value)){
        //alert("出发日期不能为空！");
		return;
	}
	//alert("aaaa");
	if(AddzeroToDate(obj.startDate1.value) < AddzeroToDate(str)){
		alert("出发日期不能小于当天！");
		return;
	}
	//alert("bbb");
	if(obj.arriveCity.value == ""){
		alert("到达城市不能为空！");
		
		return;
	}
//	alert(obj.cfcs.value);
	//alert(obj.zzcs.value);	
//	alert(obj.ddcs.value);
	
	//alert(QueryDistance(obj.cfcs.value,obj.ddcs.value));
	
	
	if(obj.startDate2.value == "" && !obj.flightWay[0].checked){
		alert("出发时间不能为空");
		return;
	}
	if(!obj.flightWay[0].checked && !chkDate(obj.startDate2.value)){
        //alert("出发日期不能为空！");
		return;
	}
	if(!obj.flightWay[0].checked && (AddzeroToDate(obj.startDate2.value) < AddzeroToDate(str))){
		alert("出发日期不能小于当天！");
		return;
	}
	if(obj.arriveCity2.value == ""&&obj.flightWay[2].checked){
		alert("目的城市2不能为空！");
		//obj.arriveCity2.focus();
		return;
	}
		
	if(obj.startCity.value == obj.arriveCity.value){
		slert("出发城市和到达城市不能相同！");
		return;
	}
	if(obj.sendCity.value==""){
		//obj.sendCity.value=obj.startCity.value;
		obj.sendCity.value=obj.cfcs.value;
	}

	if(obj.flightWay[0].checked||obj.flightWay[1].checked)
	{
		obj.action="planeQuery.do?menuId=3&distance1="+QueryDistance(obj.cfcs.value,obj.ddcs.value);
	}
	
	if(obj.flightWay[2].checked)
	{
		obj.action="planeQuery.do?menuId=3&distance1="+QueryDistance(obj.cfcs.value,obj.zzcs.value)+"&distance2="+QueryDistance(obj.zzcs.value,obj.ddcs.value);
	}	
	//alert(obj.action);
	
	obj.submit();
}
function subForm(){
	var date = new Date();
	//var month = 
	var str = date.getYear()+"-"+date.getMonth()+"-"+date.getDay();
	var obj = document.forms[0];		  
	if(obj.startCity.value == ""){
		alert("出发城市不能为空！");
		return;
	}
	if(obj.startDate1.value == ""){
		alert("出发日期不能为空！");
		return;
	}
	//alert("cc");
	if(!chkDate(obj.startDate1.value)){
        //alert("出发日期不能为空！");
		return;
	}
	//alert("aaaa");
	if(AddzeroToDate(obj.startDate1.value) < AddzeroToDate(str)){
		alert("出发日期不能小于当天！");
		return;
	}
	//alert("bbb");
	if(obj.arriveCity.value == ""){
		alert("到达城市不能为空！");
		return;
	}
	
	if(obj.startDate2.value == "" && !obj.flightWay[0].checked){
		alert("出发时间不能为空");
		return;
	}
	if(!obj.flightWay[0].checked && !chkDate(obj.startDate2.value)){
        //alert("出发日期不能为空！");
		return;
	}
	if(!obj.flightWay[0].checked && (AddzeroToDate(obj.startDate2.value) < AddzeroToDate(str))){
		alert("出发日期不能小于当天！");
		return;
	}
	if(obj.arriveCity2.value == ""&&obj.flightWay[2].checked){
		alert("目的城市2不能为空！");
		//obj.arriveCity2.focus();
		return;
	}
	if(obj.startCity.value == obj.arriveCity.value){
		slert("出发城市和到达城市不能相同！");
		return;
	}
	//if(obj.sendCity.value==""){
	//	obj.sendCity.value=obj.startCity.value;
	//}
	
		//alert(obj.cfcs.value);
	//alert(obj.zzcs.value);	
	//alert(obj.ddcs.value);
	
	
	
	
	
	if(obj.flightWay[0].checked||obj.flightWay[1].checked)
	{
		obj.action="planeQuery.do?menuId=3&distance1="+QueryDistance(obj.cfcs.value,obj.ddcs.value);
	}
	
	if(obj.flightWay[2].checked)
	{
		obj.action="planeQuery.do?menuId=3&distance1="+QueryDistance(obj.cfcs.value,obj.zzcs.value)+"&distance2="+QueryDistance(obj.zzcs.value,obj.ddcs.value);
	}	
	
	wait();
	document.forms[0].submit();
	setTimeout("timeout();",60000);
}

function timeout(){
	var t =confirm("可能与远程数据库查询超时，你想取消这次查询吗？");
	if(t==1)	{
		window.location='planeQuery.do?menuId=3';
	}
}

function showTr(str,objtr){
	var obj = eval("goListtr"+str);
	//alert(obj);
	if(obj.style.display == "none"){
		obj.style.display = "";
		objtr.style.cssText = "background-color:#99CCFF";
	}else{
		obj.style.display = "none";
		objtr.style.cssText="background-color:#FFFFFF";
	}
	
}   
function showbackTr(str,objtr){
	var obj = eval("backListtr"+str);
	//alert(obj);
	if(obj.style.display == "none"){
		obj.style.display = "";
		objtr.style.cssText = "background-color:#99CCFF";
	}else{
		obj.style.display = "none";
		objtr.style.cssText="background-color:#FFFFFF";
	}
}
function submitAirForm(){
	//alert(document.forms[0].radio1);
	var radio1 = document.forms[0].radio1;
	if(!radio1){
         alert("没有前往机票！请重新选择！");
		 return;
	}
	var radio1Length = document.forms[0].radio1.length;
	var radio1Check =0;
	//var radioCheck = 0;
	var type = document.forms[0].flightType.value;
	for(var i = 0; i < radio1Length; i++){
		if( radio1[i].checked ){
            radio1Check++;
			break;
		}
	}
	if(radio1Check == 0 ){
		alert("请选择机票！");
		return;
	}
	if(type != "Single"){
		var radioLength = document.forms[0].radio.length;
		var radio = document.forms[0].radio;
		for(var k =0; k < radioLength; k++){
			if( radio[k].checked ){
				radio1Check++;
				break;
			}
		}
		if(radio1Check == 1 ){
            if(type =="Double"){
			    alert("请选择回程机票！");
			    return;
			}
			if(type == "Mult"){
				alert("请选择联程机票！");
			    return;
			}
		}
	}
	document.forms[0].submit();
}
function reserve(index,str,rad){
	
	var formObj = document.forms[0];
	if(str == "back"){
		//alert("enter 1111 "+document.all("rebatePrice_back"+index).value);
		var price;
		if(rad == "rea"){
            price = document.all("rebatePrice_back"+index).value;
		}
		if(rad == "sta"){
			price = document.all("standardPrice_back"+index).value;
		}
        formObj.airCompany_back.value=document.all("airCompany_back"+index).value;
		//alert("11111  "+formObj.airCompany_back.value);
		formObj.flightNo_back.value=document.all("flightNo_back"+index).value;
		//alert("222  "+formObj.flightNo_back.value);
		formObj.planeType_back.value=document.all("planeType_back"+index).value;
		//alert("333  "+formObj.planeType_back.value);
		formObj.price_back.value=price;
		//alert("4444  "+formObj.price_back.value);
		//formObj.rebatePrice_back.value=document.all("rebatePrice_back"+index).value;
		formObj.startTime_back.value=document.all("startTime_back"+index).value;
		//alert("5555  "+formObj.startTime_back.value);
		formObj.startAir_back.value=document.all("startAir_back"+index).value;
		//alert("666  "+formObj.startAir_back.value);
		formObj.buildCost_back.value=document.all("buildCost_back"+index).value;
		//alert("777  "+formObj.buildCost_back.value);
		formObj.arriveTime_back.value=document.all("arriveTime_back"+index).value;
		//alert("888  "+formObj.arriveTime_back.value);
		formObj.arriveAir_back.value=document.all("arriveAir_back"+index).value;
		//alert("999  "+formObj.arriveAir_back.value);
		formObj.buildCost_back.value=document.all("buildCost_back"+index).value;
		formObj.obilPrice_back.value=document.all("obilPrice_back"+index).value;
		//alert("00000  "+formObj.buildCost_back.value);

		
	}else{
		var price;
		//alert("enter 22222 "+document.all("rebatePrice_go"+index).value);
		if(rad == "rea"){
            price = document.all("rebatePrice_go"+index).value;
		}
		if(rad == "sta"){
			price = document.all("standardPrice_go"+index).value;
		}
		formObj.airCompany.value=document.all("airCompany_go"+index).value;
		//alert("enter 333 "+document.all("airCompany_go"+index).value);
		formObj.flightNo.value=document.all("flightNo_go"+index).value;
		//alert("enter 44 "+document.all("flightNo_go"+index).value);
		formObj.planeType.value=document.all("planeType_go"+index).value;
		//alert("enter 55 "+document.all("planeType_go"+index).value);
		formObj.price.value=price;
		//alert("enter 66 "+price);
		//formObj.rebatePrice.value=document.all("rebatePrice"+index).value;
		formObj.startTime.value=document.all("startTime_go"+index).value;
		//alert("enter 77 "+document.all("startTime_go"+index).value);
		formObj.startAir.value=document.all("startAir_go"+index).value;
		//alert("enter 88 "+document.all("startAir_go"+index).value);
		formObj.buildCost.value=document.all("buildCost_go"+index).value;
		//alert("enter 99 "+document.all("buildCost_go"+index).value);
		formObj.arriveTime.value=document.all("arriveTime_go"+index).value;
		//alert("enter 10 "+document.all("arriveTime_go"+index).value);
		formObj.arriveAir.value=document.all("arriveAir_go"+index).value;
		//alert("enter 11 "+document.all("arriveAir_go"+index).value);
		formObj.buildCost.value=document.all("buildCost_go"+index).value;
		formObj.obilPrice.value=document.all("obilPrice_go"+index).value;
			//alert(formObj.buildCost.value);
	}
	
}
function queryAgain(str,str1,str2,str3){
	//alert("aaaa");
	document.forms[0].startCity.value=str;
	alert(document.forms[0].startCity.value);
	document.forms[0].arriveCity.value=str1;
	document.forms[0].arriveCity2.value=str2;
	document.forms[0].startDate1.value=str3;
	document.forms[0].startDate2.value=str3;
	document.forms[0].action="planeQuery.do";
	document.forms[0].submit();
}
function gotoResive(){
	if(document.forms[0].warn.checked==false){
		alert("请接受注意事项！");
		
	}else{
		document.forms[0].action="PlaneOrderPerson.do?gotoOper=gotoOrder";
		document.forms[0].submit();
	//alert("系统正在建设中,请您记住您要预定的航班,拨打800-830-1003\n不便之处请见谅");
	}
}
//判断输入的日期个是：月份和天数少于两位数,则补'0'
function AddzeroToDate(date){
	var tp="";
	temp = new Array();
	temp = date.split("-");
	var year  = temp[0];
	var month = temp[1];
	var day   = temp[2];
	//alert("year="+year+"  month="+month+" day="+day);
	if(month.length<2){
		month="0"+temp[1];
	}
	if(day.length<2){
		day="0"+temp[2];
	}
	//alert("year="+year+"  month="+month+" day="+day);
	tp=year+"-"+month+"-"+day;
	//alert(tp);
	return tp;
}
//检测输入的日期是否合法
//date是日期型的字符串，比如说：'2004-07-10'
function chkDate(date){
	//if(date==null || trim(date)==""){
    //    return false;
    //} else {
    	temp = new Array();
		temp = date.split("-");
		if( temp.length < 3 || temp.length > 3){
			alert("日期必须为yyyy-mm-dd格式");
			return false;
		}
		var year  = temp[0];
		var month = temp[1];
		var day   = temp[2];
		if(!isInteger(year)||!isInteger(month)||!isInteger(day)){
			alert("请输入有效的年份、月份、日份！");
			return false;
		}
		//判断年份
		if (year.length == 2 ){
			year = "20"+year;
		}
		if (year.length == 3 ){
			year = "2"+year;
		}
		if (year.length > 4 || year.length < 2 ){ 
			alert("日期必须为yyyy-mm-dd格式");
			return false;
		}
		var yearInt = parseInt(year);
		//判断月份
		//月份在0-12之间
		if(monthInt>12 || monthInt<0){
        	alert("您输入的日期月份不正确，月份在0-12之间!");
        	return false;
    	}
    	var monthInt = parseInt(month);
    	//因为08和09 parseInt后变为0
		if( month == "08" ){
			monthInt = 8;
		}
		if( month == "09"){
			monthInt = 9;
		}
    	//判断日
    	if(day>31|| day<0){
        	alert("输入的日期最多不能超过31!");
        	return false;
    	}
    	var dayInt = parseInt(day);
    	//处理润年
		if( ((yearInt % 4)==0) && ((yearInt % 100)!=0) && ((yearInt % 400) != 0)){
        	if(monthInt==2){
            	if(dayInt>29 || dayInt<0){
                	alert("润年二月只有29天！");
                	return false;
            	}
        	}
    	} else {
        	if(monthInt==2){
            	if(dayInt>28 || dayInt<0){
                	alert("非润年二月只有28天！");
                	return false;
            	}
        	}
    	}
    	if(isNum(yearInt) && isNum(monthInt) && isNum(dayInt)){
    	//1,3,5,7,8,10,12月份有31天;
    	if(monthInt==1 ||monthInt==3||monthInt==5||monthInt==7||monthInt==8||monthInt==10||monthInt==12){
    		if(dayInt>31 || dayInt<0){
    			alert(monthInt+"月份只有31天");
    			return false;
    		}
    	}
    	//4,6,9,11月份有30天
    	if(monthInt==4 ||monthInt==6||monthInt==9||monthInt==11){
    		if(dayInt>30 || dayInt<0){
    			alert(monthInt+"月份只有30天");
    			return false;
    		}
    	}
     }
  //}
  return true;
}
//Check number(0-9)
//判断是否为数值串是否为整数。
//参数：checkstr,被检查的数值串
//返回：真或假，只有含有数字为真，否则假
function isNum(checkstr){  
	//if(checkstr==null||trim(checkstr)=="")
	//	return true;		//alert(name+"项：您尚未填写。");
		
	//var str	= trim(checkstr);
	var str	= checkstr;
	if(str!=null && str!="")
	{
		if(str.length>0)
		{
			for (var i = 0; i < str.length; i++) 
			{ 
				var ch = str.substring(i, i + 1); 
				if (ch < "0" || "9" < ch) return false;  
			} 
		}
	}
	else	return false;
	
	return true; 
} 
//判断输入是否为空
function isEmpty(s){
	return ((s == null) || (s.length == 0))
}
function isDigit(c){
    return ((c >= "0") && (c <= "9"))
}
//判断输入的是否是整数
function isInteger(s){
    var i;
    if (isEmpty(s))
       if (isInteger.arguments.length == 1) return false;
       else return (isInteger.arguments[1] == true);

    for (i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if (!isDigit(c)) return false;
    }
    return true;
}