<!--

// Mysteries functions
// 

// -------- Home Page Did You Know Routines -------- //

	var facts = 21;
	var currentFact = 1

	function factsNavForward(){
		currentFact = currentFact + 1;
		if (currentFact > facts) {
			currentFact = 1;
		}
		checkCurrent();
	}

	function factsNavBack(){
		currentFact = currentFact - 1;
		if (currentFact < 1) {
			currentFact = facts;
		}
		checkCurrent();
	}

	function checkCurrent() {
		for (loop=1;loop<=facts;loop++) {
			var obj = "facts-"+loop;
			var el = document.getElementById(obj);
			el.style.display = "none";
			var obj = "facts-related-"+loop;
			var el = document.getElementById(obj);
			el.style.display = "none";
		}
		var obj = "facts-"+currentFact;
		var el = document.getElementById(obj);
		el.style.display = "block";
		var obj = "facts-related-"+currentFact;
		var el = document.getElementById(obj);
		el.style.display = "block";
		document.getElementById("facts-info").innerHTML = "FACT #"+currentFact+" of "+facts;
	}

// -------- Interactive, Microsoft HD -------- //

	function detectOs(){
		// Check if hdViewLink ID exists
		if (document.getElementById("hdViewLink") != null ) {
			if(navigator.userAgent.indexOf('Win') != -1) {
				// If they're using windows, show the full screen HDView link
				document.getElementById('hdViewLink').style.display = 'block';
			}
		}
	}
	function viewHDFullScreen() {
		window.moveTo(0,0)
		window.resizeTo(window.screen.availWidth,window.screen.availHeight)
	}
	function hdView(opt){
		y = window.clearInterval(y);
		var HDWin = window.open(opt,'_blank','location=0,status=0,scrollbars=0,width=965,height=623');
	}
	function hdClose() {
		window.close();
	}
	window.onload = detectOs;

// ------------- Flash Embedding ------------- //

/*
Copyright (c) Copyright (c) 2007, Carl S. Yestrau All rights reserved.
Code licensed under the BSD License: http://www.featureblend.com/license.txt
Version: 1.0.2
*/
var FlashDetect = new function(){
	var self = this;
	self.installed = false;
	self.major = -1;
	self.minor = -1;
	self.revision = -1;
	self.revisionStr = "";
	self.activeXVersion = "";
	var activeXDetectRules = [
		{
			"name":"ShockwaveFlash.ShockwaveFlash.7",
			"version":function(obj){
				return getActiveXVersion(obj);
			}
		},
		{
			"name":"ShockwaveFlash.ShockwaveFlash.6",
			"version":function(obj){
				var version = "6,0,21";
				try{
					obj.AllowScriptAccess = "always";
					version = getActiveXVersion(obj);
				}catch(err){}
				return version;
			}
		},
		{
			"name":"ShockwaveFlash.ShockwaveFlash",
			"version":function(obj){
				return getActiveXVersion(obj);
			}
		}
	];
	var getActiveXVersion = function(activeXObj){
		var version = -1;
		try{
			version = activeXObj.GetVariable("$version");
		}catch(err){}
		return version;
	};
	var getActiveXObject = function(name){
		var obj = -1;
		try{
			obj = new ActiveXObject(name);
		}catch(err){}
		return obj;
	};
	var parseActiveXVersion = function(str){
		var versionArray = str.split(",");//replace with regex
		return {
			"major":parseInt(versionArray[0].split(" ")[1], 10),
			"minor":parseInt(versionArray[1], 10),
			"revision":parseInt(versionArray[2], 10),
			"revisionStr":versionArray[2]
		};
	};
	var parseRevisionStrToInt = function(str){
		return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
	};
	self.majorAtLeast = function(version){
		return self.major >= version;
	};
	self.FlashDetect = function(){
		if(navigator.plugins && navigator.plugins.length>0){
			var type = 'application/x-shockwave-flash';
			var mimeTypes = navigator.mimeTypes;
			if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){
				var desc = mimeTypes[type].enabledPlugin.description;
				var descParts = desc.split(' ');//replace with regex
				var majorMinor = descParts[2].split('.');
				self.major = parseInt(majorMinor[0], 10);
				self.minor = parseInt(majorMinor[1], 10); 
				self.revisionStr = descParts[3];
				self.revision = parseRevisionStrToInt(self.revisionStr);
				self.installed = true;
			}
		}else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){
			var version = -1;
			for(var i=0; i<activeXDetectRules.length && version==-1; i++){
				var obj = getActiveXObject(activeXDetectRules[i].name);
				if(typeof obj == "object"){
					self.installed = true;
					version = activeXDetectRules[i].version(obj);
					if(version!=-1){
						var versionObj = parseActiveXVersion(version);
						self.major = versionObj.major;
						self.minor = versionObj.minor; 
						self.revision = versionObj.revision;
						self.revisionStr = versionObj.revisionStr;
						self.activeXVersion = version;
					}
				}
			}
		}
	}();
};
FlashDetect.release = "1.0.2";

// Widget //

function showWidget() {
	if(!FlashDetect.installed){
		document.write('<a href="http://www.nationalgeographic.com/download/flash"><img src="images/widget_non_flash.jpg" alt="Mysteries of the Ancient World Widgit. Please install flash." hspace="0" vspace="0" border="0" width="300" height="250" /></a>');
	} else {
		document.write('<scr'+'ipt type="text/javascript" src="http://widgets.clearspring.com/o/4807c30cd182b553/4808cd789ed314d9/4807c30cd182b553/16890061/widget.js"></scr'+'ipt>');
	}
}

