<!--
var LOOP_SPEED = 2000; //milli-secs
var NUM_PASSES = 3; //num times to loop thru advertisers
var passNumber = 0;
var currentPOI = -1;	//default to before beginning index of array
var showingList = false;	//flag to indicate whether menu is showing
var timeoutId = null;
var anotherId = null;
var optionSelected = false;

// create nearest advertiser list
var pointsOfInterest = new Array();
pointsOfInterest[pointsOfInterest.length] =
	"<a href=\"javascript:void(selectOption('ANZ'," + pointsOfInterest.length + "))\">" +
	"<img src='/images/logo_near_anz.gif' width='16' height='16'/> <span class='POIText'>ANZ ATM</span></a>";
pointsOfInterest[pointsOfInterest.length] =
	"<a href=\"javascript:void(selectOption('Car Park'," + pointsOfInterest.length + "))\">" +
	"<img src='/images/logo_near_parking.gif' width='16' height='16'/> <span class='POIText'>Secure Parking</span></a>";
pointsOfInterest[pointsOfInterest.length] =
	"<a href=\"javascript:void(selectOption('Intel'," + pointsOfInterest.length + "))\">" +
	"<img src='/images/logo_near_wifi.gif' width='16' height='16'/> <span class='POIText'>WiFi hotspot</span></a>";


// Set browser to execute loadPage() onload
window.onload=function(){
	loadPage();
}

function loadPage() {
	// call this in onload in the body tag
	setPOIDisplay();
	setPOIList();
}

function selectOption(optVal,optPos) {
	// set hidden value for selected option
	document.getElementById("hiddenAdvId").value = optVal;
	optionSelected = true;
	// display selected option as current
	document.getElementById("POIDisplay").innerHTML = pointsOfInterest[optPos];

	hidePOIList();
}

function setPOIList() {
	//sets up all options in the menu
	var allMenuItems = "";
	for (var i = 0; i < pointsOfInterest.length; i++) {
		allMenuItems += "<div class='POI'>" + pointsOfInterest[i] + "</div>";
	}
	document.getElementById("POIList").innerHTML = allMenuItems;

}

function setPOIDisplay() {
	if (!showingList  && (passNumber < NUM_PASSES)) {

		if ((++currentPOI) == pointsOfInterest.length) {
			currentPOI = 0;	//reset counter
			passNumber++;
		}

		document.getElementById("POIDisplay").innerHTML = pointsOfInterest[currentPOI];
		timeoutId = window.setTimeout("setPOIDisplay()", LOOP_SPEED);

	}
	else {
		window.clearTimeout(timeoutId);
		window.clearTimeout(anotherId);
		resetDisplay()
	}

}

function showPOIList() {
	window.clearTimeout(anotherId);
	window.clearTimeout(timeoutId);

	if (!showingList)
	{
	    if (!optionSelected)
        {
	        resetDisplay()
        }
	    document.getElementById("POIList").style.display = "block";
	    showingList = true;
	}
	else
	{
	    hidePOIList();
	}
}

function hidePOIList() {
	if (showingList) {	//so that this doesn't fire twice at the same time
		document.getElementById("POIList").style.display = "none";
		showingList = false;

		if(!optionSelected) {
			anotherId = window.setTimeout("setPOIDisplay()", LOOP_SPEED);
		}
	}
}

function resetDisplay() {
    document.getElementById("POIDisplay").innerHTML = "<span class='selectText'>Please Select -></span>";
}

function debug(elementId, eventType) {
	var debugDiv = document.getElementById("eventDebugger");
	var currentHtml = debugDiv.innerHTML;
	debugDiv.innerHTML = currentHtml + elementId + ", " + eventType + "<br>";
}
//-->