function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function UrlEncode(str){var rs;try{rs=VBS_UrlEncode(str)}catch(e){rs=JS_UrlEncode(str)}return rs;}

function GE(a){try{return document.getElementById(a)}catch(e){alert(a+'不存在')}}

function getCookie(Name){var search=Name+"=";document.cookie.Domain="cccv.cn";if(document.cookie.length>0){var offset = document.cookie.indexOf(search);if(offset!=-1){offset+=search.length;var end=document.cookie.indexOf(";",offset);if(end==-1)end=document.cookie.length;return unescape(document.cookie.substring(offset,end));}else{return "";}}else{return "";}}

function setCookie(name,value,time) {if(time==0){document.cookie=name+"="+escape(value)+";domain=.cccv.cn;path=/;";}else{var today=new Date();var expires=new Date();expires.setTime(today.getTime()+60000*time);document.cookie = name + "=" + escape(value) +"; domain=.cccv.cn; path=/; expires="+ expires.toGMTString();}}

function cCookie(name){document.cookie=name+'=;domain=.cccv.cn;path=/;'}



var show = new Object();
show.Version="2.0";
show.isOpen=false;
show.select="";
show.sTitle='';show.sTip='';show.sLeft='';show.sContent='';show.sBottom='';show.sWidth='100';show.sClose=true;show.MX=0;show.MY=0;show.sec=0;show.Interval;show.Timeout;

show.lx=0, show.ly=0, show.canDrg=false, show.thiso=null, show.x, show.y;

show.close=function (){
	show.shield(0);
	GE('InputBg').style.display='none';
	try{
		if( show.select != '' ){
			var list = show.select.split(",");
			for( var no=0; no<list.length; no++ ){
				GE(list[no]).style.display = '';
				if(no>100){ return }
			}
		}
	}catch(e){}

	show.isOpen = false;
	clearTimeout(show.Interval);
	clearTimeout(show.Timeout);
}


show.autoclose=function (num){ clearTimeout(show.Timeout); show.Timeout = setTimeout ( 'show.close()', num ); show.sec=num; clearTimeout(show.Interval); show.Interval = setInterval ( 'show.closetip()', 1000 ); }

show.closetip=function (){var a;if(show.sec>0){show.sec=show.sec-1000; a=show.sec/1000; GE('InputTitle').innerHTML=show.sTitle +'('+a+'秒后关闭)';}else{clearTimeout(show.Interval);}}

show.open=function (){
	try{
		if( show.select != '' ){
			var list = show.select.split(",");
			for( var no=0; no<list.length; no++ ){
				GE(list[no]).style.display = "none";
				if(no>100){ return }
			}
		}
	}catch(e){}
	GE('InputBg').style.display='';
	show.isOpen = true;
	show.move();
	clearTimeout(show.Interval);
	clearTimeout(show.Timeout);
}

show.move=function (){
	if(show.isOpen){
		if(show.MY==0){
			var docTop = document.documentElement.scrollTop||document.body.scrollTop;
			var docHeight = document.documentElement.clientHeight||document.body.clientHeight;
			GE('InputBg').style.top=(docTop+(docHeight-GE("InputBg").offsetHeight)/2)+"px";
		}else{
			GE('InputBg').style.top=show.MY;
		}
		if(show.MX==0){
			var docLeft = document.documentElement.scrollLeft||document.body.scrollLeft;
			var docWidth = document.documentElement.clientWidth||document.body.clientWidth;
			GE('InputBg').style.left=(docLeft+(docWidth-GE("InputBg").offsetWidth)/2)+"px";
		}else{
			GE('InputBg').style.left=show.MX;
		}
	}
}

show.snap=function(obj,position,MovePx){
	if(MovePx==null){MovePx=0}
	var objLeft = obj.offsetLeft;
	var objTop = obj.offsetTop;
	var objParent = obj.offsetParent;
	while (objParent.tagName != "BODY") {
		objLeft += objParent.offsetLeft;
		objTop += objParent.offsetTop;
		objParent = objParent.offsetParent;
	}
	if(position=='bl'){objTop+=obj.offsetHeight+2;}
	else if(position=='br'){objTop+=obj.offsetHeight+2;objLeft-=(MovePx-obj.clientWidth);}
	else if(position=='bc'){objTop+=obj.offsetHeight+2;objLeft-=(MovePx-obj.clientWidth)/2;}
	else if(position=='lb'){objLeft-=(MovePx+2);}
	else if(position=='rb'){objLeft+=(obj.clientWidth+2);}

	if(objLeft<1){objLeft=1;objTop+=obj.offsetHeight+2;}
	if(objTop<1){objTop=1;objLeft+=(obj.clientWidth+2);}

	show.MX=objLeft+'px'; show.MY=objTop+'px';
}


