  //<![CDATA[

  // Builds an array of geocode responses for the 5 cities.

var city = [
	// START CITY TEMPELATE
	// You need to put the Bedminster info in this one. They need to be in the exact order of the drop-down.

// BEDMINSTER 1 store.49
	
    {
      name: "Bedminster",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "450 Rte. 206 North & Hills Dr.<br />Bedminster, NJ 07921",
          storeManager: "Kathy Fiduccia<br>Mark Taylor",
		  storePhone: "908-719-4960",
          storeFax: "908-781-5557",
          storeHours: "Mon-Sun 7:00AM-10:00PM<br />", 	
          Point: { coordinates: [-74.643989, 40.652037, 0]} 		// {Long, Lat, 0}
        }
      ]
    },
	

// BERKELY HEIGHTS   2 store. 52

    {
      name: "Berkeley Heights",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "434 Springfield Ave<br />Berkeley Heights, NJ 07922",
          storeManager: "Gil Van Buskirk",
		  storePhone: "908-464-4476",
          storeFax: "908-464-4362",
          storeHours: "Mon-Sat 7:30AM-9:00PM<br />Sun 7:30AM-8:00PM",
          Point: { coordinates: [-74.438829, 40.685713, 0]} 		// {Long, Lat, 0}
        }
      ]
    },


// BERNARDSVILLE   3  Store 41


