var map;
var geocoder = null;

function loadMap() {
	if (!window.GBrowserIsCompatible) return;
	if (GBrowserIsCompatible()) {      
		map = new GMap2(document.getElementById("map"));
                map.setCenter(new GLatLng(37.0625,-95.677068),3);
                map.setUIToDefault();
				var markers=initializeSchoolMarkers();
                for (var i in markers)
				{
					map.addOverlay(markers[i]);
				} 
    }
}

function initializeSchoolMarkers() {
	var point;
    point=new GLatLng(33.88767,-118.064179);
    gMarker1=new GMarker(point);
    gMarker1.bindInfoWindowHtml('<strong>Cerritos College</strong><br /> 17110 A londra Blvd.<br /> Norwalk, CA 90650-6298<br /><a href="http://cms.cerritos.edu/auto">Website</a>');

    point=new GLatLng(35.599434,-97.638667);
    gMarker2=new GMarker(point);
    gMarker2.bindInfoWindowHtml('<strong>Francis Tuttle Technology Center</strong><br /> 12777 N Rockwell Ave.<br /> Oklahoma City, OK 73142-2789<br /><a href="http://www.francistuttle.com/classes/ctp/details.aspx?PRGID=18">Website</a>');

    point=new GLatLng(42.59151,-87.915136);
    gMarker3=new GMarker(point);
    gMarker3.bindInfoWindowHtml('<strong>Gateway Technical College</strong><br /> 4940 - 88th Avenue<br /> Kenosha, WI 53144<br /><a href="http://www.gtc.edu/page.asp?q=235">Website</a>');

    point=new GLatLng(38.832479,-104.787741);
    gMarker4=new GMarker(point);
    gMarker4.bindInfoWindowHtml('<strong>IntelliTec College Colorado</strong><br /> 2315 E. Pikes Peak Ave.<br /> Colorado Springs, CO 80909<br /><a href="http://www.intelliteccollege.edu/CS_AutomotiveTechnician.htm">Website</a>');

    point=new GLatLng(33.37312,-86.992105);
    gMarker5=new GMarker(point);
    gMarker5.bindInfoWindowHtml('<strong>Lawson State Community College</strong><br /> 1100 9th Avenue<br /> S.W. Bessemer, AL 35022<br /><a href="http://www.acaue.org/">Website</a>');

    point=new GLatLng(43.785673,-88.421694);
    gMarker6=new GMarker(point);
    gMarker6.bindInfoWindowHtml('<strong>Moraine Park Technical College</strong><br /> 235 North National Avenue<br /> Fond du Lac, WI 54936-1940<br /><a href="http://www.morainepark.edu/pages/342.asp">Website</a>');

    point=new GLatLng(41.714752,-71.445637);
    gMarker7=new GMarker(point);
    gMarker7.bindInfoWindowHtml('<strong>New England Institute of Technology</strong><br /> 2500 Post Road<br /> Warwick, RI 02886-2266<br /><a href="http://cti.neit.edu/index.cfm?pg=404&title=Snap-On-Center">Website</a>');

    point=new GLatLng(40.759349,-84.14725);
    gMarker8=new GMarker(point);
    gMarker8.bindInfoWindowHtml('<strong>University of Northwestern Ohio</strong><br /> 1441 N. Cable Road<br /> Lima, OH 45805<br /><a href="http://www.unoh.edu/academics/collegetechnologies/automotive_technology.shtml">Website</a>');

    point=new GLatLng(36.724038,-76.293144);
    gMarker9=new GMarker(point);
    gMarker9.bindInfoWindowHtml('<strong>Tidewater CC</strong><br /> 1428 Cedar Rd<br /> Chesapeake, VA 23322<br /><a href="http://www.tcc.edu">Website</a>');

    point=new GLatLng(39.369333,-87.38857);
    gMarker10=new GMarker(point);
    gMarker10.bindInfoWindowHtml('<strong>Ivy Tech Community College</strong><br /> 7999 S.U.S. Highway 41<br /> Terre Haute, IN 47802-4898<br /><a href="http://www.ivytech.edu/schools/technology/automotive-tech/index.html">Website</a>');

    point=new GLatLng(41.916429,-91.656409);
    gMarker11=new GMarker(point);
    gMarker11.bindInfoWindowHtml('<strong>Kirkwood Community College</strong><br /> 6301 kirkwood Blvd.<br /> S.W. Cedar Rapids, IA 52406<br /><a href="http://www.kirkwood.edu/site/index.php?d=466">Website</a>');

    point=new GLatLng(41.364868,-105.587786);
    gMarker12=new GMarker(point);
    gMarker12.bindInfoWindowHtml('<strong>Wyotech - Laramie Campus</strong><br /> 4373 North 3rd St.<br /> Laramie, WY 82072<br /><a href="http://www.wyotech.edu/campus/laramie">Website</a>');

    point=new GLatLng(43.921295,-87.753368);
    gMarker13=new GMarker(point);
    gMarker13.bindInfoWindowHtml('<strong>Lakeshore Technical College</strong><br /> 1290 North Ave.<br /> Cleveland, WI 53015<br /><a href="http://gotoltc.edu/programs/automain_index.php">Website</a>');

    point=new GLatLng(44.512994,-88.0334);
    gMarker14=new GMarker(point);
    gMarker14.bindInfoWindowHtml('<strong>Northeast Wisconsin Technical College</strong><br /> 2740 West Mason St.<br /> Green Bay, WI 54307-9042<br /> <a href="http://www.nwtc.edu/academics/degrees/auto_transport/automotive/snapon_certification/Pages/Home.aspx">Website</a>');

    var gMarkers=new Array(gMarker1,gMarker2,gMarker3,gMarker4,gMarker5,gMarker6,gMarker7,gMarker8,
                       gMarker9,gMarker10,gMarker11,gMarker12,gMarker13,gMarker14);
    return gMarkers;
}

function handleErrors(){
	if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
		alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
	else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	    alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
	   
	else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	    alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

	//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
	     
	else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	    alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

	else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	    alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	    
	else alert("An unknown error occurred.");
}

function onGDirectionsLoad(){ 
	// Use this function to access information about the latest load()
    // results.

    // e.g.
	// document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	// and yada yada yada...
}
