var sitename='资阳大众网';
var wealthName='金币';
var wealthUnit='个';
var loginerr='请先 <a href="/user/reg.html"><font color="red">注册</font></a> 或 <a href="#" onclick="showLoginDlg(\'SiteLogin\');new dialog().reset();return false;"><font color="red">登录</font></a> '+sitename+'通行证!';
var loadtext='&nbsp;<font color="#999999">数据处理中</font>';
var loadimg="<img src='/img/load.gif' align='absmiddle'>";
var loadPage=false;
//铃声
var MsgPage=1;
var music_play_id=0;
var music_play_str='';

//取得字符串的字节长度
function strlen(str)
{
	var i=0,len=0;
	for (i=0;i<str.length;i++){
		if (str.charCodeAt(i)>255 || str.charCodeAt(i)<0)
		{len+=2;}
		else
		{len++;}
	}
	return len;
}
function URLencode(sStr) 
{
    return escape(sStr).replace(/\+/g,'%2B');
   // return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');
}
function Confirm(n) {return window.confirm (n)}
function afirm(n) {return window.confirm (n)}
function Trim(s){
	return s.replace(/(^\s*)|(\s*$)/g, "");
}
function checknumber(data)
{
  var datastr = data;
  if (datastr.search(/\D/gi) != -1)
	  {return false;}
  if (datastr.search(/\S/gi) == -1)
	  {return false;}
  return true;
}
function $(s){return document.getElementById(s);}

function gid(id){return document.getElementById?document.getElementById(id):null;}
function gna(id){return document.getElementsByName?document.getElementsByName(id):null;}
function gname(name){return document.getElementsByTagName?document.getElementsByTagName(name):new Array()}


function hide(s){$(s).style.display=$(s).style.display=="none"?"":"none";}
function initAjax()
{
	 var ajax=false; 
	 if (!window.XMLHttpRequest) {
	 try { ajax = new ActiveXObject("Msxml2.XMLHTTP.4.0"); return xmlHttp; } catch (ex) {}
	 try { ajax = new ActiveXObject("MSXML2.XMLHTTP"); return xmlHttp; } catch (ex){}
	 try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); return xmlHttp; } catch (ex) {}
	 return ajax;
	 }
	 else
	 {
	 try {ajax = new XMLHttpRequest(); return xmlHttp;} catch(ex) {}
	 return ajax;
	 }
}

function AJAXRequest() {
	var xmlObj = false;
	var CBfunc,ObjSelf;
	ObjSelf=this;
	try { xmlObj=new XMLHttpRequest; }
	catch(e) {
		try { xmlObj=new ActiveXObject("MSXML2.XMLHTTP"); }
		catch(e2) {
			try { xmlObj=new ActiveXObject("Microsoft.XMLHTTP"); }
			catch(e3) { xmlObj=false; }
		}
	}
	if (!xmlObj) return false;
	this.method="POST";
	this.url;
	this.async=true;
	this.content="";
	this.callback=function(cbobj) {return;}
	this.send=function() {
		if(!this.method||!this.url||!this.async) return false;
		xmlObj.open (this.method, this.url, this.async);
		if(this.method=="POST") xmlObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		xmlObj.onreadystatechange=function() {
			if(xmlObj.readyState==4) {
				if(xmlObj.status==200) {
					ObjSelf.callback(xmlObj);
				}
			}
		}
		if(this.method=="POST") xmlObj.send(this.content);
		else xmlObj.send(null);
	}
}


