$( function() {
	$( '.category' ).click( function() {
		$( this ).toggleClass( 'active' )
		$( this ).siblings( '.dropdown' ).toggle();
		$( this ).find( '.indicator' ).toggleClass( 'indicator-active' );
		return false;
	} );
			
	$( '#dock > li' ).hover( function() {
		$( '.latest' ).fadeOut( 'fast' );
		$( this ).addClass( 'dock-active' );
		$( this ).children( 'span' ).fadeIn( 200 );
	}).bind( "mouseleave", function() {		
		$( this ).removeClass( 'dock-active' );	
		$( this ).children( 'span' ).fadeOut( 200 );
	} );
			
	$( '#dock' ).bind( "mouseleave", function() {
		$( '.latest' ).fadeIn( 1000 );
	} );
} );

$(document).ready(function() {
	
	var offset=1;
	var backHeight=900;
	var verso=1;
	
  	function scrollbackground() {
		
		if(offset<backHeight){	
			if(offset>0) offset=offset+verso;
			else{ verso=-verso;offset=offset+verso;}
		}
		else {verso=-verso;offset=offset+verso;}
		//console.log(offset+" "+verso);
   		$('#logoCont').css("background-position", "50% " + (-offset) + "px");
		
   		setTimeout(function() {
			scrollbackground();
			}, 50
		);
   	}
 
	scrollbackground();

});

