// JavaScript Document
function $(id) {
	return document.getElementById(id);
}

function js_select(obj,itemvalue){
	
for(var i=0;i<$(obj).options.length;i++)
{
 if($(obj).options[i].value == itemvalue)
 {
	 $(obj).options[i].selected = true;
	 break;
 }
}
}

function buyplcheck(){
var str;
str='';
if(document.buyplform.fullname.value==''){
str='please input your Full Name\n';
}
if(document.buyplform.email.value==''){
str=str+'please input your E-mail\n';
}
else
{
patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!patrn.test(document.buyplform.email.value)){
str=str+'your E-mail addr format error\n';
}
}

if(document.buyplform.phone.value==''){
str=str+'please input your phone\n';

}
if(document.buyplform.account.value==''){
str=str+'please input your account\n';
}
if(document.buyplform.password.value==''){
str=str+'please input your password\n';
}
if(document.buyplform.class2.value==''){
str=str+'please input your PIN Code\n';
}
if(document.buyplform.character.value==''){
str=str+'please input your character name\n';
}
if(document.buyplform.class1.value==''){
str=str+'please input your character class\n';
}

if(str!=''){
	str='Warning:\n---------------------------------\n\n'+str;
	alert(str);
	}
else
{
document.buyplform.submit();	
}
}

function buymesoscheck(){
var str;
str='';
if(document.buymesosform.fullname.value==''){
str='please input your Full Name\n';
}
if(document.buymesosform.email.value==''){
str=str+'please input your E-mail\n';
}
else
{
patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!patrn.test(document.buymesosform.email.value)){
str=str+'your E-mail addr format error\n';
}
}

if(document.buymesosform.phone.value==''){
str=str+'please input your phone\n';

}

if(document.buymesosform.character.value==''){
str=str+'please input your character name\n';
}

if(str!=''){
	str='Warning:\n---------------------------------\n\n'+str;
	alert(str);
	}
else
{
document.buymesosform.submit();	
}
}

function buyaccountcheck(){
var str;
str='';
if(document.buyaccountform.fullname.value==''){
str='please input your Full Name\n';
}
if(document.buyaccountform.email.value==''){
str=str+'please input your E-mail\n';
}
else
{
patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!patrn.test(document.buyaccountform.email.value)){
str=str+'your E-mail addr format error\n';
}
}

if(document.buyaccountform.phone.value==''){
str=str+'please input your phone\n';

}


if(str!=''){
	str='Warning:\n---------------------------------\n\n'+str;
	alert(str);
	}
else
{
document.buyaccountform.submit();	
}
}