function openPictureWindow_Fever(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>' +alt+ '</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">'); 
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt='+alt+'>'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}


function WM_toggle(id){
if (document.all){
if(document.all[id].style.display == 'none'){
document.all[id].style.display = '';
} else {
document.all[id].style.display = 'none';
}
return false;
} else if (document.getElementById){
if(document.getElementById(id).style.display == 'none'){
document.getElementById(id).style.display = 'block';
} else {
document.getElementById(id).style.display = 'none';
}
return false;
}
}

function nascondi(nome){
var stato = document.getElementById("tbl" + nome).style.display;
if (stato != "none"){
// Nascondo la riga
document.getElementById("tbl" + nome).style.display = "none";
}
}
function apri(nome){
var statoapri = document.getElementById("tbl" + nome).style.display;
if (statoapri == "none"){
// Visualizzo la riga
document.getElementById("tbl" + nome).style.display = "";
}
}



// funzione per far comparire il pop-up della privacy
function apriFinestra(page){
var winOpenSquadra;
winOpened = window.open(page,"Squadra","directories=no,status=no,statusbar=no,resizable=no,menubar=no,scrollbars=yes,toolbar=no,width=770,height=530,left=10,top=10");
}




function show_calendar(str_target, lang, str_datetime){
var lang = lang;
if (lang=="en"){
var arr_months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var week_days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
}
else if (lang=="fr"){
var arr_months = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"];
var week_days = ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"];
}
else{
var arr_months = ["Gennaio", "Febbario", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"];
var week_days = ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"];
}

var n_weekstart = 0; // day week starts from (normally 0 or 1)
 
var dt_datetime = ((str_datetime == null || str_datetime == "") ? new Date() : str2dt(str_datetime));
 
var dt_prev_month = new Date(dt_datetime);
dt_prev_month.setMonth(dt_datetime.getMonth() - 1);
 
var dt_next_month = new Date(dt_datetime);
dt_next_month.setMonth(dt_datetime.getMonth() + 1);
 
var dt_firstday = new Date(dt_datetime);
dt_firstday.setDate(1);
dt_firstday.setDate(1 - (7 + dt_firstday.getDay() - n_weekstart) % 7);
 
var dt_lastday = new Date(dt_next_month);
dt_lastday.setDate(0);
 
  // html generation (feel free to tune it for your particular application)
  // print calendar header
  var str_buffer = new String("<html>\n" +
                              "<head>\n" +
                              "<title>Calendar</title>\n" +
					"<LINK rel=\"stylesheet\" href=\"font.css\" type=\"text/css\">\n" +
                              "</head>\n" +
                              "<body>\n" +
                              "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n<Tbody>\n" +
                              "<tr><td bgcolor=\"#FFFFFF\">\n" +
                              "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" width=\"100%\">\n" +
                              "<tr>\n <td bgcolor=\"#569847\"><a href=\"javascript:window.opener.show_calendar('" +
                              str_target +
					"', '"+ lang +"', '" +
                              dt2dtstr(dt_prev_month) +
                              " ' + document.cal.time.value);\">" +
                              "<img src=\"img/freccia_sx2.gif\" width=\"10\" height=\"9\" border=\"0\"" +
                              " alt=\"" +
                              arr_months[dt_datetime.getMonth()-1] +
                              "\"></a></td>\n" +
                              " <td bgcolor=\"#569847\" colspan=\"5\" align=\"center\" valign=\"middle\">" +
                              "<font color=\"white\" class=\"corpo\">" +
                              arr_months[dt_datetime.getMonth()] +
                              " " +
                              dt_datetime.getFullYear() +
                              "</font></td>\n" +
                              " <td bgcolor=\"#569847\" align=\"right\"><a href=\"javascript:window.opener.show_calendar('" +
                              str_target +
					"', '"+ lang +"', '" +
                              dt2dtstr(dt_next_month) +
                              " ' + document.cal.time.value);\">" +
                              "<img src=\"img/freccia_dx2.gif\" width=\"10\" height=\"9\" border=\"0\"" +
                              " alt=\"" +
                              arr_months[dt_datetime.getMonth()+1] +
                              "\"></a></td>\n</tr>\n");
 
  var dt_current_day = new Date(dt_firstday);
 
  // print weekdays titles
  str_buffer += "<tr>\n";
 
  for ( var n = 0 ; n < 7 ; n++)
    str_buffer += " <td bgcolor=\"#CCCCCC\">" +
    "<font color=\"white\" class=\"corpo\">" +
    week_days[(n_weekstart + n) % 7] +
    "</font></td>\n";
 
  // print calendar table
  str_buffer += "</tr>\n";
  while (dt_current_day.getMonth() == dt_datetime.getMonth() ||
         dt_current_day.getMonth() == dt_firstday.getMonth())
    {
      // print row heder
      str_buffer += "<tr>\n";
 
      for ( var n_current_wday = 0 ; n_current_wday < 7 ; n_current_wday++)
        {
          if (dt_current_day.getDate() == dt_datetime.getDate() &&
              dt_current_day.getMonth() == dt_datetime.getMonth())
              // print current date
              str_buffer += " <td bgcolor=\"#FF0000\" align=\"right\">";
          else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
                   // weekend days
                   str_buffer += " <td bgcolor=\"#E0ECE8\" align=\"right\">";
          else // print working days of current month
               str_buffer += " <td bgcolor=\"white\" align=\"right\">";

          if (dt_current_day.getMonth() == dt_datetime.getMonth())
              // print days of current month

              str_buffer += "<a href=\"javascript:window.opener." +
                            str_target +
                            ".value='" + dt2dtstr(dt_current_day) + "'; window.close();\">" +
                            "<font color=\"black\" class=\"corpo\">";
          else // print days of other months
               str_buffer += "<a href=\"javascript:window.opener." +
                             str_target +
                             ".value='" + dt2dtstr(dt_current_day) + "'; window.close();\">" +
                             "<font color=\"gray\" class=\"corpo\">";
 
          str_buffer += dt_current_day.getDate() + "</font></a></td>\n";
          dt_current_day.setDate(dt_current_day.getDate() + 1);
        }
 
      // print row footer
      str_buffer += "</tr>\n";
    }
 
  // print calendar footer
  str_buffer += "<form name=\"cal\">\n<tr><td colspan=\"7\" style=\"margin:0px;\">" +
                "<input type=\"hidden\" name=\"time\" value=\""+dt2tmstr(dt_datetime) +
                "\"></td></tr>\n</form>\n" +
                "</Tbody>\n</table>\n" +
                "</td>\n</tr>\n</Tbody>\n</table>\n" +
                "</body>\n" +
                "</html>\n";

 
  var vWinCal = window.open("", "Calendario", "width=250,height=190,status=no,resizable=yes,top=200,left=200");
  vWinCal.opener = self;
  var calc_doc = vWinCal.document;
  calc_doc.write(str_buffer);
  calc_doc.close();
}
 
// datetime parsing and formatting routimes. modify them if you wish other datetime format
function str2dt(str_datetime)
{
  var re_date = /^(\d{1,2})\/(\d{1,2})\/(\d{4})\s+(\d{1,2})\:(\d{1,2})\:(\d{1,2})$/;
 
  if (!re_date.exec(str_datetime)) return(alert("Invalid Datetime format: " + str_datetime));
 
  return(new Date (RegExp.$3, RegExp.$2-1, RegExp.$1, RegExp.$4, RegExp.$5, RegExp.$6));
}

function dt2dtstr(dt_datetime){
//var dt = dt_datetime.getDate() + "-";

var day = dt_datetime.getDate();
var month = dt_datetime.getMonth() + 1;
var dt = ((day < 10) ? "0" + day : day) + "/";
dt += ((month < 10) ? "0" + month : month);
dt += "/" + dt_datetime.getFullYear();
return(dt);
}
 
function dt2tmstr(dt_datetime){
var dt = dt_datetime.getHours() + ":";
dt += ((dt_datetime.getMinutes() < 10) ? "0" + dt_datetime.getMinutes() : dt_datetime.getMinutes()) + ":";
dt += ((dt_datetime.getSeconds() < 10) ? "0" + dt_datetime.getSeconds() : dt_datetime.getSeconds());
return(dt);
}


function people(){
var colore_normale = "#FFFFFF";
var colore_avviso = "#E3F5D9";
//--Applico il colore base alle text--
document.theform.nome.style.backgroundColor = colore_normale;
document.theform.cognome.style.backgroundColor = colore_normale;
document.theform.indirizzo.style.backgroundColor = colore_normale;
document.theform.citta.style.backgroundColor = colore_normale;
document.theform.telefono.style.backgroundColor = colore_normale;
document.theform.email.style.backgroundColor = colore_normale;
document.theform.arrivo.style.backgroundColor = colore_normale;
document.theform.partenza.style.backgroundColor = colore_normale;
document.theform.ora_arrivo.style.backgroundColor = colore_normale;
document.theform.n_persone.style.backgroundColor = colore_normale;
document.theform.camera1.style.backgroundColor = colore_normale;
document.theform.camera2.style.backgroundColor = colore_normale;
document.theform.camera3.style.backgroundColor = colore_normale;
document.theform.camera4.style.backgroundColor = colore_normale;

var camera1 = document.theform.camera1.options.selectedIndex;
var camera2 = document.theform.camera2.options.selectedIndex;
var camera3 = document.theform.camera3.options.selectedIndex;
var camera4 = document.theform.camera4.options.selectedIndex;
var persone = document.theform.n_persone.options.selectedIndex;
var tot_1 = 0;
var tot_2 = 0;
var tot_3 = 0;
var tot_4 = 0;
var somma = 0;
tot_1 = parseInt(camera1) * 1;
tot_2 = parseInt(camera2) * 2;
tot_3 = parseInt(camera3) * 2;
tot_4 = parseInt(camera4) * 3;


somma = tot_1 + tot_2 + tot_3 + tot_4;


if (document.theform.cognome.value==""){
alert("Attenzione ! Inserire il Cognome.\nPlease insert the Surname.");
document.theform.cognome.focus();
document.theform.cognome.style.backgroundColor = colore_avviso;
return false;
}
if (document.theform.nome.value==""){
alert("Attenzione ! Inserire il Nome.\nPlease insert the Name.");
document.theform.nome.focus();
document.theform.nome.style.backgroundColor = colore_avviso;
return false;
}
if (document.theform.citta.value==""){
alert("Attenzione ! Inserire la Città.\nPlease insert the Town.");
document.theform.citta.focus();
document.theform.citta.style.backgroundColor = colore_avviso;
return false;
}
if (document.theform.telefono.value==""){
alert("Attenzione ! Inserire il Telefono o Cell.\nPlease insert the Phone Number or Mobile Phone.");
document.theform.telefono.focus();
document.theform.telefono.style.backgroundColor = colore_avviso;
return false;
}
if (document.theform.email.value==""){
alert("Attenzione ! Inserire l\'Email.\nPlease insert the Email.");
document.theform.email.focus();
document.theform.email.style.backgroundColor = colore_avviso;
return false;
}
var x = document.theform.email.value;
var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!(filter.test(x))){
alert ("Attenzione! Inserire l'E-mail corretta.");
document.theform.email.focus();
document.theform.email.style.backgroundColor = colore_avviso;
return false;
}
if (document.theform.arrivo.value==""){
alert("Attenzione ! Inserire il Giorno di Arrivo.\nPlease insert the Arrival Date.");
document.theform.arrivo.focus();
document.theform.arrivo.style.backgroundColor = colore_avviso;
return false;
}
if (document.theform.partenza.value==""){
alert("Attenzione ! Inserire il Giorno di Partenza.\nPlease insert the Departure Date.");
document.theform.partenza.focus();
document.theform.partenza.style.backgroundColor = colore_avviso;
return false;
}
if (document.theform.ora_arrivo.value=="0"){
alert("Attenzione ! Inserire l\'Orario di Arrivo.\nPlease insert the Arrival Time.");
document.theform.ora_arrivo.focus();
document.theform.ora_arrivo.style.backgroundColor = colore_avviso;
return false;
}
if (somma < persone){
alert("Attenzione ! Il numero max di persone inserite è superiore ai posti letto selezionati.\nAttention..the number of people is greater to the number of selected beds.");
document.theform.n_persone.focus();
document.theform.n_persone.style.backgroundColor = colore_avviso;
return false;
}
if (somma > persone){
alert("Attenzione ! Il numero max di persone inserite è inferiore ai posti letto selezionati.\nAttention..the number of people is lower to the number of selected beds.");
document.theform.n_persone.focus();
document.theform.n_persone.style.backgroundColor = colore_avviso;
return false;
}
if (somma==0){
alert("Attenzione ! Scegli una tipologia di stanza.\nAttention..choose a typology of lodging.");
document.theform.camera1.style.backgroundColor = colore_avviso;
document.theform.camera2.style.backgroundColor = colore_avviso;
document.theform.camera3.style.backgroundColor = colore_avviso;
document.theform.camera4.style.backgroundColor = colore_avviso;
return false;
}
if (persone==0){
alert("Attenzione ! Inserire il numero delle persone.\nPlease insert the N.of People.");
document.theform.n_persone.focus();
document.theform.n_persone.style.backgroundColor = colore_avviso;
return false;
}
if (somma > 31){
alert("Attenzione ! L\'Hotel può ospitare un massimo di 31 persone.\nAttention..Our Hotel can entertain maximum 31 people.");
document.theform.camera1.style.backgroundColor = colore_avviso;
document.theform.camera2.style.backgroundColor = colore_avviso;
document.theform.camera3.style.backgroundColor = colore_avviso;
document.theform.camera4.style.backgroundColor = colore_avviso;
return false;
}
}


//funzione che mi permette di ridimensionare le immagini in Offerte ed Eventi se superano una determinata larghezza
function ridimensiona(){ 
for (imm in document.images){ 
img = document.images[imm] 
if (img.className=="image"){ 
if (img.width > 500){ 
img.width=500 
} 
//if (img.height> 600){ 
//img.height = 600 
//} 
} 
} 
}

