// JavaScript Document


function ValidateForm(form) {
				//Check Required Form Elements for Input Before Submition

				//Name check
				if (form.txtENQ_NAME.value == "" ) {
					alert("You have not entered a contact name. Please Enter One")
					form.txtENQ_NAME.focus()
					return false

			    //Check the Reply Methods
				} else if (form.txtENQ_POSTAL_ADDRESS.value == ""  & form.txtENQ_TEL.value == "" & form.txtENQ_EMAIL.value == ""  ) {
					alert("You have not entered an address or number to contact you on. Please Enter One")
					form.txtENQ_POSTAL_ADDRESS.focus()
					return false

			    //Check the Enquiry
				} else if (form.txtEQD_DESCRIPTION.value == "" ) {
					alert("You have not entered a description of your enquiry. Please Enter One")
					form.txtEQD_DESCRIPTION.focus()
					return false

				}
				
				//OK to Process
				//Set form action
				if (form.cbobranch.value == 'NONE') {
					alert('You have not selected a department. Please select one')
					form.cbobranch.focus()
					return false

				} else if (form.cbobranch.value == 'destri') {
					//form.action = "mailto:gavin.greathead@destinationtriumph.co.uk?subject=Website Enquiry"
					document.wz_Form.txtENQ_OVERRIDE_BRA_EMAIL.value = 'gavin.greathead@destinationtriumph.co.uk';
					
				} else if (form.cbobranch.value == 'destriguild') {
					//form.action = "mailto:gavin.greathead@destinationtriumph.co.uk?subject=Website Enquiry"
					document.wz_Form.txtENQ_OVERRIDE_BRA_EMAIL.value = 'gavin.greathead@destinationtriumph.co.uk';
				
				}

				return true
			}

			function MM_goToURL() { //v3.0
			  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
			  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
			}


			//////////////////////////////////////////////////////////////////////////
			function WZSubmit(cmdName, fnName)
			{
			    //document.wz_Form.wz_Command.value = cmdName
			    //GetGridSettings(document.wz_Form, document.wz_GridControl);

			    // Call custom handler

			        if (false == fnName(document.wz_Form, document.wz_GridControl))
			            return false;

			    document.wz_Form.submit();
				//alert("Your Message Has Been Sent");
			    return true;

			}

			// =======================================================================
			function OnSave(theForm, theGrid)
			{
				if (true == ValidateForm(theForm)){
					//Ok to redirect to new url
					//document.wz_Form.txtEQD_DESCRIPTION.value = document.wz_Form.txtEQD_DESCRIPTION.value
					document.wz_Form.action = "Update_Enquiry.asp?BRA_ID=6012"
					document.wz_Form.submit()
					//alert("Your Message Has Been Sent");

				}
			    return false;
			}
			
