$(function()
{jQuery(window).unbind('resize').bind('resize',function()
{setLayout();setSmallSlideShow();});});function setLayout()
{var w=$(window).width();var h=$(window).height();var slides_visible=$('#mainSlideShowWrapper .slides:visible').length;if(slides_visible==0)$('#mainSlideShowWrapper .slides').show();setBigImages();if(slides_visible==0)$('#mainSlideShowWrapper .slides').hide();}
$(document).ready(function()
{$('#mainMenu .home').addClass('active');$('.more-scenes-button').click(function()
{var increment=2;var w=$(window).width();var thumbMarginLeft=9;var thumbMarginBottom=9;var paddingTopBottom=2;var thumbWidth=225+ thumbMarginLeft;var thumbHeight=302+ thumbMarginBottom;var thumbColumnCount=Math.floor((w- 2*27)/thumbWidth);var thumbCount=$('ul.briefScenes li').length;var maxRows=Math.ceil(thumbCount/thumbColumnCount);var rows=$('ul.briefScenes').data('rows');var height=$('ul.briefScenes').height();var clickedTimes=$(this).data('clickedTimes')||0;clickedTimes++;$(this).data('clickedTimes',clickedTimes);if(rows<maxRows)
{$('ul.briefScenes').animate({height:height+ thumbHeight*Math.min(maxRows- rows,increment)},300);$('ul.briefScenes').data('rows',Math.min(rows+increment,maxRows));}
else
{location.href='/scenes/';}
if(clickedTimes>=3)
{location.href='/scenes/';}});var reflectionOptions={height:0.4,opacity:0.25};$('#thumbSlider img').reflect(reflectionOptions);$('#mainSlideShowWrapper img:gt(0)').css('opacity',0);startGallery();$('#mainSlideShowWrapper .pager .next').click(function()
{stopGallery();setTimeout(function(){nextSlide();},100);});$('#mainSlideShowWrapper .pager .prev').click(function()
{stopGallery();prevSlide();});$('#mainSlideShowWrapper .pager .pause').click(function()
{stopGallery();$(this).hide();$(this).parent().find('.play').show();});$('#mainSlideShowWrapper .pager .play').click(function()
{startGallery();$(this).hide();$(this).parent().find('.pause').show();});$('#mainSlideShowWrapper .pager .page').click(function()
{stopGallery();showSlide(parseInt($(this).html(),10));});$('#mainSlideShowWrapper .trailer-button').click(function()
{$('#mainSlideShowWrapper .slides, #mainSlideShowWrapper .trailer-button, #mainSlideShowWrapper .pager').hide();$('#movie').show();});autoSlide();});
