function check_form()
{
	if($.trim($('#ServerList').val()) == '')
	{
		alert('please choose your server');
		return false;
	}
	if($.trim($('#ProductList').val()) == '')
	{
		alert('please choose the the product');
		return false;
	}
	if ($("#CustomerEmail").val().search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
	{
		alert('Email Address Wrong!');
		$("#CustomerEmail").focus();
		return false;
	}
	if ($("#CustomerPhone").val() == '')
	{
		alert('Input Phone Number');
		$("#CustomerPhone").focus();
		return false;
	}
	if ($("#GameName").val() != 'RS2'){
		if($("#FirstName").val() == '')
		{
			alert('Please fill in your FirstName!');
			$("#FirstName").focus();
			return false;
		}
		if($("#LastName").val() == '')
		{
			alert('Please fill in your LastName!');
			$("#LastName").focus();
			return false;
		}
		var firstnameno = $("#FirstName").val();
		var lastnameno = $("#LastName").val();
    }else{
		var firstnameno = "";
		var lastnameno = "";
	}
	if($("#CharactorName").val() == '')
	{
		alert('Please fill in your Character!');
		$("#CharactorName").focus();
		return false;
	}
	if ($("#GameName").val() == 'RS2' && $("#LoginGameName").val() == '')
	{
		alert('Input account name');
		$("#LoginGameName").focus();
		return false;
	}
	if ($("#GameName").val() == 'RS2' && $("#LoginGamePassword").val() == '')
	{
		alert('Input password');
		$("#LoginGamePassword").focus();
		return false;
	}
	var currency = document.getElementsByName('Currency');
	for(var i=0;i<currency.length;i++){
		if(currency[i].checked){
			currency=currency[i].value;
			break;
		}
	}
	if(typeof(currency)=="object")
	{currency="USD";}
	$("#c_currency").val(currency);
	numberPrice = $.trim($('#ProductList').val())+'|'+ $('#ProductList').find('option:selected').text()
	$("#ServerName").val($('#ServerList').find('option:selected').text());
	$("#NumberPrice").val(numberPrice);
	$("#ServerId").val($.trim($('#ServerList').val()));
	$("#payment_form").submit();
}
function checkout_confirm()
{
	if ($("#GameName").val() == 'RS2'){
		var firstnameno = $("#FirstName").val();
		var lastnameno = $("#LastName").val();
    }else{
		var firstnameno = "";
		var lastnameno = "";
	}
	os0 = $("#CharactorName").val()+"|"+$("#LoginGameName").val()+"|"+$("#LoginGamePassword").val();
	os2 = '0 0|gold item';
	os1 = $("#CustomerEmail").val()+'|'+firstnameno+' '+lastnameno+'|'+$("#CustomerPhone").val()+'|0';
	os3 = $("#Notice").val()+'|'+$("#CustomerMsn").val()+'|'+$("#CustomerLandlinPhone").val()+'|'+$("#CustomerOnlieTime").val()+'|'+$("#OtherCharactor").val();
	var method = document.getElementsByName("PayType");
	for(var i=0;i<method.length;i++)
	{
		if(method[i].checked)
		{
			method=method[i].value;
			break;
		}
	}

	switch(method)
	{
		case "1":
			$("#os0").val(os0);
			$("#os1").val(os1);
			$("#os2").val(os2);
			$("#os3").val(os3);
			$("#theform").submit();
			return false;
			break;
		case "2":
		case "3":
			if(method == 2)
			{$("#paymentbank").val('eu');}
			else if(method == 3)
			{$("#paymentbank").val('wu');}
			$("#char").val($("#CharactorName").val());
			$("#fname").val(firstnameno);
			$("#lname").val(lastnameno);
			$("#mail").val($("#CustomerEmail").val());
			$("#phone").val($("#CustomerPhone").val());
			$("#payment_other").submit();
			return false;
			break;
	}
}
