// JavaScript Document
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 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 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 plconfirmcheck(){
	var str;
	str='';
	if(document.plconfirmform.servername.value=='')	{
		str+='please input your server \n';
	}
	if(document.plconfirmform.first_name.value=='')	{
		str+='please input your First Name \n';
	}
	if(document.plconfirmform.last_name.value=='')	{
		str+='please input your Last Name \n';
	}
	if(document.plconfirmform.account.value=='')	{
		str+='please input your Account \n';
	}
	if(document.plconfirmform.character.value=='')	{
		str+='please input your Password for Account \n';
	}
	if(document.plconfirmform.pswd.value=='')	{
		str+='please input your Password for Account \n';
	}
	if(document.plconfirmform.character.value=='')	{
		str+='please input your Character Name \n';
	}
	if(document.plconfirmform.class1.value=='')	{
		str+='please input your Character Class \n';
	}
	if(document.plconfirmform.email.value=='')	{
		str=str+'please input your E-mail \n';
	}
	else	{
		patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
		if (!patrn.test(document.plconfirmform.email.value))		{
			str=str+'your E-mail addr format error \n';
		}
	}
	if(document.plconfirmform.phone.value=='')	{
		str=str+'please input your phone \n';

	}
	if(str!='')	{
		str='Friendly Tips:\n---------------------------------\n\n'+str;
		return alert(str);
	}
	else 	{
	return document.plconfirmform.submit();	
	}
}
