/*---------------------------------------------------------------------------------------------*/
// Routensuche
/*---------------------------------------------------------------------------------------------*/
  function check() {
    var finish="true";
    var checkdate="true";
    if(document.search_form.dest.value=="") {
     if(document.search_form.date1.value=="") {
      if(document.search_form.date2.value=="") {
       if(document.search_form.ship.value=="") {
        if(document.search_form.port.value=="") {
         if(document.search_form.duration.value=="") {
          if(document.search_form.special_search.checked == false) {
            var finish = "false";
          }
         }
        }
       }
      }
     }
    }
    if(document.search_form.date1.value!="") {
      if(document.search_form.date1.value>document.search_form.date2.value) {
        checkdate = "false";
      }
    }
    if (checkdate=="false") {
      alert ("Por favor verifique la fecha.");
    } else {
      if(finish=="false") {
        alert ("Especifique las condiciones de la búsqueda.")
      } else {
        document.search_form.submit();
      }
    }
  }

/*---------------------------------------------------------------------------------------------*/
// Hotelsuche
/*---------------------------------------------------------------------------------------------*/

  function checkHotel() {
    var finish="true";
    var text="";
    if(document.search_form.dest.value=="Elija el destino deseado") {
      text ="Elija el destino deseado";
      var finish = "false";
    } else {
      if(document.search_form.port.value=="Elija el puerto deseado") {
        text ="Elija el puerto deseado";
        var finish = "false";
      }
    }
    if(finish=="false") {
      alert (text)
    } else {
      document.search_form.submit();
    }
  }

  function updatePortsHotel(id) {
    delPort();
    for (i=0;i<a_hotel.items.length;i++) {
      if(document.search_form.dest.value == a_hotel.items[i][1]) {
        document.search_form.port.value = a_hotel.items[i][2];
        element = new Option(a_hotel.items[i][2], a_hotel.items[i][0], false, true);
        document.search_form.port.options[document.search_form.port.options.length] = element;
      }
    }
    for (i=0;i<aa_hotel.items.length;i++) {
      if (document.search_form.dest.value == "Elija el destino deseado") {
        document.search_form.port.options[0].selected = true;
      }
    }
    document.search_form.port.options[0].selected = true;
  }
  function setSelectedDestPortHotel() {
    if (dest_hotel=="Elija el destino deseado") {dest_hotel =0; }
    document.search_form.dest.options[dest_hotel].selected = true;
    updatePortsHotel(dest_hotel);
    for (i=0;i<document.search_form.port.length;i++) {
      if(document.search_form.port.options[i].value == port_hotel) {
        document.search_form.port.options[i].selected = true;
      }
    }
  }

/* Aufbau eines 2Dimensionalen Arrays */
  function Array2D(x_hotel,y_hotel) {
    this.items = new Array(x_hotel);
   for(i=0;i<y_hotel;i++) {
      this.items[i] = new Array(x_hotel);
    }
  }
  var zahl_hotel = "25";
  a_hotel = new Array2D(zahl2_hotel,zahl_hotel);
  var x_hotel=0;

/* Aufbau eines 2Dimensionalen Arrays */
  function Array2D(xx_hotel,y_hotel) {
    this.items = new Array(xx_hotel);
    for(i=0;i<y_hotel;i++) {
      this.items[i] = new Array(xx_hotel);
    }
  }
  var zahl2_hotel = "10";
  aa_hotel = new Array2D(zahl2_hotel,zahl2_hotel);
  var xx_hotel=0;

  /* Aufbau eines 2Dimensionalen Arrays */
  function Array2D(x,y) {
    this.items = new Array(x);
   for(i=0;i<y;i++) {
      this.items[i] = new Array(x);
    }
  }
  var zahl = "26";
  a = new Array2D(16,zahl);
  var x=0;

/* Aufbau eines 2Dimensionalen Arrays */
  function Array2D(xx,y) {
    this.items = new Array(xx);
    for(i=0;i<y;i++) {
      this.items[i] = new Array(xx);
    }
  }
  var zahl2 = "16";
  aa = new Array2D(16,zahl2);
  var xx=0;

/* Aufbau eines 2Dimensionalen Arrays */
  function Array2D(z,y) {
    this.items = new Array(z);
    for(i=0;i<y;i++) {
      this.items[i] = new Array(y);
    }
  }
  var zahl1 = 11;
  b = new Array2D(11,zahl1);
  var z=0;


