/**
 * @author egrissom
 */

$(document).ready(function() {
	/* Initiate click event for site map animation */	
	$("#siteMapTrigger a").click(function () {
		$("#sitemap").toggle();
		$("#disclaimer").hide();
		$("#disclaimerTrigger").removeClass('active');
		$(this).parent().toggleClass("active"); 
	});

	/* Initiate click event for site map animation */	
	$("#disclaimerTrigger a").click(function () {
		$("#disclaimer").toggle();
		$("#sitemap").hide();
		$("#siteMapTrigger").removeClass('active');
		$(this).parent().toggleClass("active"); 
	});
	
	/* Admin Code */
	
	$("select#categoryId").change(function () {
		 document.categoryFilter.submit();
	});
	
	/* Gallery Code */
	
	/* Initiate hover event for photo galleries */	

	$("ul.photoListing a").hover(
      function () {
      	$("#galleryPhoto img").attr("src", $(this).attr("href"));
		$(this).toggleClass("active");
      },
      function () {
        // do something... or nothing
      }
    ); 
	$("ul.photoListing a").click(function() {
		return false;
	});
	
	$("#detailsPrices a").click(function() {
		// Over lay info //
		$('#overlayTabs').tabs();
	});
});	

window.onload = init;

function init() {
	$(document).ready(function() {
		$('ul.photoListing a').preload();
	});
}
