// JavaScript Document

$(document).ready(function() {

	onWindowResize();
	$(window).resize(function() {
	    onWindowResize();
	});
	
	 shadowPopUp();
	 positionPopUp();

})

function shadowPopUp() {
		    $('div.shadow').append('<div class="sh_tr"></div><div class="sh_bl"></div><div class="sh_br"></div>');
		    $('div.shadow').each(function() {
		        $(this).find('.sh_tr').height(parseInt($(this).height()) + parseInt($(this).css("padding-top")) + parseInt($(this).css("padding-bottom")));
		        $(this).find('.sh_bl').width(parseInt($(this).width()) + parseInt($(this).css("padding-left")) + parseInt($(this).css("padding-right")));
		    });
}

function onWindowResize() {
    $('div.overlay').height(0);
    $('div.overlay').height($(document).height());
	positionPopUp();
}

function positionPopUp() {
	$('div.iframePopup').css("top", ($(window).height() - $('div.iframePopup').height())/2);
	if($(window).height()<$('div.iframePopup').height()) $('div.iframePopup').css("top", "10px");
	$('div.iframePopup').css("left", ($(window).width() - $('div.iframePopup').width() -7)/2);
	if($(window).width()<$('div.iframePopup').width()) $('div.iframePopup').css("left", "10px");
	}

function showPopUp() {

		$('div.overlay').show();
        $('div.iframePopup').stop(true, true);
	    if ($.browser.msie == true) {
	        $('div.iframePopup').show();
	    } else {
	         $('div.iframePopup').fadeIn(200);
	    }

}
