function MM_reloadPage(init) {  //reloads the window if Nav4 resized
    if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
    else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);

    function MM_findObj(n, d) { //v4.01
    var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
}

    function MM_showHideLayers() { //v6.0
    var i,p,v,obj,args=MM_showHideLayers.arguments;
    for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

     var flip = true;
        
 
 /*================== PAGINA TESSUTI POP UP =========================*/   
     function cambia(nome){         
         snome = "upload/collections/jpg_460x505/" + nome + ".jpg";
         //document.getElementById('img-big').src=snome;     
         //function VT_gallery(img, id) {
         if (flip) {
         $("#div-img-big-bis").css("background-image",'url('+snome+')');
         $("#div-img-big").fadeTo(1000, 0);
         $("#div-img-big-bis").fadeTo(1000, 1);        
         }
         else {
         $("#div-img-big").css("background-image",'url('+snome+')');
         $("#div-img-big-bis").fadeTo(1000, 0);
         $("#div-img-big").fadeTo(1000, 1);
            }
         flip = ! flip;
         }

/*================== PAGINA TESSUTI BACK BUTTON =========================*/      
     function icoon(){
             document.getElementById('bbutton').src="img/ico-back.gif"; 	 
	 }
     
     function icoout(){
             document.getElementById('bbutton').src="img/ico-back-sel.gif"; }
             
        
	 function cambio(){
		MM_showHideLayers('foto-div','','hide');	
		$('div.slidePrevControl').css('visibility','visible');  			
		$('div.slideNextControl').css('visibility','visible');  	
		
	 
	 }
             
/*================== BOTTONI BIANCHI WHITEBANNERS =========================*/              
       
        function light(id){ 
            sfondo=document.getElementById(id) ;
            sfondo.style.opacity="1";
			$(sfondo).css('filter','alpha(opacity:100)');  
			$(sfondo).css('-moz-opacity','1');  
			
        }
        function dark(id){
            sfondo=document.getElementById(id) ;
            sfondo.style.opacity="0.5";			
			$(sfondo).css('filter','alpha(opacity:50)');  
			$(sfondo).css('-moz-opacity','0.50');  
        }
            
       
       

// ================================= RETTANGOLO MENU ==========================================

function shape() 
    {
        if (($('#ret').lenght) > 0) {
          $('#ret').css("background-color","#fff");
          var pos = $('.selected').position();
          $('#ret').css({"top":pos.top+7,"left": 175}).show(500);   
        }
    }

	
 var blank = new Image();
 blank.src = 'img/blank.gif';
 
 
 $(document).ready(function() {
   var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
   if (badBrowser) {
     // get all pngs on page
     $('img[src$=.png]').each(function() {
       if (!this.complete) {
         this.onload = function() { fixPng(this) };
       } else {
         fixPng(this);
       }
     });
   }
 });
 
 function fixPng(png) {
   // get src
   var src = png.src;
   // set width and height
   if (!png.style.width) { png.style.width = $(png).width(); }
   if (!png.style.height) { png.style.height = $(png).height(); }
   // replace by blank image
   png.onload = function() { };
   png.src = blank.src;
   // set filter (display original image)
   png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
 }
	
// ================= APRIGOOGLEMAPS
 //   $(document).ready(function () 
 //   {
		$("#showMaps").click(function(event){  
			$('#div-cornice').animate( {height:'280px', width:'425px'},{queue:false, duration:1000});   
		});
//	});


// ==================== CAMBIA SFONDO AL LIVELLINO

  function setImageLivellino(newPath,semaforo){ 
           
    var img = new Image();
    img.src = newPath;
    img.onload = function(){
        $(this).css({"left":"0", "position":"absolute", "top":"0", "width":"100%"});
        $(".livellino_img1").before($(this)).fadeOut(1000,function(){
                $(this).remove();
                semaforo = true;      
            });
        $(this).addClass('livellino_img1');  
    };                                                  
             
}   


//Reperisce l'oggetto flash
function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

 
 
                    