// Other flash objects using ngsEmbed

ngsEmbed.flash({ 	
	src: "/history/ancient/lost-tombs/flash/videoplayer.swf", 
	width: "482",
	height: "408",			
	version:"8",
	wmode:"transparent",
	flashvars: "videoID=1566340692"
	}, "lost-tombs-video","lost-tombs-video-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/lost-tombs/flash/videoplayer.swf", 
	width: "482",
	height: "408",			
	version:"8",
	wmode:"transparent",
	flashvars: "videoID=1566340692"
	}, "lost-tombs-video-1","lost-tombs-video-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/lost-tombs/flash/videoplayer.swf", 
	width: "482",
	height: "408",			
	version:"8",
	wmode:"transparent",
	flashvars: "videoID=1566340199"
	}, "lost-tombs-video-2","lost-tombs-video-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/lost-tombs/flash/videoplayer.swf", 
	width: "482",
	height: "408",			
	version:"8",
	wmode:"transparent",
	flashvars: "videoID=1566340193"
	}, "lost-tombs-video-3","lost-tombs-video-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/lost-tombs/flash/videoplayer.swf", 
	width: "482",
	height: "408",			
	version:"8",
	wmode:"transparent",
	flashvars: "videoID=1566340685"
	}, "lost-tombs-video-4","lost-tombs-video-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/lost-tombs/flash/videoplayer.swf", 
	width: "482",
	height: "408",			
	version:"8",
	wmode:"transparent",
	flashvars: "videoID=1566340188"
	}, "lost-tombs-video-5","lost-tombs-video-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/lost-tombs/flash/video-slider-4column.swf", 
	width: "482",
	height: "151",			
	version:"8",
	wmode:"transparent",
	flashvars: "xmlLocation=/history/ancient/lost-tombs/xml/feed.xml&iconLocation=/history/ancient/lost-tombs/images/"
	}, "lost-tombs-carousel","lost-tombs-carousel-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/flash/am_flash.swf", 
	width: "598",
	height: "420",			
	version:"8",
	wmode:"transparent",
	flashvars: "xmlFeed=flash/data.xml"
	}, "mysteries-ancient-world","mysteries-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/interactive/zoomifyViewer.swf", 
	width: "806",
	height: "500",			
	version:"8",
	wmode:"transparent",
	flashvars: "zoomifyImagePath=http://www3.nationalgeographic.com/history/ancient/interactives/treasury/Treasury_Zoomify&zoomifyClickZoom=1&zoomifyNavWindow=0&zoomifyZoom=4"
	}, "petra-1","petra-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/interactive/zoomifyViewer.swf", 
	width: "806",
	height: "500",			
	version:"8",
	wmode:"transparent",
	flashvars: "zoomifyImagePath=http://www3.nationalgeographic.com/history/ancient/interactives/jebel-haroun/jebel_haroun_zoomify&zoomifyClickZoom=1&zoomifyNavWindow=0&zoomifyZoom=10"
	}, "petra-2","petra-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/interactive/zoomifyViewer.swf", 
	width: "806",
	height: "500",			
	version:"8",
	wmode:"transparent",
	flashvars: "zoomifyImagePath=http://www3.nationalgeographic.com/history/ancient/interactives/high-place/High_Place_zoomify_img&zoomifyClickZoom=1&zoomifyNavWindow=0&zoomifyZoom=3"
	}, "petra-3","petra-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/interactive/zoomifyViewer.swf", 
	width: "806",
	height: "500",			
	version:"8",
	wmode:"transparent",
	flashvars: "zoomifyImagePath=http://www3.nationalgeographic.com/history/ancient/interactives/treasury-by-candlelight/Treasury_at_night_zoomify&zoomifyClickZoom=1&zoomifyNavWindow=0&zoomifyZoom=12"
	}, "petra-4","petra-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/interactive/zoomifyViewer.swf", 
	width: "806",
	height: "500",			
	version:"8",
	wmode:"transparent",
	flashvars: "zoomifyImagePath=http://www3.nationalgeographic.com/history/ancient/interactives/monastery/Petra_Monastery_Zoomify&zoomifyClickZoom=1&zoomifyNavWindow=0&zoomifyZoom=5"
	}, "petra-5","petra-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/interactive/zoomifyViewer.swf", 
	width: "806",
	height: "500",			
	version:"8",
	wmode:"transparent",
	flashvars: "zoomifyImagePath=http://www3.nationalgeographic.com/history/ancient/interactives/lion-tomb/Lion_Tomb_Zoomify&zoomifyClickZoom=1&zoomifyNavWindow=0&zoomifyZoom=10"
	}, "petra-6","petra-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/interactive/zoomifyViewer.swf", 
	width: "806",
	height: "500",			
	version:"8",
	wmode:"transparent",
	flashvars: "zoomifyImagePath=http://www3.nationalgeographic.com/history/ancient/interactives/inside-treasury/Petra_Treasury_Inside_img/&zoomifyClickZoom=1&zoomifyNavWindow=0&zoomifyZoom=10"
	}, "petra-7","petra-replace");

ngsEmbed.flash({ 	
	src: "/history/ancient/flash/herods-map.swf", 
	width: "580",
	height: "332",			
	version:"8",
	wmode:"transparent",
	flashvars: "xmlFeed=/history/ancient/flash/herods-data.xml"
	}, "herods-map","herods-map-replace");

-->
