//Do not change section - start
function loadLocations(){
	var zoom = 8;
	latitude = "33.845921";
	longitude = "-84.36842";
	address = "3344 Peachtree Rd., Suite 300";
	city = "Atlanta";
	state = "GA";
	zip = "30326";
	phone = '<IMG SRC="/images/phone.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Contact f2o, Sandy Springs Restaurant"> 404-503-9999';
	company = "Fresh 2 Order, Buckhead ";
	
	html  = '<center><div style="left: 1px; top: 1px; width: 170px; text-align: center; font-size: 12px; font-family: arial;" z-index: 2;>';
	html     += "<a href='/f2o-buckhead' title='Fresh 2 Order, Buckhead'><B>" + company + "</B></a><br />"; 
	html 	 +=	address + "<br />";
	html 	 +=	city + ", " + state + " " + zip + "<br />" + phone + "<br /><a href='/f2o-buckhead' title='Fresh 2 Order, Buckhead'><B>View Details, Directions</B></a>";
	html  	 += '</div></center>';

	var map = new GMap2(document.getElementById("map"));
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	//map.addControl(new google.maps.LocalSearch());
	map.setCenter(new GLatLng(34.528719,-84.74611), 18);
	map.checkResize();			
	map.setZoom(zoom);
	var point = new GLatLng(latitude,longitude);
	var marker = createMark(point,html, 1, 'A');
	map.addOverlay(marker);
	document.getElementById("map").style.cursor = 'move';

	//Cumberland Mall
	latitude = "33.882797";
	longitude = "-84.470094";
	address = "1260 Cumberland Mall";
	city = "Atlanta";
	state = "GA";
	zip = "30339";
	phone = '<IMG SRC="/images/phone.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Contact f2o, Sandy Springs Restaurant"> 678-564-1400';
	company = "Fresh 2 Order, Cumberland Mall ";
	
	html  = '<center><div style="left: 1px; top: 1px; width: 170px; text-align: center; font-size: 12px; font-family: arial;" z-index: 2;>';
	html     += "<B><a href='/f2o-cumberland-mall' title='Fresh 2 Order, Cumberland Mall'>" + company + "</a></B><br />"; 
	html 	 +=	address + "<br />";
	html 	 +=	city + ", " + state + " " + zip + "<br />" + phone + "<br /><a href='/f2o-cumberland-mall' title='Fresh 2 Order, Cumberland Mall'><B>View Details, Directions</B></a>";
	html  	 += '</div></center>';
	var point = new GLatLng(latitude,longitude);
	var marker = createMark(point, html, 2, 'B');
	map.addOverlay(marker);

	//Johns Creek
	latitude = "34.045802";
	longitude = "-84.179369";
	address = "10900 Medlock Bridge Rd.";
	city = "Duluth";
	state = "GA";
	zip = "30097";
	phone = '<IMG SRC="/images/phone.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Contact f2o, Sandy Springs Restaurant"> 678-720-9333';
	company = "Fresh 2 Order, Johns Creek ";
	
	html  = '<center><div style="left: 1px; top: 1px; width: 170px; text-align: center; font-size: 12px; font-family: arial;" z-index: 2;>';
	html     += "<B><a href='/f2o-johns-creek' title='Fresh 2 Order, Johns Creek'>" + company + "</a></B><br />"; 
	html 	 +=	address + "<br />";
	html 	 +=	city + ", " + state + " " + zip + "<br />" + phone + "<br /><a href='/f2o-johns-creek' title='Fresh 2 Order, Johns Creek'><B>View Details, Directions</B></a>";
	html  	 += '</div></center>';
	var point = new GLatLng(latitude,longitude);
	var marker = createMark(point, html, 3, 'C');
	map.addOverlay(marker);

	//Midtown
	latitude = "33.778204";
	longitude = "-84.384328";
	address = "860 Peachtree Road, Spire Building";
	city = "Atlanta";
	state = "GA";
	zip = "30308";
	phone = '<IMG SRC="/images/phone.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Contact f2o, Sandy Springs Restaurant"> 404-593-2333';
	company = "Fresh 2 Order, Midtown ";
	
	html  = '<center><div style="left: 1px; top: 1px; width: 170px; text-align: center; font-size: 12px; font-family: arial;" z-index: 2;>';
	html     += "<B><a href='/f2o-midtown' title='Fresh 2 Order, Chattanooga'>" + company + "</a></B><br />"; 
	html 	 +=	address + "<br />";
	html 	 +=	city + ", " + state + " " + zip + "<br />" + phone + "<br /><a href='/f2o-midtown' title='Fresh 2 Order, Chattanooga'><B>View Details, Directions</B></a>";
	html  	 += '</div></center>';
	var point = new GLatLng(latitude,longitude);
	var marker = createMark(point, html, 4, 'D');
	map.addOverlay(marker);

	//Sandy springs
	latitude = "33.922615";
	longitude = "-84.378594";
	address = "6125 Roswell Road, # 300";
	city = "Atlanta";
	state = "GA";
	zip = "30328";
	phone = '<IMG SRC="/images/phone.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Contact f2o, Sandy Springs Restaurant"> 404-567-8646';
	company = "Fresh 2 Order, Sandy Springs ";
	
	html  = '<center><div style="left: 1px; top: 1px; width: 170px; text-align: center; font-size: 12px; font-family: arial;" z-index: 2;>';
	html     += "<B><a href='/f2o-sandy-springs' title='Fresh 2 Order, Sandy Springs'>" + company + "</a></B><br />"; 
	html 	 +=	address + "<br />";
	html 	 +=	city + ", " + state + " " + zip + "<br />" + phone + "<br /><a href='/f2o-sandy-springs' title='Fresh 2 Order, Sandy Springs'><B>View Details, Directions</B></a>";
	html  	 += '</div></center>';
	var point = new GLatLng(latitude,longitude);
	var marker = createMark(point, html, 5, 'E');
	map.addOverlay(marker);

	//Chattanooga
	latitude = "35.028536";
	longitude = "-85.156468";
	address = "1919 Gunbarrel Rd, Suite 103";
	city = "Chattanooga";
	state = "TN";
	zip = "37421";
	phone = '<IMG SRC="/images/phone.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Contact f2o, Sandy Springs Restaurant"> 423-826-5000';
	company = "Fresh 2 Order, Chattanooga ";
	
	html  = '<center><div style="left: 1px; top: 1px; width: 170px; text-align: center; font-size: 12px; font-family: arial;" z-index: 2;>';
	html     += "<B><a href='/f2o-chattanooga' title='Fresh 2 Order, Chattanooga'>" + company + "</a></B><br />"; 
	html 	 +=	address + "<br />";
	html 	 +=	city + ", " + state + " " + zip + "<br />" + phone + "<br /><a href='/f2o-chattanooga' title='Fresh 2 Order, Chattanooga'><B>View Details, Directions</B></a>";
	html  	 += '</div></center>';
	var point = new GLatLng(latitude,longitude);
	var marker = createMark(point, html, 6, 'F');
	map.addOverlay(marker);

	//BWG
	latitude = "34.028902";
	longitude = "-84.335752";
	address = "880 Holcomb Bridge Rd";
	city = "Roswell";
	state = "GA";
	zip = "30076";
	phone = '<IMG SRC="/images/phone.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Contact f2o, Sandy Springs Restaurant"> 770-587-0102';
	company = "Brookwood Grill Rosewell";
	html  = '<center><div style="left: 1px; top: 1px; width: 170px; text-align: center; font-size: 12px; font-family: arial;" z-index: 2;>';
	html     += "<B><a href='http://www.brookwoodgrill.com' title='Brookwood Grill Rosewell'>" + company + "</a></B><br />"; 
	html 	 +=	address + "<br />";
	html 	 +=	city + ", " + state + " " + zip + "<br />" + phone + "<br /><a href='http://www.brookwoodgrill.com' title='Brookwood Grill Rosewell'><B>Go to Brookwood Grill</B></a>";
	html  	 += '</div></center>';
	var point = new GLatLng(latitude,longitude);
	var marker = createMark(point, html, 7, 'G');
	map.addOverlay(marker);


}

