poplogin= new PopLogin();

function  getOpenArea(a){
	var poplogin2= new PopLogin();
	if(false==poplogin2.loginCheck()){
		return;
	}
	var url="/around/listAreaAjax.jsps?clickevent="+a+"&t="+new Date();
	Ajax.doGet(url,null,shArea);
}
function shArea(e){
	document.getElementById("around_other_area").style.display="block";
	document.getElementById("around_other_area").innerHTML=e;
}
function changeArea(acode){
	//window.location.search="?areaCode="+acode;
	//window.location.host=acode;
	window.location.href="/around/changeAreaDefault.jsps?areaCode="+acode+"&t="+new Date();
}
function changeShopDetailArea(acode){
	window.location="/around/around.jsps?areaCode="+acode;
}

var out_div = true;//标识--解决div内部元素事件紊乱问题

function hidAreaDiv(obj){
	 out_div = true;
}

function showAreaDiv(obj){
	 out_div = false;
}

document.onclick=function(oevent){
	 oevent=window.event||oevent;
	 var obje = oevent.srcElement ? oevent.srcElement : oevent.target;
	 var obj2=document.getElementById('around_other_area');
	 var obj3=document.getElementById('around_other_qh');
	if(out_div&&obj2&&obje!=obj2&&obje!=obj3){
		  if(obj2.style.dispaly!='none'){
			obj2.style.display='none';
		 }
	}
};



function showNsu(_acode,_aname){
	var content='<div class="firsttime">'
		+'<input type="hidden" id="userAreaCode" value="'+_acode+'" /><input type="hidden" id="userAreaName" value="'+_aname+'"/>'
		+'<p class="p1">亲爱的天天网用户：</p>'
		+'<p class="p2">天天网目前推出了<strong class="red">深圳市-车公庙片区</strong>的周边信息，包含了深圳市车公庙片区所有商店（包括餐饮、服饰、商场等）即时打折信息、深圳市各公共场所的活动信息（如画展、音乐会、演唱会等），您也可以爆料一些自己的所见所闻，<a href="/around/index.jsps" title="" class="uline">马上去看看</a>。</p>'
		+'<p class="p2">如果您不在深圳或对该片区的周边信息没有兴趣，请您留下你的常用E-mail及所在地，我们将根据您的反馈尽快开通并即时通知您，您可以先上天天网<strong class="red">享受其它交友、相片涂鸦、姓名测试、争车位、开店游戏等</strong>游戏，放松您的心情。</p>'
		+'<p class="p3"><label for="">E-mail:</label><input type="text" id="nsu_mail" name="" value="" maxlength="50"/></p>'
		+'<p class="p3"><label for="">所在地:</label><input type="text" name=""  maxlength="30" id="nsu_location" value="" /></p>'
		+'<p class="p4"><input type="button" onclick="saveNsu();" name="" id="gotest" value=" 马上体验 " /><input type="button" id="nisz" name="" onclick=" document.getElementById(\'gotest\').style.disabled=true;this.style.disabled=true;window.location=\'http://www.tiantian17.com/user/index.jsps\'" value="我不在深圳" /></p>'
		+'</div>';
		pop('提示',content);
}

function saveNsu(e){
	document.getElementById('gotest').style.disabled=true;
	document.getElementById('nisz').style.disabled=true;
	var mail=document.getElementById('nsu_mail');
	var locat=document.getElementById('nsu_location');
	if((!mail||!mail.value)&&(!locat||!locat.value)){
		closeBox();
		return ;
	}
	if(mail&&mail.value&&!checkEmail(mail.value)){
		alert("邮箱不正确!");
		document.getElementById('gotest').style.disabled=false;
		document.getElementById('nisz').style.disabled=false;
		return false;
	}
	var locavalue=(locat&&locat.value)?locat.value:document.getElementById('userAreaName').value;
	var url="/around/saveContact.jsps";
	var ps="nsu.areacode="+document.getElementById('userAreaCode').value+"&nsu.location="+encodeURIComponent(locavalue)+"&nsu.email="+mail.value;
	Ajax.doPost(url,ps,null,nsu_back);
	return ;
}
function nsu_back(){
	closeBox();
	window.location="/around/index.jsps";
}
 



var catelistamount, catelisttimer,goright;//goright用于标识向左还是右移1:右，0:左
var dis_width, tb_width;//分别标明外层div与内蹭table宽度

function initCateDiv(){
	if(document.getElementById("catelist_tb_div")){
		dis_width=document.getElementById("catelist_tb_div").clientWidth;
	}
	if(document.getElementById("catelist_tb")){
		tb_width=document.getElementById("catelist_tb").clientWidth;
	}
	
	//getGif(-1);

}
function move(v1,v2,v3){
	goright=v3;
	catelistamount=v1;
	catelisttimer=setInterval("movelist()", v2);
}
function movelist(){
	document.getElementById("catelist_tb_div").scrollLeft+=catelistamount;
	getGif(goright);
}
function stopmove(v){
	clearInterval(catelisttimer);
	getGif(-1);
}
function getGif(v){
	goright=v;
	//alert(goright+":dis_width:"+dis_width+":tb_:"+tb_width+"::"+document.getElementById("catelist_tb_div").scrollLeft);
	var leftimgsrc="http://ss.tiantian17.com/images/new/global/tl1.gif";
	var rightimgsrc="http://ss.tiantian17.com/images/new/global/tr1.gif";
	var scl=0;
	if(document.getElementById("catelist_tb_div"))
		scl=document.getElementById("catelist_tb_div").scrollLeft;
	// deal left gif
	if(scl<=0){
		leftimgsrc="http://ss.tiantian17.com/images/new/global/tl1.gif";
	}else{
		if(goright==0){
			leftimgsrc="http://ss.tiantian17.com/images/new/global/tl3.gif";
		}else{
			leftimgsrc="http://ss.tiantian17.com/images/new/global/tl2.gif";
		}
	}
//deal right gif
	if((scl+dis_width<tb_width)){
		if(goright==1){
			rightimgsrc="http://ss.tiantian17.com/images/new/global/tr3.gif";
		}else{
			rightimgsrc="http://ss.tiantian17.com/images/new/global/tr2.gif";
		}
	}else if(scl+dis_width>=tb_width){
		rightimgsrc="http://ss.tiantian17.com/images/new/global/tr1.gif";
	}
	if(document.getElementById("goleft"))
		document.getElementById("goleft").src=leftimgsrc;
	if(document.getElementById("goright")){
		document.getElementById("goright").src=rightimgsrc;
	}
	
}

function autoGOtoCate(_cid){
	initCateDiv();
	var ag=document.getElementById("allcate").childNodes,al=0;
	for(var i=0;i<ag.length;i++){
		var nname = ag[i].nodeName.toLowerCase();
		if(nname=="#text"||nname==""||nname=="script")continue;
		if (nname=="td"&&ag[i].className=="now"){break;}
			al+=ag[i].offsetWidth;
	}
	document.getElementById("catelist_tb_div").scrollLeft=0;
	var A=240;
	if (al>A)document.getElementById("catelist_tb_div").scrollLeft=al-A>0?al-A:0;
		getGif(-1);
}

function outListDiv(obj,_id){
	obj.style.background='';
	var wydp=document.getElementById('wydp_div'+_id);
	if(wydp) wydp.style.display='none';
}
function inListDiv(obj,_id){
	obj.style.background='#fefaf2';
	var wydp=document.getElementById('wydp_div'+_id);
	if(wydp) wydp.style.display='block';
}