$(document).ready(function() {

	// **********************************************
	// animazione serie
	// **********************************************
	
	$('.prodotto-serie-descrizione').each(function(){
	
	
		var text_div = $(this).find('.prodotto-serie-descrizione-testo');
		var text_span = $(this).find('.prodotto-serie-descrizione-span');
		
		text_div.hide();
	
		text_span.click(function(){				
	
			text_div.stop().slideToggle('slow',function(){
				var my_style = text_div.css('display');
				
				if(my_style=='block'){
					text_span.addClass('arrowup');
				}else if(my_style=='none'){
					text_span.removeClass('arrowup');
				}
			});
		});
		
	
	});
	
	
			
	
	// **********************************************
	// animazione home
	// **********************************************


	$('#home_CollapsiblePanelContent').hide();
	
	$('#home_header h2').click(function(){				
	
		$('#home_CollapsiblePanelContent').stop().slideToggle('slow',function(){
			var my_style = $('#home_CollapsiblePanelContent').css('display');
			
			if(my_style=='block'){
				$('#home_header h2').addClass('arrowup');
			}else if(my_style=='none'){
				$('#home_header h2').removeClass('arrowup');
			}
		});
	});
		

	
	// **********************************************
	// GESTIONE VIDEO
	// **********************************************
	
	$("#video_dialog").dialog({
		autoOpen: false,
		bgiframe: true,
		resizable: false,
		width:670,
		height:410,
		modal: true,
		overlay: {
			backgroundColor: '#FFFFFF',
			opacity: 1
		}
	});


	

	$('#standard-documenti a.video').click(function(event){
		event.preventDefault();
		var my_video = $(this).attr('rel');
		var my_video_code = "<object width='640' height='360' id='flvPlayer'><param name='allowFullScreen' value='true' /><param name='movie' value='res/swf/player.swf?movie=../resources/"+my_video+"&bgcolor=0x2573d9&fgcolor=0x2573d9&volume=50&autoload=on&autorewind=on&clickurl=&clicktarget=&postimage=' /><embed src='res/swf/player.swf?movie=../resources/"+my_video+"&bgcolor=0x2573d9&fgcolor=0x2573d9&volume=50&autoload=on&autorewind=on&clickurl=&clicktarget=&postimage=' width='640' height='360' allowFullScreen='true' type='application/x-shockwave-flash' /></object>";
		$('#video_dialog').html(my_video_code).dialog('open');
	});
	
	//
	//
	// FINE GESTIONE VIDEO
	// **********************************************





	// rimuovo il testo contenuto nell'input del campo di ricerca
	$('#ricerca-form').one('focus', function(){
		$(this).val('');
	});



	//
	// animazione submenu e submenu parent
	//

	
	$('#standard-page-menu a').mouseover(function(){
		
		$(this).stop().animate({
			paddingRight:'10px',
			paddingLeft:'10px'
		}, 200);
	});
	
	$('#standard-page-parent-menu a').mouseout(function(){
		
		$(this).stop().animate({
			paddingRight:'5px',
			paddingLeft:'5px'
		}, 200);
	});

	$('#standard-page-parent-menu a').mouseover(function(){
		
		$(this).stop().animate({
			paddingRight:'10px',
			paddingLeft:'10px'
		}, 200);
	});
	
	$('#standard-page-menu a').mouseout(function(){
		
		$(this).stop().animate({
			paddingRight:'5px',
			paddingLeft:'5px'
		}, 200);
	});	

	///////////////////////////////////////////////////
	// TOOLTIP IN NAVIGAZIONE PRODOTTI

	/*
		$('.prodotti-serie li a').bind('mousemove',function(e){
			var my_top = e.pageY - 20;
			var my_left = e.pageX + 20;
			var mytip = $('#blustyle_tooltip');
			var my_contenuto = $(this).find('span').html();
			mytip.html(my_contenuto);
			mytip.css("top",my_top);
			mytip.css("left",my_left);
			mytip.fadeIn(100);

		});

		$('.prodotti-serie li a').bind('mouseleave',function(){
			var mytip = $('#blustyle_tooltip');
			//mytip.hide();
			mytip.hide();
		});
	*/
		
	///////////////////////////////////////////////////
	// ANIMAZIONE HOME
	
	$('#home_main_menu a').bind('mouseover',function(e){
		$(this).stop().animate({
		top:"5px"		
		},100);
	});
	
	$('#home_main_menu a').bind('mouseout',function(e){
		$(this).stop().animate({top:"10px"},100);
	});
	

	
});// CHIUDO DOMREADY


///////////////////////////////////////////////////
// GOOGLE ANALYTICS ASINCRONO

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2674600-15']);
_gaq.push(['_trackPageview']);

  (function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
  })();



