﻿// JScript File
var MyOffices = new Array();
var MyIcon;
var map;
    function bodyLoad() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.enableScrollWheelZoom();
        map.setCenter(new GLatLng(34.116352,-84.550781), 8);
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.addControl(new GScaleControl());
                

		MyIcon = new GIcon();
        MyIcon.image = "images_new/BACustomMapIconTop.png";
        MyIcon.shadow="images_new/BACustomMapIconShadow.png";
        MyIcon.transparent="images_new/BACustomMapIconTopTrans.png";
        MyIcon.iconSize = new GSize(27,34);
        MyIcon.shadowSize = new GSize(45,34);
        MyIcon.iconAnchor = new GPoint(11,34);
        MyIcon.infoWindowAnchor = new GPoint(11,0);
        MyIcon.imageMap = [ 1, 8, 25, 8, 25, 32, 8, 32, 13, 39, 1, 32 ];
        
        //Atlanta office
        MyOffices["Atlanta"] = new office("Atlanta");
        MyOffices["Atlanta"].gMapMarker=new GMarker(new GLatLng(33.829169,-84.344809),MyIcon);
        MyOffices["Atlanta"].infoWindowOfficeName="ATLANTA OFFICE&nbsp;";
        MyOffices["Atlanta"].infoWindowAddress="2751 Buford Hwy<br>Suite 400<br>Atlanta, GA 30324";
