  function mailWindows(){

      Windows.closeAll();
      var win = new Window({className: "spread", title: "Mailing List", 
                      width:350, height:200, 
                      url: "pagine/mailinglist/mailform.asp", showEffect:Effect.BlindDown, resizable: false, hideEffectOptions: {duration:0.5}});       
      win.showCenter(); 
}
	
  function fillBody(url){
        Windows.closeAll();
		    var searchResultArea = document.getElementById("resultArea");
	      searchResultArea.innerHTML = "<p><h2>Caricamento...</h2></p> <br><div class=\"distanza\"></div>";
	      
				var myAjax = new Ajax.Updater("resultArea", url, {method: 'get', evalScripts: 'true', onFailure: function(r) {searchResultArea.innerHTML = "<p><h3>Errore nel caricamento della pagina</h3></p> <br><div class=\"distanza\"></div>";}});
	}
	
  function fillAvvisi(){
        Windows.closeAll();
		    var searchResultArea = document.getElementById("resultArea");
	      searchResultArea.innerHTML = "<p><h2>Caricamento...</h2></p> <br><div class=\"distanza\"></div>";
	      
				var myAjax = new Ajax.Updater("resultArea", "pagine/avvisi.asp", {method: 'get', evalScripts: 'true', onComplete: function(){calcHeight()},onFailure: function(r) {searchResultArea.innerHTML = "<p><h3>Errore nel caricamento della pagina</h3></p> <br><div class=\"distanza\"></div>";} });
	}
  	
	  function showNews(ID){
	      Windows.closeAll();
		    var searchResultArea = document.getElementById("news");
		    var url ="pagine/news.asp?ID="+ID
	      searchResultArea.innerHTML = "<p><h2>Caricamento...</h2></p>";
	      
				var myAjax = new Ajax.Updater("news", url, {method: 'get', evalScripts: 'true',onFailure: function(r) {searchResultArea.innerHTML = "<p><h3>Errore nel caricamento della news</h3></p>";}});
	}

  function calcHeight()
  {
     //find the height of the internal page
     var the_height=document.documentElement.clientHeight;

     //change the height of the iframe
     if (document.getElementById('avvisi_iframe')!=null){
          document.getElementById('avvisi_iframe').height=the_height-70;
      }
  
  }
  
   function validEmail(){
      var email = document.getElementById("email").value;
      if(email.match("^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\\-+)|([A-Za-z0-9]+\\.+)|([A-Za-z0-9]+\\++))*[A-Za-z0-9]+@((\\w+\\-+)|(\\w+\\.))*\\w{1,63}\\.[a-zA-Z]{2,6}$")==null){
        alert('La preghiamo di inserire un indirizzo email valido');
        return false;
      }
      return true;
   }