function ShowNav(id) {

   // var v_left = (document.body.clientWidth - document.getElementById(id).clientWidth) / 2;
  //  var v_top = (document.body.clientHeight - document.getElementById(id).clientHeight) / 2;

    document.getElementById(id).style.left = 15 + "px";
    document.getElementById(id).style.top = 20 + "px";
    
    document.getElementById(id).style.display = 'block';

}

function HideNav(id){
    document.getElementById(id).style.display='none';
}

function IsCharNum(s) 
{ 
    var patrn=/[a-zA-Z0-9]+[a-zA-Z0-9_]+/; 
    if (!patrn.exec(s)) return false; 
    return true;
} 

function IsNum(s) 
{ 
    var patrn=/[1-9]+[0-9_]?/; 
    if (!patrn.exec(s)) return false; 
    return true;
} 

function IsValidEMail(s) 
{ 
    var patrn=/(\S)+[@]{1}(\S)+[.]{1}(\w)+/; 
    if (!patrn.exec(s)) return false; 
    return true;
} 

function GoPage(id,file,bigPage,smallClassID)
{
        txtPage=document.getElementById(id);
        if(txtPage.value=="")
        {
            alert("ÇëÊäÈëÒ³Âë!");
            txtPage.focus();
            return;
        }
        if(!IsNum(txtPage.value))
        {
            alert("ÇëÊäÈëÊý×Ö!"+txtPage.value);
            txtPage.focus();
            return;
        }
        window.location=file+"&page="+txtPage.value+"&BigPage="+bigPage+"&SmallClassID="+smallClassID;
        
}

function TopicGoPage(id,file,bigPage,TID)
{
        txtPage=document.getElementById(id);
        if(txtPage.value=="")
        {
            alert("ÇëÊäÈëÒ³Âë!");
            txtPage.focus();
            return;
        }
        if(!IsNum(txtPage.value))
        {
            alert("ÇëÊäÈëÊý×Ö!"+txtPage.value);
            txtPage.focus();
            return;
        }
        window.location=file+"&page="+txtPage.value+"&BigPage="+bigPage+"&ID="+TID;
        
}

function  getParam(name){   
          var   reg   =   new   RegExp("(^|&)"+   name   +"=([^&]*)(&|$)");   
          var   r   =   window.location.search.substr(1).match(reg);   
          if   (r!=null)   return   unescape(r[2]);   return   null;   
 }   
 
 function InsertIcon(id,dir,img)
 {
     o=document.getElementById(id);
     o.value=o.value+"[icon|"+dir+"|"+img+"/]";
 }


 //ÅÐ¶ÏÊÇ·ñÊÇÊý×ÖºÍ×ÖÄ¸µÄ×éºÏ
 function isChrandNum(cCharacter) {
     for (ilen = 0; ilen < cCharacter.length; ilen++) {
         if (cCharacter.charAt(ilen) < '0' || cCharacter.charAt(ilen) > '9') {
             if (cCharacter.charAt(ilen) < 'a' || cCharacter.charAt(ilen) > 'z') {
                 if (cCharacter.charAt(ilen) < 'A' || cCharacter.charAt(ilen) > 'Z')
                     return false;
             }
         }
     }
     return true;
 }


 function checkStr(str) {
     //     [\u4E00-\uFA29]|[\uE7C7-\uE7F3]ºº×Ö±àÂë·¶Î§
     var re1 = new RegExp("^([\u4E00-\uFA29]|[\uE7C7-\uE7F3]|[a-zA-Z0-9])*$");
     if (!re1.test(str)) {
       return false;
     }
     return true;
 }
