var ox;
var oy;
var num=1;
////////////加载首页信息s//////////////////////
function init() {
	        //openWindow();	       
  	  		DWREngine.setOrdered(true); 
		 	incPagesLoad("body_booking","/pages/2008/include/index/index_booking.jsp");  //订票
		 	incPagesLoad("en_body_booking","/pages/2008/include/index/en_index_booking.jsp");  //订票
      		useLoadingImage("pages/2008/images/ico_loading1.gif","loadDivStr"); 	  		
			incPagesLoad("normal_top","/pages/2008/include/index_ebtop.jsp");    //top
			incPagesLoad("index_login","/pages/2008/include/index/index_login.jsp");
	     	incPagesLoad("book_product","/pages/2008/include/index/index_pro.jsp");  //产品图片
		 	incPagesLoad("body_order","/pages/2008/include/index/index_order.jsp");//网上值机,机票验证
			// 城市，函数，返回div，select id 
		 	//selcity("flightConditionEntity.orgCity1","","getBookingBack","OrgCity","Y");
		 	//selcity("flightConditionEntity.dstCity0","SZX","getBookingBack","DstCity","Y"); 
     		selcity("Flygo","","getFlyBack","FlyOrgCity","N");
	 	 	selcity("Flyback","SZX","getFlyBack","FlyDstCity","N"); 
	 	 	incPagesLoad("body_bigphoto","/pages/2008/include/index/index_big_res.jsp");  //大图
			incPagesLoad("body_rule","/pages/2008/include/index/index_link.jsp");  //链接图片
			incPagesLoad("body_discont","/pages/2008/include/index/index_discount.jsp");
			incPagesLoad("body_szlinenews","/pages/2008/include/index/index_article.jsp");  //文章列表
			incPagesLoad("normal_bottom","/pages/2008/include/index_bottom.jsp");     // bottom	
			
   }
////////////加载首页信息e//////////////////////
////////////会员登录s//////////////////////
function verify(str) {
	  if(str=="checknumerr"){
	  	dwr.util.setValue("ix_notice","<table><tr><td width='126' height='53' background='images/index/B2C09_tishi.gif'><font color='red' size='2px'>验证码</font>错误</td></tr></table>",{ escapeHtml:false });
		calpositon($("denglu"),$("ix_notice"));
	  	}
	  	else if(str=="loginerr"){
	  	dwr.util.setValue("ix_notice","<table><tr><td width='126' height='53' background='images/index/B2C09_tishi.gif'><font color='red' size='2px'>登录名或密码</font>错误</td></tr></table>",{ escapeHtml:false });
		calpositon($("denglu"),$("ix_notice"));
	  		}else if(str=="Socketerr" || str=="Systemerr"){
	  		dwr.util.setValue("ix_notice","<table><tr><td width='126' height='53' background='images/index/B2C09_tishi.gif'><font color='red' size='2px'>系统繁忙，请稍后尝试</font></td></tr></table>",{ escapeHtml:false });
			calpositon($("denglu"),$("ix_notice"));
	  		}else {
	  			incPagesLoad("index_login","/pages/2008/include/index/index_login.jsp");
	  			}  
}
	
function getAbsolutePos(el){
	var r = { x: el.offsetLeft, y: el.offsetTop };
	if (el.offsetParent) {
	var tmp =getAbsolutePos(el.offsetParent);
	r.x += tmp.x;
	r.y += tmp.y;
	}
	return r;
}
	
function calpositon(obj,objid){
    var offsetPos=getAbsolutePos(obj); 
if((document.body.offsetHeight-(offsetPos.y+obj.offsetHeight-document.body.scrollTop))<objid.style.pixelHeight){
var calTop=offsetPos.y-objid.style.pixelHeight;
}
else{
var calTop=offsetPos.y+obj.offsetHeight;
}
if((document.body.offsetWidth-(offsetPos.x+obj.offsetWidth-document.body.scrollLeft))>objid.style.pixelWidth){
var calLeft=offsetPos.x;
}
else{
var calLeft=obj.offsetLeft+obj.offsetWidth;
}
if(calLeft+234>document.body.offsetWidth){
ox=calLeft-(calLeft+234-document.body.offsetWidth)-30;}else{
ox=calLeft-35; }
oy=calTop-10;
    $("ix_notice").style.position='absolute';
    $("ix_notice").style.left=ox;
    $("ix_notice").style.top=oy;
	$("ix_notice").style.display="block";
	setTimeout("$('ix_notice').style.display='none'",5000);
}

