if(typeof webjs=="undefined"){
    webjs={
    }
    ;
}
webjs.loader={
    _timer:{
    }
    ,isLoading:function(win){
        if(!win){
            win=window;
        }
        if(!win.document){
            return false;
        }
        if(Prototype.Browser.Gecko){
            return !!win.document.body;
        }
        else{
            return win.document.readyState=="complete";
        }
    }
    ,load:function(_1,_2,_3){
        try{
            if(!_3){
                _3=window;
            }
            else{
                _3=eval(_3);
            }
            if(!this.isLoading()){
                webjs.loader._timer[_1]=window.setTimeout(function(){
                    return webjs.loader.load(_1,_2,_3);
                }
                ,500);
                return 1;
            }
            if(webjs.loader._timer[_1]){
                window.clearTimeout(webjs.loader._timer[_1]);
                delete webjs.loader._timer[_1];
            }
            if(typeof _2=="function"){
               _2();
               return false;
            };
            return 0;
        }
        catch(e){
            return -6;
        }
    }
    ,unload:function(_b,_c){
        try{
            if(!_c){
                _c=window;
            }
            else{
                _c=eval(_c);
            }
            if(webjs.loader._timer[_b]){
                window.clearTimeout(webjs.loader._timer[_b]);
                delete webjs.loader._timer[_b];
            }
            var _d=_c.document.getElementById(_b);
            if(!_d){
                return -1;
            }
            _c.document.body.removeChild(_d);
            eval("try{ delete "+_b+"; }catch(e){}");
            return 0;
        }
        catch(e){
        }
        return -2;
    }
}
;

var Xml =
{
   toSCPXML : function(CommandXML, AppXML)
   {
      var xmlns = Xml.getXMLNS();
      var respxml = ''
      + '<scp ' + xmlns + '>\n'
      + '   <command><action>API:' + CommandXML + '</action></command>\n'
      + '   <security>' + AppXML + '\n'
      + '   </security>\n'
      + '</scp>';
      return respxml;
   }
   ,
   getXMLNS : function()
   {
      var xmlns = 'xmlns="urn:scp:params:xml:ns:scp-3.0"\n\n'
      + ' xmlns:domain="urn:5lin.com:domain"\n\n'
      + ' xmlns:contact="urn:5lin.com:contact"\n\n'
      + ' xmlns:registrant="urn:5lin.com:registrant"\n\n'
      + ' xmlns:host="urn:5lin.com:host"';
      return xmlns;
   }
   ,
   getCode : function(responseXML)
   {
      var code = '';
      start_pos = responseXML.indexOf('<result code=');
      if(start_pos > 0)
      {
         code = responseXML.substring(start_pos + 14, start_pos + 18);
      }
      return code;
   }
   ,
   getMessage : function(CutXml, svalue)
   {
      key = svalue
      str1 = '<' + svalue + '>';
      str2 = '</' + svalue + '>';
      start_pos = CutXml.toLowerCase().indexOf(str1.toLowerCase()) + str1.length;
      if( start_pos > 0 )
      {
         over_pos = CutXml.toLowerCase().indexOf(str2.toLowerCase());
         resValue = CutXml.substring(start_pos, over_pos);
      }
      return resValue;
   }
}
;

var command, appxml, users;
var Login =
{
   checkNavigator : function()
   {
      if(navigator['cookieEnabled'] == false)
      {
         alert('温馨提示：\n\n对不起，登陆操作需要先开启您浏览器的Cookies才能正常登陆！');
         return false;
      }
      return true;
   }
   ,
   getParameterDef : function(varName)
   {
      var query = location.search;
      if(query.indexOf('?') != - 1)
      {
         var query = query.substr(1);
         if(query != '')
         {
            var qArray = query.split('&');
            var len = qArray.length;
            if (len > 0)
            {
               for (var i = 0; i < len; i ++ )
               {
                  var sArray = qArray[i].split('=', 2);
                  if (sArray[0] && sArray[1] && sArray[0].toLowerCase() == varName)
                  {
                     return unescape(sArray[1].replace('#', ''));
                  }
               }
            }
         }
      }
      return null;
   }
   ,
   checkuserdomainlogin : function(f)
   {
      if(Login.checkNavigator())
      {
         users = f.strDomainUser.value.toLowerCase();
         var pwd = f.strDomainPwd.value;
         var l = f.strDomainUrl.value;
         Login.login_topchk('loginmsg');
         command = 'userlogin';
         appxml = '<username>' + users + '</username>'
         + '<userpsw>' + pwd + '</userpsw>'
         + '<note>false</note>'
         + '<url>' + l + '</url>';
         Login.Domain_Login();
         return false;
      }
      return true;
   }
   ,
   login_topchk : function(Message)
   {
      var o = _$(Message);
      var v = (o.innerHTML) ? o.innerHTML : o.textContent;
      o.old_value = v;
      o.innerHTML = '<ul><li>请梢等，正在验证信息...</li></ul>';
   }
   ,
   getUrlFileName : function()
   {
      var sURL = document.URL;
      var filename = '';
      if(typeof(top.main_board) != 'undefined')
      {
         sURL = top.main_board.document.URL;
      }
      if(sURL.lastIndexOf('?') != - 1)
      {
         filename = sURL.substring(sURL.lastIndexOf('/') + 1, sURL.lastIndexOf('?')).toLowerCase();
      }
      return filename;
   }
   ,
   Domain_Login : function()
   {
      var sendXML = Xml.toSCPXML(command, appxml);
      var strurl = '/XML/index.aspx';
      new Ajax.Request(strurl,
      {
         method : 'post',
         parameters : sendXML,
         onSuccess : function(sResult)
         {
            var responseXML = sResult.responseText;
            var msg = Xml.getMessage(responseXML, 'msg');
            var code = Xml.getCode(responseXML);
            var o = _$('loginmsg');
            if (code == 2000)
            {
               o.innerHTML = '<ul class="user-tools_dlh">'
               + '<li><span>' + users + '</span>欢迎回家 |</li>';
               if(users == Login.getParameterDef('username'))
               {
                  if(Login.getUrlFileName() == 'default.aspx' || Login.getUrlFileName() == '')
                  {
                     o.innerHTML += '<li><a href="/preview.aspx?username=' + users 
                     + '" target="_parent">预览我的地盘</a> | </li>';
                  }
                  else
                  {
                     o.innerHTML += '<li><a href="/default.aspx?username=' + users 
                     + '" target="_parent">管理我的地盘</a> | </li>';
                  }
               }
               else
               {
                  o.innerHTML += '<li><a href="/default.aspx?username=' + users 
                  + '" target="_parent">管理我的地盘</a> | </li>';
               }
               o.innerHTML += '<li class="user-tools_my"><a href="javascript:void(\'tools\')" '
               + 'onmouseover="Menu.showHideLayers(\'tool_bar_nav\', \'\', \'show\');" '
               + 'onmouseout="Menu.showHideLayers(\'tool_bar_nav\', \'\', \'hide\');">'
               + '我的菜单</a></li><li> | <a href="/public/logout.aspx">退出</a></li></ul>';
               window.location.reload();
            }
            else if (code == 5000)
            {
               alert(msg);
               o.innerHTML = o.old_value;
            }
            else
            {
               alert('There was a problem retrieving the XML data:\n' + req.statusText);
            }
            sResult = null;
         }
      }
      );
   }
   ,
   checkLoginState : function()
   {
      Login.login_topchk('loginmsg');
      command = 'checkUsersLoginState';
      appxml = '<loginstate>' + Ajax.getDatetime() + '</loginstate>';
      Login.checkLoginStateCreateXML();
      return false;
   }
   ,
   checkLoginStateCreateXML : function()
   {
      var sendXML = Xml.toSCPXML(command, appxml);
      var strurl = '/XML/index.aspx';
      new Ajax.Request(strurl,
      {
         method : 'post',
         parameters : sendXML,
         onSuccess : function(sResult)
         {
            var responseXML = sResult.responseText;
            var msg = Xml.getMessage(responseXML, 'msg');
            var code = Xml.getCode(responseXML);
            var element2 = _$('loginmsg');
            var loginHTML = '<ul class="user-tools_dlq">'
            + '<li>用户名：<input name="strDomainUser" type="text"  class="uesr-tools_input1" /></li>'
            + '<li>密码：<input name="strDomainPwd" type="password" class="uesr-tools_input1" /></li>'
            + '<li><input name="strDomainUrl" type="hidden" value="http://my.5lin.com" />'
            + '  <input type="submit" name="submit" value="确定" class="uesr-tools_input" /> '
            + '<input type="button" value="注册" onclick="window.location=\'http://reg.5lin.com\'" '
            + ' class="uesr-tools_input" /></li></ul>';
            if (code == 2000)
            {
               var userinfo = msg.split('|');
               if(userinfo != null && userinfo[0] == 'yes')
               {
                  element2.innerHTML = '<ul class="user-tools_dlh">'
                  + '<li><span>' + userinfo[1] + '</span>欢迎回家 | </li>';
                  if(userinfo[1] == Login.getParameterDef("username"))
                  {
                     if(Login.getUrlFileName() == 'default.aspx' || Login.getUrlFileName() == '')
                     {
                        element2.innerHTML += '<li><a href="/preview.aspx?username=' + userinfo[1] 
                        + '" target="_parent">预览我的地盘</a> | </li>';
                     }
                     else
                     {
                        element2.innerHTML += '<li><a href="/default.aspx?username=' + userinfo[1] 
                        + '" target="_parent">管理我的地盘</a> | </li>';
                     }
                  }
                  else
                  {
                     element2.innerHTML += '<li><a href="/default.aspx?username=' + userinfo[1] 
                     + '" target="_parent">管理我的地盘</a> | </li>';
                  }
                  element2.innerHTML += '<li class="user-tools_my"><a href="javascript:void(\'tools\')" '
                  + 'onmouseover="Menu.showHideLayers(\'tool_bar_nav\',\'\',\'show\');" '
                  + 'onmouseout="Menu.showHideLayers(\'tool_bar_nav\',\'\',\'hide\');\">我的菜单</a></li>'
                  + '<li> |<a href="/public/logout.aspx">退出</a></li></ul>';       
                  webjs.loader.load("initChatConfig",function(){setUserConfig(userinfo[1]);});
               }
               else
               {
                  element2.innerHTML = loginHTML;
               }
               sResult = null;
            }
            else if (code == 5000)
            {
               element2.innerHTML = loginHTML;
            }
            else
            {
               element2.innerHTML = loginHTML;
            }
         }
      }
      );
   }
}
;

/* func.js */
var innerhtmls = null;
var scrollHeight = null;
var focusControlPad = false;
var intervalControlPad = null;

var Common =
{
   toolTip :
   {
      sPop : null,
      popStyle : null,
      showPopupText : function(event)
      {
         try
         {
            if(event.srcElement) o = event.srcElement;
            else o = event.target;
            if( ! o)
            {
               return;
            }
            MouseX = event.clientX;
            MouseY = event.clientY;
            if(o.alt != null && o.alt != '')
            {
               o.pop = o.alt;
               o.alt = '';
            }
            if(o.title != null && o.title != '')
            {
               o.pop = o.title;
               o.title = '';
            }
            if(o.pop != Common.toolTip.sPop)
            {
               Common.toolTip.sPop = o.pop;
               if(Common.toolTip.sPop == null || Common.toolTip.sPop == '')
               {
                  _$('popLayers').style.visibility = "hidden";
               }
               else
               {
                  Common.toolTip.popStyle = o.dyclass != null ? o.dyclass : 'cPopText';
                  _$('popLayers').style.zIndex = 99;
                  _$('popLayers').style.visibility = "visible";
                  Common.toolTip.showIt();
               }
            }
         }
         catch(e)
         {
            // alert(e.description);
         }
      }
      ,
      showIt : function()
      {
         var _o = _$('popLayers');
         _o.className = Common.toolTip.popStyle;
         _o.innerHTML = Common.toolTip.sPop.replace(/<(.*)>/g, "&lt;$1&gt;").replace(/\n/g, "<br>");
         var popWidth = _o.clientWidth;
         var popHeight = _o.clientHeight;
         var popLeftAdjust = MouseX + 12 + popWidth > document.body.clientWidth ? - popWidth - 24 : 0;
         var popTopAdjust = MouseY + 12 + popHeight > document.body.clientHeight ? - popHeight - 24 : 0;
         _o.style.left = (MouseX + 12 + document.body.scrollLeft + popLeftAdjust) + 'px';
         _o.style.top = (MouseY + 12 + document.body.scrollTop + popTopAdjust) + Common.scrollPos() + 'px';
      }
      ,
      hideIt : function()
      {
         _$('popLayers').style.visibility = "hidden";
      }
   }
   ,
   scrollPos : function()
   {
      var scrollPos;
      if (typeof window.pageYOffset != 'undefined')
      {
         scrollPos = window.pageYOffset;
      }
      else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat')
      {
         scrollPos = document.documentElement.scrollTop;
      }
      else if (typeof document.body != 'undefined')
      {
         scrollPos = document.body.scrollTop;
      }
      return scrollPos;
   }
   ,
   AlphaShow : function()
   {
      if(ReUserName == "")
      {
         return false;
      }
      if(window.navigator.appVersion.substr(window.navigator.appVersion.indexOf('MSIE ') + 5, 3) >= 4)
      {
         clearInterval(intervalControlPad);
         var nOpacity = _$("tool-bar").filters.alpha.opacity;
         if (nOpacity >= 40 && nOpacity < 100)
         {
            _$("tool-bar").filters.alpha.opacity += 10;
            intervalControlPad = setInterval('Common.AlphaShow()', 50);
         }
         else
         {
            _$("tool-bar").filters.alpha.opacity = 100;
         }
         return true;
      }
      else
      {
         clearInterval(intervalControlPad);
         var nOpacity = _$("tool-bar").style.opacity;
         if (nOpacity >= 0.4 && nOpacity < 1)
         {
            _$("tool-bar").style.opacity -= - 0.1;
            intervalControlPad = setInterval('Common.AlphaShow()', 50);
         }
         else
         {
            _$("tool-bar").style.opacity = 1;
         }
         return true;
      }
   }
   ,
   AlphaHide : function()
   {
      if(ReUserName == "")
      {
         return false;
      }
      if(window.navigator.appVersion.substr(window.navigator.appVersion.indexOf('MSIE ') + 5, 3) >= 4)
      {
         clearInterval(intervalControlPad);
         if(focusControlPad)
         {
            _$("tool-bar").filters.alpha.opacity = 100;
            return true;
         }
         var nOpacity = _$("tool-bar").filters.alpha.opacity;
         if (nOpacity > 40 && nOpacity <= 100)
         {
            _$("tool-bar").filters.alpha.opacity -= 5;
            intervalControlPad = setInterval('Common.AlphaHide()', 50);
         }
         else
         {
            _$("tool-bar").filters.alpha.opacity = 40;
         }
         return true;
      }
      else
      {
         clearInterval(intervalControlPad);
         if(focusControlPad)
         {
            _$("tool-bar").filters.alpha.opacity = 100;
            return true;
         }
         var nOpacity = _$("tool-bar").style.opacity;
         if (nOpacity > 0.4 && nOpacity <= 1)
         {
            _$("tool-bar").style.opacity -= 0.03;
            intervalControlPad = setInterval('Common.AlphaHide()', 30);
         }
         else
         {
            _$("tool-bar").style.opacity = 0.4;
         }
         return true;
      }
   }
   ,
   showMenuDiv : function()
   {
      if(_$('tool_bar_nav').style.display == 'none')
      {
         _$('tool_bar_nav').style.display = 'block';
         if( ! document.onclick)
         {
            document.onclick = function()
            {
               Common.hideMenuDiv();
            }
            ;
         }
      }
   }
   ,
   hideMenuDiv : function()
   {
      _$('tool_bar_nav').style.display = 'none';
   }
   ,
   showSelect : function(obj)
   {
      if(_$(obj).style.visibility == 'hidden' || _$(obj).style.display == 'none')
      {
         _$(obj).style.visibility = 'visible';
         _$(obj).style.display = 'block';
         _$(obj + 's').style.display = 'none';
      }
   }
   ,
   copySelect : function(obj)
   {
      _$(obj.id + 's').innerHTML = "<h6><p>" + obj.options[obj.selectedIndex].text + "</p></h6>";
   }
   ,
   hideSelect : function(obj)
   {
      _$(obj).style.visibility = 'hidden';
      _$(obj).style.display = 'none';
      _$(obj + 's').style.display = 'block';
   }
}
;

if( ! document.onmouseover)
{
   document.onmouseover = function(e)
   {
      var event = e ? e : window.event;
      Common.toolTip.showPopupText(event);
   }
   ;
}
;

var moveobject =  null;
var moveresult =  false;
var moveX, moveY;
var Move =
{
   mousedown : function (obj)
   {
      moveobject = obj;
      moveX = moveobject.style.pixelLeft - event.clientX;
      moveY = moveobject.style.pixelTop - event.clientY;
      obj.onmousemove = Move.mousemove;
      obj.onmouseup = Move.mouseup;
   }
   ,
   mousemove : function ()
   {
      if(moveobject != null)
      {
         moveobject.style.left = moveX + event.clientX;
         moveobject.style.top = moveY + event.clientY;
         event.returnValue = false;
         moveresult = true;
      }
   }
   ,
   mouseup : function ()
   {
      if(moveobject != null)
      {
         if(moveobject.getAttribute("rel") != "no")
         {
            if(moveresult && ReUserName == UserName && Preview == "False")
            {
               saveMenuset(moveobject);
            }
         }
         moveresult = false;
         moveobject = null;
         event.returnValue = true;
      }
   }
}
;

var MenuObject = null;
var Menu =
{
   showMenu : function(obj)
   {
      document.oncontextmenu = function()
      {
         return false;
      }
      MenuObject = obj;
      var menus = _$("ie5menu");
      var cX = document.body.clientWidth - event.clientX;
      var cY = document.body.clientHeight - event.clientY;
      if (cX < menus.offsetWidth)
      {
         menus.style.left = document.body.scrollLeft + event.clientX - menus.offsetWidth + "px";
      }
      else
      {
         menus.style.left = document.body.scrollLeft + event.clientX + "px";
      }
      if (cY < menus.offsetHeight)
      {
         menus.style.top = document.body.scrollTop + event.clientY - menus.offsetHeight + "px";
      }
      else
      {
         menus.style.top = document.body.scrollTop + event.clientY + Common.scrollPos() + "px";
      }
      menus.style.zIndex = "100";
      menus.style.display = "block";
      if( ! document.onclick)
      {
         document.onclick = Menu.hideMenu;
      }
   }
   ,
   hideMenu : function()
   {
      _$("ie5menu").style.display = "none";
      if(MenuObject != null)
      {
         MenuObject = null;
      }
      document.oncontextmenu = function()
      {
         return true;
      }
   }
   ,
   saveMenu : function(indexS)
   {
      if(MenuObject != null)
      {
         switch(indexS)
         {
            case "top" :
               MenuObject.style.zIndex = 99;
               saveMenuset(MenuObject);
               break;
            case "previous" :
               MenuObject.style.zIndex = MenuObject.style.zIndex + 1;
               saveMenuset(MenuObject);
               break;
            case "next" :
               if(MenuObject.style.zIndex < 10)
               {
                  MenuObject.style.zIndex = 10;
               }
               else
               {
                  MenuObject.style.zIndex = MenuObject.style.zIndex - 1;
               }
               saveMenuset(MenuObject);
               break;
            case "bottom" :
               MenuObject.style.zIndex = 10;
               saveMenuset(MenuObject);
               break;
            case "delete" :
               flag = confirm("确定要删除此挂件吗？");
               if(flag)
               {
                  deleteMenuset(MenuObject.id);
               }
               break;
         }
      }
   }
   ,
   reloadPage : function (init)
   {
      if (init == true) with (navigator)
      {
         if ((appName == "Netscape") && (parseInt(appVersion) == 4))
         {
            document.pgW = innerWidth;
            document.pgH = innerHeight;
            onresize = Menu.reloadPage;
         }
      }
      else if (innerWidth != document.pgW || innerHeight != document.pgH)
      {
         location.reload();
      }
   }
   ,
   findObj : function (n, d)
   {
      var p, i, x;
      if( ! d)
      {
         d = document;
      }
      if((p = n.indexOf("?")) > 0 && parent.frames.length)
      {
         d = parent.frames[n.substring(p + 1)].document;
         n = n.substring(0, p);
      }
      if( ! (x = d[n]) && d.all)
      {
         x = d.all[n];
      }
      for (i = 0; ! x && i < d.forms.length; i ++ )
      {
         x = d.forms[i][n];
      }
      for(i = 0; ! x && d.layers && i < d.layers.length;
      i ++ )
      {
         x = Menu.findObj(n, d.layers[i].document);
      }
      if( ! x && d.getElementById)
      {
         x = d.getElementById(n);
      }
      return x;
   }
   ,
   showHideLayers : function ()
   {
      var i, p, v, obj, args = Menu.showHideLayers.arguments;
      for (i = 0; i < (args.length - 2); i += 3)
      {
         if ((obj = Menu.findObj(args[i])) != null)
         {
            v = args[i + 2];
            if (obj.style)
            {
               obj = obj.style;
               v = (v == 'show') ? 'visible' : (v == 'hide') ? 'hidden' : v;
            }
            obj.visibility = v;
         }
      }
   }
}
;

var isIE = /msie/i.test(navigator.userAgent);
var isDTD = /CSS1Compat/i.test(document.compatMode);
if( ! isIE)
{
   window.constructor.prototype.__defineGetter__("event", function()
   {
      var func = arguments.callee.caller;
      while(func != null)
      {
         var arg0 = func.arguments[0];
         if(arg0 && (arg0.constructor == Event || arg0.constructor == MouseEvent))
         {
            return arg0;
         }
         func = func.caller;
      }
      return null;
   }
   );
   Event.prototype.__defineSetter__("returnValue", function(b)
   {
      if( ! b)this.preventDefault();
      return b;
   }
   );
   HTMLDocument.prototype.attachEvent = function(sType, foo)
   {
      this.addEventListener(sType.slice(2), foo, false);
   }
   HTMLDocument.prototype.detachEvent = function(sType, foo)
   {
      this.removeEventListener(sType.slice(2), foo, false);
   }
}
;

var closes = false, Normal_Windows = false, minimizeds = false;
var drag =
{
   body : null, style : null, x : null, y : null,
   init : function(sId)
   {
      if(closes)
      {
         Tools.close();
         return;
      }
      if(minimizeds)
      {
         Tools.Minimized();
         return;
      }
      if(Normal_Windows)
      {
         Tools.Normal_Window();
         return;
      }
      if (event.button == 0 || event.button == 1)
      {
         dragobj = _$(sId);
         var AppendDiv = document.getElementsByTagName("body").item(0);
         var attributeDiv = document.createElement("div");
         attributeDiv.setAttribute("id", "drag_effect");
         attributeDiv.style.position = "absolute";
         attributeDiv.style.zIndex = dragobj.style.zIndex + 1;
         attributeDiv.onselectstart = function()
         {
            return false;
         }
         ;
         attributeDiv.style.display = "block";
         attributeDiv.style.top = dragobj.style.top;
         attributeDiv.style.left = dragobj.style.left;
         AppendDiv.appendChild(attributeDiv);
         obj = _$("drag_effect");
         var xHeight = parseInt(dragobj.offsetHeight);
         var xWidth = parseInt(dragobj.offsetWidth);
         obj.innerHTML = '<div style="border:2px dashed #FF0000; height:' + xHeight + '; width:'
         + xWidth + ';"></div>';
         dragobj.style.display = "none";
         body = isDTD ? document.documentElement : document.body;
         style = obj.style;
         x = event.clientX + body.scrollLeft - parseInt(style.left);
         y = event.clientY + body.scrollTop - parseInt(style.top);
         document.attachEvent("onmousemove", drag.start);
         document.attachEvent("onmouseup", drag.end);
         document.attachEvent("onselectstart", drag.select);
         isIE ? event.cacelBubble = true : event.stopPropagation();
         // style.filter = "alpha(opacity=80)";
         // style.opacity = "0.8";
         event.returnValue = false;
      }
      return false;
   }
   ,
   select : function ()
   {
      return false;
   }
   ,
   start : function ()
   {
      if (event.button == 0 || event.button == 1)
      {
         style.cursor = "move";
         style.left = (event.clientX + body.scrollLeft - x) + "px";
         style.top = (event.clientY + body.scrollTop - y) + "px";
      }
      else
      {
         drag.end();
      }
      isIE ? event.cacelBubble = true : event.stopPropagation();
   }
   ,
   end : function ()
   {
      style.cursor = "";
      // obj.style.filter = "alpha(opacity=100)";
      // obj.style.opacity = "1.0";
      dragobj.style.top = obj.style.top;
      dragobj.style.left = obj.style.left;
      obj.removeNode(true);
      dragobj.style.display = "block";
      document.detachEvent("onmouseup", drag.end);
      document.detachEvent("onmousemove", drag.start);
      document.detachEvent("onselectstart", drag.select);
      isIE ? event.cacelBubble = true : event.stopPropagation();
   }
}
;

var drags =
{
   body : null, style : null, x : null, y : null,
   init : function(sId)
   {
      obj = _$(sId);
      if (event.button == 0 || event.button == 1)
      {
         body = isDTD ? document.documentElement : document.body;
         style = obj.style;
         x = event.clientX + body.scrollLeft - parseInt(style.left);
         y = event.clientY + body.scrollTop - parseInt(style.top);
         document.attachEvent("onmousemove", drags.start);
         document.attachEvent("onmouseup", drags.end);
         document.attachEvent("onselectstart", drags.select);
         isIE ? event.cacelBubble = true : event.stopPropagation();
         event.returnValue = false;
      }
   }
   ,
   select : function ()
   {
      return false;
   }
   ,
   start : function ()
   {
      if (event.button == 0 || event.button == 1)
      {
         style.cursor = "move";
         style.left = (event.clientX + body.scrollLeft - x) + "px";
         style.top = (event.clientY + body.scrollTop - y) + "px";
      }
      else
      {
         drags.end();
      }
      isIE ? event.cacelBubble = true : event.stopPropagation();
   }
   ,
   end : function ()
   {
      style.cursor = "";
      document.detachEvent("onmouseup", drags.end);
      document.detachEvent("onmousemove", drags.start);
      document.detachEvent("onselectstart", drags.select);
      isIE ? event.cacelBubble = true : event.stopPropagation();
   }
}
;

function addmouse(sid, types)
{
   var bodyDiv = document.getElementsByTagName("body").item(0);
   var scursor = "";
   if(types != "no")
   {
      scursor = _$("mouse" + sid).getAttribute("rel");
      savemouse(scursor, 'no');
   }
   else
   {
      scursor = _$("mouse" + sid).getAttribute("rel").split(',')[3];
      shop.addshopping('mouse', sid, 'no');
   }
   bodyDiv.style.cursor = "url('" + scursor + "')";
}
;

function delmouse(sid, sstatus)
{
   var bodyDiv = document.getElementsByTagName("body").item(0);
   bodyDiv.style.cursor = "empty.cur";
   if(sstatus != "no")
   {
      loading("open");
      var strurl = "/inc/chk.aspx?username=" + UserName + "&act=mouse&v=" + escape("/empty.jpg")
      + "&time=" + Ajax.getDatetime()
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            window.status = sResult.responseText;
            loading("close");
         }
      }
      )
   }
}
;

function deletemouse(sid)
{
   var bodyDiv = document.getElementsByTagName("body").item(0);
   var sUrlImg = "url('" + _$("mouse" + sid).getAttribute("rel").toLowerCase() + "')";
   var sBgImg = bodyDiv.style.cursor.toLowerCase();
   sBgImg == sUrlImg ? bodyDiv.style.cursor = "empty.cur" : '';
   loading("open");
   var strurl = "/inc/chk.aspx?username=" + UserName + "&act=mouse&v=" + escape("/empty.jpg")
   + "&time=" + Ajax.getDatetime()
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         window.status = sResult.responseText;
         loading("close");
      }
   }
   )
}
;

function delmouses(sid, types)
{
   var flag = confirm("鼠标删除之后您将不能再使用，确认删除吗？");
   if(flag)
   {
      deletemouse(sid);
      delshops(sid, types);
   }
}
;

