// JavaScript Document
//$(document).ready(function () {
  //  $(document).pngFix();
//});
$(document).ready(function(){ 
	/*gestione delle label dei TAB*/
	$("#interno_col_dx").find('img').each(function(){
		var align = $(this).attr('align') ;
		if(align == 'right'){
			$(this).addClass('dx');
		}
		if(align == 'left'){
			$(this).addClass('sx');
		}
	});

	$("#contenuti_home").find('img').each(function(){
		var align = $(this).attr('align') ;
		if(align == 'right'){
			$(this).addClass('dx');
		}
		if(align == 'left'){
			$(this).addClass('sx');
		}
	});

	$(".notizie .download_doc:last").css("border-bottom","0");
	$(".documentazione .download_doc:last").css("border-bottom","1px solid #D9D9D9");
	$(".documentazione .download_doc:last").css("padding-bottom","20px");
	$("#txtHint").css("overflow","hidden");
	$("h1").click(function(){
		$("#txtHint").slideToggle("slow");	
	});
	
});	

//script per la funzionalità Salva pagina nei bookmark (funziona solo con IE)
$(document).ready(function(){
	$("a.jqbookmark").click(function(event){
		event.preventDefault(); // prevent the anchor tag from sending the user off to the link
		var url = this.href;
		var title = this.title;

		if (window.sidebar) { // Mozilla Firefox Bookmark
			alert('Siamo spiacenti, ma il suo broser non supporta questa funzionalità. '
			 + 'La preghiamo di inserire manualmente la pagina tra i preferiti premendo [ctrl]+D se sta usando Windows oppure [cmd]+D se, invece, sta usando Mac! Grazie.');
		} else if( window.external ) { // IE Favorite
			window.external.AddFavorite( url, title);
		} else { // for Safari, Konq etc - browsers who do not support bookmarking scripts (that i could find anyway)
			 alert('Siamo spiacenti, ma il suo broser non supporta questa funzionalità. '
			 + 'La preghiamo di inserire manualmente la pagina tra i preferiti premendo [ctrl]+D se sta usando Windows oppure [cmd]+D se, invece, sta usando Mac! Grazie.');
		}

	});
});

$(document).ready(function(){ 	

	// Hover Menu principale IT
    $(".menu_it .trasporto a").hover(function () {
        $('.trasporto a img').attr('src', '/shared/i/menu_SRG_05.png');
    }, function () {
        $('.trasporto a img').attr('src', '/shared/i/menu_SRG_01.png');
    });
    $(".menu_it .rigassificazione a").hover(function () {
        $('.rigassificazione a img').attr('src', '/shared/i/menu_SRG_06.png');
    }, function () {
        $('.rigassificazione a img').attr('src', '/shared/i/menu_SRG_02.png');
    });
    $(".menu_it .stoccaggio a").hover(function () {
        $('.stoccaggio a img').attr('src', '/shared/i/menu_SRG_07.png');
    }, function () {
        $('.stoccaggio a img').attr('src', '/shared/i/menu_SRG_03.png');
    });
    $(".menu_it .distribuzione a").hover(function () {
        $('.distribuzione a img').attr('src', '/shared/i/menu_SRG_08.png');
    }, function () {
        $('.distribuzione a img').attr('src', '/shared/i/menu_SRG_04.png');
    });

	// Hover Menu principale EN
    $(".menu_en .trasporto a").hover(function () {
        $('.trasporto a img').attr('src', '/shared/i/menu_SRG_05_en.png');
    }, function () {
        $('.trasporto a img').attr('src', '/shared/i/menu_SRG_01_en.png');
    });
    $(".menu_en .rigassificazione a").hover(function () {
        $('.rigassificazione a img').attr('src', '/shared/i/menu_SRG_06_en.png');
    }, function () {
        $('.rigassificazione a img').attr('src', '/shared/i/menu_SRG_02_en.png');
    });
    $(".menu_en .stoccaggio a").hover(function () {
        $('.stoccaggio a img').attr('src', '/shared/i/menu_SRG_07_en.png');
    }, function () {
        $('.stoccaggio a img').attr('src', '/shared/i/menu_SRG_03_en.png');
    });
    $(".menu_en .distribuzione a").hover(function () {
        $('.distribuzione a img').attr('src', '/shared/i/menu_SRG_08_en.png');
    }, function () {
        $('.distribuzione a img').attr('src', '/shared/i/menu_SRG_04_en.png');
    });
		 
});

/* SCRIPT VECCHIO PER L'ALTEZZA DEL FONDO
$(document).ready(function(){
  var contenutiHomeHeight = $('#contenuti_home').height();
  $('#sfondo').height(contenutiHomeHeight);
});
 */