{
      name: "Bernardsville",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "100 Morristown Rd.<br> Bernardsville, NJ 07924",
          storeManager: "Frank Pershpalaj",
	  storePhone: "908-204-4840",
          storeFax: "908-204-0190",
          storeHours: "Mon-Sun 7:30AM-9:00PM<br />", 	
          Point: { coordinates: [-74.560973, 40.719757, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// BOONTON   4   Store. 60

{
      name: "Boonton",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "115 Hawkins Place<br />Boonton, NJ 07005",
          storeManager: "Karl Schmidt",
	  storePhone: "973-257-4899",
          storeFax: "973-402-6351",
          storeHours: "Mon-Sat 7:00AM-10:00PM <br> Sun 7:00AM-9:00PM", 	
          Point: { coordinates: [-74.425010, 40.906820, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// CHATHAM   5  Store. 38

{
      name: "Chatham",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "393  Main St.<br />Chatham, NJ 07928",
          storeManager: "Bill Van Buskirk",
	  storePhone: "973-635-4400",
          storeFax: "973-635-4742",
          storeHours: "Mon-Sat 7:30AM-10:00PM<br /> Sun 7:30AM-9:00PM", 	
          Point: { coordinates: [-74.388215, 40.742380, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// CRESSKILL   6  Store. 29

{
      name: "Cresskill",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "70 Union Ave.<br />Cresskill, NJ 07626",
          storeManager: "Gabe Corso<br/>Vince Gramuglia",
	  storePhone: "201-541-4900",
          storeFax: "201-894-8920",
          storeHours: "Mon-Sun 7:00AM-10:00PM<br />", 	
          Point: { coordinates: [-73.959481, 40.941398, 0]} 		// {Long, Lat, 0}
        }
      ]
    },


// FORT LEE   7   Store. 58

{
      name: "Florham Park",
      Status: {
        code: 200,
        request: "geocode"
      },
     Placemark: [ {
          address: "184 Columbia Trnpke<br />Florham Park, NJ 07932",
          storeManager: "Roger Schwartz",
	  storePhone: "973-360-1600",
          storeFax: "973-660-0757",
          storeHours: "Mon-Sun 7:00AM-10:00PM<br />", 	
          Point: { coordinates: [-74.39338, 40.788388, 0]} 		// {Long, Lat, 0}
        }
      ]
    },
 
 
 
// FORT LEE   7

//{
   //   name: "Fort Lee",
   //   Status: {
   //     code: 200,
   //     request: "geocode"
   //   },
   //   Placemark: [ {
   //       address: "112-130 Linwood Plaza<br />Fort Lee, NJ 07024",
   //       storeManager: "Karl Schmidt",
	//  storePhone: "201-363-4912",
   //       storeFax: "201-947-9351",
  //        storeHours: "Mon-Sun 7:00AM-10:00PM<br />", 	
  //        Point: { coordinates: [-73.971215, 40.860397, 0]} 		// {Long, Lat, 0}
  //      }
 //     ]
 //   },


// GARWOOD     8  Store. 43

{
      name: "Garwood",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "300 South Ave.<br />Garwood, NJ 07027",
          storeManager: "Donna Carroll",
	  storePhone: "908-518-4360",
          storeFax: "908-789-0126",
          storeHours: "Mon-Sat 7:00AM-10:00PM<br />Sun 7:00AM-9:00PM", 	
          Point: { coordinates: [-74.322393, 40.651902, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// HILLSDALE     9  Store. 44

{
      name: "Hillsdale",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "381 Washington Ave.<br />Hillsdale, NJ 07642",
          storeManager: "Gerry Straub<br>Mike Porporino",
	  storePhone: "201-722-4690",
          storeFax: "201-664-5691",
          storeHours: "Mon-Sat 7:00AM-10:00PM <br> Sun 7:00AM-9:00PM", 	
          Point: { coordinates: [-74.041154, 41.001876, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// HOBOKEN      10   Store. 59

{
      name: "Hoboken North",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "1212 Shipyard Lane<br />Hoboken, NJ 07030",
          storeManager: "Gerald Lynch",
	  storePhone: "201-239-4060",
          storeFax: "201-239-1453",
          storeHours: "Mon-Sun 7:00AM-10:00PM", 	
          Point: { coordinates: [-74.025204, 40.751044, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// HOBOKEN       11  Store. 66

{
      name: "Hoboken South",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "325  River Street<br />Hoboken, NJ 07030",
          storeManager: "Scott Kurtz",
	  storePhone: "201-386-2300",
          storeFax: "201-876-0687",
          storeHours: "Mon-Sun 7:00AM-10:00PM", 	
          Point: { coordinates: [-74.027784, 40.740576, 0]} 		// {Long, Lat, 0}
        }
      ]
    },



// LIVINGSTON    12  store. 35

{
      name: "Livingston",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "255  South Livingston Ave.<br />Livingston, NJ 07039",
          storeManager: "Pete Gardner",
	  storePhone: "973-535-4940",
          storeFax: "973-994-2786",
          storeHours: "Mon-Sun 7:30AM-10:00PM", 	
          Point: { coordinates: [-74.313793, 40.787300, 0]} 		// {Long, Lat, 0}
        }
      ]
    },


// MAPLEWOOD       13    Store. 12

{
      name: "Maplewood",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "159  Maplewood Ave.<br />Maplewood, NJ 07040",
          storeManager: "Bob Turiano",
	  storePhone: "973-761-4092",
          storeFax: "973-762-0197",
          storeHours: "Mon-Sat 7:00AM-10:00PM<br />Sun 7:00AM-9:00PM", 	
          Point: { coordinates: [-74.277525, 40.731168, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// MENDHAM        14    Store. 51

{
      name: "Mendham",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "86 East Main St.<br />Mendham, NJ 07945",
          storeManager: "Antonio Acosta",
	  storePhone: "973-543-4493",
          storeFax: "973-543-4204",
          storeHours: "Mon-Sat 7:00AM-10:00PM<br />Sun 7:00AM-9:00PM", 	
          Point: { coordinates: [-74.590762, 40.780600, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// MIDLAND PARK        15   Store. 61

{
      name: "Midland Park",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "85 Godwin Ave.<br>Midland Park, NJ 07432",
          storeManager: "Carole Bracaglia<br>Jim Hannon",
	  storePhone: "201-251-4808",
          storeFax: "201-493-2179",
          storeHours: "Mon-Sat 7:00AM-10:00PM<br />Sun 7:00AM - 9:00PM", 	
          Point: { coordinates: [-74.138220, 40.984916, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// MORRISTOWN                16  Store. 37

{
      name: "Morristown",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "191 South St.<br>Morristown, NJ 07960",
          storeManager: "Maryann Klejmont<br>Joe Amon",
	  storePhone: "973-898-4512",
          storeFax: "973-538-9553",
          storeHours: "Mon-Sat 7:00AM-11PM<br />Sun 7:00AM-10:00PM", 	
          Point: { coordinates: [-74.472475, 40.788928, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// RIDGEWOOD               17    Store. 39

{
      name: "Ridgewood",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "112 North Maple Ave.<br>Ridgewood, NJ 07450",
          storeManager: "Gil Wong",
	  storePhone: "201-493-4924",
          storeFax: "201-447-5193",
          storeHours: "Mon-Sun 7:00AM-9:00PM<br>", 	
          Point: { coordinates: [-74.112513, 40.980433, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// SHORT HILLS           18    Store. 42

{
      name: "Short Hills",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "778 Morris Turnpike<br>Short Hills, NJ 07078",
          storeManager: "Emilio Romeo<br>Mike Porporino",
	  storePhone: "973-258-4000",
          storeFax: "973-379-2419",
          storeHours: "Mon-Sat 7:00AM-11PM<br />Sun 7:00AM-10:00PM", 	
          Point: { coordinates: [-74.332998, 40.720745, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// SUMMIT               19    Store. 28

{
      name: "Summit",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "784 Springfield Ave.<br>Summit, NJ 07901",
          storeManager: "Ken Rizzie",
	  storePhone: "908-598-4500",
          storeFax: "908-522-1374",
          storeHours: "Mon-Sat 7:00AM-10:00PM<br />Sun 7:00AM-9:00PM", 	
          Point: { coordinates: [-74.384495, 40.712801, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// UPPER MONTCLAIR             20     Store. 21

{
      name: "Upper Montclair",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "650 Valley Rd.<br />Upper Montclair, NJ 07043",
          storeManager: "Dave Mesa",
	  storePhone: "973-509-4828",
          storeFax: "973-744-4633",
          storeHours: "Mon-Sat 7:00AM-10:00PM<br>Sun 7:00AM-9:00PM", 	
          Point: { coordinates: [-74.192752, 40.864861, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// VERONA 21    Store. 40

{
      name: "Verona",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "265 Pompton Ave.<br />Verona, NJ 07044",
          storeManager: "Barbara Miller",
	  storePhone: "973-571-4188",
          storeFax: "973-239-7856",
          storeHours: "Mon-Sun 7:00AM-10:00PM<br />", 	
          Point: { coordinates: [-74.227090, 40.833859, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// WARREN         22    Store. 56

{
      name: "Warren",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "64 Mountain Blvd.<br />Warren, NJ 07059",
          storeManager: "John Westerman",
	  storePhone: "908-226-4988",
          storeFax: "908-755-1521",
          storeHours: "Mon-Sun 7:00AM-9:00PM<br />", 	
          Point: { coordinates: [-74.495162, 40.617834, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// WEST CALDWELL      23   

{
      name: "West Caldwell",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "875 Bloomfield Ave.<br />West Caldwell, NJ 07006",
          storeManager: "Brien Delp",
	  storePhone: "973-244-4540",
          storeFax: "973-575-5107",
          storeHours: "Mon-Sat 7:00AM-10:00PM<br />Sun 7:30AM-9:00PM", 	
          Point: { coordinates: [-74.298893, 40.851399, 0]} 		// {Long, Lat, 0}
        }

      ]
    },

// WHITEHOUSE STATION          24

{
      name: "Whitehouse Station",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "531 U.S. Hwy. 22 East<br />P.O. Box 7<br />Whitehouse Station, NJ 08889",
          storeManager: "John Mangrella",
	  storePhone: "908-534-6888",
          storeFax: "908-534-3789",
          storeHours: "Mon-Sun 7:00AM-9:00PM<br>", 	
          Point: { coordinates: [-74.7642, 40.6085, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// GARDEN CITY          25
	
    {
      name: "Garden City",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "870 Franklin Ave.<br>Garden City, NY 11530",
          storeManager: "Connie Deckel",
	  storePhone: "516-739-5559",
          storeFax: "516-739-9788",
          storeHours: "Mon-Sat 7:00AM-9:00PM<br />Sun 7:00AM-8:00PM", 	
          Point: { coordinates: [-73.634802, 40.727701, 0]} 		// {Long, Lat, 0}
        }
      ]
    },

// KINGS CORPORATE OFFICE           26

{
      name: "Kings Corporate Office",
      Status: {
        code: 200,
        request: "geocode"
      },
      Placemark: [ {
          address: "700 Lanidex Plaza<br />Parsippany, NJ 07054",
	  storeManager: "N/A",
	  storePhone: "Consumer Affairs Hotline<br /><b>Toll Free:</b> 800-325-4647<br /><b>Phone:</b> 973-463-6300",
          storeFax: "N/A",
          storeHours: "Mon-Fri 9:00AM-5:00PM", 	
          Point: { coordinates: [-74.420872, 40.862479, 0]} 		// {Long, Lat, 0}
        }
      ]
    }
];

  var map;
  var geocoder;
  var icon;
  // CapitalCitiesCache is a custom cache that extends the standard GeocodeCache.
  // We call apply(this) to invoke the parent's class constructor.
  function CapitalCitiesCache() {
    GGeocodeCache.apply(this);
  }

  // Assigns an instance of the parent class as a prototype of the
  // child class, to make sure that all methods defined on the parent
  // class can be directly invoked on the child class.
  CapitalCitiesCache.prototype = new GGeocodeCache();

  // Override the reset method to populate the empty cache with
  // information from our array of geocode responses for capitals.
  CapitalCitiesCache.prototype.reset = function() {
    GGeocodeCache.prototype.reset.call(this);
    for (var i in city) {
      this.put(city[i].name, city[i]);
    }
  }

  function load() {
    if ((document.all) && (navigator.userAgent.indexOf('Opera')== -1)) {
		setTimeout('ieLoad()',1);
	} else {
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
	
		map.enableDoubleClickZoom();
		map.enableContinuousZoom();
		map.enableScrollWheelZoom();
		
		map.setCenter(new GLatLng(40.862319, -74.420564), 9);
		
		geocoder = new GClientGeocoder();
		geocoder.setCache(new CapitalCitiesCache());
	
		icon = new GIcon();
		icon.image = "../images/greenmarker.png";
		icon.shadow = "../images/shadow50.png";
		icon.iconSize = new GSize(20, 34);
		icon.shadowSize = new GSize(37, 34);
		icon.iconAnchor = new GPoint(6, 34);
		icon.infoWindowAnchor = new GPoint(5, 1);
		
		addAllItems();
	}
  }

  function ieLoad() {
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
	
		map.enableDoubleClickZoom();
		map.enableContinuousZoom();
		map.enableScrollWheelZoom();
		
		map.setCenter(new GLatLng(40.862319, -74.420564), 9);
		
		geocoder = new GClientGeocoder();
		geocoder.setCache(new CapitalCitiesCache());
	
		icon = new GIcon();
		icon.image = "../images/greenmarker.png";
		icon.shadow = "../images/shadow50.png";
		icon.iconSize = new GSize(20, 34);
		icon.shadowSize = new GSize(37, 34);
		icon.iconAnchor = new GPoint(6, 34);
		icon.infoWindowAnchor = new GPoint(5, 1);
		
		addAllItems();  
  }
  function addAddressToMap(response) {
    if (response && response.Status.code != 200) {
      alert("Unable to locate " + decodeURIComponent(response.name));
    } else {
      var place = response.Placemark[0];
      var point = new GLatLng(place.Point.coordinates[1],
                              place.Point.coordinates[0]);
	  var infoString = "<div style=\"width: 400px; font-family: Arial, Helvetica, sans-serif; font-size: 12px/14px;\"><div style=\"font-size: 16px; border-bottom: 2px solid #b42135; color: #b42135; width: 380px; font-weight: bold;\">"+response.name+"</div><b>Address:</b><br /> " + place.address
       + "<br /><b>Store Manager:</b><br /> " + place.storeManager
       + "<br /><b>Phone:</b> " + place.storePhone
       + "<br /><b>Fax:</b> " + place.storeFax
       + "<br /><b>Store Hours:</b><br />" + place.storeHours+"<br /><br /><a href=\"mailto:openline@kingssm.com?subject="+response.name+" Customer Feedback\" style=\"cursor: pointer; color: #b42135; font-size: 14px;\">Email Us</a><br /><span onclick=\"returnZoom();\" style=\"cursor: pointer; color: #b42135; font-size: 14px;\">Back To Original Zoom</span></div>";
	   
      map.setCenter(point, 11);
      map.openInfoWindowHtml(point, infoString);
    }
  }

  function addCity(num) {
	  response = city[num];
      var place = response.Placemark[0];
      var point = new GLatLng(place.Point.coordinates[1],
                              place.Point.coordinates[0]);
	  var infoString = "<div style=\"width: 400px; font-family: Arial, Helvetica, sans-serif; font-size: 12px/14px;\"><div style=\"font-size: 16px; border-bottom: 2px solid #b42135; color: #b42135; width: 380px; font-weight: bold;\">"+response.name+"</div><b>Address:</b><br /> " + place.address
       + "<br /><b>Store Manager:</b><br /> " + place.storeManager
       + "<br /><b>Phone:</b> " + place.storePhone
       + "<br /><b>Fax:</b> " + place.storeFax
       + "<br /><b>Store Hours:</b><br />" + place.storeHours+"<br /><br /><a href=\"mailto:openline@kingssm.com?subject="+response.name+" Customer Feedback\" style=\"cursor: pointer; color: #b42135; font-size: 14px;\">Email Us</a><br /><span onclick=\"zoomTo('"+place.Point.coordinates[1]+"','"+place.Point.coordinates[0]+"','"+num+"');\" style=\"cursor: pointer; color: #b42135; font-size: 14px;\">Zoom To Store</span><br /><span onclick=\"returnZoom();\" style=\"cursor: pointer; color: #b42135; font-size: 14px;\">Back To Original Zoom</span></div>";
	   
	  var marker = new GMarker(point,icon);
	  GEvent.addListener(marker, "click", function() {
	    marker.openInfoWindowHtml(infoString);
	  });

	  map.addOverlay(marker);
  }

  function findCity(which) {
    if (which != 0) {
      geocoder.getLocations(city[which - 1].name, addAddressToMap);
    }
  }

	function addAllItems() {
		var size = city.length;
		for(var i=0;i<(size);i++) {
			addCity(i);
		}
	}

	function zoomTo(x,y,num) {
		response = city[num];
		var place = response.Placemark[0];
		var infoString = "<div style=\"width: 400px; font-family: Arial, Helvetica, sans-serif; font-size: 12px/14px;\"><div style=\"font-size: 16px; border-bottom: 2px solid #b42135; color: #b42135; width: 380px; font-weight: bold;\">"+response.name+"</div><b>Address:</b><br /> " + place.address
       + "<br /><b>Store Manager:</b><br /> " + place.storeManager
       + "<br /><b>Phone:</b> " + place.storePhone
       + "<br /><b>Fax:</b> " + place.storeFax
       + "<br /><b>Store Hours:</b><br />" + place.storeHours+"<br /><br /><a href=\"mailto:openline@kingssm.com?subject="+response.name+" Customer Feedback\" style=\"cursor: pointer; color: #b42135; font-size: 14px;\">Email Us</a><br /><span onclick=\"returnZoom();\" style=\"cursor: pointer; color: #b42135; font-size: 14px;\">Back To Original Zoom</span></div>";
	   
		var point = new GLatLng(x,y);
		map.setCenter(point, 11);
		map.openInfoWindowHtml(point, infoString);
	}

	function returnZoom() {
		map.setCenter(new GLatLng(40.862319, -74.420564), 8);
	}
  //]]>
