/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
(function(a){function p(b){a(b).click(function(){n(this.title||this.name||null,this.href||this.alt,this.rel||false);this.blur();return false})}function n(b,c,h){try{if(typeof document.body.style.maxHeight==="undefined"){a("body","html").css({height:"100%",width:"100%"});a("html").css("overflow","hidden");if(document.getElementById("TB_HideSelect")===null){a("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");a("#TB_overlay").click(i)}}else if(document.getElementById("TB_overlay")===
null){a("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");a("#TB_overlay").click(i)}q()?a("#TB_overlay").addClass("TB_overlayMacFFBGHack"):a("#TB_overlay").addClass("TB_overlayBG");if(b===null)b="";a("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");a("#TB_load").show();var e=/\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/,j=(c.indexOf("?")!==-1?c.substr(0,c.indexOf("?")):c).toLowerCase().match(e);if(j==".jpg"||j==".jpeg"||j==".png"||j==".gif"||j==".bmp"){TB_imageCount=
TB_NextHTML=TB_NextURL=TB_NextCaption=TB_PrevHTML=TB_PrevURL=TB_PrevCaption="";TB_FoundURL=false;if(h){TB_TempArray=a("a[@rel="+h+"]").get();for(TB_Counter=0;TB_Counter<TB_TempArray.length&&TB_NextHTML==="";TB_Counter++){TB_TempArray[TB_Counter].href.toLowerCase().match(e);if(TB_TempArray[TB_Counter].href!=c)if(TB_FoundURL){TB_NextCaption=TB_TempArray[TB_Counter].title;TB_NextURL=TB_TempArray[TB_Counter].href;TB_NextHTML="<span id='TB_next'>\u00a0\u00a0<a href='#'>Next ></a></span>"}else{TB_PrevCaption=
TB_TempArray[TB_Counter].title;TB_PrevURL=TB_TempArray[TB_Counter].href;TB_PrevHTML="<span id='TB_prev'>\u00a0\u00a0<a href='#'>< Prev</a></span>"}else{TB_FoundURL=true;TB_imageCount="Image "+(TB_Counter+1)+" of "+TB_TempArray.length}}}imgPreloader=new Image;imgPreloader.onload=function(){imgPreloader.onload=null;var d=r(),l=d[0]-150;d=d[1]-150;var f=imgPreloader.width,g=imgPreloader.height;if(f>l){g*=l/f;f=l;if(g>d){f*=d/g;g=d}}else if(g>d){f*=d/g;g=d;if(f>l){g*=l/f;f=l}}TB_WIDTH=f+30;TB_HEIGHT=
g+60;a("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='../"+c+"' width='"+f+"' height='"+g+"' alt='"+b+"'/></a><div id='TB_caption'>"+b+"<div id='TB_secondLine'>"+TB_imageCount+TB_PrevHTML+TB_NextHTML+"</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div>");a("#TB_closeWindowButton").click(i);if(TB_PrevHTML!==""){var o=function(){a(document).unbind("click",o)&&a(document).unbind("click",o);a("#TB_window").remove();
a("body").append("<div id='TB_window'></div>");n(TB_PrevCaption,TB_PrevURL,h);return false};a("#TB_prev").click(o)}if(TB_NextHTML!==""){var s=function(){a("#TB_window").remove();a("body").append("<div id='TB_window'></div>");n(TB_NextCaption,TB_NextURL,h);return false};a("#TB_next").click(s)}document.onkeydown=function(t){keycode=t==null?event.keyCode:t.which;if(keycode==27)i();else if(keycode==190){if(TB_NextHTML!=""){document.onkeydown="";s()}}else if(keycode==188)if(TB_PrevHTML!=""){document.onkeydown=
"";o()}};m();a("#TB_load").remove();a("#TB_ImageOff").click(i);a("#TB_window").css({display:"block"})};imgPreloader.src=c}else{var v=c.replace(/^[^\?]+\??/,""),k=u(v);TB_WIDTH=k.width*1+30||630;TB_HEIGHT=k.height*1+40||440;ajaxContentW=TB_WIDTH-30;ajaxContentH=TB_HEIGHT-45;if(c.indexOf("TB_iframe")!=-1){urlNoQuery=c.split("TB_");a("#TB_iframeContent").remove();if(k.modal!="true")a("#TB_window").show().append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+b+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div></div><iframe frameborder='0' hspace='0' src='"+
urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1E3)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW+29)+"px;height:"+(ajaxContentH+17)+"px;' > </iframe>");else{a("#TB_overlay").unbind();a("#TB_window").show().append("<iframe frameborder='0' hspace='0' src='../"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1E3)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW+29)+"px;height:"+(ajaxContentH+17)+"px;'> </iframe>")}}else if(a("#TB_window").css("display")!=
"block")if(k.modal!="true")a("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+b+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");else{a("#TB_overlay").unbind();a("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>")}else{a("#TB_ajaxContent")[0].style.width=ajaxContentW+
"px";a("#TB_ajaxContent")[0].style.height=ajaxContentH+"px";a("#TB_ajaxContent")[0].scrollTop=0;a("#TB_ajaxWindowTitle").html(b)}a("#TB_closeWindowButton").click(i);if(c.indexOf("TB_inline")!=-1){a("#TB_ajaxContent").append(a("#"+k.inlineId).children());a("#TB_window").unload(function(){a("#"+k.inlineId).append(a("#TB_ajaxContent").children())});m();a("#TB_load").remove();a("#TB_window").css({display:"block"})}else if(c.indexOf("TB_iframe")!=-1){m();if(a.browser.safari){a("#TB_load").remove();a("#TB_window").css({display:"block"})}}else a("#TB_ajaxContent").load(c+=
"&random="+(new Date).getTime(),function(){m();a("#TB_load").remove();p("#TB_ajaxContent a.thickbox");a("#TB_window").css({display:"block"})})}if(!k.modal)document.onkeyup=function(d){keycode=d==null?event.keyCode:d.which;keycode==27&&i()}}catch(w){}}function i(){a("#TB_imageOff").unbind("click");a("#TB_closeWindowButton").unbind("click");a("#TB_window").fadeOut("fast",function(){a("#TB_window,#TB_overlay,#TB_HideSelect").trigger("unload").unbind().remove()});a("#TB_load").remove();if(typeof document.body.style.maxHeight==
"undefined"){a("body","html").css({height:"auto",width:"auto"});a("html").css("overflow","")}document.onkeydown="";document.onkeyup="";return false}function m(){a("#TB_window").css({marginLeft:"-"+parseInt(TB_WIDTH/2,10)+"px",width:TB_WIDTH+"px"});jQuery.browser.msie&&jQuery.browser.version<7||a("#TB_window").css({marginTop:"-"+parseInt(TB_HEIGHT/2,10)+"px"})}function u(b){var c={};if(!b)return c;b=b.split(/[;&]/);for(var h=0;h<b.length;h++){var e=b[h].split("=");if(!(!e||e.length!=2)){var j=unescape(e[0]);
e=unescape(e[1]);e=e.replace(/\+/g," ");c[j]=e}}return c}function r(){var b=document.documentElement;return arrayPageSize=[window.innerWidth||self.innerWidth||b&&b.clientWidth||document.body.clientWidth,window.innerHeight||self.innerHeight||b&&b.clientHeight||document.body.clientHeight]}function q(){var b=navigator.userAgent.toLowerCase();if(b.indexOf("mac")!=-1&&b.indexOf("firefox")!=-1)return true}a(document).ready(function(){p("a.thickbox, area.thickbox, input.thickbox");imgLoader=new Image;imgLoader.src=
"/js/thickbox/loadingAnimation.gif"});window.tb_init=p;window.tb_show=n;window.tb_showIframe=function(){a("#TB_load").remove();a("#TB_window").css({display:"block"})};window.tb_remove=i;window.tb_position=m;window.tb_parseQuery=u;window.tb_getPageSize=r;window.tb_detectMacXFF=q})(jQuery);