function login() {
	var isValid = window.frames["validate_frame"].validate();
	if(isValid != true)
	{
			return false;
	}
	var cardno = document.getElementById("cardno").value;
	var password = document.getElementById("password").value;
	//var checknum = document.getElementById("checknum").value;	
	var checknum = ""; 
	var selectLogin = document.getElementsByName("logintype")[0];
	var logintype=selectLogin.options[selectLogin.selectedIndex].value;	
	
//	alert(cardno+password+checknum);
 if (cardno == "") {
	dwr.util.setValue("ix_notice","<table><tr><td width='126' height='53' background='images/index/B2C09_tishi.gif'>请输入<font color='red' size='2px'>用户名</font></td></tr></table>",{ escapeHtml:false });
	calpositon($("denglu"),$("ix_notice"));
 	return false; 
 }
 if (password == "") {
dwr.util.setValue("ix_notice","<table><tr><td width='126' height='53' background='images/index/B2C09_tishi.gif'>请输入<font color='red' size='2px'>密码</font></td></tr></table>",{ escapeHtml:false });
calpositon($("denglu"),$("ix_notice"));
 return false; 
 } 
   indexLogin.indexLogin(cardno,password,checknum,logintype,verify);
}

function indexLogout() {
	indexLogin.indexLogout(logoutToIndex);
}
function logoutToIndex(str) {
		 	if(str=="out"){
		 		incPagesLoad("index_login","/pages/2008/include/index/index_login.jsp");
		  }
 	 } 

//行程管理
	function queryOrder(){
		
		window.open("common/orderManage.do");
	} 

////////////会员登录e//////////////////////
////////////订票s//////////////////////


function lineType(type){
		if(type==2){  
			 $("flightConditionEntity.orgDate2").value=showdate(1,"-");
			$("back_datelable").style.display="block";
			$("flightConditionEntity.orgDate2").style.display="block";
		}
		if(type==1){  
			$("back_datelable").style.display="none";
			$("flightConditionEntity.orgDate2").style.display="none";
		} 
		if(type==4){  
			 $("BackDate1").value=showdate(1,"-");
			$("wordBackDate").style.display="block";
			$("BackDate1").style.display="block";
		} 
		if(type==3){  
			$("wordBackDate").style.display="none";
			$("BackDate1").style.display="none";
		}
	} 
function getBookingBack(cityStr){
	selcity("flightConditionEntity.dstCity0",cityStr,"getBookingBack","DstCity","Y");
}
function search_ticket(){ 
	   	document.all.GouNeiflightSearchForm.originalPage.value = "index";        
		document.all.GouNeiflightSearchForm.operate.value = "goLoadingPage";		
		document.all.GouNeiflightSearchForm.method="post";
		document.all.GouNeiflightSearchForm.submit();
}

function en_search_ticket(){ 
	   	document.all.flightSearchForm.originalPage.value = "index";        
		document.all.flightSearchForm.operate.value = "goLoadingPage";		
		document.all.flightSearchForm.method="post";
		document.all.flightSearchForm.submit();
}

function goFlightConditionPage(){
	 
		document.all.flightSearchForm.originalPage.value = "indexDD";
		document.all.flightSearchForm("flightConditionEntity.hcType")[2].checked = true;
		document.all.flightSearchForm.operate.value = "flightCondition";
	 	document.all.flightSearchForm.submit();
	}
