﻿function createMarker(point, html) {
    var marker = new GMarker(point);
    GEvent.addListener(marker, "click", function() {
        // Tabs for Corporate when marker is clicked   
        var tabs = [];
        // Create tabs and add them to the array
        tabs.push(new GInfoWindowTab('Location', '<strong>Corporate</strong><br />Zia Engineering & Environmental Consultants, LLC<br />755 S. Telshor Blvd, Ste. F-201<br />Las Cruces, New Mexico 88011'));
        tabs.push(new GInfoWindowTab('Contact', '(voice) 575-532-1526<br>(phone) 866-532-1588<br>(fax 575-532-1587'));
        // Add tabs to the InfowWindow   
        marker.openInfoWindowTabsHtml(tabs);
    });
    return marker;
}
function initialize() {
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.addControl(new GMapTypeControl());
        map.setMapType(G_NORMAL_MAP);
        map.setCenter(new GLatLng(32.321374, -106.736212), 4);
        map.getPane(G_MAP_FLOAT_SHADOW_PANE).style.display = "none";

        //All Points
        var point = new GLatLng(32.321374, -106.736212);
        var pointNorthern = new GLatLng(35.666362, -105.964422);
        var pointSouthern = new GLatLng(32.276321, -107.754078);
        var pointMidWest = new GLatLng(42.010657, -93.62875);
        var pointCentral = new GLatLng(31.806029, -106.509705);
        var pointWestern = new GLatLng(36.079488, -115.095005);
        var pointPacific = new GLatLng(45.41466, -122.689304);
        var pointFtWorth = new GLatLng(32.76115, -97.327538);
        var pointYuma = new GLatLng(32.868991, -114.436426);
        var pointSimonsIsland = new GLatLng(31.146566, -81.380539);
        var pointAbq = new GLatLng(35.10397, -106.56395);
        var pointWSMR = new GLatLng(33.044932, -106.388168);

        //Create Markers for the map from the points created
        var marker = createMarker(point);
        var markerNorthern = createMarker(pointNorthern);
        var markerSouthern = createMarker(pointSouthern);
        var markerMidWest = createMarker(pointMidWest);
        var markerCentral = createMarker(pointCentral);
        var markerWestern = createMarker(pointWestern);
        var markerPacific = createMarker(pointPacific);
        var markerFtWorth = createMarker(pointFtWorth);
        var markerYuma = createMarker(pointYuma);
        var markerSimonsIsland = new createMarker(pointSimonsIsland);
        var markerAbq = new createMarker(pointAbq);
        var markerWSMR = new createMarker(pointWSMR);

        //Add markers to map with overlay
        map.addOverlay(marker);
        map.addOverlay(markerNorthern);
        map.addOverlay(markerSouthern);
        map.addOverlay(markerMidWest);
        map.addOverlay(markerCentral);
        map.addOverlay(markerWestern);
        map.addOverlay(markerPacific);
        map.addOverlay(markerFtWorth);
        map.addOverlay(markerYuma);
        map.addOverlay(markerSimonsIsland);
        map.addOverlay(markerAbq);
        map.addOverlay(markerWSMR);
    

        // Corporate Info Tabs that show on default as page loads
        var tabs = [];
        // Create tabs and add them to the array
        tabs.push(new GInfoWindowTab('Location', '<strong>Corporate</strong><br>Zia Engineering & Environmental Consultants, LLC<br>755 S. Telshor Blvd, Ste. F-201<br>Las Cruces, New Mexico 88011'));
        tabs.push(new GInfoWindowTab('Contact', '(voice) (575) 532-1526<br />(phone) 866-532-1588<br>(fax) 575-532-1587'));
        // Add tabs to the InfowWindow
        marker.openInfoWindowTabsHtml(tabs);

        // Click event for Northern New Mexico
        GEvent.addListener(markerNorthern, "click", function() {
            // Create an array that will hold the tabs   
            var tabs = [];
            // Create tabs and add them to the array
            tabs.push(new GInfoWindowTab('Location', '<strong>Northern New Mexico</strong><br />1925 Aspen Drive #502 unit A<br />Santa Fe, New Mexico 87505'));
            tabs.push(new GInfoWindowTab('Contact', '(voice) (505) 424-3345<br />(fax) (505) 424-3157<br />email: <a href="mailto:hrosoff@ziaeec.com">Hank Rosoff</a>'));
            // Add tabs to the InfowWindow   
            markerNorthern.openInfoWindowTabsHtml(tabs);
        });

        // Click event for Abq
        GEvent.addListener(markerAbq, "click", function() {
            // Create an array that will hold the tabs   
            var tabs = [];
            // Create tabs and add them to the array
            tabs.push(new GInfoWindowTab('Location', '<strong>Albuquerque office</strong><br />1720 Louisiana Blvd. NE, Suite 202<br />Albuquerque, NM 87110'));
            tabs.push(new GInfoWindowTab('Contact', '(voice) (505) 266-2488<br />(fax)  (505) 266-2803<br />(email) <a href="mailto:hrosoff@ziaeec.com ">Hank Rosoff</a>'));
            // Add tabs to the InfowWindow
            markerAbq.openInfoWindowTabsHtml(tabs);
        });

        // Click event for Southern New Mexico
        GEvent.addListener(markerSouthern, "click", function() {
            // Create an array that will hold the tabs   
            var tabs = [];
            // Create tabs and add them to the array
            tabs.push(new GInfoWindowTab('Location', '<strong>Southern New Mexico</strong><br />410 S. Gold Ave, <br />Deming, New Mexico 88030'));
            tabs.push(new GInfoWindowTab('Contact', '(voice) 575-546-3660<br />(fax) 575-546-0544'));
            // Add tabs to the InfowWindow   
            markerSouthern.openInfoWindowTabsHtml(tabs);
        });

        // Click event for MidWest
        GEvent.addListener(markerMidWest, "click", function() {
            // Create an array that will hold the tabs   
            var tabs = [];
            // Create tabs and add them to the array
            tabs.push(new GInfoWindowTab('Location', '<strong>Mid-West</strong> - Dba/ Zia Environmental Consultants, LLC<br />1531 Airport Road<br />Ames, Iowa 50010'));
            tabs.push(new GInfoWindowTab('Contact', '(voice) 515-233-5794<br />(fax) 515-233-5934<br />email: <a href="mailto:dstone@ziaeec.com">Donn Stone</a>'));
            // Add tabs to the InfowWindow   
            markerMidWest.openInfoWindowTabsHtml(tabs);
        });

        // Click event for Central
        GEvent.addListener(markerCentral, "click", function() {
            // Create an array that will hold the tabs   
            var tabs = [];
            // Create tabs and add them to the array
            tabs.push(new GInfoWindowTab('Location', '<strong>Central</strong><br />414 Executive Center Blvd., Suite 105<br />El Paso, TX 79902'));
            tabs.push(new GInfoWindowTab('Contact', '(voice) 915-577-0052 <br />(fax) 915-532-7373'));
            // Add tabs to the InfowWindow   
            markerCentral.openInfoWindowTabsHtml(tabs);
        });

        // Click event for Western
        GEvent.addListener(markerWestern, "click", function() {
            // Create an array that will hold the tabs   
            var tabs = [];
            // Create tabs and add them to the array
            tabs.push(new GInfoWindowTab('Location', '<strong>Western</strong><br />3481 East Sunset Road, Suite 100<br />Las Vegas, Nevada 89120'));
            tabs.push(new GInfoWindowTab('Contact', '(voice) 702-853-0201<br />(fax) 702-853-0202'));
            // Add tabs to the InfowWindow   
            markerWestern.openInfoWindowTabsHtml(tabs);
        });

        // Click event for Pacific Northwest
        GEvent.addListener(markerPacific, "click", function() {
            // Create an array that will hold the tabs   
            var tabs = [];
            // Create tabs and add them to the array
            tabs.push(new GInfoWindowTab('Location', '<strong>Pacific Northwest</strong><br />1700 Woodland Terrace<br />Lake Oswego, Oregon 97034'));
            tabs.push(new GInfoWindowTab('Contact', '(voice) 503-675-2705<br />(email) <a href="mailto:akkhera@ziaeec.com">akkhera@ziaeec.com</a><br />(email) <a href="mailto:rhertzbg@ziaeec.com">rhertzbg@ziaeec.com</a>'));
            // Add tabs to the InfowWindow   
            markerPacific.openInfoWindowTabsHtml(tabs);
        });

        // Click event for Ft Worth
        GEvent.addListener(markerFtWorth, "click", function() {
            // Create an array that will hold the tabs   
            var tabs = [];
            // Create tabs and add them to the array
            tabs.push(new GInfoWindowTab('Location', '<strong>Fort Worth Office</strong><br />819 Taylor Street, Room 7A37<br />Fort Worth, TX 76102'));
            tabs.push(new GInfoWindowTab('Contact', ''));
            // Add tabs to the InfowWindow   
            markerFtWorth.openInfoWindowTabsHtml(tabs);
        });

        // Click event for Yuma
        GEvent.addListener(markerYuma, "click", function() {
            // Create an array that will hold the tabs   
            var tabs = [];
            // Create tabs and add them to the array
            tabs.push(new GInfoWindowTab('Location', '<strong>Yuma Office</strong><br />301 C. Street, Bldg. 105<br />Yuma, AZ 85365'));
            tabs.push(new GInfoWindowTab('Contact', '(voice) (918) 328-3257<br />(email) <a href="mailto:jmills@ziaeec.com">John Mills</a>'));
            // Add tabs to the InfowWindow   
            markerYuma.openInfoWindowTabsHtml(tabs);
        });

        // Click event for Simons Island
        GEvent.addListener(markerSimonsIsland, "click", function() {
            // Create an array that will hold the tabs   
            var tabs = [];
            // Create tabs and add them to the array
            tabs.push(new GInfoWindowTab('Location', '<strong>Brunswick Georgia office</strong><br />504 Beachview Drive, Suite 2-F<br />Saint Simons Island, GA  31522'));
            tabs.push(new GInfoWindowTab('Contact', '(voice) (912) 638-1599<br />(fax) (912) 638-1599<br />(email) <a href="mailto:wrdailey@ziaeec.com">wrdailey@ziaeec.com</a>'));
            // Add tabs to the InfowWindow
            markerSimonsIsland.openInfoWindowTabsHtml(tabs);
        });

        // Click event for WSMR
        GEvent.addListener(markerWSMR, "click", function() {
            // Create an array that will hold the tabs   
            var tabs = [];
            // Create tabs and add them to the array
            tabs.push(new GInfoWindowTab('Location', '<strong>White Sands Technical Services, LLC (A ZiaEEC Subsidiary)</strong><br />Bldg 126, 3rd Floor; PO Box 363<br />White Sands Missile Range, NM 88002'));
            tabs.push(new GInfoWindowTab('Contact', '(voice) (575) 678-0263<br />(fax) (575) 678-6096<br />(email) <a href="mailto:ehmartinez@ws-tech.com">Eddie Martinez</a>'));
            // Add tabs to the InfowWindow
            markerWSMR.openInfoWindowTabsHtml(tabs);
        });

        /////////////////////////////////////////////////////////////
        
        //This gives you a small zoom tool
        map.addControl(new GSmallMapControl());
    }
}