/* ___________________________________________________
   
            JS-NV-091208.js ~ rev. 2009.12.08
     XGB Web and Software Design ~ www.xgbdesign.com
   ___________________________________________________
*/
	

// Functions for posting navigation schemas: ______________________________________________________

function PostNavigationSchema() {
	if (document.images)
		PostNavigationMap(Math.floor(Math.random() * 4));
}

// mapSet is a global variable which is assigned the set
// of preloaded images for the navigation schema:
function PostNavigationMap(theme) {
	mapSet = MapSet(theme);
	document.write("<img id='nav-mapped' src='" + mapSet[0].src + "' usemap='#theMap' />");
	document.write("<map name='theMap'>");
	WriteAreaTags(theme);
	if (theme == 1)
		PostAttribution();
	document.write("</map>");
}


// Functions called from here: ____________________________________________________________________

function MapSet(theme) {
	var numImages = (theme == 1) ? 9 : 8;
	var msArray = new Array(numImages);
	for (var i = 0; i < numImages; ++i) {
		msArray[i] = new Image(213, 390);
		msArray[i].src = "images/navigation/nav" + theme + "-" + i + ".png";
	}
	return msArray;
}

function WriteAreaTags(theme) {
	var reference = new Array("index.html", "about.html", "portfolio.html", "programming.html",
		"../george-lacks/", "odds-n-ends.html", "contact.html");
	var coordinates = Coordinates()[theme];
	var shape = (theme == 0) ? "poly" : "rect";
	for (var i = 0; i < 7; ++i)
		document.write("<area shape='" + shape +
			"' coords='" + coordinates[i] +
			"' href='" + reference[i] +
			"' onmouseover='Flip(" + (i + 1) +
			")' onmouseout='Flip(0)' />");
}

function Coordinates() {
	return new Array(
		// Abstract rotation theme:
		[ "9, 61, 72, 0, 84, 21, 23, 85", "42, 228, 151, 123, 177, 163, 68, 270", 
		  "0, 150, 150, 0, 173, 20, 0, 194", "27, 180, 207, 6, 212, 14, 212, 35, 43, 202",
		  "17, 340, 192, 170, 204, 187, 28, 360", "30, 385, 212, 209, 212, 249, 71, 389, 32, 389",
		  "97, 389, 212, 277, 212, 303, 124, 389" ],

		// Rose theme:
		[ "84, 43, 128, 55", "23, 85, 187, 97", "61, 127, 151, 139", "48, 169, 164, 181",
		  "46, 211, 165, 223", "51, 253, 161, 265", "49, 295, 163, 307" ],

		// Abstract reflection theme:
		[ "168, 47, 204, 57", "82, 186, 129, 201", "112, 94, 179, 104", "63, 141, 154, 151",
		  "61, 235, 152, 245", "100, 282, 177, 292", "116, 329, 202, 339" ],

		// Moonlit theme:
		[ "10, 40, 46, 49", "10, 75, 147, 84", "10, 110, 84, 119", "10, 145, 109, 154",
		  "10, 180, 114, 189", "10, 215, 102, 224", "10, 250, 107, 259" ] );
}

function Flip(i) {
	if (document.images)
		document.getElementById("nav-mapped").src = mapSet[i].src;
}

function PostAttribution() {
	var atoma = "http://images.google.com/imgres?imgurl=http://upload.wikimedia.org/wikipedia/commons/7/7e/Rose_Petals.jpg&imgrefurl=http://commons.wikimedia.org/wiki/File:Rose_Petals.jpg&usg=__Yy7XPCapYjDkuFylfrpAS4V01U8=&h=752&w=1129&sz=171&hl=en&start=11&sig2=Hb3flLyqR4EgqCcyLVxzAg&um=1&tbnid=Lc1rdMR4FuuVOM:&tbnh=100&tbnw=150&prev=/images%3Fq%3Drose%2Bpetals%26hl%3Den%26client%3Dfirefox-a%26rls%3Dcom.ubuntu:en-US:unofficial%26sa%3DN%26um%3D1&ei=a2GRSoEYiK6zA5rX2QY";
	document.write("<area coords='107, 372, 137, 382' href='" + atoma + "' target='_blank' onmouseover='Flip(8)' onmouseout='Flip(0)' />");
}

