window.onload=function(){
	$("fromcity").onkeyup=function(){popup_hide();suggest.display('fromcity','start_city',event);}
	$("fromcity").onclick=function(){popUp('fromcity','start_city')}
	$("fromcity").onblur=function(){showSearch('fromcity',1)}
	$("fromcity").onfocus=function(){popUp('fromcity','start_city')}
	$("tocity").onkeyup=function(){popup_hide();suggest.display('tocity','end_city',event);}
	$("tocity").onclick=function(){popUp('tocity','end_city')}
	$("tocity").onblur=function(){showSearch('tocity',1)}
	$("tocity").onfocus=function(){popUp('tocity','end_city')}
}
function showmorectiy(obj,flag)
{
	initmorecitydiv(flag);
	var spanleft=getspanLeft(obj);	
  	   
	if (document.getElementById("morecitydiv").style.display   ==   ""){document.getElementById("morecitydiv").style.display   =   "none";}
     else{document.getElementById("morecitydiv").style.display   =   "";
          document.getElementById("morecitydiv").style.left   =   spanleft-184+"px";
          document.getElementById("morecitydiv").style.top   =gETop(obj)+ 23+"px";
	 }
}
function swapsearch(n)
{
	if(n==1){$("inSalesTicket").style.display="";$("outSalesTicket").style.display="none";}
	if(n==5){$("inSalesTicket").style.display="none";$("outSalesTicket").style.display="";}
	for(var i=1;i<=5;i++)
	{
		if(i==n){$("sl"+i).className="checked";$("searchplan"+i).style.display='';}
		else{$("sl"+i).className="";$("searchplan"+i).style.display='none';}
	}
}
function getspanLeft(x){var l=0;while(x){l+=x.offsetLeft;x=x.offsetParent;}return l;}

function initmorecitydiv(flag)
{
var ss = "";
	ss +='<div class="yy">'; 
	ss +='<div class="xzcs">'; 
	ss +='<div class="biaoti">'; 
	ss +='<img style="cursor:pointer" class="left" src="/v1/images/close.gif" onclick="hidemorecitydiv();" />'; 
	ss +='<div class="clear"></div>'; 
	ss +='</div>';

	ss +='<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">'; 
	var tmpcount=citycodelistmore.length%5;
	for(i=0;i<Math.floor(citycodelistmore.length);i++)
	{
		if(i%5 == 0)
		{
			ss +='<tr>';
		}
		ss += '<td><span onclick="changecity(this,'+flag+');event.cancelBubble=true;" title="'+citynamelistmore[i]+'"  urlkey="'+citycodelistmore[i]+'"  urlname="'+citynamelistmore[i]+'">'+citynamelistmore[i]+'</span></td>';
		if(i%5 == 4)
		{
			ss +='</tr>';
		}
	}
	ss +='</table>';
	ss +='<div>';
	if(flag == 0)
  ss +='<label><a href="#" style="float:right;padding-bottom:3px;padding-right:7px;text-decoration:none;color:#0054A8;">所有城市>></a><label>';
	if(flag == 1)
  ss +='<label><a href="#" style="float:right;padding-bottom:3px;padding-right:7px;text-decoration:none;color:#0054A8;">所有城市>></a><label>';
  ss +='<div class="clear"></div>';
  ss +='</div>';
	ss += '</div>'
	ss +='</div>';
	ss +='</div>';
	ss +='</div>';

  $("morecitydiv").innerHTML=ss;
}



function changecity(obj,flag)
{
	changeplansstyle("special_ticket_List",$("othercity"));
	hidemorecitydiv();
	$("othercity").val=obj.urlkey;
	$("othercity").innerText=obj.urlname;
	var pars="t="+Math.random()+"&c="+obj.urlkey;
	new Ajax.Updater("ticketPlan",url,{method: 'get',parameters: pars});
}

function gETop(x) {
    var t = 0;
    while(x) {
        t += x.offsetTop;
        x = x.offsetParent;
    }
    return t;
}
function gEBottom(x) {
    return (x.offsetHeight+gETop(x));
}
function gELeft(x) {
    var l = 0;
    while(x) {
        l += x.offsetLeft;
        x = x.offsetParent;
    }
    return l;
}
function gERight(x) {
    return (x.offsetWidth + gELeft(x));
}