//        MyOffices["Atlanta"].infoWindowDetails="Druid Pointe Office Building<br>4th Floor";
        MyOffices["Atlanta"].infoWindowDetails="";
        MyOffices["Atlanta"].imageAvailable=true;
        MyOffices["Atlanta"].infoWindowPictureURL="images_new/Atlanta.gif";
        MyOffices["Atlanta"].infoWindowPictureWidth=225;
        MyOffices["Atlanta"].infoWindowPictureHeight=183;
        map.addOverlay(MyOffices["Atlanta"].gMapMarker);
        GEvent.addListener(MyOffices["Atlanta"].gMapMarker,"click", function() {
        	infoWindowPopup("Atlanta",false)
        })
        
        //Duluth office
        MyOffices["Duluth"] = new office("Duluth");
        MyOffices["Duluth"].gMapMarker=new GMarker(new GLatLng(33.947382,-84.130119),MyIcon);
        MyOffices["Duluth"].infoWindowOfficeName="DULUTH OFFICE&nbsp;";
        MyOffices["Duluth"].infoWindowAddress="3675 Crestwood Pkwy<br>Suite 400<br>Duluth, GA 30096";
        MyOffices["Duluth"].infoWindowDetails="";
        MyOffices["Duluth"].imageAvailable=true;
        MyOffices["Duluth"].infoWindowPictureURL="images_new/Duluth.jpg";
        MyOffices["Duluth"].infoWindowPictureWidth=268;
        MyOffices["Duluth"].infoWindowPictureHeight=262;
        map.addOverlay(MyOffices["Duluth"].gMapMarker);
        GEvent.addListener(MyOffices["Duluth"].gMapMarker,"click", function() {
        	infoWindowPopup("Duluth",false)
        })
        
        //Gainesville office
        MyOffices["Gainesville"] = new office("Gainesville");
        MyOffices["Gainesville"].gMapMarker=new GMarker(new GLatLng(34.299885,-83.82703),MyIcon);
        MyOffices["Gainesville"].infoWindowOfficeName="GAINESVILLE OFFICE&nbsp;";
        MyOffices["Gainesville"].infoWindowAddress="105 Bradford<br>Suite C<br>Gainesville, GA 30501";
        MyOffices["Gainesville"].infoWindowDetails="";
        MyOffices["Gainesville"].imageAvailable=false;
        MyOffices["Gainesville"].infoWindowPictureURL="images_new/PhotoNA.jpg";
        MyOffices["Gainesville"].infoWindowPictureWidth=250;
        MyOffices["Gainesville"].infoWindowPictureHeight=250;
        map.addOverlay(MyOffices["Gainesville"].gMapMarker);
        GEvent.addListener(MyOffices["Gainesville"].gMapMarker,"click", function() {
        	infoWindowPopup("Gainesville",false)
        })
        
        //Newnan office
        MyOffices["Newnan"] = new office("Newnan");
        MyOffices["Newnan"].gMapMarker=new GMarker(new GLatLng(33.393872,-84.766098),MyIcon);
        MyOffices["Newnan"].infoWindowOfficeName="NEWNAN OFFICE&nbsp;";
        MyOffices["Newnan"].infoWindowAddress="276 Bullsboro Dr<br>Newnan, GA 30263";
        MyOffices["Newnan"].infoWindowDetails="";
        MyOffices["Newnan"].imageAvailable=false;
        MyOffices["Newnan"].infoWindowPictureURL="images_new/PhotoNA.jpg";
        MyOffices["Newnan"].infoWindowPictureWidth=250;
        MyOffices["Newnan"].infoWindowPictureHeight=250;
        map.addOverlay(MyOffices["Newnan"].gMapMarker);
        GEvent.addListener(MyOffices["Newnan"].gMapMarker,"click", function() {
        	infoWindowPopup("Newnan",false)
        })
        
        //Rome office
        MyOffices["Rome"] = new office("Rome");
        MyOffices["Rome"].gMapMarker=new GMarker(new GLatLng(34.254228,-85.171465),MyIcon);
        MyOffices["Rome"].infoWindowOfficeName="ROME OFFICE&nbsp;";
        MyOffices["Rome"].infoWindowAddress="401 Broad Street<br>Suite 306<br>Rome, GA 30161";
        MyOffices["Rome"].infoWindowDetails="";
        MyOffices["Rome"].imageAvailable=false;
        MyOffices["Rome"].infoWindowPictureURL="images_new/PhotoNA.jpg";
        MyOffices["Rome"].infoWindowPictureWidth=250;
        MyOffices["Rome"].infoWindowPictureHeight=250;
        map.addOverlay(MyOffices["Rome"].gMapMarker);
        GEvent.addListener(MyOffices["Rome"].gMapMarker,"click", function() {
        	infoWindowPopup("Rome",false)
        })
        
        //Cartersville office
        MyOffices["Cartersville"] = new office("Cartersville");
        MyOffices["Cartersville"].gMapMarker=new GMarker(new GLatLng(34.184621,-84.794599),MyIcon);
        MyOffices["Cartersville"].infoWindowOfficeName="CARTERSVILLE OFFICE&nbsp;";
        MyOffices["Cartersville"].infoWindowAddress="807 N Tennessee St<br>Suite 103<br>Cartersville, GA 30120";
        MyOffices["Cartersville"].infoWindowDetails="";
        MyOffices["Cartersville"].imageAvailable=false;
        MyOffices["Cartersville"].infoWindowPictureURL="images_new/PhotoNA.jpg";
        MyOffices["Cartersville"].infoWindowPictureWidth=250;
        MyOffices["Cartersville"].infoWindowPictureHeight=250;
        map.addOverlay(MyOffices["Cartersville"].gMapMarker);
        GEvent.addListener(MyOffices["Cartersville"].gMapMarker,"click", function() {
        	infoWindowPopup("Cartersville",false)
        })
        
        //Dalton office
        MyOffices["Dalton"] = new office("Dalton");
        MyOffices["Dalton"].gMapMarker=new GMarker(new GLatLng(34.762283,-84.963004),MyIcon);
        MyOffices["Dalton"].infoWindowOfficeName="DALTON OFFICE&nbsp;";
        MyOffices["Dalton"].infoWindowAddress="415 E Walnut Ave<br>Suite 110<br>Dalton, GA 30721";
        MyOffices["Dalton"].infoWindowDetails="";
        MyOffices["Dalton"].imageAvailable=false;
        MyOffices["Dalton"].infoWindowPictureURL="images_new/PhotoNA.jpg";
        MyOffices["Dalton"].infoWindowPictureWidth=250;
        MyOffices["Dalton"].infoWindowPictureHeight=250;
        map.addOverlay(MyOffices["Dalton"].gMapMarker);
        GEvent.addListener(MyOffices["Dalton"].gMapMarker,"click", function() {
        	infoWindowPopup("Dalton",false)
        })
		
	
        
        //Douglasville office
        MyOffices["Douglasville"] = new office("Douglasville");
        MyOffices["Douglasville"].gMapMarker=new GMarker(new GLatLng(33.721091,-84.72388),MyIcon);
        MyOffices["Douglasville"].infoWindowOfficeName="Douglasville OFFICE&nbsp;";
        MyOffices["Douglasville"].infoWindowAddress="3400 Chapel Hill Rd<br>Suite 327<br>Douglasville, GA 30135";
        MyOffices["Douglasville"].infoWindowDetails="";
        MyOffices["Douglasville"].imageAvailable=false;
        MyOffices["Douglasville"].infoWindowPictureURL="images_new/PhotoNA.jpg";
        MyOffices["Douglasville"].infoWindowPictureWidth=250;
        MyOffices["Douglasville"].infoWindowPictureHeight=250;
        map.addOverlay(MyOffices["Douglasville"].gMapMarker);
        GEvent.addListener(MyOffices["Douglasville"].gMapMarker,"click", function() {
        	infoWindowPopup("Douglasville",false)
        })
        
        //Jonesboro office
        MyOffices["Jonesboro"] = new office("Jonesboro");
        MyOffices["Jonesboro"].gMapMarker=new GMarker(new GLatLng(33.559129,-84.346091),MyIcon);
        MyOffices["Jonesboro"].infoWindowOfficeName="JONESBORO OFFICE&nbsp;";
        MyOffices["Jonesboro"].infoWindowAddress="7183 Jonesboro Rd<br>Suite 100<br>Morrow, GA 30260";
        MyOffices["Jonesboro"].infoWindowDetails="";
        MyOffices["Jonesboro"].imageAvailable=false;
        MyOffices["Jonesboro"].infoWindowPictureURL="images_new/PhotoNA.jpg";
        MyOffices["Jonesboro"].infoWindowPictureWidth=250;
        MyOffices["Jonesboro"].infoWindowPictureHeight=250;
        map.addOverlay(MyOffices["Jonesboro"].gMapMarker);
        GEvent.addListener(MyOffices["Jonesboro"].gMapMarker,"click", function() {
        	infoWindowPopup("Jonesboro",false)
        })

        //Kennesaw office
        MyOffices["Kennesaw"] = new office("Kennesaw");
        MyOffices["Kennesaw"].gMapMarker=new GMarker(new GLatLng(34.048819,-84.562454),MyIcon);
        MyOffices["Kennesaw"].infoWindowOfficeName="KENNESAW OFFICE&nbsp;";
        MyOffices["Kennesaw"].infoWindowAddress="125 Townpark Dr<br>Suite 300<br>Kennesaw, GA 30144";
        MyOffices["Kennesaw"].infoWindowDetails="";
        MyOffices["Kennesaw"].imageAvailable=false;
        MyOffices["Kennesaw"].infoWindowPictureURL="images_new/PhotoNA.jpg";
        MyOffices["Kennesaw"].infoWindowPictureWidth=250;
        MyOffices["Kennesaw"].infoWindowPictureHeight=250;
        map.addOverlay(MyOffices["Kennesaw"].gMapMarker);
        GEvent.addListener(MyOffices["Kennesaw"].gMapMarker,"click", function() {
        	infoWindowPopup("Kennesaw",false)
        })		
      }
    }
