// JavaScript Document
site = (function() {
	
	function setLocation (hash) {
		console.log('settingLocation: ' + hash);
		window.location.hash = hash;	
		location = getLocation();
	}
	
	function getLocation () {
		return window.location.hash.substring(1);
	}
	
	function confirmLocation(theme, section) {
		console.log("Confirm Theme: ", theme, "Section:", section);	
	}
	
	function checkLocation() {
		if(location != getLocation()) {
			
			location = getLocation();
			
			console.log("Hash changed: " + location);
			
			if (navigator.appName.indexOf("Microsoft") != -1) {
            	 var movie =  window["container"];
			 } else {
				 var movie =  document["container"];
			 }
			 movie.locationChanged(location);
		}
	}
	
	//private
	var location = getLocation();
	setInterval(checkLocation, 1000);
	
	//public
	return {
		setLocation: setLocation,
		getLocation: getLocation,
		flashPage: confirmLocation
	};
	
})();