////////////订票e//////////////////////
////////////值机s//////////////////////
function submitckiform(){

		var KING_CLUB_NAME = $("KING_CLUB_NAME").value;
		var ID_NUMBER = $("ID_NUMBER").value;	
		ID_NUMBER=ID_NUMBER.toUpperCase();
		
		if (KING_CLUB_NAME == "") {
		
			if($("cnencheck").value=="2"){
				alert("Please enter your name!");
			}
			
			if($("cnencheck").value=="1"){
				alert("请输入姓名");
			}
			
			return false; 
		}
		if (ID_NUMBER == "") {
			if($("cnencheck").value=="1"){
				alert("请输入证件号");
			}
			
			if($("cnencheck").value=="2"){
				alert("Please enter your passport No.!");
			}
			return false; 
		}
		var rand = document.ckiform.randnet.value;
		var rand1 = document.ckiform.randNeting.value;
			if(rand==""){
				alert("请输入校验码 ！");
				document.ckiform.randnet.focus();
				return ;
			}

			if(rand!=rand1)
			{
				alert("输入校验码有误，请重新输入！");
				document.ckiform.randnet.focus();
				return ;

			}
		if(!document.all.ckiform.checkbox.checked){
			if($("cnencheck").value=="1"){
				alert("抱歉,您不同意使用协议,不能享用网上值机服务！");
			}
			
			if($("cnencheck").value=="2"){
				alert("Before online check in should be accepted Check-in Service Agreement!");
			}
			return false;
		}		
		var url ="http://cki.shenzhenair.com/common/CkiSearchCtrl.do";	
		document.all.ckiform.ID_NUMBER.value = ID_NUMBER;
		document.all.ckiform.action=url;
		document.all.ckiform.submit();
	}
	
	function verifyCkiName() {
	     var KING_CLUB_NAME = dwr.util.getValue("KING_CLUB_NAME");
	  if (KING_CLUB_NAME == "") {
	    dwr.util.setValue("cki_name", "*");
	    return false; 
	  }else {
	    dwr.util.setValue("cki_name", "");
	  }
	  
	}
	
	function verifyCkiID() {
	     var ID_NUMBER = dwr.util.getValue("ID_NUMBER");
	  if (ID_NUMBER == "") {
	    dwr.util.setValue("cki_id", "*");
	    return false; 
	  }else {
	    dwr.util.setValue("cki_id", "");
	  }
	  
	}
	
////////////值机e//////////////////////
////////////航班动态s//////////////////////
function getFlyBack(cityStr)
{
	selcity("Flyback",cityStr,"getFlyBack","FlyDstCity","N");
}
 

function querydyfly()
{
     var pdydate = $("dydate").innerText;       
 				pdydate=pdydate.replace(/-/g,"/");
     var orgcityp =  document.all.dyform.Flygo.value;
     var descityp =  document.all.dyform.Flyback.value;
     var url="module/wshdp/dyShowFlight.jsp?startcity="+orgcityp+"&endcity="+descityp+"&flightdate="+pdydate;
     		document.all.dyform.target="_blank";
        document.all.dyform.action=url;
        document.all.dyform.submit();
} 

////////////航班动态e//////////////////////
////////////产品图片s//////////////////////
function goImg(obj){
	 var pimgvalue = $("imgvalue"+obj).value;
	 $("pageimgid").value = pimgvalue;
	 var url ="common/showProduceInfo.do";
	 document.all.imgform.action=url;
	 document.all.imgform.operate.value="show";
	 document.all.imgform.submit();
} 

////////////产品图片e//////////////////////
////////////文章列表s//////////////////////
function showInfo(sID,sCateName,sDate) {
	    var strURL="show.jsp?info_sID="+sID+"&catename="+sCateName+"&date="+sDate;
		  window.open(strURL,'info');
	}
////////////文章列表e//////////////////////

 
	