var baseIcon = new GIcon(G_DEFAULT_ICON);
baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
baseIcon.iconSize = new GSize(20, 34);
baseIcon.shadowSize = new GSize(37, 34);

function createMark(point, html, i, letter) {
	// Create a lettered icon for this point using our icon class
  //var letter = String.fromCharCode("A".charCodeAt(0) + i);
  var letteredIcon = new GIcon(baseIcon);
  letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";

  // Set up our GMarkerOptions object
  markerOptions = { icon:letteredIcon };

	var marker = new GMarker(point, markerOptions);
	gmarkers[i] = marker;
	htmls[i] = html;

	GEvent.addListener(marker, "click", function() {
	  marker.openInfoWindowHtml(html);
	});
	
	return marker;
 }

  var gmarkers = [];
  var htmls = [];
  function myclick(i) {
    gmarkers[i].openInfoWindowHtml(htmls[i]);
  }

  var zoom = 10;
function loadMap(divID, latitude, longitude, html){
	var map = new GMap2(document.getElementById(divID));
	var point = new GLatLng(latitude,longitude);
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	map.setCenter(point, zoom);
	map.checkResize();			
	map.setZoom(14);
	//map.addControl(new GSmallMapControl());
	//map.addControl(new GMapTypeControl());
	var marker = createMarker(point,html);
	map.addOverlay(marker);
	GEvent.trigger(marker,'click');
}
//Do not change section - end
function loadBuckHead()
{
	latitude = "33.845921";
	longitude = "-84.36842";
	divID = "map";
	address = "3344 Peachtree Rd., Suite 300";
	city = "Atlanta";
	state = "GA";
	zip = "30326";
	phone = '<IMG SRC="/images/phone.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Contact f2o, Sandy Springs Restaurant"> 404-503-9999';
	company = "Fresh 2 Order, Buckhead ";
	
	html  = '<center><div style="left: 1px; top: 1px; width: 170px; text-align: center; font-size: 12px; font-family: arial;" z-index: 2;>';
	html     += "<B>" + company + "</B><br />"; 
	html 	 +=	address + "<br />";
	html 	 +=	city + ", " + state + " " + zip + "<br />" + phone + "<br /><a href='/online-ordering' title='Place your order at Fresh 2 Order, Buckhead'><B>Order at  F2O, Buckhead</B></a>";
	html  	 += '</div></center>';

	loadMap(divID, latitude, longitude, html);
}