/*--------------------------------------
http://ajax.xujiwei.cn/
--------------------------------------*/
function AJAX_Request() {
	var xmlPool=[],objPool=[],AJAX=this,ac=arguments.length,av=arguments;
	var xmlVersion=["MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
	var eF=emptyFun=function(){};
	var av=ac>0?typeof(av[0])=="object"?av[0]:{}:{};
	var encode=$GEC(av.charset+"");
	this.url=getp(av.url,"");
	this.oncomplete=getp(av.oncomplete,eF);
	this.content=getp(av.content,"");
	this.method=getp(av.method,"POST");
	this.async=getp(av.async,true);
	this.onexception=getp(av.onexception,eF);
	this.ontimeout=getp(av.ontimeout,eF);
	this.timeout=getp(av.timeout,3600000);
	this.onrequeststart=getp(av.onrequeststart,eF);
	this.onrequestend=getp(av.onrequestend,eF);
	if(!getObj()) return false;
	function getp(p,d) { return p!=undefined?p:d; }
	function getObj() {
		var i,j,tmpObj;
		for(i=0,j=xmlPool.length;i<j;i++) if(xmlPool[i].readyState==0||xmlPool[i].readyState==4) return xmlPool[i];
		try { tmpObj=new XMLHttpRequest; }
		catch(e) {
			for(i=0,j=xmlVersion.length;i<j;i++) {
				try { tmpObj=new ActiveXObject(xmlVersion[i]); } catch(e2) { continue; }
				break;
			}
		}
		if(!tmpObj) return false;
		else { xmlPool[xmlPool.length]=tmpObj; return xmlPool[xmlPool.length-1]; }
	}
	function $(id){return document.getElementById(id);}
	function $N(d){var n=d*1;return(isNaN(n)?0:n);}
	function $VO(v){return(typeof(v)=="string"?(v=$(v))?v:false:v);}
	function $GID(){return((new Date)*1);}
	function $SOP(id,ct){objPool[id+""]=ct;}
	function $LOP(id){return(objPool[id+""]);}
	function $SRP(f,r,p){return(function(s){s=f(s);for(var i=0;i<r.length;i++) s=s.replace(r[i],p[i]);return(s);});}
	function $GEC(cs){
		cs="GB2312";
		//if(cs.toUpperCase()=="UTF-8") return(encodeURIComponent);
		//else return($SRP(escape,[/\+/g],["%2B"]));
		return($SRP(escape,[/\+/g],["%2B"]));
	}
	function $ST(obj,text) {
		var nn=obj.nodeName.toUpperCase();
		if("INPUT|TEXTAREA".indexOf(nn)>-1) obj.value=text;
		else try{obj.innerHTML=text;} catch(e){};
	}
	function $CB(cb) {
		if(typeof(cb)=="function") return cb;
		else {
			cb=$VO(cb);
			if(cb) return(function(obj){$ST(cb,obj.responseText);});
			else return emptyFun; }
	}
	function $GP(p,v,d,f) {
		var i=0;
		while(i<v.length){p[i]=v[i]?f[i]?f[i](v[i]):v[i]:d[i];i++;}
		while(i<d.length){p[i]=d[i];i++;}
	}
	function send(purl,pc,pcbf,pm,pa) {
		var purl,pc,pcbf,pm,pa,ct,ctf=false,xmlObj=getObj(),ac=arguments.length,av=arguments;
		if(!xmlObj) return false;
		var pmp=pm.toUpperCase()=="POST"?true:false;
		if(!pm||!purl) return false;
		var ev={url:purl, content:pc, method:pm};
		purl+=(purl.indexOf("?")>-1?"&":"?")+"timestamp="+$GID();
		xmlObj.open(pm,purl,pa);
		AJAX.onrequeststart(ev);
		if(pmp) xmlObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		ct=setTimeout(function(){ctf=true;xmlObj.abort();},AJAX.timeout);
		xmlObj.onreadystatechange=function() {
			if(ctf) { AJAX.ontimeout(ev); AJAX.onrequestend(ev); }
			else if(xmlObj.readyState==4) {
				ev.status=xmlObj.status;
				try{ clearTimeout(ct); } catch(e) {};
				try{ if(xmlObj.status==200) pcbf(xmlObj); else AJAX.onexception(ev); }
				catch(e) { AJAX.onexception(ev); }
				AJAX.onrequestend(ev);
			}
		}
		if(pmp) xmlObj.send(pc); else xmlObj.send("");
		return true;
	}
	this.setcharset=function(cs) { encode=$GEC(cs); }
	this.get=function() {
		var p=[],av=arguments;
		$GP(p,av,[this.url,this.oncomplete],[null,$CB]);
		if(!p[0]&&!p[1]) return false;
		return(send(p[0],"",p[1],"GET",this.async));
	}
	this.update=function() {
		var p=[],purl,puo,pinv,pcnt,av=arguments;
		$GP(p,av,[emptyFun,this.url,-1,-1],[$CB,null,$N,$N]);
		if(p[2]==-1) p[3]=1;
		var sf=function(){send(p[1],"",p[0],"GET",this.async);};
		var id=$GID();
		var cf=function(cc) {
			sf(); cc--; if(cc==0) return;
			$SOP(id,setTimeout(function(){cf(cc);},p[2]));
		}
		cf(p[3]);
		return id;
	}
	this.stopupdate=function(id) {
		clearTimeout($LOP(id));
	}
	this.post=function() {
		var p=[],av=arguments;
		$GP(p,av,[this.url,this.content,this.oncomplete],[null,null,$CB]);
		if(!p[0]&&!p[2]) return false;
		return(send(p[0],p[1],p[2],"POST",this.async));
	}
	this.postf=function() {
		var p=[],fo,vaf,pcbf,purl,pc,pm,ac=arguments.length,av=arguments;
		fo=ac>0?$VO(av[0]):false;
		if(!fo||(fo&&fo.nodeName!="FORM")) return false;
		vaf=fo.getAttribute("onvalidate");
		vaf=vaf?(typeof(vaf)=="string"?new Function(vaf):vaf):null;
		if(vaf&&!vaf()) return false;
		$GP(p,[av[1],fo.action,fo.method],[this.oncomplete,this.url,this.method],[$CB,null,null]);
		pcbf=p[0];purl=p[1];
		if(!pcbf&&!purl) return false;
		pc=this.formToStr(fo); if(!pc) return false;
		if(p[2].toUpperCase()=="POST")
			return(send(purl,pc,pcbf,"POST",true));
		else {
			purl+=(purl.indexOf("?")>-1?"&":"?")+pc;
			return(send(purl,"",pcbf,"GET",true));
		}
	}
	/* formToStr
	// from SurfChen <surfchen@gmail.com>
	// @url     http://www.surfchen.org/
	// @license http://www.gnu.org/licenses/gpl.html GPL
	// modified by xujiwei
	// @url     http://www.xujiwei.cn/
	*/
	this.formToStr=function(fc) {
		var i,qs="",and="",ev="";
		for(i=0;i<fc.length;i++) {
			e=fc[i];
			if (e.name!='') {
				if (e.type=='select-one'&&e.selectedIndex>-1) ev=e.options[e.selectedIndex].value;
				else if (e.type=='checkbox' || e.type=='radio') {
					if (e.checked==false) continue;
					ev=e.value;
				}
				else ev=e.value;
				ev=encode(ev);
				qs+=and+e.name+'='+ev;
				and="&";
			}
		}
		return qs;
	}
}

//http://www.xujiwei.cn/works/ajaxrequest/  AJAX_Request

function openEmot()
{
	var url="/img/emot/index.html";  //要打开的窗口
	var winName="newWin";  //给打开的窗口命名
	var awidth=630;   //窗口宽度,需要设置
	var aheight=480;   //窗口高度,需要设置 
	var atop=(screen.availHeight - aheight)/2;    //窗口顶部位置,一般不需要改
	var aleft=(screen.availWidth - awidth)/2;  //窗口放中央,一般不需要改
	var param0="scrollbars=0,status=0,menubar=0,resizable=2,location=0";  //新窗口的参数
	  //新窗口的左部位置，顶部位置，宽度，高度 
	var params="top=" + atop + ",left=" + aleft + ",width=" + awidth + ",height=" + aheight + "," + param0 ; 
	win=window.open(url,winName,params); //打开新窗口
	win.focus();  //新窗口获得焦点
}

function viewpic(t_title,t_str)
{
	var str='<html><head><title>'+t_title+'</title>'
	str+='</head><body><div style="text-align:center;padding:5px;line-height:22px;">'
	str+=t_str;
	str+='</div><div style="text-align:center;margin-top:20px;"><input type="button" value="关闭窗口" style="width:120px;height:24px;font-size:14px;" onclick="window.close();">&nbsp;&nbsp;&nbsp;<input type="button" value="全屏观看" style="width:120px;height:24px;font-size:14px;" onclick="window.moveTo(0,0);window.resizeTo(screen.availWidth,screen.availHeight);"></div>';
	str+='</body></head></html>';
	var awidth=750;
	var aheight=600;   //窗口高度,需要设置 
	var atop=(screen.availHeight - aheight)/2;    //窗口顶部位置,一般不需要改
	var aleft=(screen.availWidth - awidth)/2;  //窗口放中央,一般不需要改
	var param0="scrollbars=1,status=0,menubar=0,resizable=2,location=0";  //新窗口的参数
	var params="top=" + atop + ",left=" + aleft + ",width=" + awidth + ",height=" + aheight + "," + param0 ; 
	var newwin=window.open('','',params); 
	newwin.opener = null 
	newwin.document.write(str);
	newwin.document.close();
}
//检测在线编器字符数
function checklength()
{
	var Content;
	var oEditor = FCKeditorAPI.GetInstance('Content') ;
	Content=oEditor.GetXHTML(true)
	alert("\n当前: "+Content.length+" 个字符");
	return false;
}

//读取cookie值 
function getCookie(name) { 

  var search;

  search = name + "=";
  offset = document.cookie.indexOf(search); 
  if (offset != -1) {
    offset += search.length ;
    end = document.cookie.indexOf(";", offset) ;
    if (end == -1)
      end = document.cookie.length;
    return unescape(document.cookie.substring(offset, end));
  }
  else
    return "";

}

function DecodeCookie(str)
{
　var strArr;
　var strRtn="";
　strArr=str.split("a");
　for (var i=strArr.length-1;i>=0;i--) 
　strRtn+=String.fromCharCode(eval(strArr[i]));
　return strRtn;
}

//改变图片大小 -- 参数n  1论坛 | 2博客频道 |3新闻频道)
function resizepic(thispic,n)
{
	if(n==1){
		if(thispic.width>620) thispic.width=620;
	}
	else if(n==2){
		if(thispic.width>620) thispic.width=620;
	}
	else
	{
		if(thispic.width>620) thispic.width=620;
	}
}

function fiximg(o){
	if(o.width>140) o.style.width=140;
}

//用户相关信息 stats-boardid-channerid-title-url
function userinfo(t_stats,t_boardid,t_channelid,t_title,t_url)
{
	var ajax = initAjax();
	var u_url="/common/ajax.asp?action=getUserInfo&u_action="+escape(t_stats)+"&boardid="+t_boardid+"&channelid="+t_channelid+"&title="+escape(t_title)+"&url="+escape(t_url)+"&ran="+Math.random();
	$('u_info').innerHTML = loadimg+"&nbsp;&nbsp;"+loadtext;
	ajax.open('GET',u_url,true);
	ajax.onreadystatechange = function()
	{
		if (ajax.readyState == 4 && ajax.status == 200)
		{
			var response = ajax.responseText;
			$('u_info').innerHTML =response;
		}
	};
	ajax.send(null);
}




//全屏显示
function Browser(){var ua, s, i;this.isIE = false;this.isNS = false;this.isOP = false;this.isSF = false;ua = navigator.userAgent.toLowerCase();s = "opera";if ((i = ua.indexOf(s)) >= 0){this.isOP = true;return;}s = "msie";if ((i = ua.indexOf(s)) >= 0) {this.isIE = true;return;}s = "netscape6/";if ((i = ua.indexOf(s)) >= 0) {this.isNS = true;return;}s = "gecko";if ((i = ua.indexOf(s)) >= 0) {this.isNS = true;return;}s = "safari";if ((i = ua.indexOf(s)) >= 0) {this.isSF = true;return;}}
//用户登录弹出窗口
//判断iE
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = (userAgent.indexOf('opera') != -1);
var is_saf = ((userAgent.indexOf('applewebkit') != -1) || (navigator.vendor == 'Apple Computer, Inc.'));
var is_webtv = (userAgent.indexOf('webtv') != -1);
var is_ie = ((userAgent.indexOf('msie') != -1) && (!is_opera) && (!is_saf) && (!is_webtv));
var is_ie4 = ((is_ie) && (userAgent.indexOf('msie 4.') != -1));
var is_ie7 = ((is_ie) && (userAgent.indexOf('msie 7.') != -1));
var is_moz = ((navigator.product == 'Gecko') && (!is_saf));
var is_kon = (userAgent.indexOf('konqueror') != -1);
var is_ns = ((userAgent.indexOf('compatible') == -1) && (userAgent.indexOf('mozilla') != -1) && (!is_opera) && (!is_webtv) && (!is_saf));
var is_ns4 = ((is_ns) && (parseInt(navigator.appVersion) == 4));
var is_mac = (userAgent.indexOf('mac') != -1);

var dialog_div_tips="<div id='DialogLoading' style='background-attachment:fixed;'><p style='color:#666666;padding-top:30px;'><img src='/img/loading.gif' align='absmiddle'/> 处理数据中,请稍候…<br><br><input style='width:80px;' type='button' onclick='DialogHide()' value='取消'></div>"

var x0=0,y0=0,x1=0,y1=0;
var offx=6,offy=6;
var moveable=false;
var divWidth=200 //弹出层默认宽度
var divHeight=150 //弹出层默认高度

//登录框  
function showLoginDlg(obj)
{
	if (loadPage)
	{
		ScreenConvert();
		DialogShow(dialog_div_tips);
		var the_Url ="/user/dialog/login.html?action=getDialog&ran="+Math.random();
		divWidth=428
		divHeight=300
		Get_Request('DialogLoading',the_Url)
	}
	else
	{
		alert("请稍等，网站数据正在加载中！")
	}
}

function Get_Request(theid,theurl,divWidth,divHeight)
{
	var ajaxobj=new AJAXRequest;
	ajaxobj.method='GET'; 
	ajaxobj.url =theurl;
	ajaxobj.callback=function(xmlobj)
	{
		var response =xmlobj.responseText;
		resize_DialogShow()
		$(theid).innerHTML = response;
	}
	ajaxobj.send();    // 发送请求
	return false;
}

function resize_DialogShow()
{
	var screenWidth,screeHeight,L,T
	screenWidth=screen.availWidth; 
	screeHeight=screen.availHeight;
	L=(screenWidth-divWidth)/2;
	T=((screeHeight-divHeight)/2)-100;
	
	var objDialog = $("DialogMove");
	objDialog.id = "DialogMove";
	var oS = objDialog.style;
	oS.top = T+document.documentElement.scrollTop + "px";
	oS.left = L + "px";
	oS.width = divWidth + "px";
	oS.height = divHeight + "px";
}


function DialogShow(showdata)
{
    //定义变量
    var screenWidth,screeHeight,L,T
	var objDialog = $("DialogMove");
	
	if(showdata==dialog_div_tips) //load
	{
		divWidth=200 //弹出层默认宽度
		divHeight=150 //弹出层默认高度
	}

	if (!objDialog) objDialog = document.createElement("div");
	screenWidth=screen.availWidth; 
    screeHeight=screen.availHeight;
	L=(screenWidth-divWidth)/2;
    T=((screeHeight-divHeight)/2)-100;
	objDialog.id = "DialogMove";
	var oS = objDialog.style;
	oS.display = "block";
	oS.top = T+document.documentElement.scrollTop + "px";
	oS.left = L + "px";
	oS.margin = "0px";
	oS.padding = "0px";
	oS.width = divWidth + "px";
	oS.height = divHeight + "px";
	oS.position = "absolute";
	oS.zIndex = "999";
	oS.background = "#FFF";
	oS.border = "solid #000 3px";
	objDialog.innerHTML = showdata;
	document.body.appendChild(objDialog);
	window.onscroll=function()
	{
		if($("DialogMove"))
		oS.top=((screeHeight-divHeight)/2)-100+document.documentElement.scrollTop + "px";
	}	
	
}

function ScreenConvert()
{
	var browser = new Browser();
	var objScreen = document.getElementById("ScreenOver");
	if(!objScreen)
	var objScreen = document.createElement("div");
	var oS = objScreen.style;
	objScreen.id = "ScreenOver";
	oS.display = "block";
	oS.top = oS.left = oS.margin = oS.padding = "0px";
	if (document.body.clientHeight)
	{
		var wh = document.body.clientHeight + "px";
	}
	else if (window.innerHeight)
	{
		var wh = window.innerHeight + "px";
	}
	else
	{
		var wh = "100%";
	}
	oS.width = "100%";
	oS.height = wh;
	oS.position = "absolute";
	oS.zIndex = "3";
	if ((!browser.isSF) && (!browser.isOP))
	{
		oS.background = "#cccccc";
	}
	else
	{
		oS.background = "#cccccc";
	}
	oS.filter = "alpha(opacity=65)";
	oS.opacity = 65/100;
	oS.MozOpacity = 65/100;
	document.body.appendChild(objScreen);
	var allselect = document.getElementsByTagName("select");
	for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "hidden";
	var allselect = document.getElementsByTagName("embed");
	for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "hidden";
	var allselect = document.getElementsByTagName("object");
	for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "hidden";
	}

function ScreenClean()
{
	var objScreen = $("ScreenOver");
	if (objScreen) objScreen.style.display = "none";
	var allselect = document.getElementsByTagName("select");
	for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "visible";
	var allselect = document.getElementsByTagName("embed");
	for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "visible";
	var allselect = document.getElementsByTagName("object");
	for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "visible";
}
function DialogHide()
{
	ScreenClean();
	var objDialog = $("DialogMove");
	if (objDialog) objDialog.style.display = "none";
}

//关闭弹出层
function closeOpenDiv()
{
	divWidth=200 //弹出层默认宽度
	divHeight=150 //弹出层默认高度
    ScreenClean();
	var objDialog = $("DialogMove");
	if (objDialog) objDialog.style.display = "none";
	if($('td_play_'+music_play_id)) $('td_play_'+music_play_id).innerHTML=""; //关闭铃声
	document.body.onselectstart=function(){return true} 
}


//开始移动
 function fDragging(e, limit)
 { 
        obj=document.getElementById('DialogMove');
        if(!e) e=window.event; 
        var x=parseInt(obj.style.left); 
        var y=parseInt(obj.style.top); 
       // alert(x+'dd'+y)
        var x_=e.clientX-x; 
        var y_=e.clientY-y; 
         
        if(document.addEventListener){ 
            document.addEventListener('mousemove', inFmove, true); 
            document.addEventListener('mouseup', inFup, true); 
        } else if(document.attachEvent){ 
            document.attachEvent('onmousemove', inFmove); 
            document.attachEvent('onmouseup', inFup); 
        } 
         
        inFstop(e);     
        inFabort(e) 
		
        function inFmove(e){ 
            var evt; 
            if(!e)e=window.event; 
            document.body.onselectstart=function(){return false} 
            //实现层透明
            //obj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=85,finishOpacity=100,style=0)';
            //obj.style.opacity = 0.85;
            if(is_ie && !is_mac) {
					obj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=85,finishOpacity=100,style=0)";
				}
				obj.style.opacity = 0.85;
				
            if(limit){ 
                var op=obj.parentNode; 
                var opX=parseInt(op.style.left); 
                var opY=parseInt(op.style.top); 
                 
                if((e.clientX-x_)<0) return false; 
                else if((e.clientX-x_+obj.offsetWidth+opX)>(opX+op.offsetWidth)) return false; 
                 
                if(e.clientY-y_<0) return false; 
                else if((e.clientY-y_+obj.offsetHeight+opY)>(opY+op.offsetHeight)) return false; 
                //status=e.clientY-y_; 
            } 
             
            obj.style.left=e.clientX-x_+'px'; 
            obj.style.top=e.clientY-y_+'px'; 
            inFstop(e); 
        } // shawl.qiu script 
        function inFup(e){ 
            var evt; 
            if(!e)e=window.event; 
            //恢复不透明
            if(is_ie && !is_mac) {
					obj.style.filter = "";
				}
				obj.style.opacity = 100;
				
            if(document.removeEventListener){ 
                document.removeEventListener('mousemove', inFmove, true); 
                document.removeEventListener('mouseup', inFup, true); 
            } else if(document.detachEvent){ 
                document.detachEvent('onmousemove', inFmove); 
                document.detachEvent('onmouseup', inFup); 
            } 
            inFstop(e); 
			document.body.onselectstart=function(){return true} 
        } // shawl.qiu script 
  
        function inFstop(e){ 
            if(e.stopPropagation) return e.stopPropagation(); 
            else return e.cancelBubble=true;        
			
        } // shawl.qiu script 
        function inFabort(e){ 
            if(e.preventDefault) return e.preventDefault(); 
            else return e.returnValue=false; 
        } // shawl.qiu script 
    } 


