/*
=======================================
= Created by Andrew Davies  13/10/08  =
=======================================

function pagetakeover() {
	if button was clicked.
		- create an overlay div
		- create a container with an iframe loading the href parsed to the overlay.
}
*/

function startOverlay(overlayLink) {
//add the elements to the dom

	$("body")
		.append('<div class="overlay">&nbsp;</div><div class="shadow rounded {10px transparent}"><span class="prop">&nbsp;</span>&nbsp;<div class="clr">&nbsp</div></div><div class="container rounded {5px transparent}"><iframe src="'+overlayLink+'" frameborder="0" scrolling="yes"></iframe></div>');

	$('.rounded').corners();
	$('select').css({"display":"none"}); //hack for IE 6.0 z-index problem on select elements
	
	var $top = $(window).scrollTop();
	var $height = $(window).height();
	
	$(".overlay").css({height:$("body").height()+50+"px"});
	//scroll the inner container down to where the user is on the page.
	$('.container').css({top:$top+50+"px" });
	$('.container').css({height:$height-100+"px" });
	$('.container iframe').css({height:$height-114+"px" });

	$('.shadow').css({top:$top+42+"px" });
	$('.shadow').css({height:$height-84+"px" });
	$('.shadow .prop').css({height:$height-114+"px" });
	//animate the semitransparant layer
	$(".overlay").animate({"opacity":"0.6"}, 400, "linear");

	//position it correctly after downloading
	$(".container").load();

}

function closeOverlay() {
	
	parent.$(".overlay").fadeOut("slow");
	parent.$(".shadow").remove();
	parent.$(".container").remove();

}
/* fin. */
