document.write("<script type='text/javascript' src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA7TPFX5-Ilniw0UQCRZLfhBRJ2RAzHZrqd9CTJtLBdYUsLknadBQxvmJkt9TNxFo0BaIzK2MwiCFGkw&amp;hl=de'></scr" + "ipt>");


function EuclideanProjection(a) {
    this.pixelsPerLonDegree=[];
    this.pixelsPerLonRadian=[];
    this.pixelOrigo=[];
    this.tileBounds=[];
    var b=256;
    var c=1;
    for(var d=0;d < a;d++) {
        var e=b/2;
        this.pixelsPerLonDegree.push(b/360);
        this.pixelsPerLonRadian.push(b/(2*Math.PI));
        this.pixelOrigo.push(new GPoint(e,e));
        this.tileBounds.push(c);
        b*=2;
        c*=2
    }
}

function ELabel(point, html, classname, pixelOffset, percentOpacity, overlap) {
    // Mandatory parameters
    this.point = point;
    this.html = html;
    
    // Optional parameters
    this.classname = classname||"";
    this.pixelOffset = pixelOffset||new GSize(0,0);
    if (percentOpacity) {if(percentOpacity<0){percentOpacity=0;}
        if(percentOpacity>100){percentOpacity=100;}
    }        
    this.percentOpacity = percentOpacity;
    this.overlap=overlap||false;
    this.hidden = false;
}

jQuery(document).ready(function() {
    if (GBrowserIsCompatible()) {
    	//EuclideanProjection
        EuclideanProjection.prototype = new GProjection();
         
        EuclideanProjection.prototype.fromLatLngToPixel = function(a,b) {
            var c=Math.round(this.pixelOrigo[b].x+a.lng()*this.pixelsPerLonDegree[b]);
            var d=Math.round(this.pixelOrigo[b].y+(-2*a.lat())*this.pixelsPerLonDegree[b]);
            return new GPoint(c,d)
        };
        
        EuclideanProjection.prototype.fromPixelToLatLng = function(a,b,c) {
            var d=(a.x-this.pixelOrigo[b].x)/this.pixelsPerLonDegree[b];
            var e=-0.5*(a.y-this.pixelOrigo[b].y)/this.pixelsPerLonDegree[b];
            return new GLatLng(e,d,c)
        };
        
        EuclideanProjection.prototype.tileCheckRange = function(a,b,c) {
            var d=this.tileBounds[b];
            if (a.y<0||a.y>=d)
            {
                return false;
            }
            if(a.x<0||a.x>=d)
            {
                a.x=a.x%d;
                if(a.x<0)
                {a.x+=d;}
            }
            return true;
        }
              
        EuclideanProjection.prototype.getWrapWidth = function(zoom)
        {
            return this.tileBounds[zoom]*256;
        }
        
        //EMarkerManager
        
        //ELabel
        
        ELabel.prototype = new GOverlay();

        ELabel.prototype.initialize = function(map) {
            var div = document.createElement("div");
            div.style.position = "absolute";
            div.innerHTML = '<div class="' + this.classname + '">' + this.html + '</div>' ;
            map.getPane(G_MAP_FLOAT_SHADOW_PANE).appendChild(div);
            this.map_ = map;
            this.div_ = div;
            if (this.percentOpacity) {if(typeof(div.style.filter)=='string'){div.style.filter='alpha(opacity:'+this.percentOpacity+')';}
                if(typeof(div.style.KHTMLOpacity)=='string'){div.style.KHTMLOpacity=this.percentOpacity/100;}
                if(typeof(div.style.MozOpacity)=='string'){div.style.MozOpacity=this.percentOpacity/100;}
                if(typeof(div.style.opacity)=='string'){div.style.opacity=this.percentOpacity/100;}
            }
            if (this.overlap) {
                var z = GOverlay.getZIndex(this.point.lat());
                this.div_.style.zIndex = z;
            }
            if (this.hidden) {this.hide();}
        }
        
        ELabel.prototype.remove = function() {this.div_.parentNode.removeChild(this.div_);}
        
        ELabel.prototype.copy = function() {
        	return new ELabel(this.point, this.html, this.classname, this.pixelOffset, this.percentOpacity, this.overlap);
        }
        
        ELabel.prototype.redraw = function(force) {
            var p = this.map_.fromLatLngToDivPixel(this.point);
            var h = parseInt(this.div_.clientHeight);
            this.div_.style.left = (p.x + this.pixelOffset.width) + "px";
            this.div_.style.top = (p.y +this.pixelOffset.height - h) + "px";
        }
        
        ELabel.prototype.show = function() {
            if (this.div_) {
                this.div_.style.display="";
                this.redraw();
            }
        	this.hidden = false;
        }
        
        ELabel.prototype.hide = function() {
            if (this.div_) {this.div_.style.display="none";}
            this.hidden = true;
        }
        
        ELabel.prototype.isHidden = function() {
        	return this.hidden;
        }
        
        ELabel.prototype.supportsHide = function() {
        	return true;
        }
        
        ELabel.prototype.setContents = function(html) {
            this.html = html;
            this.div_.innerHTML = '<div class="' + this.classname + '">' + this.html + '</div>' ;
            this.redraw(true);
        }
        
        ELabel.prototype.setPoint = function(point) {
            this.point = point;
            if (this.overlap) {
                var z = GOverlay.getZIndex(this.point.lat());
                this.div_.style.zIndex = z;
            }
            this.redraw(true);
        }
        
        ELabel.prototype.setOpacity = function(percentOpacity) {
            if (percentOpacity) {if(percentOpacity<0){percentOpacity=0;}
                if(percentOpacity>100){percentOpacity=100;}
            }        
            this.percentOpacity = percentOpacity;
            if (this.percentOpacity) {if(typeof(this.div_.style.filter)=='string'){this.div_.style.filter='alpha(opacity:'+this.percentOpacity+')';}
                if(typeof(this.div_.style.KHTMLOpacity)=='string'){this.div_.style.KHTMLOpacity=this.percentOpacity/100;}
                if(typeof(this.div_.style.MozOpacity)=='string'){this.div_.style.MozOpacity=this.percentOpacity/100;}
                if(typeof(this.div_.style.opacity)=='string'){this.div_.style.opacity=this.percentOpacity/100;}
            }
        }
        
        ELabel.prototype.getPoint = function() {
        	return this.point;
        }
        
        //Global
        
        if (typeof(initialize) == 'function') {initialize();}

        jQuery(window).bind('unload', function() {GUnload();});
    }
});