//检测自动登录
function loginAutoClick()
{
    var obj=$('siteLoginAuto')
    if (obj.checked)
    {
        if (confirm("确认自动登录？")==false)
        {
            obj.checked=true;
        }
    }
}
//检测用户登录
function siteLoginCheck()
{
    var uname=$('siteLoginUserName').value
    var pwd=$('siteLoginPassWord').value
	var loginfields,loginfield;
	loginfields=document.getElementsByName('loginfield')
	for(i=0;i<loginfields.length;i++)  
	{  
		if(loginfields[i].checked) loginfield=loginfields[i].value; 
	} 
    var autoLogin=0;
    if ($('siteLoginAuto').checked)
    {
        //登录有效期1年
        autoLogin=2;
    }
	if (uname=='')
    {
        $('siteLoginErrMsg').innerHTML='请填写完整登录信息,用户名不能为空';
        $('siteLoginUserName').focus();
        return false;
    }
    if (pwd=='')
    {
        $('siteLoginErrMsg').innerHTML='请填写完整登录信息,密码不能为空';
        $('siteLoginPassWord').focus();
        return false;
    }
  
    $('siteLoginErrMsg').innerHTML='正在登录,请稍候...';
    var ajaxobj=new AJAXRequest;    // 创建AJAX对象
	ajaxobj.method='GET';   // 设置请求方式为GET
	ajaxobj.url='/user/checkUser.asp?action=login&uhidden=0&loginfield='+loginfield+'&username='+escape(uname)+'&password='+pwd+'&setcookie='+autoLogin+'&ran='+Math.random();
	// 设置回调函数，输出响应内容
	ajaxobj.callback=function(xmlobj) {
		var response=xmlobj.responseText
		if(response.indexOf("用户名修改友情提示")>0)
		{
			show_Dialog(response,400,210)
			return false;
		}
		else if(response=='')
		{
			location.reload();
			return false;
		}
		else
		{
			response=response.replace('@@@','');
			$('siteLoginErrMsg').innerHTML=response;
			$('siteLoginPassWord').value='';
			$('siteLoginPassWord').focus();
			return false;
		}
	}
	ajaxobj.send();    // 发送请求
	return false;
}
//修改用户名
function ChangeUserName()
{
	var NewUserName=$('NewUserName').value;
	var url="/user/checkUser.asp?action=ChangeUserName&NewUserName="+escape(NewUserName)+"&ran="+Math.random();
	//window.open(url)
	ScreenConvert();
	DialogShow(dialog_div_tips);
	//window.open(url)
	var ajax=new AJAX_Request;    // 创建AJAX对象
	ajax.get(
		url,
		function(obj)
		{
			var response = obj.responseText;
			show_Dialog(response,300,180)
			return false;
		}
	)
	return false;
}
function ReloadChangeUserName()
{
	ScreenConvert();
	DialogShow(dialog_div_tips);
	var url="/user/checkUser.asp?action=ReloadChangeUserName&&ran="+Math.random();
	//window.open(url)
	var ajax=new AJAX_Request;    // 创建AJAX对象
	ajax.get(
		url,
		function(obj)
		{
			var response = obj.responseText;
			show_Dialog(response,400,210)
			return false;
		}
	)
	return false;
}

