﻿// JScript 文件

//=================================================================================
//---------------------------------------------------------------------------------
//Request_GET()用在JS里获得URL参数，类似ASP里的Request
//作者：吴作杏  日期：2007-03-31 18:17
//使用举例：Request_GET("Par")
//---------------------------------------------------------------------------------
//Request_GET() -Start-
function Request_GET(vn)
{
  //vn参数区分大小写
  
  var result= false;
  //得到URL的参数信息
  var pars=window.location.search;
  pars = pars.substr(1);

  //以&符分解到数组
  var parsArry = pars.split("&");
  
  //数组里的元素形如：from=JoinClass
  for (i=0;i<parsArry.length;i++)
  {
     //得到=号所在的位置，如果没找到，即等于-1时，跳过；
     var pos = parsArry[i].indexOf("=");
     if (pos == -1)
     {
        continue;
     }
   
     //得到参数变量名
     var VarName = parsArry[i].substr(0,pos);
   
     //得到参数的值
     var VarValue = parsArry[i].substr(pos+1);
     
     //需得到的参数值;
     if (VarName==vn)
     {
        result = true;
        return VarValue;
        break;
     }     
   }
   
   //如果传入参数错误时
   if (!result)
   {
      return "";
   }
}

//Request_GET() -End-
//给<textarea>自动添加/隐藏滚动条
//========================================
//文本框的ID
//文本长度
function ShowScroll(idname,len)
{
    var text=document.getElementById(idname);  
    var index=text.value.indexOf("\n");
    var row=1
    while(index!=-1)
    {
        row++;
        index=text.value.indexOf("\n",index+1);
    }
    if(row>=text.rows)
        text.rows=row+1;
    else
        text.className="textarea_right";
    if(len&&text.value.length>len)
    {
        text.value=text.value.substr(0,len);
    }    
}
//字体[小、中、大]
function fontZoom(size,id){
    document.getElementById(id).style.fontSize=size+'px'
}
//动态加载JS
//JS ID<Script id=
//所在URL
function LoadJS( id, fileUrl )
{
    var scriptTag = document.getElementById( id );
    var oHead = document.getElementsByTagName('HEAD').item(0);
    var oScript= document.createElement("script");
    if (scriptTag) oHead.removeChild(scriptTag);
         oScript.id = id;
     oScript.type = "text/javascript";
     oScript.src=fileUrl ;
     oHead.appendChild(oScript);
}
//屏蔽所有html
function MaskHtml(wdata)
{
    var st=wdata.indexOf("<");
    while(st>-1)
    {
        var temp=wdata.substr(0,st);    
        var ed=wdata.indexOf(">");
        if(ed>0)
        {    
            wdata=wdata.substr(ed+1);        
            wdata=temp+wdata;
        }
        else
        {
            wdata=temp+"&lt;";
        }    
        st=wdata.indexOf("<");
    }
    return wdata;
}
//取得Options的值，st起始位置，ed结束位置，df默认位置，flag加后缀，如：分，岁
function GetOpts(st,ed,df,flag)
{
    var data="";
    for(var i=st;i<=ed;i++)
    {
        if(i==df)
        {
            data+="<option value="+i+" selected=\"selected\">"+i+flag+"</option>";
        }
        else
        {
            data+="<option value="+i+">"+i+flag+"</option>";
        }
    }
    if(data.length>0)
    document.write(data);
}
//入学年份选择下拉框数据
function ShowEnterollYear()
{
   var CurDate = new Date();
   var CurYear = CurDate.getFullYear();
   var CurMonth = CurDate.getMonth();
   var list = "";
   var subV = 1;
   
   if (CurMonth>7)
   {
      list = "<option value=\"" + CurYear + "\" selected=\"selected\">" + CurYear + "</option>";
      
   }
   else
   {
      list = "<option value=\"" + CurYear + "\">" + CurYear + "</option>"+
             "<option value=\"" + (CurYear-1) + "\" selected=\"selected\">" + (CurYear-1) + "</option>";
      subV = 2;
   }
            
   for(i=CurYear-subV;i>=1977;i--)
   {
      if (i%10==0)
         iData = "---" + i + "---";
      else 
         iData =  i;
      list = list + "<option value=\"" + i + "\">" + iData + "</option>";
   }
  
   document.write(list);
}
/** 
* 判断用户选择的本地文件大小是否合法. 
* fileObj : 上传文件对象． 
* title : 非法时的提示信息． 
* maxSize : 最大限制． 
*/ 
function CheckFile(FilePath ,AllowExt ,AllowSize) 
{ 
   var FSO, File;
   var FileTypePass = false;

   try 
   { 
      FSO = new ActiveXObject("Scripting.FileSystemObject"); 
   } 
   catch(e) 
   { 
      //alert("IE里的：\n工具---Internet选项--安全--自定义级别--对没有标记为安全的ActiveX控件进行初始化和脚本运行”\n当前未“启用”\n\n选择的文件将到服务端检查．"); 
      return 4; 
   } 

   if (! FSO.FileExists(FilePath)) 
   { 
      //alert(FilePath +" \n找不到该文件，请重新选择．");       
      return 1; 
   } 

   
   
   File = FSO.GetFile(FilePath) ;
   FilePathArry = FilePath.split(".");
   var FileType = FilePathArry[FilePathArry.length-1].toUpperCase();  
   
   var ExtArry = AllowExt.split(",");
   for (i=0;i<ExtArry.length;i++)
   {
      //alert(ExtArry[i]);
      if(FileType==ExtArry[i])
      {
         var FileTypePass = true;
         break;
      }
   }
   
   
   if (!FileTypePass)
   {
      //alert(FileType+"文件类型不允许上传．");
      return 2;
   }
   
   if(File.size > AllowSize) 
   { 
      //alert("文件超过了最大限制值：" + AllowSize/1024 + " KB") ;       
      return 3 ; 
   } 

   return 5; 
} 
//弹出浮动层
//instance：对像实例名
//width：层宽度
//height：层高度
var eppooFloat=function(instance,width,height)
{
	var msg="...";		
	var ins=instance;	
	var obj;		
	var s=Math.PI/2;//初始角度为90度，及cos(s)=0
	var x1=0,y1=0;	//是否扩展到指定的宽高
	var tempW=50;	//当前弹性的最大范围
	var addFlag=0,delFlag=1;	//标记角度是递增还是递减
	var count=0;				//循环变量
	var oHideTimer;
	var hideTimer;//当鼠标没有直接移动到层上的时候的定时关闭
	
	var w=120,h=60;
	if(width)
		w=width;
		
	if(height)
		h=height;
	
	this.writeHTML=function(str)//写层的代码
	{
		//if(obj==null)
			document.write("<div class='tagdiv' id='content' onmouseover='"+ins+".clear();' onmouseout='"+ins+".hiddenIt()' style='display:none'>" + str + "</div>");
			
			//this.getObj("content").innerHTML=str;
			//鼠标移上来，清除hideTimer，同时也清除上次移出这个层却还没有来得及关闭的记时，鼠标移出，开始计算时间，准备推出
	}
	
	this.getObj=function(id)//得到OBJ
	{
		if(document.getElementById)
		{
			return document.getElementById(id)
		}
		else if(document.all)
		{
			return document.all[id];
		}
		else if(document.layers)
		{
			return document.layers[id];
		}
	}
	
	this.change=function()//层漫漫扩大
	{
		var x=obj.style.width;
		var y=obj.style.height;
		
		if(parseInt(x)<w&&x1==0){	//当前宽度小于300且未曾扩大到300过
			obj.style.width=(parseInt(x)+4)+"px";
		}else{
			x1=1;
		}
		
		if(parseInt(y)<h&&y1==0){	//当前高度小于150且未曾扩大到150过
			obj.style.height=(parseInt(y)+2)+"px";
		}else{
			y1=1;
		}
		
		if(x1==1&&y1==1&&tempW>0){	//如果已经扩大到了最大高宽且弹性范围大于0则执行下列代码
			obj.style.width=(w+tempW*Math.cos(s))+"px";
			obj.style.height=(h+tempW/2*Math.cos(s))+"px";
		
			if(addFlag==1){
				s+=Math.PI/6;		//每次变化30°
				if(s>2*Math.PI){	//加超过PI开始减
					addFlag=0;
					delFlag=1;
				}
			}
			if(delFlag==1){
				s-=Math.PI/6;
				if(s<0){	//减过0则开始加
					addFlag=1;
					delFlag=0;
				}
			}
			//if(++count%3==0)	//每过90度弹性范围减一
				tempW-=1;
		}
		
		if(tempW>0){
			setTimeout(ins+".change()",10);
		}
	}
	
	this.showIt=function(content)//显示层
	{
		obj=this.getObj("content");
		if(obj==null)
			this.writeHTML(content);
		else
			obj.innerHTML=content;
			
		s=Math.PI/2,x1=0,y1=0,tempW=50,addFlag=0,delFlag=1,count=0;//重置数据
			
		if(oHideTimer) clearTimeout(oHideTimer);
		if(hideTimer) clearTimeout(hideTimer);
		
		var evt=window.event||this.showIt.caller.arguments[0];
		obj.style.width="0px";
		obj.style.height="0px";
		obj.style.left=evt.clientX+"px";
		obj.style.top=evt.clientY+"px";
		obj.style.display="block";
		this.change();
	}
	
	/*以下用户鼠标移出触发事件源而没有移动到层上的时候的关闭*/
	this.clear=function()
	{
		if(hideTimer) clearTimeout(hideTimer);
		if(oHideTimer) clearTimeout(oHideTimer);
	}
	
	this.hiddenIt_=function()//定时隐藏层
	{
		hideTimer=setTimeout("document.getElementById('content').style.display='none';s=Math.PI/2,x1=0,y1=0,tempW=50,addFlag=0,delFlag=1,count=0;",2000);
	}
	/*以上用户鼠标移出触发事件源而没有移动到层上的时候的关闭*/
	
	this.hiddenIt=function()//定时隐藏层
	{
		oHideTimer=setTimeout("document.getElementById('content').style.display='none';s=Math.PI/2,x1=0,y1=0,tempW=50,addFlag=0,delFlag=1,count=0;",2000);
	}
	//立即隐藏层
	this.hidden=function()
	{
	    document.getElementById('content').style.display='none';s=Math.PI/2,x1=0,y1=0,tempW=50,addFlag=0,delFlag=1,count=0;
	}
}

