var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]
 
};
BrowserDetect.init();

//GUERRERA JQUERY
$(document).ready(function() {
        $("#carousel").featureCarousel({
		
		  trackerIndividual: false,
		  autoPlay: 2000,
		  carouselSpeed: 1000,
		  largeFeatureWidth: 0,
		  largeFeatureHeight: 0
        });
		
		
		
		$(function() {
	
	$('#lightbox a').lightBox(); 
	$('.foto a').lightBox();
	$('.foto2 a').lightBox();
	$('.foto3 a').lightBox();
	$('.boxfoto a ').lightBox();
	
			});
      });
	  
	   
$(document).ready(function() {


if( BrowserDetect.browser == 'Explorer' && ( BrowserDetect.version == 7 || BrowserDetect.version == 8  )) {

	$('.header').show();

	$('.footer').show();

	$('.menu').show();

		  
	$('.logo').show();

	$('.slogan').show();



}

else {
	  
	  $('.header').show("fade",2500);
	  $('.footer').show("fade",2500);
	  $('.menu').show("fade",2500);
	  
	  $('.logo').delay(500).show("fade",1000);
	  $('.slogan').delay(1000).show("fade",1000);
	 
}
});


//MENU HOVER


$(document).ready(function() {
	
	$('#chi').mouseover(function() { 
	
		if( $('.chisiamo').is(':visible') ) {
			$('.chisiamo').hide();
			$('.chisiamohover').show();
		}
	});
	
	
	
	$('#chi').mouseout(function() { 
	
		if( $('.chisiamohover').is(':visible') ) {
	
			$('.chisiamohover').hide();
			$('.chisiamo').show();
		}
	});
	
	
	$('#prod').mouseover(function() { 
	
	if ( $('.prodotti').is(':visible') ) {
	
		$('.prodotti').hide();
		$('.prodottihover').show();
		}
	});
	
	$('#prod').mouseout(function() { 
	
	if ( $('.prodottihover').is(':visible') ) {
	
	
		$('.prodottihover').hide();
		$('.prodotti').show();
		}
	});
	
	$('#punti').mouseover(function() { 
	
	
	if ( $('.puntivendita').is(':visible') ) {
	
		$('.puntivendita').hide();
		$('.puntivenditahover').show();
		
		}
	});
	
	$('#punti').mouseout(function() { 
	
	if( $('.puntivenditahover').is(':visible') ) {
	
		$('.puntivenditahover').hide();
		$('.puntivendita').show();
		}
	});
	
	$('#dep').mouseover(function() { 
	
	if( $('.deposito').is(':visible') ) {
		$('.deposito').hide();
		$('.depositohover').show();
		}
	});
	
	$('#dep').mouseout(function() { 
	
	if($('.depositohover').is(':visible') ) {
		$('.depositohover').hide();
		$('.deposito').show();
		}
	});
	
	$('#trans').mouseover(function() { 
	
	if($('.trasporti').is(':visible') ) {
		
		$('.trasporti').hide();
		$('.trasportihover').show();
	}
	});
	
	$('#trans').mouseout(function() { 
	
	if($('.trasportihover').is(':visible') ) {
		$('.trasportihover').hide();
		$('.trasporti').show();
	}
	});
	
	$('#contact').mouseover(function() { 
	
	if($('.contatti').is(':visible') ) {
		$('.contatti').hide();
		$('.contattihover').show();
	}
	});
	
	$('#contact').mouseout(function() { 
	
	if($('.contattihover').is(':visible') ) {
		$('.contattihover').hide();
		$('.contatti').show();
	}
	});
	
	$('#vid').mouseover(function() { 
	
	if($('.video').is(':visible') ) {
		$('.video').hide();
		$('.videohover').show();
	}
	});
	
	
	$('#vid').mouseout(function() { 
	
	if($('.videohover').is(':visible') ){
		$('.videohover').hide();
		$('.video').show();
	}
	});
});
	
	//MENU CLICK
