﻿// JScript 文件
function getOs()
{
   if(navigator.userAgent.indexOf("MSIE")>0)return 1;
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)return 2;
   if(isSafari=navigator.userAgent.indexOf("Safari")>0)return 3;   
   if(isCamino=navigator.userAgent.indexOf("Camino")>0)return 4;
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0)return 5;
   return 0;
}
//添加收藏夹
function AddFavorite()
{
   switch(getOs())
   {
       case 1:window.external.addFavorite(webURL,webName);break;
       case 2:window.sidebar.addPanel(webName, webURL, "");break;
   } 
}
//打印时间
function writeDatetime()
{
    var d = new Date().toLocaleString().split(' ');
    document.write(d[0] + " " + d[1]);
}
//校正高度
function adjustHeight(id1,id2)
{
    if($(id1).height() >= $(id2).height())
    {
        $(id2).height($(id1).height());
    }
    else
    {
        $(id1).height($(id2).height());
    }
}
/********************************************
给字符串增加截空格的方法
********************************************/
String.prototype.trim = function() 
{ 
    return this.replace(/(^\s*)|(\s*$)/g, ""); 
} 

String.prototype.ltrim = function() 
{ 
    return this.replace(/(^\s*)/g, ""); 
} 

String.prototype.rtrim = function() 
{ 
    return this.replace(/(\s*$)/g, ""); 
}