/* Function delSelect() löscht alle Einträge aus der Dropdownliste der Ports ab der 1.Position, damit*/
/* der Default-Wert nicht gelöscht wird */
  function delPort() {
    for(i=1; i < document.search_form.port.length;) {
        document.search_form.port.options[document.search_form.port.length - 1] = null;
    }
  }

  function delShip() {
    for(i=1; i < document.search_form.ship.length;) {
        document.search_form.ship.options[document.search_form.ship.length - 1] = null;
    }
  }
  function updateShipByDestination(id) {
    delShip();
    for (i=0;i<b.items.length;i++) {
      if (document.search_form.dest.value == "") {
        document.search_form.ship.value = b.items[i][1];
        element = new Option(b.items[i][1], b.items[i][0], false, true);
        document.search_form.ship.options[document.search_form.ship.options.length] = element;
      }
      if(document.search_form.dest.value == 1) {
        if(b.items[i][2]==1) {
          document.search_form.ship.value = b.items[i][1];
          element = new Option(b.items[i][1], b.items[i][0], false, true);
          document.search_form.ship.options[document.search_form.ship.options.length] = element;
        }
      }
      if(document.search_form.dest.value == 2) {
        if(b.items[i][3]==1) {
          document.search_form.ship.value = b.items[i][1];
          element = new Option(b.items[i][1], b.items[i][0], false, true);
          document.search_form.ship.options[document.search_form.ship.options.length] = element;
        }
      }
      if(document.search_form.dest.value == 3) {
        if(b.items[i][4]==1) {
          document.search_form.ship.value = b.items[i][1];
          element = new Option(b.items[i][1], b.items[i][0], false, true);
          document.search_form.ship.options[document.search_form.ship.options.length] = element;
        }
      }
      if(document.search_form.dest.value == 4) {
        if(b.items[i][5]==1) {
          document.search_form.ship.value = b.items[i][1];
          element = new Option(b.items[i][1], b.items[i][0], false, true);
          document.search_form.ship.options[document.search_form.ship.options.length] = element;
        }
      }
      if(document.search_form.dest.value == 5) {
        if(b.items[i][6]==1) {
          document.search_form.ship.value = b.items[i][1];
          element = new Option(b.items[i][1], b.items[i][0], false, true);
          document.search_form.ship.options[document.search_form.ship.options.length] = element;
        }
      }
      if(document.search_form.dest.value == 6) {
        if(b.items[i][7]==1) {
          document.search_form.ship.value = b.items[i][1];
          element = new Option(b.items[i][1], b.items[i][0], false, true);
          document.search_form.ship.options[document.search_form.ship.options.length] = element;
        }
      }
    }
    document.search_form.ship.options[0].selected = true;
  }