//以Get返回内容ajax
function getRequest(url,obj)
{
    //$(obj).innerHTML=loadimg+loadtext;
    var ajaxobj=new AJAXRequest;    // 创建AJAX对象
	ajaxobj.method='GET';   // 设置请求方式为GET
	ajaxobj.url=url+'&ran='+Math.random();
	// 设置回调函数，输出响应内容
	ajaxobj.callback=function(xmlobj) {
		var response=xmlobj.responseText
			$(obj).innerHTML=response;
	}
	ajaxobj.send();    // 发送请求
}


function show_Dialog(str,tw,th)
{
	divWidth=tw;
	divHeight=th;
	//检测是否为登录用户
	if (str.indexOf("注册")>0 && str.indexOf("登录")>0 && str.indexOf("通行证")>0 && str.indexOf("SiteLogin")>0)
	{
		divWidth=250
		divHeight=150;
	}
	else if (str.indexOf("错误信息提示")>0)
	{
		divWidth=280
		divHeight=180;
	}
	resize_DialogShow()
	document.getElementById("DialogLoading").innerHTML = str;
}


//参  数：id   Html页面唯一ID
//参  数：str  错误信息
//返回值：无
function errTips(id,str)
{
	var obj=document.getElementById(id);
	obj.className="t_err";
	obj.innerHTML=str;
	return false;	
}

