Utilisateur:Emeralda/coords.js : Différence entre versions

De Lotro-wiki
Sauter à la navigation Sauter à la recherche
(Page créée avec « // based upon http://www.wowwiki.com/User:Pcj/coords.js /* Formulaic logic: The map flow is top to bottom, left to right for placement. It uses a percent placement lo... »)
 
 
Ligne 307 : Ligne 307 :
 
yPos = 100 - getOffset(yMin, yMax, yNum);
 
yPos = 100 - getOffset(yMin, yMax, yNum);
 
break;
 
break;
case "Trollshaws":
+
case "Trouée des trolls":
 
xMin = 20.8 * 10;
 
xMin = 20.8 * 10;
 
xMax = 41.3 * 10;
 
xMax = 41.3 * 10;

Version actuelle datée du 20 mai 2013 à 15:29

// based upon http://www.wowwiki.com/User:Pcj/coords.js

/* Formulaic logic:
   The map flow is top to bottom, left to right for placement.  It uses a percent placement logic versus fixed.
   This allows flexibility in map sizes as long as the aspect ratio is maintained.
   This means:
      x (North/South) INCREASES as you move south/down.  
      y (East/West) DECREASES as you move East/right.
   Thus the math on offset for "x" is straight but for "y" it is (100 - value) to reverse the percentage.

   Due to Misty Mountains unique layout, that zone will require special handling for East/West work.
   Misty Mountains breaks West and East at 0.0 where East is 0-13.0 and West is 0-11.9

   Due to Angmar's and Forochel's unique layout, those zones will require special handling for North/South work.
   Angmar breaks North and South at 0.0 where South is 0-7.2 and North is 0-14.7.
   Forochel breaks North and South at 0.0 where South is 0-5.7 and North is 0-25.0.

   Due to decimal based locations, it rounds to even numbers before math so everything is *10.

   xType = N for North, S for South, E for East, W for West.
   All other (currently existing) zones are South/West referenced so we'll ignore xType for them. 
   This is for Angmar/MM support.

   xNum = numeric position of North/South parameter.
   xMax, xMin, yMax and yMin are the minimum and maximum locations on a given map respectively.
   Range = (Max - Min) for the total available range of values on a map.
   xOffset = ((xNum - xMin) / Range) -- the Top-down offset percentage used to map the point.
   yOffset = 100 - ((yNum - yMin) / Range) -- the Left-in offset percentage used to map the point.
   I included the Min and Max values in the formulas in case they change at any time or need tweaking.

   Additional notes by EoD:
   All map images should have the layout "Zone_map.jpg" and never contain a leading "The".
   Any leading "The" will be removed from the requested image in order to support request "The Shire" and "Shire" at the same time.
   If there are multiple naming schemes for an area, do something similar to "Shire Homesteads" (see below).
   If the map has a different name, overwrite the specialImageTitle as in "Grand Stair".
 
   HOWTO add/change coordinates:
   Go ingame, switch to full screen, open the map.
   Move the mouse the the SE and the NW corner.
   Write down coordinates for both SE and NW corners.
   Add those values to xMax, xMin, yMax, yMin for the appropriate area. If there is a N/S or E/W switch, read above!
*/

// global variables needed to set positions...
xPos = "";
yPos = "";
mapsize = "450";
var linkCache = new Object();
var coords_hidden = new Boolean();

function getImageAndDisplay(zone) {
	var specialImageTitle = zone;
	//We ignore a leading "The ", "The_", "the ", "the_"
	if( /[tT]he[ _]/.test( specialImageTitle ) ) {
		specialImageTitle = specialImageTitle.replace(/[tT]he[ _]/,'');
	}
	var xType = xPos.charAt(xPos.length-1);
	var xNum = xPos.substr(0,(xPos.length-1)) * 10;
	var xMin = 0;
	var xMax = 0;
	var yType = yPos.charAt(yPos.length-1);
	var yNum = yPos.substr(0, (yPos.length-1)) * 10;
	var yMin = 0;
	var yMax = 0;
	switch (specialImageTitle) {
		case "Angmar":
			// xPos is a special case for Angmar due to 0.0 North/South in zone.
			if (xType == "N") {
			// North -- 0 base the top of the map by removing North reference to the 0 point.
				xNum = 147 - xNum;
			}
			else {
			// South -- Add 14.7N to the number to offset the 0 base at top.
				if (xType == "S") {
					xNum = xNum + 147;
				}
			}
			xMin = 0;
			xMax = 22.0 * 10; // 7.3S to 14.7N = 22.0
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 13.6 * 10;
			yMax = 42.8 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Annuminas":
			specialImageTitle = "Annúminas";
		case "Annúminas":
			xMin = 15.5 * 10;
			xMax = 21.2 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 65.9 * 10;
			yMax = 73.5 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Breeland":
			specialImageTitle = "Bree-land";
		case "Bree-land":
			xMin = 17.6 * 10;
			xMax = 38.8 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 37.3 * 10;
			yMax = 65.6 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Archet":
			specialImageTitle = "Archet Dale";
		case "Archet Dale":
			xMin = 24.2 * 10;
			xMax = 28.3 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 45.2 * 10;
			yMax = 50.7 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Bree-town":
			specialImageTitle = "Bree";
		case "Bree":
			xMin = 28 * 10;
			xMax = 33 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 47.9 * 10;
			yMax = 54.6 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Bree-land Homestead":
			specialImageTitle = "Bree-land Homesteads";
		case "Bree-land Homesteads":
			xMin = 33.9 * 10;
			xMax = 38 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 44.6 * 10;
			yMax = 49.9 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Northern Barrows":
			specialImageTitle = "Northern Barrow-downs";
		case "Northern Barrow-downs":
			xMin = 29.9 * 10;
			xMax = 33.5 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 52.5 * 10;
			yMax = 57.3 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Southern Barrows":
			specialImageTitle = "Southern Barrow-downs";
		case "Southern Barrow-downs":
			xMin = 32.7 * 10;
			xMax = 37.2 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 51.9 * 10;
			yMax = 57.8 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Ered Luin":
			xMin = 12.6 * 10;
			xMax = 32.2 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 86.5 * 10;
			yMax = 112.9 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Thorin's Gate":
			xMin = 11.1 * 10;
			xMax = 17 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 98.7 * 10;
			yMax = 106.8 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Thorin's Hall Homestead":
			specialImageTitle = "Thorin's Hall Homesteads";
		case "Thorin's Hall Homesteads":
			// No coord info yet...
			xMin = 13.2 * 10;
			xMax = 17.3 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 104.6 * 10;
			yMax = 110 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Falathlorn Homestead":
			specialImageTitle = "Falathlorn Homesteads";
		case "Falathlorn Homesteads":
			// No coord info yet...
			xMin = 24.3 * 10;
			xMax = 28.5 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 88 * 10;
			yMax = 93.5 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Forochel":
			// xPos is a special case for Forochel due to 0.0 North/South in zone.
			if (xType == "N") {
			// North -- 0 base the top of the map by removing North reference to the 0 point.
				xNum = 250 - xNum;
			}
			else {
			// South -- Add 250 to the number to offset the 0 base at top.
				if (xType == "S") {
					xNum = xNum + 250;
				}
			}
			xMin = 0.1 * 10;
			xMax = 30.6 * 10; // 0.1S to 5.7S + 0.0N to 25.0N = 30.6
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 51.9 * 10;
			yMax = 92.8 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Ettenmoors":
			xMin = 9.9 * 10;
			xMax = 21.8 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 8.2 * 10;
			yMax = 24.3 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Evendim":
			xMin = 1.7 * 10;
			xMax = 24.3 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 52.5 * 10;
			yMax = 82.8 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Lone-lands":
			xMin = 26.2 * 10;
			xMax = 43.8 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 20.9 * 10;
			yMax = 44.3 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Misty Mountains":
			// Misty Mountains needs special handling...
			xMin = 14.6 * 10;
			xMax = 33.2 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			if (yType == "E") {
			// East -- 0 base the east of the map by removing east reference to the 0 point.
				yNum = 130 - yNum;
			}
			else {
			// South -- Add 130 to the number to offset the 0 base at top.
				if (yType == "W") {
					yNum = yNum + 130;
				}
			}
			yMin = 0.1 * 10;
			yMax = 24.9 * 10; // 13.0E + 11.9W = 24.9
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "North Downs":
			xMin = 1 * 10;
			xMax = 22.2 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 32.2 * 10;
			yMax = 60.5 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Rivendell Valley":
			specialImageTitle = "Rivendell";
		case "Rivendell":
			xMin = 26.3 * 10;
			xMax = 33.5 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			if (yType == "E") {
			// East -- 0 base the east of the map by removing east reference to the 0 point.
				yNum = 3 - yNum;
			}
			else {
			// South -- Add 0.3E to the number to offset the 0 base at top.
				if (yType == "W") {
					yNum = yNum + 3;
				}
			}
			yMin = 0;
			yMax = 9.7 * 10; //9.4W + 0.3E = 9.7
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Shire":
			xMin = 22.9 * 10;
			xMax = 38.8 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 59.8 * 10;
			yMax = 80.9 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Shire Homestead":
			specialImageTitle = "Shire Homesteads";
		case "Shire Homesteads":
			xMin = 34.5 * 10;
			xMax = 38.9 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 71.8 * 10;
			yMax = 77.4 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Old Forest":
			xMin = 29.2 * 10;
			xMax = 38.9 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 52.3 * 10;
			yMax = 65.3 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Trouée des trolls":
			xMin = 20.8 * 10;
			xMax = 41.3 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			if (yType == "E") {
			// East -- 0 base the east of the map by removing east reference to the 0 point.
				yNum = 9 - yNum;
			}
			else {
			// South -- Add 0.9E to the number to offset the 0 base at top.
				if (yType == "W") {
					yNum = yNum + 9;
				}
			}
			yMin = 0;
			yMax = 27.2 * 10; //26.3W + 0.9E = 21.7
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Enedwaith":
			xMin = 53.5 * 10;
			xMax = 76.7 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 0.6 * 10;
			yMax = 31.6 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Frostbluff":
		// xPos is a special case for Frostbluff due to 0.0 North/South in zone.
			if (xType == "N") {
			// North -- 0 base the top of the map by removing North reference to the 0 point.
				xNum = 250 - xNum;
			}
			else {
			// South -- Add 250 to the number to offset the 0 base at top.
				if (xType == "S") {
					xNum = xNum + 250;
				}
			}

			xMin = 10.8 * 10;
			xMax = 14.4 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 91.6 * 10;
			yMax = 96.2 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Eregion":
			xMin = 35.2 * 10;
			xMax = 58.0 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			if (yType == "E") {
			// East -- 0 base the east of the map by removing east reference to the 0 point.
				yNum = 64 - yNum;
			}
			else {
			// South -- Add 64 to the number to offset the 0 base at top.
				if (yType == "W") {
					yNum = yNum + 64;
				}
			}
			yMin = 0.1 * 10;
			yMax = 30.4 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Walls of Moria":
			xMin = 48.3 * 10;
			xMax = 54.1 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 1.5 * 10;
			yMax = 9.2 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		// MORIA REGIONS BEGIN HERE \\
		case "Durin's Way":
			// xPos is a special case for Durin's Way due to 0.0 North/South in zone.
			if (xType == "N") {
			// North -- 0 base the top of the map by removing North reference to the 0 point.
				xNum = 21 - xNum;
			}
			else {
			// South -- Add 21 to the number to offset the 0 base at top.
				if (xType == "S") {
					xNum = xNum + 21;
				}
			}
			xMin = 0.1 * 10;
			xMax = 11.8 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 98.1 * 10;
			yMax = 114.1 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Nud-melek":
			xMin = 3.9 * 10;
			xMax = 12.2 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 94.1 * 10;
			yMax = 105.3 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Flaming Deeps":
			xMin = 12.3 * 10;
			xMax = 18.0 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 104.7 * 10;
			yMax = 112.2 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Foundations of Stone":
			xMin = 10.5 * 10;
			xMax = 16.4 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 95.0 * 10;
			yMax = 102.9 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Great Delving":
			xMin = 4.9 * 10;
			xMax = 10.3 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 110.1 * 10;
			yMax = 117.3 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Silvertine Lodes":
			xMin = 8.5 * 10;
			xMax = 14.0 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 108.9 * 10;
			yMax = 116.2 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Redhorn Lodes":
			xMin = 9.3 * 10;
			xMax = 16.3 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 99.8 * 10;
			yMax = 109.1 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Grand Stair":
			specialImageTitle = "The Grand Stair";
			xMin = 69.3 * 10;
			xMax = 74.1 * 10;
			xPos = 100 - getOffset(xMin, xMax, xNum);
			yMin = 135.2 * 10;
			yMax = 141.5 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Water-works":
		case "Water-Works":
			specialImageTitle = "Waterworks";
		case "Waterworks":
			xMin = 12.3 * 10;
			xMax = 22.5 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 106.8 * 10;
			yMax = 120.5 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Zelem-melek":
			xMin = 3.8 * 10;
			xMax = 13.8 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 100.7 * 10;
			yMax = 114.0 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Zirakzigil":
			xMin = 11.5 * 10;
			xMax = 17.8 * 10;
			xPos = 100 - getOffset(xMin, xMax, xNum);
			yMin = 105.0 * 10;
			yMax = 113.5 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Lothlorien":
			specialImageTitle = "Lothlórien";
		case "Lothlórien":
			xMin = 4.5 * 10;
			xMax = 20.2 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 61.1 * 10;
			yMax = 82.1 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Caras Galadhon":
			xMin = 12.9 * 10;
			xMax = 17.1 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 64.4 * 10;
			yMax = 70.0 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		// MIRKWOOD REGIONS BEGIN HERE \\
		case "Mirkwood":
			xMin = 4.9 * 10;
			xMax = 23.3 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 39.0 * 10;
			yMax = 63.6 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		// ISENGARD REGIONS BEGIN HERE \\
		case "Dunland":
			//[90.9S, 1.9W], [70.8S, 28.6W]
			xMin = 70.8 * 10;
			xMax = 90.9 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 1.9 * 10;
			yMax = 28.6 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Dunlending":
			//[70.5S, 28.5W], [98.0S, 4.2E]
			//Needs special handling as 0.0 of E/W is in the zone (see Misty Mountains).
			xMin = 70.5 * 10;
			xMax = 98.0 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			if (yType == "E") {
			// East -- 0 base the east of the map by removing east reference to the 0 point.
				yNum = 42 - yNum;
			}
			else {
			// South -- Add 4.2E to the number to offset the 0 base at top.
				if (yType == "W") {
					yNum = yNum + 42;
				}
			}
			yMin = 0.1 * 10;
			yMax = 32.7 * 10; // 28.5W to 4.2E = 32.7
			yPos = 100 - getOffset(yMin, yMax, yNum);
                case "Tâl Methedras":
			//[72.1S, 14.5W], [78.9S, 5.4W]
			xMin = 72.1 * 10;
			xMax = 78.9 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 5.4 * 10;
			yMax = 14.5 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
			break;
		case "Gap of Rohan":
			//[80.4S, 20.8W], [95.3S, 0.9W]
			xMin = 80.4 * 10;
			xMax = 95.3 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 0.9 * 10;
			yMax = 20.8 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Nan Curunir":
			specialImageTitle = "Nan Curunír";
		case "Nan Curunír":
			//[76.1S, 9.5W], [86.3S, 4.1E]
			//Needs special handling as 0.0 of E/W is in the zone (see Misty Mountains).
			xMin = 76.1 * 10;
			xMax = 86.3 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			if (yType == "E") {
			// East -- 0 base the east of the map by removing east reference to the 0 point.
				yNum = 41 - yNum;
			}
			else {
			// South -- Add 4.1E to the number to offset the 0 base at top.
				if (yType == "W") {
					yNum = yNum + 41;
				}
			}
			yMin = 0.1 * 10;
			yMax = 13.6 * 10; // 9.5W to 4.1E = 13.6
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Galtrev":
			//[78.9S, 18.4W], [81.6S, 14.8W]
			xMin = 78.9 * 10;
			xMax = 81.6 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 14.8 * 10;
			yMax = 18.4 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Isengard":
			//[76.3S, 6.3W], [82.1S, 1.4E]
			//Needs special handling as 0.0 of E/W is in the zone (see Misty Mountains).
			xMin = 76.3 * 10;
			xMax = 82.1 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			if (yType == "E") {
			// East -- 0 base the east of the map by removing east reference to the 0 point.
				yNum = 14 - yNum;
			}
			else {
			// South -- Add 1.4E to the number to offset the 0 base at top.
				if (yType == "W") {
					yNum = yNum + 14;
				}
			}
			yMin = 0.1 * 10;
			yMax = 7.7 * 10; // 6.3W to 1.4E = 7.7
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Isengard Depths":
			//[76.8S, 31.3E], [81.5S, 37.5E]
			//Needs special handling for yPos as it's the only South/East map.
			xMin = 76.8 * 10;
			xMax = 81.5 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 31.3 * 10;
			yMax = 37.5 * 10;
			yPos = getOffset(yMin, yMax, yNum);
			break;
		case "Pit of Iron":
			// TODO
			//[52.3N, 94.4W], [49.3N, 90.4W]
			xMin = 49.3 * 10;
			xMax = 52.3 * 10;
			xPos = 100 - getOffset(xMin, xMax, xNum);
			yMin = 90.4 * 10;
			yMax = 94.4 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		// SHORES OF THE GREAT RIVER BEGIN HERE \\
		case "Great River":
			//[17.2S, 73.9W], [37.6S, 46.9W]
			xMin = 17.2 * 10;
			xMax = 37.6 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 46.9 * 10;
			yMax = 73.9 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Stangard":
			//[24.9S, 65.1W], [27.1S, 62.2W]
			xMin = 24.9 * 10;
			xMax = 27.1 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 62.2 * 10;
			yMax = 65.1 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		// Riders of Rohan BEGIN HERE \\
		case "East Rohan":
			//[33.6S,77.5W] [65.6S,34.7W]
			xMin = 33.6 * 10;
			xMax = 65.6 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 34.7 * 10;
			yMax = 77.5 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
               case "East Wall":
			//[45.7S,61.3W] [63.5S,37.5W]
			xMin = 45.7 * 10;
			xMax = 63.5 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 37.5 * 10;
			yMax = 61.3 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
               case "Eaves of Fangorn":
			//[34.4S,79.4W] [44.3S,66.1W] 
			xMin = 34.4 * 10;
			xMax = 44.3 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 66.1 * 10;
			yMax = 79.4 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
               case "Entwash Vale":
			//[38.9S,74.3W] [54.6S,53.5W] 
			xMin = 38.9 * 10;
			xMax = 54.6 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 53.5 * 10;
			yMax = 74.3 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
               case "Norcrofts":
			//[41.8S,67.0W] [58.1S,45.3W] 
			xMin = 41.8 * 10;
			xMax = 58.1 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 45.3 * 10;
			yMax = 67.0 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
               case "Sutcrofts":
			//[52.4S,69.9W] [67.2S,50.1W] 
			xMin = 52.4 * 10;
			xMax = 67.2 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 50.1 * 10;
			yMax = 69.9 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
               case "Snowbourn":
			//[59.5S,63.7W] [62.1S,60.3W] 
			xMin = 59.5 * 10;
			xMax = 62.1 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 60.3 * 10;
			yMax = 63.7 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Wold":
			//[30.1S,64.2W] [48.7S,39.4W] 
			xMin = 30.1 * 10;
			xMax = 48.7 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 39.4 * 10;
			yMax = 64.2 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
                case "Harwick":
			//[37.7S,54.4W] [40.8S,50.3W] 
			xMin = 37.7 * 10;
			xMax = 40.8 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 50.3 * 10;
			yMax = 54.4 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
               case "Wildermore":
			//[27.1S,77.7W] [46.9S,51.3W] 
			xMin = 27.1 * 10;
			xMax = 46.9 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 51.3 * 10;
			yMax = 77.7 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
		case "Forlaw":
			//[37.4S,62.5W] [39.7S,59.4W] 
			xMin = 37.4 * 10;
			xMax = 39.7 * 10;
			xPos = getOffset(xMin, xMax, xNum);
			yMin = 59.4 * 10;
			yMax = 62.5 * 10;
			yPos = 100 - getOffset(yMin, yMax, yNum);
			break;
	}

	//if our link hasn't been fetched yet, fetch it
	if(linkCache[specialImageTitle] == null) {
	  $.getJSON(
	    "/api.php?action=query&format=json",
	    {titles: "File:"+specialImageTitle+"_map.jpg", 
	     prop: "imageinfo", 
	     iiprop: "url",
	     iiurlwidth: mapsize
	    },
	    function(data) { 
	      for( var page in data.query.pages ) {
	        //== null means comparing for "undefined" or "null"
	        if(data.query.pages[page].missing == null) {
                  linkCache[specialImageTitle] = data.query.pages[page].imageinfo[0].thumburl;
		  //if loading took longer than the user's patience, we don't want to disturb him/her with the image
		  if(!coords_hidden)
	            showCoordsTip(linkCache[specialImageTitle]);
                }
	        else
	          alert("Error, image "+"File:"+specialImageTitle+"_map.jpg"+" not found!");
	        break;
	      }
	    }
	  ).error(function() { 
		alert("Error, image "+"File:"+specialImageTitle+"_map.jpg"+" could not be retrieved!");
	  });
	} else {
	  return showCoordsTip(linkCache[specialImageTitle]);
	}
}

// validate the position is valid with respect to min and max "valid" positional values.
// if so, return its percent based relative position.  If not, return 0.
function getOffset(minPos, maxPos, actualPos) {
	offset = 0;
	rangeValue = (maxPos - minPos);
	if (actualPos > maxPos) {
		offsetPos = -1;
	}
	else {
		if (actualPos < minPos) {
			offsetPos = -1;
		}
		else {
			offsetPos = ((actualPos - minPos) / rangeValue) * 100;
		}
	}
	return offsetPos;
}


// the core display tooltip function.
function tryCoordsTip(i) {
	if (tooltipsOn) {
		coords_hidden = false;
		var Span = document.getElementById( "ctt" + i );
		var zoneInfo = Span.className.replace("coordslink ", "");
		var zone = "Universe";
		if (zoneInfo) {
			rawMapInfo = zoneInfo.split("--");
			zone = rawMapInfo[0];
			xPos = rawMapInfo[1];
			yPos = rawMapInfo[2];
		}
		zoneImage = getImageAndDisplay(zone);
	}
}

function showCoordsTip(zoneImage) {
		var tip = document.getElementById('coordstfb');
		tooltip = ttHTMLStart + '<div class="ZoneMap" style="position:relative;width:'+mapsize+'px;">';
		tooltip = tooltip + '<img width="'+mapsize+'px" src="' + zoneImage + '" alt="">';
		if (yPos >= 0 && xPos >= 0) {
			tooltip = tooltip + '<img style="position:absolute; height:8px; width:8px; left:'+yPos+'%; top:'+xPos+'%; margin:-4px" src="http://lotro-wiki.com/images/e/e5/Coord_mark.gif">';
		}
		tooltip = tooltip + '</div></div>';
		tip.innerHTML = tooltip;
		tip.style.position = "absolute";
		tip.style.visibility = "hidden";
		tip.style.display = "block";
		tip.style.zIndex = "999";
		moveCoordsTip();
		tip.style.visibility = "visible";
}

// this function hides the tooltip.
function hideCoordsTip() {
	coords_hidden = true;
	var tip = document.getElementById('coordstfb');
	tip.innerHTML = "";
	tip.style.display = "none";
}

// This function moves the tool-tips when our mouse moves
function moveCoordsTip() {
	if (document.documentElement && document.documentElement.scrollTop) {
	// IE6 +4.01 and user has scrolled
		dbSleft = document.documentElement.scrollLeft;
		dbStop = document.documentElement.scrollTop;
	} else {
	// IE5 or DTD 3.2
		dbSleft = document.body.scrollLeft;
		dbStop = document.body.scrollTop;
	}
	var tip = document.getElementById('coordstfb');
	var newTop = mousePos.y - (tip.clientHeight + 40);
	var newLeft = mousePos.x - ( tip.clientWidth / 2 );
	if( newTop < dbStop ) { 
		newTop = mousePos.y + 1;
		if ( newTop + tip.clientHeight > winSize.y ) newTop = dbStop; 
	}
	if( newLeft < dbSleft ) newLeft = dbSleft;
	if( ( mousePos.x + ( tip.clientWidth / 2 ) ) >= winSize.x - 150 ) newLeft = mousePos.x - ( 1.75 * tip.clientWidth );
	tip.style.top = newTop + "px";
	tip.style.left = newLeft + "px";
}

// activation function...
function cttMouseOver() {
	ttfdiv = document.createElement("div");
	ttfdiv.setAttribute("id", "coordstfb");
	contentstart = document.getElementById("content");
	contentstart.insertBefore(ttfdiv , contentstart.childNodes[0]);
	var Spans = document.getElementsByTagName( "span" );
	for ( var i = 0; i < Spans.length; i++ ) {
		if ( hasClass( Spans[i], "coordslink" ) ) {
			Spans[i].setAttribute("id", "ctt" + i);
			Spans[i].onmouseover = tryCoordsTip.bind(Spans[i],i);
			Spans[i].onmouseout = hideCoordsTip;
			Spans[i].onmousemove = moveCoordsTip;
		}
	}
}
cttMouseOver();