// JavaScript Document
var kg;   //select game list 1 close 0 open
kg=1;
var money_n='USD';
var money_p=1;
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 onlyNum()
{
 if ( !(window.event.keyCode >= 48 && window.event.keyCode <= 57) )
 {
  window.event.keyCode = 0 ;
 }
}

function AddBookMark(){ 
var aurl,atitle;
aurl = "http://www.igsstar.com";
atitle = "Internet Game Service Star"; 
window.external.AddFavorite(aurl,atitle); 
}

function suborderform_one(){
var s = document.getElementsByName("aserver");
var f = document.getElementsByName("afaction");
var as=0;
var af=0;
if (document.all('package') != null){
	for(var i=0;i<document.orderform_one.package.length;i++)   //check the package includes information
		{
			if (document.orderform_one.package[i].value==""){
			alert('Please Input Package Information');
			document.orderform_one.package[i].focus();
			return false;
			}
		}
	}




if (document.orderform_one.firstname.value==""){
	alert('Please Input Your firstname');
	document.orderform_one.firstname.focus();
	return false;
}

if (document.orderform_one.lastname.value==""){
	alert('Please Input Your lastname');
	document.orderform_one.lastname.focus();
	return false;
}

if (document.orderform_one.phone.value==""){
	alert('Please Input Your phone');
	document.orderform_one.phone.focus();
	return false;
}

if (document.orderform_one.email.value==""){
	alert('Please Input Your email');
	document.orderform_one.email.focus();
	return false;
}


if (document.orderform_one.account.value==""){
	alert('Please Input Your Account Username');
	document.orderform_one.account.focus();
	return false;
}
if (document.orderform_one.password.value==""){
	alert('Please Input Your Account Password');
	document.orderform_one.password.focus();
	return false;
}
if (document.orderform_one.character.value==""){
	alert('Please Input Your Character Name');
	document.orderform_one.character.focus();
	return false;
}
if (document.orderform_one.aclass.options[document.orderform_one.aclass.selectedIndex].value==""){
	alert('Please Select Class');
	document.orderform_one.aclass.focus();
	return false;
}
for (var i=0; i<s.length; i++)
        if(s[i].checked) as=1;
if (as==0){
	alert('Please Select Server');
	return false;	
}
if (document.orderform_one.realm.value==""){
	alert('Please Input Your Realm Name');
	document.orderform_one.realm.focus();
	return false;
}
for (var j=0; j<f.length; j++)
        if(f[j].checked) af=1;
if (af==0){
	alert('Please Select Faction');
	return false;	
}
}

function suborderform_two(){
var s = document.getElementsByName("aserver");
var f = document.getElementsByName("afaction");
var as=0;
var af=0;
if (document.orderform_two.price.value==""){
	alert('Please Select Your Current Level and desired level.');
	document.orderform_two.price.focus();
	return false;
}

if (document.orderform_two.firstname.value==""){
	alert('Please Input Your firstname');
	document.orderform_two.firstname.focus();
	return false;
}

if (document.orderform_two.lastname.value==""){
	alert('Please Input Your lastname');
	document.orderform_two.lastname.focus();
	return false;
}

if (document.orderform_two.phone.value==""){
	alert('Please Input Your phone');
	document.orderform_two.phone.focus();
	return false;
}

if (document.orderform_two.email.value==""){
	alert('Please Input Your email');
	document.orderform_two.email.focus();
	return false;
}

if (document.orderform_two.eta.value==""){
	alert('Please Select Your Current Level and desired level.');
	document.orderform_two.eta.focus();
	return false;
}
if (document.orderform_two.startlevel.options[document.orderform_two.startlevel.selectedIndex].value==""){
	alert('Please Select Current Level');
	document.orderform_two.startlevel.focus();
	return false;
}
if (document.all('package') != null){
	for(var i=0;i<document.orderform_two.package.length;i++)   //check the package includes information
		{
			if (document.orderform_two.package[i].value==""){
			alert('Please Input Package Information');
			document.orderform_two.package[i].focus();
			return false;
			}
		}
	}
if (document.orderform_two.account.value==""){
	alert('Please Input Your Account Username');
	document.orderform_two.account.focus();
	return false;
}
if (document.orderform_two.password.value==""){
	alert('Please Input Your Account Password');
	document.orderform_two.password.focus();
	return false;
}
if (document.orderform_two.character.value==""){
	alert('Please Input Your Character Name');
	document.orderform_two.character.focus();
	return false;
}
if (document.orderform_two.aclass.options[document.orderform_two.aclass.selectedIndex].value==""){
	alert('Please Select Class');
	document.orderform_two.aclass.focus();
	return false;
}
for (var i=0; i<s.length; i++)
        if(s[i].checked) as=1;
if (as==0){
	alert('Please Select Server');
	return false;	
}
if (document.orderform_two.realm.value==""){
	alert('Please Input Your Realm Name');
	document.orderform_two.realm.focus();
	return false;
}
for (var j=0; j<f.length; j++)
        if(f[j].checked) af=1;
if (af==0){
	alert('Please Select Faction');
	return false;	
}
}

