function cinValidation(cin){
	if ( trimmer(cin.value).length == 0){
		alert(M_cinempty);
		cin.value="";
		cin.focus();
		return false;
	}
	return true;
}
function cinRegValidation(cin){

	if ( cin.value.length == 0 ){
		alert(M_cinempty);
		cin.focus();
		return false;
	}
	var reg = /[ \-]+/g;
	var test = cin.value;
	test = test.replace(reg,"");
	if (test.length < 14 || (cin.value!="" && cin.value.length<14)) {
		alert(M_cinlength);
		cin.focus();
		return false;
	}
	reg = /[^0-9 \-]+/;
	test=reg.test(cin.value);
	if(test){
		alert(M_cin);
		cin.focus();
		return false;
	}
	return true;
}
function pinValidation(pin){
	if ( trimmer(pin.value).length == 0){
		alert(M_pinempty);
		pin.value="";
		pin.focus();
		return false;
	}
	return true;
}
function accountNumberValidation(acct){
	if ( trimmer(acct.value).length == 0 ){
		alert(M_acctnumempty);
		acct.value="";
		acct.focus();
		return false;
	}
	return true;
}
function accountNumberRegValidation(acct){
	if ( trimmer(acct.value).length == 0){
		alert(M_acctnumempty);
		acct.value="";
		acct.focus();
		return false;
	}
	return true;
}
function usernameValidation(username){
	if ( username != null && trimmer(username.value).length == 0){
		alert(M_unameempty);
		username.value="";
		username.focus();
		return false;
	}
	return true;
}
function usernameRegValidation(username){
	var a = /[^(0-9a-zA-Z@_.)]/;
	if(username.value.length == 0){
		alert(M_unameempty) ;
		username.focus();
		return false;
	}
	if(username.value.length<3 || username.value.length>50){
		alert(M_unamelength) ;
		username.focus();
		return false;
	}
	if( a.test(username.value) ){
		alert(M_uname) ;
		username.focus();
		return false;
	}
	return true;
}
function passwordValidation(password){
	if ( trimmer(password.value).length == 0){
		alert(M_pwdempty);
		password.value="";
		password.focus();
		return false;
	}
	return true;
}
function passwordRegValidation(password){
	var reg0 = /(.{1,1})\1\1/;
	var reg1 = /([A-Za-z])/;
	var reg2 = /([0-9])/;

	if(password.value.length==0){
		alert(M_pwdempty) ;
		password.focus();
		return false;
	}
	if(password.value.length<6 || password.value.length>50){
		alert(M_pwdlength) ;
		password.focus();
		return false;
	}
	if( !(reg1.test(password.value) && reg2.test(password.value)) ){
		alert(M_pwd) ;
		password.focus();
		return false;
		}
	if( reg0.test(password.value) ){
		alert(M_pwd2) ;
		password.focus();
		return false;
	}
	return true;
}
function validateEmail(email){
	var a = /^[^\s^@]+@[^\s^\.]+(\.[^\s^\.]+)+$/;
	if( email.value.length == 0 ){
		alert(M_emailempty) ;
		email.focus();
		return false ;
	}
	if(!a.test(email.value)){
		alert(M_email) ;
		email.focus();
		return false ;
	}
	return true ;
}
function trimmer(tmp){
    var reTrimRight = / +$/;
    var reTrimLeft = /^ +/;
    tmp = tmp.replace( reTrimRight, "" );
    tmp = tmp.replace( reTrimLeft, "" );
	return tmp;
}
function isBlank(str){
    if ( trimmer(str.value).length == 0){
        str.focus();
        return true;
    }
    return false;
}


