function check_email1 ( email , name  )
{
	if( name == ''){
		name = "E-mail";
	} else {
		name = name;
	}
	var len = email.length;
	if(len==0)
		return "Your "+ name + " address can not be a blank!\n";
	for(var i=0;i<len;i++)
	{
		var c= email.charAt(i);
		if(!((c>="A"&&c<="Z")||(c>="a"&&c<="z")||(c>="0"&&c<="9")||(c=="-")||(c=="_")||(c==".")||(c=="@")))
			return "Your "+name+" address is the only figure in English letters and symbols'-','_' and other symbols are not used !\n";
		}
		if((email.indexOf("@")==-1)||(email.indexOf("@")==0)||(email.indexOf("@")==(len-1)))
			return "Your " + name + " address incomplete !\n";
		if((email.indexOf("@")!=-1)&&(email.substring(email.indexOf("@")+1,len).indexOf("@")!=-1))
			return "Your " + name + " address incomplete !\n";
		if((email.indexOf(".")==-1)||(email.indexOf(".")==0)||(email.lastIndexOf(".")==(len-1)))
			return "Your " + name + " address incomplete !\n";
			return "";
}

function check_null ( column, name )
{
if( column.length == 0 )
return name + " can not be a blank !\n";
return "";
}
function check_select ( select, name )
{
if( select.options[0].selected == true )
return name + " must choose !\n";
return "";
}

function check_radio1 ( radio_name, name )
{
	var radio = document.getElementsByName(radio_name);
	var error = true;
	for( i=0; i <radio.length; i++ )
	if( radio[i].checked == true ) {
		error = false;
		break;
	}
	if( error == true )
	return name + " must choose !\n";
	return "";
}

function check_radio ( radio, name )
{
var error = true;
for( i=0; i <radio.length; i++ )
if( radio[i].checked == true ) {
error = false;
break;
}
if( error == true )
return name + "must choose !\n";
return "";
}
function check_passwd ( pw1, pw2 )
{
if( pw1 == '' ) {
	return ("Your passwd can not be a blank!\n");
}
for( var idx = 0 ; idx <pw1.length ; idx++ ) {
	if( pw1.charAt(idx) == ' ' || pw1.charAt(idx) == '\"' ) {
		return ("Password can't be null or \"\" marks !\n");
	}
	if(!((pw1.charAt(idx) >= "a" && pw1.charAt(idx) <= "z")||(pw1.charAt(idx) >= "0" && pw1.charAt(idx) <= "9"))){
        return "nly english letters or numbers for password!\n";
    }
}	
if( pw1.length < 6 || pw1.length > 12 )
	return( "6 to 12 letters for password length !\n" );
if( pw1 != pw2 )
	return("Password and comfirm password aren't the same!\n");
	return "";
}

function edit_check_passwd ( pw1, pw2 , value)
{
	if( value == pw1 &&  pw2 == value){
		return "";	
	}
	
	if( pw1 == '' ) {
		return ("Your passwd can not be a blank!\n");
	}
	
	for( var idx = 0 ; idx <pw1.length ; idx++ ) {
		if( pw1.charAt(idx) == ' ' || pw1.charAt(idx) == '\"' ) {
			return ("Password can't be null or \"\" marks !\n");
		}
		if(!((pw1.charAt(idx) >= "a" && pw1.charAt(idx) <= "z")||(pw1.charAt(idx) >= "0" && pw1.charAt(idx) <= "9"))){
			return "only english letters or numbers for password!\n";
		}
	}	
	
	if( pw1.length < 6 || pw1.length > 12 )
		return( "6 to 12 letters for password length !\n" );
	
	if( pw1 != pw2 )
		return("Password and comfirm password aren't the same!\n");
		return "";	
}

function check_nan( num ,name )
{
	if( Math.round( new Number(num) ) < 1 ) 
		return name + "No less than 1!\n";
	else
		return "";
}

function check_number_YN( number , name )
{
var error = false;
if( number.length <= 0 )
	return name + "Not a blank !\n";
for( idx = 0 ; idx <number.length ; idx++ ) {
	if( !( number.charAt(idx)>= '0' && number.charAt(idx) <= '9' ) ) {
		error = true;
		break;
	}
}

if( error == true )
	return name + "Only figures, the other symbols are not used !\n";
else
	return "";
}
