<!--
/* 
 * Don't forget !!!!!
 
 * inlcude this into the *.html: <script src="http://dev.virtualearth.net/mapcontrol/v5/mapcontrol.js"></script>
 * this is needed to start and controll the Map
 * 
 */

document.write("<SCRIPT LANGUAGE='JavaScript1.5' " +
		"SRC='extentions.js' TYPE='text/javascript'><\/SCRIPT>");
	
	
function DrawMap ( )
{
	map = DrawMap_();

		// loading the points

	var pushpins = new Array();
	pushpins = GetPushpinData ();
	
	DrawPushpins ( map, pushpins );
}

	

function DrawMap_ ( map ) // Drawing the googlemap 
{

	try
	{
		if (GBrowserIsCompatible()) 
		{
        	var map = new GMap2(document.getElementById("MyMap"));
        	map.addControl(new GOverviewMapControl());
	        map.addControl(new GLargeMapControl());
	        map.addControl(new GMapTypeControl());
	        map.addControl(new GScaleControl());
	        
	        map.setCenter(new GLatLng(lat, long), zoom);
      	}
      	else
      	{
      		throw("incompatible browser");
      	}
		
		return map;
	} 
	catch( x )
	{
		alert("error loading map " .x );
	}	 
}

function GetIcon (Level )
{
	// Create our "tiny" marker icon
	var icon = new GIcon();
	
	
	//icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
	
	if ( Level == "0" )
	{
		icon.image = "png/level1.png";
	}
	else if ( Level == "1" )
	{
		icon.image = "png/level2.png";
	}
	else if ( Level == "2" )
	{
		icon.image = "png/level3.png";
	}
	else
	{
		icon.image =  "png/level1.png" ;	    	
	}
	
	icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	icon.iconSize = new GSize(12, 20);
	icon.shadowSize = new GSize(22, 20);
	icon.iconAnchor = new GPoint(6, 20);
	icon.infoWindowAnchor = new GPoint(5, 1);
	
	return icon;
	
}
	
function CreateMarker ( map, icon, text, point)
{
	var marker = new GMarker(point, icon);
	GEvent.addListener(marker, "click", function(){marker.openInfoWindowHtml(text)});
	//GEvent.addListener(marker, "mouseover", function(){marker.openInfoWindowHtml(text)});
	map.addOverlay(marker);
}	
	
function DrawPushpins ( map, pushpins )
{	    
  	

	for ( var i = 0; pushpins[i] != '\0'; i++ )
	{
			
		var point =pushpins[i].LatLong;
		var icon = GetIcon(pushpins[i].Level);
		
/*			making popuptext	
		var title = pushpins[i].Name + "<br/>"  + pushpins[i].Company;
		
		var description = pushpins[i].State + " , " + pushpins[i].Zip + "," 
					+ pushpins[i].Country + "<br/><br/>" + 
					"<a href=./showtherapist.asp?uid="+pushpins[i].UID+"><b>Visit my EEG Directory listing for more information</b></a>"
					+ "<br/><br/><a href=VirtualEarth_fullscreen.htm target=\"_blank\"><b>Full page map</b>"
					+ "<br/><br/><a href=\"http://maps.live.com/default.aspx?where1="+pushpins[i].Address+"&v=2\"><b>Map with my detailed address</b>";
		
	    shape.SetTitle(title);
	    shape.SetDescription(description);
*/
		var popuptext = 	"<p><b>"+pushpins[i].Name+"<br/>"+pushpins[i].Company+"</b>"+
							pushpins[i].State+" , "+pushpins[i].Zip+" , "+pushpins[i].Country+"<br/><br/>"+
							"<a href=./showtherapist.asp?uid="+pushpins[i].UID+"><b>Visit my EEG Directory listing for more information</b></a>"+
							"<br/><a href=map_"+home+"_fullscreen.html target=\"_blank\"><b>Full page map</b>"+
							"<br/><a href=\"http://maps.google.com/maps?f=q&hl=en&geocode=&q="+pushpins[i].Address+"&ie=UTF8&z=15&iwloc=addr&om=1\"><b>Map with my detailed address</b>";
							
	    
		CreateMarker(map,icon,popuptext,point);
	}
}


//-->
