// JavaScript Document

function show(idLayer) {document.getElementById(idLayer).style.display='block';}
function showInline(idLayer) { document.getElementById(idLayer).style.display='inline'; }
function hide(idLayer) {document.getElementById(idLayer).style.display='none';}

function visible(idLayer) {document.getElementById(idLayer).style.visibility='visible';}
function invisible(idLayer) {document.getElementById(idLayer).style.visibility='hidden';}

function change(id, newClass) {
identity=document.getElementById(id);
identity.className=newClass;
}

//Children selector.
function displayages(childobj)
{
if (childobj.options[0].selected){hide('children_box'); hide('minorsAge1'); hide('minorsAge2'); hide('minorsAge3'); hide('minorsAge4');}
if (childobj.options[1].selected){show('children_box'); showInline('minorsAge1'); hide('minorsAge2'); hide('minorsAge3'); hide('minorsAge4');}
if (childobj.options[2].selected){show('children_box'); showInline('minorsAge1'); showInline('minorsAge2'); hide('minorsAge3'); hide('minorsAge4');}
if (childobj.options[3].selected){show('children_box'); showInline('minorsAge1'); showInline('minorsAge2'); showInline('minorsAge3'); hide('minorsAge4');}
if (childobj.options[4].selected){ show('children_box'); showInline('minorsAge1'); showInline('minorsAge2'); showInline('minorsAge3'); showInline('minorsAge4');}
}


function verifyForm(strID)
{
	var blnPass = false;
	var objF = document.getElementById(strID);
	if(objF.chk_in.value=="mm/dd/yyyy"||objF.chk_in.value=="")
	{
		alert("Please select a check in date.");
		objF.chk_in.focus();
	}
	else if(objF.chk_out.value=="mm/dd/yyyy"||objF.chk_out.value=="")
	{
		alert("Please select a check out date.");
		objF.chk_out.focus();
	}
	else
	{
		if(strID=="airHotelSearch")
		{
			
			if(objF.leavingFrom.value=="")
			{
				alert("Please enter the city you are leaving from.");
				objF.leavingFrom.focus();
			}
			else if(objF.goingTo.value=="")
			{
				alert("Please enter the city you are going to.");
				objF.goingTo.focus();
			}
			else
			{
				objF.dateLeavingMonth.value = objF.doa_mm.value;
				objF.dateLeavingDay.value = objF.doa_dd.value;
				objF.dateReturningMonth.value = objF.dod_mm.value;
				objF.dateReturningDay.value = objF.dod_dd.value;
				blnPass = true;
			}
		}
		else if(strID=="CarSearch")
		{
			if(objF.pucity.value=="")
			{
				alert("Please enter the pick-up city.");
				objF.pucity.focus();
			}
			else if(objF.docity.value=="")
			{
				alert("Please enter the drop-off city.");
				objF.docity.focus();
			}
			else
			{
				objF.pudate_mo.value = objF.doa_mm.value;
				objF.pudate_dy.value = objF.doa_dd.value;
				objF.dodate_mo.value = objF.dod_mm.value;
				objF.dodate_dy.value = objF.dod_dd.value;
				blnPass = true;
			}
		}
		else
			blnPass = true;
	}
	return blnPass;
	
}

var strSlideIDs = new Array();
var strSlideURL = new Array();
strSlideIDs[1] = "caribbean";
strSlideIDs[2] = "hawaii";
strSlideIDs[3] = "bermuda";
strSlideIDs[4] = "turks-caicos";
strSlideIDs[5] = "bahamas";
strSlideIDs[6] = "south-pacific";
strSlideIDs[7] = "cayman-islands";
strSlideIDs[8] = "mediterranean";
strSlideIDs[9] = "jamaica";
strSlideIDs[10] = "mexico";
strSlideIDs[11] = "puerto-rico";
strSlideIDs[12] = "panama";
strSlideURL[1] = "/destinations/caribbean/";
strSlideURL[2] = "/destinations/hawaii/";
strSlideURL[3] = "/destinations/bermuda/";
strSlideURL[4] = "/destinations/turks-caicos/";
strSlideURL[5] = "/destinations/bahamas/";
strSlideURL[6] = "/destinations/south-pacific/";
strSlideURL[7] = "/destinations/cayman/";
strSlideURL[8] = "/destinations/mediterranean/";
strSlideURL[9] = "/destinations/jamaica/";
strSlideURL[10] = "/destinations/mexico/";
strSlideURL[11] = "/destinations/puerto-rico/";
strSlideURL[12] = "/destinations/panama/";

