String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
String.prototype.isNumeric=function(){return this.match(/^[+-]?\d*[.]?\d*$/gi)!=null;}
String.prototype.isInteger=function(){return this.match(/^[+-]?\d*$/gi)!=null;}
String.prototype.isEmail=function(){return this.match(/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/gi)!=null;}
String.prototype.hasGB = function(){return this.match(/^(.*)([^\x00-\xff])(.*)$/gi)!=null;}
String.prototype.isValidLoginId=function()
{
	//是否是合法的登录Id,字母开头(6-32)
	return this.match(/^[a-zA-Z][a-zA-Z0-9_]{5,32}$/gi)!=null;
}
String.prototype.isValidPassword=function()
{
	//是否是合法的密码(字母或者数字特殊符号以及6-32位)
	return this.match(/^[\x00-\x19\x21-\xff]{5,32}$/gi)!=null;
}

String.prototype.byteLength=function()
{
   return this.replace(/[^\x00-\xff]/gi,'xx').length;
}
String.prototype.round=function(n)
{
	return parseFloat(this).toFixed(n);
}
function $(eltId,doc){if(!doc)doc=document;return doc.getElementById(eltId);};
function $$(tagName,doc){if(!doc)doc=document;return doc.createElement(tagName);};
var __IsIE=navigator.userAgent.toLowerCase().indexOf("msie")>-1;

//对mozilla不支持replaceNode 和 removeNode的修正 
if(window.Node)
{
    HTMLElement.prototype.replaceNode=function(Node)
    {
        this.parentNode.replaceChild(Node,this);
    }
    HTMLElement.prototype.removeNode=function()
    {
        this.parentNode.removeChild(this)
    }
}

