subHover = function(){
		var nav = document.getElementById('nav');
		if(nav == null)
		{
			return;
		}
	    var subEls = nav.getElementsByTagName('LI');
        for(var i=0; i<subEls.length;i++){
                subEls[i].onmouseover = function(){
if (this.getElementsByTagName('A').length > 0) {
  this.getElementsByTagName('A')[0].style.backgroundPosition = 'left bottom';
}
                        this.className += "subhover";
                        if(document.all && document.getElementById("underNav")){ //if there is any div or element with the ID 'underNav' then this will hide all select elements in the enter
                            var centercontent = document.getElementById("contentcenter");
                            var selects = centercontent.getElementsByTagName("select");
                            for(i=0;i<selects.length;++i){
                                selects[i].style.visibility="hidden";
                            }
                        }

                        
                }
                subEls[i].onmouseout = function(){
if (this.getElementsByTagName('A').length > 0) {
  this.getElementsByTagName('A')[0].style.backgroundPosition = 'left top';
}
                        this.className = this.className.replace(new RegExp("subhover\\b"), "");
                        if(document.all && document.getElementById("underNav")){
                            //this shows the select boxes if there is any element with the ID of underNav...
                            var centercontent = document.getElementById("contentcenter");
                            var selects = centercontent.getElementsByTagName("select");
                            for(i=0;i<selects.length;++i){
                                selects[i].style.visibility="visible";
                            }
                        }

                }
        }
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
               {
               for(var i=0; i<document.images.length ; i++)
                  {
                  var img = document.images[i]
                  var imgName = img.src.toUpperCase()
                  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
                     {
                     var imgID = ( img.id) ? "id='" + img.id + "' " : ""
                     var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                     var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                     var imgStyle = "display:inline-block;" + img.style.cssText
                     if (img.align == "left") imgStyle = "float:left;" + imgStyle
                     if (img.align == "right") imgStyle = "float:right;" + imgStyle
                     if (img.parentElement.href ) imgStyle = "cursor:hand;" + imgStyle
                     var strNewHTML = "<span " + imgID + imgClass + imgTitle
                     + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
                     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                     + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
                     img.outerHTML = strNewHTML
                     i = i-1
                     }
                  }
               }

       
onloads.push(subHover);
        
if(window.attachEvent){
  window.attachEvent("onload", correctPNG);
}

// --------------- FLAG: THIS IS THE COLLAPSIBLE MENU AND CLASS CHANGE FUNCTION

function showHide(current_element){
     var target_element = current_element.parentNode.nextSibling.nextSibling;
     // Code fork for IE
    if(document.all) {
        target_element = current_element.parentNode.nextSibling;
    }
    //
        //debug section--
        /* alert(target_element.nodeName);
        alert(current_element.nodeName);*/
    //
    //collapse stuff
     if(target_element.style.display == "block"){
        target_element.style.display = "none";
     }
     else{
        target_element.style.display = "block";
     }
}

function justHide(current_element){
     var target_element = current_element.parentNode.nextSibling.nextSibling;
     // Code fork for IE
    if(document.all) {
        target_element = current_element.parentNode.nextSibling;
    }
    //
        //debug section--
        /* alert(target_element.nodeName);
        alert(current_element.nodeName);*/
    //
    //collapse stuff
     if(target_element.style.display == "block"){
        target_element.style.display = "none";
     }
}

function changeClass(current_element,target_class,new_class){
    var final_class = "";//initialize variable make sure its empty
    var target_element = current_element.parentNode;
    //alert(target_element.className);
    var classes = target_element.className;
    classes = classes.split(" ");
    var length = classes.length;
    //check to see if the if the target class is in the elements class attribute
    //if it isn't then check to see if the new class has already been put into the elements class attribute
    for(i=0;i<length;++i){

        if(classes[i] == target_class){
            classes[i] = new_class;
        }
        else if(classes[i] == new_class){
            classes[i] = target_class;
        }

    }

    for(i=0;i<length;++i){
        if(i!= length-1){
            final_class += classes[i]+" ";
        }
        else{
            final_class += classes[i];
        }
    }

    //alert(final_class);
    target_element.className = final_class;
}


// --------------- FLAG: THIS OPEN/CLOSE function
//----------------gets value of a radio button. Used in Booking engine: guest info page.
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
//----------------show/hide function for yes/no form element. Used in Booking engine: payment & guest info page.
function evalYesNoRadio(target){
	var checked = getCheckedValue(document.forms['guest_info'].elements['on_cruise'])
	//alert('you have checked: ' + checked);

	if (checked == 'yes'){
		//alert('YESSSSS!!!!');
		showHide(target);
		changeClass(target,'open2','close2');
	} else {
		justHide(target);
		changeClass(target,'open2','close2');
	}

}

function showHideElement() {
	for (var i = 0; i < params.length; i++)
	{
		var elmt = document.getElementById(params[i]);
		showHide(elmt);
		changeClass(elmt,'open','close');
		elmt.className = elmt.className == 'arrow_down' ? 'arrow_right' : 'arrow_down';
	}
}