function check_email1 ( email )
{
var len = email.length;
if(len==0)
return "電子信箱不可以空白 !\n";
//return "您的聯絡信箱選擇備用電子信箱, 所以備用電子信箱不可以空白 !\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 "您的電子郵件地址只能是數字,英文字母及'-','_'等符號,其他的符號都不能使用 !\n";
}
if((email.indexOf("@")==-1)||(email.indexOf("@")==0)||(email.indexOf("@")==(len-1)))
return "您的電子郵件地址不合法 !\n";
if((email.indexOf("@")!=-1)&&(email.substring(email.indexOf("@")+1,len).indexOf("@")!=-1))
return "您的電子郵件地址不合法 !\n";
if((email.indexOf(".")==-1)||(email.indexOf(".")==0)||(email.lastIndexOf(".")==(len-1)))
return "您的電子郵件地址不完全 !\n";
return "";
}

function check_null ( column, name )
{
if( column.length == 0 )
return name + " 不能為空白 !\n";
return "";
}
function check_select ( select, name )
{
if( select.options[0].selected == true )
return name + " 不能為空白 !\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 + " 必須選擇 !\n";
return "";
}
function check_passwd ( pw1, pw2, ac )
{
if( pw1 == '' ) {
return ("密碼不可以空白 !\n");
}
for( var idx = 0 ; idx <pw1.length ; idx++ ) {
var c= pw1.charAt(idx);
if(!((c>="A"&&c<="Z")||(c>="a"&&c<="z")||(c>="0"&&c<="9")))
return "您的密碼只能是數字及英文字母,其他的符號都不能使用 !\n";
}	
if( pw1 == ac )
return( "密碼與帳號不可相同 !\n" );
if( pw1.length < 5 || pw1.length > 15 )
return( "密碼長度只能 5 到 15 個字母 !\n" );
if( pw1 != pw2 )
return("密碼二次輸入不一樣,請重新輸入 !\n");
return "";
}
function check_nan( num ,name )
{
	if( Math.round( new Number(num) ) < 1 ) 
		return name + "不能設定小於1!\n";
	else
		return "";
}
function check_id ( id)
{
if( id == '' ) {
return ("帳號不可以空白 !\n");
}
if(!(id.charAt(0).match(/[a-z]/) || id.charAt(0).match(/[A-Z]/))) return ("帳號第一個字必須使用英文 \n");
if( id.length < 4 || id.length > 15 ) return( "帳號長度只能 4 到 15 個位元 !\n" );
for( var idx = 0 ; idx <id.length ; idx++ ) {
	if( id.charAt(idx) == ' ' || id.charAt(idx) == '\"' ) {
		return ("帳號不可以含有空白或雙引號 !\n");
	}
	var c= id.charAt(idx);
	if(!((c>="A"&&c<="Z")||(c>="a"&&c<="z")||(c>="0"&&c<="9")||(c=="-")||(c=="_"))){
        return "請輸入限用英文，數字組合的帳號!\n";
    }
}	
return "";
}

function check_number_YN( number , name )
{
var error = false;
if( number.length <= 0 )
return name + " 不能為空白 !\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 + "只能是數字, 其他的符號都不能使用 !\n";
else
return "";
}