function createModalWindow(modalWindowId)
{	
  return $(modalWindowId).jqm(
	{
		onShow:function (hash)
		{
		//JQuery broke with checking for IE6 now must add the additional check to see if it is IE7.
			var ie6 = (jQuery.browser.msie && (navigator.userAgent.indexOf('MSIE 6.0')) && (navigator.userAgent.indexOf('MSIE 7') < 0) && (navigator.userAgent.indexOf('MSIE 8') < 0));
			if (ie6)
			{
				// in ie6 select elements are ui instead of browser elements
				// and so they show through modal windows
				$("select").hide();
			}
			var iframe = $(modalWindowId + ' #exFrame');
			iframe.html('').attr('src', iframe.attr('iframesrc'));   			
			hash.w.attr('oheight', (hash.w.attr('oheight') ? hash.w.attr('oheight') : hash.w.css('height')));
			hash.w.attr('iheight', (hash.w.attr('iheight') ? hash.w.attr('iheight') : iframe.css('height'))); 		
			
		//used for all browsers to get the open window height
		var browserHeight = parseInt(document.documentElement.clientHeight); 
		//this is used to center the window on the screen
		var top = ((parseInt(browserHeight) - parseInt(hash.w.attr('oheight'))) / 2);
		// this used to get the height of the iFrame 
		var iframeHeight = parseInt(hash.w.attr('iheight'));
		// this is to get the scroll offset in IE6 so that the window will be right at the top 
		var ie6Top = document.documentElement.scrollTop;  

		if (iframeHeight > browserHeight)
		{	
			//This sets the height of the iFrame 55px less then height of the browser window.
			//This is because the window has 50px of space on the top
			iframe.css('height', browserHeight-55);  
			if (ie6)
			{	//This is required due to IE6 handling positioning different then other browsers.
				hash.w.css('position', 'absolute');
				hash.w.css('top', ie6Top);
			} 
			else 
			{
				hash.w.css('top', 0);
			}
			//The -5 is used to ensure that the bottom of the window is above
			//the lip of the browser.
			hash.w.css('height', browserHeight-5);
		} 
		else 
		{	
			//This is set since when we need to have the original heights of the items 
			//in case someone started with a small browser window and then expanded it.
			iframe.css('height', hash.w.attr('iheight'));
			hash.w.css('height', hash.w.attr('oheight'));
			if(!ie6)
			{
				hash.w.css('top', top);
			}
			else
			{
				//This set the top offset in IE6 equal to the scroll position 
				//plus half of the height minus the height of the window. 
				hash.w.css('top', (ie6Top + top));
			}
		}
		//This is to stop the scroll bar from being used on the main window while the modal window is showing.
		$('html').css('overflow', 'hidden');  
		hash.w.show();  		
		}, 
		onHide:function (hash)
		{
			//JQuery broke with checking for IE6 now must add the additional check to see if it is IE7.
			var ie6 = (jQuery.browser.msie && (jQuery.browser.version == '6.0') && (navigator.userAgent.indexOf('MSIE 7.0') <= 0));
			hash.w.hide();
			hash.o.remove();
			var iframe = $(modalWindowId + ' #exFrame');
			// do not set src="" or ie6 will complain about nonsecure content
			iframe.html('').attr('src', "/blank.html");
			//This is used to change back to the correct scrolling behavior of the window.
			//IE6 requires that blank be return for it function properly.
			//IE browsers require 
			$('html').css('overflow', ''); 
			if (ie6)
			{
				$("select").show();
			}
		},
		overlay: 10,
		toTop: true
	});
}