var blnSlidePause = false;
var intCurrSlide = 1;
var intMaxSlide = 12;

function goSlide()
{
	if(!blnSlidePause)
	{
		unsetAllSlides();
		setSlide(intCurrSlide);
		if(intCurrSlide<intMaxSlide)intCurrSlide++;
		else intCurrSlide = 1;
	}
	setTimeout("goSlide()",1000);
}
function setSlide(intSlide)
{
	document.getElementById("header-image").className = "header-" + strSlideIDs[intSlide];
	document.getElementById(strSlideIDs[intSlide]).className = "image outline";
	document.getElementById("click-here").href = strSlideURL[intSlide];
	
	
}
function unsetSlide(intSlide)
{
	document.getElementById(strSlideIDs[intSlide]).className = "image";
}
function unsetAllSlides()
{
	for(x=1;x<=intMaxSlide;x++)
	{
		unsetSlide(x);
	}
}








var strTabOn = 'waterTab';
function tabOver(strID)
{
	var obj1 = document.getElementById(strID);
	obj1.style.backgroundPosition='0% 0%';
}
function tabOut(strID)
{
	if(strTabOn!=strID)
	{
		var obj1 = document.getElementById(strID);
		obj1.style.backgroundPosition='0% 100%';
	}
}
function tabClick(strID)
{
	var obj1 = document.getElementById(strID);
	obj1.style.backgroundPosition='0% 0%';

	if(strID!='diversityTab')
		document.getElementById('diversityTab').style.backgroundPosition='0% 100%';
	if(strID!='activitiesTab')
		document.getElementById('activitiesTab').style.backgroundPosition='0% 100%';
	if(strID!='waterTab')
		document.getElementById('waterTab').style.backgroundPosition='0% 100%';

	strTabOn = strID;
}
function iconClick(strID)
{
	var obj1 = document.getElementById(strID);
	obj1.style.backgroundPosition='0% 0%';

	if(strID!='flip-basics')
	{
		document.getElementById('flip-basics').style.backgroundPosition='100% 100%';
		document.getElementById('flip-basics-page').style.display = "none";
	}
	if(strID!='flip-booking')
	{
		document.getElementById('flip-booking').style.backgroundPosition='100% 100%';
		document.getElementById('flip-booking-page').style.display = "none";
	}
	if(strID!='flip-news')
	{
		document.getElementById('flip-news').style.backgroundPosition='100% 100%';
		document.getElementById('flip-news-page').style.display = "none";
	}
	if(strID!='flip-specialty')
	{
		document.getElementById('flip-specialty').style.backgroundPosition='100% 100%';
		document.getElementById('flip-specialty-page').style.display = "none";
	}
	if(strID!='flip-food')
	{
		document.getElementById('flip-food').style.backgroundPosition='100% 100%';
		document.getElementById('flip-food-page').style.display = "none";
	}
	if(strID!='flip-phone')
	{
		document.getElementById('flip-phone').style.backgroundPosition='100% 100%';
		document.getElementById('flip-phone-page').style.display = "none";
	}
	if(strID!='flip-shopping')
	{
		document.getElementById('flip-shopping').style.backgroundPosition='100% 100%';
		document.getElementById('flip-shopping-page').style.display = "none";
	}
	if(strID!='flip-attire')
	{
		document.getElementById('flip-attire').style.backgroundPosition='100% 100%';
		document.getElementById('flip-attire-page').style.display = "none";
	}
	if(strID!='flip-activities')
	{
		document.getElementById('flip-activities').style.backgroundPosition='100% 100%';
		document.getElementById('flip-activities-page').style.display = "none";
	}
		
	document.getElementById(strID + '-page').style.display = "block";
}