jQuery.modal=function(modalContent,options){function doCufon(){if(typeof Cufon!="undefined"){Cufon.refresh();}}
function closeModal(){$("#jQueryModalWindow").fadeOut(500,function(){$("#jQueryModalOverlay").fadeOut();});}
var settings=jQuery.extend({verticalCentering:false},options);var modalWrapper=$("#jQueryModalWrapper");if(modalWrapper.size()==0){var modalHTML=$('<div id="#jQueryModalWrapper"><div id="jQueryModalOverlay"></div><div id="jQueryModalWindow"></div></div>');$("body").append(modalHTML);modalWrapper=$("#jQueryModalWrapper");}
$("#jQueryModalOverlay,#jQueryModalWindow",modalHTML).hide();var modalWindow=$("#jQueryModalWindow");var modalContent=$(modalContent);$(".close",modalContent).css({cursor:"pointer"}).click(function(){closeModal();return false;})
modalWindow.empty().html(modalContent);doCufon();var screenHeight=$(document).height();$("#jQueryModalOverlay").css({height:screenHeight+"px"})
if($.browser.msie&&$.browser.version<=6){var screenWidth=$(document).width()
$("#jQueryModalOverlay").css({width:screenWidth+"px"})}
if(settings.verticalCentering){modalWindow.css({"top":"50%","margin-top":"-"+(windowHeight/2)+"px"});}
else{var windowWidth=modalWindow.width();var windowHeight=modalWindow.height();modalWindow.css({"margin-left":"-"+(windowWidth/2)+"px"});}
$("#jQueryModalOverlay").fadeIn(200,function(){modalWindow.fadeIn();var offset=modalWindow.offset()
if($(document).scrollTop()>offset.top){$('html,body').animate({scrollTop:offset.top},1000)}});};
