﻿/**
 * com/hugoandcat/project/appcode/GoogleMaps.js
 *  
 * Compilation started: October 2007
 *
 * REQUIREMENTS: None
 *
 **/

/*
 * 1. Declare a global symbol (our namespace)
 * 2. Check if our declared symbol has already been defined (var com will pick up a defined global symbol)
 *    - If the global symbol is not first declared, testing for its existence will thrown an exception
 *      if it does not exist
 */
var com;
if (!com) com = {}; //Check for the existance of a defined HC symbol
else if (typeof com != 'object')
    throw new Error('com already exists and is not an object');

if (!com.hugoandcat) com.hugoandcat = {};
else if (typeof com.hugoandcat != 'object')
    throw new Error('com.hugoandcat already exists and is not an object');
    
if (!com.hugoandcat.project) com.hugoandcat.project = {};
else if (typeof com.hugoandcat.project != 'object')
    throw new Error('com.hugoandcat.project already exists and is not an object');

if (!com.hugoandcat.project.appcode) com.hugoandcat.project.appcode = {};
else if (typeof com.hugoandcat.project.appcode != 'object')
    throw new Error('com.hugoandcat.project.appcode already exists and is not an object');

if (com.hugoandcat.project.appcode.GoogleMaps)
    throw new Error('com.hugoandcat.project.appcode.GoogleMaps already exists');

/*
 * The namespace's classes start here. 
 */
com.hugoandcat.project.appcode.GoogleMaps = {  
  
    HC_HugoAndCat_MapInitialize : function (longVal, latVal) 
    {
        if (GBrowserIsCompatible()) 
        {
            try
            {
                //Create the map object
                var map = new GMap2(document.getElementById("map_canvas"));
                
                //Set the center position of the map
                map.setCenter(new GLatLng(longVal, latVal))
                
                //Set the zoom level
                map.setZoom(15);
                
                //Add the map controls
                map.addControl(new GSmallMapControl());

                //Add our point
                var point = new GLatLng(longVal, latVal);
                map.addOverlay(new GMarker(point));
            }
            catch (error) {}
        }
    }
}