$(document).ready(function() {
//--------------------------------------------城市管理按选择
$("select:[name='sf']").change(function(){
		sf=$(this).children("option:selected").val();
		acs=$(this).next();
		adq=$(this).next().next();
		$.get("../ajax/csxz.asp?lx=sfxz&sf="+sf,function(data){
			acs.empty();
			acs.append("<option value='' >请选择</option>");
			adq.empty();
			adq.append("<option disabled>请选择</option>");
			var cs=data.split(",");
				for(i=0;i<cs.length;i++){
					acs.append("<option value='"+cs[i]+"'>"+cs[i]+"</option>");
				}
		});	  					  
	});	
	$("select:[name='cs']").change(function(){
		var cs=$(this).children("option:selected").val();
		adq=$(this).next();
		$.get("../ajax/csxz.asp?lx=csxz&cs="+cs,function(data){
			adq.empty();
			adq.append("<option value=''>请选择</option>");
			var dq=data.split(",");
				for(i=0;i<dq.length;i++){
					adq.append("<option value='"+dq[i]+"'>"+dq[i]+"</option>");
				}	
		});	 					  
	});	

//--------------------------------------------TOP登陆设置
	$(".loginpanel").click(function(){RB_box()});

//--------------------------------------------首页幻灯片设置
	var currentIndex = 0;
	var DEMO; //函数对象
	var SPa=$(".wrap .left .SP a")
	var SPspan=$(".wrap .left .SP span")
	var SPtitle=$(".wrap .left .SP .title")
	SPa.eq(0).show(); //默认
	var num=SPa.length;//查询幻灯片数量
	autoScroll();
	SPspan.click(function() {
		StopScrolll($(this).html());
		$(this).css('background','#e9389b');
		$(this).css('color','#FFFFFF');
		$(this).css('border','1px solid #e9389b');
		
		SPspan.not($(this)).css('background','#FFFFFF');//除了自身全部改变
		SPspan.not($(this)).css('color','#666666');
		SPspan.not($(this)).css('border','1px solid #CCCCCC');
		
		SPa.not(SPa[$(this).html()-1]).hide(); //除了自身别的全部隐藏
		SPa.eq($(this).html()-1).fadeIn("slow");
		SPtitle.html(SPa.eq($(this).html()-1).attr("title"));
		DEMO = setTimeout(autoScroll, 8000);
	});
	//自动滚动
	function autoScroll() {
		SPa.eq(currentIndex).fadeIn("slow");
		SPa.eq(currentIndex - 1).hide();
		SPtitle.html(SPa.eq(currentIndex).attr("title"))

		SPspan.css('background','#FFFFFF');
		SPspan.css('color','#666666');
		SPspan.css('border','1px solid #CCCCCC');
		
		SPspan.eq(currentIndex).css('background','#e9389b');
		SPspan.eq(currentIndex).css('color','#FFFFFF');
		SPspan.eq(currentIndex).css('border','1px solid #e9389b');
	//	
//		SPspan.eq(currentIndex - 1).css('background','#FFFFFF');
//		SPspan.eq(currentIndex - 1).css('color','#666666');
//		SPspan.eq(currentIndex - 1).css('border','1px solid #CCCCCC');
		
		currentIndex++; currentIndex = currentIndex >= num ? 0 : currentIndex;
		DEMO = setTimeout(autoScroll, 8000);
	}
	function StopScrolll(n)//当鼠标移动到对象上面的时候停止自动滚动
	{
		currentIndex = n
		currentIndex = currentIndex >= num ? 0 : currentIndex;
		clearTimeout(DEMO);
	}
//--------------------------------------------首页提建议
	$(".Statistics .JY_form textarea").click(function(){
		if($(this).val()=="请在这里输入您对久爱婚姻网的建议"){$(this).val("");$(this).css("color","#333");}
	});
	$(".Statistics .JY_form input").hover(function(){$(this).css('background','url(images/bg_uleft_c.gif)');},function(){$(this).css('background','url(images/bg_uleft.gif)')});
	$(".Statistics .JY_form input").click(function(){
		content=$(".Statistics .JY_form textarea").val()
		$.get("ajax/ajax.asp?l=jianyi&content="+content,function(data){doing(data,'1')});
	});
//--------------------------------------------首页分类选项卡设置
	$.get("ajax/zt.asp",function(data){$(".wrap .left .Classification div.content").html(data)});
	$(".wrap .left .Classification ul li.kind a").click(function(){//当点击KIND婚姻类型时
		loading();
		kind=$(this).html();
		city=$(".wrap .left .Classification ul li.city a.default").html();
		$.get("ajax/zt.asp?kind="+kind+"&city="+city,function(data){
			$(".wrap .left .Classification div.content").html(data);
			closebox_ALL();
		});
		$(this).attr('class','default');
		$(".wrap .left .Classification ul li.kind a").not($(this)).attr('class','');
	});
	$(".wrap .left .Classification ul li.city a").click(function(){//当点击CITY城市时
		loading();
		city=$(this).html();
		kind=$(".wrap .left .Classification ul li.kind a.default").html();
		if(city=='更多&gt;&gt;'){location.href="UserList.asp";}else{
			$.get("ajax/zt.asp?kind="+kind+"&city="+city,function(data){
				$(".wrap .left .Classification div.content").html(data);
				closebox_ALL();	
			});
		}
		$(this).attr('class','default');
		$(".wrap .left .Classification ul li.city a").not($(this)).not($(".wrap .left .Classification ul li.city a.last")).attr('class','');
	});
//--------------------------------------------login.asp页面所搜设置
$(".login_wrap .right .login ul li.Submit input").hover(function(){$(this).css('background','url(images/bg_uleft_c.gif)');},function(){$(this).css('background','url(images/bg_uleft.gif)')});
//--------------------------------------------UserList.asp页面所搜设置
	$(".userlist_ss .PX .PX_text .MORE_SS_down").click(function(){
		location.href="SearchUI.asp";
	});
//--------------------------------------------SearchUI.asp页面所搜设置
	$(".SearchUI_wrap .right .SearchformID .SFID_in #nicheng").click(function(){
		if($(this).val()=="请输入要搜索的昵称"){$(this).val("");$(this).css("color","#222222");}
	});
//--------------------------------------------reg.asp页面所搜设置
	$(".reg_wrap .right ul li h2 input").focusin(function(){
		lx=$(this).attr("name");
		va=$(this).attr("value");
		Th=$(this).parent().parent().children('h3');
		Th.css('color','#333333');
	});
	$(".reg_wrap .right ul li h2 input").blur(function(){
		lx=$(this).attr("name");
		va=$(this).attr("value");
		Th=$(this).parent().parent().children('h3');
		Tb=$(this).parent().parent().children('b');
		if(lx=="password_y"){py=$("#password").attr("value");}else{py='';}
		$.get("ajax/reg_usertest.asp?lx="+lx+"&va="+va+"&py="+py,function(data){
			if(data=="ok"){
				Th.html('');
				Tb.css('display','inline-block');
				Tb.css('background','url(images/rz_yes.gif) no-repeat center center');
			}else{
				Th.html(data);
				Th.css('color','red');
				Tb.css('display','inline-block');
				Tb.css('background','url(images/rz_no.gif) no-repeat center center');
			}
		});
	});
//--------------------------------------------setuser.asp页面所搜设置
	$(".set_wrap .right ul li h2 input,.set_wrap .right ul li h2 select,.set_wrap .right ul li h2 textarea").focusin(function(){
		lx=$(this).attr("name");
		va=$(this).attr("value");
		Th=$(this).parent().parent().children('h3');
		Th.css('color','#333333');
	});
	$(".set_wrap .right ul li h2 input,.set_wrap .right ul li h2 select,.set_wrap .right ul li h2 textarea").blur(function(){
		lx=$(this).attr("name");
		va=$(this).attr("value");
		Th=$(this).parent().parent().children('h3');
		Tb=$(this).parent().parent().children('b');
		if(lx=="password_y"){py=$("#password").attr("value");}else{py='';}
		$.get("ajax/reg_usertest.asp?lx="+lx+"&va="+va+"&py="+py,function(data){
			if(data=="ok"){
				Th.html('');
				Tb.css('display','inline-block');
				Tb.css('background','url(images/rz_yes.gif) no-repeat center center');
			}else{
				Th.html(data);
				Th.css('color','red');
				Tb.css('display','inline-block');
				Tb.css('background','url(images/rz_no.gif) no-repeat center center');
			}
		});
	});
//---------------------------------------------------------【婚缘fate.asp】弹窗设置
$(".fate_k_l ul li span input,.fate_k_r ul li span input").hover(function(){$(this).css('border','1px solid #d971b6');$(this).css('background','#FAFAFA')},function(){$(this).css('border','1px solid #999999');$(this).css('background','#FFFFFF')});
$(".pop p a").each(function(){
	$(this).attr('title',$(this).html())
	});
$(".fate_k_l ul li span input,.fate_k_r ul li span input").click(function(){
				m=$(this).attr('name')
				n=m.replace('T_',""); 
				//alert('pop'+n)
				BtPopShow('pop'+n,'pop'+n);BtPopHide('close'+n,'pop'+n);
				$(".pop").attr('v',m)	

				});
$(".pop p a").click(function(){
	num=$(this).parent().children("a[b='1']").length
	nu=$(this).parent().parent().attr('nu')
	sp=$(this).parent().parent().children('p:first').children('span')
			if($(this).attr('b')!='1'){if(num!=nu){$(this).attr('b','1');$(this).css('background','#009933');$(this).css('color','#FFFFFF')}else{sp.css('color','red');sp.css('font-weight','bold');}}
			else{$(this).attr('b','0');$(this).css('background','#FFFFFF');$(this).css('color','#333333')}
							   
	});
$(".pop p input[name='xzcz']").click(function(){//当点击重新选择后
		an=$(this).parent().parent().children('p').children('a')
		an.attr('b','0');
		an.css('background','#FFFFFF');
		an.css('color','#333333')});
$(".pop p input[name='xzok']").click(function(){//当点击确认后
	id=$(this).parent().parent().attr('v')
	
	u=0
	var va
	$(this).parent().parent().children('p').children("a[b='1']").each(function(){
		if(u==0){va=$(this).html();}else{va=va+','+$(this).html();}
	u++
	});
//alert(va)
	$("#"+id).val(va);
	i=id.replace('T_',""); 
	$('#close'+i).click();
	});
$("#T_u1").click(function(){
	u0=$(".fate_k_l ul:eq(0)").children("li:eq(0)").children("span").html()
	u0=u0.replace('岁',"")
	if(u0>=18&&u0<=22){ru0="18岁-22岁"}
	if(u0>=23&&u0<=26){ru0="23岁-26岁"}
	if(u0>=27&&u0<=32){ru0="27岁-32岁"}
	if(u0>=33&&u0<=40){ru0="33岁-40岁"}
	if(u0>=41&&u0<=50){ru0="41岁-50岁"}
	if(u0>=51){ru0="50岁以上"}
	$(".fate_k_r ul:eq(0)").children("li:eq(0)").children("span").children("input").val(ru0)
	
	u1=$(".fate_k_l ul:eq(0)").children("li:eq(1)").children("span").html()
	$(".fate_k_r ul:eq(0)").children("li:eq(1)").children("span").children("input").val(u1)
	
	u2=$(".fate_k_l ul:eq(0)").children("li:eq(2)").children("span").html()
	$(".fate_k_r ul:eq(0)").children("li:eq(2)").children("span").children("input").val(u2)
	
	u3=$(".fate_k_l ul:eq(0)").children("li:eq(3)").children("span").html()
	u3=u3.replace('cm',"")
	if(u3>=145&&u3<=155){ru3="145cm-155cm"}
	if(u3>=156&&u3<=165){ru3="156cm-165cm"}
	if(u3>=166&&u3<=175){ru3="166cm-175cm"}
	if(u3>=176&&u3<=185){ru3="176cm-185cm"}
	if(u3>=186&&u3<=200){ru3="186cm-200cm"}
	$(".fate_k_r ul:eq(0)").children("li:eq(3)").children("span").children("input").val(ru3)
	
	u4=$(".fate_k_l ul:eq(0)").children("li:eq(4)").children("span").html()
	u4=u4.replace('kg',"")
	if(u4>=30&&u4<=40){ru4="30kg-40kg"}
	if(u4>=41&&u4<=50){ru4="41kg-50kg"}
	if(u4>=51&&u4<=60){ru4="51kg-60kg"}
	if(u4>=61&&u4<=70){ru4="61kg-70kg"}
	if(u4>=71&&u4<=80){ru4="71kg-80kg"}
	if(u4>=81&&u4<=90){ru4="81kg-90kg"}
	$(".fate_k_r ul:eq(0)").children("li:eq(4)").children("span").children("input").val(ru4)
	
	$(".fate_k_r ul:eq(0)").children("li:eq(5)").children("span").children("input").val("与我同一个城市,与我同一个地区")
	$(".fate_k_r ul:eq(0)").children("li:eq(6)").children("span").children("input").val("未婚")
	$(".fate_k_r ul:eq(0)").children("li:eq(7)").children("span").children("input").val("没有")
	
	u8=$(".fate_k_l ul:eq(0)").children("li:eq(8)").children("span").html()
	$(".fate_k_r ul:eq(0)").children("li:eq(8)").children("span").children("input").val(u8)
	u9=$(".fate_k_l ul:eq(0)").children("li:eq(9)").children("span").html()
	$(".fate_k_r ul:eq(0)").children("li:eq(9)").children("span").children("input").val(u9)
	
	$(".fate_k_r ul:eq(0)").children("li:eq(10)").children("span").children("input").val("高中,大专,本科")
	
	u11=$(".fate_k_l ul:eq(0)").children("li:eq(11)").children("span").html()
	$(".fate_k_r ul:eq(0)").children("li:eq(11)").children("span").children("input").val(u11)
	
	u12=$(".fate_k_l ul:eq(0)").children("li:eq(12)").children("span").html()
	$(".fate_k_r ul:eq(0)").children("li:eq(12)").children("span").children("input").val(u12)
	
	$(".fate_k_r ul:eq(0)").children("li:eq(13)").children("span").children("input").val("以后再告诉你,与父母同住,已购房(有贷款),已购房(无贷款),需要时购置")
});							
$("#T_u2").click(function(){
	$(".fate_k_l ul:eq(1) li").each(function(i){
	var u=new Array()
	u[i]=$(this).children("span").children("input").val()
	if(u[i]!="")
		{$(".fate_k_r ul:eq(1)").children("li:eq("+i+")").children("span").children("input").val(u[i]);$("#T_u2").attr("st","0")}else{$("#T_u2").attr("st","1")}
	});											
	if($("#T_u2").attr("st")=="1"){doing('您的兴趣爱好不能为空，请选择！','1')}
});
$("#T_u3").click(function(){
	$(".fate_k_l ul:eq(2) li").each(function(i){
	var u=new Array()
	u[i]=$(this).children("span").children("input").val()
	if(u[i]!="")
		{$(".fate_k_r ul:eq(2)").children("li:eq("+i+")").children("span").children("input").val(u[i]);$("#T_u3").attr("st","0")}else{$("#T_u3").attr("st","1")}
	});											
	if($("#T_u3").attr("st")=="1"){doing('您的婚姻资料不能为空，请选择！','1')}
});
//---------------------------------------------------------【用户管理u.asp】设置
$(".u_wrap .left .U_list li").each(function(i){
   $(this).children('a').css('background','url(images/Ulist/u_'+ i +'.gif) no-repeat left center');
 });
$(".u_wrap .left .U_list li").hover(
  function () {
    $(this).css('background','#FFFFFF');
  },
  function () {
    $(this).css('background','');
  }
);
$(".u_wrap .left").css('height',$(".u_wrap .certer").css('height'));
$(".u_wrap .certer .UTemplate .menu a:first").css('border-left','1px solid #CCCCCC');
$(".u_wrap .certer .UTemplate .menu a:first[class='d']").css('border-left','1px solid #f026ab');
$(".u_wrap .certer .UTemplate .content .xc_list li").hover(function(){$(this).css('border','1px solid #f026ab');},function(){$(this).css('border','1px solid #CCCCCC');})
$("#U_xc_upload_tc").click(function(){//弹出上传照片窗口
	UP_box()					
});
$("#U_xc_settx_tc").click(function(){//弹出设置头像窗口
	settx_box()					
});
$(".u_wrap .certer .UTemplate .content .yx_xx ul li h1 input[name='chkall']").click(function(){
	if($(this).attr("checked")){
		$(".u_wrap .certer .UTemplate .content .yx_xx ul li").each(function(){
			$(this).children('h1').children("input[name='list']").attr("checked","checked")
		})	
	}else{
		$(".u_wrap .certer .UTemplate .content .yx_xx ul li").each(function(){
			$(this).children('h1').children("input[name='list']").removeAttr("checked")
		});
	}
});
$(".u_wrap .certer .UTemplate .content .prop_mx ul li h1 input[name='chkall']").click(function(){
	if($(this).attr("checked")){
		$(".u_wrap .certer .UTemplate .content .prop_mx ul li").each(function(){
			$(this).children('h1').children("input[name='list']").attr("checked","checked")
		})	
	}else{
		$(".u_wrap .certer .UTemplate .content .prop_mx ul li").each(function(){
			$(this).children('h1').children("input[name='list']").removeAttr("checked")
		});
	}
});
$(".u_wrap .certer .UTemplate .content .onrg_mx ul li h1 input[name='chkall']").click(function(){
	if($(this).attr("checked")){
		$(".u_wrap .certer .UTemplate .content .onrg_mx ul li").each(function(){
			$(this).children('h1').children("input[name='list']").attr("checked","checked")
		})	
	}else{
		$(".u_wrap .certer .UTemplate .content .onrg_mx ul li").each(function(){
			$(this).children('h1').children("input[name='list']").removeAttr("checked")
		});
	}
});
$(".u_wrap .certer .UTemplate .content .story_list ul li h1 input[name='chkall']").click(function(){
	if($(this).attr("checked")){
		$(".u_wrap .certer .UTemplate .content .story_list ul li").each(function(){
			$(this).children('h1').children("input[name='list']").attr("checked","checked")
		})	
	}else{
		$(".u_wrap .certer .UTemplate .content .story_list ul li").each(function(){
			$(this).children('h1').children("input[name='list']").removeAttr("checked")
		});
	}
});

$(".UTemplate .content .fate_Mat .start input[name='DOpipei']").click(function(){
	PP_doing()
});
			$(".UTemplate .content .fate_show ul li:not(:eq(3),:eq(7))").css("margin-right","1px")
			$(".UTemplate .content .fate_show ul li").hover(function(){$(this).css('border','10px solid #CCCCCC');},function(){$(this).css('border','10px solid #FFFFFF');})
$("#start_fate").click(function(){
	doing('正在匹配...请稍等...','100')
	$.get("ajax/ajax.asp?l=fate&fanwei=100&xianshi=8",function(data){
		if(data=="ok"){
			location.href="u.asp?t=fate&f=3";
		};
		if(data=="djno"){
			doing('对不起您的【久缘印章】道具不够支付本次匹配，请先购买！','1')
		};
	});
});
$("#VIP_start_fate").click(function(){
	doing('正在匹配...请稍等...','100')
	$.get("ajax/ajax.asp?l=fate&fanwei=100&xianshi=8&vip=ok",function(data){
		if(data=="ok"){
			location.href="u.asp?t=fate&f=3";
		}
		if(data=="vipno"){
			doing('对不起您还不是VIP用户！','1')
		}
	});
});
$(".UTemplate .content .fate_show ul li:lt(4)").css("margin-bottom","1px")

$(".UTemplate .content .myprop ul li").hover(function(){$(this).css('border','2px solid #CCCCCC');},function(){$(this).css('border','2px solid #FFFFFF');})
$(".UTemplate .content .friend_list ul li:even").css("border-right","none")
$(".UTemplate .content .friend_list ul li:lt(2)").css("border-bottom","none")

$(".UTemplate .content .friend_list ul li .r .mark textarea").hover(function(){$(this).css('border','1px solid #CCCCCC');},function(){$(this).css('border','1px solid #ffffff');})







$(".um_wrap .left").css('height',$(".um_wrap .certer").css('height'));


//---------------------------------------------------------【购买道具】设置
$(".box_prop .list ul li a").hover(function(){$(this).css('border','1px solid #f026ab');},function(){$(this).css('border','1px solid #CCCCCC');})
$(".box_prop .list ul li").click(function(){
	$(".box_prop .list ul li").not($(this)).css("border","2px solid #FFFFFF")
	$(this).css("border","2px solid #f026ab")
	$(".box_prop .mai .l h1 b").html($(this).children('a').attr("name"))
	$(".box_prop .mai .l h2 b").html($(this).children('a').attr("content"))
	$(".box_prop .mai .l h3 b").html($(this).children('a').attr("jiage"))
	$(".box_prop .mai .r input[name='id']").val($(this).children('a').attr("iid"))
});
//---------------------------------------------------------【设置名片弹窗】设置
$("#line_tc_setmp ul p input").click(function(){
	qx_mp=$("#line_tc_setmp ul li input[name='qx_mp']").val()
	lx=$("#line_tc_setmp ul li input[name='lx']:checked").val()
	content=$("#line_tc_setmp ul li.ab textarea").val()
	
	doing('正在生成名片，请稍后...','100')
	$.get("/ajax/ajax.asp?l=setmp&qx_mp="+qx_mp+"&lx="+lx+"&content="+content,function(data){
		var d=data.split(",");
		if (d[0]=="no"){doing(d[1],'1')}else{TZ_p_prop();}
	});
});
$("#mpshow").click(function(){
	$.get("/ajax/ajax.asp?l=mpshow&id="+$(this).attr("uid"),function(data){
		if (data=="djno"){lock_doing('您没有魔法镜道具，请先购买!','3')}
		else if (data=="mpno"){lock_doing('此用户没有设置名片，或此用户名片不允许您查看','3')}
		else{PH_show('会员名片','../'+data,372,230)}
	});
});
$("#fate_pp").click(function(){
	$.get("/ajax/ajax.asp?l=fatepp&id="+$(this).attr("uid"),function(data){
		lock_doing("系统打分："+data+"缘分",'5')
	});
});
//---------------------------------------------------------【邮箱弹窗】设置
$("#DJ1,#DJ2,#DJ3,#DJ4").click(function(){//弹出道具赠送窗口
	$("#ZSDJ_box").attr('did',$(this).attr('id'));
	ZSDJ_box();
});
$("#ZSDJ_box a").click(function(){//弹出道具赠送窗口
	djsl=$(this).children('b').html();
	id=$(this).attr('id');
	
	$("#sy"+id).html(djsl);
	$("#sy"+id).parent().next('input').attr('value',djsl);
	ZSDJ_sl_box("sl"+id)					
});
$("#ZSDJ_box input[name='button']").click(function(){//弹出道具赠送窗口
	jianqu=$(this).prev('input').attr('value');//获取写入的值
	
	aid=$(this).attr('aid');//获取A标签的ID
	shuliang=$("#"+aid).children('b').html();//获取道具的剩余数量
	shengyu=shuliang-jianqu;//道具的剩余数量减去赠送的道具数量
	
	did=$("#ZSDJ_box").attr('did');
	b="url(../"+$(this).parent().attr('b')+")"
	tdid = did.replace('DJ','')
	if(jianqu!=0 && shengyu>=0){
		$("#"+aid).children('b').html(shengyu);//为A标签附赠剩余的数量
		$("#"+did).css('background',b);
		$("#DJZS_form input[name='dj"+tdid+"']").val(aid);
		$("#DJZS_form input[name='sl"+tdid+"']").val(jianqu);
		$("#"+did).html('<b>'+jianqu+'</b>');
	}
	closebox_ALL();
});
$("#TXL_box a,#TXL_hy_box a").click(function(){//弹出通讯录 好友
	$(".new_yx ul li h2 input.tt").val($(this).html())
	closebox_ALL();
});
$(".new_yx ul li h2 a.JS_all").click(function(){
	doing('正在接受...','100')
	id=$(this).attr("id")
	$.get("ajax.asp?str=JS_all&eid="+id,function(data){
		closebox_ALL();
		doing(data,'1');
		$("#JSDJ1,#JSDJ2,#JSDJ3,#JSDJ4").css("background","url(../images/dj/djbg.gif)");
		$("#JSDJ1,#JSDJ2,#JSDJ3,#JSDJ4").html("");
		$(".new_yx ul li h2 a.JS_all").html("");
	});
});
//---------------二次弹窗设置
function BtHide(id){var Div = document.getElementById(id);if(Div){Div.style.display="none"}}
function BtShow(id){var Div = document.getElementById(id);if(Div){Div.style.display="block"}}

function BtTabRemove(index,head,divs) {
	var tab_heads = document.getElementById(head);
	if (tab_heads) {
	var lis = tab_heads.getElementsByTagName("li"); var as = tab_heads.getElementsByTagName("a");
	for(var i=0;i<as.length;i++){lis[i].className = "";BtHide(divs+"_"+i);if (i==index) {lis[i].className = "current";}}
	BtShow(divs+"_"+index)}
}

function BtTabOn(head,divs){
	var tab_heads=document.getElementById(head);
	if (tab_heads) {
	BtTabRemove(0,head,divs);
	var alis=tab_heads.getElementsByTagName("a");
	for(var i=0;i<alis.length;i++) {
	alis[i].num=i;
	alis[i].onclick = function(){BtTabRemove(this.num,head,divs);this.blur();return false;}
	alis[i].onfocus = function(){BtTabRemove(this.num,head,divs)}}}
}

function BtZebraStrips(id,tag) {
	var ListId = document.getElementById(id);
	if(ListId){
	var tags  = ListId.getElementsByTagName(tag);
	for(var i=0;i<tags.length;i++) {
	tags[i].className   += " barry"+i%2;
	tags[i].onmouseover = function(){this.className += " hover"}
	tags[i].onmouseout  = function(){this.className = this.className.replace(" hover","")}}}
}

function BtPopload(showId){
	var h = Math.max(document.documentElement.scrollHeight,document.documentElement.clientHeight) + 'px';
	var w = document.documentElement.scrollWidth + 'px';
	var popCss = "background:#000;opacity:0.3;filter:alpha(opacity=30);position:absolute;left:0;top:0;overflow:hidden;"
	var exsit = document.getElementById("popBox");
	if (!exsit) {
		pop_Box = document.createElement("div");pop_Box.id = "popBox";
		document.getElementsByTagName("body")[0].appendChild(pop_Box);
		pop_Box.style.cssText = popCss;pop_Box.style.zIndex = "10";
		pop_Box.style.height = h;pop_Box.style.width = w;
		
		pop_Iframe = document.createElement("iframe");pop_Iframe.id = "popIframe";
		document.getElementsByTagName("body")[0].appendChild(pop_Iframe);	
		pop_Iframe.style.cssText = popCss;pop_Iframe.style.zIndex = "9";
		pop_Iframe.style.height = h;pop_Iframe.style.width = (parseInt(w)-5)+"px";
	}
	BtShow("popIframe");BtShow("popBox");BtShow(showId);
	pop_Win = document.getElementById(showId);
	pop_Win.style.position = "absolute";
	pop_Win.style.zIndex = "11";
	pop_Win.style.top = document.documentElement.scrollTop+document.documentElement.clientHeight/2-pop_Win.offsetHeight/2+ 'px';
	pop_Win.style.left = (document.documentElement.clientWidth/2-pop_Win.offsetWidth/2) + 'px';
}
function BtPopShow(Bid,Did) { 
	var UploadBtn = document.getElementById(Bid);
	BtPopload(Did);
}
function BtPopHide(Bid,Did) { 
	var UploadBtn = document.getElementById(Bid);
	if (UploadBtn){UploadBtn.onclick = function() {BtHide(Did);BtHide("popBox");BtHide("popIframe");return false;}}	
}	
});
