// JavaScript Document
function addme(){ 
var nome_sito = "www.power4wow.com"; 
var url_sito = "http://www.power4wow.com";
if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt
	(navigator.appVersion) >= 4))
	window.external.AddFavorite(url_sito, nome_sito);
else if (navigator.appName == "Netscape")
	window.sidebar.addPanel(nome_sito, url_sito, '');
else
	alert("Sorry! Cann't Add this site to your favorite! Please use IE or Firefox");
}

function SetHome(obj,vrl){
        try{
                obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
        }
        catch(e){
                if(window.netscape) {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                        }
                        catch (e) {
                                alert("This action was refused by firefox \n Please enter about:config and press enter \n Change the value of [signed.applets.codebase_principal_support],\n Let it becames to 'true',Double click it,All done!");
                        }
                        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                        prefs.setCharPref('browser.startup.homepage',vrl);
                 }
        }
}

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 showatoz(a){
	for(var i=0;i<26;i++){
		$('atoz_'+String.fromCharCode(65+i)).style.display = 'none';
		$('aatoz_'+String.fromCharCode(65+i)).className = 'atoz';
	}
	$('atoz_'+a).style.display = '';
	$('aatoz_'+a).className = 'satoz';
}

function show_list_zheny(svalue){
	if(svalue==0||svalue==null || svalue==''){
		return false;
		}
var ssa;
var ssb;
var sa = new Array();
var sb = new Array();
var dw;
var str;
var price;
str='';
servername=document.fastorder.s_sl.options[document.fastorder.s_sl.selectedIndex].text;
ssa=document.fastorder.count_str.value;
sa=ssa.split('|');
dw=sa[sa.length-1];
	for(var i=0;i < sa.length-1;i++)
	{
	ssb=sa[i];
	sb=ssb.split(':');
	price=sb[0]*sb[1]*svalue;
	price_show=price*money_p;
	price_show=price_show.toFixed(2);
	if(i%2==0){
		str_class=" class='one_list_gold'";
		
		}else{
			str_class='';
			}
	str=str + '<tr'+' '+str_class+'><td class="gold_cout">' + sb[0] + ' ' + dw + '</td><td class="gold_servername"> ' +servername + ' </td><td class="gold_price" > ' + money_n + price_show  + '</td> <td ><a href="#" onclick="buygold(' + price + ',' + sb[0] + ')"><img src="/images/buy-now.gif"  border="0" /></a></td>'+'</tr>'
	}
	
var jq = jQuery.noConflict();
jq("#gold_tb").find("tr td").detach();

jq("#gold_tb").append("<tr><td colspan='4' align='center'><img src='/images/loading.gif'/>'</td></tr>");

setTimeout(function(){jq("#gold_tb").find("tr td").detach();jq("#gold_tb").append(str);},1000);
}




function showlistzheny(svalue){
	if(svalue==0||svalue==null || svalue==''){
		return false;
		}
var ssa;
var ssb;
var sa = new Array();
var sb = new Array();
var dw;
var str;
var price;
str='';
servername="Aegwynn US - Alliance";
ssa=document.count_str.gcount.value;
sa=ssa.split('|');
dw=sa[sa.length-1];
	for(var i=0;i < sa.length-1;i++)
	{
	ssb=sa[i];
	sb=ssb.split(':');
	price=sb[0]*sb[1]*svalue;
	price_show=price*money_p;
	price_show=price_show.toFixed(2);
	if(i%2==0){
		str_class=" class='one_list_gold'";
		
		}else{
			str_class='';
			}
	str=str + '<tr'+' '+str_class+'><td class="gold_cout">' + sb[0] + ' ' + dw + '</td><td class="gold_servername"> ' +servername + ' </td><td class="gold_price" > ' + money_n + price_show  + '</td> <td ><a href="#" onclick="buygold(' + price + ',' + sb[0] + ')"><img src="/images/buy-now.gif"  border="0" /></a></td>'+'</tr>'
	}
	
var jq = jQuery.noConflict();
jq("#gold_tb").find("tr td").detach();

jq("#gold_tb").append("<tr><td colspan='4' align='center'><img src='/images/loading.gif'/>'</td></tr>");

setTimeout(function(){jq("#gold_tb").find("tr td").detach();jq("#gold_tb").append(str);},1000);
}