function savemouse(sUrl, sstatus)
{
   loading("open");
   $("shopmessage") ? $("shopmessage").innerHTML = "提示：正在保存鼠标，请稍等片刻。。。" : '';
   var strurl = "/inc/chk.aspx?username=" + UserName + "&act=mouse&v=" + escape(sUrl)
   + "&time=" + Ajax.getDatetime();
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         window.status = sResult.responseText;
         loading("close");
         if(sstatus != "no")
         {
            savecount ++ ;
            shop.savemessage();
         }
      }
   }
   )
}
;

function addflash(sid, types)
{
   if( ! _$("page_effect"))
   {
      var body = Tools.getBody();
      var s = getPageSize();
      var w = s[0] - 40;
      var AppendDiv = document.getElementsByTagName("body").item(0);
      var attributeDiv = document.createElement("div");
      attributeDiv.setAttribute("id", "page_effect");
      attributeDiv.style.position = "absolute";
      attributeDiv.onselectstart = function()
      {
         return false;
      }
      ;
      attributeDiv.style.display = "block";
      attributeDiv.style.width = w;
      attributeDiv.style.height = s[3];
      attributeDiv.style.top = 30;
      AppendDiv.appendChild(attributeDiv);
   }
   var sUrl = "";
   if(types != "no")
   {
      sUrl = _$("flash" + sid).getAttribute("rel");
      saveflash(sUrl, 'no');
   }
   else
   {
      sUrl = _$("flash" + sid).getAttribute("rel").split(',')[3];
      shop.addshopping('flash', sid, 'no');
   }
   var flashHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'
   + '"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'
   + '100%" height="100%">\n<param name="movie" value="' + sUrl + '">\n<param name="quality"'
   + ' value="high">\n<param name="menu" value="false"><param name="wmode" value="transparent">\n'
   + '<embed style="POSITION: absolute;display:block;" src="' + sUrl + '" quality="high"'
   + ' pluginspage="http://www.macromedia.com/go/getflashplayer" type="'
   + 'application/x-shockwave-flash" wmode="transparent" width="100%" height="100%">\n</embed>\n'
   + '</object>';
   _$("page_effect").innerHTML = flashHTML;
}
;

function saveflash(sUrl, sstatus)
{
   $("shopmessage") ? $("shopmessage").innerHTML = "提示：正在保存特效，请稍等片刻。。。" : '';
   loading("open");
   var body = Tools.getBody();
   var s = getPageSize();
   var w = s[0] - 40;
   var strurl = "/inc/chk.aspx?username=" + UserName + "&act=effect&v=" + escape(sUrl)
   + "&w=" + w + "&h=" + s + "&time=" + Ajax.getDatetime();
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         window.status = sResult.responseText;
         loading("close");
         if(sstatus != "no")
         {
            savecount ++ ;
            shop.savemessage();
         }
      }
   }
   )
}
;

function delflashs(sid, types)
{
   var flag = confirm("特效删除之后您将不能再使用，确认删除吗？");
   if(flag)
   {
      delflash(sid, 'yes');
      delshops(sid, types);
   }
}
;

function delflash(sid, sstatus)
{
   _$("page_effect") ? _$("page_effect").innerHTML = "" : '';
   if(sstatus != "no")
   {
      loading("open");
      var body = Tools.getBody();
      var s = getPageSize();
      var w = s[0] - 40;
      var strurl = "/inc/chk.aspx?username=" + UserName + "&act=effect&v=" + escape("/empty.jpg")
      + "&w=" + w + "&h=" + s + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            window.status = sResult.responseText;
            loading("close");
         }
      }
      )
   }
}
;

function addbackground(sid, types)
{
   var sUrl = "";
   if(types != "no")
   {
      sUrl = _$("background" + sid).getAttribute("rel");
      savebackground(sUrl, 'no');
   }
   else
   {
      sUrl = _$("background" + sid).getAttribute("rel").split(',')[3];
      shop.addshopping('background', sid, 'no');
   }
   var bodyDiv = document.getElementsByTagName("body").item(0);
   bodyDiv.style.backgroundImage = "url('" + sUrl.replace("/small","") + "')";
}
;

function savebackground(sUrl, sstatus)
{
   _$("shopmessage") ? _$("shopmessage").innerHTML = "提示：正在保存背景，请稍等片刻。。。" : '';
   loading("open");
   var strurl = "/inc/chk.aspx?username=" + UserName + "&act=domainback&v=" + escape(sUrl)
   + "&time=" + Ajax.getDatetime();
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         window.status = sResult.responseText;
         loading("close");
         if(sstatus != "no")
         {
            savecount ++ ;
            shop.savemessage();
         }
      }
   }
   )
}
;

function delbackgrounds(sid, types)
{
   var flag = confirm("背景删除之后您将不能再使用，确认删除吗？");
   if(flag)
   {
      deletebackground(sid);
      delshops(sid, types);
   }
}
;

function deletebackground(sid)
{
   var bodyDiv = document.getElementsByTagName("body").item(0);
   var sUrlImg = "url(" + _$("background" + sid).getAttribute("rel").toLowerCase() + ")";
   var sBgImg = bodyDiv.style.backgroundImage.toLowerCase();
   sBgImg == sUrlImg ? bodyDiv.style.backgroundImage = "url('empty.jpg')" : '';
   loading("open");
   var strurl = "/inc/chk.aspx?username=" + UserName + "&act=domainback&v=" + escape("/empty.jpg")
   + "&time=" + Ajax.getDatetime()
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         window.status = sResult.responseText;
         loading("close");
      }
   }
   )
}
;

function delbackground(sid, sstatus)
{
   var bodyDiv = document.getElementsByTagName("body").item(0);
   bodyDiv.style.backgroundImage = "url('empty.jpg')";
   if(sstatus != "no")
   {
      loading("open");
      var strurl = "/inc/chk.aspx?username=" + UserName + "&act=domainback&v=" + escape("/empty.jpg")
      + "&time=" + Ajax.getDatetime()
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            window.status = sResult.responseText;
            loading("close");
         }
      }
      )
   }
}
;

function addAdorn(sid, types)
{
   if( ! searchobject("div", sid))
   {
      _$("useradorn").style.display = "block";
      var strAdorn = '<div id="' + sid + '" class="guajian" rel="' + types
      + '" onmousedown="Move.mousedown(this);" oncontextmenu="Menu.showMenu(this);"'
      + ' style="cursor: move; position: absolute; z-index:10; top:100px; left:100px;">'
      + '<img src="/picture/domain/adorn/' + sid + '.gif" alt="按住鼠标左键可以托动挂件\n'
      + '单击鼠标右键可以删除挂件" /></div>';
      _$("useradorn").innerHTML += strAdorn;
      types != "yes" ? shop.addshopping('adorn', sid, 'no') : saveMenuset(_$(sid));
   }
   else
   {
      deleteMenuset(sid);
   }
}
;

function saveAddAdorn(sId, sTyle)
{
   _$("shopmessage") ? _$("shopmessage").innerHTML = "提示：正在保存挂件，请稍等片刻。。。" : '';
   loading("open");
   var strurl = "/inc/WriteAdorn.aspx?sNew=yes&sId=" + sId + "&sTyle=" + sTyle
   + "&time=" + Ajax.getDatetime()
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         if(sResult.responseText != "True")
         {
            alert(sResult.responseText);

         }
         savecount ++ ;
         shop.savemessage();
         loading("close");
      }
   }
   )
}
;

function saveMenuset(obj)
{
   if(obj.getAttribute("rel") != "no")
   {
      loading("open");
      var strurl = "/inc/WriteAdorn.aspx?sId=" + obj.id +
      "&sZindex=" + obj.style.zIndex +
      "&sX=" + obj.style.top.replace("px", "") +
      "&sY=" + obj.style.left.replace("px", "") +
      "&time=" + Ajax.getDatetime()
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText != "True")
            {
               alert(sResult.responseText);
            }
            loading("close");
         }
      }
      )
   }
}
;

function deleteMenuset(sid)
{
   if(_$(sid))
   {
      if(_$(sid).getAttribute("rel") != "no")
      {
         loading("open");
         var strurl = "/inc/WriteAdorn.aspx?sId=" + sid + "&sdel=yes&strTime=" + Ajax.getDatetime()
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               if(sResult.responseText != "True")
               {
                  alert(sResult.responseText);
               }
               loading("close");
            }
         }
         )
      }
      _$(sid).removeNode(true);
      if(_$("useradorn").innerHTML.length < 1)
      {
         _$("useradorn").style.display = "none";
      }
   }
   shop.delshopping('81', sid, 'no');
}
;

function delAdorn(sid, types)
{
   var flag = confirm("挂件删除之后您将不能再使用，确认删除吗？");
   if(flag)
   {
      if(_$(sid))
      {
         loading("open");
         var strurl = "/inc/WriteAdorn.aspx?sId=" + sid + "&sdel=yes&time=" + Ajax.getDatetime()
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               if(sResult.responseText != "True")
               {
                  alert(sResult.responseText);
               }
               loading("close");
            }
         }
         )
         _$(sid).removeNode(true);
         if(_$("useradorn").innerHTML.length < 1)
         {
            _$("useradorn").style.display = "none";
         }
      }
      delshops(sid, types);
   }
}
;

function searchobject(types, sid)
{
   var obj = document.getElementsByTagName(types);
   for(var i = 1; i < obj.length; i ++ )
   {
      if(obj[i].id == sid)
      {
         return true;
         break;
      }
   }
   return false;
}
;

function delshops(sid, types)
{
   loading("open");
   var strurl = "/inc/deleteshopping.aspx?sId=" + sid + "&ssort=" + types + "&Time=" + Ajax.getDatetime()
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         if(sResult.responseText != "True")
         {
            alert(sResult.responseText);
         }
         loading("close");
         Tools.getOption(9, 1);
      }
   }
   )
}
;

function shopAdd(oid, types)
{
   var temp = "";
   switch(types)
   {
      case "81" :
      addAdorn(oid, 'yes');
      break;
      case "68" :
      addmouse(oid, 'yes');
      break;
      case "61" :
      addflash(oid, 'yes');
      break;
      case "48" :
      addbackground(oid, 'yes');
      break;
   }
}
;

function shopDel(oid, types)
{
   switch(types)
   {
      case "81" :
      delAdorn(oid, types);
      break;
      case "68" :
      delmouses(oid, types);
      break;
      case "61" :
      delflashs(oid, types);
      break;
      case "48" :
      delbackgrounds(oid, types);
      break;
   }
}
;

var sid = "", sname = "", ssort = "", simage = "", simageurl = "", sprice = "", semploy = "", scount = 0, smoney = 0.00, savecount = 0, adornidlen = 0;
var backgroundid = "", mouseid = "", flashid = "", adornid = "" , shopday = "yes", sId = "", sTyle = "";

var shop =
{
   addshopping : function(types, oid, hides)
   {
      if( ! shop.getCountShop())
      {
         return false;
      }
      var sstatus = false;
      switch(types)
      {
         case "adorn" :
         if(sstatus == "no")
         {
            if(searchobject("div", oid))
            {
               sstatus = true;
            }
         }
         else
         {
            var ilen = shop.indexOfId(oid);
            if(ilen > - 1)
            {
               return false;
            }
            sstatus = true;
         }
         break;
         case "background" :
         if(backgroundid != "")
         {
            shop.delshopping('48', backgroundid, 'no');
         }
         backgroundid = oid;
         sstatus = true;
         break;
         case "mouse" :
         if(mouseid != "")
         {
            shop.delshopping('68', mouseid, 'no');
         }
         mouseid = oid;
         sstatus = true;
         break;
         case "flash" :
         if(flashid != "")
         {
            shop.delshopping('61', flashid, 'no');
         }
         flashid = oid;
         sstatus = true;
         break;
      }
      if(sstatus)
      {
         var temp = $(types + oid).getAttribute("rel").split(',');
         sid.length > 0 ? sid += "|" + temp[0] : sid = temp[0];
         sname.length > 0 ? sname += "|" + temp[1] : sname = temp[1];
         ssort.length > 0 ? ssort += "|" + temp[2] : ssort = temp[2];
         simageurl.length > 0 ? simageurl += "|" + temp[3].replace("Backdrop/small/", "Backdrop/").replace("adorn/", "adorn/small/").replace("mouse/jpg/", "mouse/") : simageurl = temp[3].replace("Backdrop/small/", "Backdrop/").replace("adorn/", "adorn/small/").replace("mouse/jpg/", "mouse/");
         simage.length > 0 ? simage += "|" + temp[3].replace("/mouse", "/mouse/jpg").replace(".ani", ".gif").replace(".cur", ".gif").replace("/flash", "/flash/jpg").replace(".swf", ".jpg") : simage = temp[3].replace("/mouse", "/mouse/jpg").replace(".ani", ".gif").replace(".cur", ".gif").replace("/flash", "/flash/jpg").replace(".swf", ".jpg");
         sprice.length > 0 ? sprice += "|" + temp[4] : sprice = temp[4];
         semploy.length > 0 ? semploy += "|" + temp[5] : semploy = temp[5];
         scount ++ ;
         smoney += parseFloat(temp[4]);
         sstatus = false;
         // alert(sid + "," + sname + "," + simage + "," + simageurl + "," + ssort + "," + sprice + "," + semploy);
      }
      hides == "yes" ? Tools.shopping() : '';
      $("ShopList") ? shop.viewshow() : '';
   }
   ,
   delallshop : function()
   {
      sid = "";
      sname = "";
      ssort = "";
      simageurl = "";
      simage = "";
      sprice = "";
      semploy = "";
   }
   ,
   delshopping : function(stype, vid, sstatus)
   {
      var ilen = shop.indexOfId(vid);
      if(ilen > - 1)
      {
         shop.rId(ilen);
         shop.rsname(ilen);
         shop.rsimageurl(ilen);
         shop.rsimage(ilen);
         shop.rssort(ilen);
         shop.rsprice(ilen);
         shop.rsemploy(ilen);
         scount -- ;
      }
      switch(stype)
      {
         case "81" :
         sstatus != "no" ? deleteMenuset(vid) : '';
         break;
         case "48" :
         sstatus != "no" ? delbackground(vid, 'no') : '';
         break;
         case "68" :
         sstatus != "no" ? delmouse(vid, 'no') : '';
         case "61" :
         sstatus != "no" ? delflash(vid, 'no') : '';
      }
      $("ShopList") ? shop.viewshow() : '';
      scount < 1 ? Tools.photoclose() : '';
   }
   ,
   indexOfId : function(para)
   {
      var temp = sid.split('|');
      for(var i = 0; i < temp.length ; i ++ )
      {
         if(temp[i] == para)
         {
            return i;
            break;
         }
      }
      return - 1;
   }
   ,
   rId : function(len)
   {
      var tempA = sid.split('|');
      var tempB = "";
      for(var i = 0; i < tempA.length ; i ++ )
      {
         if(i != len)
         {
            tempB.length > 0 ? tempB += "|" + tempA[i] : tempB = tempA[i];
         }
      }
      typeof(tempB) != "undefined" ? sid = tempB : sid = "";
   }
   ,
   rsname : function(len)
   {
      var tempA = sname.split('|');
      var tempB = "";
      for(var i = 0; i < tempA.length ; i ++ )
      {
         if(i != len)
         {
            tempB.length > 0 ? tempB += "|" + tempA[i] : tempB = tempA[i];
         }
      }
      typeof(tempB) != "undefined" ? sname = tempB : sname = "";
   }
   ,
   rsimageurl : function(len)
   {
      var tempA = simageurl.split('|');
      var tempB = "";
      for(var i = 0; i < tempA.length ; i ++ )
      {
         if(i != len)
         {
            tempB.length > 0 ? tempB += "|" + tempA[i] : tempB = tempA[i];
         }
      }
      typeof(tempB) != "undefined" ? simageurl = tempB : simageurl = "";
   }
   ,
   rsimage : function(len)
   {
      var tempA = simage.split('|');
      var tempB = "";
      for(var i = 0; i < tempA.length ; i ++ )
      {
         if(i != len)
         {
            tempB.length > 0 ? tempB += "|" + tempA[i] : tempB = tempA[i];
         }
      }
      typeof(tempB) != "undefined" ? simage = tempB : simage = "";
   }
   ,
   rssort : function(len)
   {
      var tempA = ssort.split('|');
      var tempB = "";
      for(var i = 0; i < tempA.length ; i ++ )
      {
         if(i != len)
         {
            tempB.length > 0 ? tempB += "|" + tempA[i] : tempB = tempA[i];
         }
      }
      typeof(tempB) != "undefined" ? ssort = tempB : ssort = "";
   }
   ,
   rsprice : function(len)
   {
      var tempA = sprice.split('|');
      var tempB = "";
      for(var i = 0; i < tempA.length ; i ++ )
      {
         if(i != len)
         {
            tempB.length > 0 ? tempB += "|" + tempA[i] : tempB = tempA[i];
         }
      }
      smoney -= parseFloat(tempA[len]);
      typeof(tempB) != "undefined" ? sprice = tempB : sprice = "";
   }
   ,
   rsemploy : function(len)
   {
      var tempA = semploy.split('|');
      var tempB = "";
      for(var i = 0; i < tempA.length ; i ++ )
      {
         if(i != len)
         {
            tempB.length > 0 ? tempB += "|" + tempA[i] : tempB = tempA[i];
         }
      }
      typeof(tempB) != "undefined" ? semploy = tempB : semploy = "";
   }
   ,
   viewshow : function()
   {
      var strHtml = '<table><tr><th class="gwc1">选购</th><th class="gwc2">名称</th>'
      + '<th class="gwc3">数量</th><th class="gwc4">类别</th><th class="gwc5">价格</th>'
      + '<th class="gwc6">使用期</th></tr>';
      if(sid.length > 0)
      {
         var tsid = sid.split('|');
         var tsname = sname.split('|');
         var tsimage = simage.split('|');
         var tssort = ssort.split('|');
         var tspricee = sprice.split('|');
         var tsemploy = semploy.split('|');
         for(var i = 0 ; i < tsid.length ; i ++ )
         {
            strHtml += '<tr><td><input name="ShopList"' + tsid[i] + '" type="checkbox" '
            + 'checked="checked" onclick="shop.delshopping(\'' + tssort[i] + '\',\'' + tsid[i]
            + '\', \'yes\'); " /></td><td><a href="javascript : ; " class="tooltips">'
            + shop.getSname(tsname[i]) + '<span><img src="' + tsimage[i] + '" alt="' + tsname[i]
            + '" /></span></a></td><td>1</td><td>' + shop.getSort(tssort[i]) + '</td><td>'
            + tspricee[i] + '金豆</td><td>' + tsemploy[i] + '天</td></tr>';
         }
         _$("ShopList").innerHTML = strHtml;
      }
      else
      {
         $("ShopList").innerHTML = strHtml;
         scount = 0,
         smoney = 0.00;
      }
      $("ShopList").innerHTML += "</table>";
      $("ScountA").innerText = scount;
      $("ScountB").innerText = scount;
      $("Smoney").innerText = smoney;
   }
   ,
   getSname : function(sname)
   {
      return sname.length > 6 ? sname.substring(0, 6) : sname;
   }
   ,
   getSort : function(ssort)
   {
      switch(ssort)
      {
         case "81" :
         return "挂件";
         break;
         case "48" :
         return "背景";
         break;
         case "68" :
         return "鼠标";
         break;
         case "61" :
         return "特效";
         break;
      }
   }
   ,
   getCountShop : function()
   {
      if (scount >= 10)
      {
         alert("单次购买物品不能超过10件，请分次购买。");
         return false
      }
      return true;
   }
   ,
   saveshopping : function()
   {
      if(ReUserName == "")
      {
         $("shopmessage") ? _$("shopmessage").innerHTML = "提示：您还没有登录，或登录已超时。" : alert("提示：您还没有登录，或登录已超时。");
         return false;
      }
      if(scount > 0)
      {
         var flag = confirm("您购买了" + scount + "件物品，确认现在支付金豆？\n单击“确定”之后，请不要刷新本页面。");
         if(flag)
         {
            $("savaloadingmsg").innerHTML = "正在保存您购买物品，请耐心等待片刻。。。";
            Tools.getSavaLoad();
            loading("open");
            var strurl = "/inc/SaveShopping.aspx?type=1&smoney=" + smoney + "&time=" + Ajax.getDatetime()
            new Ajax.Request(strurl,
            {
               method : 'get',
               onSuccess : function(sResult)
               {
                  if(sResult.responseText != "True")
                  {
                     shopday = "no";
                     alert(sResult.responseText);
                  }
                  loading("close");
                  shop.saveshoppingpost();
               }
            }
            )
         }
      }
      else
      {
         alert("您没有购买任何物品!");
      }
   }
   ,
   saveAdorn : function()
   {
      sId.length > 0 ? saveAddAdorn(sId, sTyle) : "";
   }
   ,
   savemessage : function()
   {
      if(savecount  >= scount)
      {
         $("savaloadingmsg") ? $("savaloadingmsg").innerHTML = "您的物品已成功购买，正在加载地盘。。。" : "";
         setTimeout("window.location.reload()", 100);
      }
   }
   ,
   saveshop : function()
   {
      var tsid = sid.split('|');
      var tssort = ssort.split('|');
      var tsimageurl = simageurl.split('|');
      for(var i = 0; i < tsid.length ; i ++ )
      {
         switch(tssort[i])
         {
            case "81" :
            adornid.length > 0 ? adornid += "," + tsid[i] : adornid = tsid[i];
            shop.newAdorn();
            break;
            case "48" :
            savebackground(tsimageurl[i].replace("/small", ""));
            break;
            case "68" :
            savemouse(tsimageurl[i], 'yes');
            break;
            case "61" :
            saveflash(tsimageurl[i], 'yes');
            break;
         }
      }
      shop.saveAdorn();
   }
   ,
   newAdorn : function()
   {
      var sZindex = 10, sX = 100, sY = 100;
      var sindex;
      var sadorn = adornid.split(',');
      for(sindex = 0 ; sindex < sadorn.length ; sindex ++ )
      {
         if($(sadorn[sindex]))
         {
            sZindex = $(sadorn[sindex]).style.zIndex;
            sX = $(sadorn[sindex]).style.top.replace("px", "");
            sY = $(sadorn[sindex]).style.left.replace("px", "");
         }
         else
         {
            sZindex = 10;
            sX = 100;
            sY = 100;
         }
         if(sindex > 0)
         {
            sId += "|" + sadorn[sindex];
            sTyle += "|" + sZindex + ":" + sX + ":" + sY;
         }
         else
         {
            sId = sadorn[sindex];
            sTyle = sZindex + ":" + sX + ":" + sY;
         }
         scount -- ;
      }
   }
   ,
   saveshoppingpost : function()
   {
      loading("open");
      $("shopmessage") ? $("shopmessage").innerHTML = "提示：正在购买物品，请稍等片刻。。。" : '';
      var strurl = "/inc/SaveShopping.aspx";
      var semployday = 0;
      if(shopday == "yes")
      {
         semployday = parseInt(semploy.split('|')[0]);
      }
      else
      {
         semployday = 1;
      }
      var strParam = "type=2&sid=" + sid + "&sname=" + sname + "&simage=" + simage + "&simageurl="
      + simageurl + "&ssort=" + ssort + "&sprice=" + sprice + "&semploy=" + semployday + "&time="
      + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'post',
         parameters : strParam,
         onSuccess : function(sResult)
         {
            if(sResult.responseText != "True")
            {
               alert(sResult.responseText);
            }
            shop.saveshop();
            loading("close");
         }
      }
      )
   }
}
;

var Tools =
{
   active : false,
   loadings : function(types)
   {
      _$("diy_toolsA").style.top = 100 + Common.scrollPos() + "px";
      _$("diy_toolsA").style.left = "220px";
      _$("diy_toolsA").style.width = "580px";
      _$("diy_toolsA").style.display = "block";
      _$("set_tools").style.display = "block";
      _$("showdiytools").style.display = "none";
      if(types == null || types == "")
      {
         Tools.getOption(0, 1);
      }
   }
   ,
   close : function()
   {
      _$("diy_toolsAtitle").className = "active";
      _$("diy_toolsA").style.display = "none";
      _$("diy_main_R").innerHTML = '<div class="diy_main_cd diy_main_bj"><img src="/themes/images/wait_ax.gif" alt="" /> 正在加载数据 ...</div>';
      _$("viptools").style.display = "none";
      _$("showdiytools").style.display = "block";
      Tools.ATabStrip(0, 13);
      closes = false;
      Tools.photoclose();
   }
   ,
   getOption : function(sid, sframe)
   {
      loading("open");
      var strFile = "", strCpid = "";
      switch(sid)
      {
         case 0 :
         strFile = "info.aspx";
         break;
         case 1 :
         strFile = "bujus.aspx";
         break;
         case 2 :
         strFile = "mobans.aspx";
         break;
         case 3 :
         strFile = "setModules.aspx";
         break;
         case 4 :
         strFile = "demoConfigs.aspx";
         break;
         case 5 :
         strFile = "texiaos.aspx";
         strCpid = "all";
         break;
         case 6 :
         strFile = "shubiaos.aspx";
         strCpid = "all";
         break;
         case 7 :
         strFile = "adorn.aspx";
         strCpid = "81";
         break;
         case 8 :
         strFile = "domainBackdrops.aspx";
         break;
         case 9 :
         strFile = "myres.aspx";
         strCpid = "all";
         break;
         case 10 :
         strFile = "overdueshop.aspx";
         strCpid = "all";
         break;
      }
      var strurl = "/attribute/" + strFile + "?username=" + UserName
      if(sframe > 0)
      {
         strurl += "&sid=" + sframe;
      }
      if(strCpid != "")
      {
         strurl += "&cpid=" + strCpid;
      }
      strurl += "&time=" + Ajax.getDatetime()
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            _$("diy_main_R").innerHTML = sResult.responseText;
            loading("close");
         }
      }
      )
   }
   ,
   shopping : function()
   {
      if(scount < 1)
      {
         alert("您的购物车没有物品!");
         return false;
      }
      loading("open");
      var TopV = _$("diy_toolsA").style.top.replace("px", "");
      var LeftK = _$("diy_toolsA").style.left.replace("px", "");
      var strurl = "/attribute/shopping.aspx?time=" + Ajax.getDatetime()
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            _$("photoselect").innerHTML = sResult.responseText;
            _$("photoselect").style.display = "block";
            _$("photoselect").style.top = parseInt(TopV) + 10 + "px";
            _$("photoselect").style.left = parseInt(LeftK) + 110 + "px";
            _$("diy_toolsAtitle").className = "normal";
            active = "Yes";
            loading("close");
            _$("ShopList") ? shop.viewshow() : '';
         }
      }
      )
   }
   ,
   getPhotoSelect : function(stype)
   {
      loading("open");
      var TopV = _$("diy_toolsA").style.top.replace("px", "");
      var LeftK = _$("diy_toolsA").style.left.replace("px", "");
      var strurl = "/attribute/photoselect.aspx?type=" + stype + "&time=" + Ajax.getDatetime()
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            _$("photoselect").innerHTML = sResult.responseText;
            _$("photoselect").style.display = "block";
            _$("photoselect").style.top = parseInt(TopV) + 10 + "px";
            _$("photoselect").style.left = parseInt(LeftK) + 110 + "px";
            _$("diy_toolsAtitle").className = "normal";
            active = "Yes";
            loading("close");
         }
      }
      )
   }
   ,
   getSavaLoad : function()
   {
      var body = Tools.getBody();
      _$("savaback").style.width = body.scrollWidth;
      _$("savaback").style.height = body.scrollHeight;
      _$("savaback").style.display = "block";
      var TopV = _$("diy_toolsA").style.top.replace("px", "");
      var LeftK = _$("diy_toolsA").style.left.replace("px", "");
      _$("savaloading").style.top = parseInt(TopV) + 100 + "px";
      _$("savaloading").style.left = parseInt(LeftK) + 160 + "px";
      _$("savaloading").style.display = "block";
   }
   ,
   closeSaLoad : function()
   {
      _$("savaback") ? _$("savaback").style.display = "none" : "";
      _$("savaloading") ? _$("savaloading").style.display = "none" : "";
   }
   ,
   photoclose : function()
   {
      _$("attribute_Sale") ? _$("attribute_Sale").style.display = "none" : '';
      _$("photoselect") ? _$("photoselect").style.display = "none" : '';
      try
      {
         active != "No" ? _$("diy_toolsAtitle").className = "active" : '';
      }
      catch(e)
      {
         // alert(e.description);
      }
   }
   ,
   Normal_Window : function()
   {
      _$("diy_toolsA").style.top = 100 + Common.scrollPos() + "px";
      _$("diy_toolsA").style.left = "220px";
      _$("diy_toolsA").style.width = "580px";
      _$("diy_toolsAtitle").className = "active";
      _$("set_tools").style.display = "block";
      active = "No";
   }
   ,
   Minimized : function()
   {
      var body = Tools.getBody();
      if (scrollHeight == null)
      {
         scrollHeight = body.scrollHeight;
      }
      _$("diy_toolsA").style.top = body.scrollTop + (body.offsetHeight - 35) + "px";
      _$("diy_toolsA").style.left = "3px";
      _$("diy_toolsA").style.width = "200px";
      _$("diy_toolsAtitle").className = "normal";
      _$("set_tools").style.display = "none";
      active = "No";
      minimizeds = false;
   }
   ,
   TabStrip : function(sid, numbers)
   {
      for(var i = 1; i <= numbers; i ++ )
      {
         if('TabStrip' + i == 'TabStrip' + sid)
         {
            _$("TabStrip" + sid).className = "active";
            _$("Frame" + sid).style.display = "block";
         }
         else
         {
            _$("TabStrip" + i).className = "normal";
            _$("Frame" + i).style.display = "none";
         }
      }
   }
   ,
   ATabStrip : function(sid, numbers)
   {
      if(sid == 0)
      {
         _$("diy_main_Ldiv").scrollTop = 120;
      }
      if(sid > 9)
      {
         _$("viptools").style.display = "block";
      }
      if(sid > 0)
      {
         for(var i = 1; i <= numbers; i ++ )
         {
            if('ATabStrip' + i == 'ATabStrip' + sid)
            {
               _$("ATabStrip" + sid).className = "active";
            }
            else
            {
               _$("ATabStrip" + i).className = "normal";
            }
         }
      }
      else
      {
         for(var i = 1; i <= numbers; i ++ )
         {
            _$("ATabStrip" + i).className = "normal";
         }
      }
   }
   ,
   getBody : function()
   {
      if (document.compatMode && document.compatMode != "BackCompat")
      {
         return document.documentElement;
      }
      else
      {
         return document.body;
      }
   }
}
;

