$(document).ready(function(){
	// include modal after page
	$('<div id="productionShots"></div><div id="modalOverlay"></div>').insertAfter('#page');
	
	//open modal on menu click
	$('a[href$=productionShots]').live("click",function() {
	// if on a blog, then deeplink to index page for soa
		if(document.location.href.split('.')[0] == 'http://blogs')
		{
			document.location.href = "http://www.fxnetworks.com/" + path + "#productionShots";
		}
		else
		{
			openmodal();
		}
	});
	
	// close on click out
	$("#modalOverlay").click(function() {
		closemodal();
		return false;
	});
	
	// deeplink
	if(FXMicrosite.params.hash)
	{
		if(FXMicrosite.params.hash == "productionShots")
		{
			openmodal();
		}
	}	
});
// close modal function
function closemodal()
{
	$("#page").show();
	$("#productionShots").hide();
	$("#productionShots").empty();
	$("#modalOverlay").hide();
}
	
// open modal function
function openmodal()
{
	$("#productionShots").show();
	$("#modalOverlay").show();
	if(navigator.userAgent.indexOf('iPad') >= 0){
		$("#page").hide();
		scrollTo(0, 100);
	} else {
		// scroll to top of page
		window.scroll(0, 52);
	}
	
	$.get("productionShots/productionShots.php",function(data){
		$("#productionShots").append(data);
		$('#images').galleria({height:680});
		$('#productionShots').height(795);
	});

	return false;
}
