var map;
var markers;
var baseIcon;

var lotOne, lotTwo, lotThree, lotFive, lotEight, lotNine, lotTen, lotEleven, lotThirteen, lotFourteen, lotFifteen, lotSixteen, lotSeventeen, lotEighteen, lotTwenty, lotTwentyFour, lotTwentySix, lotTwentySeven, lotTwentyEight, lotThirty, lotThirtyOne, lotThirtyTwo, lotThirtyThree, lotThirtySix, lotThirtyNine, lotFourtyOne, garageFour, garageSix, garageSeven, garageTwelve, garageNineteen, garageTwentyOne, garageTwentyTwo, garageTwentyThree, garageTwentyFive, garageTwentyNine, garageThirtyFour, garageThirtyFive, garageThirtySeven, garageThirtyEight, garageForty;

var DS_BASE_URL = location.protocol + "//" + location.hostname;

function initializePoint(pointData) {
	var visible = false;
	var point   = new GLatLng(pointData.lat, pointData.lon);
	
	var letteredIcon = new GIcon(baseIcon);
    letteredIcon.image = "/images/map_markers/" + pointData.cat + ".png";
    
    // Set up our GMarkerOptions object
    markerOptions = { icon:letteredIcon };
    var marker = new GMarker(point, markerOptions);
    
	var focusPoint = function() {
	    
	    var content = '<div class="popup">';
        content += '<h1>' + pointData.name + '</h1>';
        content += '<p>' + pointData.street + '<br />';
        content += '    ' + pointData.city + ', ' + pointData.state + ' ' + pointData.zip;
        content += '</p>';
        
        if (pointData.phone != '')
        {
            content += '<p>' + pointData.phone + '</p>';
        }
        
        content += '<p><a href="' + DS_BASE_URL + '/index.php/browse/entry/' + pointData.id + '">more info &gt;</a></p>';
        
        if (pointData.url != '' && pointData.url != 'http://')
        {
            content += '<p><a href="' + pointData.url + '">' + pointData.url + '</a></p>';
        }
        
        content += '</div>';
	    
		marker.openInfoWindowHtml(content);
		//map.panTo(point);
		return false;
	}
	
	GEvent.addListener(marker, 'click', focusPoint);
	
	pointData.show = function() {
		if (!visible) {
			map.addOverlay(marker);
			visible = true;
		}
	}
	
	pointData.hide = function() {
		if (visible) {
			map.removeOverlay(marker);
			visible = false;
		}
	}
}


function toggleMarkers(type) { 
	markers.each(function(marker){
        if (marker.cat == type.value) {
	        if (type.checked == true) {
		        marker.show(); 
		    } else { 
			    marker.hide(); 
			}
		}
	});
}


function toggleLots(chkbox) {
	if (chkbox.checked == true) 
	{
		map.addOverlay(lotOne);
		map.addOverlay(lotTwo); 
		map.addOverlay(lotThree); 
		map.addOverlay(lotFive); 
		map.addOverlay(lotEight); 
		map.addOverlay(lotNine); 
		map.addOverlay(lotTen); 
		map.addOverlay(lotEleven); 
		map.addOverlay(lotThirteen); 
		map.addOverlay(lotFourteen); 
		map.addOverlay(lotFifteen); 
		map.addOverlay(lotSixteen); 
		map.addOverlay(lotSeventeen); 
		map.addOverlay(lotEighteen); 
		map.addOverlay(lotTwenty); 
		map.addOverlay(lotTwentyFour); 
		map.addOverlay(lotTwentySix); 
		map.addOverlay(lotTwentySeven); 
		map.addOverlay(lotTwentyEight); 
		map.addOverlay(lotThirty); 
		map.addOverlay(lotThirtyOne); 
		map.addOverlay(lotThirtyTwo); 
		map.addOverlay(lotThirtyThree); 
		map.addOverlay(lotThirtySix); 
		map.addOverlay(lotThirtyNine); 
		map.addOverlay(lotFourtyOne); 
	} else { 
		map.removeOverlay(lotOne);
		map.removeOverlay(lotTwo); 
		map.removeOverlay(lotThree); 
		map.removeOverlay(lotFive); 
		map.removeOverlay(lotEight); 
		map.removeOverlay(lotNine); 
		map.removeOverlay(lotTen); 
		map.removeOverlay(lotEleven); 
		map.removeOverlay(lotThirteen); 
		map.removeOverlay(lotFourteen); 
		map.removeOverlay(lotFifteen); 
		map.removeOverlay(lotSixteen); 
		map.removeOverlay(lotSeventeen); 
		map.removeOverlay(lotEighteen); 
		map.removeOverlay(lotTwenty); 
		map.removeOverlay(lotTwentyFour); 
		map.removeOverlay(lotTwentySix); 
		map.removeOverlay(lotTwentySeven); 
		map.removeOverlay(lotTwentyEight); 
		map.removeOverlay(lotThirty); 
		map.removeOverlay(lotThirtyOne); 
		map.removeOverlay(lotThirtyTwo); 
		map.removeOverlay(lotThirtyThree); 
		map.removeOverlay(lotThirtySix); 
		map.removeOverlay(lotThirtyNine); 
		map.removeOverlay(lotFourtyOne);
	}
}


