var childAddr="";
var formName="";
var defalutText="";
function changeAddr2(form,parentId,childId,provinceId,cityId,countyId,villageId){
  	childAddr=childId;
  	var areaId="";
  	var info;
  	formName=form
  	areaId = document.getElementById(parentId).value;
  	if(parentId==provinceId){
  		if (document.getElementById(cityId)){
  			document.getElementById(cityId).style.display="none";
  		}
  		if (document.getElementById(countyId)){
  			document.getElementById(countyId).style.display="none";
  		}
		if (document.getElementById(villageId)){
			document.getElementById(villageId).style.display="none";
		}
		defalutText="请选择市";
  	}else if(parentId==cityId){
  		if (document.getElementById(countyId)){
  			document.getElementById(countyId).style.display="none";
  		}
		if (document.getElementById(villageId)){
			document.getElementById(villageId).style.display="none";
		}
		defalutText="请选择区/县"
  	}else if(parentId==countyId){
  		if (document.getElementById(villageId)){
			document.getElementById(villageId).style.display="none";
		}
		defalutText="请选择乡填/社区"
  	}
	 		
   	var url="/register.go?action=loadContryOptions";
    var pars = "&areaId="+encodeURI(areaId);

 	var myAjax = new Ajax.Request(
            url,
     		{method: 'post', parameters: pars,onFailure: reportError,onComplete: showResponseAddr}
            );
}

function showResponseAddr(originalRequest){ 
    define=originalRequest.responseText;
    eval("data = "+define);
	var childs=data.childStr.split(",");
	var info=document.getElementById(childAddr);
	info.length=0;
	if (childs.length>0  && childs!=""){
		
		if (document.getElementById(childAddr)){
			document.getElementById(childAddr).style.display="inline";
		}

		info[0]=new Option(defalutText,"");
		if(childs != ""){
			for (var i=1; i <= childs.length; i++) {
				child=childs[i-1].split("#");
				info[i]=new Option(child[1],child[0]);
			}
		}
	}else{
		if (document.getElementById(childAddr)){
			document.getElementById(childAddr).style.display="none";
		}
	}
}

function reportError(request){
	alert('输入错误，请重心输入！');
}

	/** 头用到，鼠标移动到大厦上，查看楼层传入具体大厦ID和目标class **/
	var currentBuildingId="";
var selectBuildingId="";
	var cFloorId;
	var clearTime;
	function waitTime(posBuildingId,chinaName,currentFloorID){
		clearTimeout(clearTime);
		clearTime=setTimeout(function(){lookFloors(posBuildingId,chinaName,currentFloorID,posBuildingId)},2000);
	}
	function clearTimeFun(tyName,divn,posBuildingId,chinaName,currentFloorID){
		switch(tyName){
			case "oMove":
				clearTimeout(clearTime);
				break;
			case "oMOut":
				clearTime=setTimeout(function(){clearDiv(divn,posBuildingId,chinaName,currentFloorID)},1000);
				break;
			default:
				break;
		}
	}