//字体列表(HenryNg)
//若追加字体请紧跟其后,添加后不能修改与删除.
var FontArry = new Array();
FontArry[0] = "宋体";
FontArry[1] = "黑体";
FontArry[2] = "楷体_GB2312";
FontArry[3] = "隶书";
FontArry[4] = "幼圆";
FontArry[5] = "Arial";

function getSystemFonts(vn,idx)
{
   //某一个水印位置
   var o = "TextFont" + vn;   
   
   with(document.getElementById(o))
   {
      options.length=0;
      
      for(var i=0;i<FontArry.length;i++)
      {
        options[i] = new Option(FontArry[i],i);
      }
   }
   document.getElementById(o)[idx].selected = true;
}


//ＥＰＰＯＯ的弹出对话框
/*function BtnOK()
{
	document.body.removeChild(docEle("newDiv"));
	document.body.removeChild(docEle("mask"));
	return 1;
}

function BtnCancle()
{
	document.body.removeChild(docEle("newDiv"));
	document.body.removeChild(docEle("mask"));
	return 0;
}

function BtnBug()
{
	document.body.removeChild(docEle("newDiv"));
	document.body.removeChild(docEle("mask"));
	return 2;
}*/

function ImgClose()
{
	document.body.removeChild(docEle("newDiv"));
	document.body.removeChild(docEle("mask"));
	//window.close();
	//window.returnValue=0;
}
		
