TRestricter = function (map) {
this.map = map;
}

TRestricter.prototype.restrict = function (sw, ne) {
	this.map._allowedBounds = new GLatLngBounds(sw, ne);
	GEvent.addListener(this.map, 'move', this.checkBounds);
}

TRestricter.prototype.unrestrict = function () {
	this.map._allowedBounds = null;
}

TRestricter.prototype.checkBounds = function() {
	if (!this._allowedBounds || this._allowedBounds.contains(this.getCenter())) return;
	var x = Math.min(Math.max(this.getCenter().lng(), this._allowedBounds.getSouthWest().lng()), this._allowedBounds.getNorthEast().lng());
	var y = Math.min(Math.max(this.getCenter().lat(), this._allowedBounds.getSouthWest().lat()), this._allowedBounds.getNorthEast().lat());
	this.setCenter(new GLatLng(y,x));
}

TRestricter.prototype.zoomLevels = function (min, max) {
	var array = this.map.getMapTypes() || [];
	for (var i=0; i<array.length; i++) {
	 array[i].getMinimumResolution = function () { return min };
	 array[i].getMaximumResolution = function () { return max };
	}
}

function createMarker(point, icon, popuphtml) {
	var popuphtml = "<div id=\"popup\">" + popuphtml + "<\/div>";
	var marker = new GMarker(point, icon);
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(popuphtml);
	});
	return marker;
}

function createMarker1(point, icon, popuphtml) {
	var popuphtml = "<div id=\"popup\">" + popuphtml + "<\/div>";
	var marker = new GMarker(point, icon);
	GEvent.addListener(marker, "mouseover", function() {
		marker.openInfoWindowHtml(popuphtml);
	});
	GEvent.addListener(marker, "mouseout", function() {
		marker.closeInfoWindow();
	});
	return marker;
}

function displayPoint(marker, index){
    $("#message").hide();
    var moveEnd = GEvent.addListener(map, "moveend", function(){
        var markerOffset = map.fromLatLngToDivPixel(marker.getLatLng());
        $("#message")
            .fadeIn()
            .css({ top:markerOffset.y, left:markerOffset.x });
        GEvent.removeListener(moveEnd);
    });
    map.panTo(marker.getLatLng());
}

//function Panner(x,y,z)
function washu()
{
	window.parent.document.getElementById('fr_left').map.zoomTo(12);
}

function include(filename)
{
	var head = document.getElementsByTagName('head')[0];
	
	script = document.createElement('script');
	script.src = filename;
	script.type = 'text/javascript';
	
	head.appendChild(script)
}