function $(obj)
{
   return document.getElementById(obj);
}
String.prototype.trim= function()  
{  
    // 用正则表达式将前后空格  
    // 用空字符串替代。  
    return this.replace(/(^\s*)|(\s*$)/g, "");  
}
String.prototype.endsWith = function(str) {
    return this.substr(this.length - str.length) == str;
}
//添加元素, 如果已经存在则不添加, 返回元素下标
Array.prototype.addUnique=function(value){
        var index = this.findIndex(value);
        if(index>-1){
            return index;
        }else{
            index = this.length;
            this[index]=value;
            return index;
        }
    }
    //查找数组元素, 返回元素下标
Array.prototype.findIndex=function(value){
        var index=-1;
        for(var i=0;i<this.length;i++){
            if(this[i]===value) {
                index=i;
                break;
            }
        }
        return index;
    } 
    //删除数组元素, 并返回元素下标
Array.prototype.deleteByValue=function(value){
        var index = this.findIndex(value);
        if(index>-1){
            this.splice(index,1);
        }
        return index;
    }
    
function onLoginSubmit2(){
    var username=document.getElementById("username2");
    var pwd=document.getElementById("password2");
	if(username.value==""){
		alert("用户名不能为空");
		return false;
	}
	if(pwd.value==""){
		alert("密码不能为空");
		return false;
	}
	return true;
}
function onLoginSubmit1(){
    var username=document.getElementById("username1");
    var pwd=document.getElementById("password1");
	if(username.value==""){
		alert("用户名不能为空");
		return false;
	}
	if(pwd.value==""){
		alert("密码不能为空");
		return false;
	}
	return true;
}
function ShowIframe(url)
		{
            var pop=new Popup({ contentType:1,scrollType:'no',isReloadOnClose:false,width:380,height:200});
            pop.setContent("contentUrl",url);
            pop.setContent("title","信息");
            pop.build();
            pop.show();
        }