//清除错误提示函数
//参  数：id   Html页面唯一ID
//返回值：无
function clearTips(id)
{
	var obj=document.getElementById(id);
	obj.className="";
	obj.innerHTML="";
}


function showQunInfo(uid)
{
	ScreenConvert();
	DialogShow(dialog_div_tips);
	var the_Url ="/user/ajax_userspace.asp?action=showQunInfo&uid="+uid+"&ran="+Math.random();
	divWidth=350
	divHeight=350
	Get_Request('DialogLoading',the_Url)
}

//-----------------下拉菜单-------------------


function doane(event) {
	e = event ? event : window.event;
	if(is_ie) {
		e.returnValue = false;
		e.cancelBubble = true;
	} else if(e) {
		e.stopPropagation();
		e.preventDefault();
	}
}

function isUndefined(variable) {
	return typeof variable == 'undefined' ? true : false;
}


var jsmenu = new Array();
var ctrlobjclassName;
jsmenu['active'] = new Array();
jsmenu['timer'] = new Array();
jsmenu['iframe'] = new Array();

function initCtrl(ctrlobj, click, duration, timeout, layer) {
	if(ctrlobj && !ctrlobj.initialized) {
		ctrlobj.initialized = true;
		ctrlobj.unselectable = true;

		ctrlobj.outfunc = typeof ctrlobj.onmouseout == 'function' ? ctrlobj.onmouseout : null;
		ctrlobj.onmouseout = function() {
			if(this.outfunc) this.outfunc();
			if(duration < 3) jsmenu['timer'][ctrlobj.id] = setTimeout('hideMenu(' + layer + ')', timeout);
		}

		ctrlobj.overfunc = typeof ctrlobj.onmouseover == 'function' ? ctrlobj.onmouseover : null;
		ctrlobj.onmouseover = function(e) {
			doane(e);
			if(this.overfunc) this.overfunc();
			if(click) {
				clearTimeout(jsmenu['timer'][this.id]);
			} else {
				for(var id in jsmenu['timer']) {
					if(jsmenu['timer'][id]) clearTimeout(jsmenu['timer'][id]);
				}
			}
		}
	}
}

