// JavaScript Document


function SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}



// serve per switchare tra  blovc e none 
// ossia visualizzaree o nascondere l'oggetto div 'obj'
// passato come variabile
   function showhide(obj)
	{
      if (document.getElementById(obj).style.display=='block') {
            // fai .....
		document.getElementById(obj).style.display='none';		
      } else {
            // fai .....
		document.getElementById(obj).style.display='block';		
      }
    }
	

<!-- script per aggiugnere ai preferiti-->
function addBookmark(title,url) {
  if (window.sidebar)
  {
    window.sidebar.addPanel(title, url,"");
  }
  else if( document.all )
  {
    window.external.AddFavorite( url, title);
  }
  else
  {
    return true;
  }
}

<!-- finestra popup generica con variabili-->
function popup_generica (url,wname,w,h,scroll,browserloc,menubar,resizable,status,directories,toolbar) {
	var winl = (screen.width - w) / 2 - 5;
	var wint = (screen.height - h) / 2 -80;
	finestra = window.open(url,wname,'top='+wint+',left='+winl+',width='+w+',height='+h+',buttons=1,scrollbars='+scroll+',location='+browserloc+',menubar='+menubar+',resizable='+resizable+',status='+status+',directories='+directories+',toolbar='+toolbar+',copyhistory=Yes');
}

<!-- trasparenza png-->
function correctPNG() 
   {
   for(var i=0; i<document.images.length; i++)
      {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle        
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML
         i = i-1
         }
      }
   }
   
window.attachEvent("onload", correctPNG);

<!--- finestra popup immagini ingrandite centrata --->

function popup_image(theURL,winName,features) {
    finestra=window.open(theURL,winName,features);  
}

