﻿function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}

function show_area(pre, n, select_n){for (i=1;i <= n;i++){
var aread=document.getElementById(pre+i);
aread.style.display="none";
if(i==select_n){aread.style.display="block";}
}}
function G(id){return document.getElementById(id);}
function show_intro(pre,pree, n, select_n){
for (i=1;i <= n;i++){
var intro=G(pre+i);
var cha=G(pree+i);
intro.style.display="none";
cha.className="menu_off";
if(i==select_n){
intro.style.display="block";
cha.className="menu_on";
}
}
}
function show_tab(pre,pree,cls,n,select_n){
for (i=1;i <= n;i++){
var intro=G(pre+i);
var cha=G(pree+i);
intro.style.display="none";
cha.className=cls+"2";
if(i==select_n){
intro.style.display="block";
cha.className=cls+"1";
}
}
}

function show_ad(pre,n){
var id=Math.round(Math.random()*(n-1))+1;
for (i=1;i <= n;i++){
var ad350=G(pre+i);
ad350.style.display="none";
if(i==id){ad350.style.display="block";}
}
}
function $a(id,tag){var re=(id&&typeof id!="string")?id:document.getElementById(id);if(!tag){return re;}else{return re.getElementsByTagName(tag);}}
function movec()//点击移动
{
	var o=$a("bd1lfimg");
	var oli=$a("bd1lfimg","li");//所有LI列表
    var oliw=oli[0].offsetWidth;//每次移动的宽度
	var ow=o.offsetWidth-2;
	var dnow;//=oli.length-3;//当前位置
	var day=(new Date()).getDay();
	switch(day)
	{
		case 1:dnow=0;break;
		case 2:dnow=1;break;
		case 3:dnow=2;break;
		case 4:dnow=3;break;
		case 5:dnow=4;break;
		case 6:dnow=5;break;
		case 0:dnow=6;break;
	}
	var olf=oliw-(ow-oliw+10)/2;
		o["scrollLeft"]=olf+(dnow*oliw);
	var rqbd=$a("bd1lfsj","ul")[0];
	var extime;
	var rqnr=["","1","2","3","4","5","6","7",""];

	for(var i=1;i<oli.length-1;i++){rqbd.innerHTML+="<li>"+rqnr[i]+"</li>";}

	var rq=$a("bd1lfsj","li");
	for(var i=0;i<rq.length;i++){reg(i);};
	oli[dnow+1].className=rq[dnow].className="show";
	var wwww=setInterval(uu,3000);

	function reg(i){rq[i].onclick=function(){oli[dnow+1].className=rq[dnow].className="";dnow=i;oli[dnow+1].className=rq[dnow].className="show";mv();}}
	function mv(){clearInterval(extime);clearInterval(wwww);extime=setInterval(bc,15);wwww=setInterval(uu,3000);}
	function bc()
	{
		var ns=((dnow*oliw+olf)-o["scrollLeft"]);
		var v=ns>0?Math.ceil(ns/10):Math.floor(ns/10);
		o["scrollLeft"]+=v;if(v==0){clearInterval(extime);oli[dnow+1].className=rq[dnow].className="show";v=null;}
	}
	function uu()
	{
		if(dnow<oli.length-3)
		{
			oli[dnow+1].className=rq[dnow].className="";
			dnow++;
			oli[dnow+1].className=rq[dnow].className="show";
		}
		else{oli[dnow+1].className=rq[dnow].className="";dnow=0;oli[dnow+1].className=rq[dnow].className="show";}
		mv();
	}
}
function paipic()//点击移动
{
	var p=$a("zipai");
	var pli=$a("zipai","li");
	var rn=Math.floor(Math.random()*10);
	if (rn>5){
	  	rn-=4;
	}
	for(var i=1;i<pli.length-1;i++){
		pli[rn].className="alpha_100";
	}
}

function setcookie(cookieName, cookieValue) {
  var expires = new Date();
    expires.setTime(expires.getTime() + 24*60*60*365);
    document.cookie = cookieName + '='+ escape (cookieValue) + ';expires=' + expires.toGMTString();
}

function SetCity(value)
{
	setcookie('MplifeArea',value);
	location.reload(true);
}

