<!-- Copyright Relaxing Journeys Ltd 2005/9 -->

<!-- Pop JS -->
$(document).ready(function() {
	$("a.pop").fancybox({
		'zoomOpacity'			: true,
		'overlayShow'			: false,
		'zoomSpeedIn'			: 500,
		'zoomSpeedOut'		: 500,
		'overlayShow'			: true,
		'frameWidth'				: 425,
		'frameHeight'			: 555,
		'hideOnContentClick'	: false
	});
});
<!-- End Pop JS -->

<!-- Form Checker -->
function checkCheckBox(f){
if (f.DepartMonth.selectedIndex  == 0)
{
alert('Please ensure you select your preferred travel date. If you are not sure exactly when you wish to travel, then please provide us with an approximate date. Thanks!');
f.DepartMonth.focus();
return false;
}

if (f.Adults.value == "")
{
alert('Please ensure you have typed in how many adults are traveling.');
f.Adults.focus();
return false;
}

if (f.FirstName.value == "")
{
alert('Please ensure you have typed in your first name.');
f.FirstName.focus();
return false;
}

if (f.Surname.value == "")
{
alert('Please ensure you have typed in your last name.');
f.Surname.focus();
return false;
}

if (f.Email.value == "")
{
alert('Please ensure you have typed in your email address. Without it we will find it hard to contact you...');
f.Email.focus();
return false;
}

if (f.Terms.checked == false)
{
alert('Please tick that you have read the Terms & Conditions to continue...');
return false;
}
}

function checkDayTourForm(f){
if (f.StartDate.value == "")
{
alert('Please select a tour start date by clicking on the calendar icon.');
f.StartDate.focus();
return false;
}
}
<!-- End Form Checker -->


<!-- Weather -->
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
<!-- End Weather -->

<!-- Shortlist -->
var arrRecords = new Array();

expireDate = new Date;
oldDate    = new Date;
expireDate.setDate(expireDate.getDate()+60);

function cookieVal(cookieName) 
{
	thisCookie = document.cookie.split("; ")
	for (i = 0; i < thisCookie.length; i++) {
		if (cookieName == thisCookie[i].split("=")[0]) {
			return thisCookie[i].split("=")[1];
		}
	}
	return null;
}

function loadCookie() 
{
	if(document.cookie != "") {
		retStr = cookieVal("Tours") ;
		// alert ("retStr=" + retStr );
		if (retStr != null) {
			arrRecords = retStr.split(",");
		}
    }
}

/*
function setCookie (name, value, expires) {
if (!expires) expires = new Date();
document.cookie=name+"="+escape (value)+"; expires="+expires.toGMTString()+"; path=/";
}
*/

function addTour(id) 
{
	var i = 0;
	var recCount = getNumTours() ;
	var found = false;
	var rTour;
	// var newurl = document.location +'#Tour'+id;

	// check it is not already there
    for(i = 0; i < recCount; i++) {
		rTour = arrRecords[i];
		if (rTour == id) {
			found=true;
			break;
		}
	}

	if (found==false)
	{
		lastitem = arrRecords.length;
		arrRecords[lastitem] = id;
		
		document.cookie = "Tours="+arrRecords+";expires=" + expireDate.toGMTString()+"; path=/";
		// alert(newurl);
		// document.location.href=newurl;
		document.getElementById("Tour"+id).innerHTML = "<a href=\"/shortlist.php\" class=\"icons\" id=\"saveshortlist\"></a>";
		// location.reload();
	}
	 else
	 {
		alert('This tour has already been added to your saved tour list.');
	}
}

function getNumTours()
{
	if (arrRecords.length != "" ) 	{
		return arrRecords.length ;
	} else {
		return 0;
	}
}

function deleteTour(id, rl) 
{
	var arrTemp = new Array();
	var i = 0;
	var j = 0;
	var recCount = getNumTours() ;
	var rTour = null;

	if (recCount == 1)
	{
		nullStr = "";
		document.cookie = "Tours="+nullStr+";expires=" + oldDate.toGMTString()+"; path=/";
		//if (rl) {
			location.reload();
		//}
		return ;
	}

	// copy active array into temp array
	// skip the item to be deleted
    for (i = 0, j = 0; i < recCount; i++) {
		rTour = arrRecords[i];
		if (rTour != id) {
			arrTemp[j++] = arrRecords[i];
		} 
		//else 
		//{
		//	alert('found item to delete : ' + rTour);
		//}
	}

    arrRecords = arrTemp ;
	document.cookie = "Tours="+arrRecords+";expires=" + expireDate.toGMTString()+"; path=/";
	//if (rl) {
		location.reload();
	//}
}

function getTour(index)
{
	if (arrRecords.length != "" && index < arrRecords.length) 	{
		return arrRecords[index] ;
	} else {
		return 0;
	}
}

function delTours() {
	if (window.confirm('Are you sure you want to clear all your tours?')) {
		nullStr = "";
		document.cookie = "Tours="+nullStr+";expires=" + oldDate.toGMTString()+"; path=/";
		location.reload();
	}
}

function ClearTours() {
    document.write ('<a href="javascript:delTours();"><img src="/images/plus.png" width="21" height="21" border="0" align="left"></a>&nbsp;&nbsp;<a href="javascript:delTours();">Remove ALL Tours from your Shortlist</a>');
}			


loadCookie();
<!-- End Shortlist -->