﻿function launchMap(direction, address){
	var url = "http://maps.yahoo.com/beta/index.php#mvt=m&maxp=search&"
	if (direction == "to"){
		url += "q2"
	} else {
		url += "q1"
	}
	url += "="+ address +"&mag=3"
	var oWindow = window.open(url, "map", "width=800,height=600,resizable=1,scrollbars=1,location=1,titlebar=1", true);
	oWindow.focus();
}
function YLoad(mapId, latitude, longitude, markerText){
	if (latitude == 0 || latitude == -1) {
		document.getElementById("mapContainer").style.display = "none";
		
	} else {
		document.getElementById("mapContainer").style.display = "block";
		
		// Create a lat/lon object
		var myPoint = new YGeoPoint(latitude, longitude);
		
		// Create a map object 
		var map = new YMap(document.getElementById(mapId));
		
		// Display the map centered on a latitude and longitude and resize
		map.drawZoomAndCenter(myPoint, 4);
		map.resizeTo(new YSize(290, 290));
		
		// Add a slider zoom control 
		map.addZoomShort(); 
		
		var marker = new YMarker(myPoint); 
		
		// Add a label to the marker
		marker.addLabel('<div style="padding:4px 0 0 5px;">+</div>'); 
		var markerText = '<div style="font-size:smaller; width:130px;">'+ markerText +'</div>'
		
		// Add auto expand
		marker.addAutoExpand(markerText);
		
		// Call onSmartWinEvent when the user clicks on the marker
		YEvent.Capture(marker, EventsList.MouseClick, function (){map.showSmartWindow(myPoint, markerText)});

		//map.showSmartWindow(myPoint,"some information");
		map.addOverlay(marker);
	}
	
}
