
	document.observe("dom:loaded", function() {
		
		// Set all anchors with the class name "blank" to open in a blank window
		$$('a.blank').each(function(element){
			element.observe('click', function(){
				this.target = 'blank';
			});
		});
		
		// Enquiry form validation
		if ($('enquiry_form')){
			$('enquiry_form').observe('submit', function(event){
				if (!$F('name')){
					$('name').focus();
					alert('Please enter your name');
					event.stop();
				} else if (!$F('address')) {
					$('address').focus();
					alert('Please enter your address');
					event.stop();
				} else if (!$F('telephone')) {
					$('telephone').focus();
					alert('Please enter your telephone number');
					event.stop();
				} else if (
					!$F('email')
					|| !$F('email').match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,})+$/)
				) {
					$('email').focus();
					alert('Please enter a valid email address');
					event.stop();
				} else if (!$F('enquiry')) {
					$('enquiry').focus();
					alert('Please enter an enquiry');
					event.stop();
				}
			}.bindAsEventListener(this));
		}
		
	});
	
