function openWindow(url, name, width, height) {
window.open( url, name, 'toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,scrollbars=yes,width='+width+',height='+height+',top=30,left=230');
}
function CheckNumber(Obj,DescriptionStr)
{
    if (Obj.value!='' && (isNaN(Obj.value) || Obj.value<0))
    {
        alert(DescriptionStr+"只允许为数字！");
        Obj.value="";
        Obj.focus();
    }
}
function CheckEnglishStr(Obj,DescriptionStr)
{
    var TempStr=Obj.value,i=0,ErrorStr='',CharAscii;
    if (TempStr!='')
    {
        for (i=0;i<TempStr.length;i++)
        {
            CharAscii=TempStr.charCodeAt(i);
            if (CharAscii>=255||CharAscii<=31)
            {
                ErrorStr=ErrorStr+TempStr.charAt(i);
            }
            else
            {
                if (!CheckClassErrorStr(CharAscii))
                {
                    ErrorStr=ErrorStr+TempStr.charAt(i);
                }
            }
        }
        if (ErrorStr!='')
        {
            alert(DescriptionStr+'非法字符：'+ErrorStr);
            Obj.focus();
            return false;
        }
        if (!(((TempStr.charCodeAt(0)>=48)&&(TempStr.charCodeAt(0)<=57))||((TempStr.charCodeAt(0)>=65)&&(TempStr.charCodeAt(0)<=90))||((TempStr.charCodeAt(0)>=97)&&(TempStr.charCodeAt(0)<=122))))
        {
            alert(DescriptionStr+'首字符必须为数字或字母！');
            Obj.focus();
            return false;
        }
    }
    return true;
}
function stopError() {
return true;
          }
window.onerror = stopError;
function chkselect(s,divid)
{
var divname='Issubport';
var chkreport;
    s=Number(s)
    if (divid=="knowmail")
    {
    divname=divname+s;
    }
    if (divid=="knowupload")
    {
    s+=4;
    if (s==1003){s=999;}
    divname=divname+s;
    }
    if (divid=="knowpreview")
    {
    s+=9;
    if (s==1008){s=999;}
    divname=divname+s;
    }
document.getElementById(divid).innerHTML=divname;
chkreport=document.getElementById(divname).innerHTML;
document.getElementById(divid).innerHTML=chkreport;
}
function fIsNumber (sV,sR){
var sTmp;
if(sV.length==0){ return (false);}
for (var i=0; i < sV.length; i++){
sTmp= sV.substring (i, i+1);
if (sR.indexOf (sTmp, 0)==-1) {return (false);}
}
return (true);
}
function doHighlight(elementName)
{
var defaultBGcolor="#eee";
var defaultFGcolor="#000";
var hoverBGcolor="#eff";
var hoverFGcolor="#006";
for (var i=0;i<whatTag(elementName).length;i++)
    {
    var currentEl=whatTag(elementName)[i];
    if (document.getElementById)
        {
        currentEl.onfocus=function(){this.style.backgroundColor=hoverBGcolor;this.style.color=hoverFGcolor;};
        currentEl.onblur=function(){this.style.backgroundColor=defaultBGcolor;this.style.color=defaultFGcolor;};
        }
    }
}
function highlightFormInput()
{
doHighlight("INPUT");
doHighlight("TEXTAREA");
doHighlight("SELECT");
}
function whatTag(tagName)
{
var value=document.getElementByTagName?document.getElementByTagName(tagName):document.all.tags(tagName);
    return value;
}
var notAlpha    = /[^a-z \-\.\,']/gi;
var isEmail     = /^\w(\.?[\w-])*@\w(\.?[\w-])*\.[a-z]{2,6}(\.[a-z]{2})?$/i;
var isDecimal   = /^\d+(\.\d+)?$/;
function ConfirmDel()
{
   if(confirm("确定删除吗？"))
     return true;
   else
     return false;
}
function ConfirmDel2()
{
   if(confirm("确定删除吗？"))
     return true;
   else
     return false;
}
function ConfirmUpdate()
{
   if(confirm("确定更新吗？"))
     return true;
   else
     return false;
}
function ConfirmNoDel()
{
   if(confirm("由于有下属栏目或内容无法删除！"))
     return true;
   else
     return false;
}
function swap_tab(n){
    for(var i=1;i<=2;i++){
        var curC=document.getElementById("tab_"+i);
        var curB=document.getElementById("tab_t"+i);
        if(n==i){
            curC.style.display="block";
            curB.className="active"
        }else{
            curC.style.display="none";
            curB.className="normal"
        }
    }
}
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
var con=document.getElementById("con_"+name+"_"+i);
menu.className=i==cursel?"hover":"";
con.style.display=i==cursel?"block":"none";
}
}
function copyToClipboard(txt) {
     if(window.clipboardData) {
             window.clipboardData.clearData();
             window.clipboardData.setData("Text", txt);
     } else if(navigator.userAgent.indexOf("Opera") != -1) {
          window.location = txt;
     } else if (window.netscape) {
          try {
               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
          } catch (e) {
               alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'。");
          }
          var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
          if (!clip)
               return;
          var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
          if (!trans)
               return;
          trans.addDataFlavor('text/unicode');
          var str = new Object();
          var len = new Object();
          var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
          var copytext = txt;
          str.data = copytext;
          trans.setTransferData("text/unicode",str,copytext.length*2);
          var clipid = Components.interfaces.nsIClipboard;
          if (!clip)
               return false;
          clip.setData(trans,null,clipid.kGlobalClipboard);
     }
alert("已复制！请用“Ctrl+V”粘贴到需要的位置。") ;
}
function clearform()
{
    var   aa   =   document.getElementsByTagName("input")
    for   (var   i=0;   i<aa.length;   i++)
    {
        if   (aa[i].type   !=   "button" && aa[i].type   !=   "submit" && aa[i].type   !=   "hidden")aa[i].value=""
    }
    var   aa   =   document.getElementsByTagName("textarea")
    for   (var   i=0;   i<aa.length;   i++)
    {aa[i].value="";}
}