//24小时悦读 频道滑动门
function SwitchTag(tit,box,s,show,time)
{
	var t=tit.split('/'),b=box.split("/"),ts=$a(t[0],t[1]),bs=$a(b[0],b[1]),s=s||"onmouseover",now=show=show||0,c;
	for(var i=0;i<ts.length;i++){ts[i].old=ts[i].className.replace("show","");bs[i].old=bs[i].className.replace("show","");reg(i);}
	function init(){for(var i=0;i<ts.length;i++){ts[i].className=ts[i].old;bs[i].className=bs[i].old;};if(now!=-1){ts[now].className+=(t[2]||"")+" show";bs[now].className+=(b[2]||"")+" show";}}
	function reg(i){ts[i][s]=function(){clearInterval(c);now=i;init();}
	if(show!=-1&&time){bs[i].onmouseover=function(){clearInterval(c);};bs[i].onmouseout=function(){go();};ts[i].onmouseout=function(){go();}}
	if(show==-1&&s=="onmouseover"){ts[i].onmouseout=function(){now=-1;init();}}}
	function go(){c=setInterval(function(){(now<ts.length-1)?now++:now=0;init();},time);}
	if(show!=-1&&time){go();};init();
}
//幻灯片轮换
if(typeof PicFocusManager == "undefined")
	{
		PicFocusManager =[];
	}
	function PicFocus(imageContainerID,textContainerID,buttonContainerID,intervarTime){
		this.$ = function (id){return document.getElementById(id)}
		this.index = PicFocusManager.length;
		PicFocusManager[PicFocusManager.length] = this;
		this.imageContainer = this.$(imageContainerID);
		this.textContainer = this.$(textContainerID);
		this.buttonContainer = this.$(buttonContainerID);
		this.firstShow = 0; //默认显示项
		this.interval = (isNaN(intervarTime)?0:intervarTime) || 5000;
		 //切换时间
		this.canAutoPlay = true; //是否可以自动切换
		this.currentPosition = this.firstShow;
		this.timer;
		this.images = [];
		this.texts = [];
		this.buttons = [];
		this.bindEvent = function(){
			var _self = this;
			for(var i=0;i<this.images.length;i++){
				this.images[i].onmouseover = function(){
					_self.stop();
				}
				this.images[i].onmouseout = function(){
					_self.timer = setTimeout('PicFocusManager[' + _self.index + '].play()' , _self.interval )
				}
			}
			for(var i=0;i<this.buttons.length;i++){
				this.buttons[i].onmouseover = function(){
					_self.focus(this);
				}
			}
		}
		this.play = function(){
			if(this.canAutoPlay){
				this.setFocus(this.currentPosition ++ )
				if(this.currentPosition >= this.images.length)this.currentPosition =0 ;
				this.timer = setTimeout('PicFocusManager[' + this.index + '].play()' , this.interval )
			}
		}
		this.stop = function(){
			clearTimeout( this.timer );
		}
		this.focus = function(button){
			for(var i=0;i<this.buttons.length;i++){
				if(this.buttons[i] == button){
					this.currentPosition = i;
					this.setFocus(this.currentPosition);
					break;
				}
			}
		}
		this.setFocus = function(i){
			if(/Microsoft/.test(navigator.appName)){
				this.imageContainer.filters[0].apply();
				this.imageContainer.filters[0].play();
			}
			for(var j=0;j<this.images.length;j++){
				this.images[j].style.display = (i==j)?"":"none";
			}
			for(var j=0;j<this.texts.length;j++){
				this.texts[j].style.display = (i==j)?"":"none";
			}
			for(var j=0;j<this.buttons.length;j++){
				this.buttons[j].className = (i==j)? this.buttons[j].getAttribute("focusClass") :this.buttons[j].getAttribute("normalClass");
			}
			if(/Microsoft/.test(navigator.appName)){  //滤镜版本
				new ActiveXObject("DXImageTransform.Microsoft.Fade");
				this.imageContainer.filters[0].play();
			}
		}
		this.init = function(){
			if(this.imageContainer && this.buttonContainer){
				//init
				this.images=this.imageContainer.getElementsByTagName("img");
				if(this.textContainer) this.texts=this.textContainer.getElementsByTagName("label");
				this.buttons=this.buttonContainer.getElementsByTagName("a");
				this.bindEvent();
				for(var i=0;i<this.images.length;i++){
					this.images[i].style.display = "none";
					if(i<this.texts.length) this.texts[i].style.display = "none";
					this.buttons[i].className = this.buttons[i].getAttribute("normalClass");
					this.buttons[i].target="_self";
				}
				this.images[this.firstShow].style.display = "";
				if(this.firstShow<this.texts.length) this.texts[this.firstShow].style.display = "";
				this.buttons[this.firstShow].className = this.buttons[this.firstShow].getAttribute("focusClass");
			}else{
				alert("未提供正确的参数")
			}
		}
	}



