function initIndex(){
	//$("#loginFormDIV").load("/module/iLoginPage3.0.vm");
	/*$.ajax({
	   cache: false,
	   url: "/module/iLoginPage3.0.vm",//"/module/iLoginPage3.0.vm",/userFrontScript.do?method=scoreSearchInLogin
	   success: function(cValue){
			document.getElementById("loginFormDIV").innerHTML = cValue;
			//setTimeout("loadTicket()",2000);
	   }
	});*/
	//$("#loginInfo").load("/module/iLoginInfo.vm");
	$.ajax({
	   cache: false,
	   url: "/module/iLoginInfo.vm",
	   success: function(cValue){
			document.getElementById("loginInfo").innerHTML = cValue;
	   }
	});
	//shpopTips();		//ego.aifei.com pop tips
}
	function shpopTips(){
		var sht = getCookie("shpopTips");
		if(sht!="1"){$("#popTips").show();}
	}
	function closepopTips(){ 
		$("#popTips").hide();setCookie("shpopTips","1",30);
	}
//show login panel
function showLoginPanel(url){
	$("#loginFormDIV").load(url);
	/*
	$.ajax({
	   cache: false,
	   url: url,
	   success: function(cValue){
			document.getElementById("loginInfo").innerHTML = cValue;
	   }
	});
	*/
}

//	function showCHSearchForm(pars){
	function showCHSearchForm(url){
		try{
//			new Ajax.Updater("showWSearchForm",'/module/worldSearchForm3.0.vm', {asynchronous:true, evalScripts:true, onComplete:showCHSearchFormed});
			$.ajax({
			   type: "POST",
			   url: url,
//			   url: "/module/worldSearchForm3.0.vm",
//			   data: "name=John&location=Boston",
			   success: function(cValue){
				   	var tagdiv = document.getElementById("showWSearchForm");
				   	tagdiv.innerHTML = cValue;	
				   	_tagCnID = "placeToS";
					_tagID = "placeTo";
					try{document.getElementById("searchDate").value=getDateCC(new Date(),-1);}catch(e){}
					try{document.getElementById("returnDate").value=getDateCC(new Date(),-30);}catch(e){}
					//alert(getCookie("placeToS"));
					if(getCookie("placeToS")!=""){
						document.getElementById("placeToS").value = getCookie("placeToS");
						document.getElementById("placeTo").value = getCookie("placeTo");
						document.getElementById("contentType").value = getCookie("contentType");
					}
					ZZ.module.searchBox.init();
			   }
			});
		}catch(e){window.status=(e.description);}
	}
	
function loadTicket(){
	try{document.getElementById("showTicketList").innerHTML = document.getElementById("tmpTicketList").innerHTML;}catch(e){}
}
/**
*	异步发送小纸条给指定人员
*/
function sendNoteToAdmin(noteTitle,noteBody,recieverId) {
	if(noteTitle == "" || noteBody == "") {
		alert("你未填写标题或内容");
	} else {
		// checkLength(str,len) 来自script/common.js
		if(checkLength(noteTitle,50) && checkLength(noteBody,400)) {
			var postData = "recieverId="+recieverId+"&noteTitle=" + noteTitle + "&noteBody=" + noteBody ;
//			new Ajax.Updater('noteComplete', '/littleNote.do?method=sendLN', {method:'post',postBody:postData,onComplete:showSuccess ,asynchronous:true, evalScripts:true});
			
			jQuery.ajax({
			   type: "POST",
			   url: "/littleNote.do?method=sendLN",
			   data: postData,
			   success: function(cValue){
//					try{setTimeout("parent.document.getElementById('fillSubmitForm').style.display = 'none'",1500);}catch(e){}
			   }
			});			
			 
		} else {
			alert("提交内容过多,请缩减字数!");
		}
	}
}

/*
$(document).click(function(){
		try{
			var o = window.event.srcElement;
			alert(o.name+"\n id:"+o.id);
			if(o.name!="choosePlace"){
				var x = document.getElementById('hotCity').style.display;
				funCloseAllPlacePanel();
			}
		}catch(e){}
	}
);*/

//=====================================================

