//=======================================================================================================================
//Lock Dx
var message="";

function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")

//=======================================================================================================================
//Lock Img
var clickmessage=""

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
//alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
//alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
//alert(clickmessage)
return false
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()


//=======================================================================================================================
function stmfla(nome,larghezza,altezza,trasparenza,bgcolor,menu,nomediv,position,ptop,pleft,pright,liv){
//stmfla("swf/simbruina_stagna_cooming.swf",380,180,"transparent","#null","false","fla01","relative",0,0,0,1)

document.write ('<div id="'+nomediv+'" '
+ ' style="background-color:'+ bgcolor +';'
+ ' visibility:visible; '      
+ ' position:'+ position +'; '  //absolute|relative
+ ' top: '+ ptop +'; '         //numeric
+ ' left:'+ pleft +'; '        //numeric
+ ' right:'+ pright +'; '      //numeric
+ ' width: ' + larghezza + ' ;' 
+ ' height:' + altezza + ';'
+ ' z-index:' + liv + '">'     //numeric pos 1..9999

//nome = nome file completo di estenzione
//larghezza = px
//altezza = px
//trasparenza = transparent se vero | se falso null
//bgcolor = se vero #hex | se falso null
//menu = true|false
+ '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
+'codebase="http://download.macro....................................sh.cab#version=5,0,0,0" '
+'WIDTH=' + larghezza + ' HEIGHT=' + altezza + '> '
+'<PARAM NAME=movie VALUE="'  + nome + '"> '
+'<PARAM NAME=quality VALUE=high> '
+'<PARAM NAME=bgcolor VALUE='+ bgcolor +'> '
+'<param name="wmode" value="' + trasparenza + '"> '
+'<PARAM NAME=menu VALUE='+ menu +'> '
+'<EMBED src="' + nome + '" quality=high menu='+ menu +' bgcolor='+ bgcolor +' WIDTH='
+ larghezza + ' HEIGHT=' + altezza
+' TYPE="application/x-shockwave-flash" wmode="' + trasparenza + '"'
+'PLUGINSPAGE="http://www.macromedia.com/shockwave/download"> '
+'</EMBED></OBJECT></DIV>');
}

//=======================================================================================================================
//Random BG 
function bgrandom(){
var Immagini = new Array();
Immagini[0] = "images/bg/01.gif";
Immagini[1] = "images/bg/02.gif";
Immagini[2] = "images/bg/03.gif";
Immagini[3] = "images/bg/04.gif";
Immagini[4] = "images/bg/05.gif";


var rdn = Math.floor(Math.random() * Immagini.length);
document.write("<body background=" + Immagini[rdn] + " >");
}
//=======================================================================================================================


//=======================================================================================================================
//PROTECTOR
//=======================================================================================================================
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")

function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}

function reEnable(){
return true
}

if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable

}
//=====================================================
//controlli per ricerca interna al sito
function VerificaFormRicerca()
   {
   if ((document.forms['cerca']['search'].value=='') || (document.forms['cerca']['search'].value=='Inserisci il testo da cercare nel sito...'))
      {
      alert("Attenzione: inserisci il testo per effettuare una ricerca!");
      document.forms['cerca']['search'].focus();
      return false; //non ho fornito il codice => avviso e restituisco false
     }
   return true; //ho fornito il codice => restituisco true e procedo con il submit della form
  }
//controlli per ricerca interna al sito - FINE

//======================================================
//Contolli mailing list

function ControllaSendMail()
  {
   if(document.form1.consenso.checked==false) { 
    alert("E' necessario dare il consenso sulle Condizioni Generali di Utilizzo e sull'Informativa sulla Privacy (Legge 196/03)"); 
	document.form1.consenso.focus();
    return false;
  }
  ControllaMail()
  if (ControllaMail() == false) {
  return false;
  } 
  return true;
  
}

  function ControllaMail()
   {
   EmailAddr = document.form1.email.value;
   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   if (Filtro.test(EmailAddr))
      return true;
   else
      {
      alert("Verifica l'indirizzo di e-mail! \n\n Sono presenti caratteri non validi!");
      document.form1.email.focus();
      return false;
      }
   }
//Contolli mailing list - FINE
