function loadFlash() {

	var flashvars = {};
	var params = {
		allowScriptAccess: "sameDomain"
	  , allowFullScreen: "false"
	  , quality: "high"
	  , bgcolor: "#ffffff"
	};
	var attributes = {};

	swfobject.embedSWF("/skin/website/swf/contacts.swf", "flash", "670", "701", "9.0.0", "expressInstall.swf", flashvars, params, attributes);

}



$(document).ready(function() {
	
	if ($("#flash").length > 0) {
		loadFlash();
	}
	
	// gestione IMG HOVER
	$(".icsmMouseOver").each(function() {
		var src = $(this).attr('src');
		var extension = src.substring(src.lastIndexOf('.'),src.length);
		$(this).mouseover(function() {
			$(this).attr('src',src.replace(extension,'_over' + extension));
		});
		$(this).mouseout(function() {
			$(this).attr('src',src);
		});
	});
	
	$("h1:has(img)").each(function() {
		var img       = $(this).find(".titolo");
		var imgWidth  = img.width();
		var imgHeight = img.height();
		var hPos      = imgWidth+20;
		var vPos      = imgHeight-2;
		$(this).css({
					border:"none"
				  , background:"url(/skin/website/widgets/sf-h1.gif) no-repeat "+hPos+"px "+vPos+"px"
					});
	});
	
	if ($(".imgGallery").length > 0) {
		var textHeight = $(".text").height();
		var imgHeight  = $(".imgGallery").height();
		if (textHeight > imgHeight) {
			$(".imgGallery").height(textHeight);
		}
	}
	
	if ($(".lightbox").length > 0) {
		$(".lightbox").lightbox();
		//$(".lightbox").lightBox({fixedNavigation:true});
	}
	
	if ($(".prodApplicazioni").length > 0) {
			$(".prodApplicazioni").hide();
		$(".viewApplicazioni").click(function() {
			$(".prodApplicazioni").slideToggle();
			return false;
		});
	}
	
	if ($(".contatti").length > 0) {
		$(".indirizziLista li").each(function() {
			$(this).hide();
		});
		$("#manager").show();
		
		$("div.map a").click(function() {
			$(".indirizziLista li").each(function() {
				$(this).hide();
			});
			var classe = $(this).attr("class");
			$(".indirizziLista li."+classe).fadeIn();
			return false;
		});
		
		$('.province').each(function() {
			//$(this).hide();
		});
		$('.regione a').each(function() {
			$(this).click(function() {
				$(this).siblings('ul.province').toggle();
				return false;
			});
		});	
		$("ul.province a").click(function() {
			var classe = $(this).attr("class");
			$(".indirizziLista li."+classe).fadeIn();
			return false;
		});
	
		// gestione indirizzi in contatti
		var listaHeight = $('.mainContent').height();
		$('#indirizziLista').height(listaHeight);
		$('ul.indirizziLista').scrollFollow();
		
		
	}

});