// JavaScript Document
function logfs(){
if(document.login.email.value=='E-mail Addr:')
document.login.email.value='';
if(document.login.pswd.value=='password')
document.login.pswd.value='';
}

function $(id) {
	return document.getElementById(id);
}

function getXMLRequester( )
{ var xmlhttp_request = false;
try
{ if( window.ActiveXObject )
{ for( var i = 5; i; i-- ){
try{
if( i == 2 )
{ xmlhttp_request = new ActiveXObject( "Microsoft.XMLHTTP" ); }
else
{ xmlhttp_request = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" );
xmlhttp_request.setRequestHeader("Content-Type","text/xml");
xmlhttp_request.setRequestHeader("Content-Type","utf8"); }
break;}
catch(e){ xmlhttp_request = false; } } }
else if( window.XMLHttpRequest )
{ xmlhttp_request = new XMLHttpRequest();
if (xmlhttp_request.overrideMimeType)
{ xmlhttp_request.overrideMimeType('text/xml'); } } }
catch(e){ xmlhttp_request = false; }
return xmlhttp_request ; }

function power_check(){
var str;
str='';
if(document.power_form.firstname.value==''){
str='please input your First Name\n';
}
if(document.power_form.lastname.value==''){
str=str+'please input your Last Name\n';
}
if(document.power_form.email.value==''){
str=str+'please input your E-mail\n';
}
else
{
patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!patrn.test(document.power_form.email.value)){
str=str+'your E-mail addr format error\n';
}
}

if(document.power_form.phone.value==''){
str=str+'please input your phone\n';
}

if(document.power_form.account.value==''){
str=str+'please input your account\n';
}
if(document.power_form.pswd.value==''){
str=str+'please input your password\n';
}
if(document.power_form.pswd2.value==''){
str=str+'please confirm your password\n';
}
if(document.power_form.pswd.value!=document.power_form.pswd2.value){
str=str+'your password confirm error\n';
}
if(document.power_form.class1.value==''){
str=str+'please input your character class\n';
}
if(document.power_form.character.value==''){
str=str+'please input your character name\n';
}
if(document.power_form.server.value==''){
str=str+'please input your server\n';
}

if(str!=''){
	str='Warning:\n---------------------------------\n\n'+str;
	alert(str);
	return false;
	}
else
{
return true;
}	
}

function g_check(){
var str;
str='';
if(document.g_form.firstname.value==''){
str='please input your First Name\n';
}
if(document.g_form.lastname.value==''){
str=str+'please input your Last Name\n';
}
if(document.g_form.email.value==''){
str=str+'please input your E-mail\n';
}
else
{
patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!patrn.test(document.g_form.email.value)){
str=str+'your E-mail addr format error\n';
}
}

if(document.g_form.phone.value==''){
str=str+'please input your phone\n';
}


if(document.g_form.character.value==''){
str=str+'please input your character name\n';
}


if(str!=''){
	str='Warning:\n---------------------------------\n\n'+str;
	alert(str);
	return false;
	}
else
{
return true;
}	
}

function signup_check(){
var str;
var sexn = document.getElementsByName("sex");
var sexz=0;
for(var i=0;i<sexn.length;i++)
	if(sexn[i].checked) sexz=1;
str='';
if(sexz==0) str=str+'*Please select your gender\n';
if(document.signup.firstname.value=='') str=str+'*Please input your First Name\n';
if(document.signup.lastname.value=='') str=str+'*Please input your Last Name\n';
if (document.signup.b_month.options[document.signup.b_month.selectedIndex].value=="") str=str+'*Please select your Birth Month\n';
if (document.signup.b_day.options[document.signup.b_day.selectedIndex].value=="") str=str+'*Please select your Birth Day\n';
if (document.signup.b_year.options[document.signup.b_year.selectedIndex].value=="") str=str+'*Please select your Birth Year\n';
if(document.signup.email.value=='') str=str+'*Please input your E-mail Address\n';
if(document.signup.email.value!=''){
if(checkmail(document.signup.email.value)!=true) str=str+'*Your E-mail Address is not legitimacy\n';
}
if(document.signup.street.value=='') str=str+'*Please input your Street Address\n';
if(document.signup.postcode.value=='') str=str+'*Please input Post Code\n';
if(document.signup.city.value=='') str=str+'*Please input City\n';
if (document.signup.country.value=='') str=str+'*Please input your Country\n';
if(document.signup.state.value=='') str=str+'*Please input State/Province\n';
if(document.signup.tele.value=='') str=str+'*Please input Your Telephone Number\n';
if(document.signup.password.value=='') str=str+'*Please input Your Password\n';
if(document.signup.password1.value=='') str=str+'*Please input Confirm Password\n';
if((document.signup.password.value!='')&&(document.signup.password1.value!='')){
if(document.signup.password.value!=document.signup.password1.value)str=str+'*The password confirmation must match your password\n';
}
if(str!=''){
str='Please input all Required Information, Error:              \n\n'+str;
alert(str);
return false;
}
}

function infoedit_check(){
var str;
var sexn = document.getElementsByName("sex");
var sexz=0;
for(var i=0;i<sexn.length;i++)
	if(sexn[i].checked) sexz=1;
str='';
if(sexz==0) str=str+'*Please select your gender\n';
if(document.changeinfo.firstname.value=='') str=str+'*Please input your First Name\n';
if(document.changeinfo.lastname.value=='') str=str+'*Please input your Last Name\n';
if (document.changeinfo.b_month.options[document.changeinfo.b_month.selectedIndex].value=="") str=str+'*Please select your Birth Month\n';
if (document.changeinfo.b_day.options[document.changeinfo.b_day.selectedIndex].value=="") str=str+'*Please select your Birth Day\n';
if (document.changeinfo.b_year.options[document.changeinfo.b_year.selectedIndex].value=="") str=str+'*Please select your Birth Year\n';

if(document.changeinfo.street.value=='') str=str+'*Please input your Street Address\n';
if(document.changeinfo.postcode.value=='') str=str+'*Please input Post Code\n';
if(document.changeinfo.city.value=='') str=str+'*Please input City\n';
if (document.changeinfo.country.value=="") str=str+'*Please input your Country\n';
if(document.changeinfo.state.value=='') str=str+'*Please input State/Province\n';
if(document.changeinfo.tele.value=='') str=str+'*Please input Your Telephone Number\n';

if(str!=''){
str='Please input all Required Information, Error:              \n\n'+str;
alert(str);
return false;
}
}

function repswd_check(){
var str;
var sexn = document.getElementsByName("sex");
var sexz=0;
for(var i=0;i<sexn.length;i++)
	if(sexn[i].checked) sexz=1;
str='';
if(document.changepassword.ps1.value=='') str=str+'*Please input Your currently Password\n';
if(document.changepassword.ps2.value=='') str=str+'*Please input Your new Password\n';
if(document.changepassword.ps3.value=='') str=str+'*Please input Your confirm new Password\n';
if((document.changepassword.ps2.value!='')&&(document.changepassword.ps3.value!='')){
if(document.changepassword.ps2.value!=document.changepassword.ps3.value)str=str+'*The new password confirmation must match your new password\n';
}

if(str!=''){
str='Please input all Required Information, Error:              \n\n'+str;
alert(str);
return false;
}
}