/////////////////////////////////////////////
// precarica in cache le immaginette del menu

var overImg = new Array();
   
overImg[0] = new Image(122,31);
overImg[1] = new Image(122,31);
overImg[2] = new Image(122,31);
overImg[3] = new Image(122,31);
overImg[4] = new Image(122,31);
overImg[5] = new Image(122,31);
   
overImg[0].src = "img/HomeMenuItem1Out.gif";
overImg[1].src = "img/HomeMenuItem2Out.gif";
overImg[2].src = "img/HomeMenuItem3Out.gif";
overImg[3].src = "img/HomeMenuItem4Out.gif";
overImg[4].src = "img/HomeMenuItem5Out.gif";
overImg[5].src = "img/HomeMenuItem6Out.gif";


/////////////////////////
//controllo formato data
function checkData(str) {
  var formatoData = /(01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\/(01|02|03|04|05|06|07|08|09|10|11|12)\/\d\d/;
  if (formatoData.exec(str)==null) {
    alert('formato data non corretto!\n\nLa data deve essere nella forma gg/mm/aa');
    return false;
  }
  return true;
}

//////////////////////////////////////////////////////////
//verifica che l'indirizzo mail sia un indirizzo mail valido
//solo se si è effettivamente inserita una mail
function isValidEmail(str) {
  
  //se la casella mail è vuota, non esegue il controllo
  
  var ritorno = true
  
  if (str!="") {
    var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
    var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
    ritorno = (!r1.test(str) && r2.test(str));
  }
 
 if (ritorno==false) alert('Inserire un indirizzo email valido.');
 return ritorno;
}


//////////////////////////////////////////////////////////
//verifica che l'indirizzo web inizi per http://

function isValidURL(str) {
  
  var ritorno = true
  
  if (str!="") {
    ritorno = (str.substring(0,7) == 'http://');
  }
   
   if (ritorno==false) alert('L\'indirizzo web deve iniziare per \'http://\'.');
 return ritorno;
}


//////////////////////////////////////////////////////////////////////////////////
// ---------------------------------------------------------------------------
// Finestra PopUp: prende in ingrezzo link,
// dimensioni e ID
// <A HREF="javascript:MyPopUpInsCasa('http://',400,400,1);">Your text here</A>
// ----------------------------------------------------------------------------

function popUpAllegato(page,PWidth,PHeight,id) {
 
 eval("designerwiz"+id+"=window.open('"+page+"','designerwiz1','toolbar=0,scrollbars=1,location=0,status=0,menubars=0,resizable=1,width="+PWidth+",height="+PHeight+"')")

eval;("wiz"+id+".window.moveTo((screen.width/2)-(PWidth/2),(screen.height/2)-(PHeight/2))")

}


