
if(typeof NAP=="undefined"){var NAP={};}
NAP.overlayPanel=function(opts){var confirmText=opts.confirmText||"OK",cancelText=opts.cancelText||"Cancel",height=(opts.height)?"height:"+opts.height+"px;":"",width=(opts.width)?"width:"+opts.width+"px;":"width:180px;",overlayMaskColour=(opts.theme.toLowerCase()=="light")?"#FFF":"#000",correction=(navigator.appName.indexOf('Microsoft')!=-1)?21:0,pageHeight=$(document).height(),pageWidth=$(document).width(),modal=opts.modal||false,closeButton=(modal)?"":'<div id="lightbox-close" title="Close">X</div>',overlayMask=['<div id="overlay-mask" style="height:',pageHeight,'px; width:',pageWidth,'px; position:absolute; top:0; left:0; background-color:',overlayMaskColour,'; opacity:0; filter:alpha(opacity=0); z-index:999999;">&nbsp;</div>'].join(""),buttons=(opts.type=="confirm")?['<input type="button" id="overlay-confirm-button" class="overlay-alert-button lightbox-yes" value="',confirmText,'" />&nbsp;<input type="button" value="',cancelText,'" id="overlay-cancel-button" class="overlay-alert-button lightbox-no" />'].join(""):(opts.type=="alert")?['<input type="button" id="overlay-confirm-button" class="overlay-alert-button lightbox-ok" value="',confirmText,'" />'].join(""):"",alertBox=['<div id="lightbox-container" style="position:absolute;z-index:1000001;',width,height,'">','<div id="lightbox-top">',opts.title,closeButton,'</div>','<div id="lightbox-middle">',opts.message,'</div>','<div id="lightbox-bottom">',buttons,'</div></div>'].join("");function hideAlert(){$("#overlay-mask").fadeOut("fast",function(){$(this).remove();});$("#lightbox-container").fadeOut("fast",function(){$(this).remove();});}
function showAlert(){hideAlert();var opacity=(opts.theme=="light")?0.50:0.35;$(overlayMask).appendTo($("body")).animate({opacity:opacity},"fast",function(){$(alertBox).appendTo($("body"));var boxPosX=(typeof opts.left!="undefined")?opts.left:Math.max((($(window).width())/2)-(parseInt($("#lightbox-container").width())/2)+$(document).scrollLeft(),0),boxPosY=(typeof opts.top!="undefined")?opts.top:Math.max((($(window).height())/2)-(parseInt($("#lightbox-container").height())/2)+$(document).scrollTop(),0);$("#lightbox-container").css({"left":boxPosX+"px","top":boxPosY+"px"}).fadeIn("fast",function(){if(opts.onReady)opts.onReady();});if(typeof opts.addClass!="undefined"){$("#lightbox-container").addClass(opts.addClass);}
bindClicks();});if(!modal){$("#overlay-mask").click(function(){if(opts.callback){opts.callback();}
hideAlert();});}}
function bindClicks(){if(opts.type=="confirm"){$("#overlay-confirm-button").click(function(){if(opts.callback){opts.callback(true);}
hideAlert();});$("#overlay-cancel-button").click(function(){if(opts.callback){opts.callback(false);}
hideAlert();});}else{$("#overlay-confirm-button").click(function(){if(opts.callback){opts.callback();}
hideAlert();});}
$("#lightbox-close").click(function(){if(opts.callback){opts.callback();}
hideAlert();});}
showAlert();};
