// Validation for all
var utErrorMessage = new utErrorMessage(1);
	var utData = new utData(utErrorMessage);
	
	function validator(theForm){
  	if(utData.checkString(theForm, 'name', 'Nama Anda harus diisi', true, 40, 1) == false)
			return false;
			
		if(theForm.address.value == '.'){
			var message = utErrorMessage.getErrorMessage(0, new Array('address'));
			alert(message);
			theForm.alamat.focus();
  		return false;
		}
		
		if(utData.checkString(theForm, 'address', 'Alamat Anda', true, 200, 0) == false)
			return false;	
		
		if(utData.checkString(theForm, 'city', 'Kota Anda', true, 20, 1) == false)
			return false;
	 if(theForm.postcode.value != ""){
	 if(utData.checkNumber(theForm, 'postcode', 'Nomor Fax Anda', true, 8) == false)
    		return false;
	 }
	  if(utData.checkNumber(theForm, 'fax', 'Nomor Fax / Telp Anda', true, 15) == false)
    		return false;
		 if(theForm.email.value != ""){	
		 if(utData.checkAddress(theForm, 'email', 'Email Anda', false, 35, 1) == false)
    	return false;
		}
		if(utData.checkRadio(theForm, 'pesanan', 'Jumlah Pesanan', true) == false)
			return false;
		
		if(utData.checkRadio(theForm, 'edisi', 'Edisi', true) == false)
			return false;
			
			if(utData.checkRadio(theForm, 'pembayaran', 'Jenis Pembayaran', true) == false)
			return false;
		//end
	  return true;
	}
function submit_form(theForm, typ){
		if(typ == 1){
		if(validator(theForm) == true){
				theForm.action = "submit_order.php";
				theForm.submit();
				}
				}
		}
		function check_length(objects, max){
		var allValid = true;

		if(objects.value.length > max){
		  objects.value = objects.value.substring(0, max);
		  alert("Maksimum " + max + " karakter");
		  objects.select();
		  objects.focus();
		  allValid = false;
		}
   	return allValid;
	}
