function caribRoll(dest) {
	document.getElementById('caribbeanImg').src='/images/nav/'+dest+'.jpg';
	return false;
}
function eurRoll(dest) {
	document.getElementById('europeImg').src='/images/nav/'+dest+'.jpg';
	return false;
}
function amRoll(dest) {
	document.getElementById('americasImg').src='/images/nav/'+dest+'.jpg';
	return false;
}


//holiday check
function HolidayCheck(sender, args) { 
	var arr = document.getElementById('txtArrive');
    var nights = document.getElementById('ddlNights');
    
	if (arr == null)
		arr = document.aspnetForm.ctl00$ctl00$txtArrive.value;
	if (nights == null)
		nights = document.aspnetForm.ctl00$ctl00$ddlNights.value;
    
    var xmas = new Date(2008, 11, 19); // Dec 19th
    var nyears = new Date(2009, 0, 4); // Jan 4th
    var m;
    var d;
    var n = parseInt(nights); 
    var arrive = new Date(); 
    arrive.setTime(Date.parse(arr)); 
    var depart = new Date(arrive.getFullYear(), arrive.getMonth(), arrive.getDate() + n);
    if(arrive<=nyears && depart>=xmas && n<14) 
        args.IsValid = false; 
        else 
        args.IsValid = true; 
} 

//day check for What's Hot in 2nd Column
function checkDay() {
	today=new Date();
	thisDay=today.getDay();
	newBkg="url(/images/hot"+thisDay+".gif)";
	document.getElementById("new").style.backgroundImage = newBkg;
}

//2 column pop up
function popLighter(url) {
	newwindow=window.open(url,'LighterSide','height=355,width=425');
	if (window.focus) {newwindow.focus()}
	return false;
}

//basic pop
function popWin(url,height,width) {
	newwindow=window.open(url,'StormUpdate','height='+height+',width='+width);
	if (window.focus) {newwindow.focus()}
	return false;
}

//storm pop up window
function popStorm() {
	newwindow=window.open('/storm-update.html','StormUpdate','height=500,width=425');
	if (window.focus) {newwindow.focus()}
	return false;
}

//james bond pop up window
function popBond() {
	var h = window.screen.availHeight * 0.60;
	var w = window.screen.availWidth * 0.60;
	//window.location = "http://www.wimco.com/villas/villa.aspx?pid=897410";
	newwindow=window.open('http://www.007.com','JamesBond','height='+h+',width='+w+',scrollbars=yes,toolbar=yes,resizable=yes');
	if (window.focus) {newwindow.focus()}
	return false;
}

//ie drop down menus hack
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			toggleSelects('hide');
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			toggleSelects('show');
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
function toggleSelects(action) {}

//write in Flash
function writeFlash(src, width, height) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'"><param name="movie" value="'+src+'.swf"><param name="quality" value="high"><param name="wmode" value="transparent"><embed src="'+src+'.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="'+width+'" height="'+height+'"></embed></object>');
}

//Destination Yahoo weather
function ftnWeather(strPage) {
	strWindowName = "winWeather";
	intWidth = 640;
	intHeight = 0;
	strUrl = "http://weather.yahoo.com/forecast/" + strPage;
	window.open(strUrl, strWindowName, "toolbar=0,location=0,status=0,screenX=100,screenY=200,left=100,top=200,scrollbars=1");
};

//Destination Maps
function islandMap(url) {
	newwindow=window.open(url,'DestinationMap','height=450,width=540');
	if (window.focus) {newwindow.focus()}
	return false;
}
function satelliteMap(url) {
	newwindow=window.open(url,'DestinationMap','height=485,width=540');
	if (window.focus) {newwindow.focus()}
	return false;
}
function dynamicMap(url) {
	newwindow=window.open(url,'DestinationMap','height=500,width=700');
	if (window.focus) {newwindow.focus()}
	return false;
}

//select another destination
function WinOpen() {
	document.location.href = document.aspnetForm.ddlDestNav.value
}

//select a holiday
function openHol() {
	document.location.href = document.aspnetForm.holSearch.value
}

//form fields
function clearText(thefield) {
	if (thefield.defaultValue==thefield.value) { thefield.value = "" }
}
		
function replaceText(thefield) {
	if (thefield.value=="") { thefield.value = thefield.defaultValue }
}



//not used *yet*
//toolTips
function toolTipShow(ele) {
	document.getElementById(ele).style.display = "block";
	document.getElementById(ele).onmouseover = function() { document.getElementById(ele).style.display = "block"; }
	document.getElementById(ele).onmouseout = function() { document.getElementById(ele).style.display = "none"; }
	//follow x and y
	//document.getElementById(ele).style.pixelLeft=(e.x+15+document.body.scrollLeft);
    //document.getElementById(ele).style.pixelTop=(e.y+document.body.scrollTop); 
}
function toolTipHide(ele) {
	document.getElementById(ele).style.display = "none";
}

//for big interactive maps on destinations
function launchTour(code) {
	var w = screen.width;
	var winwidth;
	var winurl;
	if (w >= 1000) {
		winwidth=890       
		winurl = 'http://delivery.vrxstudios.com/destinations/vrxfullviewer.asp?ident='+code;
	} else {
		winwidth=546
		winurl = 'http://delivery.vrxstudios.com/destinations/vrxmap.asp?ident='+code;
	}
	var win = window.open(winurl,'vrxmap','width=' + winwidth + ',height=520,top=5,left=5,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
	win.focus();
}

// js cookie function. 04.29.09 JK

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}