//切换图
function clickMove(list,show,upbt,dobt)
{
	var as=$a(list),ss=$a(show,"dl"),li=$a(as,"li"),h=75,ubt=$a(upbt),dobt=$a(dobt),now=1;for(var i=0;i<7;i++){reg(i);}
	function reg(i){li[i].onclick=function(){now=i;init();}}
	dobt.onclick=function(){if(now<6){now++;}else{now=0;}init();};
	ubt.onclick=function(){if(now>0){now--;}else{now=6;}init();}
	function init(){for(var i=0;i<ss.length;i++){li[i].className="";ss[i].className="";}
	li[now].className="show";ss[now].className="show";if(now==6){as["scrollTop"]=4*h;}else{as["scrollTop"]=(now-1)*h;}};init();
	var uimg=addImg(ubt.src),uimg1=addImg(ubt.src.replace(/(.*)(\.\w{4})/,"$1_$2"));
	ubt.onmouseover=function(){this.src=uimg1.src;};ubt.onmouseout=function(){this.src=uimg.src;}
	var dimg=addImg(dobt.src),dimg1=addImg(dobt.src.replace(/(.*)(\.\w{4})/,"$1_$2"));
	dobt.onmouseover=function(){this.src=dimg1.src;};dobt.onmouseout=function(){this.src=dimg.src;}
}

//服饰频道页街拍图片展示
function setPanelContClass(parentId,className,elemTag,index){ 
	var parent_node = document.getElementById(parentId); 
	var elems = parent_node.getElementsByTagName(elemTag);
	var num = 0;
	for(var i=0;i<elems.length;i++){
		if(elems[i].className.indexOf(className)<0) continue;
		var classname = elems[i].className;
		elems[i].className = classname.replace(/curren/, "normal");
		if(num == index){elems[i].className = classname.replace(/normal/, "curren");}
		num++;
	}
}
function tagglePanel(parentId,menuId,contClass,mTag,mIndex){
	if(!document.getElementById(parentId)) return false;
	if(!document.getElementById(menuId)) return false;
	
	var menu_arr = document.getElementById(menuId).getElementsByTagName(mTag);
	var pTotleNum = menu_arr.length; 
	if((mIndex+1)>pTotleNum) return false;
 	
	for(var i=0;i<pTotleNum;i++){ 
		var str = menu_arr[i].className;
		menu_arr[i].className = str.replace(/curren/, "normal");
		
	}
	var mClassname = menu_arr[mIndex].className; 
	menu_arr[mIndex].className = mClassname.replace(/normal/, "curren");
	
	setPanelContClass(parentId,contClass,"div",mIndex);
} 

//首页中部右栏滑动门合集
function showMen5(n){
	for(var i=1;i<=3;i++){
		var curCon=document.getElementById("list5_"+i);
		var curBtn=document.getElementById("listb5_"+i);
		if(n==i){
			curBtn.style.display="block";
			curCon.className="p2_lt03"
		}else{
			curBtn.style.display="none";
			curCon.className="p2_lt04";			
		}
	}
}

function showMen3(n){
	for(var i=1;i<=3;i++){
		var curCon=document.getElementById("list3_"+i);
		var curBtn=document.getElementById("listb3_"+i);
		if(n==i){
			curBtn.style.display="block";
			curCon.className="p2_lt03"
		}else{
			curBtn.style.display="none";
			curCon.className="p2_lt04";			
		}
	}
}

function showMen2(n){
	for(var i=1;i<=3;i++){
		var curCon=document.getElementById("list2_"+i);
		var curBtn=document.getElementById("listb2_"+i);
		if(n==i){
			curBtn.style.display="block";
			curCon.className="p2_lt03"
		}else{
			curBtn.style.display="none";
			curCon.className="p2_lt04";			
		}
	}
}