﻿
//删除字符串两端的空白
String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
};

//获取链接参数字符串
function getQueryStringRegExp(name) 
{     
    var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i");       
    if (reg.test(location.href)) 
    {
        return unescape(RegExp.$2.replace(/\+/g, " ")); 
    }
    return "";
}

//转换指定Ie版本高度，heigheig(IE6标准)指定传入来的高度        
function cHeight6(heig)
{
   var browser = new Browser();
   var myHeight=heig;
   if(browser.version>=7)
   {
        myHeight-=45;
   }
   return myHeight;
}

//检测浏览器版本号
 function Browser() {
   var ua, s, i;
   this.isIE     = false;   // Internet Explorer
   this.isNS     = false;   // Netscape
   this.version = 0;
   ua = navigator.userAgent;

   s = "MSIE";
   if ((i = ua.indexOf(s)) >= 0) {
     this.isIE = true;
     this.version = parseFloat(ua.substr(i + s.length));
     return;
   }

   s = "Netscape6/";
   if ((i = ua.indexOf(s)) >= 0) {
     this.isNS = true;
     this.version = parseFloat(ua.substr(i + s.length));
     return;
   }
   s = "Gecko";
   if ((i = ua.indexOf(s)) >= 0) {
     this.isNS = true;
     this.version = 6.1;
     return;
   }
}

//显示用户资料
function UserShow(userId)
{
    var param = "?userid="+userId+"&time="+new Date().getTime();    
    var ret =showModalDialog("../User/UserShow.aspx"+param,null,"dialogWidth:600px;dialogHeight:"+cHeight6(270)+"px;center:yes;resizable:no;scroll:no;status:yes;");
}  
