/*
NAME
    GxControl 0.9

    Please refer to http://code.toeat.com/package/gxcontrol for additional
    documentation.

SYNOPSIS
    &lt;script src="/path/to/gxcontrol.1.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
        var myControl = new GxControl("Search Around");
        myControl.setPosition(70,14);
        myControl.positionPopup( new GPoint( 125, 150 ) );
        myControl.setImages( "/images/controls/foreground.png",
            "/images/controls/background.png" );
        myControl.setContentHTML(
            '<div class="mapPopup">' +
            '<h3 style="width: 17em;">I am triggered!</h3>' +
            'When you click on the control, this popup opens.' +
            '</div>' +
            '<br/>'
        );
        yourMap.addControl(myControl);
    &lt;/script&gt;

AUTHOR
    toEat.com <staff@toeat.com>
LICENSE
    There is no warranty of functionality of this code, if you wish to use it
    and it does not work for you, I recommend you submit a patch.  This software
    is licensed under the Lesser Gnu Public License (LGPL).  You may read
    the full text at: http://opensource.org/licenses/lgpl-license.php

*/
/* The following is copied from Google Maps (Version 20)  I am using these
   functions to create map objects nad place them.  I hope that Google
   eventually will open up these factory methods as GObject constructors or
   something
*/
function n(a){return Math.round(a)+"px";}
function Mb(a,b,c){this.type=a;this.version=b;this.os=c}
;var u=new Mb(0,0,null);var ga=navigator.userAgent.toLowerCase();if(ga.indexOf("opera")!=-1){u.type=4;if(ga.indexOf("opera/7")!=-1||ga.indexOf("opera 7")!=-1){u.version=7}else if(ga.indexOf("opera/8")!=-1||ga.indexOf("opera 8")!=-1){u.version=8}}else if(ga.indexOf("msie")!=-1&&document.all){u.type=1;if(ga.indexOf("msie 5")){u.version=5}}else if(ga.indexOf("safari")!=-1){u.type=3}else if(ga.indexOf("mozilla")!=-1){u.type=2}if(ga.indexOf("x11;")!=-1){u.os=1}else if(ga.indexOf("macintosh")!=-1){u.os=2};
function l(a){return Math.round(a)+"px"} function db(){ return false; };
function Factory() {}
Factory.create = function(a,b,c,d,e,f,g,h,i,k){var n;i=i||document;if(!k){n=i.createElement("img");if(a){n.src=a}}else{n=k(a,g,i)}if(b&&c){n.style.width=l(b);n.style.height=l(c);n.width=b;n.height=c}if(e||(d||(e==0||d==0))){n.style.position="absolute";n.style.left=l(d)+"px";n.style.top=l(e)+"px"}if(f||f==0){n.style.zIndex=f}if(u.type==1){n.unselectable="on";n.onselectstart=db}else{n.style.MozUserSelect="none"}if(u.type==1){n.galleryImg="no"}n.style.border="0";n.style.padding="0";n.style.margin="0";n.oncontextmenu=db;if(h){Ba(n,h)}return n};
function Wc(a){while(a.hasChildNodes()){a.removeChild(a.lastChild)}}
function mapObject(){}
mapObject.create=function(a,b,c,d,e,f,g,h,i){return Factory.create(a,b,c,d,e,f,g,h,i,mapObject.createElement)};
mapObject.createElement=function(a,b,c){if(typeof arguments.callee.hasFilters=="undefined"){var d=document.createElement("div");arguments.callee.hasFilters=typeof d.style.filter!="undefined"}var e;if(arguments.callee.hasFilters){var f=c.PNG_cache;if(f&&f.childNodes.length>0){e=f.removeChild(f.lastChild)}else{e=c.createElement("div");e.style.fontSize=l(1);mapObject.destroyBeforeUnload(e)}if(!e.loader){e.loader=c.createElement("img");e.loader.style.visibility="hidden";e.loader.onload=function(){if(!e.cleared){e.style.filter=mapObject.alphaImageLoader(this.src,this.ieCrop);e.src=a}}}}else{e=c.createElement("img")}mapObject.setImage(e,a,b);return e};
mapObject.alphaImageLoader=function(a,b){var c="DXImageTransform.Microsoft.AlphaImageLoader";var d=",sizingMethod="+(b?"crop":"scale");return"progid:"+c+'(src="'+a+'"'+d+")"};
mapObject.remove=function(a,b){if(a.nodeName=="DIV"){if(!b.PNG_cache){b.PNG_cache=b.createElement("div");b.PNG_cache.style.display="none";b.body.appendChild(b.PNG_cache)}b.PNG_cache.appendChild(a);mapObject.clearImage(a)}else{a.parentNode.removeChild(a)}};
mapObject.setImage=function(a,b,c){if(a.tagName=="DIV"){a.cleared=false;a.loader.ieCrop=c||false;a.loader.src=b}else{a.src=b}};
mapObject.clearImage=function(a,b){if(a.tagName=="DIV"){a.cleared=true;a.style.filter=""}else{a.src=b}};
mapObject.destroyBeforeUnload=function(a){if(!mapObject.cleanupQueue){mapObject.cleanupQueue=[];GEvent.addBuiltInListener(window,"unload",mapObject.onUnload)}mapObject.cleanupQueue.push(a)};
mapObject.onUnload=function(){for(var a=0;a<mapObject.cleanupQueue.length;++a){mapObject.destroyImage(mapObject.cleanupQueue[a])}};
mapObject.destroyImage=function(a){if(a.loader){a.loader.onload=null;a.loader=null}};
function Ia(a,b){if(a.className){a.className+=" "+b}else{a.className=b}};
function ca(a,b,c){this.anchor=a;this.offsetWidth=b||0;this.offsetHeight=c||0}
ca.prototype.apply=function(a){a.style.position="absolute";a.style[this.getWidthMeasure()]=n(this.offsetWidth);a.style[this.getHeightMeasure()]=n(this.offsetHeight)}
;ca.prototype.getWidthMeasure=function(){switch(this.anchor){case 1:case 3:return"right";default:return"left"}}
;ca.prototype.getHeightMeasure=function(){switch(this.anchor){case 2:case 3:return"bottom";default:return"top"}}
;
function setCursor( container, cursor ) {
    try {
        container.style.cursor = cursor;
    }
    catch ( c ) {
        if ( cursor == "pointer" )
            setCursor("hand");
    }
};