function suborderform_three(){
var s = document.getElementsByName("aserver");
var f = document.getElementsByName("afaction");
var as=0;
var af=0;
if (document.all('package') != null){
	for(var i=0;i<document.orderform_three.package.length;i++)   //check the package includes information
		{
			if (document.orderform_three.package[i].value==""){
			alert('Please Input Package Information');
			document.orderform_three.package[i].focus();
			return false;
			}
		}
	}
	
if (document.orderform_three.qty.value==""){
	alert('Please Input Qty');
	document.orderform_three.qty.focus();
	return false;
}

if (document.orderform_three.account.value==""){
	alert('Please Input Your Account Username');
	document.orderform_three.account.focus();
	return false;
}
if (document.orderform_three.character.value==""){
	alert('Please Input Your Character Name');
	document.orderform_three.character.focus();
	return false;
}
if (document.orderform_three.aclass.options[document.orderform_three.aclass.selectedIndex].value==""){
	alert('Please Select Class');
	document.orderform_three.aclass.focus();
	return false;
}
for (var i=0; i<s.length; i++)
        if(s[i].checked) as=1;
if (as==0){
	alert('Please Select Server');
	return false;	
}
if (document.orderform_three.realm.value==""){
	alert('Please Input Your Realm Name');
	document.orderform_three.realm.focus();
	return false;
}
for (var j=0; j<f.length; j++)
        if(f[j].checked) af=1;
if (af==0){
	alert('Please Select Faction');
	return false;	
}
}

function suborderform_four(){
if (document.orderform_four.qty.value==""){
	alert('Please Input Qty');
	document.orderform_four.qty.focus();
	return false;
}
}

function suborderform_six(){
var s = document.getElementsByName("aserver");
var as=0;
var af=0;
if (document.all('package') != null){
	for(var i=0;i<document.orderform_six.package.length;i++)   //check the package includes information
		{
			if (document.orderform_six.package[i].value==""){
			alert('Please Input Package Information');
			document.orderform_six.package[i].focus();
			return false;
			}
		}
	}

if (document.orderform_six.account.value==""){
	alert('Please Input Your Account Username');
	document.orderform_six.account.focus();
	return false;
}
if (document.orderform_six.password.value==""){
	alert('Please Input Your Account Password');
	document.orderform_six.password.focus();
	return false;
}
if (document.orderform_six.character.value==""){
	alert('Please Input Your Character Name');
	document.orderform_six.character.focus();
	return false;
}
if (document.orderform_six.aclass.options[document.orderform_six.aclass.selectedIndex].value==""){
	alert('Please Select Class');
	document.orderform_six.aclass.focus();
	return false;
}
for (var i=0; i<s.length; i++)
        if(s[i].checked) as=1;
if (as==0){
	alert('Please Select Server');
	return false;	
}
if (document.orderform_six.realm.value==""){
	alert('Please Input Your Realm Name');
	document.orderform_six.realm.focus();
	return false;
}
}


function  checkmail(mail)
{
	var  strr;
	re=/(\w+\.{0,1}\w*)(@\w+\.\w+)(\.{0,1}\w*)(\.{0,1}\w*)/i;
	re.exec(mail);
	if  (RegExp.$3!=""&&RegExp.$3!="."&&RegExp.$2!=".")
		strr=RegExp.$1+RegExp.$2+RegExp.$3
	else
		if  (RegExp.$2!=""&&RegExp.$2!=".")  
			strr=RegExp.$1+RegExp.$2
		else
			strr=RegExp.$1
	if  (strr!=mail)
		{
			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.options[document.signup.country.selectedIndex].value=="") str=str+'*Please select 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.options[document.changeinfo.country.selectedIndex].value=="") str=str+'*Please select 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;
}
}

function select_game_k(){
if(kg==0){
	kg=1;
document.getElementById("select_game").style.display='none';
}
else
{
	kg=0
	document.getElementById("select_game").style.display='';
	}
}

function chk_forder(){
if(document.fastorder.s3.options[document.fastorder.s3.selectedIndex].value==0){
alert('please choose the product first!');
return false;
}
return true;
}

function change_us(){
$('sp_us_a').className = 'sp_h';
$('sp_eu_a').className = 'sp_s';
$('sp_c_eu').style.display = 'none';
$('sp_c_us').style.display = '';
}

function change_eu(){
$('sp_us_a').className = 'sp_s';
$('sp_eu_a').className = 'sp_h';
$('sp_c_us').style.display = 'none';
$('sp_c_eu').style.display = '';
}

function sp_null(){
	;
}

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;
}	
}