function initMenu(ctrlid, menuobj, duration, timeout, layer) {
	if(menuobj && !menuobj.initialized) {
		menuobj.initialized = true;
		menuobj.ctrlkey = ctrlid;
		menuobj.onclick = ebygum;
		menuobj.style.position = 'absolute';
		if(duration < 3) {
			if(duration > 1) {
				menuobj.onmouseover = function() {
					clearTimeout(jsmenu['timer'][ctrlid]);
				}
			}
			if(duration != 1) {
				menuobj.onmouseout = function() {
					jsmenu['timer'][ctrlid] = setTimeout('hideMenu(' + layer + ')', timeout);
				}
			}
		}
		menuobj.style.zIndex = 999;
		if(is_ie) {
			menuobj.style.filter += "progid:DXImageTransform.Microsoft.shadow(direction=135,color=#CCCCCC,strength=2)";
		}
	}
}

function showMenu(ctrlid, click, offset, duration, timeout, layer, showid, maxh, drag) {
	var ctrlobj = $(ctrlid);
	if(!ctrlobj) return;
	if(isUndefined(click)) click = false;
	if(isUndefined(offset)) offset = 0;
	if(isUndefined(duration)) duration = 2;
	if(isUndefined(timeout)) timeout = 500;
	if(isUndefined(layer)) layer = 0;
	if(isUndefined(showid)) showid = ctrlid;
	var showobj = $(showid);
	var menuobj = $(showid + '_menu');
	if(!showobj|| !menuobj) return;
	if(isUndefined(maxh)) maxh = 400;
	if(isUndefined(drag)) drag = false;

	if(click && jsmenu['active'][layer] == menuobj) {
		hideMenu(layer);
		return;
	} else {
		hideMenu(layer);
	}

	var len = jsmenu['timer'].length;
	if(len > 0) {
		for(var i=0; i<len; i++) {
			if(jsmenu['timer'][i]) clearTimeout(jsmenu['timer'][i]);
		}
	}

	initCtrl(ctrlobj, click, duration, timeout, layer);
	ctrlobjclassName = ctrlobj.className;
	ctrlobj.className += ' hover';
	initMenu(ctrlid, menuobj, duration, timeout, layer, drag);

	menuobj.style.display = '';
	if(!is_opera) {
		menuobj.style.clip = 'rect(auto, auto, auto, auto)';
	}

	setMenuPosition(showid, offset);

	if(is_ie && is_ie < 7) {
		if(!jsmenu['iframe'][layer]) {
			var iframe = document.createElement('iframe');
			iframe.style.display = 'none';
			iframe.style.position = 'absolute';
			iframe.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
			$('append_parent') ? $('append_parent').appendChild(iframe) : menuobj.parentNode.appendChild(iframe);
			jsmenu['iframe'][layer] = iframe;
		}
		jsmenu['iframe'][layer].style.top = menuobj.style.top;
		jsmenu['iframe'][layer].style.left = menuobj.style.left;
		jsmenu['iframe'][layer].style.width = menuobj.w;
		jsmenu['iframe'][layer].style.height = menuobj.h;
		jsmenu['iframe'][layer].style.display = 'block';
	}

	if(maxh && menuobj.scrollHeight > maxh) {
		menuobj.style.height = maxh + 'px';
		if(is_opera) {
			menuobj.style.overflow = 'auto';
		} else {
			menuobj.style.overflowY = 'auto';
		}
	}

	if(!duration) {
		setTimeout('hideMenu(' + layer + ')', timeout);
	}

	jsmenu['active'][layer] = menuobj;
}