var docEle = function()
{
   return document.getElementById(arguments[0]) || false;
}
function eppooMsgBox(titleMsg,Icon,Msg,Btn){
		
		var m = "mask";
		var _id = "newDiv";		
		if (docEle(_id)) document.removeChild(docEle(_id));
		if (docEle(m)) document.removeChild(docEle(m));
		
		// 新激活图层
		if (titleMsg=="")
		    titleMsg = "温馨提示：";
		    
		var iconImg = "<img src=\"http://eppoo.com/manage/img/div_pro_exmd.gif\" border=\"0\">";
		if (Icon=="Help")
		    iconImg = "<img src=\"http://eppoo.com/manage/img/div_pro_help.gif\" border=\"0\">";
		    
		var BtnStr;
		//if (Btn=="BtnOK")
		    BtnStr = "<input id=\"bOK\" type=\"button\" value=\"确认\" onclick=\"javascript:return BtnOK();\" /> ";
		//else if(Btn=="BtnOkCancle")
		    //BtnStr = "<input id=\"bOK\" type=\"button\" value=\"确认\" onclick=\"javascript:return BtnOK();\" /> "
		          /* + "<input id=\"bCancle\" type=\"button\" value=\"取消\" onclick=\"javascript:return BtnCancle();\" />"
		           + "<input id=\"bBug\" type=\"hidden\" value=\"发送错误报告\" onclick=\"javascript:return BtnBug();\" />";
		else
		    BtnStr = "<input id=\"bOK\" type=\"button\" value=\"确认\" onclick=\"javascript:return BtnOK();\" /> "
		           + "<input id=\"bCancle\" type=\"button\" value=\"取消\" onclick=\"javascript:return BtnCancle();\" />"
		           + "<input id=\"bBug\" type=\"button\" value=\"发送错误报告\" onclick=\"javascript:return BtnBug();\" />";*/
		    
		    
		var TableCode = "<table align=\"center\" width=\"98%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"
		              + "<tr><td colspan=\"2\" style=\"font:14px;color:#555\">&nbsp;&nbsp;<strong>"+titleMsg+"</strong></td><td width=\"20%\" align=\"left\"><a href=\"#\" onclick=\"javascript:return ImgClose();\"><img src=\"http://eppoo.com/manage/img/div_pro_close.gif\" border=\"0\" alt=\"关闭\" id=\"img_close\"></a></td></tr>"
		              + "<tr><td height=\"20\">&nbsp;</td><td width=\"68%\">&nbsp;</td><td>&nbsp;</td></tr>"
		              + "<tr><td width=\"20%\" align=\"center\">"+iconImg+"</td><td colspan=\"2\" style=\"font:14px;color:#666\">"+Msg+"</td></tr>"
		              + "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>"
		              + "<tr align=\"center\"><td colspan=\"3\">"+BtnStr+"</td></tr>"
		              + "</table>";
		var newDiv = document.createElement("div");
		
		newDiv.id = _id;
		newDiv.style.position = "absolute";
		newDiv.style.zIndex = "10";
		newDiv.style.width = "300px";
		newDiv.style.height = "150px";
		newDiv.style.top = (parseInt(document.body.scrollHeight)-150) / 2 + "px";//垂直居中
		newDiv.style.left = (parseInt(document.body.scrollWidth)-300) / 2 + "px"; // 水平居中
		newDiv.style.background = "url(http://eppoo.com/manage/img/div_pro.gif) no-repeat";
		//newDiv.style.border = "1px solid #860001";
		newDiv.style.padding = "5px";
		newDiv.innerHTML = TableCode;
		document.body.appendChild(newDiv);
		
		// mask图层
		var newMask = document.createElement("div");
		newMask.id = m;
		newMask.style.position = "absolute";
		newMask.style.zIndex = "9";
		newMask.style.width = document.body.scrollWidth + "px";
		newMask.style.height = document.body.scrollHeight + "px";
		newMask.style.top = "0px";
		newMask.style.left = "0px";
		newMask.style.background = "#000";
		newMask.style.filter = "alpha(opacity=20)";
		newMask.style.opacity = "0.40";
		document.body.appendChild(newMask);

		// 关闭mask和新图层
		var newA = document.createElement("a");
		/*newA.href = "#";
		newA.innerHTML = "关闭";
		newA.onclick = function() {
			document.body.removeChild(docEle(_id));
			document.body.removeChild(docEle(m));
			return false;
		}*/
		bOK.onclick = function()
		{
		   	document.body.removeChild(docEle("newDiv"));
	        document.body.removeChild(docEle("mask"));
	        //window.close();
	        //window.returnValue=1;
		}
		
		/*bCancle.onclick = function()
		{
		   	document.body.removeChild(docEle("newDiv"));
	        document.body.removeChild(docEle("mask"));
	        //window.close();
	        //window.returnValue=0;
		}
		
		img_close.onclick = function()
		{
		   	document.body.removeChild(docEle("newDiv"));
	        document.body.removeChild(docEle("mask"));
	        //window.close();
	        //window.returnValue=0;
		}	*/	
		
		
		/*bBug.onclick = function()
		{
		   	document.body.removeChild(docEle("newDiv"));
	        document.body.removeChild(docEle("mask"));
	        //window.close();
	        //window.returnValue=2;
		}*/
		
		newDiv.appendChild(newA);
		//return false;
}

//左右层高度设为一致
//SpeId专为日记设计的,因为日记有格子线,用格子线填充,记录上一次填充的高度
var VarW_ForSpeId = 0;
function DivAlign(LeftId,RightId,LeftSpace,RightSpace,SpeId)
{
   try
   {
   //翻页情况下需减去上一次填的高度,即还原数据的高度
   
   var divRigthHeight = document.getElementById(RightId).offsetHeight-document.getElementById(RightSpace).offsetHeight;
   
   if(SpeId!=null)
        var LeftSpaceH = VarW_ForSpeId;// document.getElementById(SpeId).offsetHeight;
   else
        var LeftSpaceH = document.getElementById(LeftSpace).offsetHeight;
        
   var divLeftHeight = document.getElementById(LeftId).offsetHeight-LeftSpaceH;
   //alert(divLeftHeight+"="+divRigthHeight);
   var dHeight = 500;
   if(divRigthHeight>dHeight || divLeftHeight>dHeight)
   {
        var rvalue = Math.abs(divLeftHeight-divRigthHeight);

        if(parseInt(divLeftHeight)>parseInt(divRigthHeight))
        {   
            document.getElementById(RightId).style.pixelHeight = divLeftHeight;    

            document.getElementById(RightSpace).style.pixelHeight = rvalue; //填充空白层     
      
        }
        else
        {
            document.getElementById(LeftId).style.pixelHeight = divRigthHeight;
            //alert(document.getElementById(SpeId).offsetHeight + rvalue);
      
            if(SpeId!=null)
            {
                VarW_ForSpeId = rvalue;
                document.getElementById(SpeId).style.pixelHeight = document.getElementById(SpeId).offsetHeight + rvalue;
            }
            else
                document.getElementById(LeftSpace).style.pixelHeight = rvalue; //填充空白层     
      
        }      
        
   }
   else
   {
        
        document.getElementById(LeftId).style.pixelHeight = dHeight;
        document.getElementById(RightId).style.pixelHeight = dHeight;        

        document.getElementById(RightSpace).style.pixelHeight = dHeight-divRigthHeight; //填充空白层 
         
        if(SpeId!=null)
        {
          var rvalue = document.getElementById(SpeId).offsetHeight;
          VarW_ForSpeId = rvalue;
          document.getElementById(SpeId).style.pixelHeight = (dHeight-divLeftHeight)+rvalue;
        }
        else
          document.getElementById(LeftSpace).style.pixelHeight = dHeight - divLeftHeight; //填充空白层  
        

   }
   }
   catch(e)
   {
    ;
   }
}


//是否是数字
function IsNumber(idname)
{
    var temp=document.getElementById(idname).value;
    var ch=new RegExp("^[1-9]{1,}[0-9]{0,}$","ig");    
    if (!ch.exec(temp))
    {
        return false;
    }
    return true;
}

//是否是字符
function IsChar(idname)
{
    var temp=document.getElementById(idname).value;
    var ch=new RegExp("^[0-9a-zA-Z]{4,4}$","ig");    
    if (!ch.exec(temp))
    {
        return false;
    }
    return true;
}

//传入的字符串是否是数字
function IsNumeric(str)
{
    var ch=new RegExp("^[1-9]{1,}[0-9]{0,}$","ig");    
    if (isNaN(str))
    {
        return false;
    }
    return true;
}

//好友默认类型
var getFriendType="<option value=1>我的好友</option><option value=2>同学</option><option value=3>同事</option><option value=4>同乡</option>";

