/* Author: Andy Warrington*/

/* Run functions when page is loaded *or* browser is resized */
$(document).ready(function(){hoverFunctions();});
$(window).resize(function(){
	/* Turn off any jQuery functions/styles that have already been applied */
	$("figure, h1, .iframe").unbind('click').unbind('mouseenter').unbind('mouseleave');
	$("figcaption, #contactdetails").attr("style", "");
	hoverFunctions();
});

function hoverFunctions(){
	if ($(".logo").is(":visible")) { //Checks if the site logos are visible, meaning that >1024px styles have been applied in the CSS
		$("figure").hover(function(){
			$(this).children("figcaption").slideToggle(); //Sliding descriptions on screenshots
		});
		$("#contact").children("h1").click(function(){ //Show/hide function on contact details
			$(this).siblings("#contactdetails").slideToggle();
		});
		$(".iframe").fancybox({ //Contact form iframe
			'hideOnContentClick': true,
			'width': 700,
			'height': 760,
			'padding': 20
		});
	}
	else {
		//Do nothing!
	}
}
