$(window).load(function () {
  $('#copyright-bg').css({'top': $('.copyright').position().top+25});
});
$(function () {
	var slide_show_idx = 1;
	function move_slideshow(new_index) {
		var idx;
		if (typeof new_index=='undefined') {
			idx = parseInt(slide_show_idx) + parseInt(1);
		} else {
			idx = new_index;
		}
		
		var fragment_width = 624;
	    $('.slides-container').animate({
	    	'left': ((idx - 1) * - 1) * fragment_width
	    }, 1500, 'easeInOutBack');
	    $('.pages a').removeClass('active');
	    $('#page_' + idx + '').addClass('active');
	    if (idx==$('.pages a').length) {
	    	slide_show_idx = 0;
	    } else {
	    	slide_show_idx = idx;
	    }
	}
	var slideshow_interval = null;
	function run_slideshow() {
	    slideshow_interval = window.setInterval(function () {
		    move_slideshow();
		}, 5000);
	}
	function reset_slideshow_counter() { 
		if (slideshow_interval) {
			clearInterval(slideshow_interval);
		}
		run_slideshow();
	}
	run_slideshow();
	
	$('.pages a').click(function () {
	    move_slideshow(this.href.replace(/.*#/, ''));
	    reset_slideshow_counter();
	    return false;
	});
		
	// Fixate mock up
	/*
    $('.anim').cycle({
        fx: 'scrollLeft',
        timeout:  5000,
        easing:  'easeInOutBack',
        pager: $('.slide-button:eq(0)')
    });
    $('a.thickbox').lightBox();
    */
});

$(function () {
    $('.bigimghandler, .scroller a').lightBox({
    	fixedNavigation:true,
    	callbackBeforeShow: function () {
    	    $('.slide-button a').css('visibility', 'hidden');
    	},
    	callbackAfterHide: function () {
    	    $('.slide-button a').css('visibility', 'visible');
    	}
	});
});
