﻿var nowpeitip="<div class='borderTopDashed padding5 tipFont'>1. 请您不要过于频繁的做提交数据操作，否则会提示错误！<br /> 2. 请您不要发表色情暴力反动言论，同样会提示错误！<div>";
var notlogin="对不起，您还没有登录乐配，如果您还不是乐友，那么欢迎加入乐配，只要不到一分钟您就能成为乐友，我们的宗旨是助人为快乐之本，谢谢！";
var vcodeimage='<img src="http://www.nowpei.com/GHandler/VCodeImage.ashx?' + new Date().getTime() + '" width="60" height="20" />'
var nowpeiprefix="http://www.nowpei.com";
var needInFaceImgID;
var ie4 = (document.all) ? true : false;var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
var groupStr = {
	lengthOfBit : function(str) 
	{ 
		var num=str.length;
		var arr=str.match(/[^\x00-\x80]/ig);
		if(arr!=null) num += arr.length;
		return num;
	},
	trim : function(str) 
	{ 
		return str.replace(/(^\s*)|(\s*$)/g,"");
	}
}  
function getCookieVal(offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1) {
        endstr = document.cookie.length;
    }
    return unescape(document.cookie.substring(offset, endstr));
}   
function getCookie(name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg) {
            return getCookieVal(j);
        }
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break;     }
    return "";
}
function GetUserName()
{
    if(document.cookie.length > 0)     
     { 
          var result = getCookie("NowPeiLoginStatus");  
          return result;
     }     
     return "";
}
function reloadImage(form) 
{ 
	form.idCodeImage.src =  "http://www.nowpei.com/GHandler/VCodeImage.ashx?id="  + Math.random();
	return false;
}
function getWindowYPosition()
{
    var ie=document.all && !window.opera
	var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	var scroll_top=(ie)? standardbody.scrollTop : window.pageYOffset
	return scroll_top;
}
function getWindowYPositionAll()
{
    var ie=document.all && !window.opera
	var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes	
    var docheight=(ie)? standardbody.clientHeight: window.innerHeight
	return docheight;
}
function getPositionArray(position)
{
    var tp = position.split(" ");
    var objPos = {x:parseInt(tp[0]), y:parseInt(tp[1])};
    return objPos;
}
var isIe=(document.all)?true:false;  
function setSelectState(state)  
{  
 var objl=document.getElementsByTagName('select');  
 for(var i=0;i<objl.length;i++)  
 {  
    objl[i].style.visibility=state; 
 }
 if(document.getElementById('mainFrame') != null)
 {
     d = document.getElementById("mainFrame");
 
     var obj2=d.contentWindow.document.getElementsByTagName('select');

     for(var i=0;i<obj2.length;i++)  
     {  
        obj2[i].style.visibility=state;  
     }
 }
}  
function mousePosition(ev)  
{  
 if(ev == null)
 {
    var ie=document.all && !window.opera
    var domclientWidth=document.documentElement && parseInt(document.documentElement.clientWidth) || 100000 //Preliminary doc width in non IE browsers
	var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes	
    var docwidth=(ie)? standardbody.clientWidth : (/Safari/i.test(navigator.userAgent))? window.innerWidth : Math.min(domclientWidth, window.innerWidth-16)
	var scroll_left=(ie)? standardbody.scrollLeft : window.pageXOffset
	var left = scroll_left+(docwidth-200)/2
	var scroll_top=(ie)? standardbody.scrollTop : window.pageYOffset
	var docheight=(ie)? standardbody.clientHeight: window.innerHeight
	var top = scroll_top+(docheight-300)/2
	return {x:left, y:top};
 }
 if(ev.pageX || ev.pageY)  
 {  
     return {x:ev.pageX, y:ev.pageY};  
 }  
 return {  
 x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,y:ev.clientY + document.body.scrollTop - document.body.clientTop  
 };  
 }  