function buygold(price,count){
if(document.fastorder.s_gl.options[document.fastorder.s_gl.selectedIndex].value==0){
	alert('please select your game');
	return false;
}else
{
		if(document.fastorder.s_sl.options[document.fastorder.s_sl.selectedIndex].value==0){
			alert('please select your server');
			return false;
		}}
		servername=document.fastorder.s_sl.options[document.fastorder.s_sl.selectedIndex].text;
document.fastorder.servername.value=servername
document.fastorder.price.value=price;
document.fastorder.count.value=count;
document.fastorder.submit();
}


function fastordersubmit(){
var str;
var gp;
if(document.fastorder.s_gl.options[document.fastorder.s_gl.selectedIndex].value==0){
	alert('please select your game');
}
else
{
		if(document.fastorder.s_sl.options[document.fastorder.s_sl.selectedIndex].value==0){
			alert('please select your server');
		}
		else
		{
				str=document.fastorder.s_pl.options[document.fastorder.s_pl.selectedIndex].value;
				gp=str.split(':');
				if(gp[0]==0 || gp[1]==0){
					alert('please select your product');
				}
				else
				
					{
					document.fastorder.game_id.value=document.fastorder.s_gl.options[document.fastorder.s_gl.selectedIndex].value;
					document.fastorder.servername.value=document.fastorder.s_sl.options[document.fastorder.s_sl.selectedIndex].text;
					//document.fastorder.count.value=gp[0];
					document.fastorder.price.value=document.fastorder.s_price.value;
					document.fastorder.submit();
					}
						
		}	
}	
}


function buygoldcheck(){
var str;
str='';
if(document.buygoldform.fullname.value==''){
str='please input your Full Name\n';
}
if(document.buygoldform.email.value==''){
str=str+'please input your E-mail\n';
}
else
{
patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!patrn.test(document.buygoldform.email.value)){
str=str+'your E-mail addr format error\n';
}
}

if(document.buygoldform.phone.value==''){
str=str+'please input your phone\n';

}
if(document.buygoldform.character.value==''){
str=str+'please input your character name\n';
}

if(str!=''){
	str='Warning:\n---------------------------------\n\n'+str;
	alert(str);
	}
else
{
document.buygoldform.submit();	
}
}
function buycdkeycheck(){
var str;
str='';
if(document.buycdkeyform.first_name.value==''){
str='please input your Full Name\n';
}
if(document.buycdkeyform.email.value==''){
str=str+'please input your E-mail\n';
}
else
{
patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!patrn.test(document.buycdkeyform.email.value)){
str=str+'your E-mail addr format error\n';
}
}
if(document.buycdkeyform.account.value==''){
str+='please input your account\n';
}
if(document.buycdkeyform.pswd.value==''){
str+='please input your password\n';
}

if(document.buycdkeyform.pswd2.value==''){
str+='please input your Retype password\n';
}
else
{
	if(document.buycdkeyform.pswd.value!=document.buycdkeyform.pswd2.value)
	{
		str+='both the passowrd your enter are wrong\n'
		}
	}

if(document.buycdkeyform.phone.value==''){
str=str+'please input your phone\n';

}
if(document.buycdkeyform.character.value==''){
str=str+'please input your character name\n';

}
if(str!=''){
	str='Warning:\n---------------------------------\n\n'+str;
	alert(str);
	}
else
{
document.buycdkeyform.submit();	
}
}



function buyitemcheck(){
var str;
str='';
if(document.fastorder.first_name.value==''){
str='please input your Full Name\n';
}
if(document.fastorder.email.value==''){
str=str+'please input your E-mail\n';
}
else
{
patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!patrn.test(document.fastorder.email.value)){
str=str+'your E-mail addr format error\n';
}
}
if(document.fastorder.account.value==''){
str+='please input your account\n';
}
if(document.fastorder.pswd.value==''){
str+='please input your password\n';
}

