//Subnavigation
function toggle_sm(id) {
   if ((d_style(id).visibility == "hidden") || (d_style(id).visibility == "")) {
        opensubnav(id);
   } else {
        closesubnav(id);
   }
}
function opensubnav(id) {
    d_show(id);
}
function closesubnav(id) {
    d_hide(id);
}
// Details ein und ausblenden
var selectedElement = null;
function toggle(obj1) {
     var el = obj1;
     if (typeof el == 'string')
         el = document.getElementById(el);    
     el.style.display = (el.style.display != 'block' ? 'block' : 'none' );
    selectedElement = el;
}
/* ****************************************************************** */
/* Function for switching product tabs */
producttab = 1;
function tabtoggle(id) {
    productmark = producttab;
    if (producttab > 5) { productmark = producttab - 5; }
    d_style("tab" + producttab).display = "none";
    set_tab_unselected(producttab);      
    
    producttab = id;
    productmark = producttab;
    if (producttab > 5) { productmark = producttab - 5; }
    d_style("tab" + producttab).display = "block";
    set_tab_selected(producttab);      
}
function set_tab_selected(tab_num){
   d_obj("tabreiter" + tab_num).className="selected";
}
function set_tab_unselected(tab_num){
   d_obj("tabreiter" + tab_num).className="unselected";
}
function d_support() {
    return (document.layers ||
     document.all ||
     document.getElementById);
}
function d_style(id) {
    if (document.layers) {
 return d_obj(id);
    } else if (document.all || document.getElementById) {
 return d_obj(id).style;
    }
}
function d_obj(id) {
    if (document.layers) {
 return document.layers[id];
    } else if (document.all) {
 return document.all[id];
    } else if (document.getElementById) {
 return document.getElementById(id);
    } 
}
function d_hide_b(id) {
    if (d_support()) {
 d_style(id).display = "none";
    }
}
function d_show_b(id) {
    if (d_support()) {
 d_style(id).display = "block";
    }
}
function d_hide(id) {
    if (d_support()) {
 d_style(id).visibility = "hidden";
    }
}
function d_show(id) {
    if (d_support()) {
 d_style(id).visibility = "visible";
    }
}
function switch_over(id_open, id_close){
  d_hide_b(id_open);
  d_show_b(id_close);
}
function select_tab(){}
/* ****************************************************************** */
/* Function to detect file type (download content class) */
function getfiletype (thisurl) {
    thisurl = thisurl.substring(thisurl.lastIndexOf('.')+1,thisurl.length );
    document.write(thisurl);
}
/* Function to remove position after decimal point in filesize of media assets */
function stripsize(value) {
    value = (value.replace(/,[0-9]*/, ""));
    value = (value.replace(/\.[0-9]*/, ""));
    document.write(value);
}
/* ****************************************************************** */
/* Anzahl der Kabinen  wird geaendert*/
function change_cabins(){
  var Anzahl = d_obj("kabinen").selectedIndex;
  Anzahl ++;
  for (i=2;i<=5;i++){
    id =  "cabin"+i ;
    d_style(id).display = "none";
  }
  
  for (i=2;i<=Anzahl;i++){
    id =  "cabin"+i ;
    d_style(id).display = "block";
  }
  
}//function change_cabins()
/* ************************** Form check ************************** */
function check_form(fname) {
    var msg="";
    if ((!document.forms[fname].Anrede[0].checked) && (!document.forms[fname].Anrede[1].checked)) msg += "Bitte geben Sie Ihre Anrede ein!\n";
    if (!document.forms[fname].Vorname.value) msg += "Bitte geben Sie Ihren Vornamen ein!\n";
    if (!document.forms[fname].Nachname.value) msg += "Bitte geben Sie Ihren Nachnamen ein!\n";
    if (!document.forms[fname].email.value) {
          msg += "Bitte geben Sie Ihre E-Mail Adresse ein!\n";
     } 
     else {
          if (!(document.forms[fname].email.value.search(/[@.]/) >= 0) || (!(document.forms[fname].email.value.length >= 8)))     
          {   msg += "\nSie haben eine ungueltige E-Mail Adresse eingegeben.\nBitte geben Sie Ihre vollstaendige E-Mail Adresse in dem Format name@domain.com ein.\n";
          }
     }//else
    
    if (fname == "contact_form") {
       if ( document.forms[fname].Betreff.options[0].selected ) {msg += "Bitte waehlen Sie Ihren Betreff aus.\n";}
    }//if (fname == "contact_form") 
    if( msg != "" ) {
        alert( msg );
        msg="";
        return false;
    } else {
        return true;
    }
}//function check_form(fname)
/* ************************** SortHighlighting ************************** */
function changeSortHighlighting(criteria) {
    SortCriteria = Array("schiffsname", "veranstalter", "seekreuzfahrten", "flusskreuzfahrten");
    for (i = 0; i < SortCriteria.length; i++) {
        d_style('sort_' + SortCriteria[i]).fontWeight = 'normal';
        d_style('sort_' + SortCriteria[i]).color = '#A1112D';
        d_style('sort_' + criteria).textDecoration = 'underline';
    }
    d_style('sort_' + criteria).fontWeight = 'bold';
    d_style('sort_' + criteria).color = '#0059A1';
    d_style('sort_' + criteria).textDecoration = 'none';
}
 
/* ****************************************************************** */
function openwindow(t_url, sbars, width, height, bnav) {
    var wx, wy;
    if (bnav == 1) {
    bnav = "menubar=yes,toolbar=yes,";
    } else {
    bnav = "";
    }
    if (sbars == 1) {
        scrollb = "scrollbars=yes,";
    } else {
        scrollb = "";
    }
    if (screen.availWidth >= width) {
        wx = (screen.availWidth - width) / 2;
    } else {
        wx = 0;
    }
    if (screen.availHeight >= height) {
        wy = (screen.availHeight - height) / 2;
    } else {
        wy = 0;
    }
    return window.open(t_url, '', scrollb + bnav + 'width=' + width + ',height=' + height + ',left=' + wx + ',top=' + wy + ', resizable=yes');
}
/* ****************************************************************** */
// Für Reisebürosuche DER und ATLAS
function chkFormularRBS() {

    var str=new String(document.reisebuerosuche.plz.value);

    if(str.length<2 || str=='undefined') {

        alert("Bitte geben Sie mindestens die ersten 2 Ziffern der Postleitzahl ein!");
        document.reisebuerosuche.plz.focus();
        return false;

    }

    var isNumeric=true;

    for(i=0;i<str.length;++i) if(str.charAt(i)<"0" || str.charAt(i)>"9") isNumeric=false;

    if(!isNumeric) {

        alert("Bitte geben Sie nur Ziffern ein!");
        document.reisebuerosuche.plz.focus();
        return false;

    }

}