function toggleGarages(chkbox) { 
	if (chkbox.checked == true) 
	{
		map.addOverlay(garageFour); 
		map.addOverlay(garageSix); 
		map.addOverlay(garageSeven); 
		map.addOverlay(garageTwelve); 
		map.addOverlay(garageNineteen); 
		map.addOverlay(garageTwentyOne); 
		map.addOverlay(garageTwentyTwo); 
		map.addOverlay(garageTwentyThree); 
		map.addOverlay(garageTwentyFive); 
		map.addOverlay(garageTwentyNine); 
		map.addOverlay(garageThirtyFour); 
		map.addOverlay(garageThirtyFive); 
		map.addOverlay(garageThirtySeven); 
		map.addOverlay(garageThirtyEight); 
		map.addOverlay(garageForty);
	} else { 
		map.removeOverlay(garageFour); 
		map.removeOverlay(garageSix); 
		map.removeOverlay(garageSeven); 
		map.removeOverlay(garageTwelve); 
		map.removeOverlay(garageNineteen); 
		map.removeOverlay(garageTwentyOne); 
		map.removeOverlay(garageTwentyTwo); 
		map.removeOverlay(garageTwentyThree); 
		map.removeOverlay(garageTwentyFive); 
		map.removeOverlay(garageTwentyNine); 
		map.removeOverlay(garageThirtyFour); 
		map.removeOverlay(garageThirtyFive); 
		map.removeOverlay(garageThirtySeven); 
		map.removeOverlay(garageThirtyEight); 
		map.removeOverlay(garageForty);
	}
}