$(document).ready(function() {
	$('#chi').click(function() { 
	
	if( BrowserDetect.browser == 'Explorer' && ( BrowserDetect.version == 7 || BrowserDetect.version == 8  )) {
		
		$('#carousel-container').hide();
		$('#vendita').hide();
		$('#traspo').hide();
		$('#depo').hide();
		$('#contac').hide();
		$('#vide').hide();
		$('#about').show();
		$(document).hidemenu2();
		$('.chisiamoactive').show();
		$('.prodotti').show();
		$('.puntivendita').show();
		$('.deposito').show();
		$('.contatti').show();
		$('.video').show();
		$('#lightbox').hide();
	
	
	}
	
	else {
	
		$('#carousel-container').hide("fade",1000);
		$('#vendita').hide("fade",1000);
		$('#traspo').hide("fade",1000);
		$('#depo').hide("fade",1000);
		$('#contac').hide("fade",500);
		$('#about').show("fade",1000);
		$('#vide').hide("fade",500);
		$(document).hidemenu();
		$('.chisiamoactive').show("fade",500);
		$('.prodotti').show("fade",500);
		$('.puntivendita').show("fade",500);
		$('.deposito').show("fade",500);
		$('.contatti').show("fade",500);
		$('.video').show("fade",500);
		$('#lightbox').hide("fade",500);
	}
	
	});
	
	$('.logo').click(function() { 
	
	if( BrowserDetect.browser == 'Explorer' && ( BrowserDetect.version == 7 || BrowserDetect.version == 8  )) {
		
		$('#vendita').hide();
		$('#about').hide();
		$('#traspo').hide();
		$('#depo').hide();
		$('#contac').hide();
		$('#vide').hide();
		$('#carousel-container').show();
		$(document).hidemenu2();
		$('#lightbox').hide();
		$('.chisiamo').show();
		$('.deposito').show();
		$('.contatti').show();
		$('.video').show();
		$('.puntivendita').show();
		
		
	}
	
	else {
	
		$('#vendita').hide("fade",1000);
		$('#about').hide("fade",1000);
		$('#traspo').hide("fade",1000);
		$('#depo').hide("fade",1000);
		$('#contac').hide("fade",500);
		$('#vide').hide("fade",500);
		$('#carousel-container').show("fade",1000);
		$(document).hidemenu();
		$('#lightbox').hide("fade",500);
		$('.chisiamo').show("fade",500);
		$('.deposito').show("fade",500);
		$('.contatti').show("fade",500);
		$('.video').show("fade",500);
		$('.puntivendita').show("fade",500);
	}
	});
	
	$('#prod').click(function() { 
	
		if( BrowserDetect.browser == 'Explorer' && ( BrowserDetect.version == 7 || BrowserDetect.version == 8  )) {
			
			$('#carousel-container').hide();
			$('#about').hide();
			$('#vendita').hide();
			$('#traspo').hide();
			$('#depo').hide();
			$('#vide').hide();
			$('#contac').hide();
			$('#lightbox').show();	
			$(document).hidemenu2();
			$('.prodottiactive').show();
			$('.chisiamo').show();
			$('.deposito').show();
			$('.contatti').show();
			$('.video').show();
			$('.puntivendita').show();
			
		}
		else {
			
			$('#carousel-container').hide("fade",1000);
			$('#about').hide("fade",1000);
			$('#vendita').hide("fade",1000);
			$('#traspo').hide("fade",1000);
			$('#depo').hide("fade",1000);
			$('#vide').hide("fade",500);
			$('#contac').hide("fade",500);
			$('#lightbox').show("fade",1000);	
			$(document).hidemenu();
			$('.prodottiactive').show("fade",500);
			$('.chisiamo').show("fade",500);
			$('.deposito').show("fade",500);
			$('.contatti').show("fade",500);
			$('.video').show("fade",500);
			$('.puntivendita').show("fade",500);
		
		}
	});
	
	$('#punti').click(function() {
		
		if( BrowserDetect.browser == 'Explorer' && ( BrowserDetect.version == 7 || BrowserDetect.version == 8  )) {
			
			$('#carousel-container').hide();
			$('#about').hide();
			$('#lightbox').hide();
			$('#traspo').hide();
			$('#depo').hide();
			$('#contac').hide();
			$('#vide').hide();
			$('#vendita').show();
			$(document).hidemenu2();
			$('.prodotti').show();
			$('.chisiamo').show();
			$('.deposito').show();
			$('.contatti').show();
			$('.video').show();
			$('.puntivenditactive').show();
			
		}
	
		else {
			
			$('#carousel-container').hide("fade",1000);
			$('#about').hide("fade",1000);
			$('#lightbox').hide("fade",1000);
			$('#traspo').hide("fade",1000);
			$('#depo').hide("fade",1000);
			$('#contac').hide("fade",500);
			$('#vide').hide("fade",500);
			$('#vendita').show("fade",1000);
			$(document).hidemenu();
			$('.prodotti').show("fade",500);
			$('.chisiamo').show("fade",500);
			$('.deposito').show("fade",500);
			$('.contatti').show("fade",500);
			$('.video').show("fade",500);
			$('.puntivenditactive').show("fade",500);
		}
	});
	
	
	$('#trans').click(function() { 
	
		if( BrowserDetect.browser == 'Explorer' && ( BrowserDetect.version == 7 || BrowserDetect.version == 8  )) {
			
			$('#carousel-container').hide();
			$('#about').hide();
			$('#lightbox').hide();
			$('#vendita').hide();
			$('#depo').hide();
			$('#contac').hide();	
			$('#vide').hide();
			$('#traspo').show();	
			$(document).hidemenu2();
			$('.prodotti').show();
			$('.chisiamo').show();
			$('.puntivendita').show();
			$('.deposito').show();
			$('.contatti').show();
			$('.video').show();
			$('.trasportiactive').show();
			
		}
		
		else {
	
		$('#carousel-container').hide("fade",1000);
		$('#about').hide("fade",1000);
		$('#lightbox').hide("fade",1000);
		$('#vendita').hide("fade",1000);
		$('#depo').hide("fade",1000);
		$('#contac').hide("fade",500);	
		$('#vide').hide("fade",500);
		$('#traspo').show("fade",1000);	
		$(document).hidemenu();
		$('.prodotti').show("fade",500);
		$('.chisiamo').show("fade",500);
		$('.puntivendita').show("fade",500);
		$('.deposito').show("fade",500);
		$('.contatti').show("fade",500);
		$('.video').show("fade",500);
		$('.trasportiactive').show("fade",500);
		}
		
	});	
	
	$('#dep').click(function() { 
	
	
		if( BrowserDetect.browser == 'Explorer' && ( BrowserDetect.version == 7 || BrowserDetect.version == 8  )) {
			
			$('#carousel-container').hide();
			$('#about').hide();
			$('#lightbox').hide();
			$('#vendita').hide();
			$('#traspo').hide();
			$('#contac').hide();	
			$('#vide').hide();
			$('#depo').show();
			$(document).hidemenu2();
			$('.prodotti').show();
			$('.chisiamo').show();
			$('.puntivendita').show();
			$('.trasporti').show();
			$('.contatti').show();
			$('.video').show();
			$('.depositoactive').show();
			
		}
		
		else {
	
		$('#carousel-container').hide("fade",1000);
		$('#about').hide("fade",1000);
		$('#lightbox').hide("fade",1000);
		$('#vendita').hide("fade",1000);
		$('#traspo').hide("fade",1000);
		$('#contac').hide("fade",500);	
		$('#vide').hide("fade",500);
		$('#depo').show("fade",500);
		$(document).hidemenu();
		$('.prodotti').show("fade",500);
		$('.chisiamo').show("fade",500);
		$('.puntivendita').show("fade",500);
		$('.trasporti').show("fade",500);
		$('.contatti').show("fade",500);
		$('.video').show("fade",500);
		$('.depositoactive').show("fade",500);
		
		}
		
	});	
	
	$('#contact').click(function() { 
	
		if( BrowserDetect.browser == 'Explorer' && ( BrowserDetect.version == 7 || BrowserDetect.version == 8  )) {
			
			$('#carousel-container').hide();
			$('#about').hide();
			$('#lightbox').hide();
			$('#vendita').hide();
			$('#traspo').hide();	
			$('#depo').hide();
			$('#vide').hide();
			$('#contac').show();
			$(document).hidemenu2();
			$('.prodotti').show();
			$('.chisiamo').show();
			$('.puntivendita').show();
			$('.trasporti').show();
			$('.deposito').show();
			$('.video').show();
			$('.contattiactive').show();
			
		}
		
		else {
	
		$('#carousel-container').hide("fade",1000);
		$('#about').hide("fade",1000);
		$('#lightbox').hide("fade",1000);
		$('#vendita').hide("fade",1000);
		$('#traspo').hide("fade",1000);	
		$('#depo').hide("fade",500);
		$('#vide').hide("fade",500);
		$('#contac').show("fade",500);
		$(document).hidemenu();
		$('.prodotti').show("fade",500);
		$('.chisiamo').show("fade",500);
		$('.puntivendita').show("fade",500);
		$('.trasporti').show("fade",500);
		$('.deposito').show("fade",500);
		$('.video').show("fade",500);
		$('.contattiactive').show("fade",500);
		
		}
		
	});	
	
	$('#vid').click(function() { 
	
		if( BrowserDetect.browser == 'Explorer' && ( BrowserDetect.version == 7 || BrowserDetect.version == 8  )) {
		
			$('#carousel-container').hide();
			$('#about').hide();
			$('#lightbox').hide();
			$('#vendita').hide();
			$('#traspo').hide();	
			$('#depo').hide();
			$('#contac').hide();
			$('#vide').show();
			$(document).hidemenu2();
			$('.prodotti').show();
			$('.chisiamo').show();
			$('.puntivendita').show();
			$('.trasporti').show();
			$('.deposito').show();
			$('.contatti').show();
			$('.videoactive').show();
			
		}
	
		else {
			
		$('#carousel-container').hide("fade",1000);
		$('#about').hide("fade",1000);
		$('#lightbox').hide("fade",1000);
		$('#vendita').hide("fade",1000);
		$('#traspo').hide("fade",1000);	
		$('#depo').hide("fade",500);
		$('#contac').hide("fade",500);
		$('#vide').show("fade",500);
		$(document).hidemenu();
		$('.prodotti').show("fade",500);
		$('.chisiamo').show("fade",500);
		$('.puntivendita').show("fade",500);
		$('.trasporti').show("fade",500);
		$('.deposito').show("fade",500);
		$('.contatti').show("fade",500);
		$('.videoactive').show("fade",500);
		
		}
	});	
	
});