/*
 Now on to GxControl
*/

function GxControlNamespace() {
    function GxControl( caption ) {
        this.caption = caption || "Unnamed Control";
    }

    GxControl.prototype.initialize = function( map ) {
        this.map = map;
        var source = map.ownerDocument.createElement("div");
        source.style.width  = l(47);
        source.style.height = l(47);
        this.createControl( map, source );
        map.container.appendChild( source );
        this.div = map.createPane();
        map.container.appendChild( this.div );
        map.GxPopupWindow = this;
        return source;
    }

    GxControl.prototype.setContentHTML = function( ContentText ) {
        this.content = ContentText;
    }

    GxControl.prototype.setContent = function ( domNode ) {
        this.textNode = domNode;
    }

    GxControl.prototype.setRemoteContent = function( remoteURL ) {
        this.remoteURL = remoteURL;
    }
    
    GxControl.prototype.setPosition = function( x, y ) {
        this.position = new GControlPosition( 0, x, y );
    }

    GxControl.prototype.getDefaultPosition = function() {
        if ( this.position ) {
            return this.position;
        } else {
            return new GControlPosition(0, 70, 14);
        }
    }

    GxControl.prototype.setIcon = function( icon ) {

    }

    GxControl.prototype.setShadow = function( icon ) {

    }

    GxControl.prototype.setImages = function( icon, shadow ) {
        this.iconImage   = icon;
        this.shadowImage = shadow;
    }

    GxControl.prototype.createControl = function( map, doc ) {
        var shadowObj = mapObject.create( this.shadowImage, 47, 47, 0, 0, 0, false, null, map.ownerDocument );
        doc.appendChild(shadowObj);
        var iconObj = mapObject.create( this.iconImage, 47, 47, 0, 0, 1, false, null, map.ownerDocument );
        setCursor( iconObj, "pointer" );
        GEvent.bindDom( iconObj, "click", this, this.handleClick );
        iconObj.caption = this.caption;
        doc.appendChild(iconObj);
    }

    GxControl.prototype.positionPopup = function( newPoint ) {
        try {
            if ( newPoint.x > 0 && newPoint.y > 0 ) 
                this.popupPosition = newPoint;
            else
                throw "Invalid position specified";
        } catch(e) {
            throw(e);
        }
    }

    GxControl.prototype.handleClick = function() {
        //GEvent.trigger(this, "click");
        this.openPopupWindow();
    }

    GxControl.prototype.createPopupWindow = function() {
        if ( !this.popupWindow ) {
            this.popupWindow = new GxPopupWindow( this.div, 6000, false );
            this.position = this.getDefaultPosition();
        }
        else if ( this.popupWindow.isVisisble() ) {
            this.popupWindow.hide();
        }
        GEvent.bind(this.popupWindow, "closeclick", this, this.popupCloseClick);
    };

    GxControl.prototype.popupCloseClick = function() {
        this.closePopupWindow();
    }

    GxControl.prototype.openPopupWindow = function( content ) {
        if ( !this.popupWindow )
            this.createPopupWindow();
        this.popupWindow.setContent(this.content);
        if ( this.popupPosition ) {
            this.popupWindow.positionAt( this.popupPosition.x, this.popupPosition.y );
        } else {
            this.popupWindow.positionAt( 125, 150 );
        }
        this.popupWindow.show();
    }

    /* openPopupWindowHtml -
       Input: Plain text html
    */ 
    GxControl.prototype.openPopupWindowHtml = function( content ) {

    }

    /* openPopupWindowXslt -
       Input: XML DOM Object, Path to XSLT
    */ 
    GxControl.prototype.openPopupWindowXslt = function( xmlDoc, pathToXslt ) {

    }

    GxControl.prototype.closePopupWindow = function() {
        if ( this.popupWindow && this.popupWindow.isVisible() ) {
            this.popupWindow.hide();
        }
    }

    function GxPopupWindow( container, depth ) {
        this.createWindow(container, depth);
        if ( u.type != 1 ) {
            this.createMask();
        } else
            this.maskPng = null;
        this.createContentArea();
        this.createCloseButton();
        this.setSize(150,50);
        this.hide()
    }

    GxPopupWindow.prototype.setContent = function( text ) {
        this.offscreenArea.innerHTML   = text;
        this.flipOffscreenAndSize();
    }

    GxPopupWindow.prototype.setContentSize = function(a, b) {
        this.setSize(a-(this.window.w.width-25)*2,b-(this.window.n.height-15)*2)
    }

    GxPopupWindow.prototype.setSize = function(width, height) {
        if ( width < 0 ) width = 0;
        if ( height < 0 ) height = 0;
        this.width = width; this.height = height;
        this.setWindowSize( width, height );

        if ( this.hasMask() )
            this.setMaskSize();
        this.closeButton.style.left = this.getTotalWidth() - this.closeButton.width - 11 + "px";
        this.closeButton.style.top = "10px"
    }

    GxPopupWindow.prototype.getWindowHeight = function() {
        return this.window.c.height + 2 * this.window.n.height;
    }

    GxPopupWindow.prototype.getTotalHeightAboveGround = function() {
        var a = this.pixelOffset ? this.pixelOffset.height : 0;
        return this.getTotalHeight() - a;
    }

    GxPopupWindow.prototype.getTotalWidth = function() {
        return this.width + this.window.w.width + this.window.e.width;
    }

    GxPopupWindow.prototype.getTotalHeight = function() {
        return this.height + this.window.n.height;
    }

    GxPopupWindow.prototype.getOffsetLeft = function() {
        return this.windowDiv.offsetLeft;
    }

    GxPopupWindow.prototype.getOffsetTop = function() {
        return this.windowDiv.offsetTop;
    }

    GxPopupWindow.prototype.setWindowSize = function(a, b) {
        this.window.n.style.width  = a + "px";
        this.window.e.style.height = b + "px";
        this.window.c.style.width  = a + "px";
        this.window.c.style.height = b + "px";
        this.window.w.style.height = b + "px";
        this.window.s1.style.width = a + "px";
        var d = a + this.window.w.width + "px";
        this.window.ne.style.left = d;
        this.window.e.style.left  = d;
        this.window.se.style.left = d;

        var e = b + this.window.n.height + "px";
        this.window.sw.style.top = e;
        this.window.s1.style.top = e;
        this.window.se.style.top = e;
    }

    GxPopupWindow.prototype.setMaskSize = function() {
        this.maskPng.style.width=this.getTotalWidth()+"px";
        this.maskPng.style.height=this.getTotalHeight()+"px";
        var a=this.getTotalWidth();
        var b=this.getWindowHeight();
        var c=this.getTotalHeight();
        var g=","; var d = 0; var e = 0; var f = 0; var i = 0;
        var h=this.getMaskMap();
        if ( h ) {
            var l=h.firstChild;
            l.setAttribute("coords","0,0,0,"+b+g+f+g+b+g+i+g+c+g+e+g+b+g+a+g+b+g+a+",0");
        }
    }

    GxPopupWindow.prototype.hide = function() {
        if ( this.windowDiv )
            this.windowDiv.style.display = "none";
    }

    GxPopupWindow.prototype.show = function() {
        this.windowDiv.style.display      = "";
        this.windowDiv.style.visibility   = "visible";
        if ( this.offscreenArea.innerHTML ) {
            this.contentArea.innerHTML = this.offscreenArea.innerHTML;
            this.sizeToContent();
        }
        this.contentArea.style.visibility = "visible";
    }

    GxPopupWindow.prototype.isVisible = function() {
        return this.windowDiv && this.windowDiv.style.display != "none";
    }

    GxPopupWindow.prototype.positionAt = function(a, b, c) {
        var d = this.window.w.width+5;
        var e = this.height + this.window.n.height + this.window.s1.height;
        this.left = a - d;
        this.top  = b - e;
        var f = 0;
        var i = this.getTotalHeight();
        if ( c ) {
            this.left += c.width;
            this.top  += c.height;
            f-=Math.floor(c.height/2)-c.width+4;
            i-=Math.floor(c.height/2)-4
        }
        this.windowDiv.style.left = this.left + "px";
        this.windowDiv.style.top  = this.top + "px";
    }
    
    GxPopupWindow.prototype.createCroppingDiv=function(a) {
        var b=window.document.createElement("div");
        b.style.overflow="hidden";
        b.style.position="absolute";
        b.style.width=a.width+"px";
        b.style.height=a.height+"px";
        b.style.left=a.style.left+"px";
        b.style.top=a.style.top+"px";
        b.style.zIndex=a.style.zIndex;
        a.style.left="0px";
        a.style.top="0px";
        b.appendChild(a);
        return b
    };

    GxPopupWindow.prototype.createWindow = function(container, newZIndex) {
        this.window=new Object();
        this.window.nw=mapObject.create(Yb,25,25,0,0,0,false);
        this.window.n=mapObject.create(Wb,640,25,this.window.nw.width,0,0,true);
        this.window.ne=mapObject.create(Xb,25,25,0,0,0,false);
        this.window.w=mapObject.create(kc,25,640,0,this.window.nw.height,0,true);
        this.window.c=mapObject.create(Tb,640,640,this.window.w.width,this.window.n.height,0,true);
        this.window.e=mapObject.create(Vb,25,640,0,this.window.ne.height,0,true);
        this.window.sw=mapObject.create(jc,25,25,0,0,0,false);
        this.window.s1=mapObject.create(lb,640,25,this.window.sw.width,0,0,true);
        this.window.se=mapObject.create(iw_se,25,25,0,0,0,false);
        this.windowDiv=window.document.createElement("div");
        this.windowDiv.style.position="absolute";
        this.windowDiv.style.left="0px";
        this.windowDiv.style.top="0px";
        this.windowDiv.style.zIndex= newZIndex || 2000;
        Ia(this.windowDiv,"noprint");
        GEvent.bindDom( this.windowDiv, "dblclick", this, this.onDoubleClick );
        this.windowDiv.appendChild(this.window.nw);
        this.windowDiv.appendChild(this.window.n);
        this.windowDiv.appendChild(this.window.ne);
        this.windowDiv.appendChild(this.window.w);
        this.windowDiv.appendChild(this.window.c);
        this.windowDiv.appendChild(this.window.e);
        this.windowDiv.appendChild(this.window.sw);
        this.windowDiv.appendChild(this.window.s1);
        this.windowDiv.appendChild(this.window.se);
        container.appendChild( this.windowDiv );
    };

    GxPopupWindow.prototype.hasMask = function() {
        return this.maskPng != null;
    }

    GxPopupWindow.prototype.getMaskMap = function() {
        return document.getElementById(this.maskMapId);
    }

    /* Google Hosted Images (rounded corners for info windows) */
    var google = "http://www.google.com/mapfiles/";
    var local  = "/images/mapfiles/";
    var Jc = google + "transparent.gif"; var rb = 0;
    var Ub=google+"close.gif";
    var Yb=google+"iw_nw.png";var Wb=google+"iw_n.png";var Xb=google+"iw_ne.png";var Vb=google+"iw_e.png";var Tb=google+"iw_c.png";var kc=google+"iw_w.png";
    var jc=local+"iw_sw.png";var lb=local+"iw_s.png";var iw_se=local+"iw_se.png";

    GxPopupWindow.prototype.createMask=function() {
        var a=document.createElement("map");
        this.maskMapId="iwMap"+rb;
        a.setAttribute("id",this.maskMapId);
        a.setAttribute("name",this.maskMapId);
        rb++;
        this.windowDiv.appendChild(a);
        var b=document.createElement("area");
        b.setAttribute("shape","poly");
        b.setAttribute("coords","");
        b.setAttribute("href","");
        b.onclick=db;
        b.onmousedown=this.onmousedown;
        a.appendChild(b);
        for ( var c=0;c<10;c++ ) {
            var b=document.createElement("area");
            b.setAttribute("shape","poly");
            b.setAttribute("coords","");
            b.setAttribute("href","javascript:void(0)");
            b.onclick=db;
            a.appendChild(b);
        }
        this.maskPng=mapObject.create(Jc,0,0,0,0,0,false);
        this.windowDiv.appendChild(this.maskPng);
        this.maskPng.setAttribute("usemap","#"+this.maskMapId);
        this.nextMaskArea=1;
    }

    GxPopupWindow.prototype.renderXslt = function( coords, mEvent) {
        if ( this.hasMask() ) {
            var mask = this.getMaskMap();
            if ( this.nextMaskArea < mask.childNodes.length ) {
                var d = mask.childNodes[this.nextMaskArea];
                d.setAttribute("coords", coords.join(","));
                d.onmousedown = mEvent;
                this.nextMaskArea++;
            }
        }
    }

    GxPopupWindow.prototype.clearMaskMap = function() {
        if (this.hasMask() ) {
            var a=this.getMaskMap();
            for (var b=1;b<a.childNodes.length;b++ ) {
                var c=a.childNodes[b];
                c.setAttribute("coords","");
                c.onmousedown=null
            }
            this.nextMaskArea=1
        }
    }
    GxPopupWindow.prototype.getMaskLeft = function() {
        return this.windowDiv.offsetLeft;
    };

    GxPopupWindow.prototype.getMaskTop = function() {
        return this.windowDiv.offsetTop;
    };

    GxPopupWindow.prototype.createContentArea = function() {
        var a=window.document.createElement("DIV");
        a.style.position="absolute";
        a.style.left="15px";
        a.style.top="15px";
        a.style.zIndex=3;
        setCursor(a,"auto");
        a.onmousedown=this.onMouseDown;
        this.windowDiv.appendChild(a);
        this.contentArea=a;
        this.contentArea.onmousedown=this.onMouseDown;
        a=window.document.createElement("DIV");
        a.style.position="absolute";
        a.style.left=l(-screen.width)+"px";
        a.style.top=l(-screen.height)+"px";
        a.style.width=l(screen.width);
        a.style.height=l(screen.height);
        a.style.visibility="hidden";
        this.offscreenContainer=a;
        window.document.body.appendChild(a);
        a=window.document.createElement("DIV");
        a.style.position="absolute";
        a.style.left="15px";
        a.style.top="15px";
        a.style.zIndex=3;
        setCursor(a,"auto");
        this.offscreenArea=a;
        //this.offscreenArea.onmousedown=this.onMouseDown;
        this.offscreenContainer.appendChild(this.offscreenArea);
    };

    GxPopupWindow.prototype.prepareOffscreen=function(a) {
        if (this.windowDiv.style.display=="none" ) {
            this.windowDiv.style.display="";
            this.shadowDiv.style.display="";
            this.windowDiv.style.visibility="hidden";
            this.shadowDiv.style.visibility="hidden";
            this.contentArea.style.visibility="hidden";
            this.offscreenArea.style.visibility="hidden"
        }
        if ( a ) {
            this.offscreenContainer.style.width=n(a)
        }
    };

    GxPopupWindow.prototype.clearOffscreenArea=function() {
        Wc(this.offscreenArea)
    };

    GxPopupWindow.prototype.flipOffscreenAndSize=function() {
        var a = Math.max(this.offscreenArea.offsetWidth,200);
        var b=Math.max(this.offscreenArea.offsetHeight,85);
        this.flipOffscreenArea(a,b);
        this.setContentSize(a,b)
    };

    GxPopupWindow.prototype.sizeToContent = function() {
        this.setContentSize(Math.max(this.contentArea.offsetWidth,183),this.contentArea.offsetHeight);
    };

    GxPopupWindow.prototype.flipOffscreenArea = function(a,b) {
        this.offscreenContainer.removeChild(this.offscreenArea);
        this.windowDiv.removeChild(this.contentArea);
        var c=this.offscreenArea;
        this.offscreenArea=this.contentArea;
        this.contentArea=c;
        this.offscreenContainer.appendChild(this.offscreenArea);
        this.windowDiv.appendChild(this.contentArea);
        if ( a&&b ) {
            this.contentArea.style.width=n(a);
            this.contentArea.style.height=n(b)
        }
        this.offscreenArea.style.width="auto";
        this.offscreenArea.style.height="auto";
        this.contentArea.style.visibility="visible";
        this.clearOffscreenArea()
    };

    GxPopupWindow.prototype.onMouseDown=function(a) {
        GEvent.trigger(this, "click");
    };

    GxPopupWindow.prototype.onDoubleClick = function(a) {
        GEvent.trigger(this, "doubleclick");
    };

    GxPopupWindow.prototype.createCloseButton = function() {
        this.closeButton=Factory.create(Ub,14,13,null,null,4,null,null);
        this.closeButton.style.position="absolute";
        setCursor(this.closeButton,"pointer");
        GEvent.bindDom(this.closeButton,"mousedown",this,this.onCloseMouseDown);
        this.windowDiv.appendChild(this.closeButton);
    };

    GxPopupWindow.prototype.onCloseMouseDown=function(a) {
        this.hide();
        GEvent.trigger(this,"closeclick");
    };


    GxPopupWindow.prototype.renderXslt = function() {

    };

    var local = "/images/mapfiles/";
    var Gb = local + "center.png";
    var Hb = local + "east.png";
    var Lb = local + "west.png";
    var Ib = local + "north.png";
    var Kb = local + "south.png";
    var Jb = local + "panBackground.png";
    var Mb = local + "zoom-plus.png";
    var Nb = local + "zoom-minus.png";

    GLargeMapControl.prototype.createPanningControls = function(a,b) {
        var c = mapObject.create(Jb,50,50,3,4,0,false,null,a.ownerDocument);
        b.appendChild(c);
        var d = mapObject.create(Ib,18,14,19,0,1,false,null,a.ownerDocument);
        setCursor(d,"pointer");
        GEvent.bindDom(d,"click",this,function(h){a.pan(0,Math.floor(a.viewSize.height*0.5));z(h)});
        d.title=_mPanNorth;b.appendChild(d);var e=mapObject.create(Hb,14,18,42,18,1,false,null,a.ownerDocument);setCursor(e,"pointer");
        GEvent.bindDom(e,"click",this,function(h){a.pan(-Math.floor(a.viewSize.width*0.5),0);z(h)});
        e.title=_mPanEast;b.appendChild(e);var f=mapObject.create(Kb,18,14,19,42,1,false,null,a.ownerDocument);setCursor(f,"pointer");
        GEvent.bindDom(f,"click",this,function(h){a.pan(0,-Math.floor(a.viewSize.height*0.5));z(h)});f.title=_mPanSouth;b.appendChild(f);var i=mapObject.create(Lb,14,18,0,18,1,false,null,a.ownerDocument);setCursor(i,"pointer");
        GEvent.bindDom(i,"click",this,function(h){a.pan(Math.floor(a.viewSize.width*0.5),0);z(h)});i.title=_mPanWest;b.appendChild(i);var g=mapObject.create(Gb,18,18,19,19,1,false,null,a.ownerDocument);setCursor(g,"pointer");
        GEvent.bindDom(g,"click",this,function(h){a.closeInfoWindow();if(a.lastPageCenter){if(a.lastPageZoom!=a.zoomLevel){a.centerAndZoom(a.lastPageCenter,a.lastPageZoom)}else{a.recenterOrPanToLatLng(a.lastPageCenter)}}else if(a.lastLatLng){a.recenterOrPanToLatLng(a.lastLatLng)}z(h)});
        g.title=_mLastResult;b.appendChild(g);
    }

    GLargeMapControl.prototype.getDefaultPosition = function() {
        return new ca(0,9,39);
    }

    function makeInterface(a) {
        var parent = a || window;
        parent.GxControl = GxControl;
        parent.GxPopupWindow = GxPopupWindow;
    }
    makeInterface();
}

GxControlNamespace();