show.inner=function (name,values){
	if( values==''|values==null ){
		GE(name).style.display='none';
	}else{
		GE(name).style.display='';
		GE(name).innerHTML=values;
	}
}

show.tip=function (titles,tips,lefts,contents,bottoms,width,isclose,ishold){
	if(ishold==null|ishold){ show.sTitle=titles; show.sTip=tips; show.sLeft=lefts; show.sContent=contents; show.sBottom=bottoms; show.sWidth=width; show.sClose=isclose; }

	GE('InputBg').style.width=width;

	show.inner ( 'InputTitle', titles );
	show.inner ( 'InputTips', tips );
	show.inner ( 'InputBottom', bottoms );
	show.inner ( 'InputLeft', lefts );
	show.inner ( 'InputContent', contents );

	if(isclose){
		GE("InputClose").style.display='none';
	}else{
		GE("InputClose").style.display='';
	}
	show.open();
}

show.renew=function (){ show.tip(show.sTitle, show.sTip, show.sLeft, show.sContent, show.sBottom, show.sWidth, show.sClose, false); }

show.hidden=function (obj,mode){
	if(mode==null){
		if(GE(obj).style.display==''){
			GE(obj).style.display = 'none'
		}else{
			GE(obj).style.display = ''
		}
	}else if(mode==1){
		GE(obj).style.display = ''
	}else if(mode==0){
		GE(obj).style.display = 'none'
	}
}

// 加载提示
show.loading=function (str){
	if(str==null){ str='正在处理，请稍候' }
	show.tip( '','','','<div style="padding:15px 10px;"><img src="http://img.cccv.cn/h/loading.gif" width="16" height="16" align="absmiddle"> '+ str +'.....</div>','','350px', true, false );
}

// 保护层
show.shield=function(a){
	if(a==0){
		GE('shield').style.display='none';
	}else{
		var docWidth=document.documentElement.scrollWidth||document.body.scrollWidth;
		var docHeight=document.documentElement.scrollHeight||document.body.scrollHeight;
		GE('shield').style.width=docWidth+'px';
		GE('shield').style.height=docHeight+'px';
		if(a==1){GE('shield').style.display=''}
	}
}

show.dargit=function (o,e){
	show.thiso = o;
	show.canDrg = true;
	if(!document.all){
		show.lx = e.clientX; show.ly = e.clientY;
	}else{
		show.lx = event.x; show.ly = event.y;
	}
	if(document.all) show.thiso.setCapture();
	show.st(o);
}

show.st=function(o){
	var p = o.parentNode;
	if(p.lastChild != o){
		p.appendChild(o);
	}
}

show.systip=function(name,val,num){
	clearTimeout(show.sysout);
try{ GE(name).innerHTML=val;} catch (e){alert(name)}



	GE(name).style.display='';
	if(num>9){show.sysout=setTimeout('GE("'+name+'").style.display="none"',num)}
}



function getXMLHTTPRequest(){var xRequest=null;if(window.XMLHttpRequest){xRequest=new XMLHttpRequest();}else if(typeof ActiveXObject != "undefined"){xRequest=new ActiveXObject("Microsoft.XMLHTTP");}return xRequest;}

