Overlay = function()
{
	var params = arguments[0];
	
	this.show = function(elem, elemContainer)
	{
		document.getElementById('overlay_container').style.display = 'block';
		document.getElementById('overlay_shadow').onclick = this.close;
		
		var firstChild = getNormalChildNode(document.body);
		document.getElementById('overlay_shadow').style.width = Math.max(document.body.clientWidth, document.documentElement.clientWidth)+'px';
		document.getElementById('overlay_shadow').style.height = Math.max(document.body.clientHeight, document.documentElement.clientHeight, firstChild.offsetHeight)+'px';
	
		if (!elem)
		{
			var scrollHeight = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
			document.getElementById('overlay_block').style.top = scrollHeight+140+'px';
		}
		else
		{
			var elemPos = findElementPosition(elem);
			if (elemPos)
			{
				document.getElementById('overlay_block').style.left = elemPos.x-100+'px';
				document.getElementById('overlay_block').style.top = elemPos.y+30+'px';
			}
		}
		
		if (params && typeof(params.showf) == 'function')
		{
			params.showf();
		}
		
		if (elemContainer)
		{
			document.getElementById('overlay_content').innerHTML = elemContainer.innerHTML;
		}
	}
	this.close = function()
	{
		document.body.style.overflow = '';
		document.getElementById('overlay_container').style.display = 'none';
		
		if (params && typeof(params.hidef) == 'function')
		{
			params.hidef();
		}
		
		document.getElementById('overlay_content').innerHTML = '';
	}
	return this;
}

addEvent(window, 'load', function() {
	var make_online_request = document.getElementById('make_online_request');
	if (make_online_request)
	{
		var overlay = new Overlay();
		document.getElementById('make_online_request').href = 'javascript: void(0);';
		document.getElementById('make_online_request').onclick = function() { overlay.show(document.getElementById('make_online_request'), document.getElementById('feedback_container')); };
	}
});

/*
function zoomImage(elem)
{
	overlay2.show(elem, {innerHTML: '<img src="'+elem.href+'" alt="" />'});
}
*/
