
/* funzione per aprire una finestra */
function intercetta() {
	var url="";
	for (var i=0; i<document.links.length; i++) {
		url=document.links[i].href;
		if(url.substring(0,7)!="mailto:"){
			url=url.split("'");
			url=url.join("\\'");
	    	switch(document.links[i].className){
				case"linkEsterno":
				case"linkRed":
				case"linkEsternoPdf":
				case"darkbluelink":
					document.links[i].href="javascript:open_linkEsterno('"+url+"');";
				break;
			}
		}
	}
}
window.onload = intercetta;


/* open popup */
function open_popup(url,x,y) {
	sealWin = window.open(url,"win","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+x+",height="+y);
}
function open_linkEsterno(url){
	var o=window.open(url,'_blank');
	if(o==undefined){
		if(confirm("E' stata bloccata l'apertura della pagina in una nuova finestra:\n\n"+url+"\n\nVuoi aprire la pagina nella finestra corrente?"))document.location.href=url;
	}
}

//controllo campi e.mail
function FrontPage_Form1_Validator(theForm)
{

  if (theForm.Azienda.value == "")
  {
    alert("Inserire un valore per il campo \"Azienda\".");
    theForm.Azienda.focus();
    return (false);
  }

  if (theForm.Nome.value == "")
  {
    alert("Inserire un valore per il campo \"Nome\".");
    theForm.Nome.focus();
    return (false);
  }

  if (theForm.Indirizzo.value == "")
  {
    alert("Inserire un valore per il campo \"Indirizzo\".");
    theForm.Indirizzo.focus();
    return (false);
  }

  if (theForm.City.value == "")
  {
    alert("Inserire un valore per il campo \"City\".");
    theForm.City.focus();
    return (false);
  }

  if (theForm.Paese.value == "")
  {
    alert("Inserire un valore per il campo \"Paese\".");
    theForm.Paese.focus();
    return (false);
  }

  if (theForm.email_azienda.value == "")
  {
    alert("Inserire un valore per il campo \"email_azienda\".");
    theForm.email_azienda.focus();
    return (false);
  }

  if (theForm.Tel.value == "")
  {
    alert("Inserire un valore per il campo \"Tel\".");
    theForm.Tel.focus();
    return (false);
  }
  
  if (theForm.Fax.value == "")
  {
    alert("Inserire un valore per il campo \"Fax\".");
    theForm.Fax.focus();
    return (false);
  }
  
  return (true);
}

//script per gallery 

//finestra centrale
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+'';
win = window.open(mypage,myname,settings)
}

//funzione per le thumb (effetto fade)
function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",30)
}
function low(which2){
clearInterval(highlighting)
if (which2.style.MozOpacity)
which2.style.MozOpacity=0.3
else if (which2.filters)
which2.filters.alpha.opacity=50
}

function highlightit(cur2){
if (cur2.style.MozOpacity<1)
cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
else if (cur2.filters&&cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}