function setMenuPosition(showid, offset) {
	var showobj = document.getElementById(showid);
	var menuobj = document.getElementById(showid + '_menu');
	if(isUndefined(offset)) offset = 0;
	if(showobj) {
		showobj.pos = fetchOffset(showobj);
		showobj.X = showobj.pos['left'];
		showobj.Y = showobj.pos['top'];
		showobj.w = showobj.offsetWidth;
		showobj.h = showobj.offsetHeight;
		menuobj.w = menuobj.offsetWidth;
		menuobj.h = menuobj.offsetHeight;
		menuobj.style.left = (showobj.X + menuobj.w > document.body.clientWidth) && (showobj.X + showobj.w - menuobj.w >= 0) ? showobj.X + showobj.w - menuobj.w + 'px' : showobj.X + 'px';
		menuobj.style.top = offset == 1 ? showobj.Y + 'px' : (offset == 2 || ((showobj.Y + showobj.h + menuobj.h > document.documentElement.scrollTop + document.documentElement.clientHeight) && (showobj.Y - menuobj.h >= 0)) ? (showobj.Y - menuobj.h) + 'px' : showobj.Y + showobj.h + 'px');
		//debug ?
		if(menuobj.style.clip && !is_opera) {
			menuobj.style.clip = 'rect(auto, auto, auto, auto)';
		}
	}
}

function hideMenu(layer) {
	if(isUndefined(layer)) layer = 0;
	if(jsmenu['active'][layer]) {
		try {
			document.getElementById(jsmenu['active'][layer].ctrlkey).className = ctrlobjclassName;
		} catch(e) {}
		clearTimeout(jsmenu['timer'][jsmenu['active'][layer].ctrlkey]);
		jsmenu['active'][layer].style.display = 'none';
		if(is_ie && is_ie < 7 && jsmenu['iframe'][layer]) {
			jsmenu['iframe'][layer].style.display = 'none';
		}
		jsmenu['active'][layer] = null;
	}
}

function fetchOffset(obj) {
	var left_offset = obj.offsetLeft;
	var top_offset = obj.offsetTop;
	while((obj = obj.offsetParent) != null) {
		left_offset += obj.offsetLeft;
		top_offset += obj.offsetTop;
	}
	return { 'left' : left_offset, 'top' : top_offset };
}

