/*
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	Copyright (C) 2008 Cro-Cec, Inc. dba Digital Solutions.
//	A complete description of Digital Solutionsâ€™ copyright notice can be found online at: 
//	http://www.digitalsolutionslc.com/copyright_notice.php 
//		
//	Digital Solutions is a premier marketing and web development company in Las Cruces, New Mexico. 
//	We offer professional web design including flash and database web sites, graphic design, marketing materials, 
//	and video production. 
//
//	If you enjoyed this website and are looking for custom web development, give us a call at (505) 523-7661.
//		
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
*/
//<![CDATA[ 
var map_lc 							= null;				 
var subdivision_num 				= []; 		
var subdivision_name 				= []; 	
var subdivision_map_longitude 		= []; 	
var subdivision_map_latitude 		= [];
var i_marker_lc 					= 0;		
var MyMarkers_lc 					= [];			
var markers_lc 						= [];					
var point_lc 						= [];
var location_price_range_low 		= [];	
var location_price_range_high 		= [];	
var subdivision_picture 					= [];
 
function loadLoc(city_name) 
{ 
	if (GBrowserIsCompatible()) 
	{
		map_lc = new GMap2(document.getElementById("map_"+city_name)); 
		map_lc.addControl(new GSmallMapControl());
		map_lc.addControl(new GMapTypeControl()); 
		map_lc.addControl(new GScaleControl());
        map_lc.addControl(new GOverviewMapControl()); 

		
		if(city_name == "Dona Ana (North Valley)")
		{
			map_lc.setCenter(new GLatLng(32.52276, -106.942739), 11 );
		}
		
		if(city_name == "Las Cruces")
		{
			map_lc.setCenter(new GLatLng(32.42276, -106.872739), 11 );
		}
			
		if(city_name == "Hobbs")
		{
			map_lc.setCenter(new GLatLng(32.812996, -103.304929), 11 );
		}
		
		map_lc.setMapType(G_NORMAL_MAP);		
		map_lc.disableDoubleClickZoom();
				
		var url_lc = 'includes/google_maps/generate_xml_map_results.php?city='+city_name;
		
		GDownloadUrl(url_lc, function(data) 
		{
			var xml_lc = GXml.parse(data);
			markers_lc = xml_lc.documentElement.getElementsByTagName("marker_lc");
			
			var current_id_lc;
			//alert(markers_lc.length);
			
			for (i_marker_lc = 0; i_marker_lc < markers_lc.length; i_marker_lc++) 
			{
				current_id_lc 								= markers_lc[i_marker_lc].getAttribute("subdivision_num");
				subdivision_num[current_id_lc] 				= markers_lc[i_marker_lc].getAttribute("subdivision_num");
				subdivision_name[current_id_lc] 			= markers_lc[i_marker_lc].getAttribute("subdivision_name");
				subdivision_picture[current_id_lc] 			= markers_lc[i_marker_lc].getAttribute("subdivision_picture");
				subdivision_map_longitude[current_id_lc] 	= markers_lc[i_marker_lc].getAttribute("subdivision_map_longitude");
				subdivision_map_latitude[current_id_lc] 	= markers_lc[i_marker_lc].getAttribute("subdivision_map_latitude"); 
				
				//alert(subdivision_name_lc[current_id_lc]);
				
				point_lc[current_id_lc] 		= new GLatLng(subdivision_map_latitude[current_id_lc],subdivision_map_longitude[current_id_lc]);
				MyMarkers_lc[current_id_lc] 	= createMarker_lc(point_lc[current_id_lc], subdivision_name[current_id_lc], current_id_lc, subdivision_picture[current_id_lc] );
				
				map_lc.addOverlay(MyMarkers_lc[current_id_lc]);
			}
		});
	}
}
function createMarker_lc(point_lc, subdivision_name, subdivision_num, location_price_low, location_price_high, subdivision_picture) 
{	 
	var icon_lc 				= new GIcon();
    icon_lc.image 				= "http://www.farrellthurston.com/construction/images/flag.png";
    icon_lc.shadow 				= "http://www.farrellthurston.com/construction/images/shadow-flag.png";
    icon_lc.iconSize 			= new GSize(35.0, 35.0);
    icon_lc.shadowSize 			= new GSize(53.0, 35.0);
    icon_lc.iconAnchor 			= new GPoint(17.0, 17.0);
    icon_lc.infoWindowAnchor 	= new GPoint(17.0, 17.0);
		
	var marker_lc	= marker = new PdMarker(point_lc, { title: "title", icon: icon_lc });

	marker_lc.setTooltip(subdivision_name);
	var html_lc = "<div style='color:#FFFFFF; background-color:#003366; padding-left:10px;'><b>" + subdivision_name + "</b></div><table width='100%'  border='0'><tr><td><img src='images/subdivisions/"+subdivision_picture+"' width='125' align='left' style='margin-right:10px;' border='1'><br /><b>Location:</b> "+subdivision_name+"<br /><br /><div align='right' style='color:#FFFFFF; background-color:#ffffff; padding-right:10px;'><a href='subdivisions.php?num=" + subdivision_num + "' target='_self'  style='color:#FFFFFF; background-color:#003366; font-weight:bold;'>&nbsp;&nbsp; Learn More &raquo; &nbsp;&nbsp;</a></div></td></tr></table>";
	marker_lc.setDetailWinHTML(html_lc);
		
	return marker_lc;
}


function addMarker(point) 
{            
    map.addOverlay(new GMarker(point, icon));
}

