function cartronixMap( iconPath, logoPath )
{
    /*specify new map: parameter is the dom element wear you want the map to go*/
    var map = new GMap2(document.getElementById("map"));
    var centermap = new GLatLng(41.551787717318234, -87.16801643371582);
    var zoomlevel = 10;
    //initializes the map object: you must do this to start.
    //first parameter is the latitude and longitude of the map.
    //second parameter is the zoom lvl of the map.
    map.setCenter( centermap, zoomlevel );
    
    //define coordinates
    var locationOne = new customIcon();
        locationOne.latitude = 41.496315705020166;
        locationOne.longitude = -87.04547166824341;
        locationOne.imagePath = iconPath;
        locationOne.imageWidth = 50;
        locationOne.imageHeight = 25;
        locationOne.iconAnchorHeight = 0;
        locationOne.iconAnchorWidth = 0;
        locationOne.infoAnchorWidth = 0;
        locationOne.infoAnchorHeight = 0;
        locationOne.infoWindowHTML = '<div class="bubble"><img src="' + logoPath + '" class="bubbleLogo" /><p><strong>Custom Audio &amp; Video Mobile Electronics</strong><br />(219) 548-2571<br />2912 N. Calumet Ave<br />Valparaiso, IN 46383<br /><em>(Across from Cumberland Crossing)</em></p><p>Hours:<br />Mon-Fri 9:00 A.M. - 6:00 P.M.<br />Saturday 9:00 A.M. - 5:00 P.M.</p></div>';
        locationOne.addToMap( map );
        locationOne.addPointLink( 'locationOne' );

        var locationOne = new customIcon();
        locationOne.latitude = 41.46877892830617;
        locationOne.longitude = -87.0307731628418;
        locationOne.imagePath = iconPath;
        locationOne.imageWidth = 50;
        locationOne.imageHeight = 25;
        locationOne.iconAnchorHeight = 0;
        locationOne.iconAnchorWidth = 0;
        locationOne.infoAnchorWidth = 0;
        locationOne.infoAnchorHeight = 0;
        locationOne.infoWindowHTML = '<div class="bubble"><img src="' + logoPath + '" class="bubbleLogo" /><p><strong>At&amp;t Wireless Services &amp; DirecTV</strong><br />(219) 464-2571<br />2410 LaPorte Ave<br />Valparaiso, IN 46383<br /><em>(North of Target)</em></p><p>Hours:<br />Mon-Fri 9:00 A.M. - 8:00 P.M.<br />Saturday 9:00 A.M. - 7:00 P.M.<br/>Sunday 11:00 A.M. - 6:00 P.M.</p></div>';
        locationOne.addToMap( map );
        locationOne.addPointLink( 'locationTwo' );
    
    var locationTwo = new customIcon();
        locationTwo.latitude = 41.4714479195703;
        locationTwo.longitude = -87.30605363845825;
        locationTwo.imagePath = iconPath;
        locationTwo.imageWidth = 50;
        locationTwo.imageHeight = 25;
        locationTwo.iconAnchorHeight = 0;
        locationTwo.iconAnchorWidth = 0;
        locationTwo.infoAnchorWidth = 0;
        locationTwo.infoAnchorHeight = 0;
        locationTwo.infoWindowHTML = '<div class="bubble"><img src="' + logoPath + '" class="bubbleLogo" /><p><strong>At&t Wireless, U-Verse, DSL, Home Phone Advanced TV, DirecTV, Accessories</strong><br />(219) 756-2571<br />1943 Southlake Mall Drive<br />Merrillville, IN 46410<br />(Lower level, Near JC Penney)</p><p>Hours:<br />Mon-Sat 10:00 A.M. - 9:00 P.M.<br /><br />Sunday 11:00 A.M. - 6:00 P.M.</p></div>';
        locationTwo.addToMap( map );
        locationTwo.addPointLink( 'locationThree' );
        
    var locationThree = new customIcon();
        locationThree.latitude = 41.55015;
        locationThree.longitude = -87.164948;
        locationThree.imagePath = iconPath;
        locationThree.imageWidth = 50;
        locationThree.imageHeight = 25;
        locationThree.iconAnchorHeight = 0;
        locationThree.iconAnchorWidth = 0;
        locationThree.infoAnchorWidth = 0;
        locationThree.infoAnchorHeight = 0;
        locationThree.infoWindowHTML = '<div class="bubble"><img src="' + logoPath + '" class="bubbleLogo" /><p><strong>At&t Wireless Services & DirecTV</strong><br />(219) 762-2571<br />6441 US Hwy 6<br />Portage, IN 46368<br />(Across from Portage High School)</p><p>Mon-Fri 10:00 A.M. - 7:00 P.M.<br />Saturday 10:00 A.M. - 5:00 P.M.<br />Sunday 11:00 A.M. - 4:00 P.M</p></div>';
        locationThree.addToMap( map );
        locationThree.addPointLink( 'locationFour' );
        
    var locationFour = new customIcon();
        locationFour.latitude = 41.49253873117616;
        locationFour.longitude = -87.47035503387451;
        locationFour.imagePath = iconPath;
        locationFour.imageWidth = 50;
        locationFour.imageHeight = 25;
        locationFour.iconAnchorHeight = 0;
        locationFour.iconAnchorWidth = 0;
        locationFour.infoAnchorWidth = 0;
        locationFour.infoAnchorHeight = 0;
        locationFour.infoWindowHTML = '<div class="bubble"><img src="' + logoPath + '" class="bubbleLogo" /><p><strong>At&t Wireless, U-Verse, DSL, Home Phone, Advanced TV, DirecTV, Accessories</strong><br />(219) 865-2571<br />1505 US Hwy 41 #A12<br />Schererville, IN 46375<br />(Just North of Wal-Mart)</p><p>Hours:<br />Mon-Friday 10:00 A.M. - 8:00 P.M.<br />Saturday 10:00 A.M. - 5:00 P.M.<br />Sunday 11:00 A.M. - 5:00 P.M.</p></div>';
        locationFour.addToMap( map );
        locationFour.addPointLink( 'locationFive' );

    var locationSix = new customIcon();
        locationSix.latitude = 41.606423;
        locationSix.longitude = -86.730202;
        locationSix.imagePath = iconPath;
        locationSix.imageWidth = 50;
        locationSix.imageHeight = 25;
        locationSix.iconAnchorHeight = 0;
        locationSix.iconAnchorWidth = 0;
        locationSix.infoAnchorWidth = 0;
        locationSix.infoAnchorHeight = 0;
        locationSix.infoWindowHTML = '<div class="bubble"><img src="' + logoPath + '" class="bubbleLogo" /><p><strong>At&amp;t Cartronix Inc. LaPorte</strong><br />(219) 324-2355<br />113 J Street<br />LaPorte IN 46350<br /></div>';
        locationSix.addToMap( map );
        locationSix.addPointLink( 'locationSix' );


         
    /*map controls*/
    var mapTypeControl = new GMapTypeControl();
    var typeTopRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(4, 4));

    var mapSmallZoomControl = new GSmallZoomControl3D();
    var zoomTopRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(4, 25));

    map.addControl( mapSmallZoomControl, zoomTopRight );
    map.addControl( mapTypeControl, typeTopRight );
}