function loadChattanooga()
{
	latitude = "35.028536";
	longitude = "-85.156468";
	divID = "map";
	address = "1919 Gunbarrel Rd, Suite 103";
	city = "Chattanooga";
	state = "TN";
	zip = "37421";
	phone = '<IMG SRC="/images/phone.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Contact f2o, Sandy Springs Restaurant"> 423-826-5000';
	company = "Fresh 2 Order, Chattanooga ";
	
	html  = '<center><div style="left: 1px; top: 1px; width: 170px; text-align: center; font-size: 12px; font-family: arial;" z-index: 2;>';
	html     += "<B>" + company + "</B><br />"; 
	html 	 +=	address + "<br />";
	html 	 +=	city + ", " + state + " " + zip + "<br />" + phone + "<br /><a href='/online-ordering' title='Place your order at Fresh 2 Order, Chattanooga'><B>Order at  F2O, Chattanooga</B></a>";
	html  	 += '</div></center>';

	loadMap(divID, latitude, longitude, html);
}

function loadCumberland()
{
	latitude = "33.882797";
	longitude = "-84.470094";
	divID = "map";
	address = "1260 Cumberland Mall";
	city = "Atlanta";
	state = "GA";
	zip = "30339";
	phone = '<IMG SRC="/images/phone.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Contact f2o, Sandy Springs Restaurant"> 678-564-1400';
	company = "Fresh 2 Order, Cumberland Mall ";
	
	html  = '<center><div style="left: 1px; top: 1px; width: 170px; text-align: center; font-size: 12px; font-family: arial;" z-index: 2;>';
	html     += "<B>" + company + "</B><br />"; 
	html 	 +=	address + "<br />";
	html 	 +=	city + ", " + state + " " + zip + "<br />" + phone + "<br /><a href='https://fresh2order-cumberlandmall.patronpath.com/' title='Place your order at Fresh 2 Order, Cumberland Mall'><B>Order at  F2O, Cumberland Mall</B></a>";
	html  	 += '</div></center>';

	loadMap(divID, latitude, longitude, html);
}

