if (navigator.userAgent.toLowerCase().indexOf("msie 6") !=- 1) {
  alert("Attenzione: stai utilizzando una vecchia versione di Internet Explorer!\nLa visualizzazione potrebbe non essere corretta.")
}

// inizio preload immagini layout
var myimages=new Array()
function preload(){
	for (i=0;i<preload.arguments.length;i++){
		myimages[i] = new Image();
		myimages[i].src = preload.arguments[i];
	}
}

preload("img/menu/menu_01.jpg",
        "img/menu/menu_02.jpg",
        "img/menu/menu_03.jpg",
        "img/menu/menu_04.jpg",
        "img/menu/menu_05.jpg",
        "img/menu/menu_06.jpg",
        "img/menu/menu_07.jpg",
        "img/menu/menu_08.jpg",
        "img/menu/menu_09.jpg",
        "img/menu/menu_10.jpg",
        "img/menu/menu_11.jpg",
        "img/menu/menu_12.jpg",
        "img/menu/menu_13.jpg",
        "img/menu/menu_14.jpg",
        "img/menu/menu_15.jpg",
        "img/menu/menu_16.jpg",
        "img/menu/menu_17.jpg",
        "img/logo_new.jpg",
        "img/slidetop/1.jpg",
        "img/slidetop/2.jpg",
        "img/slidetop/3.jpg",
        "img/slidetop/4.jpg",
        "img/slidetop/6.jpg",
        "img/slidetop/7.jpg",
        "img/titoletti/shop.png");
// fine preload immagini layout



function apriRadio() {
  var url = 'radio.php';
  var width = 370;
  var height = 400;
  var top = (screen.height - height) / 2;
  var left = (screen.width - width) / 2;
  window.open(url,'radio','width='+width+',height='+height+',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,top='+top+',left='+left)
}


function effect(obj,speed) {
      if (speed==null) speed = 500;
      if (typeof(obj)=='object') {
          return new Fx.Tween(obj, { duration:speed, transition: 'linear' });
      }
}


document.addEvent( 'domready' , function() {
    ruota('slide');
    ruota('box_banner');
    

    $$('.menu').addEvent( 'mouseenter' , function() {
           this.src = this.src.replace("menu_","menu2_");
    } );
    $$('.menu').addEvent( 'mouseleave' , function() {
           this.src = this.src.replace("menu2_","menu_");
    } );


    $$('.mosso').addEvent( 'mouseenter' , function() {
           effect(this,200).start('margin-left', '0', '5px');
    } );
    $$('.mosso').addEvent( 'mouseleave' , function() {
           effect(this,200).start('margin-left', '5px', '0');
    } );
    

    $$('.prewiev').addEvent( 'mouseenter' , function() {
          effect(this,400).start('background-color', '#FFFFFF', '#e8e8e8');
    } );
    $$('.prewiev').addEvent( 'mouseleave' , function() {
          effect(this,400).start('background-color', '#e8e8e8', '#FFFFFF');
    } );
    
    
    if (document.all) {
        // if (document.location.href.indexOf("index.php") ==- 1)
        $('content2').style.top='-5px';
    }


    $$('.preview_gallery').addEvent( 'mouseenter' , function() {
          this.style.backgroundImage='url(img/sfondopreviewgalleryover.png)';
          effect(this,300).start('color', '#000000', '#CC0000');
    } );
    $$('.preview_gallery').addEvent( 'mouseleave' , function() {
          this.style.backgroundImage='url(img/sfondopreviewgallery.gif)';
          effect(this,300).start('color', '#CC0000', '#000000');
    } );
    

    $$('.box_orizzontale').addEvent( 'mouseenter' , function() {
          effect(this,300).start('background-color', '#EEEEEE', '#fff3e5');
    } );
    $$('.box_orizzontale').addEvent( 'mouseleave' , function() {
          effect(this,300).start('background-color', '#fff3e5', '#EEEEEE');
    } );
    
} );


function onlynumers(s){
    Filtro = /[^0-9,.]/;
    s.value = s.value.replace(Filtro,"");
}


function check (id1,id2,id3) {
  document.getElementById(id1).checked=true;
  document.getElementById(id2).innerHTML='<img src=img/ok.gif> Aggiunto!';
  document.getElementById(id3).style.display='block';
  document.getElementById('invio1').style.display='block';
  document.getElementById('invio2').style.display='block';
}
function copri (id1,id2,id3) {
  document.getElementById(id1).checked=false;
  document.getElementById(id2).innerHTML='Aggiungi al carrello';
  document.getElementById(id3).style.display='none';
}



//controllo campi vuoti x modulo di "Conferma ordine"
function controlloConfermaOrdine() {
  var nome = document.nomeForm.nominativo.value;
  var citta = document.nomeForm.citta.value;
  var CAP = document.nomeForm.cap.value;
  var provincia = document.nomeForm.provincia.value;
  var indirizzo = document.nomeForm.indirizzo.value;
  var email = document.nomeForm.mail.value;

  if ((nome=="")||(citta=="")||(CAP=="")||(provincia=="")||(indirizzo=="")||(email==""))
  {
    alert("Attenzione: devi compilare tutti i campi obbligatori!");
    return false;
  }
  else
  {
    Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
    if (!(Filtro.test(email)))
    {
      alert("Per favore inserisci un indirizzo Email corretto!");
      return false;
    }
  }
}


//controllo campi vuoti x modulo di "Prenota concerto"
function controlloPrenotaConcerto()
{
  var nome = document.nomeForm.nominativo.value;
  var numero = document.nomeForm.numero.value;
  var telefono = document.nomeForm.telefono.value;
  var email = document.nomeForm.email.value;
  var giorno = document.nomeForm.giorno.value;
  var mese = document.nomeForm.mese.value;
  var anno = document.nomeForm.anno.value;

  if ((nome=="")||(numero=="")||(telefono=="")||(giorno=="")||(mese=="")||(anno=="")||(email==""))
  {
    alert("Attenzione: devi compilare tutti i campi obbligatori!");
    return false;
  }
  else
  {
    Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
    if (!(Filtro.test(email)))
    {
      alert("Per favore inserisci un indirizzo Email corretto!");
      return false;
    }
  }
}