/* Startet zuerst die Function delSelect() zum Löschen der Einträge in der Ports-Dropdown-Box. Danach werden in  */
/* Abhängigkeit der Destinations-ID (document.search_form.dest.value) aus der Destinations-Dropdown-Box die dazu gehörigen */
/* Ports aus den Array (a.items[i][1]) in die Ports-Dropdown-Box geschrieben. a.items[i][2] ist der Portname, */
/* a.items[i][0] ist die Port-ID und a.items[i][1] ist die Detsination-ID. */
  function updatePorts(id) {
    delPort();
    for (i=0;i<a.items.length;i++) {
      if(document.search_form.dest.value == a.items[i][1]) {
        document.search_form.port.value = a.items[i][2];
        element = new Option(a.items[i][2], a.items[i][0], false, true);
        document.search_form.port.options[document.search_form.port.options.length] = element;
      }
    }
    for (i=0;i<aa.items.length;i++) {
      if (document.search_form.dest.value == "") {
        document.search_form.port.value = aa.items[i][2];
        element = new Option(aa.items[i][2], aa.items[i][0], false, true);
        document.search_form.port.options[document.search_form.port.options.length] = element;
      }
    }
    document.search_form.port.options[0].selected = true;
    updateShipByDestination(id);
  }
  function updatePortByShip(id) {
    if (document.search_form.ship.value == "") {
      updatePorts("");
    }
    if (document.search_form.ship.value == "DWN") {
      delPort();
      for(i=0;i<a.items.length;i++) {
        if(document.search_form.dest.value == a.items[i][1]) {
          if(a.items[i][14]=="1") {
            if(a.items[i][4]=="1") {
              document.search_form.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              document.search_form.port.options[document.search_form.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(document.search_form.dest.value == "") {
          if(aa.items[i][4]=="1") {
            document.search_form.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            document.search_form.port.options[document.search_form.port.options.length] = element;
          }
        }
      }
    }
    if (document.search_form.ship.value == "GEM") {
      delPort();
      for(i=0;i<a.items.length;i++) {
        if(document.search_form.dest.value == a.items[i][1]) {
          if(a.items[i][14]=="1") {
            if(a.items[i][3]=="1") {
              document.search_form.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              document.search_form.port.options[document.search_form.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(document.search_form.dest.value == "") {
          if(aa.items[i][3]=="1") {
            document.search_form.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            document.search_form.port.options[document.search_form.port.options.length] = element;
          }
        }
      }
    }

    if (document.search_form.ship.value == "PRL") {
      delPort();
      for(i=0;i<a.items.length;i++) {
        if(document.search_form.dest.value == a.items[i][1]) {
          if(a.items[i][14]=="1") {
            if(a.items[i][5]=="1") {
              document.search_form.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              document.search_form.port.options[document.search_form.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(document.search_form.dest.value == "") {
          if(aa.items[i][5]=="1") {
            document.search_form.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            document.search_form.port.options[document.search_form.port.options.length] = element;
          }
        }
      }
    }
    if (document.search_form.ship.value == "JWL") {
      delPort();
      for(i=0;i<a.items.length;i++) {
        if(document.search_form.dest.value == a.items[i][1]) {
          if(a.items[i][14]=="1") {
            if(a.items[i][6]=="1") {
              document.search_form.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              document.search_form.port.options[document.search_form.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(document.search_form.dest.value == "") {
          if(aa.items[i][6]=="1") {
            document.search_form.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            document.search_form.port.options[document.search_form.port.options.length] = element;
          }
        }
      }
    }
    if (document.search_form.ship.value == "JAD") {
      delPort();
      for(i=0;i<a.items.length;i++) {
        if(document.search_form.dest.value == a.items[i][1]) {
          if(a.items[i][14]=="1") {
            if(a.items[i][7]=="1") {
              document.search_form.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              document.search_form.port.options[document.search_form.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(document.search_form.dest.value == "") {
          if(aa.items[i][7]=="1") {
            document.search_form.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            document.search_form.port.options[document.search_form.port.options.length] = element;
          }
        }
      }
    }
    if (document.search_form.ship.value == "STA") {
      delPort();
      for(i=0;i<a.items.length;i++) {
        if(document.search_form.dest.value == a.items[i][1]) {
          if(a.items[i][14]=="1") {
            if(a.items[i][8]=="1") {
              document.search_form.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              document.search_form.port.options[document.search_form.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(document.search_form.dest.value == "") {
          if(aa.items[i][8]=="1") {
            document.search_form.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            document.search_form.port.options[document.search_form.port.options.length] = element;
          }
        }
      }
    }
    if (document.search_form.ship.value == "SUN") {
      delPort();
      for(i=0;i<a.items.length;i++) {
        if(document.search_form.dest.value == a.items[i][1]) {
          if(a.items[i][14]=="1") {
            if(a.items[i][9]=="1") {
              document.search_form.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              document.search_form.port.options[document.search_form.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(document.search_form.dest.value == "") {
          if(aa.items[i][9]=="1") {
            document.search_form.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            document.search_form.port.options[document.search_form.port.options.length] = element;
          }
        }
      }
    }
    if (document.search_form.ship.value == "SPR") {
      delPort();
      for(i=0;i<a.items.length;i++) {
        if(document.search_form.dest.value == a.items[i][1]) {
          if(a.items[i][14]=="1") {
            if(a.items[i][10]=="1") {
              document.search_form.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              document.search_form.port.options[document.search_form.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(document.search_form.dest.value == "") {
          if(aa.items[i][10]=="1") {
            document.search_form.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            document.search_form.port.options[document.search_form.port.options.length] = element;
          }
        }
      }
    }
    if (document.search_form.ship.value == "SKY") {
      delPort();
      for(i=0;i<a.items.length;i++) {
        if(document.search_form.dest.value == a.items[i][1]) {
          if(a.items[i][14]=="1") {
            if(a.items[i][11]=="1") {
              document.search_form.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              document.search_form.port.options[document.search_form.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(document.search_form.dest.value == "") {
          if(aa.items[i][11]=="1") {
            document.search_form.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            document.search_form.port.options[document.search_form.port.options.length] = element;
          }
        }
      }
    }
    if (document.search_form.ship.value == "AME") {
      delPort();
      for(i=0;i<a.items.length;i++) {
        if(document.search_form.dest.value == a.items[i][1]) {
          if(a.items[i][14]=="1") {
            if(a.items[i][12]=="1") {
              document.search_form.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              document.search_form.port.options[document.search_form.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(document.search_form.dest.value == "") {
          if(aa.items[i][12]=="1") {
            document.search_form.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            document.search_form.port.options[document.search_form.port.options.length] = element;
          }
        }
      }
    }
    if (document.search_form.ship.value == "EPC") {
      delPort();
      for(i=0;i<a.items.length;i++) {
        if(document.search_form.dest.value == a.items[i][1]) {
          if(a.items[i][14]=="1") {
            if(a.items[i][13]=="1") {
              document.search_form.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              document.search_form.port.options[document.search_form.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(document.search_form.dest.value == "") {
          if(aa.items[i][13]=="1") {
            document.search_form.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            document.search_form.port.options[document.search_form.port.options.length] = element;
          }
        }
      }
    }
    document.search_form.port.options[0].selected = true;
  }

  function openNews(Title,Text) {
    var titleText = Title;
    Modalbox.show("http://www.es.ncl.eu/news.php", {title: titleText, height: 375, width: 600}); return false;
  }

  function showMore() {
    if (document.search_form.more.checked == true) {
      document.getElementById('advanced_search').style.display="";
    }
    else {
      document.getElementById('advanced_search').style.display="none";
    }
  }
  function setPorts(test){
    var ausgabe ="";
    ausgabe = ausgabe + '<option name="port" value="+test+">+test+</option>';
    div = document.getElementById('port_div');
    div.innerHTML = ausgabe;
  }

  function openModalWM() {
    var test="<p>Con NCL no te perderás ningún gol de la Copa Mundial de fútbol, ni aún en alta mar. En todos nuestros cruceros por Europa a bordo del Norwegian Gem, Norwegian Jade y Norwegian Sun así como en los cruceros inaugurales del Norwegian Epic, transmitiremos los partidos que disputen los equipos de España, Alemania, Argentina, Brasil, EE.UU., Inglaterra, Italia y los Países Bajos. También se transmitirán en directo los encuentros de cuartos de final y semifinal, el encuentro por el tercer puesto y, naturalmente, la final.</p>";
    Modalbox.show(test, {title: "¡La Copa Mundial a bordo de la flota europea de NCL! ", height: 150, width: 550 }); return false;
  }

 function openModalWindowsOnStart() {
    if(tempModalVar=="0") {
      openModalWindows();
    } else {
      if(tempNews=="1") {
        openModalNewsletter();
      }
    }
  }

  function checkEmailNewsletter() {
    reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+    //Name
                  '(\\@)'+                       //@-Zeichen
                  '([a-zA-Z0-9\\-\\.]+)'+        //Domain
                  '(\\.)'+                       //Punkt
                  '([a-zA-Z]{2,4})$');           //TLD

    if(reg.test(document.getElementById("email_address").value) == false){
      //alert("email falsch");
      return (false);
    } else {
      //alert("email richtig");
      return (true);
    }
  }

  function checkMandatoryFieldsNewsletter() {
    var complete ="false";
    var defaultValues ="false";
    var firstnamne_error ="true";
    var lastname_error ="true";
    var email_error ="true";
    var country_error ="true";
    var title_error ="true";
    var notice_error ="true";

    if (document.getElementById("country").value=="") {
        if (document.getElementById("last_name").value=="") {
          if (document.getElementById("first_name").value=="") {
            if (document.getElementById("email_address").value=="") {
              if (document.getElementById("titlename").value=="") {
                if (document.getElementById("notice_news").value=="") {
                  defaultValues="true";
                } else {defaultValues ="false"}
              } else {defaultValues ="false"}
            } else {defaultValues ="false"}
          } else {defaultValues ="false"}
        } else {defaultValues ="false"}
    } else {defaultValues ="false"}

    if (defaultValues =="true") {
      Modalbox.hide();
      return (false);
    } else {

      if (document.getElementById("last_name").value!="") {
        lastname_error ="true";document.getElementById("last_name_text").style.color="black";
      } else {lastname_error ="false";document.getElementById("last_name_text").style.color="red";}

      if (document.getElementById("first_name").value!="") {
        firstname_error ="true";document.getElementById("first_name_text").style.color="black";
      }else {firstname_error ="false";document.getElementById("first_name_text").style.color="red";}

      if (document.getElementById("country").value!="") {
        country_error ="true";document.getElementById("country_text").style.color="black";
      } else {country_error ="false";document.getElementById("country_text").style.color="red";}

      if (document.getElementById("email_address").value!="") {
        emailCheck = checkEmailNewsletter();
        if (emailCheck==true) {
          email_error ="true";document.getElementById("e_mail_text").style.color="black";
        } else {email_error ="false";document.getElementById("e_mail_text").style.color="red";}
      } else {email_error ="false";document.getElementById("e_mail_text").style.color="red";}

      if (document.getElementById("titlename").value!="") {
        title_error ="true";document.getElementById("title_text").style.color="black";
      } else {title_error ="false";document.getElementById("title_text").style.color="red";}

      if (document.getElementById("notice_news").value!="") {
        notice_error ="true";document.getElementById("notice_news_text").style.color="black";
      } else {notice_error ="false";document.getElementById("notice_news_text").style.color="red";}

      if ((title_error =="false") || (lastname_error =="false") || (firstname_error =="false") || (country_error =="false") || (email_error =="false") || (notice_error =="false")) {
        complete = "false";
      } else {complete = "true";}

      if (complete=="true") {
        uniInden=document.callback_form.first_name.value+document.callback_form.last_name.value+document.callback_form.email_address.value+document.callback_form.country.value;
        document.callback_form.uniqueIdentifier.value=uniInden;
        return (true);
      } else if (complete=="false"){
        if (email_error =="false") {
          alert("Por favor ingrese su dirección de e-mail.");
        } else {
          alert("Por favor rellene todos los campos obligatorios.");
        }
        return (false);
      }
    }
  }

  function checkMandatoryFieldsNewsletterPage() {
    var complete ="false";
    var firstnamne_error ="true";
    var lastname_error ="true";
    var email_error ="true";
    var country_error ="true";
    var title_error ="true";
    var notice_error ="true";

    if (document.getElementById("last_name").value!="") {
      lastname_error ="true";document.getElementById("last_name_text").style.color="#666666";
    } else {lastname_error ="false";document.getElementById("last_name_text").style.color="red";}

    if (document.getElementById("first_name").value!="") {
      firstname_error ="true";document.getElementById("first_name_text").style.color="#666666";
    }else {firstname_error ="false";document.getElementById("first_name_text").style.color="red";}

    if (document.getElementById("country").value!="") {
      country_error ="true";document.getElementById("country_text").style.color="#666666";
    } else {country_error ="false";document.getElementById("country_text").style.color="red";}
    if (document.getElementById("email_address").value!="") {
      emailCheck=checkEmailNewsletter();
      if (emailCheck==true) {
        email_error ="true";document.getElementById("e_mail_text").style.color="#666666";
      } else {email_error ="false";document.getElementById("e_mail_text").style.color="red";}
    } else {email_error ="false";document.getElementById("e_mail_text").style.color="red";}

    if (document.getElementById("titlename").value!="") {
      title_error ="true";document.getElementById("title_text").style.color="#666666";
    } else {title_error ="false";document.getElementById("title_text").style.color="red";}

    if (document.getElementById("notice_news").value!="") {
      notice_error ="true";document.getElementById("notice_news_text").style.color="#666666";
    } else {notice_error ="false";document.getElementById("notice_news_text").style.color="red";}

    if ((title_error =="false") || (lastname_error =="false") || (firstname_error =="false") || (country_error =="false") || (email_error =="false") || (notice_error =="false")) {
      complete = "false";
    } else {complete = "true";}
    if (complete=="true") {
      uniInden=document.callback_form.first_name.value+document.callback_form.last_name.value+document.callback_form.email_address.value+document.callback_form.country.value;
      document.callback_form.uniqueIdentifier.value=uniInden;
      return (true);
    } else if (complete=="false"){
      if (email_error =="false") {
        alert("Por favor ingrese su dirección de e-mail1.");
      } else {
        alert("Por favor rellene todos los campos obligatorios.");
      }
      return (false);
    }
  }

  function checkValueNewsletter() {
    if (document.getElementById('notice_news').value=="others") {
      document.getElementById('others').style.display="";
    } else {
      document.getElementById('others').style.display="none";
      document.getElementById('others').value="";
    }
  }

  function openModalWindows() {
    Modalbox.show("http://www.es.ncl.eu/itinerary/news_form.php", {title: "NCL Specials-Letter", height: 530, width: 700 }); return false;
  }

  function openModalNewsletter() {
    var test="<p class=\"billing\">Gracias por suscribirte al boletín informativo de NCL.<br><br>En breve recibirás un mensaje en tu correo electrónico con un enlace de confirmación, que deberás pulsar si deseas recibir nuestro boletín.<br><br>Tu equipo de NCL Freestyle Cruising</p>";
    Modalbox.show(test, {title: "Suscripción al boletín informativo de NCL", height: 250, width: 450 }); return false;
  }

  var search="0";
  function showSearchForm() {
    if (search=="0") {
      document.getElementById('advanced_search1').style.display="";
      search="1";
    } else {
      document.getElementById('advanced_search1').style.display="none";
      search="0";
    }
  }



  function checkMandatoryFieldsShorex() {
    var complete ="false";
    var defaultValues ="false";
    var title_error ="true";
    var firstnamne_error ="true";
    var lastname_error ="true";
    var areacode_error ="true";
    var phone_error ="true";
    var county_error ="true";

    if (document.getElementById("dest_shorex").value=="") {
      if (document.getElementById("title_shorex").value=="") {
        if (document.getElementById("last_name_shorex").value=="") {
          if (document.getElementById("first_name_shorex").value=="") {
            if (document.getElementById("area_code_shorex").value=="") {
              if (document.getElementById("phone_shorex").value=="") {
                if (document.getElementById("dest_shorex").value=="") {
                  if (document.getElementById("ship_shorex").value=="") {
                    defaultValues="true";
                  } else {defaultValues ="false"}
                } else {defaultValues ="false"}
              } else {defaultValues ="false"}
            } else {defaultValues ="false"}
          } else {defaultValues ="false"}
        } else {defaultValues ="false"}
      } else {defaultValues ="false"}
    } else {defaultValues ="false"}


    if (defaultValues =="true") {
      Modalbox.hide();
      return (false);
    } else {
      if (document.getElementById("title_shorex").value!="") {
        title_error ="true";document.getElementById("titletext").style.color="black";
      } else {title_error ="false";document.getElementById("titletext").style.color="red";}

      if (document.getElementById("last_name_shorex").value!="") {
        lastname_error ="true";document.getElementById("lastnametext").style.color="black";
      }else {lastname_error ="false";document.getElementById("lastnametext").style.color="red";}

      if (document.getElementById("first_name_shorex").value!="") {
        firstnamne_error ="true";document.getElementById("firstnametext").style.color="black";
      }else {firstnamne_error ="false";document.getElementById("firstnametext").style.color="red";}

      if (document.getElementById("area_code_shorex").value!=""){
        areacode_error ="true";document.getElementById("phone_area_text").style.color="black";
      } else {areacode_error ="false";document.getElementById("phone_area_text").style.color="red";}

      if (document.getElementById("phone_shorex").value!="") {
        phone_error ="true";document.getElementById("phone_area_text").style.color="black";
      } else {phone_error ="false";document.getElementById("phone_area_text").style.color="red";}

      if (document.getElementById("dest_shorex").value!="") {
        phone_error ="true";document.getElementById("desttext").style.color="black";
      } else {phone_error ="false";document.getElementById("desttext").style.color="red";}

      if ((phone_error =="false") || (areacode_error =="false")) {
        document.getElementById("phone_area_text").style.color="red";
      }

      if (document.getElementById("country_shorex").value!="") {
        county_error ="true";document.getElementById("countrytext").style.color="black";
      } else {county_error ="false";document.getElementById("countrytext").style.color="red";}

      if ((title_error =="false") || (lastname_error =="false") || (firstnamne_error =="false") || (areacode_error =="false") || (phone_error =="false") || (county_error =="false")) {
        complete = "false";
      } else {complete = "true";}
      if (complete=="true") {
        return (true);
      } else if (complete=="false"){
        alert("Por favor, rellene todos los campos obligatorios.");
        return (false);
      }
    }
  }

  function showAgencyShorex(show) {
    if (show==1) {
      document.getElementById('agencylabel_shorex').style.display="";
      document.getElementById('agencyname_shorex').style.display="";
    }
    if (show==2) {
      document.getElementById('agencylabel_shorex').style.display="none";
      document.getElementById('agencyname_shorex').style.display="none";
      document.getElementById('agencyname_shorex').value="";
    }
  }

  function setEmailShorex() {
    if (document.getElementById("allowemailspecial_shorex").checked == true) {
      document.getElementById("email_label_shorex").style.display="";
      document.getElementById("email_address_shorex").style.display="";
    } else {
      document.getElementById("email_label_shorex").style.display="none";
      document.getElementById("email_label_shorex").value="";
      document.getElementById("email_address_shorex").style.display="none";
      document.getElementById("email_address_shorex").value="";
    }
  }

  function openModalClickToCallShorex() {
    var ShowText = "<form class=\"new_signup_request_shorex\" id=\"callback_form_shorex\" name=\"callback_form_shorex\" method=\"post\" action=\"insert_shorex_ctc.php\" onsubmit=\"return checkMandatoryFieldsShorex(this)\">";
    var header= "<div class=\"block\"><img alt=\"Signup_header\" src=\"http://www.ncl.de/web/images/ctc/callback_header.jpg\" align=\"left\"/><h1 class=\"title16px\">¡Permítame ayudarle a planear sus excursiones en tierra! </h1></div>";
    header += "<br><p style=\"margin-top:0px\">Nuestros agentes están disponibles de lunes a viernes de 9:00 a 19:00 hs.</p><br>";
    header += "<br><div id=\"another_search_ctc\"><div class=\"dotDivider\"></div><p style=\"margin-top:2px;margin-bottom:2px;margin-left:5px;\"><b>Por favor rellene el formulario para que nuestros expertos de las excursiones en tierra<br>puedan contactarle o consulte su agencia de viajes local.</b></p><div class=\"dotDivider\"></div></div>";
    header += "<br>";
    var text = "<table><tr><td colspan=\"2\"><p style=\"margin-bottom:0px;margin-top:0px\">¿Está actualmente trabajando en una agencia de viajes?*&nbsp;&nbsp;&nbsp;";
    text += "<input name=\"agency_shorex\" name=\"agency_shorex\" id=\"agency_shorex\" type=\"radio\" value=\"true\" tabindex=\"1\" onclick=\"javascript:showAgencyShorex(1)\">";
    text += "<label>Sí</label>&nbsp;&nbsp;&nbsp;&nbsp;";
    text += "<input name=\"agency_shorex\" name=\"agency_shorex\" id=\"agency_shorex\" type=\"radio\" value=\"false\" checked tabindex=\"2\" onclick=\"javascript:showAgencyShorex(2)\">";
    text += "<label>No</label></p></td></tr>";
    text += "<tr><td><label><p style=\"margin-bottom:0px;margin-top:0px;display:none\" id=\"agencylabel_shorex\" name=\"agencylabel_shorex\">Agencia de viajes</label>&nbsp;&nbsp;&nbsp;&nbsp;";
    text += "<input name=\"agencyname_shorex\" id=\"agencyname_shorex\" type=\"text\" style=\"display:none;width:360px\"></p></td></tr>";
    text += "<tr><td colspan=\"3\"><p style=\"margin-bottom:0px;margin-top:0px\">¿Ya tiene número de reserva de NCL?&nbsp;&nbsp;&nbsp;&nbsp;";
    text += "<input name=\"booking_shorex\" id=\"booking_shorex\" type=\"text\"style=\"width:247px\" tabindex=\"3\">";
    text += "</p></td></tr></table>";
    text += "<table><tr><td><label><p style=\"margin-bottom:1px\" name=\"desttext\" id=\"desttext\">Haga clic en el destino que le interesa para<br>informarse sobre las excursiones en tierra *</p></label><select name=\"dest_shorex\" id=\"dest_shorex\" size=\"1\" style=\"font-size:13px;width:250px;\"><option value=\"\">Seleccione por favor<option value=\"Mediterráneo & Mar Báltico\">Mediterráneo & Mar Báltico<option value=\"Caribe, Bahamas\">Caribe, Bahamas<option value=\"Hawai\">Hawai<option value=\"Alaska, Canadá & Nueva Inglaterra\">Alaska, Canadá & Nueva Inglaterra<option value=\"Sudamérica, Canal de Panamá & Riviera Mexicana\">Sudamérica, Canal de Panamá & Riviera Mexicana<option value=\"Información general\">Información general</select></p></td>";
    text += "<td><p style=\"margin-bottom:1px\" name=\"shiptext\" id=\"shiptext\">Quiero viajar en el siguente buque:<br>&nbsp;</p></label><select name=\"ship_shorex\" id=\"ship_shorex\" size=\"1\" style=\"font-size:13px;width:218px;\"><option value=\"\">Seleccione por favor<option value=\"Dawn\">Norwegian Dawn<option value=\"Epic\">Norwegian Epic<option value=\"Gem\">Norwegian Gem<option value=\"Jade\">Norwegian Jade<option value=\"Jewel\">Norwegian Jewel<option value=\"Majesty\">Norwegian Majesty<option value=\"Pearl\">Norwegian Pearl<option value=\"Sky\">Norwegian Sky<option value=\"Spirit\">Norwegian Spirit<option value=\"Star\">Norwegian Star<option value=\"Sun\">Norwegian Sun<option value=\"PAM\">Pride of America</select></p></td></tr></table>";
    text += "<table><tr><td valign=\"top\"><label><p style=\"margin-bottom:1px;\" name=\"titletext\" id=\"titletext\">Título*</p></label><select name=\"title_shorex\" id=\"title_shorex\" size=\"1\" style=\"font-size:13px;width:100px;\"><option value=\"\">Seleccione por favor<option value=\"Señor\">Señor<option value=\"Señora\">Señora<option value=\"Familia\">Familia</select></p>";
    text += "</td><td valign=\"top\">";
    text += "<label><p style=\"margin-bottom:0px\" name=\"firstnametext\" id=\"firstnametext\">Nombres*</p></label>";
    text += "<input name=\"first_name_shorex\" id=\"first_name_shorex\" style=\"width:175px\" tabindex=\"5\" type=\"text\" >";
    text += "</td><td valign=\"top\">";
    text += "<label><p style=\"margin-bottom:0px\" name=\"lastnametext\" id=\"lastnametext\">Apellidos*</p></label>";
    text += "<input name=\"last_name_shorex\" id=\"last_name_shorex\" style=\"width:177px\" tabindex=\"6\" type=\"text\" >";
    text += "</td></tr></table><table><tr><td>";
    text += "<label><p style=\"margin-bottom:0px\" name=\"countrytext\" id=\"countrytext\">¿Dónde vive?*</p></label>";
    text += "<select name=\"country_shorex\" id=\"country_shorex\" size=\"1\" style=\"font-size:13px\" tabindex=\"7\"><option value=\"\">Seleccione por favor<option value=\"AL\">Albania<option value=\"DE\">Alemania<option value=\"AD\">Andorra<option value=\"AT\">Austria<option value=\"BE\">Bélgica<option value=\"BY\">Bielorrusia<option value=\"BA\">Bosnia y Hercegovina<option value=\"BG\">Bulgaria<option value=\"CY\">Chipre<option value=\"VA\">Ciudad del Vaticano<option value=\"HR\">Croacia<option value=\"DK\">Dinamarca<option value=\"SK\">Eslovaquia<option value=\"ES\">España<option value=\"EE\">Estonia<option value=\"FI\">Finlandia<option value=\"FR\">Francia<option value=\"GR\">Grecia<option value=\"HU\">Hungría<option value=\"IS\">Islandia<option value=\"FO\">Islas Feroe<option value=\"LV\">Letonia<option value=\"LI\">Liechtenstein<option value=\"LT\">Lithuania<option value=\"IT\">Italia<option value=\"LU\">Luxemburgo<option value=\"MK\">Macedonia<option value=\"MT\">Malta<option value=\"MD\">Moldavia<option value=\"MC\">Mónaco<option value=\"NO\">Noruega<option value=\"NL\">Países Bajos<option value=\"PL\">Polonia<option value=\"PT\">Portugal<option value=\"CZ\">República Checa<option value=\"RO\">Rumania<option value=\"RU\">Rusia<option value=\"SM\">San Marino<option value=\"SI\">Slovenia<option value=\"SE\">Suecia<option value=\"CH\">Suiza<option value=\"TR\">Turquía<option value=\"UA\">Ucrania<option value=\"YU\">Yugoslavia</select>";
    text += "</td><td align=\"left\">";
    text += "<label><p style=\"margin-bottom:0px\" name=\"phone_area_text\" id=\"phone_area_text\">Prefijo*&nbsp;/&nbsp;&nbsp;Teléfono*</p></label>";
    text += "<input name=\"area_code_shorex\" id=\"area_code_shorex\" style=\"width:60px\" tabindex=\"8\" type=\"text\" > / <input name=\"phone_shorex\" id=\"phone_shorex\" style=\"width:100px\" tabindex=\"9\" type=\"text\" >";
    text += "</td></tr></table>";
    text += "<table><tr><td colspan=\"2\"><p style=\"margin-bottom:0px\"><input type=\"checkbox\" name=\"allowemailspecial_shorex\" id=\"allowemailspecial_shorex\" tabindex=\"10\" onclick=\"javascript:setEmailShorex()\">Quiero recibir por e-mail las ofertas y promociones de NCL.</p></td></tr>";
    text += "<tr><td colspan=\"2\">";
    text += "<label><p style=\"margin-bottom:0px;margin-top:0px;display:none\" name=\"email_label_shorex\" id=\"email_label_shorex\" tabindex=\"11\" >Dirección de correo electrónico</label>&nbsp;&nbsp;&nbsp;&nbsp;";
    text += "<input type=\"text\" name=\"email_address_shorex\" id=\"email_address_shorex\" size=\"24\" tabindex=\"12\" style=\"display:none;width:285px\"></p>";
    text += "</td></tr></table>";
    text += "<input type=\"hidden\" name=\"modal_type\" value=\"shorex_ctc_es\">";
    text += "<p><input type=\"submit\" value=\"Enviar/Cerrar\">&nbsp;&nbsp;&nbsp;<span class=\"small_text\">*Información obligatoria</span></p>";
    ShowText += header + text;
    ShowText += "</form>";
    Modalbox.show(ShowText, {title: "&nbsp;", height: 550, width: 700}); return false;
  }

/*---------------------------------------------------------------------------------------------*/
// Miles and More
/*---------------------------------------------------------------------------------------------*/

 function showConditions() {
    var ShowText ="<p><p>Con NCL Freestyle Cruising puede vivir unas vacaciones a su medida. Para los participantes de Miles & More esto también vale para el modo de pago: el precio en millas indicado es por persona y basado en ocupación doble, pero solamente una de las dos personas tiene que pagar en millas. La segunda persona tiene la opción de pagar el precio regular/de oferta vigente en el momento de la reserva en euros. Al hacer la reserva, por favor indique cómo quiere realizar el pago. Para más información y reservas llámenos al +49 611 36 07 024 ó envíe un correo electrónico a <a href=\"mailto.milesandmore@ncl.com\" style=\"text-decoration:underline\">milesandmore@ncl.com</a>.</p>";
    ShowText += "<p><b>Condiciones:</b><br>";
    ShowText += "<p class=\"arrow_white\">Únicamente los participantes de Miles & More de la Europa continental tendrán la posibilidad de canjear millas de premio a través de NCL (se incluye Rusia, se excluye Gran Bretaña e Irlanda).</p>";
    ShowText += "<p class=\"arrow_white\">Todas las ofertas correspondientes a \"Canjear millas\" se consideran \"Sólo Crucero\". No se incluye el trayecto de ida y vuelta al puerto de embarque/desembarque. Dicho trayecto se puede reservar mediante un paquete aéreo-terrestre a través de NCL. Dichos paquetes de NCL no son computables a efectos de millas.</p>";
    ShowText += "<p class=\"arrow_white\">Reservas con un mínimo de 15 días de anticipación antes de la salida.</p>";
    ShowText += "<p class=\"arrow_white\">Los premios de millas indicados han de entenderse por persona basados en ocupación doble.</p>";
    ShowText += "<p class=\"arrow_white\">Se facturarán gastos por cambio de reserva y por anulación. Reservas sujetas a disponibilidad.</p>";
    ShowText +="<p class=\"arrow_white\">Las millas no son transferibles, por lo que la persona que las canjea tiene que ser una de las personas que viajen.</p>";
    ShowText += "<p class=\"arrow_white\">Son de aplicación las <a href=\"../termsandconditions.php\" style=\"text-decoration:underline\">Condiciones Comerciales Generales</a> de NCL (Bahamas) Ltd.</p>";
    ShowText += "<p><b>Advertencias Cruise Rewards y Programa Latitudes:</b><br>Si paga el total del precio del crucero en millas de premio, abona así un precio por milla especialmente calculado. Por lo tanto no es posible canjear un cupón de abono \"Cruise Rewards\" para dicho crucero. <br><br>Por el mismo motivo tampoco es posible obtener los precios especiales Latitudes por el mismo crucero. Evidentemente tiene garantizadas todas las ventajas Latitudes a bordo y, por supuesto, el crucero es contabilizado a efectos de estatus Latitudes.</p>";
    Modalbox.show(ShowText, {title: "Condiciones", height: 430, width: 700}); return false;
  }
  function showConditionsNewReedemModel() {
    var ShowText ="<p class=\"arrow_white\">Únicamente los participantes de Miles & More de la Europa continental tendrán la posibilidad de canjear millas de premio a través de NCL (se incluye Rusia, se excluye Gran Bretaña e Irlanda).</p>";
    ShowText +="<p class=\"arrow_white\">Sólo una parte del precio del crucero puede ser pagado en millas de premio. No se incluye el trayecto de ida y vuelta al puerto de embarque/desembarque. Dicho trayecto se puede reservar mediante un paquete aéreo-terrestre a través de NCL. Dichos paquetes de NCL no son computables a efectos de millas.</p>";
    ShowText +="<p class=\"arrow_white\">La oferta es válida para todas las tarifas publicadas en euros, incluidas las ofertas especiales, según disponibilidad. La oferta es combinable con los precios especiales para socios de Latitudes y con los cupones de abono \"Cruise Rewards\".</p>";
    ShowText +="<p class=\"arrow_white\">Reservas con un mínimo de 15 días de anticipación antes de la salida.</p>";
    ShowText +="<p class=\"arrow_white\">Se facturarán gastos por cambio de reserva y por anulación. Reservas sujetas a disponibilidad.</p>";
    ShowText +="<p class=\"arrow_white\">Las millas no son transferibles, por lo que la persona que las canjea tiene que ser una de las personas que viajen.</p>";
    ShowText +="<p class=\"arrow_white\">Son de aplicación las <a href=\"../termsandconditions.php\" style=\"text-decoration:underline\">Condiciones Comerciales Generales</a> de NCL (Bahamas) Ltd.</p>";
    Modalbox.show(ShowText, {title: "Condiciones", height: 240, width: 700}); return false;
  }

/*---------------------------------------------------------------------------------------------*/
// ShoreEx
/*---------------------------------------------------------------------------------------------*/
  function Array2D(x,y) {
    this.items = new Array(x);
    for(i=0;i<y;i++) {
      this.items[i] = new Array(y);
    }
  }
  var zahl = 250;
  ashore = new Array2D(7,zahl);
  var x=0;

  function makePortsShown(id) {
    delSelect();
    var count=0;
    for (i=0;i<ashore.items.length;i++) {
      if(document.edt_port_to_dest.dest.value == ashore.items[i][1]) {
        document.edt_port_to_dest.port.value = ashore.items[i][2];
        element = new Option(ashore.items[i][2], ashore.items[i][0], false, true);
        document.edt_port_to_dest.port.options[document.edt_port_to_dest.port.options.length] = element;
        count++;
      }
    }
    document.edt_port_to_dest.port.options[0].selected = true;
    return count;
  }

  function delSelect() {
    for(i=1;i<document.edt_port_to_dest.port.length;) {
      document.edt_port_to_dest.port.options[document.edt_port_to_dest.port.length - 1] = null;
    }
  }

  function setSelectedDestPort() {
    if (dest_shorex=="Seleccione por favor") {dest_shorex =0; }
    document.edt_port_to_dest.dest.options[dest_shorex].selected = true;
    var count = makePortsShown(dest_shorex);
    for (i=0;i<=count;i++) {
      if(document.edt_port_to_dest.port.options[i].value == port_shorex) {
        document.edt_port_to_dest.port.options[i].selected = true;
      }
    }
  }

  function checkShoreEx() {
    var finish = "true";
    if(document.edt_port_to_dest.dest.value=="Seleccione por favor") {
      text ="Elija el destino deseado";
      var finish = "false";
    } else {
      if(document.edt_port_to_dest.port.value=="Seleccione por favor") {
        text ="Elija el puerto deseado";
        var finish = "false";
      }
    }
    if(finish=="false") {
      alert (text)
    } else {
      document.edt_port_to_dest.submit();
    }
  }

/*---------------------------------------------------------------------------------------------*/
// ShoreEx System Outage
/*---------------------------------------------------------------------------------------------*/
  function systemOutageShoreEx(Title) {
    var titleText = Title;
    Modalbox.show("http://www.es.ncl.eu/landausfluege/outage.php", {title: titleText, height: 250, width: 400}); return false;
  }

/*---------------------------------------------------------------------------------------------*/
// OBE System Outage
/*---------------------------------------------------------------------------------------------*/
  function systemOutageObe(Title) {
    var titleText = Title;
    Modalbox.show("http://www.es.ncl.eu/itinerary/outage.php", {title: titleText, height: 250, width: 400}); return false;
  }