var _currentModalBoxy = {};
var closeColorBox, msie6;

(function ($) {
	if (typeof jQuery == "undefined") {
		return false;
	}
	closeColorBox = function() {
		$("#modalClose").click(); 	
	};
	
	/*
		determine whether browser is MSIE 6 or not because we have 
		to hide all select boxes on the page before displaying the
		overlay in IE 6.
		
	*/
	msie6 = ($.browser.msie == true && $.browser.version.substr(0,1) == "6");
	
	$(document).ready(function() {

		$("a.open-contacts-link").click(function(e) { //a.print-link, a.print-all-link
			var link = $(this);
			_currentModalBoxy = new Boxy("<iframe src='' frameborder='0' id='modalCmgView'></iframe>", {
				title: link.html(),
				afterHide: function() {  if (msie6 == true) { $("select").css("visibility", ""); } },
				modal: true,
				unloadOnHide: true,
				closeText: "<img border=\"0\" src=\"/httpd/img/general/icon_close.gif\" width=\"13\" height=\"13\">"
			});
			
			$("#modalCmgView").parent().css("overflow", "hidden");
			
			$("#modalCmgView").load(function() { $(this).contents().find("html").css("overflow", "hidden"); });
			$("#modalCmgView").attr("src", link.attr("href"));
			
			
			if (msie6 == true) { $("select").css("visibility", "hidden"); }
			
			return false;
		});
	});
})(jQuery);