function loadRequest(url,parames,method,tiptitle,tipobj,tipbegin,tipok,tiperr,isshow,mode){
	if(tipobj==''){tipobj='console'}
	if(tipbegin==null){tipbegin='no'}
	if(tipok==null){tipok='no'}
	if(mode==null){mode='js'}
	if(tiperr==null){tiperr='no'}
	if(tipbegin==''){tipbegin='正在'+ tiptitle +'...'}
	if(tipok==''){tipok=tiptitle +'完成'}
	if(tiperr==''){tiperr=tiptitle +'错误，操作中止'}

	if(tipbegin!='no'){ show.systip(tipobj,tipbegin,0) }
	var XR=getXMLHTTPRequest();
	if(XR){
		XR.onreadystatechange=function(){
			if(XR.readyState==4){
				if(XR.status==200){
					if(mode=='js'){eval(XR.responseText)}else{GE(mode).innerHTML=XR.responseText}
					if(tipok!='no'){ show.systip(tipobj,tipok,3000) }
				}else if(XR.status==404){
					if(tiperr!='no'){ show.systip(tipobj,'没有找到网页',0);show.tip( '系统提示','','','<div style="padding:20px 10px;text-align:left;font-size:14px;">对不起，没有找到 <b>'+ tiptitle +'('+url+')</b> 网页</div>','<input type="button" value="返回" onClick="show.close()" class="button1">','400px' );ErrLog(404,url,XR.responseText); }
				}else{
					if(tiperr!='no'){ show.systip(tipobj,tiperr,0);show.loading('系统发现错误，正在提交错误信息，如果长时间没有反应，请刷新当前网页');ErrLog(XR.status,url,XR.responseText); }
				}
			}
		}
		if(method==null){method='POST'}
		if(parames==null){parames=''}
		XR.open(method,url,true);
		XR.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		XR.send(parames)
	}else{
		if(tipobj!=null){ show.systip(tipobj,'浏览器不支持',0) }
	}
}

function ErrLog(cat,url,text){
	var XR=getXMLHTTPRequest();
	if(XR){
		XR.onreadystatechange=function(){ if(XR.readyState==4){if(XR.status==200){eval(XR.responseText)}}}
		text=UrlEncode(text);
		XR.open('POST','/wrtm/errlog5.asp',true);
		XR.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		XR.send('cat='+cat+'&url='+url+'&text='+text);
	}
}



var login = new Object();
login.states=0; login.uid=''; login.name=''; login.cat=0; login.vip=0; login.cid=0; login.outplace='login_tip'; login.iuid=''; login.ipsd=''; login.mode=0; login.dojs=''; login.okjs=''; login.nojs=''; login.exitjs=''; login.alert=0;

login.disabled=function(val){if(document.forms.length==0){return}for(var i=0;i<document.forms.length;i++){if(document.forms[i].name.substring(0,5)=='login'){try{document.forms[i].submit.disabled=val}catch(e){}}}}

login.input=function (tips, okjs, nojs, userid){
	if( tips==null ){ tips='' }
	if( okjs==null|okjs=='' ){ okjs=login.dojs }
	if( nojs==null|nojs=='' ){ nojs=login.dojs }

	login.okjs=okjs; login.nojs=nojs;

	if(userid==null){ userid = getCookie("userid") }
	if(userid==null){ userid='' }
	login.iuid=userid;

	var bottoms = '<A HREF="/common/zt/reg/" target="_blank" style="color:red">还不是会员，免费注册&gt;&gt;</A>';
	var contents = '<form name="loginform1" style="margin:0" onSubmit="return login.inputcheck(this);"><input type="hidden" name="tipobj" value="InputTips"><div align="left" style="padding:10px 10px 6px 10px;">用户名 <input type="text" name="uid" maxlength="20" onFocus="this.select();" style="border: #CCC 1px solid;font-size:12px;ime-mode:disabled;width:130px;" value="'+ userid +'"> <a href="/common/zt/reg/forget/forgetid1.asp" target="_blank" tabindex="0">忘记用户名</a></div> <div align="left" style="padding:3px 10px 6px 10px;">密　码 <input type="password" name="psd" maxlength="50" onFocus="this.select();" style="border: #CCC 1px solid; font-size:12px;ime-mode:disabled;width:130px;"> <a href="/common/zt/reg/forget/forgetpsd1.asp" target="_blank" tabindex="0">忘记密码</a></div><div style="padding:15px;text-align:center;"><input type="image" src="http://img.cccv.cn/h/btn01_login.gif" width="52" height="21" name="submit"> <a href="/common/zt/reg/privy.asp" target="_blank"><img src="http://img.cccv.cn/h/btn01_reg.gif" width="52" height="21" border="0" alt="注册"></a></div></form>';

	show.tip( '会员登录', tips, '', contents, bottoms, '300px', false, false );
}