//Msg start
//rb提示信息，text标题，bts按钮数bts=true|false（true确认与取消,false确认），idName（元素ID）定位到指定元素下边
//返回值处理函数fCallBack(res)调用者实现
//return=false|0|1|value false关闭,取消0,确认1,input.value
function showMsg(rb,text,bts,idName)
{
    
     var br=El.createElement("DIV", "dvSystemMsg");
     document.body.appendChild(br);   

text=text||"Eppoo.com系统提示";
var u="";
var cancelHtml="";
if(bts)
{
    cancelHtml='<input type="button" class="submit" value="取 消" class="syBtn" id="btnSysMsgCancel"/>';
}
/*
if(isPrompt)
{
    rb=rb + ':&nbsp;<input type="text" id="txtPromptInput" />&nbsp;&nbsp;&nbsp;&nbsp;<span id="spnEroMsg" class=check></span>'
}*/
 u+='<div class="out_div" style="position:absolute;z-index:999;;top:100;left:10" id="sysMsgWin" >'
 +'<div class="out_div_top" id="sysHead" onmousedown=f_mdown(\'sysMsgWin\')  >' 
 + text 
 +'<span class="out_img_close"><a href="javascript:fGoto();" title="关闭" class="clsWin close12" id="btnSysInfoClose"></a></span>' 
 +'</div>' 
 +'<div class="out_div_text">'
 + rb +'</div>' 
 +'<div class="out_div_bottom">' 
 +'<input type="button" class="submit" value="确 定" id="btnSysMsgOk" />  ' 
 +cancelHtml+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/></div></div>';
 
var Aok="1000px";
var Anc="1280px";
if(window.screen.width>0)
{
    Aok=(window.screen.width-20)+"px";
}
if(document.body.scrollHeight > Alf())
{
    Anc=document.body.scrollHeight;
}
var Abc="";
Abc="-moz-opacity:0.07;";
Abc+="filter:alpha(opacity=20);";
u+='<div  style="position:absolute;z-index:998;top:0;left:0;width:'+ Aok +';height:'+ Anc +';'+ Abc +'background:url(http://eppoo.com/manage/img/mask_div_bg.gif) repeat"></div>';
br.innerHTML=u;
var ag=br.firstChild;
var h=ag.offsetHeight;
var w=ag.offsetWidth;
var scrollTop=Sth();
var x=(Aml() - w)/2;
var y=(Alf() - h)/2 + scrollTop;//+event.clientY;
if(idName!=null)
{
    var obj=document.getElementById(idName);   
    x=findPosX(obj)-80;
    y=findPosY(obj)+22;
}

ag.style.left=x + "px";
ag.style.top=y + "px";

if(idName=="btDelF" || idName=="btMask")//删除好友或黑名单时默认焦点在取消上
{
    if($("btnSysMsgCancel"))
        $("btnSysMsgCancel").focus();
}
else
{
    if($("btnSysMsgOk"))
       $("btnSysMsgOk").focus();
}

var res=""; 
$("btnSysInfoClose").onclick=function()
{
    br.style.display="none";  
    fCallBack(res);  
    return false;
};

if($("btnSysMsgCancel"))
{
    $("btnSysMsgCancel").onclick=function()
    {        
        //return "0";
         res="0";  
        if(bts)
        {            
            //if(isPrompt)
               // res="0";         
            //fCallBack(res);
        }
        $("btnSysInfoClose").onclick();
    }
}/*
if($("txtPromptInput"))
{
    $("txtPromptInput").focus();
    $("txtPromptInput").onfocus=function()
    {
        $("spnEroMsg").innerHTML="";
    }
}*/
    $("btnSysMsgOk").onclick=function()
    {        
        //return "1";
        res="1";
        if(bts)
        {   /*         
            if(isPrompt)
            {
                res=$("txtPromptInput").value;
                if(res.length<1)
                {
                    $("spnEroMsg").innerHTML="你还没输入值呢！";
                    return false;
                }
            }   */         
        }
        //fCallBack(res);
        $("btnSysInfoClose").onclick();
    }   
}
function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	} else if (obj.x) curleft += obj.x;
	return curleft;
}
function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} else if (obj.y) curtop += obj.y;
	return curtop;
}

function fGoto()
{
}

function $() 
{
    var xo=new Array();
    for (var i=0; i < arguments.length; i++) 
    {
        var aa=arguments[i];
        if(typeof aa=='string')
        {
            aa=document.getElementById(aa);
        }    
        if(arguments.length==1)
        {
            return aa;
        }
        xo.push(aa);
    }
    return xo;
}
//取得窗体宽度
function Aml()
{
    return (document.documentElement.offsetWidth||document.body.offsetWidth);
}
//取得窗体高度
function Alf()
{
    return (self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight);
}

//取得被卷去的高
function Sth()
{
    return (document.documentElement.scrollTop||document.body.scrollTop);
}
//拖动开始
var currentMoveObj = null;	
var relLeft;	
var relTop;
function f_mdown(obj)
{
	currentMoveObj = document.getElementById(obj);		
	currentMoveObj.style.position = "absolute";
	relLeft = event.x - currentMoveObj.style.pixelLeft;
	relTop = event.y - currentMoveObj.style.pixelTop;
}
window.document.onmouseup = function()
{
	currentMoveObj = null;	
}
window.document.onmousemove=function()
{
	if(currentMoveObj != null)
	{
		currentMoveObj.style.pixelLeft=event.x-relLeft;
		currentMoveObj.style.pixelTop=event.y-relTop;
	}
}
//old drag
/*
var isdown = false
var beginx,beginy
var test="";
function down(mdiv) 
{
    isdown = true;    
}

function up() 
{
    isdown = false;
    //alert(document.body.scrollHeight+","+document.body.offsetHeight+","+event.clientY+","+document.documentElement.clientHeight);
}

function move(mdiv) 
{
    if(mdiv!=null)
        document.getElementById(mdiv).style.cursor="hand";
    if (isdown&&mdiv!=null)
    {
        var obj=document.getElementById(mdiv);
        var endx = event.clientX+document.body.scrollLeft;           //document.body.scrollTop
        var endy = event.clientY+document.body.scrollTop;        //document.body.scrollLeft  
        //test+='end('+endx+','+endy+');obj('+obj.style.left+','+obj.style.top+');begin('+beginx+','+beginy+')\n'
        //alert(test);
        obj.style.left = parseInt(obj.style.left)+ endx-beginx;
        obj.style.top = parseInt(obj.style.top) + endy-beginy;
        //isdown=false;
    }
    beginx = event.clientX+document.body.scrollLeft;
    beginy = event.clientY+document.body.scrollTop;
}
*/
//end

function ng(ao) 
{
    return ( ao&&(ao.length||ao.length==0)&&typeof ao!="string"&&!ao.tagName&&!ao.alert);
}

function oj(Ace)
{
var aa=null;
if(typeof(Ace)=='object')
{aa=Ace;}
else
{aa=$(Ace);}
return aa;
}