var citycodelistmore=new Array("PEK","SHA","CAN","SZX","CTU","XIY","HGH","HRB","WUH","CSX","TSN","SHE","CGQ","DLC","TAO","TNA","CGO","TYN","NKG","SJW","NGB","FOC","XMN","ZUH","HET","KHN","HFE","NNG","KMG","URC","LHW","INC","HAK","KWE");
var citynamelistmore=new Array(
    "北京",
    "上海",
    "广州",
    "深圳",
    "成都",
    "西安",
    "杭州",
    "哈尔滨",
    "武汉",
    "长沙",
    "天津",
    "沈阳",
    "长春",
    "大连",
    "青岛",
    "济南",
    "郑州",
    "太原",
    "南京",
    "石家庄",
    "宁波",
    "福州",
    "厦门",
    "珠海",
    "呼和浩特",
    "南昌",
    "合肥",
    "南宁",
    "昆明",
    "乌鲁木齐",
    "兰州",
    "银川",
    "海口",
    "贵阳"
);
function hidemorecitydiv()
{
     document.getElementById("morecitydiv").style.display   =   "none";
}

function searchordernobymini(obj,t,orderno,mobno){
	if(orderno==""){$("ordertypesmsg").innerHTML="订单号不能为空。";$("orderno").focus();return false;}
	if(mobno==""){if(t=="1"){$("ordertypesmsg").innerHTML="手机号不能为空。";}else{$("ordertypesmsg").innerHTML="证件号不能为空。"}$("moblino").focus();return false;}
	obj.disabled = true;
	$("ordertypesmsg").innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;<img src='/v1/images/loading.gif'>";
	var para="t="+t+"&orderno="+orderno+"&mobno="+mobno+"&rng="+Math.random();
	new Ajax.Request("/member/tickets/t.asp",{method: 'post',parameters: para,onComplete: showResponse});
	function showResponse(originalRequest){
		var reqstr = originalRequest.responseText;
		$("ordertypesmsg").innerHTML="";
		var tmpreqstr = new Function("return "+reqstr);reqstr = tmpreqstr();
		if(reqstr.status){
			obj.disabled = false;
			ShowMsgo.show("订单号："+orderno,reqstr.msg,'','',3);
		}
		else{
			$("ordertypesmsg").innerHTML = reqstr.msg;
			obj.disabled = false;
		}
	}
}
function $id(id){ 
	return document.getElementById(id); 
} 
function ShowMsg(){ 

	document.writeln("<div id=\"msgdiv\" style=\"position:absolute;display:none;border:6px solid #FDFDFD;\"><\/div>"); 
	document.writeln("<div id=\"overdiv\" style=\"position:absolute;display:none;\">"); 
	document.writeln("<\/div>"); 
	this.ok_callback=function(){}; 
	this.cancel_callback=function(){}; 
	this.msgobjname="";
	
	this.show=function(msgtitle,sc,ec,fno,t){
		if(t==2){sc="";ec="";}
		var tempobj1=$id("msgdiv"); 
		var tempobj2=$id("overdiv"); 
		var msgobj=this.msgobjname; 
		tempobj2.style.filter="alpha(opacity=75)"; 
		tempobj2.style.MozOpacity = 75/100; 
		tempobj2.style.backgroundColor = "#CCCCCC"; 
		tempobj2.style.display = ''; 
		tempobj2.style.zIndex= 100; 
		with(document.documentElement) {
			var bodywidth = (scrollWidth>clientWidth)?scrollWidth:clientWidth;
			var bodyheith = (scrollHeight>clientHeight)?scrollHeight:clientHeight;
		}
		tempobj2.style.height = bodyheith+"px";
		tempobj2.style.width = bodywidth+"px";
		
		tempobj2.style.left=0; 
		tempobj2.style.top=0; 
		tempobj1.style.display="none"; 
		tempobj1.style.display= ''; 
		if(t==3)
		{
			tempobj1.style.left= (document.documentElement.clientWidth)/3+"px"; 
			tempobj1.style.top= (document.documentElement.scrollTop+(document.documentElement.clientHeight)/4)+"px"; 
			tempobj1.style.width=450+"px"; 
			tempobj1.style.height=300+"PX"; 
		}
		else if(t=="4")
		{
			tempobj1.style.left= (document.documentElement.clientWidth)/4+"px"; 
			tempobj1.style.top= (document.documentElement.scrollTop+(document.documentElement.clientHeight)/5)+"px"; 
			tempobj1.style.width=700+"px"; 
			tempobj1.style.height=400+"PX"; 
		}
		else
		{
			tempobj1.style.left= (document.documentElement.clientWidth)/5+"px"; 
			tempobj1.style.top= (document.documentElement.scrollTop+(document.documentElement.clientHeight)/10)+"px"; 
			tempobj1.style.width=750+"px"; 
			tempobj1.style.height=655+"PX"; 
		}
		tempobj1.style.zIndex= 200; 
		tempobj1.style.backgroundColor = "#CDDAF1"; 
		var OutStr; 
		OutStr="<div style=\"font-weight:bolder;text-align:left;height:20px;padding:5px 0 0 5PX;;font-size:14px; color:#FFFFFF;background-color:#6088D2;cursor:move\" ><span style='width:95%;_width:93%; float:left;' canmove=\"true\" forid=\"msgdiv\">"+msgtitle+"</span><span><img src='/v1/images/hit33.jpg' onmouseover=\"this.style.cursor='pointer'\" onclick=\""+msgobj+".cancel()\" title='关闭并返回'></span></div>" ;
		if(t!=3&&t!=4)
		{
			OutStr=OutStr+"<div style=\"height:630PX;text-align:left;font-size:12px;background-color:#EEF7FF; border:1px solid #6088D2;  \">"+
					"<p style='color:#C0490A;margin:0'><iframe id=\"vfrm\" width=\"100%\" height=\"100%\" frameborder=\"0\" ></p>"+
					"</div>" ;
		}
		else if(t==3){
			OutStr=OutStr+"<div style=\"height:273PX;text-align:left;font-size:12px;background-color:#EEF7FF; border:1px solid #6088D2;  \"><ul class='showminiflt'>"+sc+"</ul></div>";
		}
		else if (t=="4")
		{
			OutStr=OutStr+"<div style=\"height:373PX;text-align:left;font-size:12px;background-color:#EEF7FF; border:1px solid #6088D2;  \">"+
						"<fieldset style='border:none; margin:12px 0 0 0'>"+
			"	<label style='float:left;width:160px;text-align:right;font-size:14px;'>姓名：</label>"+
			"		<input name=\"username\" id=\"username\" style=\"width: 300px;float:left;\" maxlength=\"20\"  /><span style=\"color:red\">*</span>"+
			"	</fieldset>"+
						"<fieldset style='border:none; margin:12px 0 0 0'>"+
			"	<label style='float:left;width:160px;text-align:right;font-size:14px;'>手机号码：</label>"+
			"		<input name=\"usermobile\" id=\"usermobile\" style=\"width: 300px;float:left;\"  maxlength=\"20\"  /><span style=\"color:red\">*</span>"+
			"	</fieldset>"+
						"<fieldset style='border:none; margin:12px 0 0 0'>"+
			"	<label style='float:left;width:160px;text-align:right;font-size:14px;'>联系电话：</label>"+
			"		<input name=\"usertel\" id=\"usertel\" style=\"width: 300px;float:left;\" maxlength=\"20\"   />"+
			"	</fieldset>"+
						"<fieldset style='border:none; margin:12px 0 0 0'>"+
			"	<label style='float:left;width:160px;text-align:right;font-size:14px;'>电子邮箱：</label>"+
			"		<input name=\"useremail\" id=\"useremail\" style=\"width: 300px;float:left;\"  maxlength=\"30\"  />"+
			"	</fieldset>"+
						"<fieldset style='border:none; margin:12px 0 0 0'>"+
			"	<label style='float:left;width:160px;text-align:right;font-size:14px;'>留言类型：</label>"+
			"		<input name=\"msgtype\" id=\"msgtype1\" type=\"radio\" value=\"咨询\" onclick=\"javascrpt:$('msgtypes').value=this.value\" checked /><label for=\"msgtype1\">咨询</label>"+
			"		<input name=\"msgtype\" id=\"msgtype2\" type=\"radio\" value=\"投诉\"  onclick=\"javascrpt:$('msgtypes').value=this.value\" /><label for=\"msgtype2\">投诉</label>"+
			"		<input name=\"msgtype\" id=\"msgtype3\" type=\"radio\" value=\"建议\"  onclick=\"javascrpt:$('msgtypes').value=this.value\" /><label for=\"msgtype3\">建议</label>"+
			"		<input name=\"msgtypes\" id=\"msgtypes\" type=\"hidden\" value=\"咨询\"  />"+
			"	</fieldset>"+
						"<fieldset style='border:none; margin:12px 0 0 0'>"+
			"	<label style='float:left;width:160px;text-align:right;font-size:14px;'>留言内容：</label>"+
			"		<textarea name=\"msg\" style=\"width:400px; height:100px\"></textarea><span style=\"color:red\">*</span>"+
			"	</fieldset>"+
			"			<fieldset style=\"text-align:left;font-size:12px; margin:15px 0 0 0; border:none;\">"+
			"			<input type=\"submit\" name=\"SubmitLogin\" id=\"id_login\" value=\"提交留言\" class=\"btn\" onclick=\""+msgobj+".ok(this)\" style='margin:0 0 0 160px;' /> "+
			"			<span id='retloginmsg' style='color:red; padding:0 0 0 25px;'></span>"+
			"		</fieldset>	"+
			"			<fieldset style=\"text-align:left;font-size:12px; margin:15px 0 0 0; border:none; \">"+
			"			<span style='padding-left:100px; COLOR:#FF6600'>温馨提示：您还可以将留言发送至我们的短信平台：075583367777 （支持移动/联通/小灵通）</span>"+
			"		</fieldset>	"+
					"</div>";
		}
		tempobj1.innerHTML=OutStr; 
		if(t!="3"&&t!="4")
		{
			var iframe = $("vfrm")
			iframe.src = "http://www.feeyo.com/vflight/opens/vflightsearch.html?dep="+sc+"&arr="+ec+"&fno="+fno+"&s=%B2%E9%D1%AF";
		}
		else if(t=="4")
		{
			$("username").focus();
		}
		var md=false,mobj,ox,oy;
		document.onmousedown=function(ev) 
		{ 
			var ev=ev||window.event; 
			var evt=ev.srcElement||ev.target; 
			if(typeof(evt.getAttribute("canmove"))=="undefined") 
			{ 
				return; 
			} 
			if(evt.getAttribute("canmove")) 
			{ 
				md = true; 
				mobj = document.getElementById(evt.getAttribute("forid")); 
				ox = mobj.offsetLeft - ev.clientX; 
				oy = mobj.offsetTop - ev.clientY; 
			} 
		} 
		document.onmouseup= function(){md=false;} 
		document.onmousemove= function(ev) 
		{ 
			var ev=ev||window.event; 
			if(md) 
			{ 
				mobj.style.left= (ev.clientX + ox)+"px"; 
				mobj.style.top= (ev.clientY + oy)+"px"; 
			} 
		} 
	} 
	this.ok = function(obj) 
	{
		obj.disabled = true;
		$("retloginmsg").innerHTML = "正在处理...";
		var username=$id("username").value;
		var usermobile=$id("usermobile").value;
		var usertel=$id("usertel").value;
		var useremail=$id("useremail").value;
		var msgtype=$id("msgtypes").value;
		var msg=$id("msg").value;
		var para="username="+username+"&usermobile="+usermobile+"&usertel="+usertel+"&useremail="+useremail+"&msgtype="+msgtype+"&msg="+msg+"&saction=add";
		new Ajax.Request("/member/addMsgbynet.asp",{method: 'post',parameters: para,onComplete: showResponse});
		function showResponse(originalRequest)
		{
			var reqstr = originalRequest.responseText;
			var tmpreqstr = new Function("return "+reqstr);reqstr = tmpreqstr();
			if(reqstr.status){
				$("retloginmsg").innerHTML = reqstr.msg;
			}
			else{
				$("retloginmsg").innerHTML = reqstr.msg;
				obj.disabled = false;
			}
		}
	}
	this.cancel=function(){ 
		$id('msgdiv').style.display='none'; 
		$id('overdiv').style.display='none'; 
		this.cancel_callback(); 
	} 
} 

var ShowMsgo=new ShowMsg(); 
ShowMsgo.msgobjname="ShowMsgo"; 
ShowMsgo.ok_callback=function(){ 
} 
ShowMsgo.cancel_callback=function(){ 
} 
