function mm_openbrwindow ( theurl, winname, features )
{
window.open( theurl, winname, features );
}
function check_uid ( uid )
{
if( uid.length <= 0 )
return( "Account Required !\n" );

//if( uid.indexOf( "kimo" )>= 0 || uid.indexOf( "yahoo" )>= 0 )
//return( "您的帳號不能含有 'kimo' 與 'yahoo' 的字眼 !\n" );
return "";
}
function check_oldID ( uid )
{
if( uid.length <= 0 )
return( "您的帳號還沒填呢 !\n" );
if( uid.length> 32 )
return( "您的帳號長度只能小於 32 個字元 !\n" );
for( idx = 0 ; idx <uid.length ; idx++ )
{
if( uid.charAt(idx)>= 'A' && uid.charAt(idx) <= 'Z' )
return( "帳號不可以含有大寫字元 !\n" );
if( !( ( uid.charAt(idx)>= 'a' && uid.charAt(idx) <= 'z' ) || ( uid.charAt(idx)>= '0' && uid.charAt(idx) <= '9' ) || ( uid.charAt(idx) == '_' ) || ( uid.charAt(idx) == '-' ) || ( uid.charAt(idx) == '.' ) ) )
return( "您的帳號只能是數字,英文字母及「_」「-」「.」等符號,其他的符號都不能使用 !\n" );
}
return "";
}
function check_passwd ( pw1, pw2 )
{
if( pw1 == '' ) {
return ("Password Required !\n");
}
for( var idx = 0 ; idx <pw1.length ; idx++ )
if( pw1.charAt(idx) == ' ' || pw1.charAt(idx) == '\"' )
return ("Password  !\n");
if( pw1 != pw2 )
return("Not the same as the second input the password, please re-enter!\n");
return "";
}
function check_ht ( ht )
{
if( ht == '' )
return( "密碼提示不可以空白 !\n" );
return "";
}
function check_telephonenumber ( number )
{
var error = false;
if( number.length <= 0 ) 
return "連絡電話不可為空白 !\n";
for( idx = 0 ; idx <number.length ; idx++ ) {
if( !( ( number.charAt(idx)>= '0' && number.charAt(idx) <= '9' ) || ( number.charAt(idx) == '-' ) ) ) {
error = true;
break;
}
}
if( number.length <= 5 )
return "連絡電話輸入不完全 !\n";

if( error == true )
return "您的連絡電話只能是數字及'-'等符號, 其他的符號都不能使用 !\n";
return "";

}
function check_mobile ( number )
{
var error = false;
if( number.length <= 0 ) 
return "Mobile !\n";
for( idx = 0 ; idx <number.length ; idx++ ) {
if( !( ( number.charAt(idx)>= '0' && number.charAt(idx) <= '9' ) || ( number.charAt(idx) == '-' ) ) ) {
error = true;
break;
}
}
if( number.length < 10 )
return "行動電話輸入不完全 !\n";

if( error == true )
return "您的行動電話只能是數字及'-'等符號, 其他的符號都不能使用 !\n";
return "";

}
function check_email ( email, emop )
{
var alt = check_radio( emop, "聯絡信箱" );
if( alt.length> 0 )
return alt;
var len = email.length;
if( emop[1].checked == true && len == 0 )
return "您的聯絡信箱選擇備用電子信箱, 所以備用電子信箱不可以空白 !\n";
var ck =0;
if(len==0)
return "";
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 "E-Mail Illegal !\n";
}
if((email.indexOf("@")==-1)||(email.indexOf("@")==0)||(email.indexOf("@")==(len-1)))
return "E-Mail Illegal !\n";
if((email.indexOf("@")!=-1)&&(email.substring(email.indexOf("@")+1,len).indexOf("@")!=-1))
return "E-Mail Illegal !\n";
if((email.indexOf(".")==-1)||(email.indexOf(".")==0)||(email.lastIndexOf(".")==(len-1)))
return "E-Mail Illegal !\n";
var idx = email.indexOf("@");
var name = email.substring( 0, idx );
var domain = email.substring( idx+1, email.length).toLowerCase();
email = name + "@" + domain;
return "";
}
function check_amail ( email )
{
var len = email.length;
//if( emop.type == "checkbox" ) {
if( len == 0 )
return "E-Mail Required !\n";
//}
if(len==0)
return "";
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 "E-Mail Illegal !\n";
}
if((email.indexOf("@")==-1)||(email.indexOf("@")==0)||(email.indexOf("@")==(len-1)))
return "E-Mail Illegal !\n";
if((email.indexOf("@")!=-1)&&(email.substring(email.indexOf("@")+1,len).indexOf("@")!=-1))
return "E-Mail Illegal !\n";
if((email.indexOf(".")==-1)||(email.indexOf(".")==0)||(email.lastIndexOf(".")==(len-1)))
return "E-Mail Illegal !\n";
return "";
}
function check_email1 ( email )
{
var len = email.length;
if(len==0)
return "";
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 "E-Mail Illegal !\n";
}
if( email == "tw-abuse@yahoo-inc.com" )
return "E-Mail Illegal ! !\n";
if((email.indexOf("@")==-1)||(email.indexOf("@")==0)||(email.indexOf("@")==(len-1)))
return "E-Mail Illegal ! !\n";
if((email.indexOf("@")!=-1)&&(email.substring(email.indexOf("@")+1,len).indexOf("@")!=-1))
return "E-Mail Illegal ! !\n";
if((email.indexOf(".")==-1)||(email.indexOf(".")==0)||(email.lastIndexOf(".")==(len-1)))
return "E-Mail Illegal ! !\n";
return "";
}

function check_zip ( column )
{
if( column.length == 0 )
return "Post Code Required!\n";
if(isNaN(column))
return "Post Code Illegal !\n";
return "";
}

function check_null ( column, name )
{
if( column.length == 0 )
return name + " Required !\n";
return "";
}
function check_select ( select, name )
{
if( select.options[0].selected == true )
return name + " Required !\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 + " Required !\n";
return "";
}
function check_birthday_year( year )
{
var error = false;
if( year.length != 4 )
return ("4 number please !\n");
for( idx = 0 ; idx <year.length ; idx++ ) {
if( !( year.charAt(idx)>= '0' && year.charAt(idx) <= '9' ) ) {
error = true;
break;
}
}
if( error == true )
return ("4 number please!\n");
return "";
}
function check_mobilephone ( number, radio )
{
var alt = check_radio( radio, "Mobile Phone" );
if( alt.length> 0 )
return alt;
var error = false;
if( radio[1].checked == true ) {
if( number.length <= 0 )
return "Mobile Phone Required !\n";
if( number.length >= 24 )
return "Mobile Phone Illegal !\n";
for( idx = 0 ; idx <number.length ; idx++ ) {
if( !( number.charAt(idx)>= '0' && number.charAt(idx) <= '9' ) && number.charAt(idx)!='-' && number.charAt(idx)!='+' ) {
error = true;
break;
}
}
}
if( error == true )
return "Mobile Phone Illegal\n";
else
return "";
}

