jQuery.extend({ImpromptuDefaults:{prefix:"jqi",buttons:{Ok:true},loaded:function(){},submit:function(){return true},callback:function(){},opacity:0.6,zIndex:999,overlayspeed:"slow",promptspeed:"fast",show:"show",focus:0,useiframe:false},SetImpromptuDefaults:function(A){jQuery.ImpromptuDefaults=jQuery.extend({},jQuery.ImpromptuDefaults,A)},prompt:function(F,C){C=jQuery.extend({},jQuery.ImpromptuDefaults,C);var I=(jQuery.browser.msie&&jQuery.browser.version<7);var O=jQuery(document.body);var P=jQuery(window);var A='<div class="'+C.prefix+'box" id="'+C.prefix+'box">';if(C.useiframe&&((jQuery.browser.msie&&jQuery("object, applet").length>0)||I)){A+='<iframe src="javascript:;" class="'+C.prefix+'fade" id="'+C.prefix+'fade"></iframe>'}else{if(I){$("select").css("visibility","hidden")}A+='<div class="'+C.prefix+'fade" id="'+C.prefix+'fade"></div>'}A+='<div class="'+C.prefix+'" id="'+C.prefix+'"><div class="'+C.prefix+'container"><div class="'+C.prefix+'close">X</div><div class="'+C.prefix+'message">'+F+'</div><div class="'+C.prefix+'buttons" id="'+C.prefix+'buttons">';jQuery.each(C.buttons,function(S,R){A+='<button name="'+C.prefix+"button"+S+'" id="'+C.prefix+"button"+S+'" value="'+R+'">'+S+"</button>"});A+="</div></div></div></div>";var B=O.append(A).children("#"+C.prefix+"box");var D=B.children("#"+C.prefix);var Q=B.children("#"+C.prefix+"fade");var H=function(){return(document.documentElement.scrollTop||document.body.scrollTop)+"px"};var G=function(){var R={width:window.innerWidth||(window.document.documentElement.clientWidth||window.document.body.clientWidth),height:window.innerHeight||(window.document.documentElement.clientHeight||window.document.body.clientHeight)};return R};var J=function(){B.css({top:H()})};var N=function(){var S=0;B.addClass(C.prefix+"warning");var R=setInterval(function(){B.toggleClass(C.prefix+"warning");if(S++>1){clearInterval(R);B.removeClass(C.prefix+"warning")}},100)};var M=function(T){var R=(window.event)?event.keyCode:T.keyCode;var S=(window.event)?27:T.DOM_VK_ESCAPE;if(R==S){E()}};var K=function(){var R=G();B.css({position:(I)?"absolute":"fixed",height:R.height,width:"100%",top:(I)?H():0,left:0,right:0,bottom:0});Q.css({position:"absolute",height:R.height,width:"100%",top:0,left:0,right:0,bottom:0});D.css({position:"absolute",top:"100px",left:"50%",marginLeft:((((D.css("paddingLeft").split("px")[0]*1)+D.width())/2)*-1)})};var L=function(){Q.css({zIndex:C.zIndex,display:"none",opacity:C.opacity});D.css({zIndex:C.zIndex+1,display:"none"})};var E=function(S,R,T){D.remove();if(I){O.unbind("scroll",J)}P.unbind("resize",K);Q.fadeOut(C.overlayspeed,function(){Q.unbind("click",N);Q.remove();if(S){C.callback(R,T)}B.unbind("keypress",M);B.remove();if(I&&!C.useiframe){$("select").css("visibility","visible")}})};K();L();jQuery("#"+C.prefix+"buttons").children("button").click(function(){var S=D.children("."+C.prefix+"container").children("."+C.prefix+"message");var R=C.buttons[jQuery(this).text()];if(C.submit(R,S)){E(true,R,S)}});if(I){P.scroll(J)}Q.click(N);P.resize(K);B.keypress(M);D.find("."+C.prefix+"close").click(E);Q.fadeIn(C.overlayspeed);D[C.show](C.promptspeed,C.loaded);D.find("#"+C.prefix+"buttons button:eq("+C.focus+")").focus();return B}});