jQuery(function( $ ){
	/**
	 * Most jQuery.localScroll's settings, actually belong to jQuery.ScrollTo, check it's demo for an example of each option.
	 * @see http://flesler.demos.com/jquery/scrollTo/
	 * You can use EVERY single setting of jQuery.ScrollTo, in the settings hash you send to jQuery.LocalScroll.
	 */
	
	// The default axis is 'y', but in this demo, I want to scroll both
	// You can modify any default like this
	$.localScroll.defaults.axis = 'xy';
	
	// Scroll initially if there's a hash (#something) in the url 
	$.localScroll.hash({
		target: '#content', // Could be a selector or a jQuery object too.
		queue:true,
		duration:1500,
		onAfter:function( anchor, settings ){
			if ($(anchor).height()>780) $(anchor).parents('.maincontainer').css({'height' : ($(anchor).height()+50)+'px'});
			if ($(anchor).parents('.sub').attr('id')=='blog') $('#blog').parents('.maincontainer').css({'height' : ($('#blog').height()+50)+'px'});
			// The 'this' contains the scrolled element (#content)
		}
	});
	
	/**
	 * NOTE: I use $.localScroll instead of $('#navigation').localScroll() so I
	 * also affect the >> and << links. I want every link in the page to scroll.
	 */
	$.localScroll({
		target: '#content', // could be a selector or a jQuery object too.
		queue:true,
		duration:1000,
		hash:true,
		onBefore:function( e, anchor, $target ){			
			$(anchor).parents('.maincontainer').css({'height' : '780px'});
			if ($(anchor).height()>780) $(anchor).parents('.maincontainer').css({'height' : ($(anchor).height()+50)+'px'});
			if ($(anchor).parents('.sub').attr('id')=='blog') $('#blog').parents('.maincontainer').css({'height' : ($('#blog').height()+50)+'px'});
			if ($(anchor).attr('class')=='sub gallery-sub') {
				$('.gallery-sub').css({'display' : 'none'});
				$(anchor).css({'display' : 'block'});
			}	
			// The 'this' is the settings object, can be modified
		},
		onAfter:function( anchor, settings ){
			//$('.main-bottom').css({'opacity' : 0});			
			//if ($(anchor).attr('class')!='sub gallery-sub') $('.gallery-sub').css({'display' : 'none'});
			// The 'this' contains the scrolled element (#content)
		}
	});
});


$(document).ready(function() {
	//$('.footer').css({'display' : 'none'});
	$('.header').slider({
		autoscrolling: true,
		autoscrollingdelay: 2500,
		transitionhide: 'slidesideloop',
		transitionshow: 'slidesideloop',
		thumbs: false,
		thumbsarrows: false
	});	
	
	
	/*
	$('.main-bottom').css({'opacity' : 1});
    $('#partners').css({'opacity' : 0, 'z-index': 1, 'display' : 'none'});
    $('.footer').css({'opacity' : 0, 'z-index': 1, 'display' : 'none'});
	$('.fb-only').css({'opacity' : 1, 'z-index': 2, 'display' : 'block'});
	
    $('#contact-link').click(function() {
        $(this).parents('.maincontainer').css({'height' : (780+$(this).parents('.maincontainer').find('.footer').height())+'px'});
        $('.main-bottom').css({'opacity' : 0});
        $('#partners').css({'opacity' : 0, 'z-index': 1, 'display' : 'none'});
        $('.fb-only').css({'opacity' : 0, 'z-index': 1, 'display' : 'none'});
        $('.footer').css({'opacity' : 1, 'z-index': 2, 'display' : 'block'});
        $('.main-bottom').stop().animate({'opacity' : 1.00}, 800, function() {
			//$(this).parents('.maincontainer').css({'height' : '3000px'});
  		});
        return false;
    });
    
    $('#partners-link').click(function() {        
    	$(this).parents('.maincontainer').css({'height' : (780+$(this).parents('.maincontainer').find('#partners').height())+'px'});
        $('.main-bottom').css({'opacity' : 0});
        $('.footer').css({'opacity' : 0, 'z-index': 1, 'display' : 'none'});
        $('.fb-only').css({'opacity' : 0, 'z-index': 1, 'display' : 'none'});
        $('#partners').css({'opacity' : 1, 'z-index': 2, 'display' : 'block'});
		$('.main-bottom').stop().animate({'opacity' : 1.00}, 800, function() {
			//$(this).parents('.maincontainer').css({'height' : '3000px'});
  		});                                                
        return false;
    });
    
    $('a[href="#index"]').click(function() {
        $(this).parents('.maincontainer').css({'height' : (780+$(this).parents('.maincontainer').find('.fb-only').height())+'px'});
        $('.main-bottom').css({'opacity' : 0});
        $('.footer').css({'opacity' : 0, 'z-index': 1, 'display' : 'none'});
        $('#partners').css({'opacity' : 0, 'z-index': 1, 'display' : 'none'});
        $('.fb-only').css({'opacity' : 1, 'z-index': 2, 'display' : 'block'});
		$('.main-bottom').stop().animate({'opacity' : 1.00}, 800, function() {
			//$(this).parents('.maincontainer').css({'height' : '3000px'});
  		});                                              
    });

    $('#logo-link').click(function() {
    	$(this).parents('.maincontainer').css({'height' : (780+$(this).parents('.maincontainer').find('.fb-only').height())+'px'});
        $('.main-bottom').css({'opacity' : 0});
        $('.footer').css({'opacity' : 0, 'z-index': 1, 'display' : 'none'});
        $('#partners').css({'opacity' : 0, 'z-index': 1, 'display' : 'none'});
        $('.fb-only').css({'opacity' : 1, 'z-index': 2, 'display' : 'block'});
		$('.main-bottom').stop().animate({'opacity' : 1.00}, 800, function() {
			//$(this).parents('.maincontainer').css({'height' : '3000px'});
  		});                                              
        return false;
    });
    */
});
