$(document).ready(function() {
	var myShowcase = $("#showcase").awShowcase(
		{
		content_width:			850,
		content_height:			300,
		fit_to_parent:			false,
		auto:					false,
		interval:				3000,
		continuous:				false,
		loading:				true,
		tooltip_width:			200,
		tooltip_icon_width:		32,
		tooltip_icon_height:	32,
		tooltip_offsetx:		18,
		tooltip_offsety:		0,
		arrows:					true,
		buttons:				true,
		btn_numbers:			true,
		keybord_keys:			true,
		mousetrace:				false, 
		pauseonover:			true,
		stoponclick:			true,
		transition:				'fade', 
		transition_delay:		100,
		transition_speed:		200,
		show_caption:			'onhover', 
		thumbnails_position:	'outside-last', 
		thumbnails_direction:	'horizontal', 
		thumbnails_slidex:		0, 
		dynamic_height:			false, 
		speed_change:			false, 
		viewline:				false,
		custom_function: 		myLoadImage
	});
	function myLoadImage(currentId, content_count){
		$('#po_'+currentId).html('<img src="portfolio/'+(content_count - currentId -1)+'.jpg" />');
			
	}
	function openPortfolio(event){
		event.preventDefault();
		$.scrollTo( '#portfolio', 100, {onAfter:function(){
				if(!($('body').hasClass('openPanel'))){
					$('body').animate({top : '+=480'}, 500).addClass('openPanel');
				}
			}		 
		});
		return false;
	}
	function closePortfolio(){
		if($('body').hasClass('openPanel')){
				$('body').animate({top : '-=480'}, 500).removeClass('openPanel');
				//$('.up').hide('bounce', null, 500).removeClass('openPanel');
			}
			return false;
	}
	$('#liofilize').click(function(){
		$('.moveme').addClass("liofilized"); 
		$('#liofilize').hide();
		$('#dilute').show();
	});
	$('#dilute').click(function(){
		$('.moveme').removeClass("liofilized", 500); 
		$('#dilute').hide();
		$('#liofilize').show();
	});
	$('.openPortfolio').click( openPortfolio);
	$('#closePorfotlio').click(closePortfolio);
	$('.bt_acqualiofilizzata').click(function(){ 
		$.scrollTo( '#acquabranding', 1000, {easing:'easeInOutQuad'});
	});
	$('.bt_contatti').click(function(){
		$.scrollTo( '#venue', 1000, {easing:'easeInOutQuad'});
	});
	
		
	$('#brand_button_elastic')
	.mouseover(function(){
		$(this).stop().animate({'height': '62px'}, 300, 'easeOutBounce')
	})
	.mouseout(function(){
		$(this).stop().animate({'height': '49px'}, 300, 'easeOutBounce')
	})
	.click(function(event){
		event.preventDefault();
		$.scrollTo( 'div.brand.item', 1000, {easing:'easeInOutQuad', onAfter:function(){
				$('div.brand.item').stop().animate({backgroundPosition:"(-900px 0)", borderTopColor: "#666", borderBottomColor: "#666", borderLeftColor: "#666", borderRightColor: "#666"}, 300, function(){
					$(window).scroll( function(){
						$('div.brand.item').stop().animate({backgroundPosition:"(0 0)", borderTopColor: "#222222", borderBottomColor: "#222222", borderLeftColor: "#222222", borderRightColor: "#222222"}, 300, function(){
			 				$(window).unbind("scroll");
			 				});
			 		});
				});
			}
		});
	})
		
		
	$('#media_button_elastic')
	.mouseover(function(){
		$(this).stop().animate({'height': '59px'}, 300, 'easeOutBounce')
	})
	.mouseout(function(){
		$(this).stop().animate({'height': '51px'}, 300, 'easeOutBounce')
	})
	.click(function(event){
		event.preventDefault();
		$.scrollTo( 'div.media.item', 1000, {easing:'easeInOutQuad', onAfter:function(){
			$('div.media.item').stop().animate({backgroundPosition:"(-900px 0)", borderTopColor: "#666", borderBottomColor: "#666", borderLeftColor: "#666", borderRightColor: "#666"}, 300, function(){
				$(window).scroll( function(){
					$('div.media.item').stop().animate({backgroundPosition:"(0 0)", borderTopColor: "#222222", borderBottomColor: "#222222", borderLeftColor: "#222222", borderRightColor: "#222222"}, 300, function(){
			 			$(window).unbind("scroll");
			 			});
			 		});
				});
			}
		});
			
	});
		
	$('#web_button_elastic')
	.mouseover(function(){
		$(this).stop().animate({'height': '61px'}, 300, 'easeOutBounce')
	})
	.mouseout(function(){
		$(this).stop().animate({'height': '52px'}, 300, 'easeOutBounce')
	})
	.click(function(event){
		event.preventDefault();
		$.scrollTo( 'div.web.item', 1000, {easing:'easeInOutQuad', onAfter:function(){
				$('div.web.item').stop().animate({backgroundPosition:"(-900px 0)", borderTopColor: "#666", borderBottomColor: "#666", borderLeftColor: "#666", borderRightColor: "#666"}, 300, function(){
					$(window).scroll( function(){
						$('div.web.item').stop().animate({backgroundPosition:"(0 0)", borderTopColor: "#222222", borderBottomColor: "#222222", borderLeftColor: "#222222", borderRightColor: "#222222"}, 300, function(){
			 				$(window).unbind("scroll");
			 				});
			 		});
				});
			}
		});
	});
	$('.goToTop').click(function(){
		$.scrollTo( '.down', 1000, {easing:'easeInOutQuad'});
	});
	
	
}); //chiude domready
