var emLatLng = new MQA.LatLng(32.012682,-96.273842);
var offLatLng = new MQA.LatLng(32.006498,-96.271624);
var cenLatLng = new MQA.LatLng(32.009623,-96.276592);

function startMap(){
	myMap = new MQA.TileMap(document.getElementById('mapWindow'),12,offLatLng,"map");
	myMap.addControl(new MQA.LargeZoomControl());
	myMap.addControl(new MQA.ViewControl(myMap), new MQA.MapCornerPlacement(MQA.MapCorner.TOP_RIGHT, new MQA.Size(125,0)));
	myMap.setCenter(cenLatLng);
	MQA.EventManager.addListener(myMap,"zoomEnd",onZoom);
	offInfoHtml = '11.6 miles from I-45 on Hwy 287<br/><a href="http://www.mapquest.com/maps?2c=Corsicana&amp;2s=TX&amp;2a=8977+Highway+287+South&amp;2z=75109&amp;2y=US&amp;form=directions&amp;CID=lfddlink">Get directions...</a>';
	offPt = new MQA.Poi(offLatLng);
	offPt.setValue('infoTitleHTML','Crowell Properties Office');
	offPt.setValue('infoContentHTML',offInfoHtml);
	offPt.setValue('titleBackgroundColor', '#E6E6E6');
	offPt.setValue('labelText','Office');
	offPt.setValue('labelClass','poiTxt');
	offPt.setValue('key','1A');
	emInfoHtml = 'Approx. one mile off of Hwy 287<br/>on SE County Road 3110<br/><a href="http://www.mapquest.com/maps?2c=Corsicana&amp;2s=TX&amp;2a=1400+SE+County+Road+3110&amp;2z=75109&amp;2y=US&amp;form=directions&amp;CID=lfddlink">Get directions...</a>'
	emPt = new MQA.Poi(emLatLng);
	emPt.setValue('infoTitleHTML','Eureka Meadows Entrance');
	emPt.setValue('infoContentHTML',emInfoHtml);
	emPt.setValue('labelText','Eureka Meadows');
	emPt.setValue('titleBackgroundColor', '#E6E6E6');
	emPt.setValue('labelClass','poiTxt');
	emPt.setValue('key','1B');
	emPt.setValue('minZoomLevel',11);
	myMap.addShape(offPt);
	myMap.addShape(emPt);
	myPolygonOL = new MQA.PolygonOverlay(); 
	myPolygonOL.setValue("borderWidth",2); 
	myPolygonOL.setValue("color","#999999"); 
	myPolygonOL.setValue("fillColor","#99FF99"); 
	var myShapePts = new MQA.LatLngCollection(); 
	myShapePts.add(new MQA.LatLng(32.012008,-96.274841));
	myShapePts.add(new MQA.LatLng(32.013086,-96.272654));
	myShapePts.add(new MQA.LatLng(32.009343,-96.270558));
	myShapePts.add(new MQA.LatLng(32.008432,-96.272835));
	myPolygonOL.setValue("shapePoints",myShapePts);
	myMap.addShape(myPolygonOL);
	myMap.getInfoWindow().setMinWidth(200);
	myMap.getInfoWindow().setMaxWidth(250);
	offPt.showInfoWindow();
}

function onZoom(e) {
	if (e.zoom <= 10) {
		offPt.setValue('labelVisible', false);
	} else {
		offPt.setValue('labelVisible', true);
	}
}