function clearDiv(divn,posBuildingId,chinaName,currentFloorID){
  // document.getElementById(divn).style.display="none";
lookFloors(posBuildingId,chinaName,currentFloorID,posBuildingId);
}

	function lookFloors(posBuildingId,chinaName,currentFloorID,selectBuildId) {
		cFloorId=currentFloorID;
		currentBuildingId=posBuildingId;
		selectBuildingId=selectBuildId;
		
		if(chinaName=='首页'){
			document.getElementById("header-floor").style.display="none";
			//document.getElementById("header-bbs-floor").style.display="none";
			document.getElementById("header-live-floor").style.display="none";
				document.getElementById("header-job-floor").style.display="none";
		}else if(chinaName=='生活服务'){
			document.getElementById("header-floor").style.display="none";
		//	document.getElementById("header-bbs-floor").style.display="none";
				document.getElementById("header-job-floor").style.display="none";
			document.getElementById("header-live-floor").style.display="block";
			
			if (currentBuildingId==selectBuildingId){
				document.getElementById("service-floor").className="header-live-floor-lf";
			}else{
				document.getElementById("service-floor").className="header-live-floor-lf-2";
			}
		
		}else if(chinaName=='人才市场'){
			document.getElementById("header-floor").style.display="none";
			// document.getElementById("header-bbs-floor").style.display="none";
			document.getElementById("header-live-floor").style.display="none";
			document.getElementById("header-job-floor").style.display="block";
			if (currentBuildingId==selectBuildingId){
				document.getElementById("job-floor").className="header-live-floor-lf";
			}else{
				document.getElementById("job-floor").className="header-live-floor-lf-2";
			}
		
		}else{
		//	document.getElementById("header-bbs-floor").style.display="none";
			document.getElementById("header-live-floor").style.display="none";
			document.getElementById("header-job-floor").style.display="none";
			document.getElementById("header-floor").style.display="block";
			var url="/bxjHome.htm?action=getFloorsByPosBuildId";
	    	var pars ="&posBuildingId="+encodeURI(posBuildingId);
			var myAjax = new Ajax.Request(
	            url,
	     		{method: 'post', parameters: pars,onFailure: hasNoFloor4Bxj,onComplete: showFloors4Bxj}
	            );
		}
  		
	}

	function hasNoFloor4Bxj(request)
	{
	//   alert('抱歉,还没有开通楼层，请与管理员联系!');
	}

    function showFloors4Bxj(originalRequest)
    { 
    	var floorStr="";
    	var floor="";
    	var cl=""
    	define=originalRequest.responseText;
    	eval("data = "+define);
		var childs=data.childStr.split(",");
		var buildName=data.buildName;
		var buildUrl=data.buildUrl;
		if (childs.length>0 && childs != ""){
			var floorStr="	<table cellspacing='0'>";
	  			floorStr=floorStr+"<tr>";
		  	  	floorStr=floorStr+"	<td width='20%'>";
		  	  	floorStr=floorStr+"		<div>";
		  	  	floorStr=floorStr+"			<div id=\"kks\" " 
		  	  //	alert (currentBuildingId+"  --  "+selectBuildingId);
		  	  	if (currentBuildingId==selectBuildingId){
		  	  		floorStr=floorStr+"style='color:#009900; font-weight:bold;font-size:26px; text-align:center;'><a href='"+buildUrl+"'>"+buildName+"</a></div>";
		  	  	}else{
		  	  		floorStr=floorStr+"style='color:#ccc; font-weight:bold;font-size:26px; text-align:center;'>"+buildName+"</div>" ;
		  	  	}
		  	  	
		  	  	floorStr=floorStr+"		</div>";
		  	  	floorStr=floorStr+"	</td>";
		  	  	floorStr=floorStr+"	<td width='80%'>";
		  	  	floorStr=floorStr+"		<table class='bn'>";
			var j=0;
			for (var i=1; i <= childs.length; i++) {
				child=childs[i-1].split("#");
				if (j%4==0){
					floor=floor+"<tr>"
				}
				cl="";
				if (child[2] == cFloorId){
					cl="select"
				}
				
				if (i<10){
					floor=floor+"<td width='19%'><a href='"+child[0]+"' class='"+cl+"' target='_self'><em>0"+i+"楼:</em>"+child[1]+"</a></td>";
				}else{
					floor=floor+"<td width='19%'><a href='"+child[0]+"'  class='"+cl+"' target='_self'><em>"+i+"楼:</em>"+child[1]+"</a></td>";
				}
			
				
				j=j+1;
				if (j%4==0){
					floor=floor+"</tr>"
				}
			}
			if (j%4!=0){
				for(var t=1;t<(4-(j%4)+1);t++){
					floor=floor+"<td width='19%'>&nbsp;  </td>"
				}
					floor=floor+"</tr>"
			}
			floor=floor+"</table>"
			floorStr=floorStr+floor
			floorStr=floorStr+"		</td>"
		  	floorStr=floorStr+"  	</tr>"
		  	floorStr=floorStr+" </table>"
			
		}
		document.getElementById("header-floor").innerHTML=floorStr;
    }	