////////////公共s//////////////////////
    function change_02(){
		$("ix_ct_01_login_02_ct").style.display="block";
		$("ix_ct_01_login_02_down").style.display="inline";
		$("ix_ct_01_login_02_right").style.display="none";
		$("ix_ct_01_login_03_down").style.display="none";
		$("ix_ct_01_login_03_right").style.display="inline";
		$("ix_ct_01_login_04_down").style.display="none";
		$("ix_ct_01_login_04_right").style.display="inline";
		$("ix_ct_01_login_03_ct").style.display="none";
		$("ix_ct_01_login_04_ct").style.display="none";
		
		}
    function change_03(){
		$("ix_ct_01_login_03_ct").style.display="block";
		$("ix_ct_01_login_02_ct").style.display="none";
		$("ix_ct_01_login_02_down").style.display="none";
		$("ix_ct_01_login_02_right").style.display="inline";
		$("ix_ct_01_login_03_down").style.display="inline";
		$("ix_ct_01_login_03_right").style.display="none";
	  $("ix_ct_01_login_04_down").style.display="none";
		$("ix_ct_01_login_04_right").style.display="inline";
		$("ix_ct_01_login_04_ct").style.display="none";
		}
		function change_04(){
		$("ix_ct_01_login_04_ct").style.display="block";
		$("ix_ct_01_login_02_ct").style.display="none";
		$("ix_ct_01_login_02_down").style.display="none";
		$("ix_ct_01_login_02_right").style.display="inline";
		$("ix_ct_01_login_03_down").style.display="none";
		$("ix_ct_01_login_03_right").style.display="inline";
		$("ix_ct_01_login_02_ct").style.display="none";
		$("ix_ct_01_login_03_ct").style.display="none";
		$("ix_ct_01_login_04_down").style.display="inline";
		$("ix_ct_01_login_04_right").style.display="none";
		}
		function incPagesLoad(divStr,UrlStr) {
    incPages.getInclude(UrlStr,function(data) {
    dwr.util.setValue(divStr, data, { escapeHtml:false });
  });
} 
function selcity(selid,cityStr,funStr,bakStr,isok)
{    
	indexBooking.getGo(selid,cityStr,funStr,isok,function(data) {
    dwr.util.setValue(bakStr, data,{ escapeHtml:false });
  });
}
function showdate(n,ft) 
		{ 
			var uom = new Date(); 
			uom.setDate(uom.getDate()+n); 
			uom = uom.getFullYear() + ft + (uom.getMonth()+1) + ft + uom.getDate(); 
			return uom.replace(/\b(\w)\b/g, '0$1'); 
		}
function checkETForm() {
   etNo = document.ValidateETForm.etNo.value;
	
	if(etNo==""){
		alert("请输入电子票号！");
		document.ValidateETForm.etNo.focus();
		return;
	}
	
	if(etNo.length!=14){
		alert("电子票号为14位，请重新输入！");
		document.ValidateETForm.etNo.focus();
		return;
	}

	var temp=etNo.substring(0,4);
	//alert(temp)
	if(temp!='479-'){
		alert("请输入电子票号！");
		document.ValidateETForm.etNo.focus();
		return;
	}

	if(document.ValidateETForm.passengerName.value==""){
		alert("请输入旅客姓名！");
		document.ValidateETForm.passengerName.focus();
		return;
	}
   rand = document.ValidateETForm.rand.value;
   rand1 = document.ValidateETForm.rand1.value;
   //alert(rand)
   //alert(rand1)
	if(rand==""){
		alert("请输入校验码 ！");
		document.ValidateETForm.rand.focus();
		return ;
	}

	if(rand!=rand1)
	{
		alert("输入校验码有误，请重新输入！");
		document.ValidateETForm.rand.focus();
		return ;

	}
		 document.ValidateETForm.submit();

}
		
function useLoadingImage(imageSrc,divID) {
	//alert(divID);
  var loadingImage;
  if (imageSrc) loadingImage = imageSrc;
  else loadingImage = "ajax-loader.gif";
  DWREngine.setPreHook(function() {
    var disabledImageZone = $(divID);
    if (!disabledImageZone) {
      disabledImageZone = document.createElement('div');
      disabledImageZone.setAttribute('id', divID);
      disabledImageZone.style.position = "absolute";
      disabledImageZone.style.zIndex = "1000";
      disabledImageZone.style.left = "0px";
      disabledImageZone.style.top = "0px";
      disabledImageZone.style.width = "100%";
      disabledImageZone.style.height = "100%";
      var imageZone = document.createElement('img');
      imageZone.setAttribute('id','imageZone');
      imageZone.setAttribute('src',imageSrc);
      imageZone.style.position = "absolute";
      imageZone.style.top = "0px";
      imageZone.style.right = "0px";
      disabledImageZone.appendChild(imageZone);
      document.body.appendChild(disabledImageZone);
    }
    else {
      $('imageZone').src = imageSrc;
      disabledImageZone.style.visibility = 'visible';
    }
  });
  DWREngine.setPostHook(function() {
  	num++;
    $(divID).style.visibility = 'hidden';
    if(num==2){
    readxml();}
  });
}

