<script type="text/javascript">
var div_popup = {
	redirect_on_hide : false,
	parent_redirect_url : '',
	popup_is_form : false,
	datepicker : false,
	display : function (show,url,url_params,height,width,parent_redirect_url,return_xml){
		if(parent_redirect_url!='') this.parent_redirect_url = parent_redirect_url;
		if(show){
			this.popup_is_form=false;
			this.datepicker=false;
			this.show_popup(width,height,url,url_params,return_xml);	
		}else{
			if ( this.popup_is_form ){
				if ( confirm('${ml_close_without_saving}?') )
					this.hide_popup();
			}else
				this.hide_popup();
		}
	},
	show_popup : function(width,height,url,url_params,return_xml){
		$("#div_popup_msg").html('<img src="/media/images/animated_gifs/loading.gif" border="0" width="20" height="20" />');
		if($("#flashBanner").length){ $("#flashBanner").css("visibility","hidden"); $("#flashBanner").css("top","-500px"); }
		if($("#flashVideo").length) $("#flashVideo").css("visibility","hidden");
		this.resize(width,height);			
		$("#div_popup_bg").css("visibility","visible");			
		$("#div_popup_msg").css("visibility","visible");
		$(window).bind("resize", function(){ div_popup.resize('',''); });
		$(window).bind("scroll", function(){ div_popup.resize('',''); });
		ajax.get_html(url,"div_popup_msg",url_params,'GET',false,return_xml);
	},
	hide_popup : function(){
		if ( this.datepicker )
			$("#ui-datepicker-div").remove();
		if(this.redirect_on_hide && this.parent_redirect_url.length > 0){
			$("#div_popup_msg").html('<img src="/media/images/animated_gifs/loading.gif" border="0" width="20" height="20" />');
			window.location.href=this.parent_redirect_url;
		}else{
			$("#div_popup_bg").css("width","0px");
			$("#div_popup_bg").css("height","0px");
			$("#div_popup_bg").css("visibility","hidden");
			$("#div_popup_msg").css("visibility","hidden");
			if($("#flashBanner").length){ $("#flashBanner").css("visibility","visible"); $("#flashBanner").css("top","0px"); }
			if($("#flashVideo").length) $("#flashVideo").css("visibility","visible");
			$(window).unbind("resize");
			$(window).unbind("scroll");
		}
	},
	resize : function (width,height){
		if(width && width != '') $("#div_popup_msg").css("width",width+"px");
		if(height && height != '') $("#div_popup_msg").css("height",height+"px");
		$("#div_popup_msg").css("left",((($(window).width()-$("#div_popup_msg").width())/2)+$(window).scrollLeft())+"px");
		$("#div_popup_msg").css("top",((($(window).height()-$("#div_popup_msg").height())/2)+$(window).scrollTop())+"px");
		$("#div_popup_bg").css("width",$(document).width()+"px");
		$("#div_popup_bg").css("height",$(document).height()+"px");
	}
};
</script>