login.inputcheck=function(theform){
	var uid=theform.uid.value;
	var psd=theform.psd.value;
	var remember;
	var tipobj=theform.tipobj.value;

	try{if(theform.remember.checked){remember=1}else{remember=0}}catch(e){remember=0}

	if(uid==""){alert("用户名 不能为空!");return false;}
	if(uid.length<3){alert("用户名必须大于或等于3个字符！");return false;}
	if(uid.length>18){alert("用户名必须小于18个字符！");return false;}

	uid=uid.toLowerCase();

	var compStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-_.";
	for(var i=0;i<uid.length;i++){
		if(compStr.indexOf(uid.charAt(i))==-1){
			alert("请输入正确的用户名，用户名只能为半角的数字或英文字符！"); return false;
		}
	}

	if(psd==""){alert("密码 不能为空!"); return false;}

	if(tipobj==''){tipobj=login.outplace;var mode=2,alert2=login.alert;}else{var mode=1,alert2=0;}

	login.disabled(true);

	var url='/common/logincheck4.4.asp';

	var parames='status=Checkem&userid='+ uid +'&password='+ psd +'&remember='+ remember +'&alert='+ alert2 +'&mode='+ mode +'&okjs='+ login.okjs +'&nojs='+login.nojs +'&tipobj='+tipobj;

	var tipbegin='<img src="http://img.cccv.cn/h/loading.gif" width="16" height="16" align="absmiddle"> 正在登录，请稍候...';

	loadRequest(url,parames,'POST','登录',tipobj,tipbegin,'no','',true);
	return false;
}


login.exit=function(tipobj){
	if(tipobj==null){tipobj=login.outplace}
	var url='/common/loginexit4.0.asp';
	var parames= 'alert='+ login.alert +'&mode='+ login.mode +'&exitjs='+ login.exitjs;
	loadRequest(url,parames,'POST','退出',null,'no','no','no',true)
}


// 需要登录才能访问的网页前的检测
login.tourl=function (url,str,target){
	login.output();
	if(login.uid==''|login.name==''){
		if(str==null|str==''){str='登录超时或没有登录，需要登录才能操作。'}
		login.input( str, 'window.open(\''+ url +'\',\''+ target +'\');', ''); 
//		login.input( str, 'parent.location.href=\''+ url +'\';', ''); 
	}else{
		if(target==null|target==''){
			location.href=url;
		}else{
			window.open(url,target)
		}
	}
}

// 登录检查
login.check=function(){
	if(navigator.cookieEnabled==true){
		login.uid=getCookie('uid'); login.name=getCookie('name');
		if(login.uid==''|login.name==''){
			return -1;
		}else{
			login.cat=getCookie('cat'); login.vip=getCookie('vip'); login.cid=getCookie('cid'); login.states=getCookie('states'); login.time=getCookie('time'); return 1;
		}
	}else{
		return -2;
	}
}

// 登录状态显示
login.output=function(){
	if(navigator.cookieEnabled==true){
		login.uid=getCookie('uid'); login.name=getCookie('name');
		if(login.uid==''|login.name==''){
			login.loginno();
		}else{
			login.cat=getCookie('cat'); login.vip=getCookie('vip'); login.cid=getCookie('cid'); login.states=getCookie('states'); login.time=getCookie('time'); login.loginok();
		}
	}else{
		login.nocookie();
	}
}

login.nocookie=function(){
	GE(login.outplace).innerHTML='对不起，您的浏览器不支持Cookie';
}

login.loginok=function(){
	var manage_url;
	if (login.cat==5){
		manage_url = '/common/zt/5shop/';
	}else{
		manage_url = '/common/ucenter/';
	}
	GE(login.outplace).innerHTML=' 欢迎您！<A HREF="http://wr.cccv.cn/'+login.uid+'/" class="logintext" target="_blank"><b>'+login.uid+'</b></a> [<a href="javascript:void(0)" class="logintext" onClick="login.exit()" title="'+login.uid+' | '+login.uid+'">退出</A>] <A HREF="'+manage_url+'" class="logintext" target="_blank">管理中心</A> <nobr><img src="http://img.cccv.cn/h/icon_msg.gif" width="13" height="13" align="top" style="margin-left:10px;margin-right:3px;"><A HREF="/common/ucenter/user_msg.asp" class="logintext" target="_blank" id="messagehint">站内留言</A></nobr> <nobr><img src="http://img.cccv.cn/h/icon_myhome.gif" width="13" height="13" align="top" style="margin-left:10px;margin-right:3px;"><A HREF="http://wr.cccv.cn/'+login.uid+'/" class="logintext" target="_blank">进入我的空间</A></nobr>';
	login.hint();
	var messagehint = setInterval("login.hint()", 300000 );
}

