function openWin(url,width,height){
	window.open(url,'_blank',"width="+width+",height="+height+",status=no,toolbar=no,menubar=no,location=no,resizable=no,left=100,top=100");
}

String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

function checkName(nameId,showstr){//英文字母和数字组合，长度在4—16个字符之间
	 var name=document.getElementById(nameId);
	 var patrn=/^[a-zA-Z0-9]{4,16}$/; 
	 if(name.value.trim()==''){
		alert(showstr);
		name.focus();
		return false;
	 }
	 return true;
	 
}


function checkPassword(passwordId,showstr){//长度在5—12位之间，英文字母和数字的组合 
	 var password=document.getElementById(passwordId);
	 var patrn=/^[a-zA-Z0-9]{4,12}$/; 
	 if(!patrn.exec(password.value.trim())){
		alert(showstr);
		password.focus();
		return false;
	 }
	 return true;
}

function validatePassword(passwordId,passwordId2,showstr){//密码和确认密码不一致 
	 var password=document.getElementById(passwordId);
	 var password2=document.getElementById(passwordId2); 
	 if(password.value.trim()!=password2.value.trim()){
		alert(showstr);
		password2.focus();
		return false;
	 }
	 return true;
}


function checkEmail(mailId,showstr)//email不能为空或格式不正确！
{
	 var mail=document.getElementById(mailId);
	 var patrn=/^([a-zA-Z0-9._-]+)@([a-zA-Z0-9_-]+)(\.[a-zA-Z0-9_-]+)(\.*[a-zA-Z0-9_-]*)$/; 
	 if(!patrn.exec(mail.value.trim())){
		alert(showstr);
		mail.focus();
		return false;
	 }
	
	return true;
}

function checkEmpty(fieldId,showstr)//email不能为空或格式不正确！
{
	 var field=document.getElementById(fieldId);
	 if(field.value.trim().length==0){
		alert(showstr);
		field.focus();
		return false;
	 }
	
	return true;
}

function parseString(str)
    {
    	str = str.replace(/['><\n\r"]/g, "");
    	return str;
    }

function CopyInBoard(hahaUrl) 
	{
		window.clipboardData.setData('text',hahaUrl)
		alert('网址已经成功复制到剪切版!');			
	}