// cufon replacement
Cufon.replace("div#infoMain h1");
Cufon.replace("div#infoMain h2");
Cufon.replace("div#subContent h2");
Cufon.replace("div#infoSub h3");
Cufon.replace("div#contactContent h4");

Cufon.replace("div.subBox a.highlightLink");
Cufon.replace("div#lakesInfo a");

// cufon shop replacement
Cufon.replace("div#shopMain h1");
Cufon.replace("div#shopMain h2");
Cufon.replace("div#shopSub div.subBox h3");

// wait until the DOM is ready
$(document).ready(function() {

	// lakes gallery
	$("div#lakesGallery a").click(function() {
		
		// set the class of current thumb
		$("div#lakesGallery a").removeClass("selectedGallery");
		$(this).addClass("selectedGallery");
		
		// get the href of clicked link
  		var enlargeGallery = $(this).attr("href");
  		
  		// set the main image to new value
  		$("div#lakesImage img").attr("src", enlargeGallery);
		
		return false;
	});
	
	// contact us form Ajax
	
		// setup contact form click
		function wireUp() {
			$("#contactForm").submit(function() {
				submitAjaxForm("#contactForm", "../include/contactUs.php", "#contactDetails");
				return false;					  
			});
		}
		
		// form submitted, lets Ajax!
		function submitAjaxForm(formId, formUrl, containerToUpdate){
			$("#ajaxLoader").css({'display' : 'inline'}); // show the ajax loader icon
			var inputs = $(formId).serialize(); // grab all the form inputs
			
			jQuery.ajax({
				type: "POST",
				data: inputs, 
				url: formUrl,
				error: function(html) {  
					alert(html);
				},
				success: function(html) { 
					// load response to form 
					$(containerToUpdate).html(html);
					wireUp();
				}
			});
		}
		
		wireUp();

}); 
