function ingrandimento(foto,w,h)
	{
	
	var pw = Math.floor((screen.width-w)/2);
	var ph = Math.floor((screen.height-h)/2);
	
	i1 = new Image;
	i1.src = foto;
	html = '<HTML>\n<HEAD>\n<TITLE>:: L\'Arte della Pasticceria - Ingrandimento Foto ::</TITLE>\n</HEAD>\n<CENTER><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0 BGCOLOR="#243F30">\n<A href="javascript:self.close();"><IMG SRC="'+foto+'" BORDER=0 alt="Clicca per chiudere la finestra" NAME=imageTest" width="' + w + '" height="' + h + '"></A></CENTER>\n</BODY>\n</HTML>';
	popupImage = window.open('','_blank',"top="+ph+",left="+pw+",width="+w+",height="+h,'toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0');
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close()
	};
	


// Preload Immagini

function PreloadImmagini()

{ 

  var args = PreloadImmagini.arguments;

  document.imageArray = new Array(args.length);

  for(var i=0; i<args.length; i++)

  {

    document.imageArray[i] = new Image;

    document.imageArray[i].src = args[i];

  }

}








//carica le immagini del Menu









// Rollover Immagini



function switchImage(imgName, imgSrc) 

{

  if (document.images)

  {

    if (imgSrc != "none")

    {

      document.images[imgName].src = imgSrc;

    }

  }

}



//Pop up di Login e Logout

function login(){
w = 300;
h = 300;
		var pw = Math.floor((screen.width-w)/2);
	    var ph = Math.floor((screen.height-h)/2);

			mywin=window.open('http://www.milazzonline.it/demo/script/mol_login.php',"login","top="+ph+",left="+pw+",width="+w+",height="+h);
			mywin.focus();

			

		}


function logout(){
w = 3;
h = 3;
		var pw = Math.floor((screen.width-w)/2);
	    var ph = Math.floor((screen.height-h)/2);

			mywin=window.open('http://www.milazzonline.it/demo/script/mol_logout.php',"logout","top="+ph+",left="+pw+",width="+w+",height="+h);
			window.self.focus();

			

		}
		
function logout2(url){
w = 300;
h = 300;
		var pw = Math.floor((screen.width-w)/2);
	    var ph = Math.floor((screen.height-h)/2);

			mywin=window.open(url,"logout","top="+ph+",left="+pw+",width="+w+",height="+h);

			

		}


//Pop up Generica



function pop_up(url,w,h,barre){

		var pw = Math.floor((screen.width-w)/2);
	    var ph = Math.floor((screen.height-h)/2);

			mywin=window.open(url,"popup","scrollbars="+barre+",top="+ph+",left="+pw+",width="+w+",height="+h);

			

		}




$(document).ready(function(){
				//funzione cycle per ruotare le immagini delle isole

	   
		
		$('.banner_ruota').show("fast"); 
		
		$('.banner_ruota').cycle({ 
			fx:    'fade', 
			delay: -2000,
			random: 1
		});
		

//segnala ad un amico
$("#button").click(    


			function() 
		    { 		
				
				 var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
				 
				if(
				   	($("#tuonome").val() == '')
					||
					($("#tuaemail").val() == '')
					||
					($("#amiconome").val() == '')
					||
					($("#amicoemail").val() == '')
					||
					($("#messaggio").val() == '')
					||
					($("#codeamico").val() == '')
									
				  ){
					
						alert('* = campi obbligatori');
						
				}
				else if(
						(!email_reg_exp.test($("#tuaemail").val()))
					||
					(!email_reg_exp.test($("#amicoemail").val()))
					){
					
						alert('Inserire indirizzi email corretti');
				}
				else{//inizio else
				
				//loading....
				$('#screen').hide(); 
	 			$("#contentLoading").show();  
				
				//invio
			    $.post("/_addon/server.php", 
				{ 
					//lingua: $("#lingua").val(),
					tuonome: $("#tuonome").val(),
					tuaemail: $("#tuaemail").val(),
					amiconome: $("#amiconome").val(),
					amicoemail: $("#amicoemail").val(),
					messaggio: $("#messaggio").val(),
					codeamico: $("#codeamico").val()

},
				function(data){	
				//recupero dati 
				$("#messaggioi").html(data.messaggioi); 
				$("#tuonome").val(data.tuonome); 
				$("#tuaemail").val(data.tuaemail); 
				$("#amiconome").val(data.amiconome); 
				$("#amicoemail").val(data.amicoemail); 
				$("#messaggio").val(data.messaggio);
				$("#codeamico").val('');
				document.getElementById('immaginecodice').src = '/__core/securimage/securimage_show.php?sid=' + Math.random();
				//visualizzo
				$("#contentLoading").hide("fast");
				$('#screen').show();  


				},"json");
				
				}//fine else
				 

		    }
			
	    );
//fine 

		
		$('.img_isola_ruota').show("fast"); 
		
		$('.img_isola_ruota').cycle({ 
			fx:    'fade', 
			delay: -2000,
			random: 1
		});
		

$('#preferiti').jFav();


 $('a.lightbox').lightBox();	

});