if(document.fastorder.pswd2.value==''){
str+='please input your Retype password\n';
}
else
{
	if(document.fastorder.pswd.value!=document.fastorder.pswd2.value)
	{
		str+='both the passowrd your enter are wrong\n'
		}
	}

if(document.fastorder.phone.value==''){
str=str+'please input your phone\n';

}
if(document.fastorder.character.value==''){
str=str+'please input your character name\n';

}
if(str!=''){
	str='Warning:\n---------------------------------\n\n'+str;
	alert(str);
	}
else
{
document.fastorder.submit();	
}
}

 function buygoldcheck(){
	
var str;
str='';

if(document.buypl.full_name.value==''){
str='please input your Full Name\n';
}

if(document.buypl.email.value==''){
str=str+'please input your E-mail\n';
}
else
{
patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!patrn.test(document.buypl.email.value)){
str=str+'your E-mail addr format error\n';
}
}

if(document.buypl.phoneno.value==''){
str=str+'please input your phone\n';

}
if(document.buypl.character.value==''){
str=str+'please input your character name\n';

}
if(document.buypl.password.value==''){
str=str+'please input your password\n';
}
if(document.buypl.currentlevel.value==''){
str=str+'please input your current level\n';
}
if(str!=''){
	str='Warning:\n---------------------------------\n\n'+str;
	alert(str);
	}
else
{
document.buypl.submit();	
}
}

function goldcheck(){
	
var str;
str='';

if(document.buypl.full_name.value==''){
str='please input your Full Name\n';
}

if(document.buypl.email.value==''){
str=str+'please input your E-mail\n';
}
else
{
patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!patrn.test(document.buypl.email.value)){
str=str+'your E-mail addr format error\n';
}
}

if(document.buypl.phoneno.value==''){
str=str+'please input your phone\n';

}
if(document.buypl.character.value==''){
str=str+'please input your character name\n';

}

if(document.buypl.currentlevel.value==''){
str=str+'please input your current level\n';
}
if(str!=''){
	str='Warning:\n---------------------------------\n\n'+str;
	alert(str);
	}
else
{
document.buypl.submit();	
}
}


function lpcheck()
{
	var str;
	str='';
	
	if(document.buypl.fullname.value=='')
	{
		str+='please input your First Name \n';
	}
	else
	{
		if (checkwords(document.buypl.fullname.value)){
			str+='your input your full\n'
			}
		
		}
	
	if(document.lpform.account.value=='')
	{
		str+='please input your Account \n';
	}
	else
	{
		if (checkwords(document.lpform.account.value)){
			str+='your account includes unavailable word\n'
			}
		
		}
	if(document.lpform.character.value=='')
	{
		str+='please input your character \n';
	}
	else
	{
		if (checkwords(document.lpform.character.value)){
			str+='your character includes unavailable word\n'
			}
		
		}
	if(document.lpform.pswd.value=='')
	{
		str+='please input your Password for Account \n';
	}else{
		if(document.lpform.pswd2.value==''){
			str+='please Retype Password \n';
			}else{
				pswd1=trim(document.lpform.pswd.value);
				pswd2=trim(document.lpform.pswd2.value);
				if(pswd1!=pswd2){
					str+='both the password your enter are wrong! \n';
					}
				
				}
		}
	
function trim(str)
{
 var reg_left=/^[\s]*/g;
 var reg_right=/[\s]*$/g;
 return str.replace(reg_left,"").replace(reg_right,"");
}
	
	if(document.lpform.email.value=='')
	{
		str=str+'please input your E-mail \n';
	}
	else
	{
		patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
		if (!patrn.test(document.lpform.email.value))
		{
			str=str+'your E-mail addr format error \n';
		}
	}

	if(document.lpform.phone.value=='')
	{
		str=str+'please input your phone \n';

	}
    if(document.lpform.info.value!=''){
		if(checkwords(document.lpform.info.value)){
			str+='your message include unavailable word\n'
			}
		}
	
	if(str!='')
	{
		str='Warning:\n---------------------------------\n\n'+str;
		return alert(str);
	}
	else
	{
	return document.lpform.submit();	
	}
}