function q1()
{this.ks=new Object();
this.Asf="object";
window.$continue=new Object();
window.$break=new Object();
this.isHash=true;
this.add=function(key,value){
if(value&&value.nodeType&&value.nodeType==1)
{value=$(value);}
if(key&&key.nodeType&&key.nodeType==1)
{key=$(key);}
if(this.Asf=="object")
{if(typeof(key)!="undefined")
{if(this.contains(key)==false)
{this.ks[key]=typeof(value)=="undefined"?null:value;return true;} 
else {return false;}
} 
else {return false;}
}else
{if(typeof(value)!="undefined"&&typeof(key)!="undefined")
{this.ks[key]=value;return true;}
else if(typeof(key)!="undefined")
{this.ks[this.ks.length]=key;return true;}
else{return false;}
}
};
this.remove=function(key){delete this.ks[key];};
this.count=function(){
if(this.Asf=="array")
{return this.ks.length;}
var i=0;
for(var k in this.ks)
{i++;}return i;};
this.items=function(key){return this.ks[key];};
this.contains=function(key){
return typeof(this.ks[key])!="undefined";};
this.has=function(s){
for(var k in this.ks)
{if(this.ks[k]==s)
{return true;}
}return false;
};
this.clear=function()
{for(var k in this.ks)
{delete this.ks[k];}
};
this.join=function(sJoin)
{var ab=[];
for(var k in this.ks)
{ab[ab.length]=(this.ks[k] + "");}
return ab.join(sJoin);};
this.each=function(func){
try{if(this.Asf=="object")
{for(var k in this.ks)
{try{
func(k, this.ks[k]);
}catch(e)
{if (e!=$continue) throw e;}
}
}else
{for(var k=0;k<this.ks.length;k++)
{try
{func(k, this.ks[k]);}
catch(e)
{if (e!=$continue) throw e;}
}
}
}catch(e)
{if (e!=$break) throw e;}
};
if(arguments.length>0)
{var arg=arguments[0];
if(typeof arg=="object")
{if(ng(arg)||arg.ie5)
{this.Asf="array";
this.ks=new Array();
for(var i=0;i<arg.length;i++)
{this.add(i, arg[i]);}
}else
{for(var ao in arg)
{this.add(ao, arg[ao]);
}
}
}
}
}

function uf(Aam, cd)
{
for(var ao in Aam)
{
try{
if(!cd[ao])
{
cd[ao]=Aam[ao];
}
}
catch(exp){}
}
}

function El(){}
El.toggle=Ang;
El.hide=fHide;
El.show=Aqh;
El.remove=Anf;
El.insertElement=wo;
El.nextSibling=Acd;
El.preSibling=Aen;
El.createElement=wn;
El.setAttr=Alg;
El.setStyle=Ajm;
El.addClass=Ajl;
El.removeClass=Acc;
El.setClass=Ajj;
El.delClass=Ajk;
El.getX=Aqg;
El.getY=Aqf;
El.position=Ajf;
El.toggleText=fToggleText;


function Ang() 
{
if(arguments.length==0)
{this.style.display=(this.style.display=='none' ? '' : 'none');}
else
{
for (var i=0; i < arguments.length; i++) 
{var aa=oj(arguments[i]);
if(aa)
{aa.style.display=(aa.style.display=='none' ? '' : 'none');}
}
}
}

function fHide() 
{
if(arguments.length==0)
{this.style.display='none';}
else
{
for (var i=0; i < arguments.length; i++) 
{var aa=oj(arguments[i]);
aa.style.display='none';}
}
}

function Aqh() 
{
if(arguments.length==0)
{this.style.display='';}
else
{
for (var i=0; i < arguments.length; i++) 
{var aa=oj(arguments[i]);
aa.style.display='';
}
}
}

function Anf() 
{
if(arguments.length==0)
{
this.parentNode.removeChild(this);
}
else
{for (var i=0; i < arguments.length; i++) 
{aa=oj(arguments[i]);
aa.parentNode.removeChild(aa);
}
}
}

function wo(aa,v,nj)
{
try
{
if(arguments.length==2)
{var nj=v;var v=aa;var aa=this;}
var da=aa.parentNode;
var Aog=da.childNodes.length;
var All=-1;
for(var i=0;i<Aog;i++)
{if(da.childNodes[i]==aa){All=i;}
}
if(nj=="beforeEnd")
{aa.appendChild(v);}
else if(nj=="afterEnd")
{if(All==Aog-1)
{da.appendChild(v);}
else{da.insertBefore(v,da.childNodes[All+1]);}
}else if(nj=="beforeBegin")
{aa.parentNode.insertBefore(v, aa);}
else if(nj=="afterBegin")
{if(aa.childNodes.length==0)
{aa.appendChild(v);}
else{aa.insertBefore(v,aa.childNodes[0]);
}
}
}catch(exp){ch("fInsertElement",exp.description);}
}

function Acd(aa)
{
try{
if(!aa)
{aa=this;}
var da=aa.parentNode;
var fa=da.childNodes;
for(var i=0;i<fa.length;i++)
{
if(fa[i]==aa)
{
if(i==fa.length-1)
{return null;}
else
{return fa[i+1];}
}
}
}catch(exp){ch("fNextSibling",exp.description);
}
}

function Aen(aa)
{
try
{if(!aa)
{aa=this;}
var da=aa.parentNode;
var fa=da.childNodes;
for(var i=0;i<fa.length;i++)
{if(fa[i]==aa)
{if(i==0)
{return null;}
else
{return fa[i-1];}
}
}
}catch(exp)
{ch("fPreSibling",exp.description);}
}

function wn(Arb, sId)
{if(sId)
{var ao=$(sId);
if(ao)
{El.remove(ao);}
}var aa=document.createElement(Arb);
if(sId){aa.id=sId;}uf(El, aa);
return aa;
}

function Alg(aa, rl)
{
if(arguments.length==1)
{var rl=aa;
var aa=this;
}for(var ao in rl)
{aa[ao]=rl[ao];}
}

function Ajm(aa, ni)
{if(arguments.length==1)
{var ni=aa;var aa=this;}
for(var ao in ni)
{aa.style[ao]=ni[ao];}
}

function Ajl(aa, bn)
{if(arguments.length==1)
{var bn=aa;var aa=this;}
var Alj=" "+aa.className.trim()+" ";
var ew=" "+bn+" ";
if (Alj.indexOf(ew)==-1)
{aa.className+=" " + bn;}
}

function Ajk(aa,bn)
{if(arguments.length==1)
{var bn=aa;var aa=this;}
aa.className=aa.className.replace(bn,"");
}

function Acc(aa, bn)
{if(arguments.length==1)
{var bn=aa;var aa=this;}
var Acf=aa.className.split(" ");
var ab=[];
for(var i=0;i<Acf.length;i++)
{if(Acf[i]!=bn)
{ab[ab.length]=Acf[i];}
}
aa.className=ab.join(" ");
}

function Ajj(aa, bn)
{if(arguments.length==1)
{var bn=aa;var aa=this;}
aa.className=bn;
}

function Aqg(aa)
{if(!aa)
{var aa=this;}
var l=aa.offsetLeft;
while(aa=aa.offsetParent)
{l+=aa.offsetLeft;}
return l;
}

function Aqf(aa)
{if(!aa)
{var aa=this;}
var t=aa.offsetTop;
while(aa=aa.offsetParent)
{t+=aa.offsetTop;}
return t;
}