function ebygum(eventobj) {
	if(!eventobj || is_ie) {
		window.event.cancelBubble = true;
		return window.event;
	} else {
		if(eventobj.target.type == 'submit') {
			eventobj.target.form.submit();
		}
		eventobj.stopPropagation();
		return eventobj;
	}
}

function menuoption_onclick_function(e) {
	this.clickfunc();
	hideMenu();
}

function menuoption_onclick_link(e) {
	choose(e, this);
}

function menuoption_onmouseover(e) {
	this.className = 'popupmenu_highlight';
}

function menuoption_onmouseout(e) {
	this.className = 'popupmenu_option';
}

function choose(e, obj) {
	var links = obj.getElementsByTagName('a');
	if(links[0]) {
		if(is_ie) {
			links[0].click();
			window.event.cancelBubble = true;
		} else {
			if(e.shiftKey) {
				window.open(links[0].href);
				e.stopPropagation();
				e.preventDefault();
			} else {
				window.location = links[0].href;
				e.stopPropagation();
				e.preventDefault();
			}
		}
		hideMenu();
	}
}

//设置是否显示我的印记
function setMySign()
{
	var str="/user/ajax_userspace.asp?action=setMySign&ran="+Math.random();
    var ajaxobj=new AJAXRequest;    // 创建AJAX对象
	ajaxobj.method='GET';   // 设置请求方式为GET
	ajaxobj.url=str
	//window.open(ajaxobj.url)
	ScreenConvert();
	DialogShow(dialog_div_tips);
	ajaxobj.callback=function(xmlobj)
	{
		var response=xmlobj.responseText;
		show_Dialog(response,320,260)
		return false;
	}
	ajaxobj.send();    // 发送请求
}
//保存设置我的印记设置
function SaveMySign(cname)
{
	var names = document.getElementsByName(cname);
	var tagid=0;
	for(i=0;i<names.length;i++)
	{
		if(names[i].checked == true)
		{
		 	tagid=names[i].value;
		}
	}
	var str="/user/ajax_userspace.asp?action=SaveMySign&tagid="+tagid+"&ran="+Math.random();
	var ajaxobj=new AJAXRequest; 
	ajaxobj.method='GET'; 
	ajaxobj.url=str;
	//window.open(str)
	// 设置回调函数，输出响应内容
	ajaxobj.callback=function(xmlobj)
	{
		var response=xmlobj.responseText;
		show_Dialog(response,250,165)
		return false;
	}
	ajaxobj.send();    // 发送请求
}

//设置站内消息提示音
function SetMyMsgMusic(page)
{
	music_play_id=0;
	music_play_str='';
	MsgPage=page
	ScreenConvert();
	DialogShow(dialog_div_tips);
	var url="/user/ajax_userspace.asp?action=SetMyMsgMusic&page="+page+"&ran="+Math.random();
	var ajax=new AJAX_Request; 
	ajax.get(
			 	url,
				function(obj)
				{
					var response=obj.responseText;
					show_Dialog(response,470,480);
					return false;
				}
		)
}

function play_Music(playid,src,title)
{
	if(music_play_id==0) 
		music_play_str=$('td_play_'+playid).innerHTML;
	else if(music_play_id!=playid)
	{
		$('td_play_'+music_play_id).innerHTML=music_play_str
		music_play_str=$('td_play_'+playid).innerHTML;
	}
	if(music_play_id!=playid)
	{
		$('td_play_'+playid).innerHTML='<img style="cursor:hand" title="停止播放" src="/user/img/stop.gif" onclick=play_Music('+playid+',"'+src+'","'+title+'")><bgsound src="'+src+'" />';
		music_play_id=playid;
	}
	else
	{
		$('td_play_'+playid).innerHTML=music_play_str;
		music_play_id=0;
	}
}
//使用当前铃声
function Use_Music(musicid,music_wealth,mywealth,mname)
{
	if(confirm('确定要使用铃声：'+mname+'？\n\n您当前共有 '+mywealth+' '+wealthUnit+wealthName+'。此次操作将花费您 '+music_wealth+' '+wealthUnit+wealthName+'')==true)
	{
		var url="/user/ajax_userspace.asp?action=Use_Music&musicid="+musicid+"&ran="+Math.random();
		var ajax=new AJAX_Request; 
		ajax.get(
				url,
				function(obj)
				{
					var response=obj.responseText;
					alert(response);
					if(response=='铃声设置成功！')
					{
						window.location.reload();
					}
				}
			)
	}
	else
	{
		return false;
	}
}
function Star_Stop_LingSheng(tid)
{
	var url="/user/ajax_userspace.asp?action=Star_Stop_LingSheng&ran="+Math.random();
	var ajax=new AJAX_Request; 
	ajax.get(url,function(obj){$(tid).innerHTML=obj.responseText;})
}
//帮助
function GetHelp()
{
	var id=arguments[0];
	var width=arguments[1];
	var height=arguments[2];
	var tid=0;
	if(arguments.length==4)
	{
		tid=arguments[3];
	}
	ScreenConvert();
	DialogShow(dialog_div_tips);
	var url="/help/ajax.html?typeid="+id+"&tid="+tid;
	var ajax=new AJAX_Request;    // 创建AJAX对象
	ajax.get(
				url,
				function(obj)
				{
					var response=obj.responseText;
					show_Dialog(response,width,height);
					return false;
				}
			 )
}
