
$(document).ready(function () {

    var $panels = $('#slider .scrollContainer > div');
    var $container = $('#slider .scrollContainer');

    var horizontal = true;

    if (horizontal) {
        $panels.css({
            'float' : 'left',
            'position' : 'relative'
        });
        
        $container.css('width', $panels[0].offsetWidth * $panels.length);
    }

    var $scroll = $('#slider .scroll').css('overflow', 'hidden');

    $scroll
        .before('<img class="scrollButtons left" src="/images/left.png" />')
        .after('<img class="scrollButtons right" src="/images/right.png" />');

    function selectNav() {
        $(this)
            .parents('ul:first')
                .find('a')
                    .removeClass('selected')
                .end()
            .end()
            .addClass('selected');
    }

    $('#slider .navigation').find('a').click(selectNav);

    function trigger(data) {
        var el = $('#slider .navigation').find('a[href$="' + data.id + '"]').get(0);
        selectNav.call(el);
    }

    if (window.location.hash) {
        trigger({ id : window.location.hash.substr(1) });
    } else {
        $('ul.navigation a:first').click();
    }

    var offset = parseInt((horizontal ? 
        $container.css('paddingTop') : 
        $container.css('paddingLeft')) 
        || 0) * -1;

    var scrollOptions = {
        target: $scroll,
        items: $panels,

        navigation: '.navigation a',

        prev: 'img.left', 
        next: 'img.right',

        axis: 'xy',

        onAfter: trigger, 
        offset: offset,

        duration: 500,
        easing: 'swing'
    };

    $('#slider').serialScroll(scrollOptions);

    $.localScroll(scrollOptions);

    scrollOptions.duration = 1;
    $.localScroll.hash(scrollOptions);
	
	arrowMovementSpeed = 150;
	
	$(".scrollButtons.left").hover(function(){
		$(this).stop().animate({left: '-24'}, arrowMovementSpeed);}, 
		function(){
		$(this).stop().animate({left: '-20'}, arrowMovementSpeed);
	});
	
	$(".scrollButtons.right").hover(function(){
		$(this).stop().animate({right: '-24'}, arrowMovementSpeed);}, 
		function(){
		$(this).stop().animate({right: '-20'}, arrowMovementSpeed);
	});

});

	// Bottom Tab

$(document).ready(function() {
						   
	$(".scroll").delay(1600).fadeTo(2000 , 1, function(){
	$("div.scroll").animate({ height: "414px" }, 400);												   
    $("div.panel_button").click(
        function(){ $("div.scroll").animate({ height: "373px" }, 400) 
		$("div.panel_button").toggle();
            }); $("div#hide_button").click(function(){
        $("div.scroll").animate({
            height: "414px"
        }, 400);
      });
	});
});