var city_arr = new Array();
city_arr[0] = new Array("吉隆坡","BJS","KUL");
city_arr[1] = new Array("胡志明","BJS","SGN");
city_arr[2] = new Array("首尔","BJS","SEL");
city_arr[3] = new Array("台北","BJS","TPE");
city_arr[4] = new Array("大阪","BJS","OSA");

city_arr[5] = new Array("吉隆坡","SZX","KUL");
city_arr[6] = new Array("胡志明","SZX","SGN");
city_arr[7] = new Array("首尔","SZX","SEL");
city_arr[8] = new Array("台北","SZX","TPE");
city_arr[9] = new Array("大阪","SZX","OSA");

city_arr[10] = new Array("吉隆坡","NNG","KUL");
city_arr[11] = new Array("胡志明","NNG","SGN");
city_arr[12] = new Array("首尔","NNG","SEL");
city_arr[13] = new Array("台北","NNG","TPE");
city_arr[14] = new Array("大阪","NNG","OSA");

city_arr[15] = new Array("吉隆坡","FOC","KUL");
city_arr[16] = new Array("胡志明","FOC","SGN");
city_arr[17] = new Array("首尔","FOC","SEL");
city_arr[18] = new Array("台北","FOC","TPE");
city_arr[19] = new Array("大阪","FOC","OSA");

city_arr[20] = new Array("北京","KUL","BJS");
city_arr[21] = new Array("深圳","KUL","SZX");
city_arr[22] = new Array("南宁","KUL","NNG");
city_arr[23] = new Array("福州","KUL","FOC");

city_arr[24] = new Array("北京","SGN","BJS");
city_arr[25] = new Array("深圳","SGN","SZX");
city_arr[26] = new Array("南宁","SGN","NNG");
city_arr[27] = new Array("福州","SGN","FOC");

city_arr[28] = new Array("北京","SEL","BJS");
city_arr[29] = new Array("深圳","SEL","SZX");
city_arr[30] = new Array("南宁","SEL","NNG");
city_arr[31] = new Array("福州","SEL","FOC");

city_arr[32] = new Array("北京","TPE","BJS");
city_arr[33] = new Array("深圳","TPE","SZX");
city_arr[34] = new Array("南宁","TPE","NNG");
city_arr[35] = new Array("福州","TPE","FOC");

city_arr[36] = new Array("北京","OSA","BJS");
city_arr[37] = new Array("深圳","OSA","SZX");
city_arr[38] = new Array("南宁","OSA","NNG");
city_arr[39] = new Array("福州","OSA","FOC");

function showPanel(){

var boxObj={'TP01':['TP0101','TP0102','TP0103','TP0104','TP0105','TP0106','TP0107' ],
'TP02':['TP0201','TP0202','TP0203'],
'TP03':['TP0301','TP0302','TP0303','TP0304','TP0305','TP0306','TP0307','TP0308','TP0309','TP0310','TP0311'],
'TP04':['TP0401','TP0402','TP0403','TP0404'],
'TP05':['TP0501','TP0502','TP0503','TP0504'],
'TP06':['TP0601','TP0602','TP0603','TP0604']};
var boxArr=boxObj[arguments[0]];
for(var i=0;i<boxArr.length;i++){
if(boxArr[i]!=arguments[1]){
$(boxArr[i]).style.display='none';

if(arguments[2]=='B2C09_xxfbdi.gif-B2C09_xxfbdi2.gif')
{
$('H_'+boxArr[i]).className="menucss1new";}
else
$('H_'+boxArr[i]).className="menucss1";

}else{
$(boxArr[i]).style.display='inline';
if(arguments[2]=='B2C09_xxfbdi.gif-B2C09_xxfbdi2.gif')
{
$('H_'+boxArr[i]).className="menucssnew";
}
else
$('H_'+boxArr[i]).className="menucss";

}}}