function initialize(){
	// display default map
	if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_google"));
        map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(43.047690777845325,-76.15126132965088), 15);
		
		// Create a base icon for all of our markers that specifies the
        // shadow, icon dimensions, etc.
        
        baseIcon = new GIcon();
        baseIcon.shadow = "/images/map_markers/shadow.png";
        baseIcon.iconSize = new GSize(15, 26);
        baseIcon.shadowSize = new GSize(29, 27);
        baseIcon.iconAnchor = new GPoint(7, 25);
        baseIcon.infoWindowAnchor = new GPoint(9, 2);
        baseIcon.infoShadowAnchor = new GPoint(18, 25);
		
		
		var perimeter = new GPolygon([
                new GLatLng(43.05444889998222  ,-76.15811705589294), 
                new GLatLng(43.05461353171698  , -76.1578381061554), 
                new GLatLng(43.05471544637893  ,-76.15748405456543), 
                new GLatLng(43.054762483858084 ,-76.15703344345093), 
                new GLatLng(43.05467624845207  ,-76.15655064582825), 
                new GLatLng(43.054535135707916 ,-76.15534901618958), 
                new GLatLng(43.0543156263493860,-76.15394353866577), 
                new GLatLng(43.05426074888699  ,-76.15367531776428), 
                new GLatLng(43.054088276542615 ,-76.15276336669922), 
                new GLatLng(43.05393932276391  , -76.1522376537323), 
                new GLatLng(43.05378252892183  , -76.1517870426178), 
                new GLatLng(43.05349245925712  ,-76.15116477012634), 
                new GLatLng(43.05295151486606  ,-76.15015625953674), 
                new GLatLng(43.052606562328165 ,-76.14956617355347), 
                new GLatLng(43.052261607850006 , -76.1488687992096), 
                new GLatLng(43.05204209035371  ,-76.14838600158691), 
                new GLatLng(43.05192449137177  ,-76.14812850952148), 
                new GLatLng(43.0517833722958   ,-76.14767789840698), 
                new GLatLng(43.05170497266887  , -76.1472487449646), 
                new GLatLng(43.05149329317548  ,-76.14590764045715), 
                new GLatLng(43.051422733182015 ,-76.14555358886719), 
                new GLatLng(43.051344333094036 ,-76.14519953727722), 
                new GLatLng(43.051211052714535 ,-76.14481329917908), 
                new GLatLng(43.05106209194759  ,-76.14442706108093), 
                new GLatLng(43.05092097088731  , -76.1441695690155), 
                new GLatLng(43.05074848915043  ,-76.14391207695007), 
                new GLatLng(43.05058384704004  ,-76.14365458488464), 
                new GLatLng(43.05044272487934  ,-76.14345073699951), 
                new GLatLng(43.050262401645924 ,-76.14328980445862), 
                new GLatLng(43.05005071717372  ,-76.14306449890137), 
                new GLatLng(43.049956634951556 ,-76.14296793937683), 
                new GLatLng(43.04955678389739  , -76.1427104473114), 
                new GLatLng(43.04921181226591  ,-76.14251732826233), 
                new GLatLng(43.048811956356175 ,-76.14238858222961), 
                new GLatLng(43.04860810724216  , -76.1423671245575), 
                new GLatLng(43.04747124398945  ,-76.14237785339355), 
                new GLatLng(43.04444473290082  ,-76.14235639572144), 
                new GLatLng(43.04260209473415  ,-76.14233493804932), 
                new GLatLng(43.04263345925105  ,-76.14399790763855), 
                new GLatLng(43.042641300377774 ,-76.14486694335938), 
                new GLatLng(43.042649141503475 ,-76.14574670791626), 
                new GLatLng(43.042641300377774 ,-76.14754915237427), 
                new GLatLng(43.04265698262818  ,-76.15087509155273), 
                new GLatLng(43.04268050599633  ,-76.15151882171631), 
                new GLatLng(43.042398224983444 ,-76.15276336669922), 
                new GLatLng(43.04231981336048  ,-76.15321397781372), 
                new GLatLng(43.042296289854065 ,-76.15353584289551), 
                new GLatLng(43.042311972192664 ,-76.15393280982971), 
                new GLatLng(43.04240606614024  ,-76.15429759025574), 
                new GLatLng(43.04244527190912  ,-76.15463018417358), 
                new GLatLng(43.04261777699461, -76.1553704738617),
                new GLatLng(43.04246879535842, -76.15808486938477),
                new GLatLng(43.04467995932147  ,-76.15856766700745), 
                new GLatLng(43.0470713767331   ,-76.15903973579407), 
                new GLatLng(43.047463403480066 ,-76.15902900695801), 
                new GLatLng(43.04774566118654  ,-76.15891098976135), 
                new GLatLng(43.048027917594176 ,-76.15888953208923), 
                new GLatLng(43.04871003188382  ,-76.15901827812195), 
                new GLatLng(43.049478381424244 ,-76.15917921066284), 
                new GLatLng(43.05005855735238  ,-76.15921139717102), 
                new GLatLng(43.05038784395138  ,-76.15917921066284), 
                new GLatLng(43.05189313160519  ,-76.15887880325317), 
                new GLatLng(43.052606562328165 ,-76.15871787071228), 
                new GLatLng(43.05346894003499  ,-76.15862131118774), 
                new GLatLng(43.0538844449648   ,-76.15854620933533), 
                new GLatLng(43.05415883346939  ,-76.15841746330261), 
                new GLatLng(43.054362664135226 ,-76.15825653076172), 
                new GLatLng(43.05444889998222  ,-76.15811705589294)
            ], "#ff0000", 3, .70, "#ff0000", 0.00);
			
			map.addOverlay(perimeter);
			
			// RED (Surface Lots)
			// 1:
			lotOne = new GPolygon([
				new GLatLng(43.05243800526874 , -76.1519855260849), 
				new GLatLng(43.05243408533161 , -76.15144371986389),
				new GLatLng(43.05293191534204 , -76.15147590637207), 
				new GLatLng(43.05347677977669 , -76.1515885591507),  
				new GLatLng(43.05349245925712 , -76.15195333957672), 
				new GLatLng(43.052888796367114, -76.15198016166687),
				new GLatLng(43.05243800526874 , -76.1519855260849) 
			], "#ff0000", 0, .70, "#ff0000", 0.65);
			
			// 2:                  
			lotTwo = new GPolygon([
				new GLatLng(43.05135217310736 , -76.15158319473267), 
				new GLatLng(43.051356093113654, -76.15086436271667), 
				new GLatLng(43.05185001189994 , -76.15087509155273), 
				new GLatLng(43.0522890474818  , -76.15123450756073), 
				new GLatLng(43.052304727265884, -76.15200161933899), 
				new GLatLng(43.0517833722958  , -76.15201234817505), 
				new GLatLng(43.05175985241825 , -76.15161001682281),
				new GLatLng(43.05135217310736 , -76.15158319473267)
			], "#ff0000", 0, .70, "#ff0000", 0.65);
			
			// 3:                  
			lotThree = new GPolygon([
				new GLatLng(43.050815129879005, -76.15402400493622), 
				new GLatLng(43.050807289797035, -76.15369141101837), 
				new GLatLng(43.050634807740465, -76.15368068218231), 
				new GLatLng(43.050626967635466, -76.15402400493622),
				new GLatLng(43.050815129879005, -76.15402400493622) 
	        ], "#ff0000", 0, .70, "#ff0000", 0.65);               
            
			// 5:                                                 
			lotFive = new GPolygon([                          
				new GLatLng(43.050391764019295, -76.15643262863159), 
				new GLatLng(43.05050544587973 , -76.15560114383698), 
				new GLatLng(43.049701828208505, -76.1556226015091 ),
				new GLatLng(43.04966654719143 , -76.15621268749237), 
				new GLatLng(43.050391764019295, -76.15643262863159)
	        ], "#ff0000", 0, .70, "#ff0000", 0.65);
			
			// 8:                                                 
			lotEight = new GPolygon([                         
				new GLatLng(43.049595985096374, -76.14723801612854), 
				new GLatLng(43.05033296297431 , -76.14720582962036), 
				new GLatLng(43.05032904290265 , -76.14647626876831), 
				new GLatLng(43.049595985096374, -76.1464387178421 ),
				new GLatLng(43.049595985096374, -76.14723801612854)
            ], "#ff0000", 0, .70, "#ff0000", 0.65);
			
			// 9:
			lotNine = new GPolygon([                                                      
				new GLatLng(43.05033296297431 , -76.1446738243103), 
				new GLatLng(43.05032904290265 , -76.14410519599915), 
				new GLatLng(43.04994879475987 , -76.14409983158112), 
				new GLatLng(43.04996839523722 , -76.14466309547424),
				new GLatLng(43.05033296297431 , -76.1446738243103)
			], "#ff0000", 0, .70, "#ff0000", 0.65);
			
            // 10:                                
			lotTen = new GPolygon([
				new GLatLng(43.04945094053496 , -76.15844964981079), 
				new GLatLng(43.049568544259714, -76.1556226015091), 
				new GLatLng(43.049305895630525, -76.1556226015091), 
				new GLatLng(43.04923141297877 , -76.15833163261414),
				new GLatLng(43.04945094053496 , -76.15844964981079) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);

			// 11:                                
			lotEleven = new GPolygon([
				new GLatLng(43.048784515168734, -76.15564405918121), 
				new GLatLng(43.048811956356175, -76.15679204463959), 
				new GLatLng(43.04919221154676 , -76.1567759513855),  
				new GLatLng(43.04919221154676 , -76.15563333034515),
				new GLatLng(43.048784515168734, -76.15564405918121) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);

			// 13:                                
			lotThirteen = new GPolygon([
				new GLatLng(43.04951366254954 , -76.15343391895294), 
				new GLatLng(43.049525422920134, -76.15235030651093), 
				new GLatLng(43.04926669424615 , -76.15235567092896), 
				new GLatLng(43.04927061438569 , -76.15343928337097),
				new GLatLng(43.04951366254954 , -76.15343391895294) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);

			// 14:                                
			lotFourteen = new GPolygon([
				new GLatLng(43.04939605871957 , -76.14942669868469), 
				new GLatLng(43.04875707396903 , -76.14942669868469), 
				new GLatLng(43.048764914313054, -76.14992022514343), 
				new GLatLng(43.04945878079028 , -76.14989876747131),
				new GLatLng(43.04939605871957 , -76.14942669868469) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);

			// 15:                                
			lotFifteen = new GPolygon([
				new GLatLng(43.049407819112716, -76.14909946918488), 
				new GLatLng(43.049407819112716, -76.14883124828339), 
				new GLatLng(43.04909812800772 , -76.14885807037354), 
				new GLatLng(43.04912164890603 , -76.1491048336029 ),
				new GLatLng(43.049407819112716, -76.14909946918488) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);               
                                                                  
			// 16:                                                
			lotSixteen = new GPolygon([                      
				new GLatLng(43.04864730904746 , -76.15763425827026), 
				new GLatLng(43.04863554850848 , -76.15729629993439), 
				new GLatLng(43.04806319955382 , -76.15710854530334), 
				new GLatLng(43.048059279337075, -76.15763425827026),
				new GLatLng(43.04864730904746 , -76.15763425827026)  
            ], "#ff0000", 0, .70, "#ff0000", 0.65);               
                                                                  
			// 17:                                                
			lotSeventeen = new GPolygon([                      
				new GLatLng(43.04793775249403 , -76.15811169147491), 
				new GLatLng(43.04789070978047 , -76.15692615509033), 
				new GLatLng(43.04761629323229 , -76.15686178207397), 
				new GLatLng(43.04762021347735 , -76.15811169147491),
				new GLatLng(43.04762021347735 , -76.15811169147491) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);               
                                                                  
			// 18:                                                
			lotEighteen = new GPolygon([                      
				new GLatLng(43.04754180852882 , -76.15693151950836), 
				new GLatLng(43.047290912020074, -76.15694761276245), 
				new GLatLng(43.04729483228593 , -76.15757524967194), 
				new GLatLng(43.04756533002391 , -76.157585978508  ),
				new GLatLng(43.04754180852882 , -76.15693151950836)
            ], "#ff0000", 0, .70, "#ff0000", 0.65);

			// 20:                                
			lotTwenty = new GPolygon([
				new GLatLng(43.04862770814791 , -76.15364849567413), 
				new GLatLng(43.04832193330435 , -76.15363240242004), 
				new GLatLng(43.04833761410265 , -76.15413665771484), 
				new GLatLng(43.04863946868838 , -76.15415275096893),
				new GLatLng(43.04862770814791 , -76.15364849567413) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);               
                                                                  
			// 24:                                                
			lotTwentyFour = new GPolygon([                      
				new GLatLng(43.04853754392944 , -76.14993631839752), 
				new GLatLng(43.04814160383589 , -76.14993095397949), 
				new GLatLng(43.04814160383589 , -76.15017771720886), 
				new GLatLng(43.048533623743026, -76.15017235279083),
				new GLatLng(43.04853754392944 , -76.14993631839752) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);               
                                                                  
			// 26:                                                
			lotTwentySix = new GPolygon([                      
				new GLatLng(43.046894963879566, -76.14284992218018), 
				new GLatLng(43.04609521924688 , -76.14284992218018), 
				new GLatLng(43.046252032741755, -76.14388525485992), 
				new GLatLng(43.04681655800402 , -76.14392280578613), 
				new GLatLng(43.046902804461595, -76.14502251148224), 
				new GLatLng(43.04704785504859 , -76.14500105381012), 
				new GLatLng(43.04705177532998 , -76.14431440830231), 
				new GLatLng(43.04735755650529 , -76.14429831504822), 
				new GLatLng(43.047349715981376, -76.14398181438446), 
				new GLatLng(43.04693416677974 , -76.14383161067963),
				new GLatLng(43.046894963879566, -76.14284992218018) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);

			// 27:
			lotTwentySeven = new GPolygon([                                
				new GLatLng(43.046844000071864, -76.15691006183624),
				new GLatLng(43.04621674974037 , -76.15560114383698),
				new GLatLng(43.04571102449035 , -76.15483403205872),
				new GLatLng(43.04536603122993 , -76.15443170070648),
				new GLatLng(43.04488774190945 , -76.1540561914444 ),
				new GLatLng(43.044405528409676, -76.15383088588715),
				new GLatLng(43.04463291410949 , -76.1543619632721 ),
				new GLatLng(43.0450484789004  , -76.15497887134552),
				new GLatLng(43.04538563317171 , -76.15582644939423),
				new GLatLng(43.04569142265252 , -76.15655601024628),
				new GLatLng(43.04587960003692 , -76.15679204463959),
				new GLatLng(43.046334359666055, -76.15695834159851),
				new GLatLng(43.046844000071864, -76.15691006183624)
            ], "#ff0000", 0, .70, "#ff0000", 0.65);

			// 28:                 
			lotTwentyEight = new GPolygon([
				new GLatLng(43.04694200735679 , -76.15370213985443), 
				new GLatLng(43.04623635141029 , -76.1537504196167 ), 
				new GLatLng(43.046252032741755, -76.15458190441132), 
				new GLatLng(43.04656173821639 , -76.1547589302063 ), 
				new GLatLng(43.0466989490028  , -76.15432441234589), 
				new GLatLng(43.0469380870684  , -76.15399718284607),
				new GLatLng(43.04694200735679 , -76.15370213985443) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);               
                                                                  
			// 30:                                                
			lotThirty = new GPolygon([                   
				new GLatLng(43.045620855984566, -76.15155637264252), 
				new GLatLng(43.045620855984566, -76.15085363388062), 
				new GLatLng(43.0451504094569  , -76.15141153335571), 
				new GLatLng(43.045318986544096, -76.15157783031464),
				new GLatLng(43.045620855984566, -76.15155637264252) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);

			// 31:                 
			lotThirtyOne = new GPolygon([
				new GLatLng(43.046040334429   , -76.1501133441925 ), 
				new GLatLng(43.04620498873537 , -76.15034401416779), 
				new GLatLng(43.04662838349385 , -76.15030646324158), 
				new GLatLng(43.04631867835566 , -76.14979147911072),
				new GLatLng(43.046040334429   , -76.1501133441925 )
            ], "#ff0000", 0, .70, "#ff0000", 0.65);   
                                                      
			// 32:                                    
			lotThirtyTwo = new GPolygon([         
				new GLatLng(43.04382921949895 , -76.15368068218231), 
				new GLatLng(43.04382921949895 , -76.15390062332153), 
				new GLatLng(43.04430751707224 , -76.15412592887878), 
				new GLatLng(43.04430751707224 , -76.1538952589035 ),
				new GLatLng(43.04382921949895 , -76.15368068218231)  
            ], "#ff0000", 0, .70, "#ff0000", 0.65);   
                                                      
			// 33:                                    
			lotThirtyThree = new GPolygon([       
				new GLatLng(43.04438592615473 , -76.15341246128082), 
				new GLatLng(43.044429051107365, -76.15245223045349), 
				new GLatLng(43.043911549674796, -76.15318715572357),
				new GLatLng(43.04438592615473 , -76.15341246128082) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);

			// 36:                                
			lotThirtySix = new GPolygon([
				new GLatLng(43.04285693096985 , -76.15009188652039), 
				new GLatLng(43.04375865068884 , -76.15007042884827), 
				new GLatLng(43.04378609412463 , -76.14956080913544), 
				new GLatLng(43.04402916402008 , -76.14956080913544), 
				new GLatLng(43.04401740259568 , -76.14894926548004), 
				new GLatLng(43.04284516932072 , -76.14897072315216),
				new GLatLng(43.04285693096985 , -76.15009188652039) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);               
                                                                  
			// 39:                                                
			lotThirtyNine = new GPolygon([                    
				new GLatLng(43.04417030093678 , -76.14742040634155), 
				new GLatLng(43.044150698606636, -76.14534974098206), 
				new GLatLng(43.043609671823134, -76.14556431770325), 
				new GLatLng(43.04362535382605 , -76.14740431308746),
				new GLatLng(43.04417030093678 , -76.14742040634155) 
            ], "#ff0000", 0, .70, "#ff0000", 0.65);               
                                                                  
			// 41:                                                
			lotFourtyOne = new GPolygon([                     
				new GLatLng(43.0442800738697  , -76.14272117614746), 
				new GLatLng(43.04300983220316 , -76.14274263381958), 
				new GLatLng(43.0429392624505  , -76.14348292350769), 
				new GLatLng(43.04340580542069 , -76.14344000816345), 
				new GLatLng(43.04361359232424 , -76.14324688911438), 
				new GLatLng(43.04419382372464 , -76.14323616027832),
				new GLatLng(43.0442800738697  , -76.14272117614746) 
			], "#ff0000", 0, .70, "#ff0000", 0.65);
			
			// PURPLE (Parking Garage)
			// 4:
			garageFour = new GPolygon([ 
				new GLatLng(43.05003111672266, -76.15861058235168),
				new GLatLng(43.050321202758546, -76.15658283233643),
				new GLatLng(43.049839031970926, -76.15647554397583),
				new GLatLng(43.04958814485858, -76.15848183631897),
				new GLatLng(43.05003111672266, -76.15861058235168)
			], "#ff0000", 0, .70, "#68228B", 0.65);
			
			// 6:
			garageSix = new GPolygon([ 
				new GLatLng(43.050164399666265, -76.1520391702652),
				new GLatLng(43.05020360047695, -76.15118622779846),
				new GLatLng(43.05005071717372, -76.1508160829544),
				new GLatLng(43.049674387419195, -76.1508321762085),
				new GLatLng(43.049686147758976, -76.15202844142914),
				new GLatLng(43.050164399666265, -76.1520391702652)
			], "#ff0000", 0, .70, "#68228B", 0.65);

			// 7:
			garageSeven = new GPolygon([
				new GLatLng(43.0504505650079, -76.14980220794678),
				new GLatLng(43.05020360047695, -76.14980220794678), 
				new GLatLng(43.05021144063604, -76.15014016628265), 
				new GLatLng(43.050454485071796, -76.15016162395477),
				new GLatLng(43.0504505650079, -76.14980220794678)
			], "#ff0000", 0, .70, "#68228B", 0.65);

			// 12:
			garageTwelve = new GPolygon([
				new GLatLng(43.04953718328849, -76.15539193153381),
				new GLatLng(43.04953718328849, -76.15444779396057),
				new GLatLng(43.04880019584877, -76.15445852279663),
				new GLatLng(43.04880803618727, -76.15538120269775),
				new GLatLng(43.04953718328849, -76.15539193153381)
			], "#ff0000", 0, .70, "#68228B", 0.65);

			// 19:
			garageNineteen = new GPolygon([
				new GLatLng(43.047600612249596, -76.15530610084534),
				new GLatLng(43.047898550235224, -76.15531146526337),
				new GLatLng(43.04787894909642, -76.15416347980499),
				new GLatLng(43.04745556296969, -76.15418493747711),
				new GLatLng(43.0475692502722, -76.15459263324738),
				new GLatLng(43.047612372987, -76.15494132041931),
				new GLatLng(43.047600612249596, -76.15530610084534)
			], "#ff0000", 0, .70, "#68228B", 0.65);
			
			// 21:
			garageTwentyOne = new GPolygon([
				new GLatLng(43.04799263561425, -76.15342855453491),
				new GLatLng(43.04794167271853, -76.1528867483139), 
				new GLatLng(43.047600612249596, -76.15289747714996),
				new GLatLng(43.04762413372213, -76.15343391895294),
				new GLatLng(43.04799263561425, -76.15342855453491)
			], "#ff0000", 0, .70, "#68228B", 0.65);

			// 22:
			garageTwentyTwo = new GPolygon([
				new GLatLng(43.04776526236791, -76.15140080451965),
				new GLatLng(43.04775350165985, -76.15089654922485),
				new GLatLng(43.04713802145684, -76.15090191364288),
				new GLatLng(43.047149782282936, -76.15141689777374),
				new GLatLng(43.04776526236791, -76.15140080451965)
			], "#ff0000", 0, .70, "#68228B", 0.65);

			// 23:
			garageTwentyThree = new GPolygon([                
				new GLatLng(43.04812592298749, -76.15063905715942),
				new GLatLng(43.048133763412196, -76.15010797977448),
				new GLatLng(43.047561409775355, -76.15010797977448),
				new GLatLng(43.0475692502722, -76.15063905715942),
				new GLatLng(43.04812592298749, -76.15063905715942)
			], "#ff0000", 0, .70, "#68228B", 0.65);

			// 25:
		 	garageTwentyFive = new GPolygon([                
				new GLatLng(43.048576745779854, -76.14920675754547),
				new GLatLng(43.04856498522736, -76.1483108997345), 
				new GLatLng(43.048118082561786, -76.14835917949677),
				new GLatLng(43.04812200277476, -76.14885807037354),
				new GLatLng(43.04831409290369, -76.14885807037354),
				new GLatLng(43.048329773704, -76.14920675754547),
				new GLatLng(43.048576745779854, -76.14920675754547)
			], "#ff0000", 0, .70, "#68228B", 0.65);

			// 29:
			garageTwentyNine = new GPolygon([                
				new GLatLng(43.0456404578449, -76.15087509155273),
				new GLatLng(43.04563653747335, -76.15205526351929),
				new GLatLng(43.04641276615794, -76.15201234817505),
				new GLatLng(43.04642452712307, -76.15085899829865),
				new GLatLng(43.0456404578449, -76.15087509155273)
			], "#ff0000", 0, .70, "#68228B", 0.65);

			// 34:
			garageThirtyFour = new GPolygon([
				new GLatLng(43.04423694881233, -76.15093946456909), 
				new GLatLng(43.0438527424176, -76.15093946456909), 
				new GLatLng(43.043872344842924, -76.1518406867981), 
				new GLatLng(43.044240869273345, -76.15186750888824), 
				new GLatLng(43.04423694881233, -76.15093946456909) 
			], "#ff0000", 0, .70, "#68228B", 0.65);

			// 35:
			garageThirtyFive = new GPolygon([
				new GLatLng(43.04424871019463, -76.15019917488098), 
				new GLatLng(43.042860851519045, -76.15019381046295), 
				new GLatLng(43.042884374809006, -76.15076780319214), 
				new GLatLng(43.044252630654874, -76.15074634552002), 
				new GLatLng(43.04424871019463, -76.15019917488098) 
			], "#ff0000", 0, .70, "#68228B", 0.65);
			
			// 37:
			garageThirtySeven = new GPolygon([
				new GLatLng(43.044240869273345, -76.15006506443024), 
				new GLatLng(43.04422910788955, -76.14891707897186), 
				new GLatLng(43.044068368751724, -76.1489063501358), 
				new GLatLng(43.04408013016633, -76.15007042884827), 
				new GLatLng(43.044240869273345, -76.15006506443024) 
			], "#ff0000", 0, .70, "#68228B", 0.65);
			
			// 38:
			garageThirtyEight = new GPolygon([
				new GLatLng(43.044405528409676, -76.14893853664398), 
				new GLatLng(43.04442513065839, -76.15071415901184), 
				new GLatLng(43.04485245812337, -76.1507248878479), 
				new GLatLng(43.04484069685683, -76.14895462989807), 
				new GLatLng(43.044405528409676, -76.14893853664398)
			], "#ff0000", 0, .70, "#68228B", 0.65);
			
			// 40:
			garageForty = new GPolygon([
				new GLatLng(43.04346853361666, -76.14742040634155), 
				new GLatLng(43.04344501055066, -76.14592373371124), 
				new GLatLng(43.04293142136188, -76.1458969116211), 
				new GLatLng(43.042935341906315, -76.1474096775055), 
				new GLatLng(43.04346853361666, -76.14742040634155)
			], "#ff0000", 0, .70, "#68228B", 0.65);			
    }
    
	//alert("HERE");

	var request = new Json.Remote(DS_BASE_URL + "/index.php/map/_generate_business_list", {
			onComplete: function(jsonObj) {
				markers = jsonObj.markers;
					
				markers.each(
				    function(marker){
				        initializePoint(marker);
				    });				
			}
		}).send();
}
