function mapLoader(coord1, coord2, id) {
    var latlng = new google.maps.LatLng(parseFloat(coord1), parseFloat(coord2));
    var myOptions = {
      zoom: 15,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
	  mapTypeControl: true,
      mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
      navigationControl: true,
      navigationControlOptions: {style: google.maps.NavigationControlStyle.DEFAULT}
    };
	
    var map = new google.maps.Map(document.getElementById(id), myOptions);	
	
	var marker = new google.maps.Marker({
        position: latlng, 
        map: map,
        title:"Finally."
    });  
	
}

function guideLoader(coord1, coord2, id, markers, storeInfo) {
	
	//var store = [];
	var tempMarker = [];
    //var pointerImg = []; 
	
	if (storeInfo[0] == "Distinct Living" && storeInfo[1] == undefined)
		var templatlng = new google.maps.LatLng(parseFloat(coord1), parseFloat(coord2));
	
	if (storeInfo[1] != undefined)
		var templatlng = new google.maps.LatLng(43.665016, -79.394044);
	
	if (storeInfo[0] != "Distinct Living" && storeInfo[1] == undefined) 
		var templatlng = new google.maps.LatLng(parseFloat(coord1), parseFloat(coord2));
		
	var tempmyOptions = {
	  zoom: 13,
      center: templatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
	  mapTypeControl: true,
      mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
      navigationControl: true,
      navigationControlOptions: {style: google.maps.NavigationControlStyle.DEFAULT}
    };
	
    guidemap = new google.maps.Map(document.getElementById(id), tempmyOptions);	
	
	var j = 0; 
	var num = 0;
	var imgCount = 1; 
	
	while (markers[num] != undefined)	{
	
		//store[j] = new google.maps.LatLng(parseFloat(markers[num]), parseFloat(markers[++num]));
		
		pointerImg = new google.maps.MarkerImage('images/mapicons/purple'+ imgCount +'.png',
			new google.maps.Size(25,25),
			new google.maps.Point(0,0)
			//new google.maps.Point(50,50)
		);
	
		tempMarker[j] = new google.maps.Marker({
			//position: store[j],
			position: new google.maps.LatLng(parseFloat(markers[num]), parseFloat(markers[++num])), 
			map: guidemap, 
			icon: pointerImg, 
			title: storeInfo[j]
		});
	
	j++;
	num++;
	imgCount++;
	
	}
	
}


function CustomMarker(markers,map) {
	this.div = new Array();
	this.markers = markers;
	this.setMap(map);
}

CustomMarker.prototype = new google.maps.OverlayView();

CustomMarker.prototype.draw = function() {
	var i = 0;
	var num = 0;
	
	var fulldiv = this.div;
	var div;
		
	while (this.markers[num]!=undefined) {
	    latlng=new google.maps.LatLng(parseFloat(this.markers[num]),parseFloat(this.markers[++num]));	
    	
		div = fulldiv[i];
		
		if (!div){
	    	div = this.div[i] = document.createElement('DIV');
			// Create the DIV representing our CustomMarker
    		div.style.border = "none";
		    div.style.position = "absolute";
    		div.style.paddingLeft = "0px";

	    	var img = document.createElement("img");
		    img.src = 'images/mapicons/purple'+(i+1)+'.png';
    		div.appendChild(img);
		
		    // Then add the overlay to the DOM
    		var panes = this.getPanes();
	    	panes.overlayImage.appendChild(div);
		}

    	// Position the overlay 
	    var point = this.getProjection().fromLatLngToDivPixel(latlng);
	
    	if (point) {
	      div.style.left = (point.x-27) + 'px';
    	  div.style.top =  (point.y-27) + 'px';
    	}
		
		i++;
		num++;
	}
};
  
function guideLoader2(coord1, coord2, id, markers, storeInfo) {
	var overlay;
	var guidemap;
	
	if (storeInfo[0] == "Distinct Living" && storeInfo[1] == undefined)
		var templatlng = new google.maps.LatLng(parseFloat(coord1), parseFloat(coord2));
	
	if (storeInfo[1] != undefined)
		var templatlng = new google.maps.LatLng(43.665016, -79.394044);
	
	if (storeInfo[0] != "Distinct Living" && storeInfo[1] == undefined) 
		var templatlng = new google.maps.LatLng(parseFloat(coord1), parseFloat(coord2));
		
	var tempmyOptions = {
	  zoom: 13,
      center: templatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
	  mapTypeControl: true,
      mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
      navigationControl: true,
      navigationControlOptions: {style: google.maps.NavigationControlStyle.DEFAULT}
    };
	
	guidemap = new google.maps.Map(document.getElementById(id), tempmyOptions);	
	
    overlay = new CustomMarker(markers,guidemap);
		
}
	