// Altezza div contenitore homepage (ULTIMO SCRIPT REALIZZATO)
// function getHeightVal(){
//    	totalHeight = $("#contenuti_home").outerHeight(true);
//    	$("#sfondo, #home").css({
//        	'height': totalHeight
//    	});
// };

// Altezza div contenitore homepage (ULTIMO SCRIPT REALIZZATO) con il ritardo per risolvere il bug dell'accavallamento
// $(document).ready(function(){
// 	setTimeout('getHeightVal();', 300);
// 	$(".TabbedPanelsTab").click( function(){
// 		setTimeout('getHeightVal();', 300);
// 	})
// });



$(document).ready(function(){
	/* organigramma */	
	/* hover navigazione PRESIDENTE AMMINISTRAZIONE SUPPLENTI */
	$(".presidente").hover(function(){
	  $(".tooltip_presidente").fadeToggle("slow");	
	});
  
	$(".amministratore").hover(function(){
	  $(".tooltip_amministratore").fadeToggle("slow");
	});	

	$(".supplenti_2").hover(function(){
	  $(".tooltip_supplenti_2").fadeToggle("slow");
	});	   
	
	$(".supplenti_1").hover(function(){
	  $(".tooltip_supplenti_1").fadeToggle("slow");
	});
});
// Text Resizer PRODUZIONE
$(document).ready(function() {

/* script per la comunicazione tra JS e Flash per il resiza del font */
// function getMovieName(movieName) {
// 	  if (navigator.appName.indexOf("Microsoft") != -1) {
// 	    return window[movieName]
// 	  }
// 	  else {
// 	    return document[movieName]
// 	  }
// 	}
//Spreparo le variabili da mandare al flash
// var flashSizeMappings = {
// 		smallText: 'small',
// 		mediumText: 'medium',
// 	    largeText: 'big'
// 	}

//Se esiste il cookie lo usa
	var cookieTextSize = $.cookie('TEXT_SIZE');
	if(cookieTextSize) {
		$('body').addClass(cookieTextSize);
		$('#containerFotoOverlayer.resizable').addClass(cookieTextSize);
	// var contenutiHomeHeight = $('#contenuti_home').height();
	//   $('#sfondo').height(contenutiHomeHeight);


	// window.setTimeout(function(){
	// 		try{
	// 			getMovieName('Snam').changeTextSizeFlash(flashSizeMappings[cookieTextSize]);
	// 		}
	// 		catch(ex){
	// 		}
	// 	}, 1000)  

		} 
	else $('body').addClass('smallText');

	// Funzione scatenata al click
	$('.textResizer a').click(function() {
		var textSize = $(this).parent().attr('class');
		$('body').removeClass('smallText mediumText largeText').addClass(textSize);
		$.cookie('TEXT_SIZE',textSize, { path: '/', expires: 10000 });
		$('#aggiornamento').addClass('resizable');

	// getMovieName('Snam').changeTextSizeFlash(flashSizeMappings[textSize]);

	// var contenutiHomeHeight = $('#contenuti_home').height();
	//   $('#sfondo').height(contenutiHomeHeight);
	});
});



//validator contatti1
// $(document).ready(function() {
// 	$("#f1").validate({
// 		rules: {
// 			fnome: "required",			
// 			fcognome: "required",			
// 			femail: {
// 				required: true,
// 				email: true
// 			},
// 			fsocieta: "required",
// 			fcategoria: "required",
// 			findirizzo: "required",
// 			fcitta: "required",
// 			fprovincia: "required"		
// 
// 		},
// 		messages: {
// 			fnome: "Nome obbligatorio",
// 			fcognome: "Cognome obbligatorio",
// 			femail: "Email obbligatoria",
// 			fsocieta: "Societ&agrave; obbligatoria",
// 			fcategoria: "Categoria obbligatoria",
// 			findirizzo: "Indirizzo obbligatorio",
// 			fcitta: "Citt&agrave; obbligatoria",
// 			fprovincia: "Provincia obbligatoria"		
// 
// 		}
//  	});
// });
//end validator contatti1

// evidenzia tutti i termini appartenenti al glossario
// function evidenzia_termini_glossario()
// {
// 	if ($("#evidenzia a").hasClass('evidenziato_on')) {
// 		$("#evidenzia a").removeClass("evidenziato_on");
// 		$("#evidenzia a").html("evidenzia i termini presenti nel glossario");
// 	}
// 	else { 
// 		$("#evidenzia a").addClass("evidenziato_on");
// 		$("#evidenzia a").html("nascondi i termini presenti nel glossario");
// 
// 	}
// 	
// 	$(".termine_glossario").each(function(){		
// 			if ($(this).hasClass('evidenziato')) { $(this).removeClass("evidenziato") }
// 			else { $(this).addClass("evidenziato") }
// 			});
// 	return true;
// }
//end evidenzia glossario




