function detectSafari(){
if (navigator.appVersion.indexOf("Safari") != -1)
   document.body.className += " safari";
}

if (window.addEventListener)
   window.addEventListener("load", detectSafari, false);


//Gallery script

function showPic(whichpic)
{
	if(document.getElementById)
	{
		var largepic = document.getElementById('placeholder');
		largepic.src = whichpic.href;
		largepic.alt = whichpic.title;
		document.getElementById('desc1').innerHTML= largepic.alt;
		
		
		return false;
	}
	else
	{
		return true;
	}
}


//browser detect
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();


//fixes menu for ie6
function menu_spacer(){
//set height of all LI to height of LI with greatest height value
if((BrowserDetect.browser =="Explorer") && (BrowserDetect.version=="6")){
	var  LIheights=new Array();
	var listItems = document.getElementById('listContainer').document.getElementsByTagName('LI');
	for (i=0; i<listItems.length; i++){
		 LIheights.push(listItems[i].offsetHeight);
	}
	function numberorder(a,b) { return b - a; } 
	LIheights.sort(numberorder)

	for (i=0; i<listItems.length; i++){
		 listItems[i].style.height=(LIheights[0]-1)+"px";
	}
	
//align nav to middle of page
	var ULwidth = document.getElementById('navigation').offsetWidth;
	var wrapperWidth = document.getElementById('listContainer').offsetWidth;
	
	var theWidth = (wrapperWidth-ULwidth)/2;
	var head = document.getElementsByTagName('head')[0],    
		style = document.createElement('style'),    
		rules = document.createTextNode('#listContainer ul {padding-left:'+theWidth+'px;}');
	style.type = 'text/css';
	if(style.styleSheet)   
		style.styleSheet.cssText = rules.nodeValue;
	else style.appendChild(rules);
	head.appendChild(style);
	}
}
//dropdown over select in IE6 image swap fix
	selectToggle = function(){
	if((BrowserDetect.browser =="Explorer") && (BrowserDetect.version=="6")){
		var selectState = document.getElementById("Menu").getElementsByTagName("LI");
		
		for (var n=0; n<selectState.length; n++) {
			selectState[n].onmouseover=function() {
				document.getElementById("formDivId").style.display="none";
				document.getElementById("formImage").style.display="block";
			}

			selectState[n].onmouseout=function() {
				document.getElementById("formDivId").style.display="block";
				document.getElementById("formImage").style.display="none";
			}
		}
	}
}
if((BrowserDetect.browser =="Explorer") && (BrowserDetect.version=="6")){
if (window.attachEvent) window.attachEvent("onload", selectToggle);
}
//Javascript for todays date +1 for Booking Component//

//set todays date
Now = new Date();
NowDay = Now.getDate();
NowMonth = Now.getMonth();
NowYear = Now.getYear();
if (NowYear < 2000) NowYear += 1900; //for Netscape

// set tomorrows date
var tomorrow = new Date(Now.getTime() + (1 * 86400000));
tDay = tomorrow.getDate();
tMonth = tomorrow.getMonth();
tYear = tomorrow.getYear();
if (tYear < 2000) tYear += 1900; //for Netscape

//function for returning how many days there are in a month including leap years
function DaysInMonth(WhichMonth, WhichYear)
{
var DaysInMonth = 31;
if (WhichMonth == "Apr" || WhichMonth == "Jun" || WhichMonth == "Sep"
|| WhichMonth ==
"Nov") DaysInMonth = 30;
if (WhichMonth == "Feb" && (WhichYear/4) != Math.floor(WhichYear/4))
DaysInMonth = 28;
if (WhichMonth == "Feb" && (WhichYear/4) == Math.floor(WhichYear/4))
DaysInMonth = 29;
return DaysInMonth;
}

//function to change the available days in a months
function ChangeOptionDays(Which)
{
DaysObject = eval("document.idForm." + Which + "day");
MonthObject = eval("document.idForm." + Which + "month");
YearObject = eval("document.idForm." + Which + "year");

Month = MonthObject[MonthObject.selectedIndex].text;
Year = YearObject[YearObject.selectedIndex].text;

DaysForThisSelection = DaysInMonth(Month, Year);
CurrentDaysInSelection = DaysObject.length;
if (CurrentDaysInSelection > DaysForThisSelection)
{
for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
{
DaysObject.options[DaysObject.options.length - 1] = null
}
}
if (DaysForThisSelection > CurrentDaysInSelection)
{
for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
{
NewOption = new Option(DaysObject.options.length + 1);
DaysObject.options.add(NewOption);
}
}
if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
}

//function to set options to tomorrow
function SetToToday(Which)
{
DaysObject = eval("document.idForm." + Which + "day");
MonthObject = eval("document.idForm." + Which + "month");
YearObject = eval("document.idForm." + Which + "year");

YearObject[0].selected = true;
MonthObject[tMonth].selected = true;
ChangeOptionDays(Which);
DaysObject[tDay-1].selected = true;
}

//function to write option years plus x
function WriteYearOptions(YearsAhead)
{
line = "";
for (i=0; i<YearsAhead; i++)
{
line += "<OPTION>";
line += NowYear + i;
line += "</OPTION>";
}
return line;
}

// End Javascript for todays date +1 for booking component


//start booking component javascript for new synxis booking engine//


function dateChange(){
  var newmonth = document.getElementById('month')[document.getElementById('month').selectedIndex].value;
  var newday = document.idForm.fromday[document.idForm.fromday.selectedIndex].text;;
  var newyear =  document.idForm.fromyear[document.idForm.fromyear.selectedIndex].text;
	   
  document.getElementById("Arrive").value = newmonth +"/"+ newday + "/" +newyear;
 }


