function ShowMap( Elem, Latitude, Longtude, Zoom , Opis, Placeid) {
    this.latitude  = Latitude;
    this.longtude  = Longtude;
    this.zoom   = Zoom;
    this.element= Elem;
    this.opis = Opis;
    this.placeid = Placeid;
    this.show();
}

function ShowCityMap( Elem ) {
this.element= Elem;
	this.show();
}    


function CloseObjects(placeid) {
this.placeid = placeid;
}

CloseObjects.prototype = new GControl();
CloseObjects.prototype.initialize = function(map) {
    var container = document.createElement("div");
    var zoomInDiv2 = document.createElement("div");
    var pl = this.placeid;
    this.setButtonStyle_(zoomInDiv2);
    container.appendChild(zoomInDiv2);

    var bb=document.createElement('b');
    bb.appendChild(document.createTextNode("Print"));
    with(bb.style) {
        borderBottom="1px solid #B0B0B0";
        borderRight="1px solid #B0B0B0";
        display="block";
        paddingTop="1px";
        fontWeight="normal";
    }
    zoomInDiv2.appendChild(bb);

    GEvent.addDomListener(zoomInDiv2, "click", function() {
        var z=map.getZoom();
        var c=map.getCenter();
        var okno=window.open('printmap.php?glan='+c.lat()+'&glon='+c.lng()+'&zoom='+z+'&placeid='+pl,'GoogleMap','width=500,height=300,scrollbars=no,top=10,left=10');

    }
    );
    
    map.getContainer().appendChild(container);
    return container;
}
CloseObjects.prototype.getDefaultPosition = function() {
    return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
}
CloseObjects.prototype.setButtonStyle_ = function(button) {
    with(button.style) {
        paddingLeft="1px";
        border="1px solid black";
        cursor="pointer";
        color="#000";
        backgroundColor="#fff";
        font="12px Arial";
        width="67px";
        textAlign="center";
        marginBottom="1px";
    }
}

GMapTypeControl.prototype.getDefaultPosition=function() {
    return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(80, 7));
}

ShowMap.prototype.show = function() {
    if (GBrowserIsCompatible()) {
	var map   = new GMap2( this.element );
	var point = new GLatLng( this.latitude, this.longtude );
	map.setCenter( point, this.zoom );
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());

    scale = new GScaleControl(); 
    scale.printable=function(){return true}; 
    map.addControl(scale); 
    
    map.addControl(new CloseObjects(this.placeid));
							//		map.addControl(new GMapTypeControl());
							
		var icon = new GIcon();
		icon.image = "./datastore/images/p4m.png";
		icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
		icon.iconSize = new GSize(37, 47);
		icon.shadowSize = new GSize(22, 20);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1);						
							
	var marker = new GMarker(point , icon)
	map.addOverlay( marker );
	var opisik = this.opis;
	GEvent.addListener(marker, "click", function() {
	        marker.openInfoWindowHtml("<center> Hotel "+ opisik +"</center>");
	});
	
   }	
}
