


function validate_form ( )
{
	valid = true;
	strAlert = ""
		

	if ( document.order_form.grand_tot.value == "0.00" )
	{
		strAlert = strAlert +"Please Choose Your Items \n" ;
		valid = false;
	}
	if ( document.order_form.clientName.value == "" || document.order_form.clientName.value.trim().length < 1)
	{
		strAlert = strAlert +"Please fill in name\n" ;
		valid = false;
	}
	if ( document.order_form.email.value == "" || document.order_form.email.value.trim().length < 1)
	{
		strAlert = strAlert +"Please fill in email\n" ;
		valid = false;
	}

	if ( document.order_form.domain.value == "" || document.order_form.domain.value.trim().length < 1)
	{
		strAlert = strAlert +"Please fill in domain\n" ;
		valid = false;
	}
	if ( document.order_form.details.value == "" || document.order_form.details.value.trim().length < 1)
	{
		strAlert = strAlert +"Please fill in detail\n" ;
		valid = false;
	}
	
	
	
	// 0-9 , -
	var telnr = /^\+?[0-9 ()-]+[0-9]$/  ;

	if (!(telnr.test(document.order_form.phone.value)))  
	{
		if (document.order_form.phone.value != "")
		{
			strAlert = strAlert +"Erro :: Phone Invalid \n" ;
			valid = false;
		}
	}

	/*if (!(telnr.test(document.subscribeForm.txtMobile.value)))  
	{
		if (document.subscribeForm.txtMobile.value != "")
		{
			strAlert = strAlert +"ผิดพลาด: เบอร์โทรศัพทมือถือไม่ถูกต้อง \n" ;
			valid = false;
		}
	}*/

	//Email
	var emailFilter=/^.+@.+\..{2,3}$/ ;

	if (!(emailFilter.test(document.order_form.email.value)))  
		{
			if (document.order_form.email.value != "")
			{
				strAlert = strAlert +"Erro :: Email Invalid \n" ;
				valid = false;
			}
		}
		


	if(!valid){
		alert ( strAlert );
	}
	return valid;
}

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