$.fn.hidemenu = function() {
	
	
	
	$('.chisiamohover').hide("fade",500);
	$('.chisiamoactive').hide("fade",500);
	$('.prodottihover').hide("fade",500);
	$('.prodottiactive').hide("fade",500);
	$('.puntivenditahover').hide("fade",500);
	$('.puntivenditactive').hide("fade",500);
	$('.trasportiahover').hide("fade",500);
	$('.trasportiactive').hide("fade",500);
	$('.depositohover').hide("fade",500);
	$('.depositoactive').hide("fade",500);
	$('.contattihover').hide("fade",500);
	$('.contattiactive').hide("fade",500);
	$('.videohover').hide("fade",500);
	$('.videoactive').hide("fade",500);
	
	
	
}

$.fn.hidemenu2 = function() {
	
	
	
	$('.chisiamohover').hide();
	$('.chisiamoactive').hide();
	$('.prodottihover').hide();
	$('.prodottiactive').hide();
	$('.puntivenditahover').hide();
	$('.puntivenditactive').hide();
	$('.trasportiahover').hide();
	$('.trasportiactive').hide();
	$('.depositohover').hide();
	$('.depositoactive').hide();
	$('.contattihover').hide();
	$('.contattiactive').hide();
	$('.videohover').hide();
	$('.videoactive').hide();
	
	
	
}


/*
if( BrowserDetect.browser == 'Explorer' && ( BrowserDetect.version == 7 || BrowserDetect.version == 8  ))
*/	
	
	
	
	