function showCHSearchForm1(pars){
	try{
//			new Ajax.Updater("showWSearchForm",'/AgentInfoSearch.do?method=searchForm&cReturn='+pars, {asynchronous:true, evalScripts:true, onComplete:showCHSearchFormed});
		new Ajax.Updater("showWSearchForm",'/module/worldSearchForm3.0.vm', {asynchronous:true, evalScripts:true, onComplete:showCHSearchFormed1});
	}catch(e){}
}
	function showCHSearchFormed1(originalRequest){
		try{
			var cValue = originalRequest.responseText;
		    Calendar.setup({
		        inputField     :    "searchDate",     										
		        ifFormat       :    "%Y-%m-%d",     
		        button         :    "searchDateIMG",  	
		        align          :    "Bl",             	
		        singleClick    :    true    });
		    Calendar.setup({
		        inputField     :    "returnDate",     										
		        ifFormat       :    "%Y-%m-%d",     
		        button         :    "returnDateIMG",  	
		        align          :    "Bl",             	
		        singleClick    :    true    });
		}catch(e){}
	}

function switchUserTip(curTip){
	try{
		for(var i=1;i<=5;i++){
			var o = "userTips_"+i
			var divObj = document.getElementById(o);
			if(o==curTip){
				divObj.className = "on";
			}else{
				divObj.className = "off";
			}
		}
	}catch(e){}
}

function switchFrom(from){
	setTimeout("switchF('"+from+"')",500);
}
function switchF(from){
	try{
/*			document.getElementById("CAN1").style.display="none";
			document.getElementById("CAN2").style.display="none";
			document.getElementById("HKG1").style.display="none";
			document.getElementById("HKG2").style.display="none";
			document.getElementById(from+"1").style.display="block";
			document.getElementById(from+"2").style.display="block";*/
		document.getElementById("CAN1").className="part1 ho";
		document.getElementById("CAN2").className="part2 ho";
		document.getElementById("HKG1").className="part1 ho";
		document.getElementById("HKG2").className="part2 ho";
		document.getElementById(from+"1").className="part1";
		document.getElementById(from+"2").className="part2";
		
		document.getElementById("tf_CAN").className = "button bg2";
		document.getElementById("tf_HKG").className = "button bg2";
		document.getElementById("tf_"+from).className = "button bg1";
		
	}catch(e){}
}
var _sc;
function switchHotelFrom(city){
	_sc = setTimeout("switchHotel('"+city+"')",500);
}
function switchStop(){
	clearTimeout(_sc);
}
	function switchHotel(city){
		var allCity = new Array("BJ","SH","GZ","SY","HZ","XA","CD");
//			var allCity = new Array("BJ","SH","GZ","SY","HZ","XA","ZZ","CD");
		for(var i=0;i<allCity.length;i++){
			//hidden title
			var t = document.getElementById("t_"+allCity[i]);
			t.className = "button bg2";
			//hidden content
			var c = document.getElementById("c_"+allCity[i]);
			c.className = "pick ho";
		}
		//show single title
		var t = document.getElementById("t_"+city);
		t.className = "button bg1";
		//show content
		var c = document.getElementById("c_"+city);
		c.className = "pick";
	}
/*	try{
		document.getElementById("HKG1").style.display="none";
		document.getElementById("HKG2").style.display="none";
	}catch(e){}*/
	
function switchGlobalFrom(from){
	setTimeout("loadGlobalHotelByCity('"+from+"')",500);
}

function loadGlobalHotelByCity(id,countryCode){
   $("#"+id).html("<img src='/images/loading.gif'/>loading...");
   var url = "/globalHotel.do?method=jGetGlobalHotelByCountry&countryCode="+countryCode+"&hotelTotal=6";
   $("#"+id).load(url);
} 