function showPanel2(){var boxObj={'TP01':['TP0101','TP0102','TP0103','TP0104','TP0105','TP0106','TP0107' ],'TP02':['TP0201','TP0202'],'TP03':['TP0301','TP0302'],'TP04':['TP0401','TP0402','TP0403','TP0404'],'TP05':['TP0501','TP0502','TP0503','TP0504'],'TP06':['TP0601','TP0602','TP0603','TP0604']};var boxArr=boxObj[arguments[0]];for(var i=0;i<boxArr.length;i++){if(boxArr[i]!=arguments[1]){$(boxArr[i]).style.display='none';
if(arguments[2])$('H_'+boxArr[i]).background='images/'+arguments[2].split('-')[0];}else{$(boxArr[i]).style.display='inline';if(arguments[2])$('H_'+boxArr[i]).background='images/'+arguments[2].split('-')[1];}}function $(sId){return document.getElementById(sId);}}

function $(sId){
return document.getElementById(sId);}

function Show_TabADSMenu(tabadid_num,tabadnum,num){
    for(var i=0;i<4;i++){$("tabadcontent_"+tabadid_num+i).style.display="none";}
    if(num=='1'){
	    for(var i=0;i<4;i++){$("tabadmenu_"+tabadid_num+i).className="bookingcss1";}
	    $("tabadmenu_"+tabadid_num+tabadnum).className="bookingcss";
	    $("tabadcontent_"+tabadid_num+tabadnum).style.display="block";
    }
    if(num=='2'){
	    for(var i=0;i<4;i++){$("tabadmenu_"+tabadid_num+i).className="bookingcss1";}
	    $("tabadmenu_"+tabadid_num+tabadnum).className="bookingcss2";
	    $("tabadcontent_"+tabadid_num+tabadnum).style.display="block";
    }
    
}

function goCorNet(){
window.open($("corNet").value);
}

function getCity(proID){
var count=40;
document.flightSearchForm.DestCity1.length=0;
for(var i=0;i<count;++i){
if(city_arr[i][1]==proID){
document.flightSearchForm.DestCity1.options[document.flightSearchForm.DestCity1.length] = new Option(city_arr[i][0],city_arr[i][2]);
}}}

function setTab(m,n){
var tli=$("menu"+m).getElementsByTagName("li");
var mli=$("main"+m).getElementsByTagName("ul");
for(i=0;i<tli.length-1;i++){
tli[i].className=i==n?"hover":"";
mli[i].style.display=i==n?"block":"none";}}

function hotelpost(){
	var hs=document.getElementById("hotelSearchForm");
		hs.action="module/hbenewb/hotelresult.jsp";
		hs.target="_blank"
		hs.method="post";
		hs.submit();			
}

function checkForm(){
	var theForm=document.all.flightSearchForm;
			if (theForm.FromCity1.value == '')
					{
						alert("请输入出发城市！");
						theForm.FromCity1.focus();
						return (false);
					}
					if (theForm.DestCity1.value == '')
					{
						alert("请输入到达城市！");
						theForm.DestCity1.focus();
						return (false);
					}
					if (theForm.FromDate1.value == '')
					{
						alert("请输入出发日期！");
						theForm.FromDate1.focus();
						return (false);
					}
					if ($("FlightWay2").checked && theForm.BackDate1.value == '')
					{
						alert("请输入返程日期！");
						theForm.BackDate1.focus();
						return (false);
					}	        
		document.all.flightSearchForm.action="http://gjp.95080.com/VerifyInputSz.jsp";
		document.all.flightSearchForm.target="_blank"
		document.all.flightSearchForm.method="post";
		document.all.flightSearchForm.submit();		
			}
        