function office (name) {
	this.name = name
}
function infoWindowPopup (officeName, showPic) {
    var tmpOffice=MyOffices[officeName];
    var infoWinHTML;
    infoWinHTML="" + 
        "<table " + 
                "style='"
    // Non-IE browsers need a reduction in line height for the infoWindow
    // to display properly.  The same reduction will cause IE to display
    // the text as overlapping and unreadable.
    if (navigator.userAgent.indexOf("MSIE") == -1){
    infoWinHTML+="line-height: 70%; "
    }
    infoWinHTML+="font-size: 2;'>" + 
            "<tr>" + 
                "<td " + 
                        "colspan='2'>" + 
                    "<font size='4'>" + 
                        "<b>" + tmpOffice.infoWindowOfficeName + "</b>" + 
                    "</font>" + 
                    "<hr>" + 
                "</td>" + 
            "</tr>" + 
            "<tr>" + 
                "<td " + 
                        "valign='top'>" + 
                    "<font " + 
                            "color=#0000FF " + 
                            "size='2'>" + 
                        "Address:" + 
                    "</font>" + 
                "</td>" + 
                "<td>" + 
                    "<font " + 
                            "size='2'>" + 
                        tmpOffice.infoWindowAddress + 
                      "</font>" + 
                "</td>" + 
            "</tr>";
    if (tmpOffice.infoWindowDetails.length>0) {
        infoWinHTML+= ""+
                "<tr>" + 
                    "<td " + 
                            "valign='top'>" + 
                        "<font " + 
                                "color=#0000FF " + 
                                "size='2'>" + 
                            "Details:" + 
                        "</font>" + 
                    "</td>" + 
                    "<td>" + 
                        "<font " + 
                                "size='2'>" + 
                            tmpOffice.infoWindowDetails + 
                        "</font>" + 
                    "</td>";
    }
    infoWinHTML+= "" + 
            "</tr>";
    if (!tmpOffice.imageAvailable) {
        infoWinHTML+= "" + 
            "<tr>" + 
                "<td " + 
                        "colspan='2'>" + 
                    "<font " + 
                            "size='2' color='#808080' style='line-height: 120%;'>" + 
                        "[Picture Unavailable]" + 
                        "<br>" + 
                    "</font>" + 
                "</td>" + 
            "</tr>"
    }        
    else if (showPic) {
        infoWinHTML+= "" + 
            "<tr>" + 
                "<td " + 
                        "colspan='2'>" + 
                    "<font " + 
                            "size='2' style='line-height: 120%;'>" + 
                        "<a " + 
                                "style=\"" + 
                                        "color:#0000FF; " + 
                                        "text-decoration: underline; " + 
                                        "cursor:pointer;\" " + 
                                "onclick=\"return infoWindowPopup('" + officeName + "',false)\">" + 
                            "Hide Picture" + 
                        "</a>" + 
                        "<br>" + 
                    "</font>" + 
                    "<img " + 
                            "width=" + tmpOffice.infoWindowPictureWidth + " " + 
                            "height=" + tmpOffice.infoWindowPictureHeight + " " + 
                            "src='" + tmpOffice.infoWindowPictureURL + "' " + 
                            "style='" + 
                                    "border-style: solid; " + 
                                    "border-color: black; " + 
                                    "border-width: 1px;' />" + 
                "</td>" + 
            "</tr>"
    }
    else {
        infoWinHTML+= "" + 
            "<tr>" + 
                "<td " + 
                        "colspan='2'>" + 
                    "<font " + 
                            "size='2'>" + 
                        "<a " + 
                                "style=\"" + 
                                        "color:#0000FF; " + 
                                        "text-decoration: underline; " + 
                                        "cursor:pointer;\" " + 
                                "onclick=\"return infoWindowPopup('" + officeName + "',true)\">" + 
                            "Show Picture" + 
                        "</a>" + 
                        "<br>&nbsp;" + 
                    "</font>" + 
                "</td>" + 
            "</tr>"
    }
    infoWinHTML+="</table>";
    tmpOffice.gMapMarker.openInfoWindowHtml(infoWinHTML);
}
//function focusDirections (officeName) {
//	for each (var tmpOffice in MyOffices) {
//	    if (tmpOffice.name != officeName) {
//	        tmpOffice.gMapMarker.hide();
//	    }
//	}
//}