var x = 0, y = 0, tmp = 0, _xL = 284, _xR = 384;
var estate = false, slideObj = null;
var slide =
{
   init : function()
   {
      estate = true;
      slideObj = _$("slideControl");
      if(slideObj != null)
      {
         slideObj.style.position = "absolute";
         tmp = parseInt(slideObj.style.left.replace("px", ""));
         x = window.event.clientX;
         slideObj.onmousemove = slide.startmove;
         slideObj.onmouseup = slide.endmove;
         return false;
      }
   }
   ,
   startmove : function()
   {
      if(slideObj != null)
      {
         if(estate)
         {
            coordinate = parseInt(tmp + event.clientX - x);
            if(coordinate < _xL)
            {
               slideObj.style.left = _xL;
            }
            else
            {
               try
               {
                  if(coordinate > _xR)
                  {
                     slideObj.style.left = _xR + "px";
                  }
                  else
                  {
                     slideObj.style.left = coordinate + "px";
                  }
               }
               catch(e)
               {
                  slide.endmove();
                  // alert(e.description);
               }
            }
         }
         slideObj.value = Math.round((parseInt(slideObj.style.left.replace("px", "")) - _xL) / 1);
         slideObj.value > 100 ? slideObj.value = 100 : '';
         _$("opacityV").value = slideObj.value;
         slideObj.alt = slideObj.value + "%";
         return false
      }
   }
   ,
   endmove : function()
   {
      slideObj = null;
      estate = false;
   }
   ,
   scroll : function()
   {
      if(_$("diy_main_cc").scrollTop > 0)
      {
         _$("slideControl").style.top = 66 - _$("diy_main_cc").scrollTop + "px";
         if(_$("diy_main_cc").scrollTop > 10)
         {
            _$("slideControl").style.display = "none";
         }
         else
         {
            _$("slideControl").style.display = "block";
         }
      }
      else
      {
         _$("slideControl").style.top = 66 + "px";
      }
   }
   ,
   show : function()
   {
      if(_$("diy_main_cc").scrollTop < 10)
      {
         _$("slideControl").style.display != "block" ? _$("slideControl").style.display = "block" : '';
      }
   }
}
;

var Locations = false;
var iLineWidth = 81;
var iScrollAmount = 3;
var pici = 0;
var pId = "";
var iPage = 1;

var photo =
{
   init : function(sid, stypes, statuss)
   {
      switch(stypes)
      {
         case -1 :
         Locations = true;
         case 3 :
         Locations = true;
         break;
         case 2 :
         Locations = true;
         break;
         case 1 :
         if(ReUserName == UserName || statuss == "yes")
         {
            Locations = true;
         }
         else
         {
            pId = sid;
            _$("albumpass").style.top = getScrollTop() + 200;
            _$("albumpass").style.display = "block";
         }
         break;
         case 0 :
         if(ReUserName == UserName)
         {
            Locations = true;
         }
         else
         {
            alert("私人相册，不对外公开！");
            Locations = false;
         }
         break;
      }
      Locations ? window.location.href = "photo.aspx?UserName=" + UserName + "&pid=" + sid : "";
   }
   ,
   chk : function()
   {
      var strurl = "/inc/chkalbumpwd.aspx?pid=" + pId + "&pwd=" + escape(_$("albumpwd").value)
      + "&time=" + Ajax.getDatetime()
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText != "True")
            {
               Locations = false;
               _$("albumpwd").value = "";
               _$("albumpwd").focus();
               alert(sResult.responseText);
            }
            else
            {
               window.location.href = "photo.aspx?UserName=" + UserName + "&pid=" + pId;
            }
         }
      }
      )
      return;
   }
   ,
   hides : function()
   {
      _$("albumpwd").value = "";
      _$("albumpass").style.display = "none";
   }
   ,
   runleft : function(e)
   {
      _$("mq").scrollLeft += iScrollAmount;
      if ( _$("mq").scrollLeft % iLineWidth == 0 )
      {
         if (pici != totalpici - 1)
         {
            pici = pici + 1;
         }
         if (pici == 0 || pici % 9 == 0 && totalpici - pici > 1)
         {
            iPage ++ ;
            photo.loadphoto(pId);
            _$("mq").scrollLeft = 81;
         }
      }
      else
      {
         window.setTimeout( "photo.runleft()", 5);
      }
   }
   ,
   fallback : function()
   {
      if (_$("mq").scrollLeft > 0)
      {
         _$("mq").scrollLeft -= 6 ;
         window.setTimeout( "photo.fallback()", 8);
      }
      else
      {
         pici = 0;
         iPage = 1;
         photo.loadphoto(pId);
      }
   }
   ,
   runright : function(e)
   {
      _$("mq").scrollLeft -= iScrollAmount;
      if ( _$("mq").scrollLeft % iLineWidth == 0 )
      {
         if (_$("mq").scrollLeft != 0 || pici != 0)
         {
            pici = pici - 1;
         }
         if(pici % 9 == 8)
         {
            offset = (Math.floor(pici / 9)) * 9;
            iPage -- ;
            photo.loadphoto(pId);
            _$("mq").scrollLeft = 729;
         }
      }
      else
      {
         window.setTimeout( "photo.runright()", 5);
      }
   }
   ,
   clicknow : function(webstr)
   {
      checknum = "a" + (_$("mq").scrollLeft / iLineWidth + 1);
      if (webstr == checknum)
      {
         photo.runright();
      }
      else
      {
         photo.runleft();
      }
   }
   ,
   loadimg : function(img)
   {
      if(img)
      {
         photoid = img.id;
         getXmlHttp('reviewlist', 'inc/PhotoReview.aspx?id=' + photoid + '&u=' + UserName);
         var image = img.getAttribute("value");
         _$("mqtitle").innerHTML = img.getAttribute("rel");
         var strHtml = '<a href="' + image + '" target="_blank"><img src="' + image
         + '" align="middle" alt="点击查看大图" ';
         if(pId != "0")
         {
            strHtml += ' style="display: none;" onload="photo.autoimg(this);" ';
         }
         strHtml += '/></a>';
         _$("mqimg").innerHTML = strHtml;
         pId != "0" ? _$("photoloading").style.display = "block" : "";
         photo.update();
      }
   }
   ,
   update : function()
   {
      var strurl = "/inc/PhotoBrower.aspx?u=" + UserName + "&i=" + photoid
      + "&time=" + Ajax.getDatetime()
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            return;
         }
      }
      )
   }
   ,
   loadphoto : function(sid)
   {
      pId = sid;
      var strurl = "/inc/LoadPhoto.aspx?u=" + UserName + "&pid=" + sid + "&page=" + iPage;
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            _$("mq").innerHTML = sResult.responseText;
         }
      }
      )
   }
   ,
   autoimg : function(img)
   {
      if( ! img)
      {
         return false;
      }
      var MaxWidth = 480;
      var MaxHeight = 640;
      img.style.display = "block";
      var HeightWidth = img.offsetHeight / img.offsetWidth;
      var WidthHeight = img.offsetWidth / img.offsetHeight;
      if(img.readyState != "complete")
      {
         return false;
      }
      if(img.offsetWidth > MaxWidth)
      {
         img.width = MaxWidth;
         img.height = MaxWidth * HeightWidth;
      }
      if(img.offsetHeight > MaxHeight)
      {
         img.height = MaxHeight;
         img.width = MaxHeight * WidthHeight;
      }
      pId != "0" ? _$("photoloading").style.display = "none" : "";
   }
   ,
   AutoImage : function(img)
   {
      if( ! img)
      {
         return false;
      }
      var MaxWidth = 150;
      var MaxHeight = 170;
      var HeightWidth = img.offsetHeight / img.offsetWidth;
      var WidthHeight = img.offsetWidth / img.offsetHeight;
      if(img.readyState != "complete")
      {
         return false;
      }
      if(img.offsetWidth > MaxWidth)
      {
         img.width = MaxWidth;
         img.height = MaxWidth * HeightWidth;
      }
      if(img.offsetHeight > MaxHeight)
      {
         img.height = MaxHeight;
         img.width = MaxHeight * WidthHeight;
      }
   }
   ,
   sendRe : function()
   {
      if($("reviewtext").value == "")
      {
         $("reviewtext").focus();
         alert("评论不能为空！");
         return false;
      }
      $("sbutton").disabled = true;
      var strurl = "/inc/PhotoReviewWrite.aspx?i=" + photoid + "&u=" + UserName + "&r=" + ReUserName
      + "&t=" + escape($("reviewtext").value) + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText != "True")
            {
               alert(sResult.responseText);
            }
            else
            {
               var strurl = 'inc/PhotoReview.aspx?id=' + photoid + '&u=' + UserName
               + '&time=' + Ajax.getDatetime()
               new Ajax.Request(strurl,
               {
                  method : 'get',
                  onSuccess : function(sResult)
                  {
                     $('reviewlist').innerHTML = sResult.responseText;
                  }
               }
               )
            }
            $("reviewtext").value = "";
            $("sbutton").disabled = false;
         }
      }
      )
   }
}
;

function DecryptStr(character, sId)
{
   var by = character.split(',');
   var rs = "";
   for(var i = 0; i < by.length; i ++ )
   {
      rs += String.fromCharCode(by[i]);
   }
   _$(sId).innerHTML = rs;
}
;

var iUtil =
{
   ViewInfo : function()
   {
      var flag = confirm("您不是VIP用户，查看私密联系方式需要支付50金豆\n\n如果愿意支付请点击"
      + "“确定”，否则请点击“取消”");
      if(flag)
      {
         var strurl = "/inc/ViewInfo.aspx?u=" + UserName + "&time=" + Ajax.getDatetime()
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               alert(sResult.responseText);
            }
         }
         )
      }
   }
   ,
   DelReview : function(sid, pid, spage, stype)
   {
      flag = confirm("删除该评论减少2个积分点，确定要继续操作吗？\n");
      if(flag)
      {
         var strurl = "/inc/DelReview.aspx?i=" + sid + "&c=" + stype
         + "&time=" + Ajax.getDatetime()
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               if(sResult.responseText != "True")
               {
                  alert(temps);
               }
               else
               {
                  switch(stype)
                  {
                     case 0 :
                     var strurl = 'inc/AllReview.aspx?id=' + pid + '&u=' + UserName + '&page=' + spage;
                     new Ajax.Request(strurl,
                     {
                        method : 'get',
                        onSuccess : function(sResult)
                        {
                           $('reviewlist').innerHTML = sResult.responseText;
                        }
                     }
                     )
                     break;
                     case 1 :
                     var strurl = 'inc/PhotoReview.aspx?id=' + pid + '&u=' + UserName + '&page=' + spage;
                     new Ajax.Request(strurl,
                     {
                        method : 'get',
                        onSuccess : function(sResult)
                        {
                           $('reviewlist').innerHTML = sResult.responseText;
                        }
                     }
                     )
                     break;
                  }
               }
            }
         }
         )
      }
   }
   ,
   showRoom : function(sid)
   {
      _$("roomMain").src = "inc/RoomShow.aspx?UserName=" + UserName + "&id=" + sid;
   }
}
;

Menu.reloadPage(true);

window.onselect = function()
{
   if(_$("set_tools").style.display == "block")
   {
      _$("diy_toolsA").style.display = "none";
   }
   else
   {
      _$("diy_toolsA").style.display = "none";
   }
   if(typeof(_$("photoselect")) != "undefined")
   {
      _$("photoselect").style.display = "none";
   }
}
;

try
{
   window.onscroll = function()
   {
      if(_$("diy_toolsA"))
      {
         var body = Tools.getBody();
         if (scrollHeight == null)
         {
            scrollHeight = body.scrollHeight;
         }
         _$("set_tools").style.display == "none" ? _$("diy_toolsA").style.top = body.scrollTop + (body.offsetHeight - 35) + "px" : '';
      }
   }
   ;

   window.onresize = function()
   {
      if(_$("showdiytools"))
      {
         if(document.body.scrollWidth < 453)
         {
            _$("showdiytools").style.display = "none";
         }
         else
         {
            _$("showdiytools").style.left = document.body.scrollWidth / 2 + 453;
            // _$("showdiytools").style.display = "block";
         }
      }
   }
   ;
}
catch(e)
{
   // alert(e.description);
}

var o = document.getElementsByTagName("img");
for(var i = 0; i < o.length; i ++ )
{
   o[i].onerror = function()
   {
      regImg(this, this.src);
   }
}
;

var Com =
{
   GetFlash : function ()
   {
      if(_$("page_effect") != null)
      {
         var azszplayer = new SWFObject(Effectsurl, "Flash_Player", "960", "700", "7", "");
         azszplayer.addParam("quality", "high");
         azszplayer.addParam("wmode", "transparent");
         azszplayer.addParam("scale", "noscale");
         azszplayer.write("page_effect");
      }
   }
}
;

/* Cookies.js */
var cookies =
{
   setCookie : function(name, value)
   {
      var Days = 30;
      var exp  = new Date();
      exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
      document.cookie = name + "=" + escape (value) + ";expires=" + exp.toGMTString();
   }
   ,
   getCookie : function(name)
   {
      var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
      if(arr = document.cookie.match(reg))
      {
         return unescape(arr[2]);
      }
      else
      {
         return null;
      }
   }
   ,
   delCookie : function(name)
   {
      var exp = new Date();
      exp.setTime(exp.getTime() - 1);
      var cval = this.getCookie(name);
      if(cval != null)
      {
         document.cookie = name + "=" + cval + ";expires = " + exp.toGMTString();
      }
   }
}
;

function loading(act, lod)
{
   if(act == 'open')
   {
      _$('Loading').style.display = "block";
      _$('Loading').style.top = (getScrollTop() + 30) + "px";
      _$('Loading').style.left = "15px";
      _$('Loading').innerHTML = _$('Loading').innerHTML;
   }
   if(act == 'close')
   {
      _$('Loading').style.display = "none";
   }
}
;

/* Drag.js */
var Version = 2.0;
var Util =
{
}
;
var DargNumber = 0;
var strPhotoAuto = 0;
var oTemps = "";

function OnIni()
{
   String.prototype.inc = function(s)
   {
      return this.indexOf(s) > - 1 ? true : false;
   }
   var agent = navigator.userAgent;
   window.isOpr = agent.inc("Opera");
   window.isIE = agent.inc("IE") && ! isOpr;
   window.isMoz = agent.inc("Mozilla") && ! isOpr && ! isIE;
   if(isMoz)
   {
      Event.prototype.__defineGetter__("x", function()
      {
         return this.clientX + 2;
      }
      );
      Event.prototype.__defineGetter__("y", function()
      {
         return this.clientY + 2;
      }
      );
   }
   BasicIni();
}
;

function BasicIni()
{
   window.$ = function(obj)
   {
      return typeof(obj) == "string" ? _$(obj) : obj;
   }
   window.oDel = function(obj)
   {
      if($(obj) != null)
      {
         $(obj).parentNode.removeChild($(obj));
         getMoveId();
      }
   }
}
;

function setDelete(obj)
{
   flag = confirm("您确定要删除这个模块吗？\n\n您可以在\"模块管理\"菜单中添加此模块。");
   if(flag)
   {
      if(_$(obj) != null)
      {
         loading("open");
         $(obj).parentNode.removeChild($(obj));
         getMoveId();
         DargNumber -- ;
         var strurl = "/inc/WriteDisplay.aspx?UserName=" + UserName + "&div=" + obj
         + "&display=no&time" + Ajax.getDatetime()
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               if(sResult.responseText != "True")
               {
                  alert(sResult.responseText);
               }
               loading("close");
            }
         }
         )
      }
      return true;
   }
   return false;
}
;

function setDeletes(obj)
{
   if($(obj) != null)
   {
      loading("open");
      $(obj).parentNode.removeChild($(obj));
      getMoveId();
      DargNumber -- ;
      var strurl = "/inc/WriteDisplay.aspx?UserName=" + UserName + "&div=" + obj
      + "&display=no&time" + Ajax.getDatetime()
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText != "True")
            {
               alert(sResult.responseText);
            }
            loading("close");
         }
      }
      )
   }
   return true;
}
;

function getDefalt()
{
   var flag = confirm("确定恢复默认设置吗？");
   if(flag)
   {
      $("savaloadingmsg").innerHTML = "正在恢复地盘默认设置，请耐心等待。。。";
      Tools.getSavaLoad();
      loading("open");
      var strurl = "/inc/chk.aspx?username=" + UserName
      + "&act=frame&v=/frame/k/131.css&f=3&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            loading("close");
         }
      }
      )
      loading("open");
      strurl = "/inc/WriteDefault.aspx?UserName=" + UserName + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText != "True")
            {
               alert(sResult.responseText);
            }
            loading("close");
            _$("savaloadingmsg") ? _$("savaloadingmsg").innerHTML = "恢复地盘默认设置成功，"
            + "正在加载地盘。。。" : "";
            setTimeout("window.location.reload()", 100);
         }
      }
      )
   }
}
;

function addevent(e)
{
   try
   {
      if(Util.o != null)
      {
         return false;
      }
      var temp = _$(this.parentNode.id + "_title");
      if(temp.style.cursor != 'move')
      {
         return false;
      }
      e = e || event;
      Util.o = this.parentNode;
      Util.xy = GetXY(Util.o);
      Util.xx = new Array((e.clientX  - Util.xy[1]), (e.clientY - Util.xy[0]));
      Util.o.style.width = Util.xy[2] + "px";
      Util.o.style.left = (e.clientX - Util.xx[0]) + "px";
      Util.o.style.top = (e.clientY - Util.xx[1]) + getScrollTop() + "px";
      Util.o.style.position = "absolute";
      var no = document.createElement("div");
      Util.otemp = no;
      no.style.height = Util.xy[3] + "px";
      no.style.border = "1px dashed #aaa";
      no.style.margin = "3px";
      Util.o.parentNode.insertBefore(no, Util.o);
      return false;
   }
   catch(e)
   {
      // alert(e.description);
   }
}
;

window.onfocus = function()
{
   document.onmouseup();
}
;

window.onblur = function()
{
   document.onmouseup();
}
;

document.onmouseup = function()
{
   if(Util.o != null)
   {
      Util.o.style.width = "99%";
      Util.otemp.parentNode.insertBefore(Util.o, Util.otemp);
      Util.o.style.position = "";
      if(Util.o.id == "panel_01")
      {
         setPhotoWidth();
      }
      if(Util.otemp.nextSibling == Util.otemp.origNextSibling || oTemps != Util.otemp.parentNode.id)
      {
         oDel(Util.otemp);
         Util =
         {
         }
         ;
         setSaveMove();
      }
      else
      {
         oDel(Util.otemp);
         Util =
         {
         }
         ;
      }
      document.onselectstart = function()
      {
         return true;
      }
   }
}
;

function setPhotoWidth()
{
   if($("MyFlash") ? true : false)
   {
      if(strPhotoAuto < 5)
      {
         var o = $("MyFlash");
         var c = getPhotoXY()[0] - 10;
         var r = 'http://my.5lin.com/UserZone/photo_player.swf?stageWidth=' + c
         + '&xmlHead=my.5lin.com/UserZone/photoxml.aspx&xmlEnd=' + UserName + '&autoStart=1';
         var azszplayer = new SWFObject(r, "Flash_Player", "95%", "400", "7", "");
         azszplayer.addParam("quality", "high");
         azszplayer.addParam("wmode", "transparent");
         azszplayer.addParam("scale", "noscale");
         azszplayer.write("MyFlash");
      }
   }
   else
   {
      strPhotoAuto ++ ;
      setTimeout("setPhotoWidth()", 1000);
   }
}
;

function getPhotoXY()
{
   var temp = new Array();
   var w = _$("panel_01").offsetWidth;
   var h = _$("panel_01").offsetHeight;
   temp[0] = w;
   temp[1] = h;
   return temp;
}
;

function getMoveId()
{
   setMoveId("dom0", "leftid");
   setMoveId("dom1", "centerid");
   setMoveId("dom2", "rightid");
}
;

function setMoveId(paraA, paraB)
{
   if($(paraA))
   {
      var eA = $(paraA).childNodes;
      var eB = $(paraB);
      eB.value = "";
      for(var i = 0; i < eA.length; i ++ )
      {
         var o = $(paraA).childNodes[i];
         if(isMoz)
         {
            eB.value += o.id + ",";
         }
         else
         {
            if(i > 0)
            {
               eB.value += "," + o.id;
            }
            else
            {
               eB.value = o.id;
            }
         }
         eB.value = eB.value.replace("undefined,", "");
      }
      if(isMoz)
      {
         eB.value = eB.value.substring(0, eB.value.length - 1);
      }
   }
}
;

function setSavaHideAndShow(paraA , paraB)
{
   loading("open");
   var strDisplay = "";
   var o = null;
   var tempv = null;
   var strDiv = "";
   for(i = paraA; i < paraB; i ++ )
   {
      if(i > 9)
      {
         tempv = "panel_" + i + "_display";
      }
      else
      {
         tempv = "panel_0" + i + "_display";
      }
      o = _$(tempv);
      if(i > paraA)
      {
         strDiv += "," + tempv.replace("_display", "");
      }
      else
      {
         strDiv = tempv.replace("_display", "");
      }
      if(i > paraA)
      {
         strDisplay += "," + o.value;
      }
      else
      {
         strDisplay = o.value;
      }
   }
   var strurl = "/inc/WriteHieOrShow.aspx?UserName=" + UserName + "&div=" + strDiv
   + "&display=" + strDisplay + "&time=" + Ajax.getDatetime()
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         if(sResult.responseText != "True")
         {
            alert(sResult.responseText);
         }
         loading("close");
      }
   }
   )
}
;

function setOneSave(paraA, paraB)
{
   loading("open");
   var strurl = "/inc/WriteHieOrShow.aspx?UserName=" + UserName + "&div=" + paraA + "&display="
   + paraB + "&time=" + Ajax.getDatetime()
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         if(sResult.responseText != "True")
         {
            alert(sResult.responseText);
         }
         loading("close");
      }
   }
   )
}
;

function setSaveMove()
{
   loading("open");
   var eA = _$("leftid").value;
   var eB = _$("centerid").value;
   var eC = _$("rightid").value;
   var strurl = "/inc/WriteZone.aspx?UserName=" + UserName + "&dom0=" + eA + "&dom1=" + eB + "&dom2=" + eC + "&time=" + Ajax.getDatetime()
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         if(sResult.responseText != "True")
         {
            alert(sResult.responseText);
         }
         loading("close");
      }
   }
   )
}
;

function setMouseCursor(paraA, paraB)
{
   var o = _$(paraA);
   if(o.style.cursor != paraB)
   {
      o.style.cursor = paraB;
   }
}
;

document.onmousemove = function(e)
{
   e = e || event;
   if(Util.o != null)
   {
      document.onselectstart = function()
      {
         return false;
      }
      oTemps = Util.o.parentNode.id;
      Util.o.style.width = Util.otemp.parentNode.offsetWidth + "px";
      Util.otemp.style.height = Util.o.offsetHeight + "px";
      Util.o.style.left = (e.clientX - Util.xx[0]) + "px";
      Util.o.style.top = (e.clientY - Util.xx[1]) + getScrollTop() + "px";
      if(Util.o.id == "panel_01")
      {
         setPhotoWidth();
      }
      CreateTemp(e);
   }
}
;

function GetReSize()
{
   var dom0 = _$("dom0");
   var dom1 = _$("dom1");
   var dom2 = _$("dom2");
   var maxtemp = 0;
   if(dom0.offsetHeight > dom1.offsetHeight && dom0.offsetHeight > dom2.offsetHeight)
   {
      maxtemp = dom0.offsetHeight;
   }
   else if(dom1.offsetHeight > dom2.offsetHeight)
   {
      maxtemp = dom1.offsetHeight;
   }
   else
   {
      maxtemp = dom2.offsetHeight;
   }
   dom0.style.height = maxtemp;
   dom1.style.height = maxtemp;
   dom2.style.height = maxtemp;
}
;

function GetXY(e)
{
   try
   {
       var temp = new Array();
       var top = e.offsetTop;
       var left = e.offsetLeft;
       var width = e.offsetWidth;
       var height = e.offsetHeight;
       while(e = e.offsetParent)
       {
          top += e.offsetTop;
          left += e.offsetLeft;
       }
       if(getScrollTop() > 0)
       {
          top = top - getScrollTop();
       }
       temp[0] = top;
       temp[1] = left;
       temp[2] = width;
       temp[3] = height;
       return temp;
   }
   catch(e)
   {
       // alert(e.description);
   }
}
;

function getScrollTop()
{
   var scrollPos;
   if (typeof window.pageYOffset != 'undefined')
   {
      scrollPos = window.pageYOffset;
   }
   else if (typeof document.compatMode != 'undefined' &&
   document.compatMode != 'BackCompat')
   {
      scrollPos = document.documentElement.scrollTop;
   }
   else if (typeof document.body != 'undefined')
   {
      scrollPos = document.body.scrollTop;
   }
   return scrollPos;
}
;

function inner(o, e)
{
   try
   {
       var temps = GetXY(o);
       if(e.clientX > temps[1] && e.clientX < (temps[1] + temps[2]) && e.clientY > temps[0] && e.clientY < (temps[0] + temps[3]))
       {
          if(e.clientY < (temps[0] + temps[3] / 2))
          {
             return 1;
          }
          else
          {
             return 2;
          }
       }
       else
       {
          return 0;
       }
   }
   catch(e)
   {
        // alert(e.description);
   }
}
;

