// JavaScript Document
if (document.images) 
{
   aboutoff = new Image();
   programsoff = new Image();
   familyoff = new Image();
   lagoonoff = new Image();
   photooff = new Image();
   giftsoff = new Image();
   educationoff = new Image();
   newsoff = new Image();
   faqoff = new Image();
   contactoff = new Image();
   
   abouton = new Image();
   programson = new Image();
   familyon = new Image();
   lagoonon = new Image();
   photoon = new Image();
   giftson = new Image();
   educationon = new Image();
   newson = new Image();
   faqon = new Image();
   contacton = new Image();
   
   aboutoff.src = "images/about_off.jpg";
   programsoff.src = "images/programs_off.jpg";
   familyoff.src = "images/family_off.jpg";
   lagoonoff.src = "images/lagoon_off.jpg";
   photooff.src = "images/photo_off.jpg";
   giftsoff.src = "images/gifts_off.jpg";
   educationoff.src = "images/education_off.jpg";
   newsoff.src = "images/news_off.jpg";
   faqoff.src = "images/faq_off.jpg";
   contactoff.src = "images/contact_off.jpg";
   
   abouton.src = "images/about_on.jpg";
   programson.src = "images/programs_on.jpg";
   familyon.src = "images/family_on.jpg";
   lagoonon.src = "images/lagoon_on.jpg";
   photoon.src = "images/photo_on.jpg";
   giftson.src = "images/gifts_on.jpg";
   educationon.src = "images/education_on.jpg";
   newson.src = "images/news_on.jpg";
   faqon.src = "images/faq_on.jpg";
   contacton.src = "images/contact_on.jpg";
}

function imgOn(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "on.src");}
}
function imgOff(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "off.src");}
}
function show_subcategory(container_name)
{
if (container_name.style.display == "none")
{
container_name.style.display = "";
}
else
{
container_name.style.display = "none";
}
}

function correctPNG() 
{

  var arVersion = navigator.appVersion.split("MSIE");
  var version = parseFloat(arVersion[1]);
	

   if ((version >= 5.5) && (document.body.filters)) 
   {
 	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 imgStyle = "display:inline-block";

            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 style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src='" + img.src + "\');\"></span>";		
		
            img.outerHTML = strNewHTML;

            i = i-1;

         }

      }

   }    
}

 
window.attachEvent("onload", correctPNG);

/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var persistmenu="no" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate

function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false;}
else {return true;}
}
}

function valdropDownMenu(dropdown)  {
var myindex=document.forms[0].menu.selectedIndex;
if (myindex==0) {
alert("\nYou must make a selection from the drop-down menu.");
document.forms[0].menu.focus();
}
else {
menu_selection=document.forms[0].menu.options[myindex].value;
return true;
   }
}

function checkreservationpageform (form)
{
//alert(form.month.options[form.month.selectedIndex].value);
  if (form.name.value == "") {
    alert( "Please enter your name." );
    form.name.focus();
    return false ;
  }
  if (form.email.value == "") {
    alert( "Please enter your email address." );
    form.email.focus();
    return false ;
  } 
  if (form.phone.value == "") {
    alert( "Please enter your phone number." );
    form.phone.focus();
    return false ;
  }   
  if (form.dolphincloseencounterage.value == "" && !(form.dolphincloseencounter.value == "")) {
    alert( "Please enter the Dolphin Encounter participants age." );
    form.dolphincloseencounterage.focus();
    return false ;
  }   
  if (form.dolphinswimage.value == "" && !(form.dolphinswim.value == "")) {
    alert( "Please enter the Dolphin Swim participants age." );
    form.dolphinswimage.focus();
    return false ;
  }   
  if (form.sealioncloseencounterage.value == "" && !(form.sealioncloseencounter.value == "")) {
    alert( "Please enter the Sea Lion Encounter participants age." );
    form.sealioncloseencounterage.focus();
    return false ;
  }   
  if (form.arrivalday.value == "") {
    alert( "Please enter your Arrival day in Nassau." );
    form.arrivalday.focus();
    return false ;
  }  
  if (form.departureday.value == "") {
    alert( "Please enter your Departure day & time from Nassau:*." );
    form.departureday.focus();
    return false ;
  }  
  if (form.datechoice1.value == "") {
    alert( "Please enter your First choice date to do program." );
    form.datechoice1.focus();
    return false ;
  } 
  if (form.datechoice2.value == "") {
    alert( "Please enter your Second choice date to do program." );
    form.datechoice2.focus();
    return false ;
  }  
  if (form.hotelcruisename.value == "") {
    alert( "Please enter the Name of hotel or cruise ship." );
    form.hotelcruisename.focus();
    return false ;
  }  
  return true ;
}


function upsellpackages(package) {
	alert("You can add some of our great other items to the " + package + " and save big! Please check out our Package Upgrades.");
    document.giftform.addcombo.focus();
}

function open_win(page) {window.open(page,"","height=1100,width=660,toolbar=no,statusbar=no,scrollbars=yes").focus(); }