var nowTime = new Date();

//show pad
function controlPanelShow(){
	try{
		//var nowTime = new Date();
		var curHour = nowTime.getHours();
		var nm = nowTime.getMinutes();
		if(((curHour==18 && nm>30) || curHour>=19) || ((curHour==8 && nm<45) || curHour<9)){
			//show ot pad
			document.getElementById("eMsg_tel").style.display = 'none';
			document.getElementById("eMsg_btnSubmit").style.display = 'none';
			document.getElementById("eMsg_btnLY").style.display = 'block';
		}
	}catch(e){}
}//controlPanelShow();



function closeDiv(){
}
function showDiv(){
}
function clearMsg(){
	try{
		var tel = document.getElementById("eMsg_tel");
		if(tel.value=="请留下您的联系电话"){
			tel.value="";
			tel.className = "eMsgInput";
		}
	}catch(e){}
}
function fillMsg(){
		var tel = document.getElementById("eMsg_tel");
		if(tel.value==""){
			tel.value="请留下您的联系电话";
			tel.className = "eMsgShow";
		}
}

//这是国际酒店首页用的 开始
function sendGlobalHotelTelInfor(){
	var subject = "有客人留电话咨询国际酒店";
	var tel = document.getElementById("eMsg_tel").value;
	var body = "国家：[br]城市：[br]入住日期：[br]离店日期：[br]房间信息：[br]联系电话："+tel+"乘客签证:[br]";
	if(document.getElementById("eMsg_tel").value.Trim()!=""){
		sendNoteToAdmin(subject+"("+tel+")",body,78);sendNoteToAdmin(subject+"("+tel+")",body,236);
		sendGlobalHotelNoteToBargainForMsg(subject,body);
	}else{alert("请填写电话号码，以便我们及时联系您！");return false;}
}

function sendGlobalHotelNoteToBargainForMsg(subject,body){
	var postData = "noteTitle=" + encodeURI(subject) + "&noteBody=" + encodeURI(body);
	var url = "/bargainOutside.do?method=sendOrderToBargainBefore&type=tel&ticketCate=2";
	url = url + "&source=7&";
	url = url + postData;
	//document.getElementById("actionBargain").src=(url);
	document.getElementById("eMsg_tel").value = "";//document.getElementById("eMsg_tel").style.backgroundImage="url(/images/msgTips.gif)";
	try{
		new Ajax.Updater('', encodeURI(url), {method:'post',postBody:postData,onComplete:sendNoteToBargainForMsged ,asynchronous:true, evalScripts:true});
	}catch(e){
		$.ajax({
		   type: "POST",
		   url: url,
		   success: function(cValue){
		   	if(cValue.Trim()=="OK"){
				alert("留言成功，请稍等。\n\n我们的客服将尽快与您联系！");
				document.getElementById("eMsg_tel").value = "";
		   	}else{alert(cValue);}
		   }
		});		
	} 
}
//这是国际酒店首页用的结束

function sendTelMsg(){
	var subject = "有客人留电话咨询机票";
	var tel = document.getElementById("eMsg_tel").value;
	var body = "机票行程：[br]出发日期：[br]回程日期：[br]乘机人数：[br]联系人名：[br]联系电话："+tel+"[br]乘客签证：[br]电子邮件：[br]地址：";
	if(document.getElementById("eMsg_tel").value.Trim()!=""){
		sendNoteToAdmin(subject+"("+tel+")",body,78);sendNoteToAdmin(subject+"("+tel+")",body,236);
		sendNoteToBargainForMsg(subject,body);
	}else{alert("请填写电话号码，以便我们及时联系您！");return false;}
}
	function sendNoteToBargainForMsg(subject,body){
		var postData = "noteTitle=" + encodeURI(subject) + "&noteBody=" + encodeURI(body);
		var url = "/bargainOutside.do?method=sendOrderToBargainBefore&type=tel&ticketCate=0";
		url = url + "&source=3&";
		url = url + postData;
		//document.getElementById("actionBargain").src=(url);
		document.getElementById("eMsg_tel").value = "";//document.getElementById("eMsg_tel").style.backgroundImage="url(/images/msgTips.gif)";
		try{
			new Ajax.Updater('', encodeURI(url), {method:'post',postBody:postData,onComplete:sendNoteToBargainForMsged ,asynchronous:true, evalScripts:true});
		}catch(e){
			$.ajax({
			   type: "POST",
			   url: url,
			   success: function(cValue){
			   	if(cValue.Trim()=="OK"){
					alert("留言成功，请稍等。\n\n我们的客服将尽快与您联系！");
					document.getElementById("eMsg_tel").value = "";
			   	}else{alert(cValue);}
			   }
			});		
		} 
	}
			function sendNoteToBargainForMsged(originalRequest) {
    			var cValue = originalRequest.responseText;
    			cValue = cValue.Trim();
				alert("留言成功，请稍等。\n\n我们的客服将尽快与您联系！");
				document.getElementById("eMsg_tel").value = "";
			}

var _ptoid='0';
function openLYMsgBoard(){

  		var url="/module/popTelOTBox.vm";
  	/*	Dialog.confirm({url: url, options: {method: 'get'}}, 
          {className: "alphacube", width:550,height:300,okLabel:" 提交 ",cancelLabel:" 关闭 ",
          onOk:function(){funSubmitMsg()},
          onCancel:function(){Dialog.closeInfo()}
         });
     */	
}
function openLYMsgBoard(oid){
	//alert(document.documentElement.scrollTop);
	freezeBG("LYMsgBoard",410,270);
	var url="/module/popTelOTBox2.vm";
	_ptoid=oid;
	//$("#LYMsgBoard").load(url);
	$.ajax({url: url, cache: false,
		success: function(html){
	    	$("#LYMsgBoard").html(html);
	    	initLYM();
	  	}
	});
  	/*
  		Dialog.confirm({url: url, options: {method: 'get'}}, 
          {className: "alphacube", width:550,height:300,okLabel:" 提交 ",cancelLabel:" 关闭 ",
          onOk:function(){funSubmitMsg()},
          onCancel:function(){Dialog.closeInfo()}
         });
     */		
}
	function initLYM(){
         try{
         	document.getElementById("key01").value = getCookie('loginName');
         	document.getElementById("key02").value = document.getElementById("isearchDate").value;
         	document.getElementById("key03").value = document.getElementById("ireturnDate").value;
         	document.getElementById("key00").value = document.getElementById("iplaceFrom").options[document.getElementById("iplaceFrom").selectedIndex].text+"-"+document.getElementById("placeToS").value;
         }catch(e){}	
	}
function funSubmitMsg(){
	var s = DestineformSubmit(_ptoid);
	if(s){disfreezeBG('LYMsgBoard');document.getElementsByTagName('html')[0].style.overflow = 'auto';}
}



function loadWorldPTSearchForm(){
	var url = "/AgentInfoSearch.do?method=searchPTForm"
	$.ajax({url: url, cache: false,
		success: function(html){
	    	$("#ptSearchForm").html(html);
	    	ZZ.module.searchBox.init();
	  	}
	});
}
