function hideOverlay(id, effect)
{
	if (effect == "fade") {
		new Effect.Fade(id);
	} else {
		new Effect.BlindUp(id);
	}
}


function showOverlay(id, effect, alpha)
{
	if (effect == "fade") {
		if (alpha && alpha != undefined) {
			//0.75
			new Effect.Appear(id, {to:alpha});
		} else {
			new Effect.Appear(id);
		}
	} else {
		new Effect.BlindDown(id);
	}
}


function positionOverlay(id, click_loc)
{
	var overlay = document.getElementById(id);
	var xPos = 0;
	var yPos = 0;
		
	if (click_loc != undefined) {
		xPos = click_loc.clientX;
		
		if (xShift) {
			xPos += xShift;
		}
		
		xPos = Math.ceil(xPos);
		yPos = click_loc.clientY;
		
		if (yShift) {
			yPos += yShift;
		}
		
		yPos = Math.ceil(yPos);
	} else {
		xPos = overlay.style.left;
		yPos = overlay.style.top;
		
		if (xShift) {
			xPos += xShift;
		}
		
		if (yShift) {
			yPos += yShift;
		}
	}
	
	overlay.style.left = xPos;
	overlay.style.top = yPos;
}


function populateOverlayAjax(id, content_page)
{
	var postVars = "";
	var sendToPage = null;
	var overlay = document.getElementById(id);
	
	//get content for overlay
	postVars = '';
	overlay.innerHTML = "Refreshing...";
	
	var opt = {
	    method: 'post',
	    postBody: postVars,
	    onSuccess: function(t) {
	        overlay.innerHTML = t.responseText;
	    },
	    on404: function(t) {
	        alert('Error 404: location "' + t.statusText + '" was not found.');
	    },
	    onFailure: function(t) {
	        alert('Error ' + t.status + ' -- ' + t.statusText);
	    }
	}

	if (content_page) {
		new Ajax.Request(content_page, opt);
	} else {
		alert ("Couldn't locate map");
	}
}


function populateOverlay(id, content)
{
	var overlay = document.getElementById(id);
	overlay.innerHTML = content;
}

function populateOverlayByAjax(id, content_page)
{
	var postVars = "";
	var sendToPage = null;
	var overlay = document.getElementById(id);
	
	if (overlay != undefined) {
		//get content for overlay
		postVars = '';
		//overlay.innerHTML = "One moment...";
		
		var opt = {
		    method: 'post',
		    postBody: postVars,
		    onSuccess: function(t) {
		        overlay.innerHTML = t.responseText;
		    },
		    on404: function(t) {
		        alert('Error 404: location "' + t.statusText + '" was not found.');
		    },
		    onFailure: function(t) {
		        alert('Error ' + t.status + ' -- ' + t.statusText);
		    }
		}
	
		if (content_page) {
			new Ajax.Request(content_page, opt);
		}
	}
}