function showMessageBox(wTitle,content,pos,wWidth)  
{
     var bWidth=parseInt(document.documentElement.scrollWidth);  
     var bHeight=parseInt(document.documentElement.scrollHeight);  
     
     if(isIe)
     {  
        setSelectState('hidden');
     }      
     var back=document.createElement("div");  
     back.id="back";  
     var styleStr="z-index:299;top:0px;left:0px;position:absolute;background:#666;width:"+bWidth+"px;height:"+(bHeight+100)+"px;";  
     styleStr+=(isIe)?"filter:alpha(opacity=0);":"opacity:0;";  
     back.style.cssText=styleStr;  
     document.body.appendChild(back);
     showBackground(back,50);  
     var mesW=document.createElement("div");  
     mesW.id="mesWindow";  
     mesW.className="mesWindow";  
     mesW.innerHTML="<div ><table width='100%' height='100%'><tr><td class='mesWindowTop'>"+wTitle+"</td></tr><tr><td><div class='mesWindowContent' id='mesWindowContent'>"+content+"</div></td></tr><tr><td style='text-align:center;'><input type='button' onclick='closeWindow();' title='关闭窗口' class='close' value='关闭' /></td></tr></table></div><div class='mesWindowBottom'>" + nowpeitip + "</div>";  
     var topOf=isIe?pos.y + getWindowYPosition():pos.y;
     if(pos.y + 200 > getWindowYPositionAll())
     {
        topOf = topOf - 150;
     }
     styleStr="left:"+(((pos.x-wWidth)>0)?(pos.x-wWidth):pos.x)+"px;top:"+(topOf)+"px;position:absolute;width:"+wWidth+"px;";  
     mesW.style.cssText=styleStr;  
     document.body.appendChild(mesW);  
}  
 function showBackground(obj,endInt)  
{  
 if(isIe)  
 {  
 obj.filters.alpha.opacity+=1;  
 if(obj.filters.alpha.opacity<endInt)  
 {  
 setTimeout(function(){showBackground(obj,endInt)},5);  
 }  
 }else{  
 var al=parseFloat(obj.style.opacity);al+=0.01;  
 obj.style.opacity=al;  
 if(al<(endInt/100))  
 {setTimeout(function(){showBackground(obj,endInt)},5);}  
 }  
}  
function closeWindow()  
{  
     if(document.getElementById('back')!=null)  
     {  
        document.getElementById('back').parentNode.removeChild(document.getElementById('back'));  
     }  
     if(document.getElementById('mesWindow')!=null)  
     {  
        document.getElementById('mesWindow').parentNode.removeChild(document.getElementById('mesWindow'));  
     }  
  
     if(isIe)
     {  
        setSelectState('');     }  
}  
function openAlert(text, objPos)
{
    var objPosition;
    if(objPos==null)
    {
        objPosition = mousePosition();       }
    else
    {
        objPosition = objPos    }
    messContent="<div style='padding:5px 0 5px 0;text-align:left;text-indent:20px;font-size:12px;'>"+text+"</div>";
    showMessageBox('友情提示',messContent,objPosition,350);   
}
function showMessageBoxWhite(wTitle,content,pos,wWidth)  
{  
 var bWidth=parseInt(document.documentElement.scrollWidth);  
 var bHeight=parseInt(document.documentElement.scrollHeight);  

 if(isIe)
 {  
    setSelectState('hidden');
 }
 var back=document.createElement("div");  
 back.id="back";  
 var styleStr="z-index:299;top:0px;left:0px;position:absolute;background:#666;width:"+bWidth+"px;height:"+bHeight+"px;";  
 styleStr+=(isIe)?"filter:alpha(opacity=0);":"opacity:0;";  
 back.style.cssText=styleStr;  
 document.body.appendChild(back); 
 var mesW=document.createElement("div");  
 mesW.id="mesWindow";  
 mesW.className="mesWindow";  
 mesW.innerHTML="<div ><table width='100%' height='100%'><tr><td class='mesWindowTop'>"+wTitle+"</td></tr><tr><td><div class='mesWindowContent' id='mesWindowContent'>"+content+"</div></td></tr><tr><td style='text-align:center;'><input type='button' onclick='closeWindow();' title='关闭窗口' class='close' value='关闭' /></td></tr></table></div><div class='mesWindowBottom'>" + nowpeitip + "</div>";  
 var topOf=isIe?pos.y + getWindowYPosition():pos.y;
 if(pos.y + 100 > getWindowYPositionAll())
 {
    topOf = topOf - 300;
 }
 styleStr="left:"+(((pos.x-wWidth)>0)?(pos.x-wWidth):pos.x)+"px;top:"+(topOf)+"px;position:absolute;width:"+wWidth+"px;";  
 mesW.style.cssText=styleStr;  
 document.body.appendChild(mesW);  
}  
function openAlertWhite(text, objPos)
{
    if(objPos==null)
    {
        objPosition = mousePosition();       }
    else
    {
        objPosition = objPos    }
    messContent="<div style='padding:5px 0 5px 0;text-align:center;font-size:12px;'>"+text+"</div>";
    showMessageBoxWhite('友情提示',messContent,objPosition,350);   
}
var needChange=false;
function SetSrcForVcode()
{
    if(needChange)
    {
        document.getElementById('idCodeImage').src = document.getElementById('idCodeImage').src + '?';
        needChange = false;    }
    return true;
}
function SetSrcForLoginVcode()
{
    if(!needChange)
    {
        document.getElementById('homeLoginIDCodeImage').src = document.getElementById('homeLoginIDCodeImage').src + '?';
        needChange = true;    }
    return true;
}
function ShowTextBoxNum(ele, num)
{
    var maxnum = num -1;
    var numspanid = ele.id + "Num";
    var strlen = ele.value.length;
    if(strlen < num)
    {
        document.getElementById(numspanid).innerHTML = (num-strlen);    }
    else
    {
        document.getElementById(numspanid).innerHTML = 0;    ele.value = ele.value.substring(0,maxnum);
    }
}
function SetSelectByValue(id, value)
{
    var options = document.getElementById(id).options;
    for(var i = 0; i < options.length; i++) 
    {
        if (options[i].value == value)
        {
            options[i].selected = "selected";
        }
    }
}
function onFailedForCommon(result)
{
    alert(
        "操作发生严重问题！错误信息是：" + result.get_message() + 
        "\n堆栈追踪结果是：" + result.get_stackTrace() + 
        "\n状态码是：" + result.get_statusCode() +
        "\n异常类型是：" + result.get_exceptionType() + 
        "\n超时状态是：" + result.get_timedOut());
}
function toggleVisibility(id, status)
{
    if(status)
    {
        document.getElementById(id).style.display = "block";    }
    else
    {
        document.getElementById(id).style.display = "none";    }
}
function hideCommentReplyForm(form_id, status)
{
    if(!status)
    {
        var div_id = "div_" + form_id;       var reply_id = "reply_" + form_id;        
        document.getElementById(div_id).style.display = "none";        document.getElementById(reply_id).style.display = "block";
    }
}
var current_form_id;
function showCommentReplyForm(form_id, reply_parent_id, is_main_comment_form) 
{ 
    if(!is_main_comment_form)
    {        
        if(current_form_id!=null)
        {            
            var current_form_div="div_" + current_form_id;        toggleVisibility(current_form_div, false);
        }
        current_form_id=form_id
	}
    is_first_click_comment=true;
	printCommentReplyForm(form_id, reply_parent_id, is_main_comment_form);
}
var is_first_click_comment=true;var is_first_click_comment_main=true; var is_exchage_click_comment_main=false; //为true则说明当前就在主回复框中
var img_for_comment_vcode; 
function showVCodeForComment(ele)
{
    var vcode_img_id="vcode_img_" + ele;
    img_for_comment_vcode =
            '\
                <img src="http://www.nowpei.com/GHandler/VCodeImage.ashx?' + new Date().getTime() + '" width="60" height="20" />'; 
    if(ele=="main_comment")
    {
        if(is_first_click_comment_main)
        {               
            document.getElementById(vcode_img_id).innerHTML = img_for_comment_vcode;           
            is_first_click_comment_main=false;   is_exchage_click_comment_main=true;    return false;
        }
        if(is_exchage_click_comment_main)
        {
            return false;  }
        else if(!is_exchage_click_comment_main)
        {
            document.getElementById(vcode_img_id).innerHTML = img_for_comment_vcode;  
            is_exchage_click_comment_main=true;    return false;      
        }
    }
    else
    {
        if(is_first_click_comment)
        {
            document.getElementById(vcode_img_id).innerHTML = img_for_comment_vcode;             
            is_first_click_comment=false;
            is_exchage_click_comment_main=false;
            return false;
        } 
        if(is_exchage_click_comment_main)
        {
            document.getElementById(vcode_img_id).innerHTML = img_for_comment_vcode;
            is_exchage_click_comment_main=false;
            return false; 
        }
        else if(!is_exchage_click_comment_main)
        {
            return false;
        }   
    }
     return false;
}
function noKeyEnterPress(event)
{
	event = event? event:(window.event?window.event:null);  
  var kcode = event.keyCode?event.keyCode:event.which;
  if(kcode == 13)
  {
  		event.keyCode=9;
      return false;
  }
}
function printCommentReplyForm(form_id, reply_parent_id, is_main_comment_form) 
{
    var vcode_visible=' style="display: block"';
	if(CheckLogin()) 
	{	    
	    vcode_visible=' style="display: none"';
	}
    var vcode_span_id="vcode_span_" + form_id;    var vcode_id = "vcode_" + form_id;    var vcode_img_id = "vcode_img_" + form_id;	var div_id = "div_" + form_id;
	var reply_id = "reply_" + form_id;	var postcomment_id = "postcomment_" + form_id;	var cacelcomment_id = "cacelcomment_" + form_id;	var reply_comment_form = "comment_form" + form_id;
	if (is_main_comment_form)
	{
		discard_visible=' style="float:left; display: none"';
	}
	else
	{
		discard_visible=' style="float:left;"';
  }
	needInFaceImgID = reply_comment_form;  
	var innerHTMLContent = 
	'\
		<textarea name="' + reply_comment_form + '" id="' + reply_comment_form + '"\
		cols="46" rows="5" \
		></textarea>\
		<br/>\
		<div style="float:left;clear:left">\
		    <div' + ' id="' + vcode_span_id + '"' + vcode_visible  + '><span style="float:left;">验证码:</span>\
		    <input style="float:left;" type="text" size="4" name="' + vcode_id + '" maxlength="4"' + ' id="' + vcode_id + ' "\
		        onclick="showVCodeForComment(\'' + form_id + '\');" onkeypress="noKeyEnterPress(event);" />\
		    <span style="float:left;"' + 'id="' + vcode_img_id + '">点击对话框显示验证码</span></div>\
			<input class="clickButton" style="float:left;margin-left:5px;"  type="button"  name="add_comment_button"' + 'id="' + postcomment_id + '" \
							value="提交评论" \
							onclick="postThreadedComment(\'' + form_id + '\', \'' + reply_parent_id + '\', event);" />\
			<input class="clickButton leftMargin5" type="button" name="discard_comment_button"' + '" id="' + cacelcomment_id + '"\
							value="取消" ' + discard_visible + '\
							onclick="hideCommentReplyForm(\'' + form_id + '\',false);" />\
		</div>\
		<br style="clear:both"><br>';
	if(!is_main_comment_form) 
	{
		toggleVisibility(reply_id, false);
	}
	document.getElementById(div_id).innerHTML = innerHTMLContent;
	toggleVisibility(div_id, true);	
}
function formatSpaces(id)
{            
    var re = /([ ]{1,})/g;
    document.getElementById(id).value = document.getElementById(id).value.replace(re,"");
}
function aspnm_hideSelectElements(group)
{
  if(navigator.appVersion.indexOf("MSIE 6.0")==-1)
  {
     return;  }
  if (window.document.getElementsByTagName) 
  {
        var arrElements = window.document.getElementsByTagName('select'); 
        for (var i = 0; i < arrElements.length; i++)
        { 
            if (aspnm_objectsOverlapping(eval(group), arrElements[i]))
            {
                arrElements[i].style.visibility = 'hidden';             }
            else
            {
                arrElements[i].style.visibility = '';             }
        }
  }
}
function aspnm_objectsOverlapping(obj1, obj2)
{
      var result = true; 
      var obj1Left = aspnm_pageX(obj1) - window.document.body.scrollLeft; 
      var obj1Top = aspnm_pageY(obj1) - window.document.body.scrollTop; 
      var obj1Right = obj1Left + obj1.offsetWidth; 
      var obj1Bottom = obj1Top + obj1.offsetHeight;
      var obj2Left = aspnm_pageX(obj2) - window.document.body.scrollLeft; 
      var obj2Top = aspnm_pageY(obj2) - window.document.body.scrollTop+30; 
      var obj2Right = obj2Left + obj2.offsetWidth; 
      var obj2Bottom = obj2Top + obj2.offsetHeight;
      if (obj1Right <= obj2Left || obj1Bottom <= obj2Top || 
          obj1Left >= obj2Right || obj1Top+30 >= obj2Bottom) 
        result = false; 
      return result; 
}
function aspnm_pageX(element)
{
      var x = 0;
      do 
        x += element.offsetLeft;
      while ((element = element.offsetParent));
      return x; 
}
function aspnm_pageY(element)
{
      var y = 0;
      do 
        y += element.offsetTop; 
      while ((element = element.offsetParent));
      return y; 
}
function aspnm_restoreSelectElements()
{
      if(navigator.appVersion.indexOf("MSIE 6.0")==-1)
      {
         return;
      }
      if (document.getElementsByTagName) 
      {
        var arrElements = window.document.getElementsByTagName('select'); 
        for (var i = 0; i < arrElements.length; i++) 
        {
            arrElements[i].style.visibility = 'visible'; 
        }
      }
}
String.prototype.trim = function()
{
    var reExtraSpace = /^\s*(.*?)\s+$/;
    return this.replace(reExtraSpace,"$1");
}
function getSize() {
     var xScroll, yScroll;
     if (window.innerHeight && window.scrollMaxY) {
             xScroll = document.body.scrollWidth;
             yScroll = window.innerHeight + window.scrollMaxY;
     } else if (document.body.scrollHeight > document.body.offsetHeight){ 
             xScroll = document.body.scrollWidth;
             yScroll = document.body.scrollHeight;
     } else { 
             xScroll = document.body.offsetWidth;
             yScroll = document.body.offsetHeight;
     }
     var windowWidth, windowHeight;
     if (self.innerHeight) {   
             windowWidth = self.innerWidth;
             windowHeight = self.innerHeight;
     } else if (document.documentElement && document.documentElement.clientHeight) {      // Explorer 6 Strict Mode
             windowWidth = document.documentElement.clientWidth;
             windowHeight = document.documentElement.clientHeight;
     } else if (document.body) {  
             windowWidth = document.body.clientWidth;
             windowHeight = document.body.clientHeight;
     }
     if(yScroll < windowHeight){
             pageHeight = windowHeight;
             y = pageHeight;
     } else {
             pageHeight = yScroll;
             y = pageHeight;
     }
     if(xScroll < windowWidth){
             pageWidth = windowWidth;
     } else {
             pageWidth = xScroll;
     }
     arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
     return arrayPageSize;
}
function autoHeight(pid) {
     var x = new getSize();
     if(parent != null)
     {
        if(document.all)
        {
            parent.document.getElementById(pid).height=x[1] + 30;       }
        else
        {
            parent.document.getElementById(pid).height=x[1];        }
     }
}
function resizeIframeFromServer(height)
{
    var x = new getSize();    
    if(document.all)
    {
        if(height == null)
        {
            parent.document.getElementById("mainFrame").height=x[1] + 30;
        }
        else
        {
            parent.document.getElementById("mainFrame").height=x[1] + parseInt(height);
        }
    }
    else
    {
        parent.document.getElementById("mainFrame").height=x[1];
    }
}
function findBrowerType()
{
    if (window.XMLHttpRequest) 
    { 
        if(!window.ActiveXObject)
        { 
            return('noie');        } 
        else 
        {
            return('ie7');        }
    } 
    else 
    {
        return('ie6');    }
}
function getxy(e){	
	var a=new Array()	
	var t=e.offsetTop;
	var l=e.offsetLeft;
	var w=e.offsetWidth;
	var h=e.offsetHeight;
	while(e=e.offsetParent){
		t+=e.offsetTop;
		l+=e.offsetLeft;
	}
	a[0]=t;a[1]=l;a[2]=w;a[3]=h; return a;
}
function tagpop(obj,o)
{
	var a=getxy(o);
	var tagpopdiv=document.getElementById(obj);
	tagpopdiv.style.left=(a[1]+a[2])+"px";
	tagpopdiv.style.top=a[0]+"px";
	tagpopdiv.style.display='block';
}
function tagout(obj)
{
	var opele = document.getElementById(obj);
	if(opele == null){return false;}
	opele.style.display='none';
}
function getUserPortal(name)
{
    return nowpeiprefix + "/u/" + name;
}
var dhtmlwindow={
imagefiles:['http://www.nowpei.com/Images/SiteImages/min.gif', 'http://www.nowpei.com/Images/SiteImages/close.gif', 'http://www.nowpei.com/Images/SiteImages/restore.gif', 'http://www.nowpei.com/Images/SiteImages/resize.gif', 'http://www.nowpei.com/Images/SiteImages/npeye.gif'], //Path to 4 images used by script, in that order
ajaxbustcache: true, 
ajaxloadinghtml: '<b>正在加载页面，请稍候...</b><img src="http://www.nowpei.com/Images/SiteImages/Loading5.gif" />', //HTML to show while window fetches Ajax Content?

minimizeorder: 0,
zIndexvalue:100,
tobjects: [], 
lastactivet: {}, 

init:function(t){
	var domwindow=document.createElement("div") 
	domwindow.id=t
	domwindow.className="dhtmlwindow"
	var domwindowdata=''
	domwindowdata='<div class="drag-handle">'
	domwindowdata+='DHTML Window <div class="drag-leftcon"><img src="'+this.imagefiles[4]+'" title="乐配Eye" /></div><div class="drag-controls"><img src="'+this.imagefiles[0]+'" title="最小化" />&nbsp;<img src="'+this.imagefiles[1]+'" title="关闭" alt="关闭" /></div>'
	domwindowdata+='</div>'
	domwindowdata+='<div class="drag-contentarea"></div>'
	domwindowdata+='<div class="drag-statusarea"><div class="drag-resizearea" style="background: transparent url('+this.imagefiles[3]+') top right no-repeat;">&nbsp;</div></div>'
	domwindowdata+='</div>'
	domwindow.innerHTML=domwindowdata
	document.getElementById("dhtmlwindowholder").appendChild(domwindow)
	this.zIndexvalue=(this.zIndexvalue)? this.zIndexvalue+1 : 100 
	var t=document.getElementById(t)
	var divs=t.getElementsByTagName("div")
	for (var i=0; i<divs.length; i++){ 
		if (/drag-/.test(divs[i].className))
			t[divs[i].className.replace(/drag-/, "")]=divs[i] 
	}
	t.style.zIndex=this.zIndexvalue
	t.handle._parent=t 
	t.resizearea._parent=t 
	t.controls._parent=t 
	t.onclose=function(){if(t.id=="Foruploadhappybox") isUploadWindowOpen=false; else if(t.id=="ForUpdateForumPostReplybox") updateForumPostReplyOpened=false; return true} //custom event handler "onclose"
	t.onmousedown=function(){dhtmlwindow.setfocus(this); } 
	t.handle.onmousedown=dhtmlwindow.setupdrag
	t.resizearea.onmousedown=dhtmlwindow.setupdrag 
	t.controls.onclick=dhtmlwindow.enablecontrols
	t.show=function(){dhtmlwindow.show(this)} 
	t.hide=function(){dhtmlwindow.hide(this)} 
	t.close=function(){dhtmlwindow.close(this)} 
	t.setSize=function(w, h){dhtmlwindow.setSize(this, w, h)} 
	t.moveTo=function(x, y){dhtmlwindow.moveTo(this, x, y)}
	t.isResize=function(bol){dhtmlwindow.isResize(this, bol)} 
	t.isScrolling=function(bol){dhtmlwindow.isScrolling(this, bol)} 
	t.load=function(contenttype, contentsource, title){dhtmlwindow.load(this, contenttype, contentsource, title)}
	this.tobjects[this.tobjects.length]=t
	return t
},

open:function(t, contenttype, contentsource, title, attr, recalonload){
	var d=dhtmlwindow
	function getValue(Name){
		var config=new RegExp(Name+"=([^,]+)", "i") 
		return (config.test(attr))? parseInt(RegExp.$1) : 0 
	}
	if (document.getElementById(t)==null)
		t=this.init(t) 
	else
		t=document.getElementById(t)
	this.setfocus(t)
	t.setSize(getValue(("width")), (getValue("height"))) 
	var xpos=getValue("center")? "middle" : getValue("left") 
	var ypos=getValue("center")? "middle" : getValue("top") 
	if (typeof recalonload!="undefined" && recalonload=="recal" && this.scroll_top==0){ 
		if (window.attachEvent && !window.opera) 
			this.addEvent(window, function(){setTimeout(function(){t.moveTo(xpos, ypos)}, 400)}, "load")
		else
			this.addEvent(window, function(){t.moveTo(xpos, ypos)}, "load")
	}
	t.isResize(getValue("resize")) 
	t.isScrolling(getValue("scrolling")) 
	t.style.visibility="visible"
	t.style.display="block"
	t.contentarea.style.display="block"
	t.moveTo(xpos, ypos) 
	t.load(contenttype, contentsource, title)
	if (t.state=="minimized" && t.controls.firstChild.title=="还原"){ 
		t.controls.firstChild.setAttribute("src", dhtmlwindow.imagefiles[0]) 
		t.controls.firstChild.setAttribute("title", "最小化")
		t.state="fullview" 
	}
	aspnm_hideSelectElements(t);
	return t
},
setSize:function(t, w, h){ 
	t.style.width=Math.max(parseInt(w), 150)+"px"
	t.contentarea.style.height=Math.max(parseInt(h), 100)+"px"
},
moveTo:function(t, x, y){ 
	this.getviewpoint()	
    var topOf=isIe?this.scroll_top+parseInt(y):parseInt(y);
    var leftOf=this.scroll_left+parseInt(x)-parseInt(t.style.width) > 0 ? (this.scroll_left+parseInt(x)-parseInt(t.style.width)) + "px" : (this.scroll_left+parseInt(x))+"px"
	
	t.style.left=(x=="middle")? this.scroll_left+(this.docwidth-t.offsetWidth)/2+"px" : leftOf;
	t.style.top=(y=="middle")? this.scroll_top+(this.docheight-t.offsetHeight)/2+"px" : topOf+"px";
},
isResize:function(t, bol){ 
	t.statusarea.style.display=(bol)? "block" : "none"
	t.resizeBool=(bol)? 1 : 0
},
isScrolling:function(t, bol){ 
	t.contentarea.style.overflow=(bol)? "auto" : "hidden"
},
load:function(t, contenttype, contentsource, title){
	if (t.isClosed){
		alert("DHTML Window has been closed, so no window to load contents into. Open/Create the window again.")
		return
	}
	var contenttype=contenttype.toLowerCase() 
	if (typeof title!="undefined")
		t.handle.firstChild.nodeValue=title
	if (contenttype=="inline")
		t.contentarea.innerHTML=contentsource
	else if (contenttype=="div"){
		var inlinedivref=document.getElementById(contentsource)
		t.contentarea.innerHTML=(inlinedivref.defaultHTML || inlinedivref.innerHTML) //Populate window with contents of inline div on page
		if (!inlinedivref.defaultHTML)
			inlinedivref.defaultHTML=inlinedivref.innerHTML 
		inlinedivref.innerHTML="" 
		inlinedivref.style.display="none" 
	}
	else if (contenttype=="iframe"){
		t.contentarea.style.overflow="hidden" 
		if (!t.contentarea.firstChild || t.contentarea.firstChild.tagName!="IFRAME") //If iframe tag doesn't exist already, create it first
			t.contentarea.innerHTML='<iframe src="" frameborder="0" border="0" marginwidth="0" marginheight="0" allowtransparency="yes" style="margin:0; padding:0; width:100%; height: 100%" name="_iframe-'+t.id+'"></iframe>'
		window.frames["_iframe-"+t.id].location.replace(contentsource)
		}
	else if (contenttype=="ajax"){
		this.ajax_connect(contentsource, t) 
	}
	t.contentarea.datatype=contenttype 
},
setupdrag:function(e){
	var d=dhtmlwindow 
	var t=this._parent 
	d.etarget=this	
	var e=window.event || e
	d.initmousex=e.clientX 
	d.initmousey=e.clientY
	d.initx=parseInt(t.offsetLeft) 
	d.inity=parseInt(t.offsetTop)
	d.width=parseInt(t.offsetWidth) 
	d.contentheight=parseInt(t.contentarea.offsetHeight) 
	if (t.contentarea.datatype=="iframe"){ 
		t.style.backgroundColor="#F8F8F8"
		t.contentarea.style.visibility="hidden"
	}
	document.onmousemove=d.getdistance 
	document.onmouseup=function(){
		if (t.contentarea.datatype=="iframe"){ 
			t.contentarea.style.backgroundColor="white"
			t.contentarea.style.visibility="visible"
		}
		d.stop()
	}
	return false
},
getdistance:function(e){
	var d=dhtmlwindow
	var etarget=d.etarget
	var e=window.event || e
	d.distancex=e.clientX-d.initmousex 
	d.distancey=e.clientY-d.initmousey
	if (etarget.className=="drag-handle") 
		d.move(etarget._parent, e)
	else if (etarget.className=="drag-resizearea") 
		d.resize(etarget._parent, e)
	return false
},
getviewpoint:function(){
	var ie=document.all && !window.opera
	var domclientWidth=document.documentElement && parseInt(document.documentElement.clientWidth) || 100000 
	this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body 
	this.scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
	this.scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
	this.docwidth=(ie)? this.standardbody.clientWidth : (/Safari/i.test(navigator.userAgent))? window.innerWidth : Math.min(domclientWidth, window.innerWidth-16)
	this.docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
},
rememberattrs:function(t){ 
	this.getviewpoint() 
	t.lastx=parseInt((t.style.left || t.offsetLeft))-dhtmlwindow.scroll_left 
	t.lasty=parseInt((t.style.top || t.offsetTop))-dhtmlwindow.scroll_top
	t.lastwidth=parseInt(t.style.width) 
},
move:function(t, e){
	t.style.left=dhtmlwindow.distancex+dhtmlwindow.initx+"px"
	t.style.top=dhtmlwindow.distancey+dhtmlwindow.inity+"px"	
    aspnm_hideSelectElements(t);

},
resize:function(t, e){
	t.style.width=Math.max(dhtmlwindow.width+dhtmlwindow.distancex, 150)+"px"
	t.contentarea.style.height=Math.max(dhtmlwindow.contentheight+dhtmlwindow.distancey, 100)+"px"	
	aspnm_hideSelectElements(t);
},
enablecontrols:function(e){
	var d=dhtmlwindow
	var sourceobj=window.event? window.event.srcElement : e.target 
	if (/最小化/i.test(sourceobj.getAttribute("title"))) 
		d.minimize(sourceobj, this._parent)
	else if (/还原/i.test(sourceobj.getAttribute("title")))
		d.restore(sourceobj, this._parent)
	else if (/关闭/i.test(sourceobj.getAttribute("title"))) 
		d.close(this._parent)
	return false
},
minimize:function(button, t){
	dhtmlwindow.rememberattrs(t)
	button.setAttribute("src", dhtmlwindow.imagefiles[2])
	button.setAttribute("title", "还原")
	t.state="minimized" 
	t.contentarea.style.display="none"
	t.statusarea.style.display="none"
	if (typeof t.minimizeorder=="undefined"){ 
		dhtmlwindow.minimizeorder++ 
		t.minimizeorder=dhtmlwindow.minimizeorder
	}
	t.style.left="10px" 
	t.style.width="200px"
	var windowspacing=t.minimizeorder*10 
	t.style.top=(t.handle.offsetHeight*t.minimizeorder)+windowspacing+"px"	
	aspnm_hideSelectElements(t);
},
restore:function(button, t){
	dhtmlwindow.getviewpoint()
	button.setAttribute("src", dhtmlwindow.imagefiles[0])
	button.setAttribute("title", "最小化")
	t.state="fullview"
	t.style.display="block"
	t.contentarea.style.display="block"
	if (t.resizeBool) 
		t.statusarea.style.display="block"
	t.style.left=parseInt(t.lastx)+dhtmlwindow.scroll_left+"px"
	t.style.top=parseInt(t.lasty)+dhtmlwindow.scroll_top+"px"
	t.style.width=parseInt(t.lastwidth)+"px"	
	aspnm_hideSelectElements(t);
},
close:function(t){
	try{
		var closewinbol=t.onclose()		
		
	}
	catch(err){ 
		var closewinbol=true
 }
	finally{ 
		if (typeof closewinbol=="undefined"){
			alert("An error has occured somwhere inside your \"onclose\" event handler")
			var closewinbol=true
		}
	}
	if (closewinbol){ 
		if (t.state!="minimized") 
			dhtmlwindow.rememberattrs(t) 
		if (window.frames["_iframe-"+t.id]) 
			window.frames["_iframe-"+t.id].location.replace("about:blank")
		else
			t.contentarea.innerHTML=""
		t.style.display="none"
		t.isClosed=true 
	    aspnm_restoreSelectElements();
	}
	return closewinbol
},
setopacity:function(targetobject, value){
	if (!targetobject)
		return
	if (targetobject.filters && targetobject.filters[0]){ 
		if (typeof targetobject.filters[0].opacity=="number") 
			targetobject.filters[0].opacity=value*100
		else //IE 5.5
			targetobject.style.filter="alpha(opacity="+value*100+")"
		}
	else if (typeof targetobject.style.MozOpacity!="undefined") 
		targetobject.style.MozOpacity=value
	else if (typeof targetobject.style.opacity!="undefined") 
		targetobject.style.opacity=value
},
setfocus:function(t){
	this.zIndexvalue++
	t.style.zIndex=this.zIndexvalue
	t.isClosed=false 
	this.setopacity(this.lastactivet.handle, 0.5)
	this.setopacity(t.handle, 1) 
	this.lastactivet=t 
    aspnm_hideSelectElements(t);
},
show:function(t){
	if (t.isClosed){
		alert("DHTML Window has been closed, so nothing to show. Open/Create the window again.")
		return
	}
	if (t.lastx) 
		dhtmlwindow.restore(t.controls.firstChild, t) 
	else
		t.style.display="block"
	this.setfocus(t)
	t.state="fullview" 
},
hide:function(t){
	t.style.display="none"
},
ajax_connect:function(url, t){
	var page_request = false
	var bustcacheparameter=""
	if (window.XMLHttpRequest) 
		page_request = new XMLHttpRequest()
	else if (window.ActiveXObject){ 
		try {
		page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
			try{
			page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	}
	else
		return false
	t.contentarea.innerHTML=this.ajaxloadinghtml
	page_request.onreadystatechange=function(){dhtmlwindow.ajax_loadpage(page_request, t)}
	if (this.ajaxbustcache) 
		bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
	page_request.open('GET', url+bustcacheparameter, true)
	page_request.send(null)
},
ajax_loadpage:function(page_request, t){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
	t.contentarea.innerHTML=page_request.responseText
	}
},
stop:function(){
	dhtmlwindow.etarget=null 
	document.onmousemove=null
	document.onmouseup=null
},
addEvent:function(target, functionref, tasktype){ 
	var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false)
	else if (target.attachEvent)
		target.attachEvent(tasktype, functionref)
},
cleanup:function(){
	for (var i=0; i<dhtmlwindow.tobjects.length; i++){
		dhtmlwindow.tobjects[i].handle._parent=dhtmlwindow.tobjects[i].resizearea._parent=dhtmlwindow.tobjects[i].controls._parent=null
	}
	window.onload=null
}
}
document.write('<div id="dhtmlwindowholder"><span style="display:none">.</span></div>') 
window.onunload=dhtmlwindow.cleanup
var filesadded="" 
function checkloadjscssfile(filename, filetype)
{ 
	if (filesadded.indexOf("["+filename+"]")==-1)
	{
	  loadjscssfile(filename, filetype) 
	  filesadded+="["+filename+"]"
	} 
	else 
  	alert("file already added!")
} 
function loadjscssfile(filename, filetype)
{ 
	if (filetype=="js")
	{ 
  	    var fileref=document.createElement('script')
  	    fileref.setAttribute("type","text/javascript")
  	    fileref.setAttribute("src", filename)
	} 
	else if (filetype=="css")
	{ 
      var fileref=document.createElement("link") 
      fileref.setAttribute("rel", "stylesheet") 
      fileref.setAttribute("type", "text/css")  
      fileref.setAttribute("href", filename) 
	} 
    if (typeof fileref!="undefined") 
      document.getElementsByTagName("head")[0].appendChild(fileref) 
}
function CheckLogin()
{        
     if(document.cookie.length > 0)     
     { 
          var result = getCookie("NowPeiLoginStatus");
          if(result == "anonymous" || result == "")     
          {         
              return false;          }     
          else
          {
              return true;          }
     }     
     return false;
}
var faceImgHtml;
function insertFaceImg(ev, id)
{
	var objPos = mousePosition(ev);
    if(id != null)
    {
        needInFaceImgID = id;
    }
    faceImgHtml=dhtmlwindow.open("ForFaceImgHtmlBox", "iframe", "http://www.nowpei.com/FaceShow.aspx?id=" + needInFaceImgID, "请您选择表情", 'width=450px, height=160px, left=' + objPos.x + 'px,top=' + objPos.y + 'px,resize=0,scrolling=0')
    faceImgHtml.focus(); return false
}
function replConImgExe($1)
{
	var num = $1.replace("(et)", "").replace("(ed)", "").trim();	
	return "<img src='" + "http://www.nowpei.com/Fckeditor/editor/images/smiley/msn/"+num+".gif" + "' />";
}
function replaceConImg(content)
{	
	var newcontent=content.replace(/(\(et\)\s*\d+\s*\(ed\))/g,replConImgExe);
	return(newcontent);
}
function formatRecps()
{
    var str=document.getElementById("recipients").value;     
    var SPECIAL_STR="~!#$%^&*+|`=\'\"[{]};:<>/?“”‘，；。、·～！×（）——￥……『』【】：《》？";    
    for(i=0;i<str.length;i++)   
    {
        if (SPECIAL_STR.indexOf(str.charAt(i)) !=-1)
        {
            openAlert("请您按照要求输入邮箱地址和用户名！");
            document.getElementById("recipients").value = document.getElementById("recipients").value.substring(0,document.getElementById("recipients").value.length-1);
            return false;        }
    }
}
// 通知 ScriptManager，JavaScript 程序代码已经结束了。
if (typeof(Sys) !== "undefined")
    Sys.Application.notifyScriptLoaded();