var closeCallback,CurrentPopup=null,CloseCallbacks={},PopupIndex=0;function getScroll(){typeof ClickTaleExec=="function"&&ClickTaleExec("getScroll()");var a,b;if(self.pageYOffset)a=self.pageXOffset,b=self.pageYOffset;else if(document.documentElement&&document.documentElement.scrollTop)a=document.documentElement.scrollLeft,b=document.documentElement.scrollTop;else if(document.body)a=document.body.scrollLeft,b=document.body.scrollTop;return{x:a,y:b}}
function MoveBlackoutRegion(){typeof ClickTaleExec=="function"&&ClickTaleExec("MoveBlackoutRegion()");if(CurrentPopup!=null){var a=getScroll();CurrentPopup.children(".black_out").css("left",a.x+"px");CurrentPopup.children(".black_out").css("top",a.y+"px")}}function getWaitHTML(){typeof ClickTaleExec=="function"&&ClickTaleExec("getWaitHTML()");return'<img src="//d3vdtj41cje8r4.cloudfront.net/1327599732/images/common/loadingAnim_oneLine.gif"/>'}
function Popup(a){this.subtitle=this.title="";this.buttons=[];this.padded=this.showX=true;this.tabbar=this.footerlinks=this.caption="";this.karma=0;closeCallback=null;this.titleDiv=$("#main_popup .title");this.tabbarDiv=$("#main_popup .top_tab_bar");this.subtitleDiv=$("#main_popup .subtitle");this.titlebarDiv=$("#main_popup .header");this.bodyDiv=$("#main_popup .content");this.footerDiv=$("#main_popup .footer");this.footerlinksDiv=$("#main_popup .footerlinks");this.xButton=$("#main_popup .close");
this.xButton.unbind("click").attr("onclick","").click(DestroyPopup);this.progressBarWidth=400;this.karmaBalloon=$("#main_popup .karma_balloon");this.karmaBalloonValue=this.karmaBalloon.find("div:first-child");PopupIndex++;typeof ClickTaleExec=="function"&&ClickTaleExec("Popup()");this.setTitle=function(a){this.title=a;return this};this.setSubtitle=function(a){this.subtitle=a;return this};this.setBody=function(a){a+='<div style="width:'+this.progressBarWidth+'px; float: left;">';a+='<div id="popup_progbar"></div>';
a+="</div>";a+='<div class="k_clear"></div>';this.body=a;return this};this.setCloseCallback=function(a){closeCallback=a;return this};this.setTabbar=function(a){this.tabbar=a;return this};this.addButton=function(a){if(a.isButton)return a.setAlignment("right"),this.buttons.push(a),this;else alert("Can't add button to popup: does not appear to be a Button object.")};this.setCaption=function(a){this.caption=a;return this};this.setFooterLinks=function(a){this.footerlinks=a;return this};this.setKarma=function(a){this.karma=
a};this.addOkButton=function(){var a=new Button("Ok","DestroyPopup()","");a.setAlignment("right");this.buttons.push(a);return this};this.addCancelButton=function(){var a=new Button("Cancel","DestroyPopup()","");a.setAlignment("right");this.buttons.push(a);return this};this.setShowX=function(a){this.showX=a;return this};this.setPadded=function(a){this.padded=a};this.getWaitHTML=function(){return'<div class="k_center k_pad"><img src="//d3vdtj41cje8r4.cloudfront.net/1327599732/images/common/loadingAnim_oneLine.gif"/></div>'};this.getFooterHTML=
function(){if(!this.buttons.length)return"";for(var a='<div class="footer_buttons">',b=0;b<this.buttons.length;b++)a+=this.buttons[b].getHTML()+" ";a+="</div>";a+='<div class="k_clear"></div>';return a};this.writeHTML=function(){this.titleDiv.html(this.title);this.subtitleDiv.html(this.subtitle);this.bodyDiv.html(this.body);this.footerDiv.html(this.getFooterHTML());this.tabbarDiv.html(this.tabbar);this.title!=""?this.titleDiv.show():this.titleDiv.hide();this.karma?(this.karmaBalloonValue.html("+"+
this.karma),this.karma>=100?this.karmaBalloon.addClass("three_digit"):this.karmaBalloon.removeClass("three_digit"),this.karmaBalloon.show().css("opacity",0)):this.karmaBalloon.hide();this.subtitle!=""?this.subtitleDiv.show():this.subtitleDiv.hide();this.tabbar!=""?(this.tabbarDiv.show(),this.tabbarDiv.css("height","auto")):(this.tabbarDiv.hide(),this.tabbarDiv.css("height","0px"));this.buttons.length>0||this.caption?(this.caption?this.footerDiv.html(this.caption):this.footerDiv.html(this.getFooterHTML()),
this.footerDiv.show()):this.footerDiv.hide();if(this.showX){if(this.xButton.show(),closeCallback){var a=closeCallback;CloseCallbacks[PopupIndex]=function(){DestroyPopup();$.browser.msie?setTimeout(a,5):a()};this.xButton.replaceWith('<div class="close" onclick="(CloseCallbacks['+PopupIndex+'])()">&nbsp;</div>')}}else this.xButton.hide();this.footerlinks&&(this.footerDiv.addClass("hasfooter").html('<div class="footer_buttons">'+this.footerlinks+'</div><div style="clear: both; height: 0px">').find("a").addClass("button"),
this.footerDiv.show());this.bodyDiv.html(this.body);this.karma&&this.karmaBalloon.delay(200).animate({opacity:1},1E3)};this.display=function(a){this.writeHTML();DisplayPopupNow(a,this.padded);return this};this.body=this.getWaitHTML();if(a&&(a.title&&this.setTitle(a.title),a.subtitle&&this.setSubtitle(a.subtitle),a.body&&this.setBody(a.body),a.tabbar&&this.setTabbar(a.tabbar),a.caption&&this.setCaption(a.caption),a.buttons))for(var b=0;a.buttons[b];){var c=a.buttons[b],d=new Button;d.alignment=c.alignment;
d.isDisabled=c.isDisabled;d.isOptionButton=c.isOptionButton;d.group=c.group;d.onclick=c.onclick;d.caption=c.caption;d.buttonStyle=c.buttonStyle;d.name=c.name;this.addButton(d);b++}}
function Button(a,b,c,d){this.containingDiv="";this.alignment="left";this.group=this.isOptionButton=this.isDisabled=0;this.caption=this.onclick="";this.name=this.buttonStyle=0;this.isButton=function(){return true};this.setStyle=function(a){this.buttonStyle=a};this.setAlignment=function(a){a!="left"&&a!="right"?alert('Alignment can only be set to "left" or "right."'):this.alignment=a};this.setCaption=function(a){this.caption=a};this.setDisabled=function(a){this.isDisabled=a*1};this.getSpecialAttributeHTML=
function(){return""};this.getGroupHTML=function(){return""};this.getHTML=function(){for(var a=1;document.getElementById("dialog_button_"+a)!=null;)a++;var b='<span href="javascript:void(0)" ';b+='id="'+(this.name?this.name:"dialog_button_"+a)+'" ';this.onclick&&(b+="onclick=\"if (this.getAttribute('disabled')) return false; "+this.onclick+'" ');b+='class="action_button" ';b+=">";b+=this.caption;b+="</span>";return b};this.render=function(){this.containingDiv==""?alert("This button cannot be rendered until it is associated with a containing div."):
document.getElementById(this.containingDiv).innerHTML=this.getHTML()};a&&this.setCaption(a);if(b)this.onclick=b;c&&this.setStyle(c);if(d)this.name=d}function DisplayPopupNow(a,b){b===void 0&&(b=true);typeof ClickTaleExec=="function"&&ClickTaleExec("DisplayPopupNow('"+a+"')");DisplayCustomPopup("main_popup",a,b)}function ResizePopup(a){typeof ClickTaleExec=="function"&&ClickTaleExec("ResizePopup('"+a+"')");ResizeCustomPopup("main_popup",a)}
function DisplayDelayedPopup(a,b){typeof ClickTaleExec=="function"&&ClickTaleExec("DisplayDelayedPopup("+a+", '"+b+"')");setTimeout("DisplayPopupNow("+(b?b:0)+")",a)}function DestroyPopup(){typeof ClickTaleExec=="function"&&ClickTaleExec("DestroyPopup()");HidePopup(true)}
function HidePopup(){typeof ClickTaleExec=="function"&&ClickTaleExec("HidePopup()");$.browser.msie&&$("#KooferViewerPDF").show();$.browser.msie&&jQuery.browser.version!="9.0"?($(".black_out").hide(),$(".popup_dialog").hide()):($(".black_out").fadeOut(),$(".popup_dialog").fadeOut());$("object").css({visibility:"visible"});ClearPopup()}function ClearPopup(){typeof ClickTaleExec=="function"&&ClickTaleExec("ClearPopup()")}
function DisplayCustomPopup(a,b,c){c===void 0&&(c=true);c?$("#"+a+" > .popup_dialog").removeClass("no_padding"):$("#"+a+" > .popup_dialog").addClass("no_padding");typeof ClickTaleExec=="function"&&ClickTaleExec("DisplayCustomPopup('"+a+"', '"+b+"')");b?(b=="large"?b=650:b=="normal"&&(b=580),ResizeCustomPopup(a,b)):ResizeCustomPopup(a,580);$("object").css({visibility:"hidden"});$("#"+a+" .footer_buttons").length==0?$("#"+a+" .bottom").removeClass("hasfooter"):$("#"+a+" .bottom").addClass("hasfooter");
a=$("#"+a);b=a.children(".popup_dialog");c=$(window).scrollTop()+50;b.css("top",c+"px");if($.browser.msie&&jQuery.browser.version!="9.0"){if(!b.show())return}else if(!b.fadeIn())return;$.browser.msie&&$("#KooferViewerPDF").hide();CurrentPopup=a;$.browser.msie&&jQuery.browser.version!="9.0"?(b.show(100),a.children(".black_out").show()):(b.fadeIn(100),a.children(".black_out").fadeIn());MoveBlackoutRegion()}
function ResizeCustomPopup(a,b){typeof ClickTaleExec=="function"&&ClickTaleExec("ResizeCustomPopup('"+a+"', '"+b+"')");b!=580&&b!=650&&b!=750&&(b=580);width=b;switch(width){default:case 580:$("#"+a+" > .popup_dialog").removeClass("large");break;case 650:$("#"+a+" > .popup_dialog").addClass("large")}}
function DestroyCustomPopup(a){typeof ClickTaleExec=="function"&&ClickTaleExec("DestroyCustomPopup('"+a+"')");CurrentPopup=null;$("#"+a+" > .black_out").hide();$("#"+a+" > .popup_dialog").hide();$.browser.msie&&$("#KooferViewerPDF").show()}function PopupIsOpen(){var a=false;$(".popup_dialog").each(function(){a|=$(this).is(":visible")});return a};