/* 地址栏隐藏显示部分 */
function showPic(objName){
	if(document.getElementById){
		return eval('document.getElementById("' + objName + '")');
	}
	else if(document.layers){
		return eval("document.layers['" + objName +"']");
	}
	else{
		return eval('document.all.' + objName);
	}
}

	var timeS;
	function addressDiv(btn,oD,num){
		
		if(showPic(num)){
		    btn.className="moreDiv";
			showPic(num).style.visibility='visible';
		}
	}
	
	function onMOut(oneDiv,twoDiv){
		clearTimeout(timeS);
		timeS=setTimeout('onMOutDiv("'+oneDiv+'","'+twoDiv+'")',1000);
	}
	function onMOutDiv(oD,tD){
		/*var iO=parseInt(oD.subStr(oD.indexOf("_"),1);*/
		if(showPic(oD)&&showPic(tD)){
			
			showPic(oD).className="moreNo";
			showPic(tD).style.visibility='hidden';
		}
		else{
			//alert("");
			}
	}
	function onMWait(tD){
		clearTimeout(timeS);
		if(showPic(tD)){
			showPic(tD).style.visibility='visible';
		}
	}
	
	
		function onAddrChange(newAddr){
		addr = newAddr;
	}
	function onWordsChange(newWords){
		words = newWords;
		start='0';
	}
	function onKeydown(evt){
		evt = evt?evt:window.event;
		var keynum=0;
		if(window.event) // IE
		{
			keynum = evt.keyCode;
		}
		else if(evt.which) // Netscape/Firefox/Opera
		{
			keynum = evt.which;
		}
		if(keynum==13){
			goSearch();
		}
	}
	function onKeydown2(evt){
		evt = evt?evt:window.event;
		var keynum=0;
		if(window.event) // IE
		{
			keynum = evt.keyCode;
		}
		else if(evt.which) // Netscape/Firefox/Opera
		{
			keynum = evt.which;
		}
		if(keynum==13){
			if(document.getElementById("words")){
					document.getElementById("words").value=document.getElementById("words2").value;
			}
			goSearch();
		}
	}
	function goSearch2(){
	   if(document.getElementById("words")){
	   	document.getElementById("words").value=document.getElementById("words2").value;
	   }
		
		goSearch();
	}
	function goSearch(){
	   var addr="";
		addr = "";
		words = ""; 
		type = "";
		bfId="";
		var posId="";
		if(document.getElementById("addr")){
			addr=document.getElementById("addr").value;
		}
		if( document.getElementById("words")){
			words=document.getElementById("words").value;
		}
		if(document.getElementById("searchType")){
			type=document.getElementById("searchType").value;
		}
		if(document.getElementById("posId")){
			posId = document.getElementById("posId").value;
		}
		if(document.getElementById("buildingFloorId")){
			bfId = document.getElementById("buildingFloorId").value;
		}
		
	
		
		if(words == "" || words.indexOf('请在这输入') > 0){
			return false;
		}
	
		if(addr == "" || addr.indexOf('可不填') > 0){
			addr="";
		}
		
		var query = "";
		if (type=='4'){
			query="/bxjHome.htm?action=gotoSearchBbs&type="+encodeURI(type)+"&words="+encodeURI(words)
			+"&addr="+encodeURI(addr)+"&posId="+encodeURI(posId)+"&bfId="+encodeURI(bfId);
		}else{
			query="/bxjHome.htm?action=gotoSearch&type="+encodeURI(type)+"&words="+encodeURI(words)
			+"&addr="+encodeURI(addr)+"&posId="+encodeURI(posId)+"&bfId="+encodeURI(bfId);
		}
		
		window.location.href = query;
	}
	
   //显示设定我的城市
   function showSetMyCity(){
   		if(document.getElementById("myciyt-box")){
   			document.getElementById("myciyt-box").style.display="block";
   		}
   }
      //隐藏设定我的城市
   function hiddenSetMyCity(){
   		if(document.getElementById("myciyt-box")){
   			document.getElementById("myciyt-box").style.display="none";
   			document.getElementById("province").selectedIndex=0;
   			document.getElementById("city").style.display="none";
   			document.getElementById("county").style.display="none";
   			document.getElementById("village").style.display="none";
   		}
   }
  
  //设定我的城市
  function setMyCity(formName){
  	  var pars ="";
 	  new Ajax.Updater('status',
	        'fileupload',
	         {asynchronous:true, method: 'post', parameters: pars, onFailure: errorSetCity});
	  document.forms[formName].submit();   	
  }
  function succSetMyCity(succ,cityUrl){
  	if(succ=="yes"){
  		alert('设置成功!');
  		document.getElementById("mycity1").style.display="inline";
  		document.getElementById("mycity1").href=cityUrl;
  		document.getElementById("mycity3").style.display="inline";
  		document.getElementById("mycity2").style.display="none";
  		this.hiddenSetMyCity();
  	}else{
  		alert('设置失败！');
  	}
  }
  function  errorSetCity(){
  	//
  }
  
  function openUrl(url) {
  	/*window.open(url);*/
	var formObj = document.createElement("form");
	formObj.action=url;
	formObj.target='_blank';
	document.documentElement.appendChild(formObj);
	formObj.submit();
  }
  
  function openwin(url){
 	window.open(url,"_blank");
  }
  
  function showPic(objName){//如果不用此函数就需要用到indexOf函数和String函数截取ID号码的数字编号
	if(document.getElementById)//判断是否IE ,Fixfore浏览器类型
	{
		return eval('document.getElementById("' + objName + '")');//返回一个动态有效的字串
	}
	else if(document.layers){ //浏览器判断
		return eval("document.layers['" + objName +"']");
	}
	else
	{
		return eval('document.all.' + objName);
	}
}
function showZindexDiv(ns){var divId=showPic("layer_"+ns);divId.style.display='';}

