<!--

function NtoA(a) { b = new Array(); b[0] = a; return b; }
function StoA(a) { b = a.split(','); c = new Array(); for(var d in b) c[c.length] = parseInt(b[d]); return c; }
function isFunction(a) { return typeof a == 'function'; }
function isNull(a) { return typeof a == 'object' && !a; }
function isNumber(a) { return typeof a == 'number' && isFinite(a); }
function isObject(a) { return (a && typeof a == 'object') || isFunction(a); }
function isString(a) { return typeof a == 'string'; }
function isUndefined(a) { return typeof a == 'undefined'; }
function isBoolean(a) { return typeof a == 'boolean'; }
function isArray(a) { return isObject(a) && a.constructor == Array; }

window.defaultStatus = '';

function popup(width,height,location,needscroll) {
    var options,top=(screen.availHeight-height)/2,left=(screen.availWidth-width)/2;
    options = "top="+top+",left="+left+",location=0,status=0,";
    options = options+"toolbar=0,menubar=0,directories=0,width=";
    if (width <= screen.availWidth) { options = options + width; }
        else { value = screen.availWidth-12; options = options + value; needscroll = true; }
    options = options + ",height=";
    if (height <= screen.availHeight) { options = options + height; }
        else { value = screen.availHeight-30; options = options + value; needscroll = true; }
    if (needscroll == true) { options = "scrollbars,resizable," + options; }
        else { options = "scrollbars=0,resizable=0," + options; }
    if (window.cwin) cwin.close();
    cwin=window.open(location,"",options);
    }


function imgPopup(width,height,location,description) {
    height+=40; width+=60;
    var options,top=(screen.availHeight-height)/2,left=(screen.availWidth-width)/2;
    popup=window.open("","Image","scrollbars=1,resizable=0,top="+top+",left="+left+",location=0,status=0,toolbar=0,menubar=0,directories=0,width="+width+",height="+height);
    popup.document.open();
    popup.document.write("<html><head><title>"+description+"</title></head><body marginwidth=\"0\" marginheight=\"0\" leftmargin=\"0\" topmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" onload=\"window.focus();\"><div align=\"center\"><a href=\"javascript:window.close();\"><img src="+location+" border=\"0\" style=\"margin:20px;\" alt=\"Click image to close\" /></a></div></body></html>");
    popup.document.close();
    popup.focus();
    }

function picture(width,height,location,description) {
    var options,needscroll=false,top=(screen.availHeight-height)/2,left=(screen.availWidth-width)/2;
    options = "top="+top+",left="+left+",location=0,status=0,";
    options = options+"toolbar=0,menubar=0,directories=0,width=";
    if (width <= screen.availWidth) { options = options + width; }
        else { value = screen.availWidth-12; options = options + value; needscroll = true; }
    options = options + ",height=";
    if (height <= screen.availHeight) { options = options + height; }
        else { value = screen.availHeight-30; options = options + value; needscroll = true; }
    if (needscroll == true) { options = "scrollbars,resizable," + options; }
      else { options = "scrollbars=0,resizable=0," + options; }
    if (window.pici) pici.close();
    pici=window.open("","Picture",options);
    pici.document.open();
    pici.document.write("<html><head><title>"+description+"</title></head><body marginwidth=\"0\" marginheight=\"0\" leftmargin=\"0\" topmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" onload=\"window.focus();\"><a href=\"javascript:window.close();\"><img src="+location+" border=\"0\" hspace=\"0\" vspace=\"0\" alt=\"Click image to close\" /></a></body></html>");
    pici.document.close();
    }

var map;
var mapIcons = new Array();

function mapInit(lat,lon,zoom,col)
    {
    if (!GBrowserIsCompatible()) return false;
    var m = document.getElementById('map');
    if (typeof(m) == 'undefined') return;
    map = new GMap2(m);
    if (true)
        {
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.addControl(new GScaleControl());
        }
        else
        {
        map.addControl(new GSmallZoomControl());
        }
    map.setCenter(new GLatLng(lat,lon),zoom);
    var colour = new Array('white','red');
    for(i=0;i<colour.length;i++)
        {
        tmp = new GIcon();
        tmp.image = '/img/googlemap_'+colour[i]+'.png';
        tmp.shadow = '/img/googlemap_shadow.png';
        tmp.iconSize = new GSize(12,20);
        tmp.shadowSize = new GSize(22,20);
        tmp.iconAnchor = new GPoint(6,20);
        tmp.infoWindowAnchor = new GPoint(5,1);
        mapIcons[colour[i]] = tmp;
        }
    mapIcon(lat,lon,col,'');
    }

function mapClear() { map.clearOverlays(); }

function mapIcon(lat,lon,col,data)
    {
    var marker = new GMarker(new GLatLng(lat,lon),mapIcons[col]);
    if (data)
        {
        if (isString(data))
            {
            GEvent.addListener(marker,'click',function() { marker.openInfoWindowHtml(data); });
            }
        else
            {
            var tabs = new Array();
            for (var i in data) tabs[tabs.length] = new GInfoWindowTab(i,data[i]);
            GEvent.addListener(marker,'click',function() { marker.openInfoWindowTabsHtml(tabs); });
            }
        }
    // GEvent.addListener(marker,'click',function() { marker.showMapBlowup(2); });
    map.addOverlay(marker);
    return marker;
    }

//-->
