$(document).ready(function(){

	var ua = navigator.userAgent.toLowerCase(); 
	var browser,version,data; 

	function detect(text) {
		stringposition = ua.indexOf(text) + 1;
		data = text;
		return stringposition;
	} 
	
	
	if (detect('msie')) browser = 'Internet Explorer';
	if (!version) version = ua.charAt(stringposition + data.length);
	if (browser == 'Internet Explorer' && (version >= 5 && version <=6)) {	
	
		$('#uno img').css({'behavior': 'url(../js/iepngfix.htc)'});
		$('#due img').css({'behavior': 'url(../js/iepngfix.htc)'});
		$('#tre img').css({'behavior': 'url(../js/iepngfix.htc)'});
	}						
		
	
	//rollover menu orizzontale
	//per il rollover le immagini devono avere lo stesso nome
	var pathOn2  = "http://www.hotelsetar.it/grafica/template/blocchicentro/roll/";
	var pathOff2 = "http://www.hotelsetar.it/grafica/template/blocchicentro/";

	$('#menucentrale li a').each(function(){
		var path = $(this).children('img').attr('src');
		var pathimg = path.split('/');
		var img = pathimg[(pathimg.length-1)];			

		$(this).hover( 				 			
				function () {	
					$(this).children(0).fadeTo('fast',.9);
					$(this).children(0).attr('src', pathOn2 + img);
					$(this).children(0).fadeTo('fast',1);

				},
				function(){
					$(this).children(0).fadeTo('fast',.9);
					$(this).children(0).attr('src', pathOff2 + img);					
					$(this).children(0).fadeTo('fast',1);
				}
		);
	});
	
	
	
	
	//rollover menu orizzontale
	//per il rollover le immagini devono avere lo stesso nome
	var pathOn  = "http://www.hotelsetar.it/grafica/template/menutop/roll/";
	var pathOff = "http://www.hotelsetar.it/grafica/template/menutop/";

	$('#menutop li a').each(function(){
		var path = $(this).children('img').attr('src');
		var pathimg = path.split('/');
		var img = pathimg[(pathimg.length-1)];			

		$(this).hover( 				 			
				function () {	
					$(this).children(0).fadeTo('slow',Math.random());
					$(this).children(0).attr('src',pathOn + img);
					$(this).children(0).fadeTo('slow',1);
				},
				function(){
					$(this).children(0).fadeTo('slow',Math.random());
					$(this).children(0).attr('src',pathOff + img);
					$(this).children(0).fadeTo('slow',1);
				}
		);
	});



	$("#showr").click(function () {
								
      $("div:eq(0)").show("fast", function () {
        // use callee so don't have to name the function
        $(this).next().show("fast", arguments.callee); 
      });
    });
    $("#hidr").click(function () {
      $("div").hide(2000);
    });
	


	
	$("#selezionalingua").each(function(){
		$("#lelingue").hide();
		$(this).hover(			
			function(){ 
				 $("#lelingue").slideDown("slow");
		  }, function(){ 
				 $("#lelingue").slideUp("slow");
		  });
	});


	//rollover menu orizzontale
	//per il rollover le immagini devono avere lo stesso nome
	var pathOn3  = "http://www.hotelsetar.it/grafica/templates/menu2RollON/";
	var pathOff3 = "http://www.hotelsetar.it/grafica/templates/menu2RollOFF/";

	$('#menuServizi ul li a').each(function(){
		if($(this).parent().parent().attr('class') != "sub"){
			var path = $(this).children('img').attr('src');
			var pathimg = path.split('/');
			var img = pathimg[(pathimg.length-1)];			
	
			$(this).hover( 				 			
					function () {		

							$(this).children(0).attr('src',pathOn3 + img);

					},
					function(){
						$(this).children(0).attr('src',pathOff3 + img);
					}
			);
		}
	});



});



