// JavaScript Document
//<![CDATA[
   
  // Create Icon
  var icon = new GIcon();
  icon.image = "images/img_map_icon.png";
  icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
  icon.iconSize = new GSize(27, 30);
  icon.shadowSize = new GSize(22, 20);
  icon.iconAnchor = new GPoint(6, 20);
  icon.infoWindowAnchor = new GPoint(5, 1);
	
  //Create Map
  var map = new GMap(document.getElementById("conMap"));
  map.addControl(new GSmallMapControl());
  map.addControl(new GMapTypeControl());
  map.centerAndZoom(new GPoint(-99.4713842868805, 27.503618050877627), 5);

  var point = new Array();
  var html = new Array();  

 // point[1] = new GPoint(-99.47675943374634, 27.55673461684212); //-99.4751501083374, 27.558541821861127
 // html[1]  = '<div style="width: 15em; style: font-size: small"><b>Main Office</b><br>6019 Mcpherson Rd # 3<br>(956) 725-4266</div>';
  point[1] = new GPoint(-99.4713842868805, 27.503618050877627);
  html[1] =  '<div style="width: 17em; style: font-size: small"><b>Main Office / Model Home</b><br>2419 Market St<br>(956) 725-4266<br>(956) 753-0071<br>(956) 727-2477<br>Fax (956) 753-2606</div>';
  point[2] = new GPoint(-99.53257083892822, 27.611375142508038);
  html[2] =  '<div style="width: 17em; style: font-size: small"><b>Sales Office / Model Home</b><br>13101 Kickapoo Drive<br>(956) 753-0071<br>(956) 727-2477</div>';
  point[4] = new GPoint(-99.42805051803589, 27.493025920509567);
  html[4] =  '<div style="width: 10em; style: font-size: small"><b>Las Flores</b><br>(956) 753-0071<br>(956) 725-4266</div>';
  point[5] = new GPoint(-99.53257083892822, 27.611375142508038);
  html[5] =  '<div style="width: 10em; style: font-size: small"><b>Indian Sunset</b><br>(956) 753-0071<br>(956) 725-4266</div>';
  point[6] = new GPoint(-99.4708800315857, 27.444153794338042);
  html[6] =  '<div style="width: 10em; style: font-size: small"><b>Sierra Vista</b><br>(956) 725-4266<br>(956) 753-0071</div>';
//  point[7] = new GPoint(-99.48139429092407, 27.450494876464223);
//  html[7] =  '<div style="width: 10em; style: font-size: small"><b>Santa Fe</b></div>';
//  point[8] = new GPoint(-99.49508428573608, 27.507300789984395);
//  html[8]  = '<div style="width: 10em; style: font-size: small"><b>Central Laredo</b></div>';
//  point[9] = new GPoint(-99.45377826690674, 27.601715659669026);
//  html[9] = '<div style="width: 10em; style: font-size: small"><b>Wyndum Terrace</b></div>';
  
	// Create Location 1 - Main Office 
  	var location1 = new GMarker(point[1], icon);
	map.addOverlay(location1);
	
	GEvent.addListener(location1, "click", function() {
		location1.openInfoWindowHtml(html[1]);
	});

	// Create Location 2 - Model Home / Sales Office 
    var location2 = new GMarker(point[2], icon);
	map.addOverlay(location2);
	
	GEvent.addListener(location2, "click", function() {
		location2.openInfoWindowHtml(html[2]);
	});

		
	// Create Location 4 - Las Flores
    var location4 = new GMarker(point[4], icon);
	map.addOverlay(location4);
	
	GEvent.addListener(location4, "click", function() {
		location4.openInfoWindowHtml(html[4]);
	});

	
	// Create Location 5 - Indian Sunset
    var location5 = new GMarker(point[5], icon);
	map.addOverlay(location5);
	
	GEvent.addListener(location5, "click", function() {
		location5.openInfoWindowHtml(html[5]);
	});
	
		// Create Location 6 - Sierra Vista
    var location6 = new GMarker(point[6], icon);
	map.addOverlay(location6);
	
	GEvent.addListener(location6, "click", function() {
		location6.openInfoWindowHtml(html[6]);
	});
	
		
//Switch Location on Map
function showLocation(marker, num) {
	marker.openInfoWindowHtml(html[num]);
}

//Background change
function addBg(id) {
	//document.getElementById(id).style.backgroundColor = '#F8F8F8';
	//document.getElementById(id).style.borderRight = '1px solid #999999';
	//document.getElementById(id).style.borderBottom = '1px solid #999999';
}
function removeBg(id) {
	//document.getElementById(id).style.backgroundColor = '#FFFFFF';
	//document.getElementById(id).style.borderRight = '1px solid #FFFFFF';
	//document.getElementById(id).style.borderBottom = '1px solid #FFFFFF';
}
 
//Background change
function changeBg(id) {
	//for(i=1;i<4,i++) 
	//{
		//var i = 0;
	for( i=1; i < 10; i++ ) 
  	{
		//alert(i);
		//var i = 1;
		if (document.getElementById("location" + i)) {
			document.getElementById("location" + i).style.backgroundColor = '#FFFFFF';
		}
		//document.getElementById("location" + i).style.borderRight = '1px solid #FFFFFF';
		//document.getElementById("location" + i).style.borderBottom = '1px solid #FFFFFF';
	}
	
	document.getElementById(id).style.backgroundColor = '#F8F8F8';
	//document.getElementById(id).style.borderRight = '1px solid #999999';
	//document.getElementById(id).style.borderBottom = '1px solid #999999';
}
function doNothing() {
	
}

function divText(id) {
	switch(id)
	{
	case 1: // Main Office
  		document.getElementById("conLocText").innerHTML="<b>Main Office / Model Home</b><br>2419 Market St<br>(956) 725-4266<br>(956) 753-0071<br>(956) 727-2477<br>Fax (956) 753-2606";
  		break    
	case 2: // Sales 1
  		document.getElementById("conLocText").innerHTML="<b>Sales Office / Model Home</b><br>13101 Kickapoo Drive<br>(956) 753-0071<br>(956) 725-4266";
  		break
	case 3: // Not Used
  		document.getElementById("conLocText").innerHTML="";
  		break
	case 4: // Las Flores
		document.getElementById("comLocText").innerHTML="<b>Las Flores</b><br>(956) 753-0071<br>(956) 725-4266";
		break
	case 5: // Indian Sunset
		document.getElementById("comLocText").innerHTML="<b>Indian Sunset</b><br>(956) 753-0071<br>(956) 725-4266";
		break
	case 6: // Sierra Vista
		document.getElementById("comLocText").innerHTML="<b>Sierra Vista</b><br>(956) 725-4266<br>(956) 753-0071";
		break
	default:
  		document.getElementById("conLocText").innerHTML="";
	}
}
//]]>