	
	var NO_VALUE_SET = 9999;
	
	// Globals
	var nACTIVEZoomRegion = NO_VALUE_SET; // no zoom region visible
	var nACTIVESector = NO_VALUE_SET;
	var sACTIVESectorType = "";
	var arrACTIVEZoomablePins = [];
	var nACTIVELastNonLinkedPin = NO_VALUE_SET;
	var bACTIVEisTouchDevice = false;
	var nACTIVELastVisiblePinID = NO_VALUE_SET;
	var bACTIVESectorLoading = false;
	
	$(document).ready(function(){
		// nNUMPOINTS = 10; // DEBUG @@@
		
		initMap();
		
		// showSector(3); DEBUG @@@
		setTimeout(startMap, 1500);
		
	});
	
	function initMap() {
		
		// set up the user events for each point - hover, click, focus
		for (i=0;i<nNUMPOINTS;i++) {
			$("#p"+i).mouseenter(function(e)	{ 
											var x = Number($(this).css("left").replace("px", ""));
											var y = Number($(this).css("top").replace("px", ""));
									 		showLocationData($(this).attr("id"), x, y, true); 
											// console_Log("Enter " + $(this).attr("id") + " " + x + " - " + y);
										});
			$("#p"+i).focus(function(e)	{ 
											var x = Number($(this).css("left").replace("px", ""));
											var y = Number($(this).css("top").replace("px", "")); 
									 		showLocationData($(this).attr("id"), x, y, true); 
										});
			$("#p"+i).mouseleave(function()	{ 
											// $(this).animate({top:'+=12'}, 80);
									 		closeLocationData(); 
										});
			$("#p"+i).click(function() { 
									if ($(this).attr("href") == "#") { 
										var x = Number($(this).css("left").replace("px", ""));
										var y = Number($(this).css("top").replace("px", ""));
										showLocationData($(this).attr("id"), x, y, false); 
										return false;
									} 
							} );
		}
		
		// set up classes/behaviour for touch devices
		bACTIVEisTouchDevice = isTouchDevice();
		if (bACTIVEisTouchDevice) $("#locationMap").addClass("is-touchdevice");
		
		// set up the zoom regions
		$(".zoomRegion").map(function(){initZoomRegion(this.id, "")});
		$(".mask").click(function(){ arrangeZoomRegion(false, "zoom" + nACTIVEZoomRegion); return false;});
		
		// set up selector panel actions
		$("#sectorSelection a").click(function(){ $("#sectorSelection a").removeClass("active"); $(this).addClass("active"); showSector(this.id.substr(6,3)); if (bCollapseSelectorOnClick) toggleSectorSelector(); return false; });
		$("#sectorSelection .heading").click(function(){ toggleSectorSelector(); });
		
		// zoom on/Off
		$("#zoomOnOff").click(function(){ hideZoomRegions(!$(this).hasClass("inActive"), false); });

	}
	
	function startMap() {
		showSector(0);
		if (bCollapseSelectorOnStart)
			toggleSectorSelector();
	}
	

	
	function showSector(nSelectorID) {
		
		if (!(Number(nSelectorID) >= 0))
			nSelectorID = 0;
		
		if (bACTIVESectorLoading) {
			// user has interrupted the pins loading
			alertMsg("Please wait.... the locations are loading", 1500);
			
			// reset the highlighted sector item to the correct value
			$("#sectorSelection a").removeClass("active");
			if (sACTIVESectorType.length > 1)
				$("#sectorSelection a.S-" + sACTIVESectorType).addClass("active");
			else
				$("#sectorSelection a:first").addClass("active");
			
		}
		else {
			bACTIVESectorLoading = true;
			
			var sSectorClass = sector[nSelectorID][2];
			var nAnimationDelay = sector[nSelectorID][3]; // time between pins dropping
			var nPinDropSpeed = sector[nSelectorID][4]; // time for a pin to drop to the map

			hideZoomRegions(true, true); // hide all the active zoom regions while the pins are loading
			
			nACTIVESector = nSelectorID;
			sACTIVESectorType = sSectorClass;
			
			dropThePins(sSectorClass, true, nAnimationDelay, nPinDropSpeed); 
			setSectorText(nSelectorID); 
			
		}
	}
	
	function toggleSectorSelector() {
		
		var nHeadingHeight = Number($("#sectorSelection .heading").css("height").replace("px", "")) + 17;
		
		if ($("#sectorSelection .sector:visible").length > 0) {
			$("#sectorSelection .sector").hide();
			$("#sectorSelection").animate({height:nHeadingHeight});
			$("#sectorSelection .heading").css("border-bottom", "none")
		} else {
			$("#sectorSelection .sector").show();
			$("#sectorSelection").animate({height:"275px"});
			$("#sectorSelection .heading").attr("style", " ");
		}
		
	}
	
	function dropThePins(sPinType, bReset, nDelay, nPinDropSpeed) {
		
		if (bReset) {
			// move all the pins out of the way
			$(".point").css({top:"-60px"});
			$(".point-shadow").hide();
		}
	
		if (nDelay > 0) { // it's not null
		}
		else
			nDelay = 40;
		
		if (sPinType.length > 0)
			sPinType = "." + sPinType
		
		// find the id of the last pin
		nACTIVELastVisiblePinID = Number($("#locations .point"+sPinType+":last")[0].id.substr(1));
		
		// set up the animations
		for (i=0;i<nNUMPOINTS;i++) {
			showPin(i, sPinType, true, nDelay, nPinDropSpeed);
		}
	}

	function showPin(nPinID, sPinType, bShow, nDelay, nPinDropSpeed) {
		var sSelector, sLandingPtY;
		
		sSelector = "#p" + nPinID + sPinType;
		sLandingPtY = locPt[nPinID][2] + "px";

		if ($(sSelector).length > 0) { // a pin exists that matches this id and class
			if (bShow) {
					// drop the pin using animation - drop the pin, then bob the pin head...
					$(sSelector).delay(nPinID*nDelay).animate({top:sLandingPtY}, nPinDropSpeed, 
								function(){	
											showShadow(this.id, true);
											$(this).find("span.pintop").animate( 	{top:'+=11'}, 
																			80, 
																			function()	{	$(this).animate( 	{top:'-=11'}, 80,
																								function(){ 
																									$(this).attr("style", " ");
																									onPinLoaded($(this).parent()[0].id);
																									}
																							 );
																						}
																		)}
							);

			} else {
				$(sSelector).hide();
			}
		}
		
	}


	function onPinLoaded(sPinID) {
		console_Log("loaded - " + sPinID);
		// check if this is the last pin to be loaded
		if (Number(sPinID.substr(1)) == nACTIVELastVisiblePinID) {
			console_Log("LAST PIN - " + sPinID);
			bACTIVESectorLoading = false;
			
			// show only the zoom regions for the current sector
			hideZoomRegions(false, false);
			
			// close the alert if it's still open during loading
			closeAlertMsg();	
		}
	}


	function initZoomRegion(sZoomIdAttr, sPinType) {
		
		// extract the zoomRegion number from the ID
		var nZoomID = Number(sZoomIdAttr.substr(4, 10));


		// look up values in the zoomRegion aray
		sLeft = zoomRegion[nZoomID][nZM_X] + "px"; 
		sTop = zoomRegion[nZoomID][nZM_Y] + "px"; 
		sWidth = zoomRegion[nZoomID][nZM_WIDTH] + "px"; 
		sHeight = zoomRegion[nZoomID][nZM_HEIGHT] + "px"; 
		
		$("#" + sZoomIdAttr).css({left:sLeft, top:sTop, width:sWidth, height:sHeight});
		if (_isIE6) {
			// IE6 has the entire zoom region enabled for _both_ open and close...
			$("#" + sZoomIdAttr).click(function(){
										arrangeZoomRegion(!$(this).hasClass("active"), this.id);
										return false;
									});
		} else {
			// all other browsers enable the zoom region for opening, and just the close button for closing
			$("#" + sZoomIdAttr).click(function(){
										if ( !$(this).hasClass("active") ) {
											// open the zoom region
											arrangeZoomRegion(true, this.id);
										}
										return false;
									});
			
			$("#" + sZoomIdAttr + " .close").click(function(){
								// close the zoom region
								arrangeZoomRegion(false, "zoom" + nACTIVEZoomRegion);
								return false;
							});
		}

	}
	
	
	function showShadow(sPointID, bShow) {
		
		var nID = Number(sPointID.substr(1, 5));
		
		if (bShow) {
			// $("#p" + nID + "Shadow").css({display:"block"});
			$("#p" + nID + "Shadow").show();
		} else
			$("#p" + nID + "Shadow").hide();
		
	}
	
	function arrangeZoomRegion(bExpandPins, sZoomIdAttr) {

		var nPinID, sPinType;

		var nZoomID = Number(sZoomIdAttr.substr(4, 10));
		var nALLOW_WIDTH_PER_PIN = 32;

		if (nACTIVEZoomRegion != nZoomID) {
			// close any other active zoom regions
			if (nACTIVEZoomRegion != NO_VALUE_SET) {
				arrangeZoomRegion(false, "zoom" + nACTIVEZoomRegion);
			} 
			nACTIVEZoomRegion = nZoomID;
		}
		
		if (bExpandPins)
			$("#" + sZoomIdAttr).addClass("active");
		else
			$("#" + sZoomIdAttr).removeClass("active");
		
		// open the zoom region wide enough to display all the pins in a horizontal line
		
		// get the number of pins within this region (for all sectors)
		var nNumAvailPins = zoomRegion[nZoomID][nZM_NUMPOINTS];
		var nCurrentPinsVisible = 0;
		
		// cheack each pin and see if it matches the current sector class
		if (sACTIVESectorType == "") {
			nCurrentPinsVisible = nNumAvailPins;
			// clear the array
			// console_Log("arrACTIVEZoomablePins.length = " + arrACTIVEZoomablePins.length);
			for (i=0;i<arrACTIVEZoomablePins.length;i++)
				arrACTIVEZoomablePins[i] = "";
			
			for (i=0;i<nNumAvailPins;i++)
				arrACTIVEZoomablePins[i] = zoomRegion[nZoomID][nZM_POINTSLIST][i];
		} else {
			for (i=0;i<nNumAvailPins;i++) {
				// check to see ach pin to see if it has the same class (type) as the currently selected sector
				nPinID = zoomRegion[nZoomID][nZM_POINTSLIST][i];
				sPinType = locPt[nPinID][7];
				if (sPinType == sACTIVESectorType)
					arrACTIVEZoomablePins[nCurrentPinsVisible++] = zoomRegion[nZoomID][nZM_POINTSLIST][i];
			}
		}
		
		var nPinX, nPinY;
		if (bExpandPins) {
		
			// get the current size/posn of the zoom region
			var nLeft = Number($("#" + sZoomIdAttr).css("left").replace("px", ""));
			var nTop = Number($("#" + sZoomIdAttr).css("top").replace("px", "")) - 30;
			var nWidth = Number($("#" + sZoomIdAttr).css("width").replace("px", ""));
			var nHeight = Number($("#" + sZoomIdAttr).css("height").replace("px", "")) + 30;
			
			// get the new left and width values for the expanded zoom region
			var nExpandedWidth = 10 + nCurrentPinsVisible * nALLOW_WIDTH_PER_PIN;
			var nExpandedLeft = nLeft - Math.round((nExpandedWidth-nWidth)/2);
			if ((nExpandedLeft + nExpandedWidth + 30) > nMAPWIDTH)
				nExpandedLeft = nMAPWIDTH - nExpandedWidth - 40; // set the new position so that the zoom region is 10px away from the RH edge
			if ((nExpandedLeft - 30) < 0)
				nExpandedLeft = 40; // set the new position so that the zoom region is 10px away from the LH edge
				
			var sExpandedLeft_px = String(nExpandedLeft) + "px";
			var sExpandedTop_px = String(nTop) + "px";
			var sExpandedHeight_px = String(zoomRegion[nZoomID][nZM_EXTHEIGHT]) + "px";
			var sExpandedWidth_px = String(nExpandedWidth) + "px";
			
			$("#" + sZoomIdAttr).animate({left:sExpandedLeft_px, top:sExpandedTop_px, width:sExpandedWidth_px, height:sExpandedHeight_px}, 500, function() {
																																						$(this).css({zIndex:3}); 
																																						maskRegion(this.id, true);
																																						// hide all the visible zoom regions other than the active region
																																						var sSectorType = "";
																																						if (sACTIVESectorType.length > 1)
																																							sSectorType = "." + sACTIVESectorType
																																						$("#locationMap .zoomRegion" + sSectorType).hide();
																																						$("#locationMap .zoomRegion" + sSectorType + ".active").show();
																																							});
			
			
			
			
			var nPinNewX, nPinNewY;
			
			for (i=0;i<nCurrentPinsVisible;i++) {
				// get the num ID of each pin
				nPinID = arrACTIVEZoomablePins[i];
				nPinNewX = 10 + (i * nALLOW_WIDTH_PER_PIN) + nExpandedLeft;
				nPinNewY = 20 + nTop;
				$("#p" + nPinID).animate({left:nPinNewX, top:nPinNewY}, 500, function(){$(this).css({zIndex:4})});
				$("#p" + nPinID).addClass("zoomed");
				
				// how far is the pin from it's true point
				nPinX = locPt[nPinID][1];
				nPinY = locPt[nPinID][2];
				nPinXDiff = nPinNewX - nPinX;
				nPinYDiff = nPinY - nPinNewY;
				
				// use this to set the display position of the connecting line/s
				sFirstSectionHeight = String(Math.round(nPinYDiff/2) + 16) + "px";
				sSecondSectionY = sFirstSectionHeight;
				sSecondSectionWidth = String(Math.abs(nPinXDiff)-1) + "px";
				sSecondSectionHeight = String(Math.round(nPinYDiff/2) + 10) + "px";
				
				// does the point sit to the right or the left of the pin
				bIsLeft = (nPinXDiff < 0);
				
				
				// configure the connecting line between the pin head and it's true location
				$("#p" + nPinID).find(".bend .first").css({height:sFirstSectionHeight});
				if (bIsLeft) {
					$("#p" + nPinID).find(".bend .right").css({height:sSecondSectionHeight, left:"0px", top:sSecondSectionY, width:sSecondSectionWidth});
					$("#p" + nPinID).find(".bend .left").hide();
				} else {
					$("#p" + nPinID).find(".bend .left").css({height:sSecondSectionHeight, left:"-"+sSecondSectionWidth, top:sSecondSectionY, width:sSecondSectionWidth});
					$("#p" + nPinID).find(".bend .right").hide();
				}
			} 
			
			// change the sppearance of the pins that are not in the zoomed region
			setNonZoomedPins(nZoomID, true);
			
		} else {
			
			// set the pins back to their working position
			for (i=0;i<nCurrentPinsVisible;i++) {
				// get the num ID of each zoomable pin
				nPinID = arrACTIVEZoomablePins[i];
				
				nPinX = locPt[nPinID][1] + "px";
				nPinY = locPt[nPinID][2] + "px";
				
				$("#p" + nPinID).animate({left:nPinX, top:nPinY}, 500, function() {$(this).css({zIndex:1})});
				$("#p" + nPinID).removeClass("zoomed");
			}
			
			// set the zoomRegion back to it's working position
			maskRegion("#" + sZoomIdAttr, false);

			// show all the zoom regions that should be visible
			var sSectorType = "";
			if (sACTIVESectorType.length > 1)
				sSectorType = "." + sACTIVESectorType
			$("#locationMap .zoomRegion" + sSectorType).show();
			$("#" + sZoomIdAttr).animate({left:zoomRegion[nZoomID][nZM_X], top:zoomRegion[nZoomID][nZM_Y], width:zoomRegion[nZoomID][nZM_WIDTH], height:zoomRegion[nZoomID][nZM_HEIGHT]}, 500, function() {$(this).css({zIndex:2});});
			
			// revert the sppearance of the pins that are not in the zoomed region
			setNonZoomedPins(nZoomID, false);

			
		}
	}
	
	function setNonZoomedPins(nZoomID, bHide) {
		// concat all the ID's of the points in the current zoom region
		var sAllZoomIDsConcat = "," + arrACTIVEZoomablePins.join(",") + ",";
		var nOpacity = 1;
		var bZoomable = false;
		var sClassFilter = "";
		
		if (sACTIVESectorType.length > 0)
			sClassFilter = "." + sACTIVESectorType;
		
		// Scan thruogh each point and see if it's zoomable
		for (var i=0;i<nNUMPOINTS;i++) {
			
			// can this pinId be included in the current zoom region
			bZoomable = (sAllZoomIDsConcat.indexOf("," + i + ",") > -1);
			
			if (!bZoomable)
				if (bHide) {
					$("#p" + i + sClassFilter).hide();
					$("#p" + i + "Shadow" + sClassFilter).hide();
				} else {
					$("#p" + i + sClassFilter).show();
					$("#p" + i + "Shadow" + sClassFilter).show();
				}
					

			
		}
	}
	
	function maskRegion(sZoomIdAttr, bShow) {
		
		if (bShow) {
		
			var nExtraZoomRegionWidth = 0;
			if (_isIE6) nExtraZoomRegionWidth += 25; // we have to allow for the open and close icons sitting within the zoom region
		
			// get the current size/posn of the zoom region
			var nX = Number($("#" + sZoomIdAttr).css("left").replace("px", ""));
			var nY = Number($("#" + sZoomIdAttr).css("top").replace("px", ""));
			var nWidth = Number($("#" + sZoomIdAttr).css("width").replace("px", ""));
			var nHeight = Number($("#" + sZoomIdAttr).css("height").replace("px", ""));
			
			$("#maskTop").show().css({left:0, top:0, width:nMAPWIDTH+"px", height:nY+"px"});
			$("#maskLeft").show().css({left:0, top:nY+"px", width:nX+"px", height:String(nHeight+2)+"px"});
			$("#maskRight").show().css({left:String(nX + nWidth + 2 + nExtraZoomRegionWidth)+"px", top:nY+"px", width:String(nMAPWIDTH - (nX+nWidth) - 2 - nExtraZoomRegionWidth)+"px", height:String(nHeight+2)+"px"});
			$("#maskBottom").show().css({left:0, top:String(nY + nHeight + 2)+"px", width:nMAPWIDTH+"px", height:String(nMAPHEIGHT - (nY + nHeight) - 2)+"px"});
			
			$("#sectorSelection").hide();
			$("#zoomOnOff").hide();
		
		} else {
			$(".mask").hide();
			$("#sectorSelection").show();
			$("#zoomOnOff").show();
		}
		
	}
	
	function hideZoomRegions(bHideZoomRegions, bHideZoomToolbutton) {
		
		
		var sClassFilter = ""
		if (sACTIVESectorType.length > 0)
			sClassFilter = "." + sACTIVESectorType;
			
		if (bHideZoomRegions) {
			$(".zoomRegion" + sClassFilter).hide(); 
			$("#zoomOnOff").addClass("inActive");
			$("#zoomOnOff").attr("title", "Zoom regions hidden");
		} else {
			$(".zoomRegion" + sClassFilter).show();
			$("#zoomOnOff").removeClass("inActive");
			$("#zoomOnOff").attr("title", "Zoom regions active");
		}
		
		if (bHideZoomToolbutton)
			$("#zoomOnOff").hide()
		else
			$("#zoomOnOff").show()
	}
	
	
	function setSectorText(nSectorID) {
		var sHeading = sector[nSectorID][0];
		var sHTML = sector[nSectorID][1];
		var sImgSrc = sector[nSectorID][5];
		
		
		// We have a background behind the text, so if there is no text, we hide the whole DIV. else we show it, base on the title heading of each sector.
		if(!sHeading.length > 0 )
		{
			$("#mapSectorText").hide();
		}
		else
		{
			if (sImgSrc) {
				sImgSrc = "<img class='thumb' src='" + sImgSrc + "' title='" +  sHeading + "' />";
				sHTML = sImgSrc + sHTML;
			}
			var sSectorURL = sector[nSectorID][6];
			if (sSectorURL) {
				sSectorURL = " &nbsp;<br/><a href='" + sSectorURL + "' class='sector-url' title='More info'></a>";
				sHTML += sSectorURL;
			}
			
			$("#mapSectorText h3").text(sHeading);
			$("#mapSectorText .body").html(sHTML);
			
			$("#mapSectorText").show();
		}
		
		
	}
	
	
	function showLocationData(sPinID, x, y, bShowDescription) {
		var nLOCATIONDATA_X_OFFSET = 130;
		var nLOCATIONDATA_Y_OFFSET = -8;
		var nLOCATION_WRAPPER_HEIGHT = 43; // 14, 29
		var sDataSeparator = "<br />";
		
		var nPinID = Number(sPinID.substr(1, 5));
		
		if ((nPinID == nACTIVELastNonLinkedPin) && (bShowDescription == false)) {
			nACTIVELastNonLinkedPin = NO_VALUE_SET;
			bShowDescription = true; // show the description if the user clicked on a pin when "no info for this location" is displayed
			// closeLocationData();
			// return;
		} 
		
		if (bShowDescription == false)
			nACTIVELastNonLinkedPin = nPinID;
		
		
		// get the display info for this pin
		var sTitle = locPt[nPinID][0];
		var sSector = locPt[nPinID][3];
		var sClient = locPt[nPinID][4];
		var sDescr = locPt[nPinID][5];
		var nBoxDisplayWidth = locPt[nPinID][6];
		var sURL = locPt[nPinID][8];
		var bHasURL = (sURL.length > 1);
		
		// if the pin has a URL, then put a class on the box to show a small linked icon
		if (bHasURL) { 
			if (!$("#locationData").hasClass("linked"))
				$("#locationData").addClass("linked");
		} else {
			if ($("#locationData").hasClass("linked"))
				$("#locationData").removeClass("linked");
		}
		
		if (nBoxDisplayWidth == 1) {
			sDataSeparator = " - ";
			$("#locationData").addClass("width-medium-data");
		} else
			$("#locationData").removeClass("width-medium-data");
		
		// set the x position
		if (nBoxDisplayWidth == 0)
			nDisplayWidth = nLOCATIONDATA_WIDTH;
		else
			nDisplayWidth = nLOCATIONDATA_MED_WIDTH;

		x += 25; // shift the location data so that it displays above the centre of the 20px wide pin
		
		if ((x + Math.round(nDisplayWidth/2)) > nMAPWIDTH) {
			// move the box to the left so that it doesn't get sit out beyond the right edge
			nDisplay_x = (nMAPWIDTH - nDisplayWidth);
		} else if (x - Math.round(nDisplayWidth/2) < 1)
			nDisplay_x = 0;
		else
			nDisplay_x = x - Math.round(nDisplayWidth/2);
		
		// find the distance between the default position of the pointer and the centre of the location data box
		var xShift = (x - Math.round(nDisplayWidth/2)) - nDisplay_x;
		
		// set the widths of the two floats that sit on each side of the pointer
		var nWidth_b_1;
		var nWidth_b_2;
		if (nBoxDisplayWidth == 0) {
			nWidth_b_1 = 101;
			nWidth_b_2 = 102;
		} else {
			nWidth_b_1 = 214;
			nWidth_b_2 = 214;
		}
		
		if (xShift > nWidth_b_2) {
			// pointer is moved too far to the right
			nWidth_b_1 += nWidth_b_2;
			nWidth_b_2 = 0;
		} else if (xShift < -nWidth_b_1) {
			// pointer is moved too far to the left
			nWidth_b_2 += nWidth_b_1;
			nWidth_b_1 = 0;
		} else {
			// move the pointer of the location box by xShift
			nWidth_b_1 += xShift; if (nWidth_b_1 < 0)  nWidth_b_1 = 0;
			nWidth_b_2 -= xShift; if (nWidth_b_2 < 0)  nWidth_b_2 = 0;
		}
		
		$("#locationData .cb-footer .b-1").css("width", String(nWidth_b_1) + "px");
		$("#locationData .cb-footer .b-2").css("width", String(nWidth_b_2) + "px");
		
		var sHTML;
		if (bShowDescription) {
			sHTML = "<span class='box-body-title'>Location:</span> " + sTitle;
			//sHTML += " [" + sPinID + "]";
			sHTML += sDataSeparator + "<span class='box-body-title'>Sector:</span>" + sSector + sDataSeparator +  "<span class='box-body-title'>Client:</span> " + sClient;
			if (sDescr.length > 0)
				sHTML += sDataSeparator + "<span class='box-body-title'>Description:</span> " + sDescr;
		}
		else
			sHTML = "<span class='no-link-info'>&nbsp;</span> No linked info is available";
			
		if (bACTIVEisTouchDevice) {
			sHTML += "<a class='close-data' onclick='closeLocationData'>X</a>";
		}
		$("#locationData .cb-body").html(sHTML);
		
		var nLocationDataHeight = Number($("#locationData").css("height").replace("px", ""));
		// console_Log("Body height = " + nLocationDataHeight);
		
		// reset the display position
		/* x -= nLOCATIONDATA_X_OFFSET; */
		if (y - (nLocationDataHeight + nLOCATIONDATA_Y_OFFSET) > 0)
			display_y = y - (nLocationDataHeight + nLOCATIONDATA_Y_OFFSET);
		else
			display_y = 0;
		
		
		// x_shift = String(Number(x.replace("px", "")) - 80) + "px";
		$("#locationData").css({left:nDisplay_x + "px", top:display_y + "px"});
		$("#locationData").show();
		if (_isIE7)
			$("#locationData .cb-body").html(sHTML); // IE7 intermittently doesn't show the popups
		
	}
	
	
	
	function closeLocationData() {
		$("#locationData").hide();
	}	
	
	
	function isTouchDevice() { 
	
		try {  
			document.createEvent("TouchEvent");  
			return true;  
		} catch (e) {  
			return false;  
		}  
		
	}
	
	function alertMsg(sAlert, nMilliSec) {
		$("#userAlert .ua-body").html(sAlert);
		$("#userAlert").show();
		setTimeout(closeAlertMsg, nMilliSec);
	}
	
	function closeAlertMsg() {
		$("#userAlert").hide();
	}
	
	
	
	
	function console_Log(sLog) {
		try {
			// console.log(sLog) // un-comment for debugging
		} catch(e) {
			// ignore for browsers without a console
		}
	}
	
