/**
	Function: exits from streetview and returns to map
	Global Vars:
	map
	streetviewcontrol
	streetOverlay
	**/
	
/**
	streetview info pane
	index: index into marker[] array, used to fish out data
	map: GMap2 used to calculate positioning
	parentDIV: name of the parent DIV
	**/
function customExitToMapControl(parentDIV, map) {

	this.parentDIV = parentDIV; 
	this.id = "customExitToMapControl";
	this.map = map;
	this.width = 24; 			// info window width
	this.height = 20;			// info window height
	this.rightpadding = 24;
	this.toppadding = 4;
	
	this.display = function() {
		var html = "";
		html += "<div class='exitToMapButton' title='back to map'></div>";
		html += "<div class='transBack'></div>";
		
		this.container = document.createElement("div");
		$(this.container).attr("id",this.id);
		/** position element in lower right corner of map **/
		var p = this.positionDiv();
		$(this.container).css("top", p['y'] +"px");
		$(this.container).css("left", p['x'] +"px");
		$(this.container).css("width", this.width +"px");
		$(this.container).css("height", this.height +"px");
		
		$(this.container).append(html);
		$("#"+this.parentDIV).append(this.container);
		$(this.container).css("display","block");
		
		$(this.container).bind("click", function() {
			$("#map_canvas").css("display","block");
			$("#street_canvas").css("display","none");
			$("#customExitToMapControl").css("display","none");
			infoPane.destroy();
			exitControl.destroy();
		});
		
	}
	
	this.positionDiv = function() {
		var size = this.map.getSize();
		var p = new Array();
		p['x'] = size.width - this.width - this.rightpadding;
		p['y'] = this.toppadding;
		return p;
	}
	
	this.destroy = function() {
		$(this.container).remove();	
	}
}