function loadJohnCreek()
{
	latitude = "34.045802";
	longitude = "-84.179369";
	divID = "map";
	address = "10900 Medlock Bridge Rd.";
	city = "Duluth";
	state = "GA";
	zip = "30097";
	phone = '<IMG SRC="/images/phone.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Contact f2o, Sandy Springs Restaurant"> 678-720-9333';
	company = "Fresh 2 Order, Johns Creek ";
	
	html  = '<center><div style="left: 1px; top: 1px; width: 170px; text-align: center; font-size: 12px; font-family: arial;" z-index: 2;>';
	html     += "<B>" + company + "</B><br />"; 
	html 	 +=	address + "<br />";
	html 	 +=	city + ", " + state + " " + zip + "<br />" + phone + "<br /><a href='/online-ordering' title='Place your order at Fresh 2 Order, Johns Creek'><B>Order at  F2O, Johns Creek</B></a>";
	html  	 += '</div></center>';

	loadMap(divID, latitude, longitude, html);
}

function loadMidtown()
{
	latitude = "33.778204";
	longitude = "-84.384328";
	divID = "map";
	address = "860 Peachtree Road, Spire Building";
	city = "Atlanta";
	state = "GA";
	zip = "30308";
	phone = '<IMG SRC="/images/phone.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Contact f2o, Sandy Springs Restaurant"> 404-593-2333';
	company = "Fresh 2 Order, Midtown ";
	
	html  = '<center><div style="left: 1px; top: 1px; width: 170px; text-align: center; font-size: 12px; font-family: arial;" z-index: 2;>';
	html     += "<B>" + company + "</B><br />"; 
	html 	 +=	address + "<br />";
	html 	 +=	city + ", " + state + " " + zip + "<br />" + phone + "<br /><a href='https://fresh2order-midtown.patronpath.com/' title='Place your order at Fresh 2 Order, Midtown'><B>Order at  F2O, Midtown</B></a>";
	html  	 += '</div></center>';

	loadMap(divID, latitude, longitude, html);
}

function loadSandySprings()
{
	latitude = "33.922615";
	longitude = "-84.378594";
	divID = "map";
	address = "6125 Roswell Road, # 300";
	city = "Atlanta";
	state = "GA";
	zip = "30328";
	phone = '<IMG SRC="/images/phone.png" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Contact f2o, Sandy Springs Restaurant"> 404-567-8646';
	company = "Fresh 2 Order, Sandy Springs ";
	
	html  = '<center><div style="left: 1px; top: 1px; width: 170px; text-align: center; font-size: 12px; font-family: arial;" z-index: 2;>';
	html     += "<B>" + company + "</B><br />"; 
	html 	 +=	address + "<br />";
	html 	 +=	city + ", " + state + " " + zip + "<br />" + phone + "<br /><a href='/online-ordering' title='Place your order at Fresh 2 Order, Sandy Springs'><B>Order at  F2O, Sandy Springs</B></a>";
	html  	 += '</div></center>';

	loadMap(divID, latitude, longitude, html);
}

// This function adds the point to the map
function createMarker(point,html) {
	var marker = new GMarker(point);
	GEvent.addListener(marker, "click", function() {
	  marker.openInfoWindowHtml(html);
	});
	return marker;
}

function getDirections(){
	var map = new GMap2(document.getElementById("map"));
	var panel = document.getElementById("directions");
	var dir = new GDirections(map, panel);
	var start = document.frmMain.saddr.value;
	var end = document.frmMain.daddr.value;
	dir.load(start + " to " + end);
}