//if(screen.width<=1024){
//	alert("La risoluzione del tuo schermo e' inferiore a 1024px.\nPer visualizzare correttamente il sito ti preghiamo \ndi impostare lo zoom del browser al 75%.");
	//$('body').addClass('.ZoomClass');
//}
	

//funzione che si occupa dell'inizializzazione dei pulsanti

function IniPulsanti(valore){
	$("#Condividi").click( function (){
		$("#nascosto").slideDown("slow");
	});
	$(".btn").each(function() {
		var percorso = $(this).attr("src").split(".");
		$(this).hover(	
			function () {
				$(this).attr({src: "." + percorso[1] + "Up." + percorso[2]});
				$(".sottoMenu").hide();
				$("#"+$(this).attr('alt')).show();
				
			}, 
            function () {
            	$(this).attr({src: "." + percorso[1] + "." + percorso[2]});
            	
            }
        );
	});
	if(valore!=""){	$("#"+valore).show(); }
	$("#topper").hover(
			function () {
			}, 
            function () {
            	$(".sottoMenu").hide();
            	$("#"+valore).show();
            }
	);
	$(".btn2").each(function() {
		var percorso = $(this).attr("src").split(".");
		$(this).hover(	
			function () {
				$(this).attr({src: "." + percorso[1] + "Up." + percorso[2]});
				
			}, 
            function () {
            	$(this).attr({src: "." + percorso[1] + "." + percorso[2]});
            	
            }
        );
	});
	$("#nascosto").click(function(){chiudiPagina();});
}


//funzione che si occupa delle png per IE6
function IniPng(){
	$('img[@src$=.png], div').ifixpng();
}


//funzione che inizializza la mappa di Google
function initialize() {
	var myLatlng = new google.maps.LatLng(41.863727, 12.460515);
	var myOptions = {
	  zoom: 16,
	  center: myLatlng,
	  mapTypeId: google.maps.MapTypeId.ROADMAP
	}

	var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

	var contentString = '<div id="content">'+'<div id="siteNotice"></div>'+'<h1 id="firstHeading" class="firstHeading">EsaRoma Srl</h1>'+'<div id="bodyContent">'+'<p>Via Nicola Pellati, 54 00149 Roma<br>'+'Tel. <br>'+'Fax. <br>'+'</p>'+'</div>'+'</div>';

	var infowindow = new google.maps.InfoWindow({
	    content: contentString
	});

	var marker = new google.maps.Marker({
	    position: myLatlng,
	    map: map,
	    title:"Prova"
	});

	google.maps.event.addListener(marker, 'click', function() {
	  infowindow.open(map,marker);
	});
}

function IniDragNDrop(){
	$("#nascosto").hide();	
	if ( $.browser.msie ) {
  		if( parseInt($.browser.version, 10) < 7 )
  			alert('Questo sito non supporta browser di vecchia generazione, le consigliamo di aggiornare i suoi strumenti di navigazione.')
	}

}


var flickerPage = null;
var facebookPage = null;

function OpenFlicker(pagina){
	var w=800;
	var h=400;
	var left = 200;
	var top = 200;
	var option = 'width='+w+',height='+h+',';
	option += 'screenX='+left+',screenY='+top+',left='+left+',top='+top+',';
	option += 'resizable=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no';
	var page = 'http://twitter.com/home?status=Currently reading ' + pagina;
	flickerPage = window.open( page ,'twitter',option);
	flickerPage.focus();
	chiudiPagina();
}

function OpenFacebook(pagina){
	var w=900;
	var h=600;
	var left = 200;
	var top = 200;
	var option = 'width='+w+',height='+h+',';
	option += 'screenX='+left+',screenY='+top+',left='+left+',top='+top+',';
	option += 'resizable=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no';
	var page = 'http://www.facebook.com/sharer.php?u=' + pagina;
	facebookPage = window.open( page ,'facebook',option);
	facebookPage.focus();
	chiudiPagina();
}

function chiudiPagina(){
	$("#nascosto").slideUp("slow", function(){$(this).hide();}); return false;
}

var maxLeft = 0;
var maxRight = 0;

function iniGallery(){
	var numeroImg = $('#ulGallery img').size();
	var larghezzaImg = $('#ulGallery img:first').width();
	var marginImg = $('#ulGallery img:first').css("margin-right"); //alert(marginImg);
	marginImg =	parseInt(marginImg) -2;
	maxLeft = 0;
	maxRight = ((numeroImg * (larghezzaImg + (marginImg*2))) - $('#GalleriaC').width())*-1;
	//alert (maxRight);
	$('#Indietro').click(function(){
		var valore = $('#ulGallery').css("margin-left");
		valore = parseInt(valore);
		if( valore < maxLeft )
			$('#ulGallery').animate({ marginLeft: '+=663'}, 500, function() { });
	});
	$('#Avanti').click(function(){ 
		var valore = $('#ulGallery').css("margin-left");
		valore = parseInt(valore);
		//alert (valore);
		if( valore > maxRight)
			$('#ulGallery').animate({ marginLeft: '-=663'}, 500, function() { });
	});

}

function iniQuestionario(){
	$(".secondo ul li a").click(function() {
		$('.nascosto').hide();
		var daAprire = '#'+$(this).attr("title");
		//alert(daAprire);
		$(daAprire).fadeIn("slow");
		return false;
	});
}