function CreateTemp(e)
{
   var otemp = _$("leftid").value;
   if(otemp.length > 0)
   {
      otemp += "," + _$("centerid").value;
   }
   else
   {
      otemp += _$("centerid").value;
   }
   if(otemp.length > 0)
   {
      otemp += "," + _$("rightid").value;
   }
   else
   {
      otemp += _$("rightid").value;
   }
   otemp = otemp.replace(",,", ",");

   var oItem = new Array()
   for(var i = 0; i < DargNumber; i ++ )
   {
      oItem[i] = otemp.split(",", DargNumber)[i];
   }
   Util.otemp.origNextSibling = Util.otemp.nextSibling;
   Util.otemp.style.width = "auto";
   for(var i = 0; i < oItem.length; i ++ )
   {
      if($(oItem[i]) == Util.o)
      {
         continue;
      }
      var b = inner($(oItem[i]), e);
      if(b == 0)
      {
         continue;
      }
      Util.otemp.style.width = "auto";
      if(b == 1)
      {
         $(oItem[i]).parentNode.insertBefore(Util.otemp, $(oItem[i]));
      }
      else
      {
         try
         {
             if($(oItem[i]).nextSibling == null)
             {
                $(oItem[i]).parentNode.appendChild(Util.otemp);
             }
             else
             {
                $(oItem[i]).parentNode.insertBefore(Util.otemp, $(oItem[i]).nextSibling);
             }
         }
         catch(e)
         {
             // alert(e.description);
         }
      }
      return true;
   }
   if($("dom2").offsetWidth > 10)
   {
      if(Util.o.offsetLeft < $("dom1").offsetLeft)
      {
         if(Util.otemp.parentNode.id != "dom0")
         {
            $("dom0").appendChild(Util.otemp)
            Util.otemp.style.width = "98%"
         }
      }
      else if(Util.o.offsetLeft < $("dom2").offsetLeft && $("dom1").offsetWidth > 10)
      {
         if(Util.otemp.parentNode.id != "dom1")
         {
            $("dom1").appendChild(Util.otemp)
            Util.otemp.style.width = "98%"
         }
      }
      else
      {
         if(Util.otemp.parentNode.id != "dom2")
         {
            $("dom2").appendChild(Util.otemp)
            Util.otemp.style.width = "98%"
         }
      }
   }
   else
   {
      if(Util.o.offsetLeft < $("dom1").offsetLeft)
      {
         if(Util.otemp.parentNode.id != "dom0")
         {
            $("dom0").appendChild(Util.otemp)
            Util.otemp.style.width = "98%"
         }
      }
      else if(Util.o.offsetLeft > $("dom1").offsetLeft && $("dom1").offsetWidth > 10)
      {
         if(Util.otemp.parentNode.id != "dom1")
         {
            $("dom1").appendChild(Util.otemp)
            Util.otemp.style.width = "98%"
         }
      }
   }
   for(var j = 0; j < 3; j ++ )
   {
      if($("dom" + j).innerHTML.inc("div") || $("dom" + j).innerHTML.inc("DIV"))
      {
         continue;
      }
      var op = GetXY($("dom" + j));
      if(e.clientX > (op[1] + 10) && e.clientX < (op[1] + op[2] - 10))
      {
         $("dom" + j).appendChild(Util.otemp);
         Util.otemp.style.width = (op[2] - 10) + "px";
      }
   }
}
;

function setCopy(paraA, paraB)
{
   var gcenter = _$("centerid").value;
   var gright = _$("rightid").value;
   if(paraA > paraB)
   {
      var temp = paraA - paraB;
      if(temp > 1)
      {
         if(gcenter.length > 0)
         {
            var centerArray = gcenter.split(',');
            for(var i = 0; i < centerArray.length; i ++ )
            {
               var o = _$(centerArray[i]);
               $("dom0").appendChild(o);
            }
         }
         if(gright.length > 0)
         {
            var rightArray = gright.split(',');
            for(var j = 0; j < rightArray.length; j ++ )
            {
               var o = _$(rightArray[j]);
               $("dom0").appendChild(o);
            }
         }
      }
      else
      {
         if(paraA > 2)
         {
            if(gright.length > 0)
            {
               var rightArray = gright.split(',');
               for(var j = 0;  j < rightArray.length; j ++ )
               {
                  var o = _$(rightArray[j]);
                  $("dom0").appendChild(o);
               }
            }
         }
         else
         {
            if(gcenter.length > 0)
            {
               var centerArray = gcenter.split(',');
               for(var i = 0; i < centerArray.length; i ++ )
               {
                  var o = _$(centerArray[i]);
                  $("dom0").appendChild(o);
               }
            }
         }
      }
      getMoveId();
      setSaveMove();
   }
}
;

function setMinimize(e, paraB)
{
   var o = _$(paraB);
   if(o.style.display != "none")
   {
      o.style.display = "none";
      if(e.src)
      {
         e.src = "themes/images/170.gif";
         e.alt = "还原";
      }
   }
   else
   {
      o.style.display = "block";
      if(e.src)
      {
         e.src = "themes/images/132.gif";
         e.alt = "最小化";
      }
   }
}
;

function setMinimizes(e, paraB)
{
   var o = _$(paraB);
   if(o.style.display != "none")
   {
      o.style.display = "none";
      if(e.src)
      {
         e.src = "template/k/2/images/ico_down.gif";
         e.alt = "展开";
      }
   }
   else
   {
      o.style.display = "block";
      if(e.src)
      {
         e.src = "template/k/2/images/ico_up.gif";
         e.alt = "收缩";
      }
   }
}
;

function setTitle(paraA)
{
   var o = paraA ? _$(paraA) : this;
   o.onclick = "";
   o.old_value = o.innerText ? o.innerText : o.textContent;
   o.innerHTML = "<input id=\"" + o.id + "_input\" type=\"text\" class=\"panel_xian\" maxlength=\"8\" />";
   var e = _$(o.id + "_input");
   e.value = o.old_value;
   e.focus();
   e.select();
   e.onblur = function()
   {
      if(trim(escapeForXML(e.value)) == "" || e.value == o.old_value)
      {
         o.innerHTML = o.old_value;
      }
      else
      {
         o.innerHTML = escapeForXML(e.value);
         if( ! e.value.length > 8)
         {
            return false;
         }
         loading("open");
         var strurl = "/inc/WriteTitle.aspx?UserName=" + UserName + "&div=" + o.id + "&title=" + e.value + "&time=" + Ajax.getDatetime()
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               if(sResult.responseText != "True")
               {
                  alert(sResult.responseText);
               }
               loading("close");
            }
         }
         )
      }
      o.onclick = setTitle;
   }
}
;

function InsertDiv(paraA, paraB, paraC)
{
   var temp = document.createElement("div");
   var o = document.createElement("div");
   var strHTML =  '<h2 class="panel_title ' + paraA + '_title" id="' + paraA + '_title"'
   + ' style="cursor:move;"><span class="panel_name panel_' + paraA + '_name" id="' + paraA
   + '_name" onmousemove="setMouseCursor(\'' + paraA + '_title\', \'text\');" onmouseout="setMouseCursor'
   + '(\'' + paraA + '_title\', \'move\');" onclick="setTitle(this.id);" title="点击修改模块标题">'
   + paraB + '</span><span class="panel_img ' + paraA + '_img" id="panel_' + paraA + '_img" onmousemove='
   + '"setMouseCursor(\'' + paraA + '_title\', \'pointer\');" onmouseout="setMouseCursor(\'' + paraA
   + '_title\', \'move\'); "><img src="themes/images/113.gif" alt="自定义模块风格" onclick="'
   + 'Page.get(this, \'' + paraA + '\');" rel="attribute/moduleBase.aspx?username=' + UserName + '" />'
   + '<img src="themes/images/132.gif" alt="最小化" onclick="setMinimize(this, \'' + paraA
   + '_content\'); " /><img src="themes/images/294.gif" alt="关闭" onclick="setDelete(\'' + paraA
   + '\'); "/></span></h2><div class="panel_content ' + paraA + '_content" id="' + paraA + '_content">'
   + '<center><br />正在加载数据...<br /><br /></center></div><div class="clear"> </div>'
   + '<div class="panel_bottom ' + paraA + '_bottom" id="' + paraA + '_bottom"><h6></h6></div>';
   o.id = paraA;
   o.className = "panel " + paraA;
   o.innerHTML = strHTML;
   temp.appendChild(o);
   if(temp != "")
   {
      _$('dom0').innerHTML = temp.innerHTML + _$('dom0').innerHTML;
   }
   else
   {
      _$('dom0').appendChild(o);
   }
   var o = document.getElementsByTagName("h2");
   for(var i = 1; i < o.length; i ++ )
   {
      o[i].onmousedown = addevent;
   }
   getMoveId();
   setOneSave(paraA, 'yes');
   setSaveMove();
   DargNumber ++ ;
   setTimeout(function()
   {
      var strurl = "/UserZone/" + paraC + "?UserName=" + UserName + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            _$(paraA + "_content").innerHTML = sResult.responseText;
         }
      }
      )
   }
   , 1000);
   if(paraA == "panel_16")
   {
      _$("savaloadingmsg").innerHTML = "添加 Google 广告成功，正在加载地盘。。。";
      Tools.getSavaLoad();
      setTimeout("window.location.reload();", 1000);
   }
}
;

/* JScript.js */
var Utils = null;
var Ready = false;
var flag = false;

function getImage()
{
   var imgs = new Array();
   if (document.images)
   {
      imgs[0] = new Image();
      imgs[1] = new Image();
      imgs[2] = new Image();
      imgs[0].src = "/public/images/loading.gif";
      imgs[1].src = "/themes/images/me4_07.gif";
      imgs[2].src = "/themes/images/loading.gif";
   }
}
;

function setUserName(paraA)
{
   if(paraA.length < 1)
   {
      alert("提示：您还没有登录！");
      return false;
   }
   return true;
}
;

function getStrLen(paraA, paraB)
{
   if(paraA.length < 1 || paraA.length > paraB)
   {
      alert("提示：长度为1~" + paraB + "个字符！");
      return false;
   }
   return true;
}
;

function ImgSizeAuto(img)
{
   var _w = 650;
   if(img.width > _w)
   {
      try
      {
         var percent = Math.round(_w / img.width);
         img.resized = true;
         img.width = _w;
         img.height = img.height * percent;
         img.style.cursor = 'hand';
         img.alt = '点击查看大图';
         img.title = '点击查看大图';
      }
      catch(e)
      {
         // alert(e.description);
      }
   }
}
;

function ImgOpen(img)
{
   if( ! img.resized)
   {
      return true;
   }
   else
   {
      window.open(img.src);
   }
}
;

function getRadio(paraA, paraB)
{
   if(paraA.length > 0)
   {
      var temp = document.getElementsByName(paraA);
      for (i = 0; i < temp.length; i ++ )
      {
         if(temp[i].checked)
         {
            return temp[i].value;
         }
      }
      alert("提示：请您选择" + paraB + "！");
      return false;
   }
   else
   {
      return true;
   }
}
;

function getXmlHttp(paraA, paraB)
{
   var o = _$(paraA);
   var strurl = paraB + "&time=" + Ajax.getDatetime();
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         o.innerHTML = sResult.responseText;
      }
   }
   )
}
;

function getXmlHttps(paraA, paraB, pub)
{
   var o = _$(paraA);
   if(o)
   {
      var strurl = paraB + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            o.innerHTML = sResult.responseText;
         }
      }
      )
   }
}
;

function setXmlHttps(paraA, paraB, paraC, paraD, paraE, paraF)
{
   if( ! getRadio(paraC, paraE))
   {
      return false;
   }
   var strTemp = getRadio(paraC);
   var strWord = "";
   if(paraF.length > 0)
   {
      strWord =  _$(paraF).value;
      if( ! getStrLen(strWord, 20))
      {
         return false;
      }
   }
   if( ! setUserName(paraA))
   {
      return false;
   }
   if( ! Ready)
   {
      Ready = true;
      var strurl = paraB;
      if(strTemp.length > 0)
      {
         if(strWord.length > 0)
         {
            strurl += "&flower=" + strTemp;
         }
         else
         {
            strurl += "&petfood=" + strTemp;
         }
      }
      if(strWord.length > 0)
      {
         strurl += "&word=" + escape(strWord);
      }
      strurl += "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            Ready = false;
            var strYesNo = sResult.responseText;
            if(strYesNo != "True")
            {
               alert(strYesNo);
            }
            else
            {
               window.location.href = paraD;
            }
         }
      }
      )
   }
   else
   {
      alert("提示：正在处理数据。。。");
   }
}
;

function setXmlHttp(paraA, paraB, paraC, paraD)
{
   var strTemp = _$(paraA);
   if( ! Ready)
   {
      if( ! setUserName(ReUserName))
      {
         return false;
      }
      Ready = true;
      var strurl = paraB + escape(strTemp.value) + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            Ready = false;
            var strYesNo = sResult.responseText;
            if(strYesNo != "True")
            {
               alert(strYesNo);
            }
            else
            {
               getXmlHttp(paraC, paraD);
            }
            strTemp.value = "";
            var oe = _$("reviewtext");
            getCountNumber(oe);
         }
      }
      )
   }
   else
   {
      alert("提示：正在处理数据。。。");
   }
}
;

function getCountNumber(paraA)
{
   var temp = paraA.value;
   var strLen = 0;
   var strEn = 0;
   var strTemp = "";
   for(var i = 0; i < temp.length; i ++ )
   {
      if(temp.charCodeAt(i) > 128)
      {
         strLen ++ ;
      }
      else
      {
         strEn ++ ;
         if(strEn > 1)
         {
            strLen ++ ;
            strEn = 0;
         }
      }
      _$("CountNumber").value = strLen + "/150";
      strTemp += temp.charAt(i);
      if(strLen >= 150)
      {
         paraA.value = "";
         paraA.value = strTemp;
         return true;
      }
   }
   if(strLen < 1)
   {
      _$("CountNumber").value = strLen + "/150";
   }
}
;

function getScrollTop()
{
   var hPos = 0;
   if (typeof window.pageYOffset != 'undefined')
   {
      hPos = window.pageYOffset;
   }
   else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat')
   {
      hPos = document.documentElement.scrollTop;
   }
   else if (typeof document.body != 'undefined')
   {
      hPos = document.body.scrollTop;
   }
   return hPos;
}
;

function setMessage(paraA)
{
   var o = _$(paraA);
   if(o.style.display != "none")
   {
      o.style.display = "none";
   }
   else
   {
      o.style.display = "block";
      o.style.top = (window.screen.width - o.clientHeight) / 2 + getScrollTop() - 220 + "px";
      o.style.left = (document.body.clientWidth / 2 - o.clientWidth / 2) + 10 + "px";
   }
}
;

function setHideAndShow(paraA, paraB)
{
   try
   {
      var o = _$(paraA);
      var e = _$(paraB);
      if(o.style.display != "none")
      {
         o.style.display = "none";
      }
      else
      {
         o.style.display = "block";
      }
      if(e.style.display == "block")
      {
         e.style.display = "none"
      }
   }
   catch(ex)
   {
   }
}
;

function setDataList(paraA)
{
   var o = _$(paraA);
   if(o.style.display != "none")
   {
      o.style.display = "none";
   }
   else
   {
      o.style.display = "block";
   }
}
;

function setShop(paraA, paraB)
{
   if( ! setUserName(paraB))
   {
      return false;
   }
   var o = _$(paraA);
   if(o.value.length > 0)
   {
      window.open("http://bao.5lin.com/Eshop.aspx?cpbm=" + o.value, "", "height=400,width=500,left=250,top=150,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
   }
   else
   {
      alert("提示：用户套房没有家具！");
      return false;
   }
}
;

function setMays(paraA, paraB, paraC)
{
   if( ! setUserName(paraC))
   {
      return false;
   }
   var url = "http://bao.5lin.com/largess.aspx?username=" + paraA + "&cpbm=" + paraB;
   window.open(url, "", "height=400,width=500,left=250,top=150,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
;

function setHideCaller()
{
   _$("MyCaller").style.display = "none";
}
;

function setUserWord()
{
   var temp = _$("reviewtext") ? true : false;
   if( ! temp)
   {
      alert("提示：用户没有开启留言功能！");
   }
   else
   {
      _$("reviewtext").focus();
   }
}
;

function CopyData(paraA)
{
   var o = _$(paraA);
   o.select();
   window.clipboardData.setData('text', o.createTextRange().text);
   alert("提示：复制地址成功！");
}
;

function PasteData()
{
   return window.clipboardData.getData("text");
}
;

function setUserZone(paraA)
{
   var o = paraA ? _$(paraA) : this;
   o.onclick = "";
   o.old_value = o.innerText ? o.innerText : o.textContent;
   o.innerHTML = "<input id=\"" + o.id + "_input\" type=\"text\" class=\"panel_xian\" maxlength=\"20\" />";
   var e = _$(o.id + "_input");
   e.value = o.old_value;
   e.focus();
   e.select();
   e.onblur = function()
   {
      if(trim(escapeForXML(e.value)) == "" || e.value == o.old_value)
      {
         o.innerHTML = o.old_value;
      }
      else
      {
         o.innerHTML = escapeForXML(e.value);
         if( ! getStrLen(e.value, 20))
         {
            return false;
         }
         var strurl = "/inc/WriteUserZone.aspx?UserName=" + UserName + "&type=A&word="
         + e.value + "&time=" + Ajax.getDatetime();
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               if(sResult.responseText != "True")
               {
                  alert(sResult.responseText);
               }
            }
         }
         )
      }
      o.onclick = setUserZone;
   }
}
;

function setUnderwrite(paraA)
{
   var o = paraA ? _$(paraA) : this;
   o.onclick = "";
   o.old_value = o.innerText ? o.innerText : o.textContent;
   o.innerHTML = "<textarea id=\"" + o.id + "_textarea\" class=\"input3\" ></textarea>";
   var e = _$(o.id + "_textarea");
   e.value = o.old_value;
   e.focus();
   e.select();
   e.onblur = function()
   {
      if(trim(escapeForXML(e.value)) == "" || e.value == o.old_value)
      {
         o.innerHTML = o.old_value;
      }
      else
      {
         o.innerHTML = escapeForXML(e.value);
         if( ! getStrLen(o.innerHTML, 150))
         {
            return false;
         }
         var strurl = "/inc/WriteUserZone.aspx?UserName=" + UserName
         + "&type=B&word=" + o.innerHTML + "&time=" + Ajax.getDatetime();
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               if(sResult.responseText != "True")
               {
                  alert(sResult.responseText);
               }
            }
         }
         )
      }
      o.onclick = setUnderwrite;
   }
}
;

function setShowDiy(paraA)
{
   var result = showModelessDialog("/attribute/" + paraA, window, "dialogWidth=500px;dialogHeight=400px");
   if(result == "Yes")
   {
      window.location.reload();
   }
}
;

function check_img(theinput)
{
   var strValue = new String(theinput.value);
   strValue = strValue.toLowerCase();
   var intA = strValue.match(/http:\/\/([\w-]+\.)+[\w-]+(\/[\w-./\?%&=]*)?/);
   if (intA == null)
   {
      theinput.focus();
      theinput.select();
      return false;
   }
   else
   {
      if ( ! Check_FileType(strValue))
      {
         theinput.focus();
         theinput.select();
         return false;
      }
   }
   return true;
}
;

function Check_FileType(str)
{
   var pos = str.lastIndexOf(".");
   var lastname = str.substring(pos, str.length)
   if (lastname.toLowerCase() != ".jpg" && lastname.toLowerCase() != ".jpeg" && lastname.toLowerCase() != ".gif")
   {
      return false;
   }
   return true;
}
;

function setCopyLink(paraA)
{
   var o = _$(paraA);
   var Caption = _$("strCaption");
   var Url = _$("strUrl");
   var LinkID = _$("LinkID");
   LinkID.value = o.id;
   Caption.value = o.title;
   Url.value = o.href;
}
;

function setClearLick()
{
   var Caption = _$("strCaption");
   var Url = _$("strUrl");
   var LinkID = _$("LinkID");
   LinkID.value = "";
   Caption.value = "";
   Url.value = "";
}
;

function setPostLink()
{
   var Caption = _$("strCaption");
   var Url = _$("strUrl");
   var LinkID = _$("LinkID");
   if(Caption.value.length < 1)
   {
      alert("提示：链接标题不能为空！");
      Caption.focus();
      Caption.select();
      return false;
   }
   if(Url.value.length < 1)
   {
      alert("提示：链接网址不能为空！");
      Url.focus();
      Url.select();
      return false;
   }
   if( ! check_url(Url))
   {
      alert("提示：链接网址格式错误");
      Url.value = "http://";
      return false;
   }
   loading("open");
   var strurl = "/inc/WriteLink.aspx?id=" + LinkID.value + "&title=" +  Caption.value + "&strurl="
   + Url.value + "&time=" + Ajax.getDatetime();
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         if(sResult.responseText != "True")
         {
            alert(sResult.responseText);
         }
         loading("close");
         getXmlHttps('panel_10_content', '/UserZone/links.aspx?UserName=' + UserName);
      }
   }
   )
}
;

function setDelLink(paraA)
{
   flag = confirm("您确定要删除此链接吗？");
   if(flag)
   {
      loading("open");
      var strurl = "/inc/DelLink.aspx?id=" + paraA + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText != "True")
            {
               alert(sResult.responseText);
            }
            loading("close");
            getXmlHttps('panel_10_content', '/UserZone/links.aspx?UserName=' + UserName);
         }
      }
      )
   }
}
;

function check_url(theinput)
{
   var strValue = new String(theinput.value);
   strValue = strValue.toLowerCase();
   var intA = strValue.match(/http:\/\/([\w-]+\.)+[\w-]+(\/[\w-./\?%&=]*)?/);
   if (intA == null)
   {
      theinput.focus();
      theinput.select();
      return false;
   }
   return true;
}
;

function AddText(NewCode)
{
   var o = _$("reviewtext");
   o.focus();
   document.selection.createRange().text = "[" + NewCode.toLowerCase() + "]";
}
;

function Google_AdSense()
{
   try
   {
      $("Google_AdSense_View").innerHTML = $("Google_AdSense").innerHTML;
   }
   catch(e)
   {
      // alert(e.description);
   }
}
;

function Google_Hide()
{
   _$("Google_AdSense_Manifestos").style.display = "none";
   _$("Google_AdSense_Edit").style.display = "block";
}
;

function isdigit(s)
{
   var r, re;
   re = /\d*/i;
   r = s.match(re);
   return (r == s) ? true : false;
}
;

function doSubmit()
{
   var client = _$("client");
   if( isdigit(client.value) == false )
   {
      alert("用户代码是16位数字，请正确填写！");
      client.focus();
      client.select();
      return;
   }
   if( client.value.length != 16 )
   {
      alert("用户代码是16位数字，请正确填写！");
      client.focus();
      client.select();
      return;
   }
   var channel = _$("channel");
   if(isdigit(channel.value) == false )
   {
      alert("渠道代码是10位数字，请正确填写！");
      channel.focus();
      channel.select();
      return;
   }
   if(channel.value.length != 10 )
   {
      alert("渠道代码是10位数字，请正确填写！");
      channel.focus();
      channel.select();
      return;
   }
   var btn1 = _$("btn1");
   btn1.disabled = true;
   btn1.value = "正在保存修改。。。";
   loading("open");
   var strurl = "/inc/WriteGoogle.aspx?Client=" + client.value + "&Channel=" + channel.value
   + "&time=" + Ajax.getDatetime();
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         if(sResult.responseText != "True")
         {
            alert(sResult.responseText);
         }
         window.location.reload();
      }
   }
   )
}
;

function delLeaveWord(paraA, paraB)
{
   flag = confirm("您确定要删除此留言吗？");
   if(flag)
   {
      loading("open");
      var strurl = "/inc/DelLeaveWord.aspx?sid=" + paraA + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText != "True")
            {
               alert(sResult.responseText);
            }
            loading("close");
            getXmlHttps('panel_07_content', '/UserZone/leave_word.aspx?UserName=' + UserName
            + "&page=" + paraB);
         }
      }
      )
   }
}
;

/* Javascriptcode.js */
var strTime = 1500;
var time = null;

var lib =
{
   /* 检测最小字符 */
   check : function(str, sid)
   {
      switch(str)
      {
         case "htmlCode" :
         var temp = "HTML代码不能空。";
         break;
         case "htmlTitle" :
         var temp = "模块名称不能空。";
         break;
      }
      if(_$(str + sid).value.length < 1)
      {
         _$("ErrorMsg" + sid).innerText = temp;
         _$(str + sid).focus();
         _$(str + sid).select();
         this.clearerror(1, sid);
         return false;
      }
      return true;
   }
   ,
   /* 最大字符判断 */
   textLimit : function(e, maxlen, sid)
   {
      if(e.value.length > maxlen)
      {
         e.value = e.value.substring(0, maxlen);
         _$("ErrorMsg" + sid).innerText = "超过最大字数限制" + maxlen + "个。";
         this.clearerror(1, sid);
      }
   }
   ,
   /* 清除内容 */
   clear : function(sid)
   {
      this.clearerror(0, sid);
      _$("htmlCode" + sid).value = "";
   }
   ,
   /* 清除提示 */
   clearerror : function(type, sid)
   {
      switch(type)
      {
         case 0 :
         _$("ErrorMsg" + sid).innerText = "";
         break;
         case 1 :
         time = setTimeout("lib.clearerror(0," + sid + ");", strTime);
         break;
      }
   }
   ,
   /* 清除记时器 */
   cleartime : function()
   {
      clearTimeout(time);
   }
   ,
   /* 预览内容 */
   preview : function(sid)
   {
      this.cleartime();
      if( ! this.check("htmlTitle", sid))
      {
         return false;
      }
      var htmlTitle = _$("htmlTitle" + sid).value;
      _$("panel_" + sid + "_name").innerText = htmlTitle;
      var htmlCode = ck._stripData(_$("htmlCode" + sid).value);
      if(htmlCode.length > 0)
      {
         _$("htmlCodeView" + sid).innerHTML = htmlCode;
      }
      else
      {
         _$("htmlCodeView" + sid).innerHTML = "<center><br />提示：还没有DIY模块内容。<br /><br /></center>";
      }
      if(htmlCode != _$("htmlCode" + sid).value.toLowerCase())
      {
         _$("ErrorMsg" + sid).innerText = "存在危害的代码已过滤。";
         this.clearerror(1, sid);
      }
      _$("htmlCode" + sid).value = htmlCode;
   }
   ,
   /* 保存内容 */
   savepost : function(sid)
   {
      this.cleartime();
      if( ! this.check("htmlTitle", sid))
      {
         return false;
      }
      var htmlTitle = _$("htmlTitle" + sid).value;
      _$("panel_" + sid + "_name").innerText = htmlTitle;
      var htmlCode = ck._stripData(_$("htmlCode" + sid).value);
      if(htmlCode.length > 0)
      {
         _$("htmlCodeView" + sid).innerHTML = htmlCode;
      }
      else
      {
         _$("htmlCodeView" + sid).innerHTML = "<center><br />提示：还没有DIY模块内容。<br /><br /></center>";
      }
      if(htmlCode != _$("htmlCode" + sid).value.toLowerCase())
      {
         _$("ErrorMsg" + sid).innerText = "存在危害的代码已过滤。";
         this.clearerror(1, sid);
      }
      _$("htmlCode" + sid).value = htmlCode;
      _$("ErrorMsg" + sid).innerText = "正在保存安全代码。";
      this.clearerror(1, sid);
      return true;
   }
}
;