function Ajf(aa) 
{
if(!aa)
{
var aa=this;
}
var valueT=0, valueL=0;
do {
valueT+=aa.offsetTop||0;valueL+=aa.offsetLeft||0;aa=aa.offsetParent;
} 
while (aa);
return [valueL, valueT];
};

function fToggleText(v, text1, text2)
{
v=$(v);
if(v.innerHTML==text1)
{v.innerHTML=text2;}
else
{v.innerHTML=text1;}
}

//Msg end

function trMouseOver(o)
{
    
    if (!o.contains(event.fromElement))
     {
            //src.style.cursor = 'hand';
            o.bgColor = "#ebfdce";
     }
}


function trMouseOut(o,par)
{
   if(par=='E')//偶数行
      o.bgColor = "#F7FEEC";
   else
      o.bgColor = "#FFFFFF";
}



//代码过滤及JS提取
function Ep_FilterScript(content)
{
	//alert(content);
	//content = Ep_rCode(content, 'javascript:', '<b>javascript</b> :');
	content = content.replace(/<(\w[^div|>]*) class\s*=\s*([^>|\s]*)([^>]*)/gi,"<$1$3") ;
	content = content.replace(/<(\w[^font|>]*) style\s*=\s*\"[^\"]*\"([^>]*>)/gi,"<$1 $2") ;
	content = content.replace(/<(\w[^>]*) lang\s*=\s*([^>|\s]*)([^>]*)/gi,"<$1$3") ;
	content = content.replace(/\"/g, "&quot;");
	content = content.replace(/<P>/g, "");
	content = content.replace(/<\/P>/g, "<BR><BR>");
	content = content.replace(/\r\n/g, "<BR>");
	var RegExp = /<(script[^>]*)>(.*)<\/script>/gi;
	content = content.replace(RegExp, "&lt;$1&gt;<br>$2<br>&lt;script&gt;");	

	RegExp = /<(\w[^>|\s]*)([^>]*)(on(finish|mouse|Exit|error|click|key|load|change|focus|blur))(.[^>]*)/gi;
	content = content.replace(RegExp, "<$1")
	RegExp = /<(\w[^>|\s]*)([^>]*)(&#|window\.|javascript:|js:|about:|file:|Document\.|vbs:|cookie| name| id)(.[^>]*)/gi;
	content = content.replace(RegExp, "<$1");
	
	//alert(content);
	return content;
}


//EPPOO表情接口
//EditId 编辑框的ID | EditModel 编辑框的模式(HTML|TEXT值之一)|PreviewId预览大图的ID号 |ClickObj 链接进入的ID,用来处理弹出层的位置| IsPopup 是否需用弹出层显示表情,不为空即可
//若为TEXT(文本)编辑器,提交内容前请使用本文件里的EpFaceUBB方法处理表情,建议在显示内容时使用此方法(节约数据库)
var EP_FaceAry;
var oHideTimer;
function GetEpFace(EditId,EditModel,ClickObj,PreviewId,IsPopup)
{
    if(IsPopup!=null)
    {
        if(oHideTimer) ClearTimer();
        EpFacePopupDiv(EditId,EditModel,ClickObj);
        
    }
    else
    {
        EP_FaceAry = new Array();
        EP_FaceAry[0] = new Array("smile","微笑");
        EP_FaceAry[1] = new Array("bye","再见");
        EP_FaceAry[2] = new Array("piquant","调皮");
        EP_FaceAry[3] = new Array("lovely","可爱");
        EP_FaceAry[4] = new Array("surprise","惊讶");
        EP_FaceAry[5] = new Array("pudency","偷笑");
        EP_FaceAry[6] = new Array("simper","憨笑");
        EP_FaceAry[7] = new Array("titter","害羞");
        EP_FaceAry[8] = new Array("puzzle","疑问");
        EP_FaceAry[9] = new Array("victory","胜利");
        EP_FaceAry[10] = new Array("love","爱情");
        EP_FaceAry[11] = new Array("cry","大哭");
        EP_FaceAry[12] = new Array("yock","大笑");
        EP_FaceAry[13] = new Array("smoke","抽烟");
        EP_FaceAry[14] = new Array("angry","发怒");
        EP_FaceAry[15] = new Array("affliction","苦恼");
        EP_FaceAry[16] = new Array("sweat","汗");
        EP_FaceAry[17] = new Array("dizzy","晕");
        EP_FaceAry[18] = new Array("daze","呆");
        EP_FaceAry[19] = new Array("cool","酷");
        EP_FaceAry[20] = new Array("vomit","吐");
        EP_FaceAry[21] = new Array("sleepy","困");
        EP_FaceAry[22] = new Array("flower","花");
        EP_FaceAry[23] = new Array("sexy","色");

        //alert(FaceAry.length);
        var theStr = "";
        for(var i=0;i<EP_FaceAry.length;i++)
        {
            var Br = "&nbsp;";           
            if(i>5 && (i%6)==0)
                Br = "<br /><br />";
             //alert(i+":"+(i%6)+":"+Br);
            theStr += Br + "<span style='cursor:pointer;' onmouseover=\"javascript:PreviewEpFace('"+PreviewId+"','"+EP_FaceAry[i][0]+"','"+EP_FaceAry[i][1]+"');\" onclick=\"javascript:EpFaceInputEditer('"+EditId+"','"+EP_FaceAry[i][0]+"','"+EditModel+"');\"><img border='0' src='http://eppoo.com/face/sm_"+EP_FaceAry[i][0]+".gif' title='"+EP_FaceAry[i][1]+"' /></span>";
        }
    
        return theStr;
    }
}


function EpFaceInputEditer(EditId,FaceName,EditModel)
{
    var theStr = "[EPF]"+FaceName+"[/EPF]";
    document.getElementById(EditId).focus();
	//alert(EditModel);
    if(EditModel=="HTML")
    {
	theStr = "<img src='face/"+FaceName+".gif' />";
       document.selection.createRange().pasteHTML(theStr);
    }
    else
    {
    	
    	with(document.selection.createRange()) 
    	{ 
        	text = theStr; 
        	collapse(); 
        	select(); 
    	} 
    }
}

function EpFaceUBB(cont)
{
    cont = cont.replace(/\[EPF\]/g,"<img src='http://eppoo.com/face/");
    cont = cont.replace(/\[\/EPF\]/g,".gif' border='0' />");
    //cont = cont.replace(/\r\n/g,"<br />");
    return cont;
}

function EpFaceUBB(cont,issp)
{
    if(issp)
        cont = cont.replace(/\[EPF\]/g,"<img src='http://eppoo.com/face/sm_");
    else
        cont = cont.replace(/\[EPF\]/g,"<img src='http://eppoo.com/face/");
        
    cont = cont.replace(/\[\/EPF\]/g,".gif' border='0' />");
    //cont = cont.replace(/\r\n/g,"<br />");
    return cont;
}

//弹出层并显示表情
function EpFacePopupDiv(EditId,EditModel,ClickObj)
{
    //被点击的链接ID
    var AH = document.documentElement.scrollTop + document.documentElement.clientHeight;    
    var obj = document.getElementById(ClickObj);
    //alert(findPosY(obj));
    var bgName = "face_bg";    
    var objTop = findPosY(obj) + 29;
    if((AH-objTop)<243)
    {
        objTop = objTop - 272;
        bgName = "face_bg2";
    }
        
    var br=El.createElement("DIV", "div_wEpFaceList");
    document.body.appendChild(br);
    document.getElementById("div_wEpFaceList").style.width = "208px";
    document.getElementById("div_wEpFaceList").style.background = "url(http://eppoo.com/face/"+bgName+".gif) no-repeat";
    document.getElementById("div_wEpFaceList").style.position = "absolute";
    document.getElementById("div_wEpFaceList").style.zIndex = "10000";
    document.getElementById("div_wEpFaceList").style.top = objTop;
    document.getElementById("div_wEpFaceList").style.left = findPosX(obj)+25;
        
    obj.onmouseover =function(){ ClearTimer();}
    obj.onmouseout = function(){ HiddenFaceDiv('div_wEpFaceList',200)};
    document.getElementById("div_wEpFaceList").onmouseover =function(){ ClearTimer();}
    document.getElementById("div_wEpFaceList").onmouseout = function(){ HiddenFaceDiv('div_wEpFaceList',200)};
    
    br.innerHTML = "<div style='padding:6px 0px 10px 6px;'><span id='ViewBigImg' style='padding-left:40px; font-weight:bold; font-size:18px; color:#666;'></span><br /><br /><span style='line-height:6px;'>" + GetEpFace(EditId,EditModel,ClickObj,'ViewBigImg') + "</span></div>";
    PreviewEpFace('ViewBigImg',EP_FaceAry[0][0],EP_FaceAry[0][1]);    
    //HiddenFaceDiv('div_wEpFaceList',5000);
   // ClearTimer();
    //alert(document.getElementById("div_wEpFaceList").innerHTML);
    //var ag = br.firstChild;
    
}

function PreviewEpFace(PreviewId,FaceFileName,FaceName)
{
    //alert(PreviewId);
    //alert(VarW_ClickedObj);    
    document.getElementById(PreviewId).innerHTML = FaceName + "&nbsp;<img src='http://eppoo.com/face/"+FaceFileName+".gif' align='absbottom' height='76px' />";
}

function ClearTimer()
{
    clearTimeout(oHideTimer);
    //alert("af");
}

function HiddenFaceDiv(div_id,ext_time)
{
    //alert(div_id);
   // document.documentElement.removeChild(div_id);
   //document.getElementById(div_id).style.display = 'none';
   //$(div_id).style.display="none";
	oHideTimer=setTimeout("$('"+div_id+"').style.display='none';",ext_time);
}
 

/*window.onerror = function()
{
    //初始化所有JS文件
    top.document.location = "initpage.aspx?par=" + escape(location.href);
} */

function htmlEncode(content)
{
	content = content.replace(/</gi,"&lt;");
	content = content.replace(/>/gi,"&gt;");
	return content;
}

//修复[EPF]配数(未完成 Ensen)
/*function EP_RepairCont(cont)
{
    var tmp = cont;
    var pos = -1;
    while(pos+1<tmp.length)
    {
        pos = tmp.indexOf("[EPF]");
        if(pos==-1)
            pos = tmp.length;
        else
        {
           tmp = tmp.substr(pos+5,tmp.length-pos);
           var pos2 = tmp.indexOf("[EPF]");
           if(pos2>0)
           var tmpstr = tmp.substr(pos+5,tmp.length-pos2)
           if(tmpstr.indexOf("[/EPF]")==-1)
           
        }
    }
}*/


//以下代码实现Ctrl + Enter提交

function isKeyTrigger(e,keyCode){
　　var argv = isKeyTrigger.arguments;
　　var argc = isKeyTrigger.arguments.length;
　　var bCtrl = false;
　　if(argc > 2){
　　　　bCtrl = argv[2];
　　}
　　var bAlt = false;
　　if(argc > 3){
　　　　bAlt = argv[3];
　　}

　　var nav4 = window.Event ? true : false;

　　if(typeof e == 'undefined') {
　　　　e = event;
　　}

　　if( bCtrl &&
　　　　!((typeof e.ctrlKey != 'undefined') ?
　　　　　　e.ctrlKey : e.modifiers & Event.CONTROL_MASK > 0)){
　　　　return false;
　　}

　　if( bAlt &&
　　　　!((typeof e.altKey != 'undefined') ?
　　　　　　e.altKey : e.modifiers & Event.ALT_MASK > 0)){
　　　　return false;
　　}
　　var whichCode = 0;
　　if (nav4) whichCode = e.which;
　　else if (e.type == "keypress" || e.type == "keydown")
　　　　whichCode = e.keyCode;
　　else whichCode = e.button;

　　return (whichCode == keyCode);
}

function CtrlEnter(e,btnObj)
{
　　var ie =navigator.appName=="Microsoft Internet Explorer"?true:false;
　　//alert(e);
　　if(ie)
　　{
　　　　if(event.ctrlKey && window.event.keyCode==13)
　　　　{
　　　　    //alert("IE");
　　　　    CtrlEnsterSubmit(btnObj);
　　　　}
　　}
　　else
　　{
　　　　if(isKeyTrigger(e,13,true))
　　　　{
　　　　    //alert("非IE");
　　　　    CtrlEnsterSubmit(btnObj);
　　　　}
　　}
}

function CtrlEnsterSubmit(btnObj)
{
    if(btnObj)
        btnObj.click();
}

//实现Ctrl + Enter提交结束

//播放音乐处理

//首页的音乐播放控制
//点播放时，提示信息的显示计时器
var tTimeout = null;
function PlayMusic(musicid)
{
    //把歌曲ID加入播放列表缓存
    if(tTimeout)
        clearTimeout(tTimeout);
        
    var o = document.getElementById("div_play_hint");
    o.style.display = "";
    o.innerHTML = "处理中……";
    $.ajax({type:"get",url:"/eppoo/push_music_tocache.aspx",data:"musicid=" + musicid + "&rnd=" + Math.random(),success:
    function(r)
    {
        var winIsOpen = r.substr(0,1);
        var r = r.substr(1);
        //alert(winIsOpen)
        var handOpen = "";              
        if(winIsOpen=="N")
        {
            handOpen = " <a href='http://eppoo.com/space/default/play_music.aspx' target='playmusic'>手动打开播放页</a>";
            window.open("http://eppoo.com/space/default/play_music.aspx","playmusic");
        }
        
        switch(r)
        {
            case "S"://加入成功 
                ShowHint("已添加到播放列表,请到播放页刷新列表." + handOpen);                                               
                break;
                
            case "N":
                ShowHint("已添加到播放列表,播放页面将自动打开." + handOpen);                
                break; 
                   
            case "E"://已存在列表中
                ShowHint("已经在播放列表中" + handOpen);
                break;
                
            case "M"://已达最大值12首
                ShowHint("播放列表最多能加入12首歌" + handOpen);
                break;  
                
            case "T"://登录超时
                ShowHint("T");
                //ShowHint("请先<a href='javascript:fGoto();' onclick='javascript:GotoLogin();'>登录</a>");
                break;   
                
            default:
                ShowHint("有错误发生" + handOpen);
                break;             
        }

    }
    });
}

function GotoLogin()
{    
    //alert(escape(location.href));
    top.document.location = "http://eppoo.com/eppoo/login.aspx?url="+escape(location.href)+"";
}

//加入列表后的提示信息
function ShowHint(cont)
{
    if(cont=="T")
    {
        cont = "请先<a href='http://eppoo.com/eppoo/login.aspx?url="+escape(location.href)+"'>登录</a>";
    }
    var o = document.getElementById("div_play_hint");    
    var count = 0;
    var iInterval = setInterval(function()
    {
        //alert(count);
        if(count<5)
        { 
            if(count%2==0)
                o.innerHTML = "<strong>"+cont+"</strong>";
            else
                o.innerHTML = "";
                
            count++;             
        }
        else
        {
            clearInterval(iInterval);
            
            tTimeout = setTimeout(function(){
            o.innerHTML = "";
            o.style.display = "none";
            if(tTimeout)
                clearTimeout(tTimeout);
            },5000);
        }     
        
    },100);   

}

//播放音乐处理完毕


//登录超时或未登录时弹出登录层(Ensen 2008.05.30)
function __PopLogin()
{
    //网页对象的高
    var bodyHeight;
    //网页顶部被卷去的高
    var topHiddenHeight;
    //网页可见区域的高
    var docHeight ;
    //网页左边被卷去的宽
    var scrollLeft;
    //网页可见内容的宽
    var docWidth;

    bodyHeight = parseInt(document.body.clientHeight,10);
    if(bodyHeight==0)
        bodyHeight = parseInt(document.documentElement.clientHeight,10);
    
    //上半部分被卷去的高
    topHiddenHeight = parseInt(document.documentElement.scrollTop,10);
    if(topHiddenHeight==0)
        topHiddenHeight = parseInt(document.body.scrollTop,10);

    //网页可见区域的高
    docHeight = parseInt(document.documentElement.clientHeight,10);
    if(docHeight==0)
        docHeight = parseInt(document.body.clientHeight,10);
        
    scrollLeft= parseInt(document.documentElement.scrollLeft);
    if(scrollLeft==0)
        scrollLeft = parseInt(document.body.scrollLeft,10);
        
    docWidth = parseInt(document.documentElement.clientWidth,10);
    if(docWidth==0)
        docWidth = parseInt(document.body.clientWidth,10);    

    var mask = document.createElement("div");
    document.body.appendChild(mask); 
    mask.style.background = "#000000";
    mask.style.top = "0px";
    mask.style.left = "0px";
    mask.style.width = (scrollLeft + docWidth) + "px";
    mask.style.height = (bodyHeight + 100) + "px";
    mask.style.position = "absolute";
    mask.style.zIndex = "999";
    mask.style.filter = "alpha(opacity=35)";
    mask.style.opacity = "0.35";
    
    var div = document.createElement("div");
    document.body.appendChild(div); 
 
    var html = "用户名：<input type='text' id='uName' name='uName' style='width:120px;'> <a href='http://eppoo.com/eppoo/join_user.aspx' target='_blank' title='新用户注册'>注册</a><br>密&nbsp;&nbsp;&nbsp;码：<input type='password' id='uPwd' name='uPwd' style='width:120px;'> <a href='http://eppoo.com/eppoo/passwd.htm' target='_blank' title='找回密码'>忘记密码?</a><br><span style='padding-left:48px;'></span><input type='button' id='loginBtn' value='登录'> <input type='button' id='cancleBtn' value='取消'> <span id='hintInfo'></span>";
   
    var u= '<div align=left style="padding:2px 15px;margin:0 auto;">'
    + '<div style="height:40px;">' 
    + '<br><strong>请登录</strong>' 
    + '</div>' 
    + '<div style="line-height:25px; font-size:12px;">'    
    + html    
    + '</div>' 
    + '<div id="statInfo" style="padding-left:15px;color:gray;">&nbsp;</div>'
    + '</div>';
    
    div.style.background = "#ffffff";
    div.style.top = (docHeight/2 - 75 + topHiddenHeight) + "px";
    div.style.left = (docWidth/2 - 140) + "px";
    div.style.width ="280px";
    div.style.border = "1px";
    div.style.height = "150px";
    div.style.position = "absolute";
    div.style.zIndex = "1000";
    div.style.color = "#000000";
    
    div.innerHTML = "<form id='_login' onsubmit='alert(1);'>" + u + "</form>"; 
    

    var cancle = document.getElementById("cancleBtn");
    if(cancle)
    {
        cancle.onclick = function()
        {            
            document.onkeydown = function(){ }
            if(div)
                document.body.removeChild(div);
            if(mask)
                document.body.removeChild(mask);
                
            __efCallBack(0);
        }
    }
    
    
    var loginBtn = document.getElementById("loginBtn");
    if(loginBtn)
    {        
        loginBtn.onclick = function()
        {
            var uNameObj = document.getElementById("uName");
            var uPwdObj = document.getElementById("uPwd");
            var hintInfo = document.getElementById("hintInfo");
            var uName = uNameObj.value.replace(/^\s+|\s+$/g,"");
            if(uName.length==0)
            {
                hintInfo.innerHTML = "请输入用户名！";
                uNameObj.focus();
                return;
            }
            
            var uPwd = uPwdObj.value.replace(/^\s+|\s+$/g,"");
            if(uPwd.length==0)
            {
                hintInfo.innerHTML = "请输入密码！";
                uPwdObj.focus();
                return;
            }
            //alert($("#uName").serialize());
            hintInfo.innerHTML = "正在登录……";
            $.ajax({
            type:"post",
            url:"/eppoo/login_jquery.aspx",
            data:$("#uName").serialize() + "&" + $("#uPwd").serialize(),
            success:
            function(r)
            {
                switch(r)
                {
                    case "1":
                    
                        document.onkeydown = function(){ }
                        hintInfo.innerHTML = "登录成功！";
                        if(div)
                            document.body.removeChild(div);
                        if(mask)
                            document.body.removeChild(mask);
                        break;
                    
                    case "0":
                        hintInfo.innerHTML = "用户名或密码错误！";
                        break;
                        
                    case "2":
                        hintInfo.innerHTML = "帐号已被锁定！";
                        break;
                        
                    default:
                        hintInfo.innerHTML = "系统错误！";
                        break; 
                        
                }
                __efCallBack(r);
            }
            
            });
        }
    }
    
    document.onkeydown = function()
    {
        if(event.keyCode==13 && loginBtn)
        {
            loginBtn.click();
        }
    }   

    
}


function  FilterBadCharForText(cont)
{
    cont = cont.replace(/&/g, "&#38;");
    cont = cont.replace(/\\/g, "&#92;");
    cont = cont.replace(/\"/g, "&quot;");
    cont = cont.replace(/</g, "&lt;");
    return cont;
}