var transparentImage = "images/none.html";

function fixTrans()
{
	if (typeof document.body.style.maxHeight == 'undefined') {

	var imgs = document.getElementsByTagName("img");
	
	for (i = 0; i < imgs.length; i++)
	{	
		if (imgs[i].src.indexOf(transparentImage) != -1)
		{
			return;
		}

		if (imgs[i].src.indexOf(".png") != -1)
			{
				var src = imgs[i].src;
				imgs[i].src = transparentImage;
				imgs[i].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
				imgs[i].style.display = "inline-block";
			}
		}	
	}
}

if (document.all && !window.opera)
	attachEvent("onload", fixTrans);



$(document).ready(function() {
  
  // Nasconde titolo se c'e' l'immagine per il titolo
  if ($('.text-holder img.nascondi').length > 0) $('.text-holder h1:first').hide()
    
  //drop-down menu
  $('ul.navigation > li').hover(function() {
	$('a:first',this).addClass('selezionata');
    $('ul:first', this).show();
  },
  function() {
    $('ul:first', this).hide();
	$('a:first',this).removeClass('selezionata');
  });

  $('ul.navigation li li').hover(function() {
    $('ul:first', this).each(function() {
      $(this).css('top', $(this).parent().position().top );
      $(this).css('left', $(this).parent().position().left + $(this).parent().width() );
      $(this).show();
    });
  },
  function() {
    $('ul:first', this).hide();
  });
});


function MM_validateForm_IT() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm_IT.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' deve contenere un indirizzo e-mail.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+'deve contenere un numero.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' deve contenere un numero compreso tra '+min+' e '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' obbligatorio.\n'; }
    } if (errors) alert('Errore/i:\n'+errors);
    document.MM_returnValue = (errors == '');
} }