var ubb =
{
   /* 创建Real播放器 */
   real : function(sid)
   {
      tempA = prompt("在线 RealPlayer 流式音/视播放", "http://");
      if(tempA != null && tempA.length > 0)
      {
         tempB = prompt("在线 RealPlayer 流式音/视的高度", "200");
         if(tempB != null && tempB.length > 0)
         {
            var myArray = new Array();
            myArray[0] = tempA;
            myArray[1] = tempB;
            this.insertHtml(this.newHtml("real", myArray), sid);
         }
      }
   }
   ,
   /* 创建WM播放器 */
   wm : function(sid)
   {
      tempA = prompt("在线 Windows Media Player 音/视播放", "http://");
      if(tempA != null && tempA.length > 0)
      {
         tempB = prompt("Windows Media Player 音/视的高度", "200");
         if(tempB != null && tempB.length > 0)
         {
            var myArray = new Array();
            myArray[0] = tempA;
            myArray[1] = tempB;
            this.insertHtml(this.newHtml("wm", myArray), sid);
         }
      }
   }
   ,
   /* 创建Flash */
   flash : function(sid)
   {
      tempA = prompt("Flash 文件的地址", "http://");
      if(tempA != null && tempA.length > 0)
      {
         tempB = prompt("Flash 文件的高度", "200");
         if(tempB != null && tempB.length > 0)
         {
            var myArray = new Array();
            myArray[0] = tempA;
            myArray[1] = tempB;
            this.insertHtml(this.newHtml("flash", myArray), sid);
         }
      }
   }
   ,
   /* 创建图片 */
   image : function(sid)
   {
      tempA = prompt("图片文件的地址", "http://");
      if(tempA != null && tempA.length > 0)
      {
         tempB = prompt("图片文件的高度", "200");
         if(tempB != null && tempB.length > 0)
         {
            var myArray = new Array();
            myArray[0] = tempA;
            myArray[1] = tempB;
            this.insertHtml(this.newHtml("image", myArray), sid);
         }
      }
   }
   ,
   /* 创建飞翔字 */
   volitation : function(sid)
   {
      temp = prompt("要产生飞翔效果的文字", "文字");
      if(temp != null)
      {
         this.insertHtml(this.newHtml("volitation", temp), sid);
      }
   }
   ,
   /* 创建移动字 */
   move : function(sid)
   {
      temp = prompt("要产生移动效果的文字", "文字");
      if(temp != null)
      {
         this.insertHtml(this.newHtml("move", temp), sid);
      }
   }
   ,
   /* 创建光晕字 */
   light : function(sid)
   {
      tempA = prompt("文字的长度、颜色和边界", "100,red,2");
      if(tempA != null && tempA.length > 0)
      {
         tempB = prompt("要产生光晕效果的文字", "文字");
         if(tempB != null && tempB.length > 0)
         {
            var myArray = new Array();
            myArray[0] = tempA;
            myArray[1] = tempB;
            this.insertHtml(this.newHtml("light", myArray), sid);
         }
      }
   }
   ,
   /* 创建阴影字 */
   shadow : function(sid)
   {
      tempA = prompt("文字的长度、颜色和边界", "100,red,2");
      if(tempA != null && tempA.length > 0)
      {
         tempB = prompt("要产生阴影效果的文字", "文字");
         if(tempB != null && tempB.length > 0)
         {
            var myArray = new Array();
            myArray[0] = tempA;
            myArray[1] = tempB;
            this.insertHtml(this.newHtml("shadow", myArray), sid);
         }
      }
   }
   ,
   /* 生成HTML代码 */
   newHtml : function(str, paraA)
   {
      if(paraA.length > 0)
      {
         switch(str)
         {
            case "real" :
            temp = '<embed src="' + paraA[0] + '" type="audio/x-pn-realaudio-plugin" controls="ImageWindo'
            + 'w,ControlPanel,StatusBar" border="0" width="100%" height="' + paraA[1] + '" autostart="1"'
            + ' loop="1"></embed>';
            break;
            case "wm" :
            temp = '<embed src="' + paraA[0] + '" pluginspage="http://www.microsoft.com/isapi/redir.dll?'
            + 'prd=windows&amp;sbp=mediaplayer&amp;ar=media&amp;sba=plugin&amp;" type="application/x-'
            + 'mplayer2" border="0" height="' + paraA[1] + '" width="100%" showcontrols="1"'
            + ' showaudiocontrols="1" showstatusbar="1" autostart="1" loop="0" enablecontextmenu="1">'
            + '</embed>';
            break;
            case "flash" :
            temp = '<embed src="' + paraA[0] + '" pluginspage=" http://www.macromedia.com/go/getfl'
            + 'ashplayer" type="application/x-shockwave-flash" wmode="transparent" quality="high"'
            + ' height="' + paraA[1] + '" width="100%"></embed>';
            break;
            case "image" :
            temp = '<img src="' + paraA[0] + '" height="' + paraA[1] + '" width="100%">';
            break;
            case "volitation" :
            temp = '<marquee width="98%" behavior="alternate" scrollamount="3">' + paraA + '</marquee>';
            break;
            case "move" :
            temp = '<marquee width="98%" scrollamount="3">' + paraA + '</marquee>';
            break;
            case "light" :
            filt = paraA[0].split(',');
            temp = '<table width=' + filt[0] + ' style="filter:glow(color=' + filt[1] + ', strength='
            + filt[2] + ')"><tr><td>' + paraA[1] + '</td></tr></table>'
            break;
            case "shadow" :
            filt = paraA[0].split(',');
            temp = '<table width=' + filt[0] + ' style="filter:shadow(color=' + filt[1] + ', direction='
            + filt[2] + ')"><tr><td>' + paraA[1] + '</td></tr></table>'
            break;
         }
         return temp.replace('undefined', '');
      }
   }
   ,
   /* 插入代码 */
   insertHtml : function(str, sid)
   {
      if(str != null)
      {
         _$("htmlCode" + sid).focus();
         document.selection.createRange().text = str.toLowerCase();
      }
   }
}
;

var ck =
{
   /* 正则替换 */
   _stripData : function(content)
   {
      var str = content.toLowerCase();
      var regStr;
      var badContent = ["head", "script", "style", "object", "applet", "noscript", "frameset", "noframes"];
      var badTag = ["form", "meta", "body", "html", "label", "select", "optgroup", "option", "textarea", "title", "script", "xmp", "applet", "head", "frameset", "iframe", "noframes", "noscript", "object", "style", "input", "base", "basefont", "isindex", "link", "frame", "param", "xml", "xss", "st1:chsdate"];
      var badAction = ["onabort", "onblur", "onchange", "onclick", "ondblclick", "ondragdrop", "onerror", "onfocus", "onkeydown", "onkeypress", "onkeyup", "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onmove", "onreset", "onresize", "onselect", "onsubmit", "onunload", "allowScriptAccess", "disabled", "id", "name", "class"];
      var badCss = ["position", "javascript", "vbscript", "actionscript", "xmp", "activex"];
      if(str.length > 0)
      {
         /* 特殊关键字正则替换 */
         for(var i = 0; i < badContent.length; i ++ )
         {
            var regStr = "<\\s*" + badContent[i] + "[^>]*>[\\s\\S]*?<\\s*\\/" + badContent[i] + "[^>]*>";
            reg = new RegExp(regStr, "ig");
            while(reg.test(str))
            {
               str = str.replace(reg, "");
               delete reg;
               reg = new RegExp(regStr, "ig");
            }
            delete reg;
         }
         /* HTML标签正则替换 */
         for(var i = 0; i < badTag.length; i ++ )
         {
            var regStr = "<\\s*[/\\?]?\\s*" + badTag[i] + "[^>]*>";
            reg = new RegExp(regStr, "ig");
            while(reg.test(str))
            {
               str = str.replace(reg, "");
               delete reg;
               reg = new RegExp(regStr, "ig");
            }
            delete reg;
         }
         /* 事件正则替换 */
         for(var i = 0; i < badAction.length; i ++ )
         {
            var regStr = "(<[^<]*[\\s'\"])" + badAction[i] +"\\s*=\\s*['\"]?[^\\s'\">]*[\\s'\"]?([^>]*>)";
            reg = new RegExp(regStr, "ig");
            while(reg.test(str))
            {
               str = str.replace(reg, "$1$2");
               delete reg;
               reg = new RegExp(regStr, "ig");
            }
            delete reg;
         }
         /* CSS正则替换 */
         for(var i = 0; i < badCss.length; i ++ )
         {
            regStr = "(<[^<]*)" + badCss[i] + "\\s*:\\s*[^\\s;\">]*([^>]*>)";
            reg = new RegExp(regStr, "ig");
            while(reg.test(str))
            {
               str = str.replace(reg, "$1$2");
               delete reg;
               reg = new RegExp(regStr, "ig");
            }
            delete reg;
         }
      }
      return str;
   }
}
;

/* Toolbar.js */
var Class =
{
   create : function()
   {
      return function()
      {
         this.initialize.apply(this);
      }
      ;
   }
}
;

function hideSelectBoxes()
{
   selects = document.getElementsByTagName("select");
   for(i = 0; i != selects.length; i ++ )
   {
      selects[i].style.visibility = "hidden";
   }
}
;

String.prototype.parseColor = function()
{
   var _1d4 = "#";
   if(this.slice(0, 4) == "rgb(")
   {
      var cols = this.slice(4, this.length - 1).split(",");
      var i = 0;
      do
      {
         _1d4 += parseInt(cols[i]).toColorPart();
      }
      while( ++ i < 3);
   }
   else
   {
      if(this.slice(0, 1) == "#")
      {
         if(this.length == 4)
         {
            for(var i = 1; i < 4; i ++ )
            {
               _1d4 += (this.charAt(i) + this.charAt(i)).toLowerCase();
            }
         }
         if(this.length == 7)
         {
            _1d4 = this.toLowerCase();
         }
      }
   }
   return (_1d4.length == 7 ? _1d4 : (arguments[0] || this));
}
;

String.prototype.nl2br = function()
{
   return this.split('\n').join('<br \/>\n');
}
;

String.prototype.len = function()
{
   return this.replace(/[^\x00-\xff]/g, "aa").length;
}
;

Object.extend = function(ParaA, ParaB)
{
   for(var paras in ParaB)
   {
      ParaA[paras] = ParaB[paras];
   }
   return ParaA;
}
;

Object.extend(Number.prototype,
{
   toColorPart : function()
   {
      var _11 = this.toString(16);
      if(this < 16)
      {
         return "0" + _11;
      }
      return _11;
   }
   , succ : function()
   {
      return this + 1;
   }
   , times : function(_12)
   {
      $R(0, this, true).each(_12);
      return this;
   }
}
);

function setHelp(id)
{
   if(confirm("选择确定，不再需要编辑窗口。\n提示：我们通过刷新窗口将会重新出现。"))
   {
      _$(id).style.display = 'none';
   }

}
;

function getWidth()
{
   return  document.documentElement.clientWidth;
}
;

function SelectColor(what)
{
   var dEL = document.all("d_" + what);
   var sEL = document.all("s_" + what);
   var url = "/public/inc/selcolor.htm?color=" + encodeURIComponent(dEL.value);
   var arr = showModalDialog(url, window, "dialogWidth:280px;dialogHeight:250px;help:no;scroll:no;status:no");
   if (arr)
   {
      dEL.value = arr;
      sEL.style.backgroundColor = arr;
   }
}
;

function SelectTitleColor(what)
{
   var dEL = document.all("d_" + what);
   var sEL = document.all("s_" + what);
   var tEL = document.all("t_" + what);
   var url = "/public/inc/selcolor.htm?color=" + encodeURIComponent(dEL.value);
   var arr = showModalDialog(url, window, "dialogWidth:280px;dialogHeight:250px;help:no;scroll:no;status:no");
   if (arr)
   {
      if(dEL) dEL.value = arr;
      if(sEL) sEL.style.backgroundColor = arr;
      if(tEL) tEL.style.color = arr;
   }
}
;

function SelectPhotoUpLoad(what)
{
   var dEL = document.all("d_" + what);
   var sEL = document.all("s_" + what);
   var url = "/public/inc/img.htm";
   var arr = showModalDialog(url, window, "dialogWidth:340px;dialogHeight:180px;help:no;scroll:no;status:no");
   if (arr)
   {
      dEL.value = arr;
   }
}
;

function resizeImage(img, _3d6)
{
   if( ! _3d6)
   {
      _3d6 = 40;
   }
   var w = img.width;
   var h = img.height;
   if(w > _3d6 && w > h)
   {
      img.width = _3d6;
      img.height = Math.round(h * (_3d6 / w));
   }
   else if (h > _3d6)
   {
      img.width = Math.round(w * (_3d6 / h));
      img.height = _3d6;
   }
}
;

function preloadimages()
{
   var myimages = new Array()
   for (i = 0; i < preloadimages.arguments.length;
   i ++ )
   {
      myimages[i] = new Image()
      myimages[i].src = preloadimages.arguments[i];
   }
}
;

function GetHttpUrl(url)
{
   var sURL = document.URL;
   return sURL.substring(0, sURL.lastIndexOf("/")) + url;
}
;

function track_click(url, id)
{
   var src = url;
   src += "?time=" + new Date().valueOf();
   var img = new Image();
   img.width = 1;
   img.height = 1;
   img.src = src;
   img.onload = function()
   {
      track_void();
   }
   ;
   document.body.appendChild(img);
}
;

function track_void()
{
   return;
}
;

function regImg(e, src)
{
   if( ! window.imgHash) window.imgHash = new Object();
   if(src.indexOf("[%") > 0)return;
   src = src.replace(/\<\%.*\%\>/g, "");
   var a = imgHash[src];
   e.onerror = null;
   if(a == null)
   {
      e.style.display = "none";
      a = imgHash[src] = [];
      a[0] = new Image();
      a[1] = e;
      a[0].onload = function()
      {
         setImges(a)
      }
      ;
      a[0].src = src;
   }
   else
   {
      if(a[0].readyState == "complete")
      e.src = src;
      else
      {
         e.style.display = "none";
         a[a.length] = e;
      }
   }
}
;

function setImges(a)
{
   for(var i = 1; i < a.length; i ++ )
   {
      a[i].src = a[0].src;
      a[i].style.display = "";
   }
   a.length = 1;
   a[0].onload = null;
}
;

function getPageSize()
{
   var _3b1, yScroll;
   if(window.innerHeight && window.scrollMaxY)
   {
      _3b1 = document.body.scrollWidth;
      yScroll = window.innerHeight + window.scrollMaxY;
   }
   else
   {
      if(document.body.scrollHeight > document.body.offsetHeight)
      {
         _3b1 = document.body.scrollWidth;
         yScroll = document.body.scrollHeight;
      }
      else
      {
         _3b1 = document.body.offsetWidth;
         yScroll = document.body.offsetHeight;
      }
   }
   var _3b2, windowHeight;
   if(self.innerHeight)
   {
      _3b2 = self.innerWidth;
      windowHeight = self.innerHeight;
   }
   else
   {
      if(document.documentElement && document.documentElement.clientHeight)
      {
         _3b2 = document.documentElement.clientWidth;
         windowHeight = document.documentElement.clientHeight;
      }
      else
      {
         if(document.body)
         {
            _3b2 = document.body.clientWidth;
            windowHeight = document.body.clientHeight;
         }
      }
   }
   if(yScroll < windowHeight)
   {
      pageHeight = windowHeight;
   }
   else
   {
      pageHeight = yScroll;
   }
   if(_3b1 < _3b2)
   {
      pageWidth = _3b2;
   }
   else
   {
      pageWidth = _3b1;
   }
   arrayPageSize = new Array(pageWidth, pageHeight, _3b2, windowHeight);
   return arrayPageSize;
}
;

var boxleft = getWidth() - 180;
var boxid = ["Editor_Function", "attribute_Function"];
var sh = screen.availHeight;
var serverUrl = "/inc/chk.aspx";

var colorArray = new Array();
var area_ary = ["dom0", "dom1", "dom2"];
var pageStyle =
{
   setColor : function(what, id)
   {
      var dEL = _$("d_" + what);
      var sEL = _$("s_" + what);
      var selcolor = dEL.value.parseColor();
      if(selcolor)
      {
         colorArray[what] = selcolor;
         this.setStyle(what, id);
         dEL.value = selcolor;
         sEL.style.backgroundColor = selcolor;
      }
   }
   , setPic : function(what, id)
   {
      var dEL = _$("d_" + what);
      var sEL = _$("s_" + what);
      var selpic = dEL.value;
      if(selpic)
      {
         try
         {
            var id = (typeof(id) == "undefined" ? _$(colorArray["id"]).id : id);
         }
         catch(e)
         {
         }
         track_click(GetHttpUrl(selpic), sEL);
         if(selpic.indexOf('http://') != - 1)
         {
            colorArray[what] = selpic;
         }
         else
         {
            colorArray[what] = GetHttpUrl(selpic);
         }
         sEL.innerHTML = "<img src=" + colorArray[what] + " height=30 onload='resizeImage(this,40);' "
         + "onerror='regImg(this, this.src);' /> "
         + "<span><a href=javascript:void('cancel') onclick=pageStyle.cancelPic('bgphotoV','" + id
         + "')>取消</a></span>";
         sEL.style.display = "block";
         if(colorArray["global"] == "all")
         this.setGlobal(what, "backgroundImage");
         else
         {
            if(id.toLowerCase() == "body")
            {

               var bodyDiv = document.getElementsByTagName("body").item(0);
               bodyDiv.style.backgroundImage = "url('"+colorArray[what]+"')";
            }
            else
            {
               var DiyDiv = _$(colorArray["id"]);
               DiyDiv.style.backgroundImage = "url('"+colorArray[what]+"')";
            }
         }
      }
   }
   , setPicStyle : function(what, id)
   {
      var sEL = _$(what);
      colorArray[what] = sEL.value;
      if(colorArray["global"] == "all")
      {
         if(what == "pic_place")
         {
            this.setGlobal(what, "backgroundPosition");
         }
         else if(what == "pic_repeat")
         {
            this.setGlobal(what, "backgroundRepeat");
         }
         else if(what == "pic_scroll")
         {
            this.setGlobal(what, "backgroundAttachment");
         }
         return;
      }
      var id = (typeof(id) == "undefined" ? _$(colorArray["id"]).id : id);
      if(id.toLowerCase() == "body" && what == "pic_place")
      {
         var bodyDiv = document.getElementsByTagName("body").item(0);
         bodyDiv.style.backgroundPosition = colorArray[what];
      }
      else if(id.toLowerCase() == "body" && what == "pic_repeat")
      {
         var bodyDiv = document.getElementsByTagName("body").item(0);
         bodyDiv.style.backgroundRepeat = colorArray[what];
      }
      else if(id.toLowerCase() == "body" && what == "pic_scroll")
      {
         var bodyDiv = document.getElementsByTagName("body").item(0);
         bodyDiv.style.backgroundAttachment = colorArray[what];
      }
      else
      {
         var DiyDiv = _$(colorArray["id"]);
         if(what == "pic_place")
         {
            DiyDiv.style.backgroundPosition = colorArray[what];
         }
         else if(what == "pic_repeat")
         {
            DiyDiv.style.backgroundRepeat = colorArray[what];
         }
         else if(what == "pic_scroll")
         {
            DiyDiv.style.backgroundAttachment = colorArray[what];
         }
      }

   }
   , setRimStyle : function(what)
   {

      var bEL = _$("b_" + what).value;
      var kEL = _$("k_" + what).value;
      if(kEL == "") kEL = 0;
      var dEL = _$("d_" + what).value;
      var pos = what.split('_')[1];
      colorArray[what] = kEL + "px " + bEL + " " + dEL;
      if(colorArray["global"] == "all")
      {
         if(pos == "top")
         {
            this.setGlobal(what, "borderTop");
         }
         else if(pos == "right")
         {
            this.setGlobal(what, "borderRight");
         }
         else if(pos == "bottom")
         {
            this.setGlobal(what, "borderBottom");
         }
         else if(pos == "left")
         {
            this.setGlobal(what, "borderLeft");
         }
         return;
      }

      var sid = _$(colorArray["id"]);
      if(pos == "top")
      {
         sid.style.borderTop = colorArray[what];
      }
      else if(pos == "right")
      {
         sid.style.borderRight = colorArray[what];
      }
      else if(pos == "bottom")
      {
         sid.style.borderBottom = colorArray[what];
      }
      else if(pos == "left")
      {
         sid.style.borderLeft = colorArray[what];
      }

   }
   , setOpacity : function(what)
   {
      var sEL = _$(what).value;
      if(sEL != "")
      {
         colorArray[what] = sEL;
         if(colorArray["global"] == "all")
         {
            this.setGlobal(what, "filter");
            return;
         }
         var sid = _$(colorArray["id"]);
         sid.style.filter = "alpha(opacity=" + sEL + ")";
      }
   }
   , setHeight : function(what)
   {
      var sEL = _$(what).value;
      if(sEL != "")
      {
         colorArray[what] = sEL;
         if(colorArray["global"] == "all")
         {
            this.setGlobal(what, "height");
            return;
         }
         var sid = _$(colorArray["id"]);
         sid.style.height = sEL + "px";
      }
   }
   , setTitle : function(what)
   {
      var sEL = _$(what).value;
      if(sEL.len > 20)
      {
         alert("标题请不要超过20个字符!");
         sEL.focus();
         return false;
      }
      if(sEL != "")
      {
         colorArray[what] = escapeForXML(sEL);
         var o = _$(colorArray["id"] + "_title");
         var v = (o.innerText) ? o.innerText : o.textContent;
         o.old_value = v;
         o.innerHTML = colorArray[what];
      }
   }
   , setContent : function(what)
   {
      var sEL = _$(what).value;
      if(sEL.len > 150)
      {
         alert("请不要超过150个字符!");
         sEL.focus();
         return false;
      }
      if(sEL != "")
      {
         colorArray[what] = escapeForXML(sEL);
         var o = _$(colorArray["id"] + "_content");
         var v = (o.innerText) ? o.innerText : o.textContent;
         o.old_value = v;
         o.innerHTML = colorArray[what];
      }
   }
   , cancelPic : function(what, id)
   {
      var dEL = _$("d_" + what);
      var sEL = _$("s_" + what);
      dEL.value = "";
      colorArray[what] = "";
      sEL.style.display = "none";
      try
      {
         var id = (typeof(id) == "undefined" ? _$(colorArray["id"]).id : id);
         if(id.toLowerCase() == "body")
         {
            var bodyDiv = document.getElementsByTagName("body").item(0);
            bodyDiv.style.background = "";
            bodyDiv.style.removeAttribute("background");
            bodyDiv.style.backgroundImage = "";
            bodyDiv.style.removeAttribute("backgroundImage");

         }
         else
         {
            var DiyDiv = _$(colorArray["id"]);
            DiyDiv.style.background = "";
            DiyDiv.style.removeAttribute("background");
            DiyDiv.style.backgroundImage = "";
            DiyDiv.style.removeAttribute("backgroundImage");
         }
      }
      catch(e)
      {
      }
   }
   , setStyle : function(what, id)
   {
      if(colorArray["global"] == "all")
      {
         switch(what)
         {
            case "bgcolorV" :
            {
               this.setGlobal(what, "backgroundColor");
               break;
            }
            case "textColorV" :
            {
               this.setGlobal(what, "color");
               break;
            }
         }
         return;
      }
      var id = (typeof(id) == "undefined" ? _$(colorArray["id"]).id : id);
      if(id.toLowerCase() == "body")
      {
         var bodyDiv = document.getElementsByTagName("body").item(0);
         bodyDiv.style.backgroundColor = colorArray[what];
      }
      else if(id.toLowerCase() == "a")
      {

         if( ! document.getElementsByTagName)
         {
            return;
         }
         var _38d = document.getElementsByTagName("a");

         for(var i = 0; i < _38d.length; i ++ )
         {
            var _38f = _38d[i];
            _38f.style.color = colorArray[what];
            _38f.onmouseout = mouseoverSyle;

         }
      }
      else if(id.toLowerCase() == "a:hove")
      {
         if( ! document.getElementsByTagName)
         {
            return;
         }
         var _38d = document.getElementsByTagName("a");

         for(var i = 0; i < _38d.length; i ++ )
         {
            var _38f = _38d[i];
            _38f.onmouseover = mouseoutSyle;
         }
      }
      else if(id.toLowerCase() == "color")
      {
         var bodyDiv = document.getElementsByTagName("body").item(0);
         bodyDiv.style.color = colorArray[what];
      }
      else
      {
         var idDiv = _$(colorArray["id"]);
         switch(what)
         {
            case "bgcolorV" :
            {
               idDiv.style.backgroundColor = colorArray[what];
               break;
            }
            case "textColorV" :
            {
               idDiv.style.color = colorArray[what];
               break;
            }
            case "AtextColorV" :
            {
               var _38d = idDiv.getElementsByTagName("a");

               for(var i = 0; i < _38d.length; i ++ )
               {
                  var _38f = _38d[i];
                  _38f.style.color = colorArray[what];
                  _38f.onmouseout = mouseoverSyle;

               }
               break;
            }
            case "AHtextColorV" :
            {
               var _38d = idDiv.getElementsByTagName("a");

               for(var i = 0; i < _38d.length; i ++ )
               {
                  var _38f = _38d[i];
                  _38f.onmouseover = mouseoutSyle;
               }
               break;
            }
         }
      }

   }
   , setGlobal : function(what, stylec)
   {
      try
      {
         for(var aa = 0; aa < area_ary.length; aa ++ )
         {
            var area = _$(area_ary[aa]);
            var ln = area.childNodes.length;
            for(var ab = 0; ab < ln; ab ++ )
            {
               var o = area.childNodes[ab];
               var m = o.id;
               if(colorArray["extension"] != "")
               m += "_" + colorArray["extension"];
               if(_$(m).id == "")
               {
                  continue;
               }
               else
               {
                  var d = _$(m);
                  if(stylec == "backgroundImage")
                  {
                     eval("d.style." + stylec + "='url("+colorArray[what]+")'");
                     d.style.backgroundRepeat = "repeat";
                  }
                  else if(stylec == "height")
                  eval("d.style." + stylec + "='"+colorArray[what]+" px'");
                  else if(stylec == "filter")
                  eval("d.style." + stylec + "='alpha(opacity="+colorArray[what]+")'");
                  else
                  eval("d.style." + stylec + "='"+colorArray[what]+"'");
               }
            }
         }
      }
      catch(e)
      {
         alert(e.description);
      }

   }
   , reset : function()
   {
      if(confirm("点击确认恢复默认设置\n\n温馨提示：恢复默认设置操作后将不能返回到上一次状态！"))
      {
         var module;
         if(colorArray["global"] == "all")  module = _$("leftid").value + "," + _$("centerid").value
         + "," + _$("rightid").value;
         loading("open");
         _$("reset").disabled = true;
         var strurl = serverUrl + "?username=" + UserName + "&act=reset_style&id=" + colorArray["id"]
         + "&module=" + module + "&time=" + Ajax.getDatetime();
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               if(sResult.responseText == "恢复成功！")
               {
                  location.reload();
               }
               else
               alert(sResult.responseText);
               _$("reset").disabled = false;
               loading("close");
            }
         }
         )
      }
   }
   , resetEdit : function()
   {
      var o = _$(colorArray["id"] + "_title");
      if(o && typeof(o.old_value) != 'undefined')
      o.innerHTML = o.old_value;
      var con = _$(colorArray["id"] + "_content");
      if(con && typeof(con.old_value) != 'undefined')
      con.innerHTML = con.old_value;
   }
   , isSave : function()
   {
      var issave = false;
      var colorArrayKeys = String(colorArray.valueOf()).split(',');
      for(var i = 0; i < colorArrayKeys.length; i ++ )
      {
         if(colorArrayKeys[i] != "id" && colorArrayKeys[i] != "global" && colorArrayKeys[i] != "extension" && colorArrayKeys[i] != "cotedrop")
         {
            if(typeof(colorArray[colorArrayKeys[i]]) != 'undefined' && colorArray[colorArrayKeys[i]] != "")
            issave = true;
         }
      }
      if(issave)
      {
         if(confirm("选择确定，保存本次操作。\n提示：不需要保存本次操作，请按取消。"))
         {
            pageStyle.save(false);

         }
      }
   }
   , saveGlobalStyle : function()
   {
      var id = colorArray["id"].split('_')[0] + "_" + colorArray["id"].split('_')[1];
      var module = _$("leftid").value + "," + _$("centerid").value + "," + _$("rightid").value;
      var strurl = serverUrl + "?username=" + UserName + "&act=applystyle" + "&id=" + id + "&module="
      + module + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText == "应用样式到全局操作成功！")
            {
               window.location.reload();
            }
            else
            alert("操作有误，请与管理员联系！");
            _$("Ok").disabled = false;
            loading("close");
         }
      }
      )
   }
   , saveGlobal : function()
   {
      pageStyle.save(true, true);
   }
   , save : function(isclose, GlobalStyle)
   {
      if(typeof isclose == "undefined") isclose = true;
      var u = "?username=" + UserName + "&act=style";
      if(colorArray["global"] == "all") colorArray["module"] = _$("leftid").value + ","
      + _$("centerid").value + "," + _$("rightid").value;
      var colorArrayKeys = String(colorArray.valueOf()).split(',');
      ec = window.encodeURIComponent ? encodeURIComponent : escape;
      for(var i = 0; i < colorArrayKeys.length; i ++ )
      {
         if(colorArrayKeys[i] == "att_title" || colorArrayKeys[i] == "att_content")
         u += "&" + colorArrayKeys[i] + "=" + colorArray[colorArrayKeys[i]];
         else
         u += "&" + colorArrayKeys[i] + "=" + ec(colorArray[colorArrayKeys[i]]);
      }

      loading("open");
      _$("Ok").disabled = true;
      var strurl = serverUrl + u + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText == "保存成功！")
            {
               window.status = sResult.responseText;
               if(GlobalStyle) pageStyle.saveGlobalStyle();
               if(isclose)
               {
                  colorArray = new Array();
                  Tools.getOption(0, 1);
               }
            }
            else
            alert(sResult.responseText);
            _$("Ok").disabled = false;
            loading("close");
         }
      }
      )
   }

}
;

