$(function () {

    $('.gallery_mc_unstyled').addClass('gallery_mc'); // adds new class name to maintain degradability
  
    $('ul.gallery_mc').galleria({
        history   : true, // activates the history object for bookmarking, back-button etc.
        clickNext : true, // helper for making the image clickable
        insert    : '#main_image', // the containing selector for our main image
		onImage   : function(image,caption,thumb) { // add image effects
            
            // fade in the image & caption
            image.css('display','none').fadeIn(1000);
            $(".caption").css('display','none').fadeIn(1000).css('width',image.width());            
            // add a title for the clickable image
            image.attr('title','Next image >>');
        }
    });
	
	$("#il-terms").popupWindow({ 
		centerScreen:1
	}); 
	$('#submit_req').click(function() {											
		var satisfied = $('#terms:checked').val();
		if (satisfied == undefined){
			alert("Do you agree with Australia Zoo's Image Library Terms of Use?")
			return false;
		}		
		$("#submit_req").attr("value", "Submitting, please wait...");
	});
	
	$('#reqform').click(function() {												
		$("#reqform").attr("value", "Submitting, please wait...");
	});	
	
	if($("#zoo_overview_list").length >0){
		$("#zoo_overview_list").hide();
		$("#zoo_overview_list_display").bind("click",function(){
			$("#zoo_overview_list").toggle();
			return false;
		})
	}
		
});