var myDate=new Date();
function getDep(){
var _1="/GetDep.do";
var _2="id="+$F("adv_univId")+"&t="+myDate.getTime();
var _3=new Ajax.Updater({success:"adv_dep"},_1,{method:"get",parameters:_2,onFailure:reportError});
}
function getDorm(){
var _4="/GetDorm.do";
var _5="id="+$F("adv_univId")+"&t="+myDate.getTime();
var _6=new Ajax.Updater({success:"adv_dorm"},_4,{method:"get",parameters:_5,onFailure:reportError});
}
function reportError(_7){
var _8=_7.status+" -- "+_7.statusText;
alert("\u4e0b\u8f7d\u5bbf\u820d\u548c\u9662\u7cfb\u5217\u8868\u51fa\u9519:(  \u9519\u8bef\u4fe1\u606f\uff1a"+_8);
}

function $(ID){
	return document.getElementById(ID);
}
var todo="";
var bodyclick=true;
var hotelCityClick = true;	//住宿首页搜索时切换城市判断，全局变量
var indexChangeCityClick = true;	//网站首页搜索住宿时切换城市判断，全局变量
var t_id=null;
var h_id=null;
var changeCityID="1595";
var changeCityPinyin="Beijing";
var checkDistrictOrCounty = "district";


function showpan(_9,_a){
	t_id=$(_9);
	h_id=$(_a);
	if(todo!="show"){
		return false;
	}	
	var x,y;
	x=findPosX($("s_city"));
	y=findPosY($(_9));
	$("univlist").style.left=x+"px";
	$("univlist").style.top=y+22+"px";
	$("univlist").style.display="block";
	if($("priceRange")!=null)
		$("priceRange").style.display="none";
	if($("roomNum")!=null)	
		$("roomNum").style.display="none";
	if($("customerNum")!=null)
		$("customerNum").style.display="none";
	if($("top_district")!=null)
		$("top_district").style.display="none";
	if($("Price_area")!=null)
		$("Price_area").style.display="none";
	if($("iSearchType")!=null)
		$("iSearchType").style.display="none";	
		
		
	if($("level")!=null)
		$("level").style.display="none";
	if($("ticketRange")!=null)
		$("ticketRange").style.display="none";	
		
	//alert("aa");
	return false;
}


function hidepan(){
	if(todo!="hide")
		return false;
	if(typeof (selectElList)!="undefined"){
		var i=0;
		for(i=0;i<selectElList.length;i++){
			selectElList[i].style.display="";
		}
	}
	if($("priceRange")!=null)
		$("priceRange").style.display="";
	if($("roomNum")!=null)		
		$("roomNum").style.display="";
	if($("customerNum")!=null)
		$("customerNum").style.display="";
	if($("top_district")!=null)
		$("top_district").style.display="";
	if($("Price_area")!=null)
		$("Price_area").style.display="";
	if($("iSearchType")!=null)
		$("iSearchType").style.display="";	
		
	if($("level")!=null)
		$("level").style.display="";
	if($("ticketRange")!=null)
		$("ticketRange").style.display="";	
	$("univlist").style.display="none";
	return false;
}

var searchType="people";



function cl(e){	
	if(!e){
		var e=window.event;
	}
	if(e.target){
		targ=e.target;
	}else{
		if(e.srcElement){
			targ=e.srcElement;
		}
	}
	if(targ.nodeType==3){
		targ=targ.parentNode;
	}
	var _f=targ.innerHTML;
	var _10=targ.href;
	//alert("_f="+_f);
	//alert(_10);
	var _11=_10.indexOf("id=");
	if(_11==-1){
		//alert("哈哈哈");
		//return false;
	}else{
		_11+=3;
		var _12=_10.substring(_11);
	}
	//alert(h_id);
	if(h_id!=null){
		t_id.value=_f;
		if(h_id!=null){
			h_id.value=_12;
		}
	}else{
		if(searchType=="people"){
			if($("adv_univ")!=null)
				$("adv_univ").value=_f;
			if($("adv_univId")!=null)
				$("adv_univId").value=_12;
			//alert($("adv_univ").value);
			}else{
				$("adv_univ").value=_f;
				$("adv_univId").value=_12;
				getDep();
				getDorm();
			}
	}
	//alert("1");
	if ( typeof( setHotelNationCityID ) == 'function' )	//这儿是判断是否存在这个js函数
		setHotelNationCityID(t_id.value,changeCityID);
	if ( typeof( changeBusinessDistrictOrCountyList ) == 'function' )	
		changeBusinessDistrictOrCountyList(changeCityID,checkDistrictOrCounty);
	
	//alert("t_id="+t_id.value);
	setCookie("changeCityPinyin",changeCityPinyin,3,"/",null,null);
	if(t_id!=null){
		setCookie("cityName",t_id.value,3,"/",null,null);
	}
	if(changeCityID!=null){		
		setCookie("cityID",changeCityID,3,"/",null,null);
	}
	//alert(getCookie("cityName"));
	t_id=null;
	h_id=null;
	todo="hide";
	hidepan();
	//alert("hotelCityClick="+hotelCityClick);
	if(!hotelCityClick)
		return false;
	if(!indexChangeCityClick)
		return false;
	//return false;
}

function idSearch(el){
var _14=getEl(el).value;
var _15=/^(\d{4,10})$/;
if(!_15.test(_14)){
alert("\u7528\u6237ID\u683c\u5f0f\u4e0d\u6b63\u786e\uff084-10\u4e2a\u6570\u5b57\uff09");
getEl(el).focus();
return false;
}
document.location.href="/getuser.do?portal=search&id="+_14;
}