//客服机器人
//function openwin(url,popwidth,popheight) { 
//window.open (url, "gmoapopupwin", "height="+popheight+", width="+popwidth+", toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") 
//} 	
function openWindow()
{
	//window.open ("http://res.shenzhenair.com/b2c/notice/wenjuannotice.html", "newwindow", "height=250px, width=400px,top=20px, left=20px, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no");  	
	window.open ("http://res.shenzhenair.com/b2c/notice/goupiao.htm", "newwindow1", "height=416px, width=450px,top=20px, left=10px, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no");  	
}


/*
 * 有关邮件订阅的验证
 */
 
//去掉左右空格
function   Trim(m)
{   
  while((m.length>0)&&(m.charAt(0)==' '))   
  m   =   m.substring(1, m.length);   
  while((m.length>0)&&(m.charAt(m.length-1)==' '))   
  m = m.substring(0, m.length-1);   
  return m;   
} 

//验证Email
function verifySingleContactEmail(obj)
{
		var contactEmail = Trim(obj.value);
		if(contactEmail.length == 0)
		{
		    alert("Email地址不能为空")
		    obj.focus();
			return false;
		}
		var myReg = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
		if(!myReg.test(contactEmail))
		{
			alert("请输入有效的Email地址!"); 
			obj.focus();
			return false; 
		}
		return true; 
}

//验证表单一中的内容
function valForm1()
{
    //获取开始日期
    var startDate = document.getElementById("startDate");
    //获取结束日期
    var endDate = document.getElementById("endDate");
    //获取价格
    var bookPrice = document.getElementById("EmailBookPrice");
    //获取第一个Email
    var bookEmail1 = document.getElementById("EmailBookEmail1");
    
    //获取出发城市
    var orgCity1 =document.getElementsByName("flightConditionEntity.orgCity1")[1];
    var deptcity =orgCity1.options[orgCity1.selectedIndex];
	//获取目标城市    
    var dstCity0 = document.getElementsByName("flightConditionEntity.dstCity0")[1];
    var arrcity =dstCity0.options[dstCity0.selectedIndex];
 
    if(Trim(deptcity.value).length == 0)
    {
       alert("出发城市不能为空！");
       deptcity.focus();
       return;
    }
    
    if(Trim(arrcity.value).length == 0)
    {
       alert("目的城市不能为空！");
       arrcity.focus();
       return;
    }  
     
    if(Trim(startDate.value).length == 0)
    {
       alert("开始日期不能为空！");
       startDate.focus();
       return;
    }
    if(endDate.value < startDate.value)
    {
      alert("结束日期不能早于开始日期！");
      endDate.focus();
      return;
    }
    if(Trim(bookPrice.value).length == 0)
    {
      alert("价格不能为空！"); 
      bookPrice.focus();
      return;
    }
    if(Trim(bookPrice.value) < 100)
    {
    	alert("价格不能低于100！");
    	bookPrice.focus();
    	return;
    }
    if(isNaN(bookPrice.value)) {
    	alert("价格输入不正确！");
    	bookPrice.focus();
    	return;
    	
    }

    if(!verifySingleContactEmail(bookEmail1))
    {
    	bookEmail1.focus();
    	return;
    }
	if(showSending() ){
	   	EmailBook.emailBook(bookEmail1.value,startDate.value,endDate.value,bookPrice.value,deptcity.value,arrcity.value , function (date){
	   		document.getElementById("EmailBookEmail1").value = "";
	   		document.getElementById("EmailBookPrice").value = "";
	   		isSubmit =  true;
	   		alert(date);
	   	}); 
   	} 
   
}


//设置页面提交后显示提示信息，并判断用户是否重复提交
var isSubmit=true;
function showSending() 
{
		if (isSubmit==true)
		{
			isSubmit = false;
			return true;
		}
		return  false;
}


//验证表单二中的内容
function valForm2()
{
	//获取第二个Email
	var bookEmail2 = document.getElementById("EmailBookEmail2");
	if(!verifySingleContactEmail(bookEmail2))
	{
    	bookEmail2.focus();
    	return;
	}
	if(showSending()){
		EmailBook.orderEmailInfo(bookEmail2.value,function(date){
			document.getElementById("EmailBookEmail2").value = "";
			isSubmit = true;
			alert(date);
		});
	}
	
}


