/*---------------------------------------------------------------------------------------------*/
// Routensuche
/*---------------------------------------------------------------------------------------------*/
  function check(form) {
    if ((form=="side_bar") || (form=="search")) {
      var doc = document.search_form;
    }
    if (form=="header") {
      var doc = document.search_form_nav;
    }
    var finish="true";
    var checkdate="true";
    if(doc.dest.value=="") {
     if(doc.date1.value=="") {
      if(doc.date2.value=="") {
       if(doc.ship.value=="") {
        if(doc.port.value=="") {
         if(doc.duration.value=="") {
          if(doc.special_search.checked == false) {
            var finish = "false";
          }
         }
        }
       }
      }
     }
    }
    if(doc.date1.value!="") {
      if(doc.date1.value>doc.date2.value) {
        checkdate = "false";
      }
    }
    if (checkdate=="false") {
      alert ("Bitte Datumseingabe überprüfen.");
    } else {
      if(finish=="false") {
        alert ("Sie müssen eine Suchbedingung eingeben.")
      } else {
        doc.submit();
      }
    }
  }

/*---------------------------------------------------------------------------------------------*/
// Hotelsuche
/*---------------------------------------------------------------------------------------------*/

  function checkHotel() {
    var finish="true";
    var text="";
    if(document.search_form.dest.value=="Wählen Sie Ihr Zielgebiet") {
      text ="Wählen Sie Ihr Zielgebiet aus";
      var finish = "false";
    } else {
      if(document.search_form.port.value=="Wählen Sie Ihren Abfahrtshafen") {
        text ="Wählen Sie Ihren Abfahrtshafen aus";
        var finish = "false";
      }
    }
    if(finish=="false") {
      alert (text)
    } else {
      document.search_form.submit();
    }
  }

  function updatePortsHotel(id,form) {
    delPort(form);
    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<a_hotel.items.length;i++) {
      if (document.search_form.dest.value == "Wählen Sie Ihr Zielgebiet") {
        document.search_form.port.options[0].selected = true;
      }
    }
    document.search_form.port.options[0].selected = true;
  }

  function setSelectedDestPortHotel() {
    if (dest_hotel=="Wählen Sie Ihr Zielgebiet") {dest_hotel =0; }
      document.search_form.dest.options[dest_hotel].selected = true;
      updatePortsHotel(dest_hotel,'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 = "30";
  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 = "36";
  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 = "36";
  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 = 12;
  b = new Array2D(12,zahl1);
  var z=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;
  bb = 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(form) {
    if ((form=="side_bar") || (form=="search") || (form=="hotel")) {
      var doc = document.search_form;
    }
    if (form=="header") {
      var doc = document.search_form_nav;
    }
    for(i=1; i < doc.port.length;) {
        doc.port.options[doc.port.length - 1] = null;
    }
  }

  function delShip(form) {
    if ((form=="side_bar") || (form=="search")) {
      var doc = document.search_form;
    }
    if (form=="header") {
      var doc = document.search_form_nav;
    }
    for(i=1; i < doc.ship.length;) {
        doc.ship.options[doc.ship.length - 1] = null;
    }
  }

  function updateShipByDestination(id,form) {
    if ((form=="side_bar") || (form=="search")) {
      var doc = document.search_form;
    }
    if (form=="header") {
      var doc = document.search_form_nav;
    }
    delShip(form);
    for (i=0;i<b.items.length;i++) {
      if (doc.dest.value == "") {
        doc.ship.value = b.items[i][1];
        element = new Option(b.items[i][1], b.items[i][0], false, true);
        doc.ship.options[doc.ship.options.length] = element;
      }
      if(doc.dest.value == 1) {
        if(b.items[i][2]==1) {
          doc.ship.value = b.items[i][1];
          element = new Option(b.items[i][1], b.items[i][0], false, true);
          doc.ship.options[doc.ship.options.length] = element;
        }
      }
      if(doc.dest.value == 2) {
        if(b.items[i][3]==1) {
          doc.ship.value = b.items[i][1];
          element = new Option(b.items[i][1], b.items[i][0], false, true);
          doc.ship.options[doc.ship.options.length] = element;
        }
      }
      if(doc.dest.value == 3) {
        if(b.items[i][4]==1) {
          doc.ship.value = b.items[i][1];
          element = new Option(b.items[i][1], b.items[i][0], false, true);
          doc.ship.options[doc.ship.options.length] = element;
        }
      }
      if(doc.dest.value == 4) {
        if(b.items[i][5]==1) {
          doc.ship.value = b.items[i][1];
          element = new Option(b.items[i][1], b.items[i][0], false, true);
          doc.ship.options[doc.ship.options.length] = element;
        }
      }
      if(doc.dest.value == 5) {
        if(b.items[i][6]==1) {
          doc.ship.value = b.items[i][1];
          element = new Option(b.items[i][1], b.items[i][0], false, true);
          doc.ship.options[doc.ship.options.length] = element;
        }
      }
      if(doc.dest.value == 6) {
        if(b.items[i][7]==1) {
          doc.ship.value = b.items[i][1];
          element = new Option(b.items[i][1], b.items[i][0], false, true);
          doc.ship.options[doc.ship.options.length] = element;
        }
      }
    }
    doc.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,form) {
    if ((form=="side_bar") || (form=="search")) {
      var doc = document.search_form;
    }
    if (form=="header") {
      var doc = document.search_form_nav;
    }
    delPort(form);
    for (i=0;i<a.items.length;i++) {
      if(doc.dest.value == a.items[i][1]) {
        doc.port.value = a.items[i][2];
        element = new Option(a.items[i][2], a.items[i][0], false, true);
        doc.port.options[doc.port.options.length] = element;
      }
    }
    for (i=0;i<aa.items.length;i++) {
      if (doc.dest.value == "") {
        doc.port.value = aa.items[i][2];
        element = new Option(aa.items[i][2], aa.items[i][0], false, true);
        doc.port.options[doc.port.options.length] = element;
      }
    }
    doc.port.options[0].selected = true;
    updateShipByDestination(id,form);
  }

  function updatePortByShip(id,form) {
    if ((form=="side_bar") || (form=="search")) {
      var doc = document.search_form;
    }
    if (form=="header") {
      var doc = document.search_form_nav;
    }
    if (doc.ship.value == "") {
      updatePorts("",form);
    }
    if (doc.ship.value == "DWN") {
      delPort(form);
      for(i=0;i<a.items.length;i++) {
        if(doc.dest.value == a.items[i][1]) {
          if(a.items[i][15]=="1") {
            if(a.items[i][4]=="1") {
              doc.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              doc.port.options[doc.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(doc.dest.value == "") {
          if(aa.items[i][4]=="1") {
            doc.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            doc.port.options[doc.port.options.length] = element;
          }
        }
      }
    }
    if (doc.ship.value == "GEM") {
      delPort(form);
      for(i=0;i<a.items.length;i++) {
        if(doc.dest.value == a.items[i][1]) {
          if(a.items[i][15]=="1") {
            if(a.items[i][3]=="1") {
              doc.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              doc.port.options[doc.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(doc.dest.value == "") {
          if(aa.items[i][3]=="1") {
            doc.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            doc.port.options[doc.port.options.length] = element;
          }
        }
      }
    }

    if (doc.ship.value == "PRL") {
      delPort(form);
      for(i=0;i<a.items.length;i++) {
        if(doc.dest.value == a.items[i][1]) {
          if(a.items[i][15]=="1") {
            if(a.items[i][5]=="1") {
              doc.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              doc.port.options[doc.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(doc.dest.value == "") {
          if(aa.items[i][5]=="1") {
            doc.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            doc.port.options[doc.port.options.length] = element;
          }
        }
      }
    }
    if (doc.ship.value == "JWL") {
      delPort(form);
      for(i=0;i<a.items.length;i++) {
        if(doc.dest.value == a.items[i][1]) {
          if(a.items[i][15]=="1") {
            if(a.items[i][6]=="1") {
              doc.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              doc.port.options[doc.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(doc.dest.value == "") {
          if(aa.items[i][6]=="1") {
            doc.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            doc.port.options[doc.port.options.length] = element;
          }
        }
      }
    }
    if (doc.ship.value == "JAD") {
      delPort(form);
      for(i=0;i<a.items.length;i++) {
        if(doc.dest.value == a.items[i][1]) {
          if(a.items[i][15]=="1") {
            if(a.items[i][7]=="1") {
              doc.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              doc.port.options[doc.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(doc.dest.value == "") {
          if(aa.items[i][7]=="1") {
            doc.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            doc.port.options[doc.port.options.length] = element;
          }
        }
      }
    }
    if (doc.ship.value == "STA") {
      delPort(form);
      for(i=0;i<a.items.length;i++) {
        if(doc.dest.value == a.items[i][1]) {
          if(a.items[i][15]=="1") {
            if(a.items[i][8]=="1") {
              doc.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              doc.port.options[doc.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(doc.dest.value == "") {
          if(aa.items[i][8]=="1") {
            doc.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            doc.port.options[doc.port.options.length] = element;
          }
        }
      }
    }
    if (doc.ship.value == "SUN") {
      delPort(form);
      for(i=0;i<a.items.length;i++) {
        if(doc.dest.value == a.items[i][1]) {
          if(a.items[i][15]=="1") {
            if(a.items[i][9]=="1") {
              doc.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              doc.port.options[doc.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(doc.dest.value == "") {
          if(aa.items[i][9]=="1") {
            doc.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            doc.port.options[doc.port.options.length] = element;
          }
        }
      }
    }
    if (doc.ship.value == "SPR") {
      delPort(form);
      for(i=0;i<a.items.length;i++) {
        if(doc.dest.value == a.items[i][1]) {
          if(a.items[i][15]=="1") {
            if(a.items[i][10]=="1") {
              doc.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              doc.port.options[doc.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(doc.dest.value == "") {
          if(aa.items[i][10]=="1") {
            doc.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            doc.port.options[doc.port.options.length] = element;
          }
        }
      }
    }
    if (doc.ship.value == "SKY") {
      delPort(form);
      for(i=0;i<a.items.length;i++) {
        if(doc.dest.value == a.items[i][1]) {
          if(a.items[i][15]=="1") {
            if(a.items[i][11]=="1") {
              doc.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              doc.port.options[doc.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(doc.dest.value == "") {
          if(aa.items[i][11]=="1") {
            doc.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            doc.port.options[doc.port.options.length] = element;
          }
        }
      }
    }
    if (doc.ship.value == "AME") {
      delPort(form);
      for(i=0;i<a.items.length;i++) {
        if(doc.dest.value == a.items[i][1]) {
          if(a.items[i][15]=="1") {
            if(a.items[i][12]=="1") {
              doc.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              doc.port.options[doc.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(doc.dest.value == "") {
          if(aa.items[i][12]=="1") {
            doc.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            doc.port.options[doc.port.options.length] = element;
          }
        }
      }
    }
    if (doc.ship.value == "EPC") {
      delPort(form);
      for(i=0;i<a.items.length;i++) {
        if(doc.dest.value == a.items[i][1]) {
          if(a.items[i][15]=="1") {
            if(a.items[i][13]=="1") {
              doc.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              doc.port.options[doc.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(doc.dest.value == "") {
          if(aa.items[i][13]=="1") {
            doc.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            doc.port.options[doc.port.options.length] = element;
          }
        }
      }
    }
    if (doc.ship.value == "BWY") {
      delPort(form);
      for(i=0;i<a.items.length;i++) {
        if(doc.dest.value == a.items[i][1]) {
          if(a.items[i][15]=="1") {
            if(a.items[i][14]=="1") {
              doc.port.value = a.items[i][2];
              element = new Option(a.items[i][2], a.items[i][0], false, true);
              doc.port.options[doc.port.options.length] = element;
            }
          }
        }
      }
      for (i=0;i<aa.items.length;i++) {
        if(doc.dest.value == "") {
          if(aa.items[i][14]=="1") {
            doc.port.value = aa.items[i][2];
            element = new Option(aa.items[i][2], aa.items[i][0], false, true);
            doc.port.options[doc.port.options.length] = element;
          }
        }
      }
    }
    doc.port.options[0].selected = true;
  }

  function openNews(Title,Text) {
    var titleText = Title;
    Modalbox.show("http://www.ncl.de/news.php", {title: titleText, height: 375, width: 725}); 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>Sie werden mit uns auch auf hoher See kein Tor verpassen. Auf allen unseren Europarouten, an Bord der Norwegian Gem, Norwegian Jade, Norwegian Sun und auf den Premierenkreuzfahrten der Norwegian Epic können Sie bei den Spielen von Deutschland, Brasilien, Argentinien, Spanien, Italien, England, den USA und den Niederlanden mitfiebern. Außerdem werden natürlich die Viertel- und Halbfinalspiele, das Entscheidungsspiel um Platz drei sowie das Finale live übertragen.</p>";
    Modalbox.show(test, {title: "Die Fußballweltmeisterschaft an Bord der NCL Europaflotte erleben! ", height: 150, width: 650 }); 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("Bitte geben Sie eine gültige E-Mail Adresse an.");
        } else {
          alert("Bitte füllen sie alle Pflichtfelder aus.");
        }
        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("Bitte geben Sie eine gültige E-Mail Adresse an.");
      } else {
        alert("Bitte füllen sie alle Pflichtfelder aus.");
      }
      return (false);
    }
  }

  function checkMandatoryFieldsNewsletterPageAdwords() {
    var complete ="false";
    var firstnamne_error ="true";
    var lastname_error ="true";
    var email_error ="true";
    var country_error ="true";
    var title_error ="true";

    if (document.getElementById("last_name").value!="") {
      lastname_error ="true";document.getElementById("last_name_text").style.color="#333333";
    } 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="#333333";
    }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="#333333";
    } 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="#333333";
      } 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="#333333";
    } else {title_error ="false";document.getElementById("title_text").style.color="red";}

    if (document.getElementById("confirm").checked) {
      confirm_error ="true";document.getElementById("confirm_text").style.color="#333333";
    } else {confirm_error ="false";document.getElementById("confirm_text").style.color="red";}

    if ((title_error =="false") || (lastname_error =="false") || (firstname_error =="false") || (country_error =="false") || (email_error =="false") || (confirm_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("Bitte geben Sie eine gültige E-Mail Adresse an.");
      } else {
        alert("Bitte füllen sie alle Pflichtfelder aus.");
      }
      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.ncl.de/itinerary/news_form.php", {title: "NCL Specials-Letter", height: 510, width: 700 }); return false;
  }

  function openModalNewsletter() {
    var test="<p class=\"billing\">Vielen Dank für Ihre NCL Newsletteranmeldung.<br><br>Sie erhalten in Kürze eine E-Mail mit Bestätigungslink von uns. Um den NCL Newsletter zukünftig zu erhalten, müssen Sie einfach nur auf den Link in der E-Mail klicken.<br><br>Ihr Team von Norwegian Cruise Line</p>";
    Modalbox.show(test, {title: "Ihre NCL Newsletteranmeldung", 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 checkEmailShoreEx() {
    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_shorex").value) == false){
      //alert("email falsch");
      return (false);
    } else {
      //alert("email richtig");
      return (true);
    }
  }

  function checkMandatoryFieldsShorex() {
    var complete ="false";
    var defaultValues ="false";
    var title_error ="true";
    var firstname_error ="true";
    var lastname_error ="true";
    var areacode_error ="true";
    var phone_error ="true";
    var country_error ="true";
    var contact_error ="true";
    var dest_error ="true";
    var contact_complete ="true";

    if (document.getElementById("country_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=="") {
                    if (document.getElementById("contact_select_value").value=="0") {
                      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"}
    } 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!="") {
        firstname_error ="true";document.getElementById("firstnametext").style.color="black";
      }else {firstname_error ="false";document.getElementById("firstnametext").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 (document.getElementById("dest_shorex").value!="") {
        dest_error ="true";document.getElementById("desttext").style.color="black";
      } else {dest_error ="false";document.getElementById("desttext").style.color="red";}

      if (document.getElementById("contact_select_value").value!="0") {
        contact_error ="true";document.getElementById("contact_select_text").style.color="black";
      } else {contact_error ="false";document.getElementById("contact_select_text").style.color="red";}

      if ((document.getElementById("contact_select_value").value=="mail") && (document.getElementById("email_address_shorex").value!="")) {
         emailCheck=checkEmailShoreEx();
         if (emailCheck==true) {
           contact_complete_error="true";email_error ="true";document.getElementById("email_label_shorex").style.color="black";
         } else {contact_complete_error="false";email_error ="false";document.getElementById("email_label_shorex").style.color="red";}
      } else {contact_complete_error="false";email_error ="true";document.getElementById("email_label_shorex").style.color="red"; }

      if (document.getElementById("contact_select_value").value=="phone") {
        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 ((phone_error =="false") || (areacode_error =="false")) {
          document.getElementById("phone_area_text").style.color="red";
          contact_complete_error="false";
        } else {
          contact_complete_error="true";
        }
      }


      if ((title_error =="false") || (lastname_error =="false") || (firstname_error =="false") || (contact_complete_error =="false") || (country_error =="false") || (dest_error =="false")) {
        complete = "false";
      } else {complete = "true";}
      if (complete=="true") {
        return (true);
      } else if (complete=="false"){
        if (email_error =="false") {
          alert("Bitte geben Sie eine gültige E-Mail Adresse an.");
        } else {
          alert("Bitte füllen sie alle Pflichtfelder aus.");
        }
        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 showContactMethod(id) {
    if (id==1) {
      document.getElementById('contact_mail').style.display="";
      document.getElementById('contact_phone').style.display="none";
      document.getElementById('contact_select_value').value="mail";
    }
    if (id==2) {
      document.getElementById('contact_mail').style.display="none";
      document.getElementById('contact_phone').style.display="";
      document.getElementById('contact_select_value').value="phone";
    }
  }

  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() {
    Modalbox.show("http://www.ncl.de/landausfluege/shorex_ctc_form.php", {title: "&nbsp;", height: 560, width: 735}); return false;
  }

  function openModalShoreExCTC() {
    if (shoreex_ctc=="1") {
      var test="<p class=\"billing\">Vielen Dank für Ihre Registrierung.</p><p>Gerne werden wir Ihre Anfrage bearbeiten und uns schnellst möglich mit Ihnen in Verbindung setzen.<br><br>Ihr Team von Norwegian Cruise Line</p>";
      Modalbox.show(test, {title: "Vielen Dank für Ihre Registrierung.", height: 250, width: 450 }); return false;
    }
  }

/*---------------------------------------------------------------------------------------------*/
// Miles and More
/*---------------------------------------------------------------------------------------------*/

  function showConditions() {
    var ShowText ="<p>Mit NCL Freestyle Cruising können Sie Ihren Urlaub so flexibel gestalten, wie Sie möchten. Das gilt für Miles & More Mitglieder auch für die Art der Zahlung: Der angegebene Meilenpreis versteht sich pro Person bei Doppelbelegung. Jedoch muss lediglich 1 Person pro Buchung in Meilen zahlen. Die zweite Person kann den zum Zeitpunkt der Buchung gültigen Katalog- oder Specialpreis der Kreuzfahrt natürlich auch in Euro begleichen. Lassen Sie uns einfach zum Zeitpunkt der Buchung wissen, welche Aufteilung Sie wünschen. Für Informationen und Buchungen kontaktieren Sie uns unter +49-611-36 07 024 oder <a href=\"mailto.milesandmore@ncl.com\" style=\"text-decoration:underline\">milesandmore@ncl.com</a>.</p>";
    ShowText +="<p><b>Konditionen:</b><br>";
    ShowText +="<p class=\"arrow_white\">Über NCL Miles & More Prämienmeilen einzulösen ist nur für Miles & More Teilnehmer aus Kontinentaleuropa möglich (inklusive Russland, exklusive Großbritannien und Irland).</p>";
    ShowText +="<p class=\"arrow_white\">Alle \"Meilen einlösen\" Angebote verstehen sich \"Cruise Only\". Die Anreise ist nicht inkludiert. Für die Anreise kann über NCL ein Anreisepaket dazugebucht werden. Für Anreisepakete von NCL können keine Meilen eingelöst werden.</p>";
    ShowText +="<p class=\"arrow_white\">Buchung: Bis zu 15 Werktage im Voraus</p>";
    ShowText +="<p class=\"arrow_white\">Die genannten Meilenangebote verstehen sich pro Person bei Doppelbelegung der Kabine. </p>";
    ShowText +="<p class=\"arrow_white\">Storno- und Umbuchungsgebühren fallen an, Buchung je nach Verfügbarkeit.</p>";
    ShowText +="<p class=\"arrow_white\">Die Person, die ihre Meilen anwendet, muss mitreisen.</p>";
    ShowText +="<p class=\"arrow_white\">Es gelten die <a href=\"../termsandconditions.php\" style=\"text-decoration:underline\">Allgemeinen Geschäftsbedingungen</a> von NCL (Bahamas) Ltd.</p>";
    ShowText +="<p><b>Hinweise Cruise Rewards & Latitudes Club:</b><br>Die Kreuzfahrten zur Gesamtzahlung in Meilen basieren auf einem speziell kalkulierten Prämienmeilenpreis. Eine Verrechnung eines Cruise Reward Anzahlungscoupons ist daher für diese Kreuzfahrt nicht möglich. <br><br>Aus demselben Grund ist es nicht möglich, für dieselbe Kreuzfahrt Latitudes Preise zu erhalten. Alle Latitudes Vorteile an Bord werden Ihnen aber selbstverständlich gewährt und die Kreuzfahrt zählt natürlich zu Ihrem Latitudes Status.</p>";
    Modalbox.show(ShowText, {title: "Konditionen", height: 430, width: 700}); return false;
  }
  function showConditionsNewReedemModel() {
    var ShowText ="<p class=\"arrow_white\">Über NCL Miles & More Prämienmeilen einzulösen ist nur für Miles & More Teilnehmer aus Kontinentaleuropa möglich (inklusive Russland, exklusive Großbritannien und Irland).</p>";
    ShowText +="<p class=\"arrow_white\">Nur Teilbeträge des reinen Kreuzfahrtpreises können in Meilen gezahlt werden. Für die Anreise kann über NCL ein Anreisepaket dazugebucht werden. Für Anreisepakete von NCL können keine Meilen eingelöst werden.</p>";
    ShowText +="<p class=\"arrow_white\">Das Angebot ist gültig für alle veröffentlichten Raten in Euro inklusive Specials. Auch eine Kombination mit Latitudes Preisen und Cruise Rewards ist möglich.</p>";
    ShowText +="<p class=\"arrow_white\">Buchung: Bis zu 15 Werktage im Voraus</p>";
    ShowText +="<p class=\"arrow_white\">Storno- und Umbuchungsgebühren fallen an, Buchung je nach Verfügbarkeit.</p>";
    ShowText +="<p class=\"arrow_white\">Die Person, die ihre Meilen anwendet, muss mitreisen.</p>";
    ShowText +="<p class=\"arrow_white\">Es gelten die <a href=\"../termsandconditions.php\" style=\"text-decoration:underline\">Allgemeinen Geschäftsbedingungen</a> von NCL (Bahamas) Ltd.</p>";
    Modalbox.show(ShowText, {title: "Konditionen", height: 230, 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=="Treffen Sie Ihre Wahl") {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=="Treffen Sie Ihre Wahl") {
      text ="Wählen Sie Ihr Zielgebiet aus";
      var finish = "false";
    } else {
      if(document.edt_port_to_dest.port.value=="Treffen Sie Ihre Wahl") {
        text ="Wählen Sie Ihren Abfahrtshafen aus";
        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.ncl.de/landausfluege/outage.php", {title: titleText, height: 260, width: 400}); return false;
  }

/*---------------------------------------------------------------------------------------------*/
// OBE System Outage
/*---------------------------------------------------------------------------------------------*/
  function systemOutageObe(Title) {
    var titleText = Title;
    Modalbox.show("http://www.ncl.de/itinerary/outage.php", {title: titleText, height: 260, width: 400}); return false;
  }

/*---------------------------------------------------------------------------------------------*/
// Variable und Funktion zum steuern der Kreuzfahrtsuche in der Navigation
/*---------------------------------------------------------------------------------------------*/
  var showFind = '1';
  function show_find_a_cruise(id) {
    if (id =='1') {
      document.getElementById('nav_search').style.display='none';
      showFind='1';
    } else {
      if(showFind=='1') {
        document.getElementById('nav_search').style.display='block';
        showFind='0';
      } else {
        document.getElementById('nav_search').style.display='none';
        showFind='1';
      }
    }
  }

/*---------------------------------------------------------------------------------------------*/
// Ship Section link dropdownin nav_right
/*---------------------------------------------------------------------------------------------*/
  function linkShip(url) {
    window.location='http://www.ncl.de/'+url;
  }

/*---------------------------------------------------------------------------------------------*/
// Terms and Conditions Latitudes Rewards
/*---------------------------------------------------------------------------------------------*/
  function openModalLat() {
    var titleText = "Latitudes Rewards Bedingungen";
    var text="<p>Latitudes Rewards Bedingungen: Nur die Nächte von zu regulären Preisen gebuchten Kreuzfahrten werden auf Ihre Mitgliedschaft angerechnet. Kreuzfahrten mit einer Dauer von 5 Nächten oder weniger zählen zu Ihrem Latitudes Level, jedoch werden Latitudes Vorteile während dieser Kreuzfahrten nicht gewährt. Falls Sie ein Bordguthaben erhalten (z.B. im Rahmen unserer Latitudes Insider-Angebote), kann dieses für alle an Bord zu leistenden Zahlungen während der gebuchten Kreuzfahrt genutzt werden, wie z. B. Aufpreise in den Spezialitätenrestaurants und Getränke, Landausflüge, sowie sonstige Dienstleistungen. Das Bordguthaben kann nicht auf spätere Kreuzfahrten übertragen oder ausgezahlt werden. ";
    text+="<br><br>Die Latitudes Insider-Angebote sind nur gültig für Neubuchungen in Euro. Das Bordguthaben gilt pro Kabine (Höhe variiert je nach gebuchter Kategorie) bei Doppelbelegung. Es gilt nicht für die 3./4. Person in der Kabine sowie Kinder. Die Höhe des Bordguthabens bleibt bei Einzelbelegung unverändert. Latitudes Insider-Angebote sind kombinierbar mit Specials & Promotions, sind jedoch nur gültig auf Kreuzfahrten zu regulären Preisen. Angebot ist limitiert und vorbehaltlich Verfügbarkeit. ";
    text+="<br><br>Die dargestellte Kreuzfahrtpreise sind in Euro pro Person und gelten für Buchungen aus Kontinentaleuropa. An Bord unserer Schiffe fällt eine optionale Servicepauschale von US $ 12 pro Person und Tag an, welche bereits im Voraus bezahlt werden kann. Weitere Informationen erhalten Sie in Ihrem Reisebüro, bei unserer Reservierung oder im Internet auf ncl.de I ncl.at I ncl.ch. Es gelten die Allgemeinen Reisebedingungen von Norwegian Cruise Line.";
    text+="<br><br>In Ausnahmefällen kann es sein, dass der separate Latitudes Check-In nicht verfügbar ist. <br>Die Latitudes Rewards Programm Bedingungen können variieren, je nachdem in welchem Land die Reise gebucht wurde.<br>Druckfehler und Änderungen vorbehalten.</p>";
    text+="<button onclick=\"Modalbox.hide();\" id=\"search_cruises_button_search_details\" value=\"Schliessen\">Schliessen</button> ";
    Modalbox.show(text, {title: titleText, height: 375, width: 725}); return false;
  }
