/* - - - - - - - - - - - - - - - - - - - - - - -
 JavaScript
 Monday, June 26, 2006 8:42:25 PM
 HAPedit 3.1.11.111
 - - - - - - - - - - - - - - - - - - - - - - - */

 
    //<![CDATA[

    function createMarker(map, point, isActive, name, link)
    {
        if (isActive == true)
        {
            var icon = new GIcon();
            icon.image = "http://labs.google.com/ridefinder/images/mm_20_green.png";
            icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
            icon.iconSize = new GSize(12, 20);
            icon.shadowSize = new GSize(22, 20);
            icon.iconAnchor = new GPoint(6, 20);
            icon.infoWindowAnchor = new GPoint(5, 1);

            var marker = new GMarker(point, icon);

            GEvent.addListener(marker, "click", function()
            {
                if (link != null)
                {
                    marker.openInfoWindowHtml("<b><a href =\"" + link + "\">" + name + "</a></b>");
                }
                else
                {
                    marker.openInfoWindowHtml("<b>" + name + "</b>");
                }
            });

            map.addOverlay( marker );
        }
        else
        {
            var icon = new GIcon();
            icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
            icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
            icon.iconSize = new GSize(12, 20);
            icon.shadowSize = new GSize(22, 20);
            icon.iconAnchor = new GPoint(6, 20);
            icon.infoWindowAnchor = new GPoint(5, 1);

            var marker = new GMarker(point, icon);
       
            GEvent.addListener(marker, "click", function()
            {
                if (link != null)
                {
                    marker.openInfoWindowHtml("<b><a href =\"" + link + "\">" + name + "</a></b>");
                }
                else
                {
                    marker.openInfoWindowHtml("<b>" + name + "</b>");
                }
            });

            map.addOverlay( marker );
        }
    }

    function addMarkers( map, rootDir, activePub )
    {
        if (rootDir == null)
        {
            rootDir="";
        }

        // Atlantic Trap & Gill
        createMarker( map, new GLatLng(49.27651980955746, -123.12548518180847), (activePub == "atla1"), "Atlantic Trap & Gill", rootDir + "pubs/atla1/index.php" );

        // Balthazar
        createMarker( map, new GLatLng(49.286129309822485, -123.14083814620972), (activePub == "balt1"), "Balthazar", rootDir + "pubs/balt1/index.php" );

        // Black Frog
        createMarker( map, new GLatLng(49.28470165109226, -123.10938119888306), (activePub == "blac1"), "Black Frog", rootDir + "pubs/blac1/index.php" );

        // Blarney Stone
        createMarker( map, new GLatLng(49.28267906379711, -123.10399532318115), (activePub == "blar1"), "Blarney Stone", rootDir + "pubs/blar1/index.php" );

        // Browns Restaurant Bar
        createMarker( map, new GLatLng(49.27497987580502, -123.12164425849915), (activePub == "brow1"), "Browns Restaurant Bar", rootDir + "pubs/brow1/index.php" );

        // Buffalo club
        createMarker( map, new GLatLng(49.27767472832097, -123.1257963180542), (activePub == "buff1"), "Buffalo Club", rootDir + "pubs/buff1/index.php" );

        // Cactus Club Cafe (Robson)
        createMarker( map, new GLatLng(49.28524752548778, -123.12610745429993), (activePub == "cact1"), "Cactus Club (Robson)", rootDir + "pubs/cact1/index.php"  );

        // Cactus Club Cafe (Yaletown)
        createMarker( map, new GLatLng(49.27504987383679, -123.12262058258057), (activePub == "cact2"), "Cactus Club (Yaletown)", rootDir + "pubs/cact2/index.php"  );

        // Cambie
        createMarker( map, new GLatLng(49.283308944168105, -123.1089735031128), (activePub == "camb1"), "Cambie", rootDir + "pubs/camb1/index.php"  );

        // Caprice - 967 Granville St
        createMarker( map, new GLatLng(49.27976751220552, -123.12259912490845), (activePub == "capr1"), "Caprice", rootDir + "pubs/capr1/index.php" );

        // Celebrities
        createMarker( map, new GLatLng(49.279354561883075, -123.1298303604126), (activePub == "cele1"), "Celebrities", rootDir + "pubs/cele1/index.php" );

        // Central
        createMarker( map, new GLatLng(49.28843867025024, -123.13965797424316), (activePub == "cent1"), "Central", rootDir + "pubs/cent1/index.php" );

        // Clove
        createMarker( map, new GLatLng(49.29213342194709, -123.13500165939331), (activePub == "clov1"), "Clove", rootDir + "pubs/clov1/index.php" );

        // Coco Rico Cafe
        createMarker( map, new GLatLng(49.2868011349216, -123.12854290008545), (activePub == "coco1"), "Coco Rico Cafe", rootDir + "pubs/coco1/index.php" );

        // DIX - 871 Beatty St. - Tel: (604) 682-2739
        createMarker( map, new GLatLng(49.27693978314591, -123.1152606010437), (activePub == "dix1"), "DIX", rootDir + "pubs/dix1/index.php" );

        // Doghouse -  118 Robson Street - http://www.thedoghouselounge.com/
        createMarker( map, new GLatLng(49.27760473401421, -123.11427354812622), (activePub == "dogh1"), "Doghouse", rootDir + "pubs/dogh1/index.php" );

        // Doolins - 654 Nelson St - http://www.doolins.ca/
        createMarker( map, new GLatLng(49.279067594368485, -123.12297463417053), (activePub == "dool1"), "Doolins", rootDir + "pubs/dool1/index.php" );

        // Dover Arms
        createMarker( map, new GLatLng(49.289810239181804, -123.13828468322754), (activePub == "dove1"), "Dover Arms", rootDir + "pubs/dove1/index.php" );

        // Earls on Hornby
        createMarker( map, new GLatLng(49.28152426222036, -123.12370419502258), (activePub == "earl1"), "Earls (Hornby)", rootDir + "pubs/earl1/index.php" );

        // Earls on Robson
        createMarker( map, new GLatLng(49.28605932751487, -123.1266975402832), (activePub == "earl2"), "Earls (Robson)", rootDir + "pubs/earl2/index.php" );

        // Fogg 'n' Suds - 1323 Robson - Tel: 604-683-2337
        createMarker( map, new GLatLng(49.28724201516806, -123.12856435775757), (activePub == "fogg1"), "Fogg 'n' Suds", rootDir + "pubs/fogg1/index.php" );

        // Fountainhead Pub
        createMarker( map, new GLatLng(49.279788509587135, -123.129723072052), (activePub == "foun1"), "Fountainhead Pub", rootDir + "pubs/foun1/index.php" );

        // Freehouse - 1780 Davie St - Tel: +1 604 801 6681
        createMarker( map, new GLatLng(49.287060065067934, -123.14181447029114), (activePub == "free1"), "Freehouse", rootDir + "pubs/free1/index.php" );

        // Ginger 62
        createMarker( map, new GLatLng(49.27699577935417, -123.12665462493896), (activePub == "ging1"), "Ginger 62", rootDir + "pubs/ging1/index.php" );

        // Granville Rooms - 957 Granville St
        createMarker( map, new GLatLng(49.27986549991003, -123.12240600585938), (activePub == "gran1"), "Granville Rooms", rootDir + "pubs/gran1/index.php" );

        // Irish Heather - 217 Carrall Street - Tel: 604-688-9779 - http://www.irishheather.com/
        createMarker( map, new GLatLng(49.282861030064055, -123.10434937477112), (activePub == "iris1"), "Irish Heather", rootDir + "pubs/iris1/index.php" );

        // Jimmy's Tap House - 783 Homer St. - Tel: 604-689-2800
        createMarker( map, new GLatLng(49.279788509587135, -123.11668753623962), (activePub == "jimm1"), "Jimmy's Tap House", rootDir + "pubs/jimm1/index.php" );

        // Jolly Tazpayer - 828 West Hastings Street - 604-681-3550 - http://www.jollytaxpayerhotel.com/
        createMarker( map, new GLatLng(49.28605932751487, -123.11541080474854), (activePub == "joll1"), "Jolly Taxpayer", rootDir + "pubs/joll1/index.php" );

        // Jupiter Lounge
        createMarker( map, new GLatLng(49.281412280023105, -123.1335961818695), (activePub == "jupi1"), "Jupiter Lounge", rootDir + "pubs/jupi1/index.php" );

        // Lennox
        createMarker( map, new GLatLng(49.281104327669446, -123.11976671218872), (activePub == "lenn1"), "Lennox", rootDir + "pubs/lenn1/index.php" );

        // Library Square Public House - 300 West Georgia Street - Tel 604-633-9644
        createMarker( map, new GLatLng(49.28000548200732, -123.11449885368347), (activePub == "libr1"), "Library Square Public House", rootDir + "pubs/libr1/index.php" );

        // Lions Pub
        createMarker( map, new GLatLng(49.28709505552396, -123.11504602432251), (activePub == "lion1"), "Lions Pub", rootDir + "pubs/lion1/index.php" );

        // Loose Moose - 724 Nelson Ave - Tel 604.633.1002
        createMarker( map, new GLatLng(49.279403556169925, -123.12339305877686), (activePub == "loos1"), "Loose Moose", rootDir + "pubs/loos1/index.php" );

        // Lucy Mae Browns
        createMarker( map, new GLatLng(49.279445551234176, -123.11870455741882), (activePub == "lucy1"), "Lucy Mae Browns", rootDir + "pubs/lucy1/index.php" );

        // Malones Bar & Grill - 608 West Pender St - Tel : 604 684 9977 - http://www.malones.bc.ca/
        createMarker( map, new GLatLng(49.284029797386445, -123.11408042907715), (activePub == "malo1"), "Malones Bar & Grill", rootDir + "pubs/malo1/index.php" );

        // Milestone's (Denman)
        createMarker( map, new GLatLng(49.28688511241537, -123.14201831817627), (activePub == "mile1"), "Milestone's (Denman)", rootDir + "pubs/mile1/index.php" );

        // Milestone's (Robson)
        createMarker( map, new GLatLng(49.28543648060131, -123.12576413154602), (activePub == "mile2"), "Milestone's (Robson)", rootDir + "pubs/mile2/index.php" );

        // Milestone's (Yaletown)
        createMarker( map, new GLatLng(49.275945839870054, -123.12127947807312), (activePub == "mile3"), "Milestone's (Yaletown)", rootDir + "pubs/mile3/index.php" );

        // Mill Marine Bistro - 1199 West Cordova St - Tel 604.687.6455 - http://www.millbistro.ca/
        createMarker( map, new GLatLng(49.289124459485684, -123.12259912490845), (activePub == "mill1"), "Mill Marine Bistro", rootDir + "pubs/mill1/index.php" );

        // Oasis
        createMarker( map, new GLatLng(49.280488417192984, -123.1311821937561), (activePub == "oasi1"), "Oasis", rootDir + "pubs/oasi1/index.php" );

        // The Morrissey
        createMarker( map, new GLatLng(49.27692578408392, -123.1268048286438), (activePub == "morr1"), "Morrissey", rootDir + "pubs/morr1/index.php" );

        // Moxie's Bar and Grill (Robson)
        createMarker( map, new GLatLng(49.28563943158338, -123.12712669372559), (activePub == "moxi1"), "Moxie's Bar and Grill (Robson)", rootDir + "pubs/moxi1/index.php"  );

        // Moxie's Bar and Grill (Davie)
        createMarker( map, new GLatLng(49.28107633190558, -123.13253402709961), (activePub == "moxi2"), "Moxie's Bar and Grill (Davie)", rootDir + "pubs/moxi2/index.php"  );

		// Panama Jack's Bar and Grill
        createMarker( map, new GLatLng(49.277996700852576, -123.12659025192261), (activePub == "pana1"), "Panama Jack's Bar and Grill", rootDir + "pubs/pana1/index.php"  );

		// Piccadilly Pub
        createMarker( map, new GLatLng(49.28415577065357, -123.11420917510986), (activePub == "picc1"), "Piccadilly Pub", rootDir + "pubs/picc1/index.php"  );

		// The Red Room
        createMarker( map, new GLatLng(49.28398780622588, -123.11221361160278), (activePub == "redr1"), "The Red Room", rootDir + "pubs/redr1/index.php"  );

        // Republic - 958 Granville St - 604 669-3266
        createMarker( map, new GLatLng(49.27956453705538, -123.12229871749878), (activePub == "repu1"), "Republic", rootDir + "pubs/repu1/index.php" );

        // Royal
        createMarker( map, new GLatLng(49.27896960507863, -123.12350034713745), (activePub == "roya1"), "The Royal", rootDir + "pubs/roya1/index.php" );

        // Section 3
        createMarker( map, new GLatLng(49.27621882628599, -123.1197988986969), (activePub == "sect1"), "Section 3", rootDir + "pubs/sect1/index.php" );

        // Shenanigans
        createMarker( map, new GLatLng(49.286675168412806, -123.12749147415161), (activePub == "shen1"), "Shenanigans", rootDir + "pubs/shen1/index.php" );

        // Smiley O'Neal's Irish Whiskey Pub
        createMarker( map, new GLatLng(49.28646522351631, -123.11702013015747), (activePub == "smil1"), "Smiley O'Neal's Irish Whiskey Pub", rootDir + "pubs/smil1/index.php"  );

        // Soho Bar and Grill
        createMarker( map, new GLatLng(49.28674514984633, -123.14141750335693), (activePub == "soho1"), "Soho Bar and Grill", rootDir + "pubs/soho1/index.php"  );

        // Soho Cafe and Billiards -  1144 Homer Street, V6B 2X6 - Tel: 604.688.1180 - http://www.sohocafe.ca/
        createMarker( map, new GLatLng(49.27565885252162, -123.12239527702332), (activePub == "soho2"), "Soho Cafe and Billiards", rootDir + "pubs/soho2/index.php" );

        // Speakeasy - 921 Granville Street - 604-685-5531
        createMarker( map, new GLatLng(49.280131465555165, -123.12205195426941), (activePub == "spea1"), "Speakeasy", rootDir + "pubs/spea1/index.php" );

        // Spice Gallery Café and Bar
        createMarker( map, new GLatLng(49.28792082307779, -123.13034534454346), (activePub == "spic1"), "Spice Gallery Café and Bar", rootDir + "pubs/spic1/index.php" );

        // Steamworks - 375 Water Street - Tel: 604.689.2739 - http://www.steamworks.com/
        createMarker( map, new GLatLng(49.2847506400669, -123.1103789806366), (activePub == "stea1"), "Steamworks", rootDir + "pubs/stea1/index.php" );

        // Stone Temple
        createMarker( map, new GLatLng(49.27820668180603, -123.12401533126831), (activePub == "ston1"), "Stone Temple", rootDir + "pubs/ston1/index.php" );

        // Subeez - 891 Homer Street - Tel: 604-687-6107
        createMarker( map, new GLatLng(49.27861264244774, -123.1184470653534), (activePub == "sube1"), "Subeez", rootDir + "pubs/sube1/index.php" );

        // Sugar Daddy's
        createMarker( map, new GLatLng(49.28217515370739, -123.13417553901672), (activePub == "suga1"), "Sugar Daddy's", rootDir + "pubs/suga1/index.php" );

        // Tonic - 919 Granville St - 604-669-0469 - http://www.thetonicclub.com/
        createMarker( map, new GLatLng(49.28024345066084, -123.12184810638428), (activePub == "toni1"), "Tonic", rootDir + "pubs/toni1/index.php" );

        // Two Parrots Perch and Grill
        createMarker( map, new GLatLng(49.276946782675424, -123.12616109848022), (activePub == "twop1"), "Two Parrots Perch and Grill", rootDir + "pubs/twop1/index.php" );

        // Wild Garlic Bistro
        createMarker( map, new GLatLng(49.29151764922714, -123.1351625919342), (activePub == "wild1"), "Wild Garlic Bistro", rootDir + "pubs/wild1/index.php" );

        // Wings
        createMarker( map, new GLatLng(49.27744374673175, -123.12542080879211), (activePub == "wing1"), "Wings", rootDir + "pubs/wing1/index.php" );

        // Yaletown Brewing Company - 1111 Mainland Street - Tel: 604.681.2739 - http://www.markjamesgroup.com/yaletown.php
        createMarker( map, new GLatLng(49.27553985727771, -123.12088251113892), (activePub == "yale1"), "Yaletown Brewing Company", rootDir + "pubs/yale1/index.php" );

    }

    function loadPubMap( latitude, longitude, rootDir, activePub ) 
    {
      if (GBrowserIsCompatible()) 
      {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        GEvent.addListener(map, "click", function() {
              var center = map.getCenter();
              document.getElementById("message").innerHTML = center.toString();
            });
        map.setCenter(new GLatLng(latitude, longitude), 14);

        addMarkers( map, rootDir, activePub );

// Add a polyline with five random points. Sort the points by
// longitude so that the line does not intersect itself.
//var points = [];
//for (var i = 0; i < 5; i++) {
//  points.push(new GLatLng(southWest.lat() + latSpan * Math.random(),
//                          southWest.lng() + lngSpan * Math.random()));
//}
//points.sort(function(p1, p2) {
//  return p1.lng() - p2.lng();
//});
//map.addOverlay(new GPolyline(points));
      }
    }

    function loadPubMap2( latitude, longitude, rootDir, activePub ) 
    {
      if (GBrowserIsCompatible()) 
      {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        GEvent.addListener(map, "click", function() {
              var center = map.getCenter();
              document.getElementById("message").innerHTML = center.toString();
            });
        map.setCenter(new GLatLng(latitude, longitude), 14);

        
        /* Start of PHP3 Script */ 
        /* Data of SQL-server */ 
        var server= "db427.perfora.net";     /* Address of 1&1 database server */
        var user= "dbo169434331";                   /* DB-username */
        var password= "FAfmk.Q2";              /* DB-Password */
        var database= "db169434331";             /* name of database */
        var table= "Pub";                /* Name of table, you can select that */
        
        /* Accessing SQL-server */ 
        /*MYSQL_CONNECT(server, user, password) or die ( "<H3>Server unreachable</H3>");
        MYSQL_SELECT_DB(database) or die ( "<H3>Database non existent</H3>");

        
        var sqlQuery = "SELECT CodeName, Name FROM Pub WHERE 1 ORDER BY Name";
        var result=MYSQL_QUERY( sqlQuery );
        if( ! result )
        {
            echo "Error in executing the query \"$sqlQuery\"<br/>";
            echo mysql_error()."<br/>";
        }
        else
        {
            //$num_rows = mysql_num_rows($result);
            //echo "There are $num_rows pubs<br/>";
            
            echo "<table>";
            
            //while ($row  =  mysql_fetch_row($result))
            //{
            //}
        }
        */
        createMarker( map, new GLatLng(49.27651980955746, -123.12548518180847), (activePub == "atla1"), "Atlantic Trap & Gill", rootDir + "pubs/atla1/index.php" );
     }
    }

    //]]>
