

function checkSpecial(str)
{
	var SPECIAL_STR = "~!@%^&*();'\"?><[]{}\\|,:/=+—“”‘";
	for(i=0;i<str.length;i++)
		if (SPECIAL_STR.indexOf(str.charAt(i)) !=-1){
		return true;
	}
	return false;
}


function isRegisterUserName(s)
{
    var patrn=/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}$/;
    if (!patrn.exec(s)) return false
    return true
}



function isPasswd(s)
{
    var patrn=/^(\w){6,20}$/;
    if (!patrn.exec(s)) return false
    return true
}



function isTel(s)
{
    //var patrn=/^[+]{0,1}(\d){1,3}[ ]?([-]?(\d){1,12})+$/;
    var patrn=/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/;
    if (!patrn.exec(s)) return false
    return true
}


function isMobil(s)
{
    var patrn=/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/;
    if (!patrn.exec(s)) return false
    return true
}


function isPostalCode(s)
{
    //var patrn=/^[a-zA-Z0-9]{3,12}$/;
    var patrn=/^[a-zA-Z0-9 ]{3,12}$/;
    if (!patrn.exec(s)) return false
    return true
}


function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;

}



function back() {
   javascript:history.go(-1);
}



function checkIsNotEmpty(str)
{
    if(str.trim() == "")
        return false;
    else
        return true;
}


function noshow(name,error){
	var names=document.getElementById(name);
	var errors=document.getElementById(error);
	errors.innerHTML='';
	names.className="";	
}

function show(name,error,msg)
{
	var names=document.getElementById(name);
	var errors=document.getElementById(error);
	var alertinfo=document.getElementById("alert-info");
	errors.innerHTML=msg;
	errormessage = errormessage+'<li>'+msg;
	
	alertinfo.innerHTML=errormessage+'</ui>';
	sub = false;
}


function partSpace(s)
{
    var len = s.length;
    var i;
    var ch;
    var result = "";
    i = 0;
    while (i < len){
        ch = s.charAt(i++);
        result += ch;
        if (ch == ' '){
            return true;
        }
    }
    return false;
}


function ischina(s){
    if(s.match(/[\u0391-\uFFE5]/ig)){
    	return true	
    }
    return false;
}


function re(){
	var alertinfo=document.getElementById("alert-info");
	alertinfo.style.display="none";	
	noshow('user','usernameerror');
	noshow('pass','passerror');
	noshow('mail','mailerror');
	noshow('code','codeerror');
    document.forms[0].username.value ="";
    document.forms[0].password.value ="";
    document.forms[0].email.value ="";
    document.forms[0].Rand.value ="";
    document.forms[0].passworded.value ="";
	document.forms[0].lost.checked=false;
	document.forms[0].subform.disabled="disabled";
}














