﻿function loadDestine(){
	try{new Ajax.Updater("destine",'/secretarialDestine.vm', {asynchronous:true, evalScripts:true});}
	catch(e){$("#destine").load("/secretarialDestine.vm");}
}

function loadSearchPanel(){
	try{new Ajax.Updater("searchPanel",'/iSearchFormPlanTicket.vm', {asynchronous:true, evalScripts:true,onComplete:loadAirlineSelect});}
	catch(e){$("#searchPanel").load("/iSearchFormPlanTicket.vm");}
}

function loadSamePT(id){
	try{new Ajax.Updater("sameContent",'/PlanTicketFrontScript.do?method=planTicketShowByID&id='+id+'&type=show&cReturn=showSamePT', {asynchronous:true, evalScripts:true});}
	catch(e){$("#sameContent").load('/PlanTicketFrontScript.do?method=planTicketShowByID&id='+id+'&type=show&cReturn=showSamePT');}
}

function loadLittleSearchForm(){
	try{new Ajax.Updater("showSearchForm",'/module/littleSearchForm.vm', {asynchronous:true, evalScripts:true});}
	catch(e){$("#showSearchForm").load("/module/littleSearchForm.vm");}
}

function loadPlaneTicketPanel(id){
	loadLittleSearchForm();
	loadSamePT(id);
	try{new Ajax.Updater("planeTicketPanel",'/PlanTicketFrontScript.do?method=planeTicketListInterrelated&id='+id, {asynchronous:true, evalScripts:true});}
	catch(e){$("#planeTicketPanel").load(url);}
}
function loadPlaneTicketPanelForDynamic(id){
	loadLittleSearchForm();
	var url = '/PlanTicketFrontScript.do?method=planeTicketListInterrelatedForDynamic&id='+id;
	try{new Ajax.Updater("planeTicketPanel",url, {asynchronous:true, evalScripts:true});}
	catch(e){$("#planeTicketPanel").load(url);}
}
function loadTicketCHPanelForDynamic(id,vDate){
	//loadLittleSearchForm();
	var url = '/PlanTicketFrontScript.do?method=ticketCHListInterrelatedForDynamic&id='+id+"&date="+vDate;
	try{new Ajax.Updater("planeTicketPanel",url, {asynchronous:true, evalScripts:true});}
	catch(e){$("#planeTicketPanel").load(url);}
}

function loadContactPanel(){
	try{new Ajax.Updater("contactPanel",'/contactUS.vm', {asynchronous:true, evalScripts:true});}
	catch(e){$("#contactPanel").load("/contactUS.vm");}
}

function loadNewsPanel(id){
	try{new Ajax.Updater("newsPanel",'/NewsFrontScript.do?method=newsListInterrelated&id='+id, {asynchronous:true, evalScripts:true});}
	catch(e){$("#newsPanel").load('/NewsFrontScript.do?method=newsListInterrelated&id='+id);}
}

function loadLittlePanel(){
  try{
  	//for prototype
//	new Ajax.Updater("","/admin/empty.vm", {asynchronous:true, evalScripts:true, onComplete:loadLittlePanelAfter});
//	new Ajax.Updater("loginFormDIV","/iLoginPage.vm", {asynchronous:true, evalScripts:true});
	new Ajax.Updater("loginFormDIV","/module/iLoginPage3.0.vm", {asynchronous:true, evalScripts:true});
	new Ajax.Updater("loginInfo","/module/iLoginInfo.vm", {asynchronous:true, evalScripts:true});
	new Ajax.Updater("littlePanel","/module/littlePanel.vm", {asynchronous:true, evalScripts:true});
  }catch(e){
  	//for jQuery
  	$("#loginFormDIV").load("/module/iLoginPage3.0.vm");
  	$("#loginInfo").load("/module/iLoginInfo.vm");
  	$("#littlePanel").load("/module/littlePanel.vm");
  }
}

function checkOutDate(cValue){
	try{
	      var dateTime = new Date(cValue);
	      var dateNow = new Date();
	      if(dateTime<dateNow){document.getElementById("outDateChapter").style.display='block';}
	      var screenWidth = (document.body.clientWidth*1)/2 - 276.5;
	      //$("outDateChapter").style.left = screenWidth;
	      $("outDateChapter").setStyle({'left':screenWidth+'px'}); 
	}catch(e){window.status=e.description;}
}

//自动触发
function funCheckInfo(){
	var url = "/littleNote.do?method=checkInBox";
	new Ajax.Updater("",encodeURI(url), {asynchronous:true, evalScripts:true, onComplete:showInfoResult});
}
	function showInfoResult(originalRequest){
		var cValue = originalRequest.responseText;
		var cDiv = $("divShowInfo");					//显示小纸条列表的div
		var cDivContent = $("divShowInfoContent");		//显示小纸条列表内容的div
//		alert(cValue);
		if(cValue.Trim()!=""){
			if(cValue.indexOf("<!DOCTYPE")!=-1){return false;}	//此时返回的页面可能是登陆界面
			cDiv.style.display = 'block';
			$("littlePanel").show(); 
			cDivContent.innerHTML = cValue;
		}
	}

function showInfoOnPage(id,content,evnt){
	//查看小纸条内容，同时置为已读
	var obj = $("divShowInfoDetail");
	obj.style.left = $("divShowInfoContent").offsetLeft-15;
	obj.style.top = $("divShowInfoContent").offsetTop+100;
	obj.style.display = 'block';
	obj.innerHTML = content;
	var url = "/littleNote.do?method=showLN&noteid="+id;
	new Ajax.Updater("",encodeURI(url), {asynchronous:true, evalScripts:true});		//把小纸条置为已读，无需返回结果
}