/**
 * Event Workaround for IE and [Insert standards compliant browser here]
 * @source Scott Andrew
 */
function addEvent( domObject , szEvent, funcHandler, bUseCapture) 
{
    if( bUseCapture == null )
    {
        bUseCapture = true;
    }

    //FF
    if( domObject.addEventListener )
    {
        switch( szEvent )
        {
            case 'onclick':
                szEvent = 'click';
            break;
        }
		
        domObject.addEventListener( szEvent, funcHandler, bUseCapture );
		return true;
    }
    else if ( domObject.attachEvent )
    {
        switch( szEvent )
        {
            case 'click':
                szEvent = 'onclick';
            break;
        }
		
        var r = domObject.attachEvent( szEvent, funcHandler );
		return r;
    }
	else 
    {
		domObject[szEvent] = funcHandler;
	}

	return true;
}

function customIcon()
{
    this.mapObject;
    this.latitude;
    this.longitude;
    this.imagePath;
    this.imageWidth;
    this.imageHeight;
    this.iconAnchorWidth;
    this.iconAnchorHeight;
    this.infoAnchorWidth;
    this.infoAnchorHeight;
    this.infoWindowHTML;
    this.marker;

    this.addToMap = function( mapObject )
    {

        var point = new GLatLng( this.latitude, this.longitude );
        //create the new icon object
        var icon = new GIcon(null, this.imagePath );
        //the size of the icon
        icon.iconSize = new GSize( this.imageWidth, this.imageHeight );
        //where the icon is anchored to
        icon.iconAnchor = new GPoint( this.iconAnchorWidth, this.iconAnchorHeight);
        //where the information box is anchored to
        icon.infoWindowAnchor = new GPoint( this.infoAnchorWidth, this.infoAnchorHeight);
        //create the marker object
        var marker = new GMarker( point, { 'icon':icon } );
        var html = this.infoWindowHTML;
        GEvent.addListener( marker, "click", function() { marker.openInfoWindowHtml( html ) });
        //add to map
        mapObject.addOverlay( marker );
        this.marker = marker;
    }

    this.addPointLink = function ( idDomElement )
    {
        var element = document.getElementById( idDomElement );
        var marker = this.marker;
        var html = this.infoWindowHTML;
        addEvent( element, 'click', function() { marker.openInfoWindowHtml( html ); }, true ); 
    }
}

