// <!--
	
	// sending info
	var enquiry_default_text = '<p>Sending enquiry...</p>';
	// set enquiry box to hidden at beginning
	var enquiryFormVisible = false;
	//
	$(document).ready(function() {
		//
		//
		initNewsTicker();
		// setup archive timer
		// 
		initArchiveImage();
		//
		// setup image galleries
		//
		$('#gallery a').lightBox({
			imageLoading: 'resources/images/lightbox-ico-loading.gif',
			imageBtnPrev:'resources/images/lightbox-btn-prev.gif',
			imageBtnNext:'resources/images/lightbox-btn-next.gif',
			imageBtnClose:'resources/images/lightbox-btn-close.gif',
			imageBlank:'resources/images/lightbox-blank.gif'
		});
		$('.img_thumb_row a').lightBox({
			imageLoading: 'resources/images/lightbox-ico-loading.gif',
			imageBtnPrev:'resources/images/lightbox-btn-prev.gif',
			imageBtnNext:'resources/images/lightbox-btn-next.gif',
			imageBtnClose:'resources/images/lightbox-btn-close.gif',
			imageBlank:'resources/images/lightbox-blank.gif'
		});
		//
		//
		// quick enquiry form show/hide
		$("a#quick_enquiry_btn").click( function() {
			$(this).toggleClass("enquiry_on");
			$("#quick_enquiry_content").toggle("fast");
			$("#enq_form_message").html("");
			$("#enq_form_wrapper").slideDown();
			
		  });
		  //
		function hasSent( sent ){
		  	//$("a#quick_enquiry_btn").click();
		  	$("#enq_form_wrapper").slideUp();
		  	
		  	$("#enq_form_message").html( sent ? "<p>Thank you for your enquiry we will be in touch soon.</p>" : "<p class='error_in_field'>Unfortunately your enquiry could not be sent.</p><br/><p>Please try again.</p><br/><p>If you continue to experience difficulties please <a href='contact.htm'>contact us</a>.</p>" );
		  }
		//
		// validation for quick enquiry form
		//
		function quickEnquiryStartRequest(){
			// $("#result").html( enquiry_default_text );
		}
		function quickEnquiryComplete(responseText, statusText){
			//alert(a+" "+b);
			// has communicated with db script
			if(statusText=="success"){
				var sent = new Boolean( responseText );
				hasSent( sent );

			}else{
				hasSent( false );
			}
		}
		//
		//
		//
		//
		var v = jQuery("#quick_enquiry_form").validate({
			submitHandler: function(form) {
				jQuery(form).ajaxSubmit({
					type: "POST",
					url:'resources/scripts/quick_enquiry_form.php', 
				  	beforeSubmit:  quickEnquiryStartRequest,
				  	success: quickEnquiryComplete
				});
			} ,
			messages: {
        			name: " (not valid)",email:" (not valid)",comment: " (not valid)"
    			}
			,
			rules: {  
			        name: { 
			            required: true,
			            minlength:3
			        },
			        email: { 
			            required: true,
			            email: true
			        },
			        comment: { 
			            required: true,
			            minlength:3
			            
			        }
			},
			
			errorPlacement: function(error, element) {
				//alert(element.html())
				element.prev().html(error);

			}
    			
		});
		
		
	});
// -->

