/* /static/js/hotel.js */ /* UTF8 COOKIE éà */

function	hotelClass(name, gBoundLat, gBoundLng, gBoundZoom, gLat, gLng)
{
	this.name = name;
	this.gBoundLat = gBoundLat;
	this.gBoundLng = gBoundLng;
	this.gBoundZoom = gBoundZoom;
	this.gLat = gLat;
	this.gLng = gLng;

	this.popupGmap = null;
//	this.popupGmapPin = null;
//	this.popupGmapIcon = null;
}

hotelClass.prototype.onGmapOpenClick = function()
{
	var	el = vkDom.el('GMAPS_POPUP');

	if(el && GBrowserIsCompatible())
	{
		var	minTop = 440;	// Avoid displaying the map over the flash player

		vkDom.setText('GMAPS_TITLE', this.name);

		if(this.popupGmap == null)
		{
			var	icon;

			this.popupGmap = new GMap2(vkDom.el('GMAPS_MAP'), { mapTypes: [ G_PHYSICAL_MAP, G_NORMAL_MAP, G_SATELLITE_MAP ] });
			this.popupGmap.addControl(new GLargeMapControl());
			this.popupGmap.addControl(new GMapTypeControl());
			this.popupGmap.enableDoubleClickZoom();
			this.popupGmap.enableContinuousZoom();

			//this.popupGmap.enableScrollWheelZoom();

			this.popupGmap.setCenter(new GLatLng(this.gBoundLat, this.gBoundLng), parseInt(this.gBoundZoom));


			icon = new GIcon();
			icon.image = '/static/img/gpins/point.gif';
			icon.iconSize = new GSize(22, 23);
			icon.iconAnchor = new GPoint(5, 23);

			this.popupGmap.addOverlay(
				new GMarker(
					new GLatLng(this.gLat, this.gLng),
					{ 'icon' : icon, 'title': this.name, 'draggable' : false }
				)
			);

		}

		el.style.left = (Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) + ((document.documentElement.clientWidth-el.clientWidth)>>1))+'px';
		el.style.top = Math.max(minTop, (Math.max(document.documentElement.scrollTop, document.body.scrollTop) + ((document.documentElement.clientHeight-el.clientHeight)>>1)))+'px';

		el.style.visibility = 'visible';
	}

	return false;
}

hotelClass.prototype.onGmapCloseClick = function()
{
	vkDom.visibility('GMAPS_POPUP', false);
	return false;
}