function showfd(j,js){
	var i=1,n=2;
	showPic("yansh").style.display ='none';
	showPic("topst").style.display = 'none';
	showPic().style.display ='block';
}


/** 首页开中间大图展示  **/
function showPic(objName){//如果不用此函数就需要用到indexOf函数和String函数截取ID号码的数字编号
	if(document.getElementById)//判断是否IE ,Fixfore浏览器类型
	{
		return eval('document.getElementById("' + objName + '")');//返回一个动态有效的字串
	}
	else if(document.layers){ //浏览器判断
		return eval("document.layers['" + objName +"']");
	}
	else
	{
		return eval('document.all.' + objName);
	}
}
var cTime;
function showZindexDiv(ns){clearTimeout(cTime);var divId=showPic("layer_"+ns);divId.style.display='';}

function showDelay(bn){
var idName=new String(bn);clearTimeout(cTime);cTime=setTimeout('showZindexOut("'+idName+'")',1000);}
function showZindexOut(idN){showPic(idN).style.display='none';}


var logoTime;
var stcIn=1;
function showLogo(tyone,tytwo,cur,total){
clearTimeout(logoTime);
for(var i=1;i<=total;i++){
if(showPic(tyone+i)&& showPic(tytwo+i)){
showPic(tyone+i).className="onlik";
showPic(tytwo+i).style.display='none';
}
}
if(showPic(tyone+cur)){
	showPic(tyone+cur).className="twhor";
	showPic(tytwo+cur).style.display='';
}
stcIn=cur;
if(stcIn<total)
stcIn++;
else
stcIn=1;
logoTime=setTimeout(function(){showLogo('logonum_','logo_',stcIn,3);},4000);

}
logoTime=setTimeout(function(){showLogo('logonum_','logo_',stcIn,3);},4000);


/** 结束中间大图展示**/

						
						function Marquee2()
						{
							clearTimeout(mys2);
							
							var hzst = document.getElementById("hzst");
							var hzst2 = document.getElementById("hzst2");
							document.getElementById("hzst2").innerHTML=document.getElementById("hzst").innerHTML;
							if(hzst2.offsetWidth-gund.scrollLeft<=0)
								{gund.scrollLeft-=hzst.offsetWidth;}
							else{gund.scrollLeft+=ifspx;}
							/*mys=setTimeout('Marquee2()',speed2);*/
							
						}
						
						
						
 function showdiv(){
	
}			
						//中部横滚图脚本

function stcsh()
{
	
	for (var i=0;i<stallpg;i++){document.getElementById("bdfh").innerHTML+="<img src='"+stimg0.src+"' />";}
	document.getElementById("bdfh").getElementsByTagName('img')[stnow-1].src=stimg1.src;
}
function stbb(id)
{
	  for (var i=0;i<stallpg;i++)
	  {document.getElementById("bdfh").getElementsByTagName('img')[i].src=stimg0.src;}
	  document.getElementById("bdfh").getElementsByTagName('img')[id].src=stimg1.src;
}
var mys2;
function stleft()
{
	clearInterval(mys);
	gund.scrollLeft=stallw;
	if(stnow>1)
	{
		stbb(stnow-2);
		if(stnow!=0){
		stnow--;
		}
		
		/*gund.scrollLeft+=stseep;*/
		gund.scrollLeft-=stseep*(stnow);
		if(stnow==1){
		gund.scrollLeft=1;
		}
		/*alert("向左方向："+stnow);*/
		
	}
	mys=setInterval('clr()',9000);
	
}

function stright()
{
	
	clearInterval(mys);
	/*gund.scrollLeft=1;*/
	/*gund.scrollLeft=0;*/
	if(stnow==stallpg){
		
	}
	else{
		gund.scrollLeft=1;
		if(stnow<=stallpg&&gund.scrollLeft<stallw)
		{	
			stbb(stnow);
		/*gund.scrollLeft-=stseep;*/
			gund.scrollLeft+=stseep*stnow;
			stnow++;
			
		
		}
		}
	
	mys=setInterval('clr()',9000);
}
function clr(){
	mys=setInterval('Marquee2()',speed2);
}
