(function(){var d=navigator.userAgent.toLowerCase(),c=1,a={client:{IE:d.indexOf("msie")>-1,IE6:d.indexOf("msie 6")>-1,IE7:d.indexOf("msie 7")>-1,Gecko:d.indexOf("gecko")>-1&&d.indexOf("safari")==-1,Webkit:d.indexOf("applewebkit/")>-1,Windows:d.indexOf("windows")>-1||d.indexOf("win32")>-1,Mac:d.indexOf("macintosh")>-1||d.indexOf("mac os x")>-1,Linux:d.indexOf("linux")>-1},initialized:false,defaults:{bodyColor:"#000",borderColor:"#303030",buttonColor:"white",easing:function(f,g,e,i,h){return i*(1+Math.pow(g/h-1,3))+e},fadeDuration:350,fixedHeight:false,fixedWidth:false,footerHeight:20,headerHeight:26,height:160,modal:false,opacity:0.8,overlayColor:"#000",padding:20,resizeDuration:350,headerLag:350,width:500},options:undefined,markup:'<div id="penumbriframe-overlay"></div><div id="penumbriframe-container"><div id="penumbriframe-header"></div><div id="penumbriframe-body"></div><div id="penumbriframe-footer"><a id="penumbriframe-close" onClick="penumbriframe.close()" title="Close">&nbsp;</a></div></div>',close:function(){$("#penumbriframe-container").animate({opacity:0},a.options.fadeDuration,a.options.easing(),function(){$(this).remove()});$("#penumbriframe-overlay").animate({opacity:0},a.options.fadeDuration,a.options.easing(),function(){$(this).remove()});$(document).unbind("keyup",b)},init:function(g){var e;if(a.initialized){return}a.initialized=true;if(g){for(e in g){if(a.defaults[e]!=undefined){a.defaults[e]=g[e]}}}if(a.client.IE6){a.defaults.height+=2;a.defaults.width+=2}$("a").click(function(i){var h=$(this).attr("rel").toLowerCase();if(h.indexOf("penumbriframe")>-1){i.preventDefault();delete a.options;a.options=jQuery.extend(true,{},a.defaults);f(h);a.trigger($(this).attr("href"),$(this).attr("title"))}});function f(k){if(k){var l,j=/^\d*\.\d+$/,p=/^\d+$/,h=k.split(/;/g),r,q;for(l=0;l<h.length;l++){r=/([^=:]+)[=:](.+)/.exec(h[l]);if(r&&r.length==3&&r[1]!="easing"){q=r[1].toLowerCase().replace(/(.)(color|duration|height|lag|width)$/i,function(){return arguments[1]+arguments[2].replace(/^[a-z]/,function(){return arguments[0].toUpperCase()})});if(a.options[q]){if(p.test(a.options[q].toString())){a.options[q]=parseInt(r[2])}else{if(j.test(a.options[q].toString())&&!isNaN(parseFloat(r[2]))){a.options[q]=parseFloat(r[2])}else{if(r[2]=="true"||r[2]=="false"){a.options[q]=r[2]=="true"}else{a.options[q]=r[2]}}}if(q=="height"){a.options.fixedHeight=true}else{if(q=="width"){a.options.fixedWidth=true}}}}}}}},trigger:function(l,n){$("body").append(a.markup);var g,f=false;initHeight=Math.min(a.defaults.height,a.options.height,h(true)),initWidth=Math.min(a.defaults.width,a.options.width,m(true)),pfBody=$("#penumbriframe-body"),pfClose=$("#penumbriframe-close"),pfContainer=$("#penumbriframe-container"),pfFooter=$("#penumbriframe-footer"),pfHeader=$("#penumbriframe-header"),pfOverlay=$("#penumbriframe-overlay");$(document).keyup(b);$(pfFooter).fadeTo(c,0,function(){$(this).css({bottom:"0px",height:a.options.footerHeight+"px"})});if(n==undefined||n==""||a.options.headerHeight==0){a.options.headerHeight=0;$(pfHeader).remove()}else{$(pfHeader).html(n);$(pfHeader).css({height:a.options.headerHeight+"px",top:(a.options.headerHeight+1)+"px"})}j();g={backgroundColor:a.options.bodyColor,borderColor:a.options.borderColor,height:initHeight+"px",top:((h(true)-initHeight)/2+a.options.headerHeight)+"px",width:initWidth+"px"};if(initWidth!=a.options.width||!a.options.fixedWidth){jQuery.extend(g,{left:Math.max(0,($(window).width()-initWidth-2)/2-k()+(a.client.IE6?1:0))})}$(pfBody).css(g);$(pfBody).html(i(l));$("#penumbriframe").load(function(){f=true});if(a.options.buttonColor.toLowerCase().indexOf("black")>-1){$(pfClose).addClass("penumbriframe-close-black")}else{$(pfClose).addClass("penumbriframe-close-white")}$(pfOverlay).css("background-color",a.options.overlayColor);$(pfOverlay).fadeTo(c,0,function(){$(pfOverlay).show(c,function(){$(pfOverlay).animate({opacity:a.options.opacity},a.options.fadeDuration,a.options.easing(),function(){$(pfContainer).show(c,function(){if(initWidth!=m(true)||initHeight!=h(true)){$(pfBody).animate({height:h(true)+"px",left:"0px",top:a.options.headerHeight+"px",width:m(true)+"px"},a.options.resizeDuration,a.options.easing(),function(){o()})}else{o()}function o(){setTimeout(function(){var p=setInterval(function(){if(f){$("#penumbriframe").show(c);clearInterval(p)}},100)},Math.max(a.options.headerLag-100,0));if(a.options.headerHeight!=0){$(pfHeader).show(c,function(){$(pfHeader).animate({top:"0px"},a.options.headerLag,a.options.easing())})}$(pfFooter).show(c,function(){$(pfFooter).animate({opacity:1},a.options.headerLag,a.options.easing())});setTimeout(function(){$(window).resize(function(){setTimeout(function(){$(pfBody).css({width:m(true)+"px",height:h(true)+"px"})},50)});if(!a.options.modal){$(pfContainer).click(a.close);$(pfOverlay).click(a.close)}},a.options.headerLag)}})});$(window).resize(function(){setTimeout(function(){j()},50)})})});function h(o){var p=$(window).height()-2*e(o);if(a.options.fixedHeight){p=$(window).height()-2*a.options.padding;if(a.options.height<p){p=a.options.height;if(!o){p+=a.options.footerHeight+a.options.headerHeight+(a.client.IE6?0:2)}}else{if(o){p-=a.options.footerHeight+a.options.headerHeight+(a.client.IE6?0:2)}}}return Math.max(0,p)}function k(o){var p=a.options.padding+(o?1:0);if(a.options.fixedWidth){p=Math.max(a.options.padding,($(window).width()-a.options.width)/2-(o?0:1))}return p+(a.client.IE6?1:0)}function m(o){var p=$(window).width()-2*a.options.padding;if(a.options.fixedWidth){p=Math.min(a.options.width,p-2);p+=(o?0:2)}else{p-=(o?2:0)}return Math.max(0,p)}function i(p){var o='<iframe id="penumbriframe" height="100%" width="100%" frameborder="0" marginwidth="0" marginheight="0" scrolling="auto"';if(a.client.IE){o+=' allowtransparency="true"'}o+=' src="'+p+'"></iframe>';return o}function j(){if(a.client.IE6){$(pfContainer).css({height:h()+"px",marginLeft:k()+"px",marginTop:e()+"px",width:m()+"px"})}else{$(pfContainer).css({height:h()+"px",left:k()+"px",top:e()+"px",width:m()+"px"})}}function e(o){var p=a.options.padding;if(a.options.fixedHeight){p=($(window).height()-(a.options.height+a.options.footerHeight+a.options.headerHeight+(a.client.IE6?0:2)))/2}if(o){p+=(a.options.footerHeight+a.options.headerHeight+(a.client.IE6?0:2))/2}return Math.max(a.options.padding,p)}}};function b(f){if(f.keyCode==27){a.close()}}window.penumbriframe=a})();