/*--------------------------------------------------------------------

		TRAVELMUSE FLASH MAP
		version: 1.1
		(c) 2008 TravelMuse, inc.
----------------------------------------------------------------------*/

/**
 * Draw the map based on the coordinates and location name. Detect whether 
 * map is loaded and returns status.
 */
 var TravelMuse = {
 	
	mapLoaded : function() {
		return (typeof this.getFlashMap("TravelMuseMap") != "undefined");
	},
	
	drawLocationMap : function(latitude,longitude,locationName){
		var map = this.getFlashMap("TravelMuseMap");
		map.drawMap(latitude,longitude,locationName);
	},

	/**
	 * Retrieve the travel time. 
	 * Available return types: "hours", "hoursRounded" and "miles".
	 * defaults to "hours".
	 *
	 */
	getTravelTime : function(returnType){
		var map = this.getFlashMap("TravelMuseMap");
		var timeUnit = (returnType == "hoursRounded")? "travelTimeHoursRounded" : 
				(returnType == "miles")? "travelTimeMiles" : "travelTimeHours";
		return map.GetVariable(timeUnit);
	},

	/**
	 * Return a Flash object referenced by name
	 */
	getFlashMap : function(mapSWFID){
		var map = document.getElementsByName(mapSWFID)[0];
		if(typeof(map)=="function" && navigator.vendor.indexOf('Apple')==-1){
			return document.getElementsByName(mapSWFID)[1];
		}else{
			return map;	
		}
	}
 }