var music =
{
   cancel : function()
   {
      if(confirm("点击确定将会取消背景音乐！\n\n小提示：需要重新设置背景音乐在音乐页点击设置即可"))
      {
         var v = "";
         var t = "";
         var strurl = serverUrl + "?username=" + UserName + "&act=music&v=" + v + "&t=" + t + "&time="
         + Ajax.getDatetime();
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               Page.load('/UserZone/music.aspx?username=' + UserName, 'panel_02_content');
            }
         }
         )
      }
   }
}
;

var Demo =
{
   get : function()
   {
      hideSelectBoxes();
      var Y = 0;
      try
      {
         Y = event.clientY;
      }
      catch(e)
      {
      }
      var strurl = "/attribute/demoConfigs.aspx?username=" + UserName + "&time=" + Ajax.getDatetime();
      loading("open");
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            Tools.getOption(4, 1);
            loading("close");
         }
      }
      )
   }
   , EditDemoName : function(_A)
   {
      var _A = (_A != null) ? _A : this;
      var t = String(_A.getAttribute("val"));
      var o = _$(t + "_title");
      var v = (o.innerText) ? o.innerText : o.textContent;
      o.old_value = v;
      o.innerHTML = "<input type='text' id='"+t+"_mt' style='border:1px dashed #0099ff;font-size:14px"
      + ";' value='" + v + "' size='14' maxlength='20' onkeydown='Page.searchKey(this,function(id){Demo"
      + ".SaveDemoName(id);});' />";
      _$(t + '_mt').focus();
      _$(t + '_mt').select();
      o.onclick = "";
      var o_tool = _$(t + "_tool");
      if (o_tool != null)
      {
         var o_tool_v = o_tool.innerHTML;
         o_tool.old_value = o_tool_v;
         o_tool.innerHTML = '<a href="javascript:void(\'save\');" onclick="Demo.SaveDemoName(\'' + t
         + '\'); ">保存</a> <a href="javascript:void(\'reset\'); " onclick="Demo.ResetDemoName(\'' + t
         + '\'); ">取消</a>';
      }
   }
   , checkDemoName : function (o, logCheck)
   {
      if( ! (/\S+/.test(o.value)))
      {
         alert("模板名称不能为空");
         o.focus();
         return false;
      }
      if (trim(o.value).len() > 20)
      {
         alert("模板名称不能大于10个汉字，当前" + trim(o.value).len() + "字")
         o.focus();
         o.select();
         return false;
      }
      if (/["'&\\]/.test(o.value))
      {
         alert("模板名称中包含不允许的特殊字符")
         o.focus();
         o.select();
         return false;
      }
      return true;
   }
   , SaveDemoName : function(id)
   {
      var v = _$(id + "_mt");
      try
      {
         if ( ! Demo.checkDemoName(v))
         {
            return false;
         }
         else
         {
            if (v.value != "") n_v = escapeForXML(v.value);
            if(v.value == v.old_value)
            {
               reModuleTitle(obj_id);
            }
            else
            {
               loading('open');
               var strurl = serverUrl + "?username=" + UserName + "&act=editdemoname&f=" + id + "&v="
               + n_v + "&time=" + Ajax.getDatetime();
               new Ajax.Request(strurl,
               {
                  method : 'get',
                  onSuccess : function(sResult)
                  {
                     var o = _$(id + "_title");
                     o.innerHTML = n_v;
                     o.onclick = Demo.EditDemoName;
                     var o_tool = _$(id + "_tool");
                     o_tool.innerHTML = o_tool.old_value;
                     window.status = sResult.responseText;
                     loading('close');
                  }
               }
               )
            }
         }
      }
      catch(e)
      {
      }
   }
   , ResetDemoName : function(id)
   {
      var o = _$(id + "_title");
      o.innerHTML = o.old_value;
      o.onclick = Demo.EditDemoName;
      var o_tool = _$(id + "_tool");
      o_tool.innerHTML = o_tool.old_value;
   }
   , getLoadSale : function(_A)
   {
      var t = String(_A.getAttribute("val"));
      var vip = parseInt(_A.getAttribute("value"));
      if(vip < 2)
      {
         alert("提示：您还不是VIP用户，请先升级！");
         return false;
      }
      var demosaleid = "photoselect";
      loading("open");
      Page.loading(demosaleid);
      var pub = function(v)
      {
         _$(demosaleid).innerHTML = v;
         loading("close");
         active = "Yes";
         var TopX = _$("diy_toolsA").style.top.replace("px", "");
         var LeftX = _$("diy_toolsA").style.left.replace("px", "");
         _$(demosaleid).style.top = parseInt(TopX) + 20 + "px";
         _$(demosaleid).style.left = parseInt(LeftX) + 100 + "px";
         _$(demosaleid).style.display = "block";
         _$("diy_toolsAtitle").className = "normal";
      }
      ;
      var strurl = t + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            pub(sResult.responseText);
         }
      }
      )
   }
   , SaleSave : function(f)
   {
      var saletitle = escapeForXML(f.saletitle.value);
      var salemoneytype = 0;
      for(i = 0; i < f.salemoneytype.length; i ++ )
      {
         if(f.salemoneytype[i].checked == true)
         {
            salemoneytype = f.salemoneytype[i].value;
            break;
         }
      }
      var salemoney = f.salemoney.value;
      var saleremark = escapeForXML(f.saleremark.value).nl2br();
      var saledemoid = f.saledemoid.value;
      if ( ! Demo.checkDemoName(f.saletitle))
      {
         return false;
      }
      if (salemoney.length < 1)
      {
         alert("温馨提示：\n\n请输入出售模板的金额")
         f.saleremark.focus();
         return false;
      }
      if (saleremark.len() > 3000)
      {
         alert("温馨提示：\n\n说明文字不要超过1500个汉字，现已输入" + saleremark.len() + "个")
         f.saleremark.focus();
         return false;
      }
      var salepage = _$("show_demosale_yes");
      salepage.old_value = salepage.innerHTML;
      Page.loading("show_demosale_yes", "正在发布,请稍候...");
      _$("savaloadingmsg").innerHTML = "正在出售地盘风格，请耐心等待片刻。。。";
      Tools.getSavaLoad();
      loading('open');
      var strurl = serverUrl + "?username=" + UserName + "&act=demosale&t=" + saletitle + "&ty="
      + salemoneytype + "&m=" + salemoney + "&b=" + saleremark + "&id=" + saledemoid + "&time="
      + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText == "出售模板成功！")
            {
               Demo.buildPreview(saledemoid);
            }
            else
            {
               if(sResult.responseText.length < 100)
               {
                  window.status = sResult.responseText;
                  Page.loading("show_demosale_yes", sResult.responseText);
               }
               else alert("处理过程中出现异常，请稍候重试！");
               loading('close');
               Tools.closeSaLoad();
               Demo.SaleEnd();
            }
         }
      }
      )
      return false;
   }
   , buildPreview : function(saledemoid)
   {
      Page.loading("show_demosale_yes", "发布成功,正在为您生成预览图<br />此次过程耗时较长请耐心等待...");
      _$("savaloadingmsg").innerHTML = "正在生成地盘预览图，请耐心等待片刻。。。";
      var strurl = serverUrl + "?username=" + UserName + "&act=cutdomainpic&id=" + saledemoid
      + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            var vmsg = sResult.responseText.split('smallurl:');
            if(vmsg[0] == "生成成功！")
            {
               Page.loading("show_demosale_yes", "生成成功<br /><img width=100 src=" + vmsg[1]
               + " /><br />预览图 <a href=javascript:Tools.photoclose();>关闭窗口</a>");
               loading('close');
            }
            else
            {
               Page.loading("show_demosale_yes", sResult.responseText + "<br /><a href=javascript:Demo"
               + ".buildPreview('" + saledemoid + "')>重新生成生成预览图</a>");
            }
            Tools.closeSaLoad();
            Tools.getOption(4,0);
         }
      }
      )
   }
   , SaleEnd : function()
   {

   }
   , Copy : function(_A)
   {
      var t = String(_A.getAttribute("val"));
      loading("open");
      var strurl = serverUrl + "?username=" + UserName + "&act=demo_copy&v=" + t + "&time="
      + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText == "拷贝成功！")
            {
               Demo.get();
               window.status = sResult.responseText;

            }
            else
            alert(sResult.responseText);
            loading("close");
         }
      }
      )
   }
   , Del : function(_A)
   {
      var t = String(_A.getAttribute("val"));
      loading("open");
      var strurl = serverUrl + "?username=" + UserName + "&act=demo_del&v=" + t + "&time="
      + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText == "删除成功！")
            {
               Demo.get();
               window.status = sResult.responseText;

            }
            else
            alert(sResult.responseText);
            loading("close");
         }
      }
      )
   }
   , Apply : function(_A)
   {
      var t = String(_A.getAttribute("val"));
      loading("open");
      var strurl = serverUrl + "?username=" + UserName + "&act=demo_apply&v=" + t + "&time="
      +  Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            var inf = sResult.responseText.split('|');
            if(inf[0] == "应用成功！")
            {

               _$("ctl00_template_www").href = inf[2] + "index.css";
               _$("ctl00_template_detail").href = inf[2] + "detail.css";
               _$("ctl00_frame").href = inf[1];
               Demo.get();
               window.status = inf[0];
            }
            else
            alert(inf[0]);
            loading("close");
         }
      }
      )
   }
   , Default : function(_A)
   {
      if(confirm("选择确定，将会还原到默认模板状态。\n提示：本次操作不可返回，请确定是否要还原模板。"))
      {
         var t = String(_A.getAttribute("val"));
         loading("open");
         var strurl = serverUrl + "?username=" + UserName + "&act=demo_default&v=" + t + "&time="
         + Ajax.getDatetime();
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               var inf = sResult.responseText.split('|');
               if(inf[0] == "还原成功！")
               {
                  _$("ctl00_template_www").href = inf[2] + "index.css";
                  _$("ctl00_template_detail").href = inf[2] + "detail.css";
                  _$("ctl00_frame").href = inf[1];
                  Demo.get();
                  window.status = inf[0];
               }
               else
               alert(inf[0]);
               loading("close");
            }
         }
         )
      }
   }
   , Quit : function(_A)
   {
      if(confirm("是否确认要下架此模板！"))
      {
         var t = String(_A.getAttribute("val"));
         loading("open");
         var strurl = serverUrl + "?username=" + UserName + "&act=demo_quit&v=" + t + "&time="
         + Ajax.getDatetime();
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               if(sResult.responseText == "下架成功！")
               {
                  Demo.get();
                  window.status = sResult.responseText;
               }
               else
               alert(sResult.responseText);
               loading("close");
            }
         }
         )
      }
   }
}
;

var Page =
{
   initialize : function()
   {
   }
   ,
   get : function(_A, styleID)
   {
      hideSelectBoxes();
      if(colorArray.length > 0)
      {
         pageStyle.isSave();
      }
      colorArray = ["id", "global", "extension", "cotedrop", "module", "bgcolorV", "compartcolorV", "opacityV", "bgphotoV", "pic_place", "pic_repeat", "pic_scroll", "textColorV", "AtextColorV", "AHtextColorV", "att_height", "att_title", "att_content", "rim_top", "rim_right", "rim_bottom", "rim_left"];
      colorArray["id"] = styleID;
      try
      {
         if(styleID.split('_')[0] == "panel")
         {
            if(styleID.split('_')[1] == "all")
            {
               colorArray["global"] = styleID.split('_')[1];
               if(styleID.split('_')[2] != null)
               {
                  colorArray["extension"] = styleID.split('_')[2];
                  colorArray["id"] = styleID.split('_')[0] + "_" + colorArray["extension"];
               }
               else
               {
                  colorArray["extension"] = "";
                  colorArray["id"] = styleID.split('_')[0];
               }
            }
         }
      }
      catch(e)
      {
         alert(e.description);
      }
      Tools.loadings('p');
      var u = String(_A.getAttribute("rel"));
      loading("open");
      if(_$(styleID + "_name")) u += "&t=" + _$(styleID + "_name").innerText;
      var strurl = u + "&id=" + styleID + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            Page.setInnerHTML("diy_main_R", u, sResult.responseText);
            if(_$('cursoropacity')) autotag(_$('cursoropacity'), _$('opacityV'));
            loading("close");
         }
      }
      )
   }
   ,
   getWidth : function(id)
   {
      return id.offsetWidth;
   }
   ,
   getValue : function(id)
   {
      return id.value;
   }
   ,
   setWidth : function(id, w)
   {
      id.style.width = w + "px";
   }
   ,
   setHeight : function(id, h)
   {
      id.style.height = h + "px";
   }
   ,
   setLeft : function(id, t)
   {
      id.style.left = t + "px";
   }
   ,
   setTop : function(id, t)
   {
      id.style.top = t + "px";
   }
   ,
   setInnerHTML : function(id, p, _38c)
   {
      var id = _$(id);
      id.innerHTML = _38c;
   }
   ,
   load : function(_A, id, pub)
   {
      loading("open");
      pub = pub ? pub : function(v)
      {
         _$(id).innerHTML = v;
         loading("close");
      }
      ;
      var strurl = _A + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            pub(sResult.responseText);
            loading("close");
         }
      }
      )
   }
   ,
   setFrame : function(_A)
   {
      var id = _$("attribute_Function");
      var t = String(_A.getAttribute("val"));
      var f = String(_A.getAttribute("frame")).split(',');
      loading("open");
      var strurl = serverUrl + "?username=" + UserName + "&act=frame&v=" + t + "&f=" + f[1]
      + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText == "转换布局操作成功！")
            {
               _$("ctl00_frame").href = t;
               setCopy(f[0], f[1]);
               Tools.getOption(1, 1);
            }
            else
            {
               if(sResult.responseText.length < 100) alert(v);
               else alert("处理过程出现异常，请稍候重试！");
            }
            Page.end();
            window.status = sResult.responseText;
            loading("close");
         }
      }
      )
   }
   ,
   setDemo : function(_A)
   {
      if(confirm("温馨提示：\n\n更改模板前是否需要拷贝一份备份。"))
      {
         Demo.get();
      }
      else
      {
         var id = _$("attribute_Function");
         var t = String(_A.getAttribute("val"));
         loading("open");
         var strurl = serverUrl + "?username=" + UserName + "&act=demo&v=" + t
         + "&time=" + Ajax.getDatetime();
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               if(sResult.responseText.split("demo:")[0] == "转换模板操作成功！")
               {
                  _$("ctl00_template_www").href = t + "index.css";
                  _$("ctl00_template_detail").href = t + "detail.css";
                  _$("ctl00_frame").href = sResult.responseText.split("demo:")[1];
                  if(t.indexOf('/k') > 0)
                  {
                     Tools.getOption(2, 1);
                  }
                  else
                  {
                     Tools.getOption(2, 2);
                  }
               }
               else
               {
                  if(sResult.responseText.length < 100) alert(sResult.responseText);
                  else alert("处理过程出现异常，请稍候重试！");
               }
               Page.end();
               window.status = sResult.responseText.split("demo:")[0];
               loading("close");
            }
         }
         )
      }
   }
   ,
   setPages : function(sid, spage)
   {
      var strFile = "";
      switch(sid)
      {
         case 0 :
         strFile = "texiaos.aspx";
         break;
         case 1 :
         strFile = "shubiaos.aspx";
         break;
      }
      Page.load('/attribute/' + strFile + '?username=' + UserName + '&cpid=all&page=' + spage, 'diy_main_R');
   }
   ,
   setBackdrop : function(_A)
   {
      var t = String(_A.getAttribute("val"));
      loading("open");
      var strurl = serverUrl + "?username=" + UserName + "&act=domainback&v=" + t + "&time="
      + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText == "转换背景操作成功！")
            {
               var bodyDiv = document.getElementsByTagName("body").item(0);
               bodyDiv.style.backgroundImage = "url('" + t + "')";
            }
            else
            {
               if(sResult.responseText.length < 100) alert(sResult.responseText);
               else alert("处理过程出现异常，请稍候重试！");
            }
            window.status = sResult.responseText;
            loading("close");
         }
      }
      )
   }
   ,
   setCoteDrop : function(_A)
   {
      var t = String(_A.getAttribute("val"));
      var module;
      if(colorArray["global"] == "all") module = _$("leftid").value + "," + _$("centerid").value + "," + _$("rightid").value;
      loading("open");
      var strurl = serverUrl + "?username=" + UserName + "&act=coteback&v=" + t + "&id="
      + colorArray["id"] + "&module=" + module + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText == "保存成功！")
            {
               if(colorArray["global"] == "all")
               {
                  colorArray['cotedrop'] = t;
                  pageStyle.setGlobal('cotedrop', "backgroundImage");
               }
               else
               {
                  var sid = _$(colorArray["id"]);
                  sid.style.backgroundImage = "url('" + t + "')";
                  sid.style.backgroundRepeat = "repeat";
               }
            }
            else
            {
               if(sResult.responseText.length < 100) alert(sResult.responseText);
               else alert("处理过程出现异常，请稍候重试！");
            }
            window.status = sResult.responseText;
            loading("close");
         }
      }
      )
   }
   ,
   setWeather : function(f)
   {
      var v = trim(f.city.value);
      if(v == "选择城市")
      {
         alert("请选择要定制天气的所在城市!");
         f.city.focus();
         return false;
      }
      else
      {
         f.weather_sub.value = "正在处理...";
         f.weather_sub.disabled = true;
         var strurl = serverUrl + "?username=" + UserName + "&act=weather&v=" + v + "&time="
         + Ajax.getDatetime();
         new Ajax.Request(strurl,
         {
            method : 'get',
            onSuccess : function(sResult)
            {
               if(sResult.responseText == "定制天气操作成功！")
               {
                  Page.load('/userzone/weather.aspx?username=' + UserName, 'weather');
               }
               else
               alert(sResult.responseText);
            }
         }
         )
      }
      return false;
   }
   ,
   hide : function(id)
   {
      id = _$(id);
      id.style.display = "none";
   }
   ,
   show : function(id, Y)
   {
      id = _$(id);
      var s = getPageSize();
      var scrollt = getScrollTop();
      if(Y > 0) this.setTop(id, (scrollt + Y - 10));
      this.setLeft(id, (s[2] - 490));
      id.style.display = "block";

   }
   ,
   searchKey : function(obj, a)
   {
      evt = this.SearchEvent();
      if(evt.keyCode == 13)
      {
         a(obj.id.split("_")[0]);
      }
   }
   ,
   SearchEvent : function()
   {
      if(document.all)
      return window.event;
      func = SearchEvent.caller;
      while(func != null)
      {
         var arg0 = func.arguments[0];
         if(arg0)
         {
            if(arg0.constructor == Event)
            return arg0;
         }
         func = func.caller;
      }
      return null;
   }
   ,
   loading : function(id, text)
   {
      _$(id).innerHTML = "<div align=center><br /><br />"
      + (typeof text != 'undefined' ? text : "正在加载，请稍候...") + " <br/><br/><br/></div>";
   }
   ,
   end : function()
   {
      if(colorArray != null)
      {
         pageStyle.isSave();
      }
      showSelectBoxes();
   }
}
;

function mouseoverSyle()
{
   if(colorArray) this.style.color = colorArray["AtextColorV"];
}
;

function mouseoutSyle()
{
   if(colorArray) this.style.color = colorArray["AHtextColorV"];
}
;

window.onload = function()
{
   OnIni();
   getImage();
   var o = document.getElementsByTagName("h2");
   for(var i = 1; i < o.length; i ++ )
   {
      o[i].onmousedown = addevent;
      DargNumber ++ ;
   }
   getMoveId();
}
;

/* grade.js */
var count = 0;
var starsNum = 0;

function showStars(n)
{
   for(i = 1; i <= n; i ++ )
   {
      _$("star__" + i).src = "/themes/images/star_yellow.gif";
   }
   for(i = n + 1; i <= 5; i ++ )
   {
      _$("star__" + i).src = "/themes/images/star_none.gif";
   }
   _$("grade_msg").innerText = String(_$("star__" + n).getAttribute("alt"));
}
;

function hideStars()
{
   _$("grade_msg").innerText = "";
   for(i = 1; i <= starsNum; i ++ )
   {
      _$("star__" + i).src = _$("star__hide").src;
      for(i = starsNum + 1; i <= 5; i ++ )
      {
         _$("star__" + i).src = "/themes/images/star_none.gif";
      }
   }
}
;

function grade(id, n)
{
   if(count == 0)
   {
      _$("grade_msg").innerText = "数据正在提交...";
      var strurl = "/inc/grade.aspx?act=grade&username=" + UserName + "&v=" + n + "&time="
      + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            var gi = sResult.responseText.split("|");
            if(gi[0] == "评分成功！")
            {
               count = count + 1;
               starsNum = n;
               _$("star__hide").src = "/themes/images/star_orange.gif";
               _$("domain_grade").innerHTML = gi[3];
               if (gi[1] == gi[2])
               {
                  _$("domain_PM").innerHTML = "第" + gi[1] + "名 <span><font color=#FF9A18>—"
                  + "</font></span>";
               }
               else if (parseInt(gi[1]) > parseInt(gi[2]))
               {
                  _$("domain_PM").innerHTML = "第" + gi[1] + "名 <span><font color=#AC0000>↓("
                  + (parseInt(gi[1]) - parseInt(gi[2])) + ")</font></span>";
               }
               else
               {
                  _$("domain_PM").innerHTML = "第" + gi[1] + "名 <span><font color=#4C8F31>↑("
                  + (parseInt(gi[2]) - parseInt(gi[1])) + ")</font></span>";
               }
               setTimeout("mysettime()", 5000);
            }
            else
            {
               _$("grade_msg").innerText = sResult.responseText;
            }
         }
      }
      )
   }
   else
   {
      _$("grade_msg").innerText = "您已投过票!";
   }
}
;

function mysettime()
{
   count = 0;
}
;

/* ajaxtabs.js */
var Browser = new Object();
Browser.isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument != 'undefined');
Browser.isIE = window.ActiveXObject ? true : false;
Browser.isFirefox = (navigator.userAgent.toLowerCase().indexOf("firefox") != - 1);
Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera") != - 1);
if (Browser.isFirefox)
{
   extendEventObject();
}
;

function extendEventObject()
{
   Event.prototype.__defineGetter__("srcElement", function ()
   {
      var node = this.target;
      while (node.nodeType != 1) node = node.parentNode;
      return node;
   }
   );

   Event.prototype.__defineGetter__("fromElement", function ()
   {
      var node;
      if (this.type == "mouseover")
      node = this.relatedTarget;
      else if (this.type == "mouseout")
      node = this.target;
      if ( ! node) return;
      while (node.nodeType != 1) node = node.parentNode;
      return node;
   }
   );

   Event.prototype.__defineGetter__("toElement", function ()
   {
      var node;
      if (this.type == "mouseout")
      node = this.relatedTarget;
      else if (this.type == "mouseover")
      node = this.target;
      if ( ! node) return;
      while (node.nodeType != 1) node = node.parentNode;
      return node;
   }
   );
}
;

var ajccache = new Object();
var waitInterval;
var tempref;
var MouseDelayTime = 150;

function loadAJAXTab(url, contentid)
{
   var ocontent = $(contentid);
   ocontent.innerHTML = '<div align=center><br /><br /><img src="/public/images/loading.gif"  border="0"'
   + '/><br/><br/><br/></div>';
   if(ajccache[url] == null)
   {
      var strurl = url;
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            ocontent.innerHTML = sResult.responseText;
            ajccache[url] = ocontent.innerHTML;
         }
      }
      )
   }
   else
   {
      ocontent.innerHTML = ajccache[url];
   }
}
;

function IsChild(cNode, pNode)
{
   while(cNode != null)
   {
      cNode = cNode.parentNode;
      if(cNode == pNode) return true;
   }
   return false;
}
;

function getTBprefixName(str, sta)
{
   if(str.indexOf("active") != - 1 || str.indexOf("normal") != - 1) str = str.substr(6);
   else if(str.indexOf("over") != - 1) str = str.substr(4);
   else str = "";
   return sta + str;
}
;

function startajaxtabs()
{
   for(var i = 0; i < arguments.length; i ++ )
   {
      var ulobj = _$(arguments[i]);
      ulist = ulobj.getElementsByTagName("li");
      for(var j = 0; j < ulist.length; j ++ )
      {
         var thelist = ulist[j];
         if(thelist.parentNode.parentNode != ulobj) continue;
         var ulistlink = thelist.getElementsByTagName("a")[0];
         var ulistlinkurl = ulistlink.getAttribute("urn");
         var ulistlinktarget = ulistlink.getAttribute("rel");
         thelist.setActive = function(bactive)
         {
            if(bactive)
            {
               this.status = "active";
               this.className = getTBprefixName(this.className, "active");
            }
            else
            {
               this.status = "normal";
               this.className = getTBprefixName(this.className, "normal");
            }
         }
         thelist.LoadTab = function()
         {
            this.setActive(true);
            this.parentNode.parentNode.activetab.setActive(false);
            this.parentNode.parentNode.activetab = this;
            var ulistlink = this.getElementsByTagName("a")[0];
            loadAJAXTab(ulistlink.getAttribute("urn"), ulistlink.getAttribute("rel"));
         }
         thelist.onclick = function(aEvent)
         {
            var myEvent = window.event ? window.event : aEvent;
            var fm = myEvent.fromElement;
            if(IsChild(fm, this) || fm == this) return;
            if(this.status == "active") return;
            tempref = this;
            clearTimeout(waitInterval);
            waitInterval = window.setTimeout("tempref.LoadTab();", MouseDelayTime);
         }

         thelist.onmouseout = function(aEvent)
         {
            var myEvent = window.event ? window.event : aEvent;
            var em = myEvent.toElement;
            if(IsChild(em, this) || em == this) return;
            if(this.status == "active") return;
            clearTimeout(waitInterval);
         }
         if(ulistlinkurl.indexOf("#default") != - 1)
         {
            thelist.setActive(true);
            ulobj.activetab = thelist;
            ajccache[ulistlinkurl] = document.getElementById(ulistlinktarget).innerHTML;
         }
         else
         {
            thelist.setActive(false);
         }
      }
      if(ulobj.activetab == null) ulobj.activetab = ulist[0];

   }
}
;

/* getMusic.js */
function box(id)
{
   window.open('http://music.5lin.com/inc/boxsave.asp?action=add&id=' + id, '', "toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,scrollbars=no,width=300,height=200,left=100,top=100");
}
;

function list()
{
   window.open("about:blank", "mp3list", "");
}
;

function CheckOthers(form)
{
   for (var i = 0; i < form.elements.length; i ++ )
   {
      var e = form.elements[i];
      if (e.checked == false)
      {
         e.checked = true;
      }
      else
      {
         e.checked = false;
      }
   }
}
;

function CheckAll(form)
{
   for (var i = 0; i < form.elements.length; i ++ )
   {
      var e = form.elements[i];
      e.checked = true;
   }
}
;

function setMusic(_A)
{
   if(confirm("选择确定，将歌曲设为背景音乐。\n提示：此操作将会替代上一次的设置。"))
   {
      var v = String(_A.getAttribute("val"));
      var t = String(_A.getAttribute("title"));
      var strurl = "/inc/chk.aspx?username=" + UserName + "&act=music&v=" + v + "&t=" + t + "&time="
      + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            alert(sResult.responseText);
         }
      }
      )
   }
}
;