login.hint=function(){loadRequest('/common/LoginHint1.0.asp','','POST','提示',null,'no','no','no',true)}


login.loginno=function(){
	if(login.mode==1){
		GE(login.outplace).innerHTML='<img src="http://img.cccv.cn/zt/08/btn_login.gif" height="20" border="0" hspace="6" align="absmiddle" onClick="show.snap(this,\'br\',300);login.input();" style="cursor:pointer">';
	}else if (login.mode==2){
		login.iuid = getCookie("userid");
		if( login.iuid==null ){login.iuid=''}
		login.ipsd='';
		GE(login.outplace).innerHTML='<form name="loginform2" style="margin:0" onSubmit="return login.inputcheck(this);"><input type="hidden" name="tipobj" value=""><table border="0" cellpadding="0" cellspacing="0" id="login_no"><tr><td class="logintext">用户名：</td><td style="padding-right:5px"><input type="text" name="uid" size="16" maxlength="18" onFocus="this.select()" style="border: #CCC 1px solid; font-size:12px; ime-mode: disabled;" value="'+ login.iuid +'"></td><td class="logintext" style="padding-left:10px;">密码：</td><td style="padding-right:5px;"><input type="password" name="psd" size="16" maxlength="18" onFocus="this.select();" style="border: #CCC 1px solid; font-size:12px; ime-mode: disabled;"></td><td style="padding-left:10px;"><input type="image" src="http://img.cccv.cn/i/btn_login.jpg" width="40" height="18" name="submit"></td><td style="padding-left:10px;" class="logintext"><A HREF="/common/zt/reg/forget/forgetpsd1.asp" target="_blank" class="logintext">忘记密码？</A></td><td style="padding-left:10px;"><a href="/common/zt/reg/privy.asp" target="_blank"><img src="http://img.cccv.cn/i/btn_reg01.jpg" width="60" height="18" alt="业主注册"></a> <a href="/common/zt/reg/shop.asp" target="_blank"><img src="http://img.cccv.cn/i/btn_reg02.jpg" width="60" height="18" alt="开通商铺"></a></td></tr></table></form>';
	}else if (login.mode==3){
	}else{
		GE(login.outplace).innerHTML=' <img src="http://img.cccv.cn/h/icon_login.gif" width="13" height="13" align="top" style="margin-right:3px;"><a href="javascript:void(0)" onclick="show.snap(this,\'bl\');login.input();" class="logintext">登录</a> <img src="http://img.cccv.cn/h/icon_reg.gif" width="13" height="13" align="top" style="margin-right:3px;"><a href="/common/zt/reg/" target="_blank" class="logintext">免费注册</a> ';
	}
}


document.onmousemove = function(e){
	if(!document.all){ show.x = e.clientX; show.y = e.clientY; }else{ show.x = event.x; show.y = event.y; }
	if(show.canDrg){
		var ofsx = show.x - show.lx;
		show.thiso.style.left = parseInt(show.thiso.style.left) + ofsx +'px';
		show.lx = show.x;
		var ofsy = show.y - show.ly;
		show.thiso.style.top = parseInt(show.thiso.style.top) + ofsy +'px';
		show.ly = show.y;
	}
}

document.onmouseup=function(){
	show.canDrg=false;
	if(document.all && show.thiso != null){
		show.thiso.releaseCapture();
		show.thiso = null;
	}
}


function fadeout(obj,speed) {if(speed==null){speed=50}try{if(GE(obj).filters.Alpha.Opacity<10){GE(obj).style.display='none';}else{GE(obj).filters.Alpha.Opacity-=10;setTimeout("fadeout('"+obj+"')",speed);}return;}catch(e){}try{if(GE(obj).style.opacity==''){GE(obj).style.opacity=1}if(GE(obj).style.opacity<0.1){GE(obj).style.display='none';}else{GE(obj).style.opacity-=0.1;setTimeout("fadeout('"+obj+"')",speed);}return}catch(e){}GE(obj).style.display='none';}


MM_preloadImages('http://img.cccv.cn/h/btn01_login.gif','http://img.cccv.cn/h/btn01_reg.gif','http://img.cccv.cn/h/icon_login.gif','http://img.cccv.cn/h/icon_msg.gif','http://img.cccv.cn/h/icon_myhome.gif','http://img.cccv.cn/h/icon_reg.gif','http://img.cccv.cn/h/loading.gif','http://img.cccv.cn/zt/08/btn_login.gif')


