//Begin Global Functions
if(document.images) {
	pic1a = new Image(60,34);
	pic1a.src = "/img/topNav-homeOff.gif";
	pic1b = new Image(60,34);
	pic1b.src = "/img/topNav-homeOver.gif";
	pic1c = new Image(60,34);
	pic1c.src = "/img/topNav-homeOn.gif";

	pic2a = new Image(81,34);
	pic2a.src = "/img/topNav-activitiesOff.gif";
	pic2b = new Image(81,34);
	pic2b.src = "/img/topNav-activitiesOver.gif";
	pic2c = new Image(81,34);
	pic2c.src = "/img/topNav-activitiesOn.gif";

	pic4a = new Image(133,34);
	pic4a.src = "/img/topNav-passportsOff.gif";
	pic4b = new Image(133,34);
	pic4b.src = "/img/topNav-passportsOver.gif";
	pic4c = new Image(133,34);
	pic4c.src = "/img/topNav-passportsOn.gif";

	pic5a = new Image(111,34);
	pic5a.src = "/img/topNav-productsOff.gif";
	pic5b = new Image(111,34);
	pic5b.src = "/img/topNav-productsOver.gif";
	pic5c = new Image(111,34);
	pic5c.src = "/img/topNav-productsOn.gif";

	pic6a = new Image(82,34);
	pic6a.src = "/img/topNav-aboutOff.gif";
	pic6b = new Image(82,34);
	pic6b.src = "/img/topNav-aboutOver.gif";
	pic6c = new Image(82,34);
	pic6c.src = "/img/topNav-aboutOn.gif";
}
function getElement(psID) {
	if(document.all) {
		return document.all[psID];
	} else if(document.getElementById) {
		return document.getElementById(psID);
	} else {
		for (iLayer = 1; iLayer < document.layers.length; iLayer++) {
			if(document.layers[iLayer].id == psID)
			return document.layers[iLayer];
		}
	}
	return null;
}
function getSection() {
	if(topNavSection == "Activities") {
		getElement("navAct").className = "navOn";
	} else if(topNavSection == "Passports & Visas") {
		getElement("navPas").className = "navOn";
	} else if(topNavSection == "ARC Products") {
		getElement("navPrd").className = "navOn";
	} else if(topNavSection == "About Us") {
		getElement("navAbt").className = "navOn";
	} else if(topNavSection == "None") {
	} else {
		getElement("navHom").className = "navOn";
	}
}
function calcPopPosition(whichDiv) {
	var browser, popTop1, popTop2, popLef1, popLef2;
	if(navigator.appName.indexOf('Microsoft') != -1) {
		browser = 'IE';
	} else if(navigator.appName.indexOf('Netscape') != -1) {
		browser = 'Netscape'
	} else {
		browser = 'IE';
	}
	if(browser == 'IE') {
		popTop1 = document.documentElement.clientHeight - getElement(whichDiv).clientHeight;
		popTop2 = popTop1 / 2;
		popLef1 = document.documentElement.clientWidth - getElement(whichDiv).clientWidth;
		popLef2 = popLef1 / 2;
	} else {
		popTop1 = window.innerHeight - getElement(whichDiv).clientHeight;
		popTop2 = popTop1 / 2;
		popLef1 = window.innerWidth - getElement(whichDiv).clientWidth;
		popLef2 = popLef1 / 2;
	}
	getElement(whichDiv).style.top = popTop2 + "px";
	getElement(whichDiv).style.left = popLef2 + "px";
}
function toggleDisplay(whichLayer) {
	if(getElement(whichLayer).style.display == "") {
		getElement(whichLayer).style.display = "none";
	} else {
		getElement(whichLayer).style.display = "";
	}
}
function urlParams(name) {
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	if(results == null ) { return ""; }
	else { return results[1]; }
}
function setCookie(name,value,expY,expM,expD,path,domain) {
	var expires = new Date (expY, expM, expD);
	var cookieStr = name + "=" + escape(value) + "; expires=" + expires.toGMTString() + "; path=" + escape (path) + "; domain=" + escape (domain);
	document.cookie = cookieStr;
}
function getCookie(name) {
	if(document.cookie.length>0) {
		c_start=document.cookie.indexOf(name + "=");
		if(c_start!=-1) {
			c_start=c_start + 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 "";
}
function delCookie(name,value) {
	var cookie_date = new Date("2008","01","01");
	document.cookie = name + "=" + value + "; expires=" + cookie_date.toGMTString() + "; path=" + escape ("/") + "; domain=" + escape ("arcmarketplace.com");
}
var comFrmUrl;
if(window.location.port == "83") {
	comFrmUrl = "http://devwww.arcmarketplace.com:83/";
} else {
	comFrmUrl = "http://www.arcmarketplace.com/";
}
//End Global Functions

//Begin Homepage Search Boxes and Ads
function searchSite2(prod) {
	if(prod == 2) {
		getElement('searchBarTop').style.backgroundImage = "url(/img/tabCars_top.png)";
		getElement('viator').style.display = "none";
		getElement('bus').style.display = "none";
		getElement('cartrawler').style.display = "";
	} else if(prod == 1) {
		getElement('searchBarTop').style.backgroundImage = "url(/img/tabBus_top.png)";
		getElement('viator').style.display = "none";
		getElement('bus').style.display = "";
		getElement('cartrawler').style.display = "none";
	} else {
		getElement('searchBarTop').style.backgroundImage = "url(/img/tabActivities_top.png)";
		getElement('viator').style.display = "";
		getElement('bus').style.display = "none";
		getElement('cartrawler').style.display = "none";
	}
}

var marqee = 0;
var featOn = 0;
var featAff = 0;

function rotate() {
	if(marqee == 0) {
		getElement('featProd').innerHTML = '<img src="/img/marqueeEurope.jpg" width="343" height="347" border="0" alt="Europe" title="Europe" usemap="#MYMAP"/>';
		marqee = 1;
	} else if(marqee == 1) {
		getElement('featProd').innerHTML = '<img src="/img/marqueeCruise.jpg" width="343" height="347" border="0" alt="Commissionable Shore Excursions" title="Commissionable Shore Excursions" usemap="#CommMap"/>';
		marqee = 2;
	} else if(marqee == 2) {
		getElement('featProd').innerHTML = '<img src="/img/marqueeRivertour.jpg" width="343" height="347" border="0" alt="River Tours" title="River Tours" usemap="#RIVERMAP"/>';
		marqee = 3;
	} else if(marqee == 3) {
		getElement('featProd').innerHTML = '<a href="https://www.cartrawler.com/microsites/arc/"><img src="/img/marqueeCar.jpg" width="343" height="347" border="0" alt="Book a car today" title="Book a car today"/></a>';
		marqee = 0;
	}
	setTimeout("rotate()", 5000);
}

/* not used now, add images again when using
function showAd(){
	if(featOn == 0) {
		getElement('smallAd').innerHTML = '<a href="http://www.arcmarketplace.com/index.html"><img src="/img/trans.gif" border="0" alt="altHere" title="altHere" /></a>';
		featOn = 1;
	} else if(featOn == 1) {
		getElement('smallAd').innerHTML = '<a href="http://www.arcmarketplace.com/index.html"><img src="/img/trans.gif" border="0" alt="altHere" title="altHere" /></a>';
		featOn = 0;

	}
	setTimeout("showAd()", 10000);
}
*/
//End Homepage Search Boxes and Ads

// Begin Homepage Activities Search
function validateActvForm() {
	if(getElement("Barc").checked == false && getElement("Lond").checked == false && getElement("NewY").checked == false && getElement("Rome").checked == false && getElement("FLau").checked == false && getElement("LosA").checked == false && getElement("Orla").checked == false && getElement("SanF").checked == false && getElement("LasV").checked == false && getElement("Miam").checked == false && getElement("Pars").checked == false && getElement("Vien").checked == false && getElement("Othr").checked == false) {
		getElement("altPop").innerHTML = "Please select a city to learn about activities there.";
		getElement("altDiv").style.display = "";
		calcPopPosition("altDiv");
		return false;
	} else if(getElement("Othr").checked == true && (getElement("freeTextKeyword").value == "" || getElement("freeTextKeyword").value == null || getElement("freeTextKeyword").value == undefined)) {
		getElement("altPop").innerHTML = "Please enter the name of the other location to learn about activities there.";
		getElement("altDiv").style.display = "";
		calcPopPosition("altDiv");
		return false;
	} else {
		getCity();
		return false;
	}
}
function goIssue(page) {
	location.href = page;
}
function stringFilter (keyword) {
	filteredValues = "+/?%&#"; // Characters stripped out
	var i;
	var returnString = "";
	for (i = 0; i < keyword.length; i++) { // Search through string and append to unfiltered values to returnString.
		var c = keyword.charAt(i);
		if(filteredValues.indexOf(c) == -1)
			returnString += c;
	}
	return returnString;
}
function stripSpaces(keyword) {
	if(keyword.indexOf(" ") >= 0) {
		var keywords = keyword.split(" ");
		keyword = "";
		for (i=0; i<keywords.length; i++) {
			if(keywords[i] != "") {
				if(keyword == "") {
					keyword = keywords[i];
				} else {
					keyword += " " + keywords[i];
				}
			}
		}
	}
	return keyword;
}
function rewriteFreetxtUrl(keyword) {
	var newUrl = "webtrends.jsp?link=HPActivitiesOther" + keyword;
	goIssue(newUrl);
}
var srchCity = new Array("ABU+DHABI","ACAPULCO","ADELAIDE","ALASKA","ALBERTA","ALICE+SPRINGS","ALSACE","AMSTERDAM","ANAHEIM+&+BUENA+PARK","ANDALUCIA+&+COSTA+DEL+SOL","ANGKOR+WAT","ANGUILLA","ANKARA","ANTALYA","ANTIGUA+AND+BARBUDA","ANTWERP+&+BRUGES","AQUITAINE","ARCTIC+FINLAND+&+LAPLAND","ARGENTINA","ARIZONA","ARUBA","ASIA","ASWAN","ATHENS","ATLANTA","AUCKLAND","AUSTRALIA","AUSTRALIA+&+THE+PACIFIC","AUSTRIA","AVIGNON","AYERS+ROCK","BAHAMAS","BALEARIC+ISLANDS","BALI","BANFF","BANGKOK","BARBADOS","BARCELONA","BASQUE+COUNTRY","BAY+OF+ISLANDS","BEIJING","BELFAST","BELGIUM","BELIZE","BERLIN","BIG+ISLAND+OF+HAWAII","BOLOGNA","BORDEAUX","BOSTON","BOTSWANA","BRAZIL","BRISBANE","BRITISH+COLUMBIA","BRITISH+VIRGIN+ISLANDS","BROOME","BRUSSELS","BUDAPEST","BULGARIA","BURGUNDY+&+DIJON","CAIRNS+&+THE+TROPICAL+NORTH","CAIRO","CALGARY","CALIFORNIA","CAMBODIA","CANADA","CANARY+ISLANDS","CANBERRA","CANCUN","CANNES","CAPE+TOWN","CARIBBEAN","CAYMAN+ISLANDS","CENTRAL+&+SOUTH+AMERICA","CENTRAL+VIETNAM","CHAMPAGNE","CHENGDU","CHIANG+MAI+&+CHIANG+RAI","CHICAGO","CHILE","CHINA","CHRISTCHURCH","COLORADO","COPENHAGEN","COSTA+BLANCA","COSTA+BRAVA","COSTA+DEL+SOL","COSTA+RICA","COZUMEL","CROATIA","CURACAO","CYPRUS","CZECH+REPUBLIC","DARWIN","DENMARK","DOMINICA","DOMINICAN+REPUBLIC","DUBAI","DUBLIN","DUNEDIN+&+THE+OTAGO+PENINSULA","DURBAN","EASTER+ISLAND","ECUADOR","EDINBURGH","EGYPT","ENGLAND","EUROPE","FIJI","FINLAND","FIORDLAND+&+MILFORD+SOUND","FLORENCE","FLORIDA","FORT+LAUDERDALE","FORTALEZA","FRANCE","FRANKFURT","FRANZ+JOSEF+&+FOX+GLACIER","FRASER+ISLAND","FREEPORT","FRENCH+RIVIERA","GENEVA","GENOA","GEORGIA","GERMANY","GLASGOW","GOLD+COAST","GRAN+CANARIA","GRANADA","GRAND+CANYON+NATIONAL+PARK","GRAZ","GREECE","GUATEMALA","GUILIN","HAMBURG","HANOI","HAWAII","HELSINKI","HO+CHI+MINH+CITY","HOBART","HONG+KONG","HUNGARY","HURGHADA","ICELAND","INDIA","INDONESIA","IRELAND","ISLANDS+OF+PORTUGAL","ISTANBUL","ITALY","IZMIR","JAMAICA","JAPAN","JAVA","JOHANNESBURG","JORDAN","KAUAI","KENYA","KEY+WEST","KOH+SAMUI","KRABI","KRAKOW","KRUGER+NATIONAL+PARK","KUALA+LUMPUR","KUSADASI","KYOTO","LA+CORUNA","LA+FORTUNA","LAKE+DISTRICT","LAKE+TAHOE","LANGKAWI","LANGUEDOC-ROUSSILLON","LAS+VEGAS","LAUSANNE+&+LAKE+GENEVA","LILLE","LISBON","LITHUANIA","LOIRE+VALLEY","LONDON","LOS+ANGELES","LOS+CABOS","LUCERNE","LUXOR","LYON","MADRID","MALAYSIA","MALTA","MARSEILLE","MARYLAND","MAUI","MELBOURNE","MEMPHIS","MEXICO","MEXICO+CITY","MIAMI","MIDDLE+EAST+&+AFRICA","MILAN","MINNEAPOLIS-ST.+PAUL","MONTEGO+BAY","MONTREAL","MOROCCO","MOUNT+COOK","MUNICH","NAMIBIA","NAPLES","NASHVILLE","NASSAU","NATAL","NEGRIL","NEPAL","NETHERLANDS","NEW+DELHI","NEW+ORLEANS","NEW+SOUTH+WALES","NEW+YORK+CITY","NEW+ZEALAND","NIAGARA+FALLS+&+AROUND","NICE","NOOSA+&+SUNSHINE+COAST","NORMANDY","NORTH+AMERICA","NORTH+CHILE","NORTH+ISLAND","NORTHERN+TERRITORY","NORWAY","NOVA+SCOTIA","OAHU","OCHO+RIOS","OMAN","ONTARIO","ORLANDO","OSAKA","OTTAWA","PALM+COVE","PALM+SPRINGS","PANAMA","PARIS","PATAGONIA","PATTAYA","PENANG","PENNSYLVANIA","PERTH","PHOENIX","PHUKET","PIEDMONT+&+LIGURIA","PISA","POLAND","PORT+DOUGLAS","PORT+ELIZABETH","PORTO+&+NORTHERN+PORTUGAL","PORTUGAL","PRAGUE","PROVENCE","PUERTO+PLATA","PUERTO+RICO","PUERTO+VALLARTA","PUNTA+CANA","QINGDAO","QUEBEC","QUEBEC+CITY","QUEENSLAND","QUEENSTOWN","QUITO","RHINE+RIVER","RIO+DE+JANEIRO","RIVIERA+MAYA+&+THE+YUCATAN","ROMANIA","ROME","ROTORUA","RUSSIA","SABAH+AND+SARAWAK","SALVADOR+DA+BAHIA","SALZBURG","SAN+DIEGO","SAN+FRANCISCO","SAN+JOSE","SANTIAGO","SANTIAGO+DE+COMPOSTELA","SCOTLAND","SEATTLE","SEDONA+&+FLAGSTAFF","SEVILLE","SHANGHAI","SHARM+EL+SHEIKH","SICILY","SINGAPORE","SLOVAKIA","SLOVENIA","SOUTH+AFRICA","SOUTH+AUSTRALIA","SOUTH+CAROLINA","SOUTH+ISLAND","SPAIN","SRI+LANKA","ST+AUGUSTINE","ST+KITTS+-+NEVIS","ST+LUCIA","ST+MAARTEN","SWEDEN","SWITZERLAND","SYDNEY","TAHITI","TAIWAN","TAMPA","TASMANIA","TENNESSEE","TEXAS","THAILAND","THE+ALGARVE","THE+NORTH+OF+ENGLAND","THE+SCOTTISH+HIGHLANDS","THE+WHITSUNDAYS+&+HAMILTON+ISLAND","TOKYO","TORONTO","TOULOUSE","TRELAWNY","TRINIDAD+AND+TOBAGO","TUCSON","TURIN","TURKEY","TUSCANY","UKRAINE","UNITED+ARAB+EMIRATES","USA","UTAH","VALENCIA","VANCOUVER","VENETO+AND+VENICE","VENICE","VERSAILLES","VICTORIA","VICTORIA","VIENNA","VIETNAM","VIRGIN+ISLANDS-US","WANAKA","WARSAW","WASHINGTON","WASHINGTON+DC","WELLINGTON","WESTERN+AUSTRALIA","WHISTLER","XIAN","ZAMBIA","ZURICH");
function getCity() {
	var city;
	var pick;
	for (var i=0; i<document.KeywordOnlySearchForm.viatorSearch.length; i++) {
		if(document.KeywordOnlySearchForm.viatorSearch[i].checked) {
			city = document.KeywordOnlySearchForm.viatorSearch[i].value;
		}
	}
	switch (city) {
		case "Barcelona":
			goIssue("webtrends.jsp?link=HPActivitiesBarcelona");
			break;
		case "London":
			goIssue("webtrends.jsp?link=HPActivitiesLondon");
			break;
		case "New York City":
			goIssue("webtrends.jsp?link=HPActivitiesNewYorkCity");
			break;
		case "Rome":
			goIssue("webtrends.jsp?link=HPActivitiesRome");
			break;
		case "Fort Lauderdale":
			goIssue("webtrends.jsp?link=HPActivitiesFortLauderdale");
			break;
		case "Los Angeles":
			goIssue("webtrends.jsp?link=HPActivitiesLosAngeles");
			break;
		case "Orlando":
			goIssue("webtrends.jsp?link=HPActivitiesOrlando");
			break;
		case "San Francisco":
			goIssue("webtrends.jsp?link=HPActivitiesSanFrancisco");
			break;
		case "Las Vegas":
			goIssue("webtrends.jsp?link=HPActivitiesLasVegas");
			break;
		case "Miami":
			goIssue("webtrends.jsp?link=HPActivitiesMiami");
			break;
		case "Paris":
			goIssue("webtrends.jsp?link=HPActivitiesParis");
			break;
		case "Vienna":
			goIssue("webtrends.jsp?link=HPActivitiesVienna");
			break;
		case "Other":
			var vother = getElement('freeTextKeyword').value;
			vpos = vother.lastIndexOf("");
			if(vother != "" && vpos > 1) {
				var temp = vother.toUpperCase();
				var tempv = temp.replace(/ /g,"+");
				var newCity;
				var statCity = false;
				for(i=0;i<srchCity.length;i++) {
					if(tempv == srchCity[i]) {
						statCity = true;
						var newCity = "webtrends.jsp?link=HPActivitiesOther" + tempv;
						goIssue(newCity);
					}
				}
				if(statCity == false) {
					var temp=getElement('freeTextKeyword').value;
					temp=stringFilter(temp);
					temp=temp.replace(/^\s+/,'');
					temp=temp.replace(/\s+$/,'');
					temp=temp.replace('mount.','mount');
					temp=temp.replace('mt.','mt');
					temp=temp.replace('st.','st');
					temp=temp.replace('ste.','ste');
					temp=temp.replace('sts.','sts');
					temp = stripSpaces(temp);
					rewriteFreetxtUrl(temp);
					return false;
				}
			} else {
				getElement("altPop").innerHTML = "Please indicate a specific location and click \'Search\' to view your results.";
				getElement("altDiv").style.display = "";
				calcPopPosition("altDiv");
			}
			break;
	}
}
//End Homepage Activities Search

//Begin Affiliate Cookie Functions
function cookieMssg() {
	errorMsg = '' +
		'<p>We have been unable to detect the cookies necessary to proceed. Please make sure cookies are enabled, and that you accept all cookies from arcmarketplace.com.</p>' +
		'<p>In a few seconds, you will be redirected back to the Affiliate Program page. <span style="cursor:pointer;text-decoration:underline;" onClick="returnHome();">Click here to go there immediately.</span></p>' +
	'';
	getElement("altPop").innerHTML = errorMsg;
	getElement("altDiv").style.display = "";
	calcPopPosition("altDiv");

	setTimeout("returnHome()", 15000);
}
function returnHome() {
	if(opener) {
		opener.location.href = "affiliate.jsp";
		window.close();
		window.opener.focus();
	} else {
		window.location.replace("affiliate.jsp");
	}
}
//End Affiliate Cookie Functions

function showHide(blk) {
	var blkDiv = getElement(blk);
	if(blkDiv.className != "faqA") {
		blkDiv.className = "faqA";
	} else {
		blkDiv.className = "faqA_hidden";
	}
}
function issueNum() {
	for (i=0; i<getElement('issue').length; i++) {
		if(location.href.indexOf(document.frmIssue.issue[i].value) > 0) {
			getElement('issue').selectedIndex = i;
		}
	}
}
function zxcPos(zxcobj){
	zxclft=zxcobj.offsetLeft;
	zxctop=zxcobj.offsetTop;
	while(zxcobj.offsetParent!=null) {
		zxcpar=zxcobj.offsetParent;
		zxclft+=zxcpar.offsetLeft;
		zxctop+=zxcpar.offsetTop;
		zxcobj=zxcpar;
	}
	return [zxclft,zxctop];
}
function dspID(dspdiv,elID) {
	var Element = eval("getElement('"+ dspdiv + "')");
	var Temp = eval("getElement('"+ elID + "')");
	Element.style.right=(zxcPos(Temp)[0]-275)+'px';
	Element.style.top=(zxcPos(Temp)[1]+25)+'px';
	Element.style.display='block';
}
function nodspID(dDiv) {
	var Temp = eval("getElement('"+ dDiv + "')");
			Temp.style.display='none';
}

//Copyright 2006,2007 Bontrager Connection, LLC
// http://bontragerconnection.com/ and http://www.willmaster.com/
// Version: July 28, 2007

var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
	if(self.pageYOffset) {
		rX = self.pageXOffset;
		rY = self.pageYOffset;
	}
	else if(document.documentElement && document.documentElement.scrollTop) {
		rX = document.documentElement.scrollLeft;
		rY = document.documentElement.scrollTop;
	}
	else if(document.body) {
		rX = document.body.scrollLeft;
		rY = document.body.scrollTop;
	}
	if(document.all) {
		cX += rX;
		cY += rY;
	}
	d.style.left = (cX+10) + "px";
	d.style.top = (cY+10) + "px";
}

function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	dd.style.display = "block";
}
function ReverseContentDisplay(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	if(dd.style.display == "none") { dd.style.display = "block"; }
	else { dd.style.display = "none"; }
}