function checkwords(str){
/*	var re=/(\[url\])|(http:\/\/)|(\.com)|(\[\/link\])/i;
	if (str!=''){
		if (re.test(str)){
			return true;
			}
	}*/
	return false;
	
	}













function pl_product_form_submit()
{
	return document.pl_product_form.submit()
}

	
function showpldiv(i)
{
 selectdiv(i);
}
function selectdiv(i)
{
 switch(i)
 {
 case 0:
 document.getElementById("pl_0").style.display="block";
 document.getElementById("pl_1").style.display="none";
 document.getElementById("pl_2").style.display="none";
 document.getElementById("pl_3").style.display="none";
 document.getElementById("pl_4").style.display="none";
  break;
 case 1:
 document.getElementById("pl_0").style.display="none";
 document.getElementById("pl_1").style.display="block";
 document.getElementById("pl_2").style.display="none";
 document.getElementById("pl_3").style.display="none";
 document.getElementById("pl_4").style.display="none";
  break;
 case 2:
 document.getElementById("pl_0").style.display="none";
 document.getElementById("pl_1").style.display="none";
 document.getElementById("pl_2").style.display="block";
 document.getElementById("pl_3").style.display="none";
 document.getElementById("pl_4").style.display="none";
 break;
 case 3:
 document.getElementById("pl_0").style.display="none";
 document.getElementById("pl_1").style.display="none";
 document.getElementById("pl_2").style.display="none";
 document.getElementById("pl_3").style.display="block";
 document.getElementById("pl_4").style.display="none";
 break;
 case 4:
 document.getElementById("pl_0").style.display="none";
 document.getElementById("pl_1").style.display="none";
 document.getElementById("pl_2").style.display="none";
 document.getElementById("pl_3").style.display="none";
 document.getElementById("pl_4").style.display="block";
 break;
 }
}

function js_select(obj,itemvalue){
for(var i=0;i<document.getElementById(obj).options.length;i++)
{
 if(document.getElementById(obj).options[i].value == itemvalue)
 {
	 document.getElementById(obj).options[i].selected = true;
	 break;
 }
}
}


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\n';}
else{patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;if (!patrn.test(document.signup.email.value))
{str=str+'your E-mail addr format error\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);
}
else{
		document.signup.submit();
	}
}


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);
}
else{
	document.changeinfo.submit();

}
}

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.pwd1.value=='') str=str+'*Please input Your currently Password\n';
if(document.changepassword.pwd2.value=='') str=str+'*Please input Your new Password\n';
if(document.changepassword.pwd3.value=='') str=str+'*Please input Your confirm new Password\n';
if((document.changepassword.pwd2.value!='')&&(document.changepassword.pwd3.value!='')){
if(document.changepassword.pwd2.value!=document.changepassword.pwd3.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);
}
else{
	document.changepassword.submit();
}
}

function dothings(){
  	var txt1=document.getElementById("searchkey");
 	 txt1.value="";
}

function checksear(){
	 str=""
	if(document.search_order.searchkey.value=="")
	{
		str="Please input your order number!";
	}
	if((document.search_order.searchkey.value).slice(0,1).toUpperCase()=="P" ||(document.search_order.searchkey.value).slice(0,1).toUpperCase()=="G")	
	{}		
	else
	{
		str="Please check your order number"
	}	
	
	if(str!=''){
				str='Warning:\n---------------------------------\n\n'+str;
				alert(str);
				}
	else
	{
		document.search_order.submit();	
	}
}
	

function logincheck(){
var str;
str='';

if(document.loginform.email.value==''){
str=str+'please input your E-mail\n';
}
else
{
patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!patrn.test(document.loginform.email.value)){
str=str+'your E-mail addr format error\n';
}
}

if(document.loginform.pwd.value==''){
str=str+'please input your password\n';

}

if(str!=''){
	str='Warning:\n---------------------------------\n\n'+str;
	alert(str);
	}
else
{
document.loginform.submit();	
}
}