function setMusics(_A)
{
   if(confirm("选择确定，将歌曲设为背景音乐。\n提示：此操作将会替代上一次的设置。"))
   {
      var v = String(_A.getAttribute("val"));
      var t = String(_A.getAttribute("title"));
      var u = String(_A.getAttribute("user"));
      var strurl = "/inc/chk.aspx?username=" + u + "&act=music&v=" + v + "&t=" + t + "&strtime="
      + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            alert(sResult.responseText);
         }
      }
      )
   }
}
;

var command, appxml, users;
function checkboxsharestate(users, specialid)
{

   if(navigator["cookieEnabled"] == false)
   {
      alert("温馨提示：\n\n对不起，登陆操作需要先开启您浏览器的Cookies才能正常登陆！");
   }
   users = users.toLowerCase();
   command = "boxShareState";
   appxml = "<username>" + users + "</username>";
   appxml = appxml + "<specialid>" + specialid + "</specialid>";
   createXML();
   return false;
}
;

function createXML()
{
   var strurl = "/XML/index.aspx";
   var sendXML = Xml.toSCPXML(command, appxml);
   new Ajax.Request(strurl,
   {
      method : 'post',
      parameters : sendXML,
      onSuccess : function(sResult)
      {
         var responseXML = sResult.responseText;
         var msg = getMessage(responseXML, "msg");
         var code = getCode(responseXML);
         if (code == 2000)
         {
            alert("温馨提示：\n\n音乐盒共享状态修改成功！");
         }
         else
         {
            alert(msg);
         }
      }
   }
   )
}
;

var checkUrl = "/inc/photo_chk.inc.aspx";
function changeBoxTitle(obj)
{
   var o = (obj != null) ? _$(obj) : this;
   var v = (o.innerText) ? o.innerText : o.textContent;
   o.old_value = v;
   o.innerHTML = "<input type='text' id='_mt' style='border:1px dashed #0099ff;font-size:14px;' value='"
   + v + "' size='12' maxlength='20' onblur='saveBoxTitle(\"" + o.id + "\",this.value);' onkeydown='mt_key"
   + "(this);' />";
   _$('_mt').focus();
   _$('_mt').select();
   o.onclick = "";
}
;

function reBoxTitle(par, return_v)
{
   loading('close');
   if (return_v == "lost")
   {
      var o = _$(par);
      o.innerHTML = o.old_value;
   }
}
;

function saveBoxTitle(obj_id, n_v)
{
   var o = _$(obj_id);
   if (n_v == "") n_v = escapeForXML(o.old_value);
   if(n_v.len() > 16)
   {
      alert("标题最多只能输入8个汉字！当前已输入" + n_v.len() + "个字");
      return false;
   }
   o.innerHTML = escapeForXML(n_v);
   o.onclick = changeBoxTitle;
   if (n_v != o.old_value)
   {
      loading('open');
      var strurl = checkUrl + "?action=editBoxtitle&title=" + n_v + "&id=" + obj_id.split("_")[0]
      + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            reBoxTitle();
         }
      }
      )
   }
}
;

function mt_key(obj)
{
   evt = SearchEvent();
   if(evt.keyCode == 13)
   {
      obj.blur();
   }
}
;

function SearchEvent()
{
   if(document.all)
   return window.event;

   func = SearchEvent.caller;
   while(func != null)
   {
      var arg0 = func.arguments[0];
      if(arg0)
      {
         if(arg0.constructor == Event)
         return arg0;
      }
      func = func.caller;
   }
   return null;
}
;

function oo(theURL)
{
   listenWin = window.open(theURL, 'w', 'scrollbars=yes');
}
;

function popup(weburl, w, h)
{
   window.open(weburl, w, 'scrollbars=yes');
}
;

function popup1(weburl, w, h)
{
   window.open(weburl, "mybox", 'scrollbars=yes')
}
;

function lTrim(str)
{
   if (str.charAt(0) == " ")
   {
      str = str.slice(1);
      str = lTrim(str);
   }
   return str;
}
;

function rTrim(str)
{
   var iLength;
   iLength = str.length;
   if (str.charAt(iLength - 1) == " ")
   {
      str = str.slice(0, iLength - 1);
      str = rTrim(str);
   }
   return str;
}
;

function trim(str)
{
   return lTrim(rTrim(str));
}
;

function chkAddAlbumForm()
{
   var tl = document.albumForm.altl.value;
   if(trim(tl) == "")
   {
      alert("您还没有为新专辑起名字");
      document.albumForm.altl.focus();
      return false;
   }
   return true;
}
;

function partOfSelect(theForm)
{
   var isSelect = false;
   var info = document.getElementsByName("id");
   var playlistid = $("gids");
   if(info.length != 'undefined')
   {
      for(i = 0; i < info.length; i ++ )
      {
         var tempid = info[i].value.replace("%7E", "~");
         tempid = info[i].value.split("%23");

         if(info[i].checked)
         {
            if(playlistid.value == "")
            {
               playlistid.value = tempid[0];
            }
            else
            {
               playlistid.value += "," + tempid[0];
            }
            isSelect = true;
         }
      }
      if( ! isSelect)
      {
         alert("请选要播放的歌曲！");
      }
      else
      {
         var thisForm = $(theForm);
         oo("about:blank");
         thisForm.action = "http://music.5lin.com/play/play_slb.asp";
         thisForm.target = "w";
         thisForm.submit();
         playlistid.value = "";
      }
   }
   else
   {
      alert("请选要播放的歌曲！");
   }
}
;

function partOfDelete(theForm, Specialid)
{
   var isSelect = false;
   var info = document.getElementsByName("id");
   var alplid = $("alplid");
   var idx = $("idx");
   var playlistid = $("gids");
   if(info.length != 'undefined')
   {
      for(i = 0; i < info.length; i ++ )
      {
         var tempid = info[i].value.replace("%7E", "~");
         tempid = info[i].value.split("%23");

         if(info[i].checked)
         {
            if(playlistid.value == "")
            {
               playlistid.value = tempid[0];
            }
            else
            {
               playlistid.value += "," + tempid[0];
            }
            isSelect = true;
         }
      }
      if( ! isSelect)
      {
         alert("请选要删除的歌曲！");
      }
      else
      {
         if(confirm("是否删除选中歌曲?"))
         {
            var link = "SpecialSave.aspx?action=delmusic&Specialid=" + Specialid + "&id="
            + playlistid.value;
            playlistid.value = "";
            location.href = link;
         }
      }
   }
   else
   {
      alert("请选要删除的歌曲！");
   }
   playlistid.value = "";
}
;

function partOfMove(theForm, oldSpecialid)
{
   var isSelect = false;
   var info = document.getElementsByName("id");
   var alplid = $("alplid");
   var onewalplid = $("ctl00$mainContent$newalplid");
   if (onewalplid.value == - 1)
   {
      alert("请先选择专辑");
      return;
   }
   var myarr = onewalplid.value.split("_");
   var newalplid = myarr[0];
   var restnum = myarr[1];
   var idx = $("idx");
   var oldSpecialid = $("alplid").value;
   var playlistid = $("gids");
   if(info.length != 'undefined')
   {
      var num = 0;
      for(i = 0; i < info.length; i ++ )
      {
         var tempid = info[i].value.replace("%7E", "~");
         tempid = info[i].value.split("%23");

         if(info[i].checked)
         {
            if(playlistid.value == "")
            {
               playlistid.value = tempid[0];
            }
            else
            {
               playlistid.value += "," + tempid[0];
            }
            isSelect = true;
            num ++ ;
         }
      }
      if (num > restnum)
      {
         alert("您选择的专辑无法放下所有歌曲，请去掉几个，然后在重新操作。");
         playlistid.value = "";
         return;
      }
      if( ! isSelect)
      {
         alert("请选要移动的歌曲！");
         playlistid.value = "";
      }
      else
      {
         if(confirm("是否将选中歌曲移动到指定专辑?"))
         {
            var link = "SpecialSave.aspx?action=move&oldSpecialid=" + oldSpecialid + "&newalplid="
            + newalplid + "&id=" + playlistid.value;
            playlistid.value = "";
            location.href = link;
         }
      }
   }
   else
   {
      alert("请选要转移的歌曲！");
   }
   playlistid.value = "";
}
;

function allOfSelect(theForm)
{
   var isSelect = false;
   var info = document.getElementsByName("id");
   var playlistid = $("gids");

   if(info.length != 'undefined')
   {
      for(i = 0; i < info.length; i ++ )
      {
         var tempid = info[i].value.replace("%7E", "~");
         tempid = info[i].value.split("%23");

         if(playlistid.value == "")
         {
            playlistid.value = tempid[0];
         }
         else
         {
            playlistid.value += "," + tempid[0];
         }
         isSelect = true;
      }
      if( ! isSelect)
      {
         alert("请选要播放的歌曲！");
      }
      else
      {
         var thisForm = $(theForm);
         oo("about:blank");
         thisForm.action = "/listen.so";
         thisForm.target = "w";
         thisForm.submit();
         playlistid.value = "";
      }
   }
   else
   {
      alert("请选要播放的歌曲！");
   }
}
;

function allSelect()
{
   try
   {
      if(document.aspnetForm.id != 'undefined')
      {
         var len = document.aspnetForm.id.length;
         if (len != 'undefined')
         {
            for(i = 0; i < len; i ++ )
            {
               document.aspnetForm.id[i].checked = document.aspnetForm.chk.checked;
            }
         }
         else
         {
            document.aspnetForm.id.checked = document.aspnetForm.chk.checked;
         }
      }
   }
   catch(e)
   {
      // alert(e.description);
   }
}
;

function unAllSelect()
{
   var ls = document.getElementsByName("id");
   var len = ls.length;
   var selected = 0;
   for(var i = 0; i < len; i ++ )
   {
      if(ls[i].checked)
      {
         selected ++ ;
      }
   }
   if (selected == len)
   document.aspnetForm.chk.checked = true;
   else
   document.aspnetForm.chk.checked = false;
}
;

function chkaspnetForm()
{
   var oooo = document.aspnetForm.oper.value;
   if(oooo == "MUP" || oooo == "MDOWN") return true;
   if(document.aspnetForm.alplid.value == 0)
   {
      alert("您还没有选择专辑");
      return false;
   }
   return alCntCheck();
}
;

function favMove(gid, where)
{
   document.aspnetForm.gid.value = gid;
   document.aspnetForm.oper.value = where;
   document.aspnetForm.submit();
}
;

function alCntCheck()
{
   var alMaxCount = 50;
   var plids = document.alMusicCntFrm.alMusicPlid;
   var cnts = document.alMusicCntFrm.alMusicCnt;
   var targetPlid = document.aspnetForm.alplid.value;
   var sourcePlids = document.aspnetForm.id;
   var sourcePlidsCnt = 0;
   for(i = 0; i < sourcePlids.length; i ++ )
   {
      if(sourcePlids[i].checked) sourcePlidsCnt ++ ;
   }
   for(i = 0; i < plids.length; i ++ )
   {
      if(targetPlid == plids[i].value)
      {
         if(cnts[i].value + sourcePlidsCnt > alMaxCount)
         {
            alert("这本专辑最多还能导入" + (alMaxCount - cnts[i].value) + "首歌曲");
            return false;
         }
      }
   }
   return true;
}
;

function resizeOuterTo(w, h)
{
   if (parseInt(navigator.appVersion) > 3)
   {
      if (navigator.appName == "Netscape")
      {
         top.outerWidth = w;
         top.outerHeight = h;
      }
      else top.resizeTo(w, h);
   }
}
;

function VideoReview(f)
{
   var v = escapeForXML(trim(f.reviewtext.value));
   if(v.length < 1 || ! getStrLen(v, 150))
   {
      alert("评论字数限制在1~150个字符，请检查字符数量!");
      f.reviewtext.focus();
      return false;
   }
   var id = f.video_id.value;
   f.video_submit.value = "正在处理...";
   f.video_submit.disabled = true;
   var strurl = "inc/WriteVideoReview.aspx?username=" + UserName + "&id=" + id + "&v=" + v + "&time="
   + Ajax.getDatetime();
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         if(sResult.responseText == "true")
         {
            getXmlHttp('reviewlist', 'inc/AllVideoReview.aspx?id=' + id);
         }
         else
         {
            alert(sResult.responseText);
         }
         var oe = $("reviewtext");
         getCountNumber(oe);
         f.reviewtext.value = "";
         f.video_submit.value = "发表评论";
         f.video_submit.disabled = false;
      }
   }
   )
   return false;
}
;

var checkUrl = "/inc/photo_chk.inc.aspx";
function changeVideoTitle(obj)
{
   var o = (obj != null) ? _$(obj) : this;
   var v = (o.innerText) ? o.innerText : o.textContent;
   o.old_value = v;
   o.innerHTML = "<input type='text' id='_mt' style='border:1px dashed #0099ff;font-size:14px;' value='"
   + v + "' size='12' maxlength='20' onblur='saveVideoTitle(\""+o.id+"\",this.value);' onkeydown='mt_key"
   + "(this);' />";
   _$('_mt').focus();
   _$('_mt').select();
   o.onclick = "";
}
;

function reVideoTitle(par, return_v)
{
   loading('close');
   if (return_v == "lost")
   {
      var o = _$(par);
      o.innerHTML = o.old_value;
   }
}
;

function saveVideoTitle(obj_id, n_v)
{
   var o = _$(obj_id);
   if (n_v == "") n_v = escapeForXML(o.old_value);
   if(n_v.len() > 16)
   {
      alert("标题最多只能输入8个汉字！当前已输入" + n_v.len() + "个字");
      return false;
   }
   o.innerHTML = escapeForXML(n_v);
   o.onclick = changeVideoTitle;
   if (n_v != o.old_value)
   {
      loading('open');
      var strurl = checkUrl + "?action=editVideotitle&title=" + n_v + "&id=" + obj_id.split("_")[0]
      + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            reVideoTitle();
         }
      }
      )
   }
}
;

function mt_key(obj)
{
   evt = SearchEvent();
   if(evt.keyCode == 13)
   {
      obj.blur();
   }
}
;

function SearchEvent()
{
   if(document.all)
   return window.event;
   func = SearchEvent.caller;
   while(func != null)
   {
      var arg0 = func.arguments[0];
      if(arg0)
      {
         if(arg0.constructor == Event)
         return arg0;
      }
      func = func.caller;
   }
   return null;
}
;

/* Diary.js */
var temp = 0;
var hiddens = "Yes";

function getHttpDate(paraA, paraB, paraC)
{
   var o = $(paraA);
   var temp = paraB;
   if(paraC.length > 0)
   {
      temp += "?" + paraC + "&time=" + Ajax.getDatetime();
   }
   else
   {
      temp += "?time=" + Ajax.getDatetime();
   }
   if(hiddens != "No")
   {
      getloading("正在加载数据", "Yes");
   }
   var strurl = temp;
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         o.innerHTML = sResult.responseText;
      }
   }
   )
}

function isNumber(s)
{
   var patrn = /^[0-9]{1,20}$/;
   if ( ! patrn.exec(s))
   {
      return false;
   }
   return true;
}

function setDiary(sKey, sValue)
{
   var sValues = sValue
   if(sValue < 1)
   {
      var sValue = $("listnumberC");
      if( ! isNumber(sValue.value))
      {
         alert("提示：只能输入数字。");
         sValue.value = "";
         sValue.focus();
         return false;
      }
      if(sValue.value > 20)
      {
         alert("提示：不能大于20篇。");
         sValue.value = "";
         sValue.focus();
         return false;
      }
      sValues = sValue.value;
   }
   loading("open");
   var strurl = "/inc/WriteZoneSet.aspx?strElement=diary&sKey=" + sKey + "&sValue=" + sValues
   + "&time=" + Ajax.getDatetime();
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         var temps = sResult.responseText;
         if(temps != "True")
         {
            alert(temps);
         }
         else
         {
            getXmlHttps('panel_05_content', '/UserZone/diary.aspx?UserName=' + UserName);
         }
         loading("close");
      }
   }
   )
}

function setVideo(sKey)
{
   var sValue = $("listnumberB");
   if( ! isNumber(sValue.value))
   {
      alert("提示：只能输入数字。");
      sValue.value = "";
      sValue.focus();
      return false;
   }
   if(sValue.value > 20)
   {
      alert("提示：不能大于20集。");
      sValue.value = "";
      sValue.focus();
      return false;
   }
   loading("open");
   var strurl = "/inc/WriteZoneSet.aspx?strElement=video&sKey=" + sKey + "&sValue=" + sValue.value
   + "&time=" + Ajax.getDatetime();
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         var temps = sResult.responseText;
         if(temps != "True")
         {
            alert(temps);
         }
         else
         {
            getXmlHttps('panel_06_content', '/UserZone/video.aspx?UserName=' + UserName);
         }
         loading("close");
      }
   }
   )
}

function setFriend(sKey)
{
   var sValue = $("listnumberA");
   if( ! isNumber(sValue.value))
   {
      alert("提示：只能输入数字。");
      sValue.value = "";
      sValue.focus();
      return false;
   }
   if(sValue.value > 20)
   {
      alert("提示：不能大于20个。");
      sValue.value = "";
      sValue.focus();
      return false;
   }
   var strurl = "/inc/WriteZoneSet.aspx?strElement=friend&sKey=" + sKey + "&sValue=" + sValue.value
   + "&time=" + Ajax.getDatetime();
   loading("open");
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         var temps = sResult.responseText;
         if(temps != "True")
         {
            alert(temps);
         }
         else
         {
            getXmlHttps('panel_03_content', '/UserZone/friend.aspx?UserName=' + UserName);
         }
         loading("close");
      }
   }
   )
}

function getHttpDelClass(paraA)
{
   flag = confirm("确定要删除该日记本吗？");
   if(flag)
   {
      var strurl = "deldiaryclass.aspx?id=" + paraA + "&time=" + Ajax.getDatetime();
      getloading("正在删除日记本", "Yes");
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            var temps = sResult.responseText;
            if(temps != "True")
            {
               clearTimeout(times);
               getloading(temps, "Yes");
            }
            else
            {
               clearTimeout(times);
               getloading("删除日记本成功", "Yes");
               hiddens = "No";
               getHttpDate('RightDiary', 'classdiary.aspx', '');
               getHttpDate('DiaryListClass', 'leftdiaryclass.aspx', '');
               hiddens = "Yes";
            }
         }
      }
      )
   }
}

function getHttpDel(paraA, paraB)
{
   flag = confirm("删除该日记减少10个积分点，确定要继续操作吗？\n");
   if(flag)
   {
      var strurl = "deldiary.aspx?id=" + paraA + "&time=" + Ajax.getDatetime();
      getloading("正在删除日记", "Yes");
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            var temps = sResult.responseText;
            if(temps != "True")
            {
               clearTimeout(times);
               getloading(temps, "Yes");
            }
            else
            {
               clearTimeout(times);
               getloading("删除日记成功", "Yes");
               hiddens = "No";
               getHttpDate('RightDiary', 'listdiary.aspx', paraB);
               getHttpDate('DiaryListClass', 'leftdiaryclass.aspx', '');
               hiddens = "Yes";
            }
         }
      }
      )
   }
}

function setNewClass()
{
   var txt = $("classtitle");
   if(txt.value.length < 1)
   {
      alert("提示：日记本标题不能空。");
      txt.focus();
      return false;
   }
   var strurl = "newdiarybooks.aspx?title=" + escape(txt.value) + "&time=" + Ajax.getDatetime();
   getloading("正在添加日记本", "Yes");
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         var temps = sResult.responseText;
         var regs = /\d/;
         if( ! regs.test(temps))
         {
            clearTimeout(times);
            getloading(temps, "Yes");
         }
         else
         {
            clearTimeout(times);
            getloading("添加日记本成功", "Yes");
            var o = document.all["SClass"];
            o.options.add(new Option('' + txt.value + '', '' + temps + ''));
            o[o.length - 1].selected = true;
            txt.value = "";
            hiddens = "No";
            getHttpDate('DiaryListClass', 'leftdiaryclass.aspx', '');
            setDataList('addDClass');
            hiddens = "Yes";
         }
      }
   }
   )
}

function getNewDiaryClass()
{
   var txt = $("temp_title_list0");
   if(txt.value.length < 1)
   {
      alert("提示：日记本标题不能空。");
      txt.focus();
      return false;
   }
   var strurl = "newdiaryclass.aspx?title=" + escape(txt.value) + "&time=" + Ajax.getDatetime();
   getloading("正在添加日记本", "Yes");
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         var temps = sResult.responseText;
         if(temps != "True")
         {
            clearTimeout(times);
            getloading(temps, "Yes");
         }
         else
         {
            clearTimeout(times);
            getloading("添加日记本成功", "Yes");
            hiddens = "No";
            getHttpDate('RightDiary', 'classdiary.aspx', '');
            getHttpDate('DiaryListClass', 'leftdiaryclass.aspx', '');
            hiddens = "Yes";
         }
      }
   }
   )
}

String.prototype.Trim = function()
{
   return this.replace(/(^\s*)|(\s*$)/g, "");
}

function getDiaryClass(paraA, paraB)
{
   var o = $(paraA);
   var txt = $(paraA + "_title");
   var temp = '<ul id="tempEdit_' + paraA + '">'
   + '<li class="e_d_G">'
   + '   <input name="temp_title_' + paraA + '" type="text" value="' + txt.innerText.Trim() + '" maxlength=\"20\" />'
   + '   <input name="temp_titles_' + paraA + '" type="hidden" value="' + txt.innerText.Trim() + '" maxlength=\"20\" />'
   + '</li>'
   + '<li class="e_d_E">'
   + '   <input type="button" value=" 确定 " onclick="getDiaryClassEdit(\'' + paraA + '\',\'Yes\',\''+paraB + '\');" />'
   + '</li>'
   + '<li class="e_d_E">'
   + '   <input type="button" value=" 取消 " onclick="getDiaryClassEdit(\'' + paraA + '\',\'No\',\''+paraB + '\');" />'
   + '</li>'
   + '</ul>'
   ;
   o.innerHTML = temp;
}

function getDiaryClassEdit(paraA, paraB, paraC)
{
   var o = $("tempEdit_" + paraA);
   var txtA = $("temp_title_" + paraA);
   var txtB = $("temp_titles_" + paraA);
   if(txtA.value.length < 1 && paraB != "No")
   {
      alert("提示：日记本标题不能空。");
      txtA.focus();
      return false;
   }
   var temp = '<ul id="' + paraA + '">'
   + '   <li class="e_d_GA" id="' + paraA + '_title">'
   if(paraB != "No")
   {
      temp += txtA.value;
   }
   else
   {
      temp += txtB.value;
   }
   temp += '</li>'
   + '   <li class="e_d_H"><a href="javascript:void(0);">'
   + '       <img src="/themes/images/ico_widget3.gif" alt="编辑封面" onclick="getHttpDate(\'RightDiary\', \'coverdiary.aspx\', \'id=' + paraC + '\');"></a>'
   + '   </li>'
   + '   <li class="e_d_E"><a href="javascript:void(0);">'
   + '       <img src="/themes/images/wdly.gif" alt="编辑" onclick="getDiaryClass(\'' + paraA + '\',\'' + paraC + '\');" /></a>'
   + '   </li>'
   + '   <li class="e_d_E"><a href="javascript:void(0);">'
   + '       <img src="/themes/images/294.gif" alt="删除" onclick="getHttpDelClass(\'' + paraC + '\');" /></a>'
   + '   </li>'
   + '</ul>';
   o.innerHTML = temp;
   if(paraB != "No" && txtA != txtB)
   {
      var strurl = "writediaryclass.aspx?id=" + paraC + "&title=" + escape(txtA.value) + "&time="
      + Ajax.getDatetime();
      getloading("正在更新日记本", "Yes");
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            var temps = sResult.responseText;
            if(temps != "True")
            {
               clearTimeout(times);
               getloading(temps, "Yes");
            }
            else
            {
               clearTimeout(times);
               getloading("更新日记本成功", "Yes");
               hiddens = "No";
               getHttpDate('RightDiary', 'classdiary.aspx', '');
               getHttpDate('DiaryListClass', 'leftdiaryclass.aspx', '');
               hiddens = "Yes";
            }
         }
      }
      )
   }
}

function getUpdateDiary(paraA)
{
   var stitle = $("sname");
   var sbrief = $("sbrief");
   var sstate = getRadio('sstate', '是否显示封面');
   if(stitle.value.length < 1)
   {
      alert("提示：日记本标题不能空。");
      stitle.focus();
      return false;
   }
   if(sbrief.value.length < 1)
   {
      alert("提示：日记本简介不能空。");
      sbrief.focus();
      return false;
   }
   if(sbrief.value.length > 150)
   {
      alert("提示：日记本简介长度不能大于150个字符。");
      sbrief.value = sbrief.value.substring(0, 150);
      sbrief.focus();
      return false;
   }
   var strurl = "updatediarybooks.aspx?id=" + paraA + "&title=" + escape(stitle.value) + "&brief="
   + escape(sbrief.value) + "&state=" + sstate + "&tTime=" + Ajax.getDatetime();
   getloading("正在更新日记本", "Yes");
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         var temps = sResult.responseText;
         if(temps != "True")
         {
            clearTimeout(times);
            getloading(temps, "Yes");
         }
         else
         {
            clearTimeout(times);
            getloading("更新日记本成功", "Yes");
            hiddens = "No";
            getHttpDate('RightDiary', 'classdiary.aspx', '');
            getHttpDate('DiaryListClass', 'leftdiaryclass.aspx', '');
            hiddens = "Yes";
         }
      }
   }
   )
}

function checkdiary(paraA)
{
   var titles = $("title");
   var dclass = $("DClass");
   var sclass = $("SClass");
   var submits = $("submits");
   var dtag = $("dtag");
   if(titles.value.length < 1)
   {
      alert("提示：日记标题不能空。");
      titles.focus();
      return false;
   }
   if(dclass.value == "-1")
   {
      alert("提示：请选择日记分类。");
      dclass.focus();
      return false;
   }
   if(dtag.value.length < 1)
   {
      alert("提示：请填写TAG标签。");
      dtag.focus();
      return false;
   }
   submits.disabled = true;
   hiddens = "No";
   getloading("正在发表日记", "Yes");
   hiddens = "Yes";
   setTimeout("getHttpDate('RightDiary', 'listdiary.aspx', 'page=" + paraA + "&type=" + sclass.value
   + "');getHttpDate('DiaryListClass', 'leftdiaryclass.aspx', '');", 1500);
}

function addTages(txt)
{
   var o = $("dtag");
   var t = o.value.split(",");
   var s = "No";
   if(t.length < 10)
   {
      if(t[0] != "")
      {
         for(var i = 0; i < t.length; i ++ )
         {
            if(t[i] == txt)
            {
               s = "Yes";
               break;
            }
         }
         if(s != "Yes")
         {
            o.value += "," + txt;
         }
      }
      else
      {
         o.value += txt;
      }
   }
   else
   {
      alert("提示：标签超过最大长度。");
   }
}

function setTables(paraA)
{
   var A = $("A");
   var AT = $("AT");
   var B = $("B");
   var BT = $("BT");
   if(paraA != "B")
   {
      A.style.display = "block";
      AT.className = "active";
      B.style.display = "none";
      BT.className = "normal";
   }
   else
   {
      A.style.display = "none";
      AT.className = "normal";
      B.style.display = "block";
      BT.className = "active";
   }
}

function getloading(paraA, paraB)
{
   var o = $("loading_edit");
   o.style.left = "15px";
   o.style.top = (getScrollTop() + 30) + "px";
   o.innerHTML = '<ul><li><img src="/themes/images/loading.gif" alt="Loading" /></li><li>' + paraA + '...</li></ul>';
   if(paraB != "No")
   {
      o.style.display = "block";
      times = setTimeout("getloading('" + paraA + "','No')", 1000);
   }
   if(paraB != "Yes")
   {
      filtersOpacity();
   }
}

function filtersOpacity()
{
   clearTimeout(times);
   var o = $("loading_edit");
   temp += 3;
   o.filters.alpha.opacity = 100 - temp;
   if(temp < 100)
   {
      setTimeout("filtersOpacity()", 50);
   }
   else
   {
      o.style.display = "none";
      o.filters.alpha.opacity = 100;
      temp = 0;
   }
}
;