var _scGlobal;
function switchGlobalHotelFrom(city){
	_scGlobal = setTimeout("switchGlobalHotel('"+city+"')",500);
}
function switchGlobalStop(){
	clearTimeout(_scGlobal);
}

 function switchGlobalHotel(city){
	  var allCity = new Array("XN","LD","BL","SFS","NY","DLD");
	  for(var i=0;i<allCity.length;i++){
    	  var t = document.getElementById("t_"+allCity[i]);
    	  t.className = "button bg2";
    	  try{
    		  var c = document.getElementById("showGlobalHotelList"+allCity[i]);
    		  c.style.display= "none";
    	  }catch(e){}
	  }
	  var t = document.getElementById("t_"+city);
	  t.className = "button bg1";
	  try{
		  var c = document.getElementById("showGlobalHotelList"+city);
		  c.style.display= "block";
	  }catch(e){}
 }

	 
	 //这里是控制酒店显示开始
 function switchHotelShowFrom(city){
	 _scGlobal = setTimeout("switchHotelShow('"+city+"')",500);
 }
 function switchHotelShow(city){
	 $(".int_hot_ten .t li").removeClass("on");
	 $("#"+city+"Li").addClass("on");
	 $(".int_hot_ten .clearfix").hide();
	 $("#"+city+"Div").show();
 }
	 
	 //这里是控制酒店显示结尾
	 
	 //这里是控制搜索框
 function switchSearchShowFrom(city){
	 _scGlobal = setTimeout("switchSearchShow('"+city+"')",500);
 }
 
 function switchSearchShow(city){
	 $(".sou_400_con .nav_div .tabNav li").removeClass("active");
	 $("#"+city+"Li").addClass("active");
	 $("#hotelSearchFormDiv").removeClass("active");
	 $("#ticketSearchFormDiv").removeClass("active");
	 $("#holidaySearchFormDiv").removeClass("active");
	 $("#"+city+"Div").addClass("active");
 }
	 
function showCHSearchForm(url){
	try{
		$.ajax({
		   type: "POST",
		   url: url,
		   success: function(cValue){
			   	var tagdiv = document.getElementById("ticketSearchFormDiv");
			   	tagdiv.innerHTML = cValue;	
			   //	_tagCnID = "placeToS";
				//_tagID = "placeTo";
				try{document.getElementById("searchDate").value=getDateCC(new Date(),-1);}catch(e){}
				try{document.getElementById("returnDate").value=getDateCC(new Date(),-30);}catch(e){}
				//alert(getCookie("placeToS"));
				if(getCookie("placeToS")!=""){
					document.getElementById("placeToS").value = getCookie("placeToS");
					document.getElementById("placeTo").value = getCookie("placeTo");
					document.getElementById("contentType").value = getCookie("contentType");
				}
				ZZ.module.searchBox.init();
				loadPlace();
		   }
		});
	}catch(e){window.status=(e.description);}
}
function showHotelSearchForm(url){
	var rsp=$.ajax({
	   type: "get",
	   url: url,
	   cache:false,
	   async:false
	}).responseText;
//	var d=document.getElementById("hotelSearchFormDiv");
//	document.getElementById("hotelSearchFormDiv").innerHTML=rsp;
	$("#hotelSearchFormDiv").html(rsp);
//	$.ajax({
//		   type: "POST",
//		   url: url,
//		   cache:false,
//		   success: function(cValue){
//			var d=document.getElementById("hotelSearchFormDiv");
//			document.getElementById("hotelSearchFormDiv").innerHTML=cValue;
//		}
//	});
	
}

function loadHotelIndexSetTimeOut(){
	var placeName=document.getElementById("placeToS").value;
	var placeId=document.getElementById("placeTo").value;
	loadHotelIndex(placeName,placeId);
}
///globalHotel.do?method=hotHotel	
function loadHotelIndex(placeName,placeId){
	if(placeName==null||placeName==undefined||placeName==""||placeId==null||placeId==undefined||placeId=="")return;
	$.ajax({
		url:"/globalHotel.do?method=hotHotelByCity&placeId="+placeId,
		cache:false,
		type:"POST",
		success:function(cValue){
			if(cValue.indexOf("error")!=-1){
				return;
			}else{
				var hm='<span class="cOrange" >'+placeName+'</span>的酒店，目前有房最低价为<span class="cRed3 f14px fB">￥'+cValue+'</span>';
				$("#searchPlaceName").html(hm);
				//$("#searchPlacePrice").html("￥"+cValue);
			}
		}
	});
}
	
	