/* getPhoto.js */
var checkUrl = "/inc/photo_chk.inc.aspx";
var getPhotoUrl = "/inc/photo_show.inc.aspx";

function changeAlbumTitle(obj)
{
   var o = (obj != null) ? _$(obj) : this;
   var v = (o.innerText) ? o.innerText : o.textContent;
   o.old_value = v;
   o.innerHTML = "<input type='text' id='_mt' style='border:1px dashed #0099ff;font-size:14px;' value='"
   + v + "' size='12' maxlength='20' onblur='saveAlbumTitle(\""+o.id+"\",this.value);' onkeydown='mt_key"
   + "(this);' />";
   _$('_mt').focus();
   _$('_mt').select();
   o.onclick = "";
}

function reAlbumTitle(par, return_v)
{
   loading('close');
   if (return_v == "lost")
   {
      var o = _$(par);
      o.innerHTML = o.old_value;
   }
}

function saveAlbumTitle(obj_id, n_v)
{
   var o = _$(obj_id);
   if (n_v == "") n_v = escapeForXML(o.old_value);
   if(n_v.len() > 16)
   {
      alert("标题最多只能输入8个汉字！当前已输入" + n_v.len() + "个字");
      return false;
   }
   o.innerHTML = escapeForXML(n_v);
   o.onclick = changeAlbumTitle;
   if (n_v != o.old_value)
   {
      loading('open');
      var strurl = checkUrl + "?action=editalbumtitle&title=" + n_v + "&id=" + obj_id.split("_")[0]
      + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            reAlbumTitle();
         }
      }
      )
   }
}

function changePhotoTitle(obj)
{
   var o = (obj != null) ? _$(obj) : this;
   var v = (o.innerText) ? o.innerText : o.textContent;
   o.old_value = v;
   o.innerHTML = "<input type='text' id='_mt' style='border:1px dashed #0099ff;font-size:14px;' value='"
   + v + "' size='12' maxlength='20' onblur='savePhotoTitle(\""+o.id+"\",this.value);' onkeydown='mt_key"
   + "(this);' />";
   _$('_mt').focus();
   _$('_mt').select();
   o.onclick = "";
}

function savePhotoTitle(obj_id, n_v)
{
   var o = _$(obj_id);
   if (n_v == "") n_v = escapeForXML(o.old_value);
   if(n_v.len() > 16)
   {
      alert("标题最多只能输入8个汉字！当前已输入" + n_v.len() + "个字");
      return false;
   }
   o.innerHTML = escapeForXML(n_v);
   o.onclick = changeAlbumTitle;
   if (n_v != o.old_value)
   {
      loading('open');
      var strurl = checkUrl + "?action=editphototitle&title=" + n_v + "&id=" + obj_id.split("_")[0]
      + "&time=" + getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            reAlbumTitle();
         }
      }
      )
   }
}

function changePasterTitle(obj)
{
   var o = (obj != null) ? _$(obj) : this;
   var v = (o.innerText) ? o.innerText : o.textContent;
   o.old_value = v;
   o.innerHTML = "<input type='text' id='_mt' style='border:1px dashed #0099ff;font-size:14px;' value='"
   + v + "' size='12' maxlength='20' onblur='savePasterTitle(\""+o.id+"\",this.value);' onkeydown='mt_key"
   + "(this);' />";
   _$('_mt').focus();
   _$('_mt').select();
   o.onclick = "";
}

function savePasterTitle(obj_id, n_v)
{
   var o = _$(obj_id);
   if (n_v == "") n_v = escapeForXML(o.old_value);
   if(n_v.len() > 16)
   {
      alert("标题最多只能输入8个汉字！当前已输入" + n_v.len() + "个字");
      return false;
   }
   o.innerHTML = escapeForXML(n_v);
   o.onclick = changeAlbumTitle;
   if (n_v != o.old_value)
   {
      loading('open');
      var strurl = checkUrl + "?action=editPastertitle&title=" + n_v + "&id=" + obj_id.split("_")[0]
      + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            reAlbumTitle();
         }
      }
      )
   }
}

function psI(DIV, f, load)
{
   var o = _$(DIV);
   if(typeof o != 'undefined')
   {
      var a = "&pid=" + (f.pid ? f.pid.value : "");
      a += "&pwd=" + (f.pwd ? f.pwd.value : "");
      var v = (o.innerHTML) ? o.innerHTML : o.textContent;
      o.old_value = v;
      o.innerHTML = "<div align=center><br /><br /><img src=/public/images/loading.gif  border=0/> "
      + "数据处理中，请稍候 Loading... <br/><br/><br/></div>";
      var strurl = checkUrl + "?action=pwd&username=" + UserName + a + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            if(sResult.responseText == "true")
            {
               if(load)
               {
                  location.reload();
               }
               else
               {
                  new Ajax.Request(getPhotoUrl + "?username=" + UserName + a + "&time=" 
                  + Ajax.getDatetime(),
                  {
                     method : 'get',
                     onSuccess : function(sResult)
                     {
                        o.innerHTML = sResult.responseText;
                     }
                  }
                  )
               }
            }
            else o.innerHTML = o.old_value;
         }
      }
      )
   }
}

function mt_key(obj)
{
   evt = SearchEvent();
   if(evt.keyCode == 13)
   {
      obj.blur();
   }
}

function SearchEvent()
{
   if(document.all)
   return window.event;

   func = SearchEvent.caller;
   while(func != null)
   {
      var arg0 = func.arguments[0];
      if(arg0)
      {
         if(arg0.constructor == Event)
         return arg0;
      }
      func = func.caller;
   }
   return null;
}

function switchDiv(div_id)
{
   var style_sheet = getStyleObject(div_id);
   if (style_sheet)
   {
      hideAll(div_id);
      changeObjectVisibility(div_id, "visible", "static");
   }
   else
   {
      alert("sorry, this only works in browsers that do Dynamic HTML");
   }
}

function getStyleObject(objectId)
{
   if(document.getElementById && document.getElementById(objectId))
   {
      return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId))
   {
      return document.all(objectId).style;
   }
   else if (document.layers && document.layers[objectId])
   {
      return document.layers[objectId];
   }
   else
   {
      return false;
   }
}

function changeObjectVisibility(objectId, newVisibility, newPosition)
{
   var styleObject = getStyleObject(objectId);
   if (styleObject)
   {
      styleObject.visibility = newVisibility;
      styleObject.position = newPosition;
      return true;
   }
   else
   {
      return false;
   }
}

function hideAll(div_id)
{
   changeObjectVisibility(div_id, "hidden", "absolute");
}

function wallopen(URL)
{
   newwin = window.open('', '_blank', 'fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
   if(document.all)
   {
      newwin.moveTo(350, 200)
      newwin.resizeTo(320, 335);
   }
   newwin.location = URL
   newwin.focus();
}
;

/* VPlayer.js */
function MM_goToURL()
{
   var i, args = MM_goToURL.arguments;
   document.MM_returnValue = false;
   for (i = 0; i < (args.length - 1); i += 2) eval(args[i] + ".location='"+args[i+1]+"'");
}
;

function JM_cc(ob)
{
   var obj = MM_findObj(ob);
   if (obj)
   {
      obj.select();
      js = obj.createTextRange();
      js.execCommand("Copy");
   }
   alert("源文件地址复制成功！");
}
;

function MM_findObj(n, d)
{
   var p, i, x;
   if( ! d) d = document;
   if((p = n.indexOf("?")) > 0 && parent.frames.length)
   {
      d = parent.frames[n.substring(p + 1)].document;
      n = n.substring(0, p);
   }
   if( ! (x = d[n]) && d.all) x = d.all[n];
   for (i = 0; ! x && i < d.forms.length; i ++ ) x = d.forms[i][n];
   for(i = 0; ! x && d.layers && i < d.layers.length;
   i ++ ) x = MM_findObj(n, d.layers[i].document);
   if( ! x && document.getElementById) x = $(n);
   return x;
}
;

function MM_goToURL2()
{
   var i, args = MM_goToURL2.arguments;
   document.MM_returnValue2 = false;
   for (i = 0; i < (args.length - 1); i += 2) eval(args[i] + ".location='"+args[i+1]+"'");
}
;

function JM_cc2(ob)
{
   var obj = MM_findObj2(ob);
   if (obj)
   {
      obj.select();
      js = obj.createTextRange();
      js.execCommand("Copy");
   }
   alert("UBB代码复制成功！");
}
;

function MM_findObj2(n, d)
{
   var p, i, x;
   if( ! d) d = document;
   if((p = n.indexOf("?")) > 0 && parent.frames.length)
   {
      d = parent.frames[n.substring(p + 1)].document;
      n = n.substring(0, p);
   }
   if( ! (x = d[n]) && d.all) x = d.all[n];
   for (i = 0; ! x && i < d.forms.length; i ++ ) x = d.forms[i][n];
   for(i = 0; ! x && d.layers && i < d.layers.length;
   i ++ ) x = MM_findObj2(n, d.layers[i].document);
   if( ! x && document.getElementById) x = $(n);
   return x;
}
;

function MM_goToURL3()
{
   var i, args = MM_goToURL3.arguments;
   document.MM_returnValue3 = false;
   for (i = 0; i < (args.length - 1); i += 2) eval(args[i] + ".location='"+args[i+1]+"'");
}
;

function JM_cc3(ob)
{
   var obj = MM_findObj3(ob);
   if (obj)
   {
      obj.select();
      js = obj.createTextRange();
      js.execCommand("Copy");
   }
   alert("Html代码复制成功！");
}
;

function MM_findObj3(n, d)
{
   var p, i, x;
   if( ! d) d = document;
   if((p = n.indexOf("?")) > 0 && parent.frames.length)
   {
      d = parent.frames[n.substring(p + 1)].document;
      n = n.substring(0, p);
   }
   if( ! (x = d[n]) && d.all) x = d.all[n];
   for (i = 0; ! x && i < d.forms.length; i ++ ) x = d.forms[i][n];
   for(i = 0; ! x && d.layers && i < d.layers.length;
   i ++ ) x = MM_findObj3(n, d.layers[i].document);
   if( ! x && document.getElementById) x = $(n);
   return x;
}
;

var URLParams = new Object() ;
var aParams = document.location.search.substr(1).split('&') ;
for (i = 0 ; i < aParams.length ; i ++ )
{
   var aParam = aParams[i].split('=') ;
   URLParams[aParam[0]] = aParam[1] ;
}

if(URLParams.flvPath == null || URLParams.flvPath == undefined)
{
   URLParams.flvPath = "/player/gom.flv";
}

var swfObject = new Object();
var done = false;
var orginFlash =
{
   init : false, isFullScreen : false, position : "", top : "", left : "", width : "", height : ""
}
;

swfObject.src = "/player/player2.1.swf";
swfObject.version = 8;
swfObject.width = 490;
swfObject.height = 435;
swfObject.params = "";

function FlashPlayer(video_id)
{
   var azszplayer = new SWFObject(swfObject.src, "Flash_Player", swfObject.width,
   swfObject.height, swfObject.version, "#000000");
   azszplayer.addParam("quality", "high");
   azszplayer.addParam("FlashVars", "vid=" + video_id + "&curl=" + urlPath
   + "&ad=/player/start.swf&len=6");
   azszplayer.addParam("menu", "false");
   azszplayer.addParam("allowScriptAccess", "sameDomain");
   azszplayer.addParam("allowFullScreen", "true");
   azszplayer.write("Players");
}
;

function getScreenSize()
{
   var w = 0;
   var h = 0;
   if( typeof( window.innerWidth ) == 'number' )
   {
      w = window.innerWidth;
      h = window.innerHeight;
   }
   else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
   {
      w = document.documentElement.clientWidth;
      h = document.documentElement.clientHeight;
   }
   else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
   {
      w = document.body.clientWidth;
      h = document.body.clientHeight;
   }
   return { width : w, height : h };
}
;

function fullScreen()
{
   if( ! orginFlash.init)
   {
      orginFlash.position = $("Players").style.position;
      orginFlash.top = $("Players").style.top;
      orginFlash.left = $("Players").style.left;
      orginFlash.width = $("Players").style.width;
      orginFlash.height = $("Players").style.height;
   }
   orginFlash.init = true;
   orginFlash.isFullScreen = true;
   var screenSize = getScreenSize();
   try
   {
      $("Players").style.position = "absolute";
      $("Players").style.top = "0px";
      $("Players").style.left = "0px";
      $("Players").style.width = screenSize.width + "px";
      $("Players").style.height = screenSize.height + "px";
      document.body.style.overflow = "hidden";
      window.scrollTo(0, 0);
   }
   catch(e)
   {
      // alert(e.description);
   }
}
;

function normal()
{
   if(orginFlash.init)
   {
      orginFlash.isFullScreen = false;
      try
      {
         $("Players").style.position = orginFlash.position;
         $("Players").style.top = orginFlash.top;
         $("Players").style.left = orginFlash.left;
         $("Players").style.width = orginFlash.width;
         $("Players").style.height = orginFlash.height;
         document.body.style.overflow = "auto";
      }
      catch(e)
      {
         // alert(e.description);
      }
   }
}
;

function reSize()
{
   try
   {
      if(orginFlash.isFullScreen)
      {
         fullScreen();
      }
   }
   catch(e)
   {
      // alert(e.description);
   } 
}
;

window.onresize = reSize;

function players_b(video_id)
{
   $('Players_ad').style.display = 'none';
   if(share == "1")
   {
      FlashPlayer(video_id);
   }
   else
   {
      var playersHTML = "<form name=\"pwd_form\" onsubmit=\"return player_checkpwdform(this); \">"
      + "<strong>对不起，该用户没有共享本视频...</strong><br />"
      + "请在下面输入查看密码后观看......<br />"
      + "查看密码："
      + "<input name=\"view_vide_id\" value=\""+video_id+"\" type=\"hidden\" id=\"view_vide_id\">"
      + "<input name=\"pwd\" type=\"password\" id=\"pwd\" size=\"20\" maxlength=\"30\"><br />"
      + "<input type=\"submit\" name=\"Submit\" value=\"提交\">"
      + "&nbsp;&nbsp;"
      + "<input type=\"reset\" name=\"Submit2\" value=\"重置\"><br />"
      + "</form>";
      _$("Players").innerHTML = playersHTML;
   }
}
;

function player_checkpwdform(f)
{
   var w = f.pwd.value;
   var id = f.view_vide_id.value;
   if (w == "")
   {
      alert("对不起，请填写观看密码！");
      f.pwd.focus();
      return false;
   }
   var o = _$("Players");
   o.old_value = o.innerHTML;
   o.innerHTML = '<br /><br /><img src="/public/images/loading.gif" border="0">正在认证...<br /><br />';
   var strurl = "chkpwd_player.aspx?username=" + UserName + "&id=" + id + "&w=" + w + "&time="
   + Ajax.getDatetime();
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         if(sResult.responseText == "true")
         {
            FlashPlayer(id);
         }
         else
         {
            alert(sResult.responseText);
            o.innerHTML = o.old_value;
         }
      }
   }
   )
   return false;
}
;

function focuspingl()
{
   var pl = _$("reviewtext");
   pl.focus();
   pl.select();
}
;

function chktagsearch()
{
   if (document.tsearch_form.tagkey.value == "")
   {
      alert("对不起，请输入TAG标签！");
      document.tsearch_form.tagkey.focus();
      return false;
   }
   if (document.tsearch_form.tagkey.value == "请输入TAG标签")
   {
      alert("对不起，请输入TAG标签！");
      document.tsearch_form.tagkey.focus();
      return false;
   }
}
;

/* getVideoReview.js */
function VideoReview(f)
{
   var v = escapeForXML(trim(f.reviewtext.value));
   if(v.length < 1 || ! getStrLen(v, 150))
   {
      alert("评论字数限制在1~150个字符，请检查字符数量!");
      f.reviewtext.focus();
      return false;
   }
   var id = f.video_id.value;
   f.video_submit.value = "正在处理...";
   f.video_submit.disabled = true;
   var strurl = "inc/WriteVideoReview.aspx?username=" + UserName + "&id=" + id + "&v=" + v + "&time="
   + Ajax.getDatetime();
   new Ajax.Request(strurl,
   {
      method : 'get',
      onSuccess : function(sResult)
      {
         if(sResult.responseText == "true")
         {
            getXmlHttp('reviewlist', 'inc/AllVideoReview.aspx?id=' + id);
         }
         else
         {
            alert(sResult.responseText);
         }
         var oe = document.getElementById("reviewtext");
         getCountNumber(oe);
         f.reviewtext.value = "";
         f.video_submit.value = "发表评论";
         f.video_submit.disabled = false;
      }
   }
   )
   return false;
}
;

var checkUrl = "/inc/photo_chk.inc.aspx";
function changeVideoTitle(obj)
{
   var o = (obj != null) ? _$(obj) : this;
   var v = (o.innerText) ? o.innerText : o.textContent;
   o.old_value = v;
   o.innerHTML = "<input type='text' id='_mt' style='border:1px dashed #0099ff;font-size:14px;' value='"
   + v + "' size='12' maxlength='20' onblur='saveVideoTitle(\""+o.id+"\",this.value);' onkeydown="
   + "'mt_key(this);' />";
   _$('_mt').focus();
   _$j('_mt').select();
   o.onclick = "";
}
;

function reVideoTitle(par, return_v)
{
   loading('close');
   if (return_v == "lost")
   {
      var o = _$(par);
      o.innerHTML = o.old_value;
   }
}
;

function saveVideoTitle(obj_id, n_v)
{
   var o = _$(obj_id);
   if (n_v == "") n_v = escapeForXML(o.old_value);
   if(n_v.len() > 16)
   {
      alert("标题最多只能输入8个汉字！当前已输入" + n_v.len() + "个字");
      return false;
   }
   o.innerHTML = escapeForXML(n_v);
   o.onclick = changeVideoTitle;
   if (n_v != o.old_value)
   {
      loading('open');
      var strurl = checkUrl + "?action=editVideotitle&title=" + n_v + "&id=" + obj_id.split("_")[0]
      + "&time=" + Ajax.getDatetime();
      new Ajax.Request(strurl,
      {
         method : 'get',
         onSuccess : function(sResult)
         {
            reVideoTitle();
         }
      }
      )
   }
}
;

function mt_key(obj)
{
   evt = SearchEvent();
   if(evt.keyCode == 13)
   {
      obj.blur();
   }
}
;

function SearchEvent()
{
   if(document.all)
   return window.event;
   func = SearchEvent.caller;
   while(func != null)
   {
      var arg0 = func.arguments[0];
      if(arg0)
      {
         if(arg0.constructor == Event)
         return arg0;
      }
      func = func.caller;
   }
   return null;
}
;
/*   getmessage   */
function startDragLogin(handle)
{
   dragmove.init(handle);
}
;

var dragmove =
{
   body : null, style : null, x : null, y : null,
   init : function(sId)
   {
      if (event.button == 0 || event.button == 1)
      {
         dragobj = $(sId);
         var AppendDiv = document.getElementsByTagName("body").item(0);
         var attributeDiv = document.createElement("div");
         attributeDiv.setAttribute("id", "drag_effect");
         attributeDiv.style.position = "absolute";
         attributeDiv.style.zIndex = dragobj.style.zIndex-1;
         attributeDiv.style.zoldIndex = dragobj.style.zIndex;
         attributeDiv.onselectstart = function()
         {
            return false;
         }
         ;
         attributeDiv.style.display = "block";
         attributeDiv.style.top = parseInt(dragobj.style.top)-1+"px";
         attributeDiv.style.left = parseInt(dragobj.style.left)-1+"px";
         attributeDiv.style.border = "1px dashed #1D8302";
         attributeDiv.style.height = parseInt(dragobj.offsetHeight)+"px";
         attributeDiv.style.width = parseInt(dragobj.offsetWidth)+"px";
         attributeDiv.style.cursor = "move";
         AppendDiv.appendChild(attributeDiv);
         obj = $("drag_effect");
         body = Browser.isIE ?  document.documentElement : document.body;
         style = obj.style;
         x = event.clientX - parseInt(style.left);
         y = event.clientY - parseInt(style.top);
         Event.observe(body,"mousemove",drag.start);
         Event.observe(body,"mouseup",drag.end);
         Event.observe(body,"selectstart",drag.select);
         Event.stop(event);
      }
      return false;
   }
   ,
   select : function ()
   {
      return false;
   }
   ,
   start : function ()
   {
      if (event.button == 0 || event.button == 1)
      {
         style.left = (event.clientX - x) + "px";
         style.top = (event.clientY - y) + "px";
      }
      else
      {
         drag.end();
      }
      Event.stop(event);
   }
   ,
   end : function ()
   {
      style.cursor = "";
      dragobj.style.top = parseInt(obj.style.top)+1+"px";
      dragobj.style.left = parseInt(obj.style.left)+1+"px";
      obj.removeNode(true);
      Event.stopObserving(body,"mousemove",drag.start);
      Event.stopObserving(body,"mouseup",drag.end);
      Event.stopObserving(body,"selectstart",drag.select);
      Event.stop(event);
   }
}
;
function createXMLHttp()
{
    var http_request;
	if(window.XMLHttpRequest) { 
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType("text/xml");
		}
	}
	else if (window.ActiveXObject) { 
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) { 
		window.alert("can't create XMLHttpRequest object.");
		return null;
	}	
	return http_request;
};
function _sendx(a,aa,x,p,sendXML){
	var ab=createXMLHttp();
	if((!ab)&&!aa){
		var ll = new Image();
		ll.src=a;
		ll.onload = function(){aa(x,ab.responseText);};

	}else{
		//stTime1=(new Date()).getTime();
		ab.open((p?p:"GET"),a,true);//(p?true:false)
		if(aa){
		    //ab.status == 200
			ab.onreadystatechange=function(){if(ab.readyState==4){
				var v = ab.responseText;
				//stTime2=(new Date()).getTime();
				//window.status=""+v.length+"? ??"+(stTime2-stTime1)+"";
				aa(x,v);
				}};
			if(p) 
			{
			    ab.setRequestHeader("Method", "POST " + a + " HTTP/1.1");
			    //ab.setRequestHeader("Charset","GB2312");
			    ab.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8 ; ");
			}
		}
		ab.send((sendXML?sendXML:null));
	}
} ;
_pi = function(str) {
	return parseInt(str);
};
function getDataTime()
{
	var strDate,strTime;
	strDate = new Date();
	strTime = strDate.getTime();
	return strTime;
};
String.prototype.trim=function(){
	return this.replace(/^\s+|\s+$/,"");
};
String.prototype.len = function()
{
	return this.replace(/[^\x00-\xff]/g,"aa").length;
};

function getWidth()
{
	var strWidth;
	var clientWidth;
	var bodyWidth;
	clientWidth = document.documentElement.clientWidth;
	try{
	    bodyWidth = document.body.clientWidth;
	}catch(e){
	    bodyWidth = 0
	}
	if(bodyWidth > clientWidth){
		strWidth = bodyWidth + 20;
	} else {
		strWidth = clientWidth;
	}
	return strWidth;
};
function getHeight()
{
	var strHeight,eclientHeight,bodyHeight;
	eclientHeight = document.documentElement.clientHeight;
	bodyHeight = document.body.clientHeight;
	if(bodyHeight > eclientHeight){
		strHeight = bodyHeight + 30;
	} else {
		strHeight = eclientHeight;
	}
	return strHeight;
} ;
function getScrollTop()
{
	var scrollPos; 
    if (typeof window.pageYOffset != 'undefined') { 
       scrollPos = window.pageYOffset; 
    } 
    else if (typeof document.compatMode != 'undefined' && 
         document.compatMode != 'BackCompat') { 
       scrollPos = document.documentElement.scrollTop; 
    } 
    else if (typeof document.body != 'undefined') { 
       scrollPos = document.body.scrollTop; 
    }
    return scrollPos;
};
getPagePosition=function(_3f){
    var ret={
    }
    ;
    ret.scrollLeft=_3f.pageXOffset||_3f.document.documentElement.scrollLeft||_3f.document.body.scrollLeft||0;
    ret.scrollTop=_3f.pageYOffset||_3f.document.documentElement.scrollTop||_3f.document.body.scrollTop||0;
    ret.clientWidth=_3f.innerWidth||_3f.document.documentElement.clientWidth||_3f.document.body.clientWidth||0;
    ret.clientHeight=_3f.innerHeight||_3f.document.documentElement.clientHeight||_3f.document.body.clientHeight||0;
    return ret;
}
;
function DisplayDIV(xleft,xtop,div)
{
    var seltext = $(div);
    var scrollPos=getScrollTop();
    var alphat=50,clientX,clientY;
    try{
       clientX = event.clientX; 
    }catch(e){ clientX=300;}
    try{
       clientY = event.clientY; 
    }catch(e){ clientY=250;}
    
    var mleft = clientX + Number(xleft);
    var mtop = scrollPos+clientY + Number(xtop);
    var bodywidth=getWidth();
    var bodyheight=getHeight();
    if(mleft<=2) mleft=2;

    if(mleft+seltext.offsetWidth>bodywidth) mleft=bodywidth-seltext.offsetWidth;
    if(mtop<scrollPos) mtop = scrollPos;
    if(mtop+seltext.offsetHeight>bodyheight) mtop = bodyheight-seltext.offsetHeight;
    seltext.style.top=mtop+"px";
    seltext.style.left=mleft+"px";
    seltext.style.display = 'block';
};
function setCookie(name, value, days)
{
	$cookie(name, value, {expires:days,domain:"5lin.com"});
};

function getCookie(name) {
  return $cookie(name);
}
;
function deleteCookie(name) {
  setCookie(name, "",0);
}
;

$cookie = function(name, value, options) {
    if (typeof value != 'undefined') {
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        };
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString();
        };
        var path = options.path ? '; path=' + options.path : '';
        var domain = options.domain ? '; domain=' + options.domain : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else {
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var search = name + "=";
            var offset = document.cookie.indexOf(search); 
            if (offset != -1) {
                offset += search.length ;
                end = document.cookie.indexOf(";", offset);
                if (end == -1) end = document.cookie.length;
                end = document.cookie.indexOf("&", offset);
                if (end == -1) end = document.cookie.length;
                var cookieValue = document.cookie.substring(offset, end);
                if(cookieValue.indexOf(";")!=-1)
                {
                    cookieValue = cookieValue.substring(0,cookieValue.indexOf(";"));
                };
             };
        };
        
        return decodeURIComponent(cookieValue);
    };
};

function toSCPXML(CommandXML,AppXML)
{
		var xmlns = getXMLNS();
		
		var respxml="<?xml version=\"1.0\" encoding=\"GB2312\"?>\n\n";
		respxml=respxml+"<scp "+xmlns+">\n";
		respxml=respxml+"   <command><action>API:"+CommandXML+"\n";
		respxml=respxml+"   </action></command>\n";
		respxml=respxml+"   <security>"+AppXML+"\n";
		respxml=respxml+"   </security>\n";
		respxml=respxml+"</scp>";
		return respxml;
};

function getXMLNS()
{
		var xmlns = "xmlns=\"urn:scp:params:xml:ns:scp-3.0\"	\n\n";
		xmlns=xmlns+ " xmlns:domain=\"urn:5lin.com:domain\"	\n\n";
		xmlns=xmlns+ " xmlns:contact=\"urn:5lin.com:contact\"	\n\n";
		xmlns=xmlns+ " xmlns:registrant=\"urn:5lin.com:registrant\"	\n\n";
		xmlns=xmlns+ " xmlns:host=\"urn:5lin.com:host\"";
		return xmlns;
};

function getCode(responseXML)
{
	var code="";
	start_pos = responseXML.indexOf("<result code=");

	if(start_pos>0)
		code = responseXML.substring(start_pos + 14, start_pos + 18);

	return code;
};
function getMessage(CutXml,svalue)
{
	key = svalue;
	str1 = "<"+svalue+">";
	str2 = "</"+svalue+">";
	start_pos = CutXml.toLowerCase().indexOf(str1.toLowerCase())+str1.length;
	if( start_pos > 0 )
	{
		over_pos = CutXml.toLowerCase().indexOf(str2.toLowerCase());
		resValue = CutXml.substring(start_pos, over_pos);
	}
	
	return resValue;
};
