jQuery(document).ready(TB_init);function TB_init(){jQuery("a.thickbox").click(function(b){b.preventDefault();this.blur();var a=this.title||this.name||"";var c=this.rel||false;TB_show(a,this.href,c)})}function TB_show(q,e,b){if(!jQuery("#TB_HideSelect").length){jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");jQuery("#TB_overlay").click(TB_remove)}jQuery(window).scroll(TB_position);TB_overlaySize();jQuery("body").append("<div id='TB_load'><img src='"+fileThickboxLoadingImage+"' /></div>");TB_load_position();var r=e.match(/(.+)?/)[1]||e;var n=/\.(jpe?g|png|gif|bmp)/gi;if(r.match(n)){var u={caption:"",url:"",html:""};var k=u,l=u,a="";if(b){function h(v,w,i){return{caption:v.title,url:v.href,html:"<span id='TB_"+w+"'>&nbsp;&nbsp;<a href='#'>"+i+"</a></span>"}}var c=jQuery("a[rel="+b+"]").get();var t=false;var p="Gallery";for(var o=0;o<c.length;o++){var j=c[o];var f=j.href.match(n);if(j.href==e){t=true;a="Image "+(o+1)+" of "+(c.length);if(j.rel!=null){p=j.rel.replace(/_/," ")}}else{if(t){l=h(j,"next","&rsaquo;");break}else{k=h(j,"prev","&lsaquo;")}}}}imgPreloader=new Image();imgPreloader.onload=function(){imgPreloader.onload=null;var A=TB_getPageSize();var I=A[0]-150;var G=A[1]-150;var F=imgPreloader.width;var D=imgPreloader.height;if(F>I){D=D*(I/F);F=I;if(D>G){F=F*(G/D);D=G}}else{if(D>G){F=F*(G/D);D=G;if(F>I){D=D*(I/F);F=I}}}if(c.length>1){TB_WIDTH=F;TB_HEIGHT=D;if(jQuery.browser.msie){TB_HEIGHT+=0;if(navigator.appVersion.match(/MSIE\s6\.0/)=="MSIE 6.0"){TB_WIDTH+=0}}thumbPreloader=Array();additional_links="<div id='TB_additional_images'>";var z=76;var v=D;for(var C=0;C<c.length;C++){var w=c[C];var L="";if(w.href==e){L="class='TB_Selected'"}thumbPreloader[C]=new Image();thumbPreloader[C].onload=function(){};thumbPreloader[C].src=w.href;var B=thumbPreloader[C].width;var J=thumbPreloader[C].height;if(B>z){J=Math.floor(J*(z/B));B=Math.floor(z);if(J>v){B=Math.floor(B*(v/J));J=Math.floor(v)}}if(B<1){B=z}if(J<1){J=60}if(jQuery("img",w).attr("src")==null){image_src=jQuery(w).attr("rev")}else{image_src=jQuery("img",w).attr("src")}image_src=image_src.replace(/width=(\d)*/,"width="+B);image_src=image_src.replace(/height=(\d)*/,"height="+J);additional_links+="<a href='#' "+L+" id='TB_ThumbnailLink_"+C+"' ><img class='TB_Thumbnail_Image' src='"+image_src+"' width='"+B+"' height='"+J+"' alt=''/></a>"}additional_links+="</div>";jQuery("#TB_window").append("<div id='TB_Header'><div id='TB_TopCloseAjaxWindow'><a href='#' id='TB_TopCloseWindowButton'>close</a></div>"+p+"</div>");jQuery("#TB_window").append(additional_links);jQuery("#TB_TopCloseWindowButton").click(TB_remove)}else{TB_WIDTH=F+0;TB_HEIGHT=D+0}jQuery("#TB_window").append("<a href='' id='TB_ImageOff'><img id='TB_Image' src='"+e+"' width='"+F+"' height='"+D+"' alt='"+q+"'/></a><div id='TB_caption'>"+q+"<div id='TB_secondLine'>"+a+k.html+l.html+"</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton'>close</a></div>");jQuery("#TB_closeWindowButton").click(TB_remove);function K(i){return function(){jQuery("#TB_window").remove();jQuery("body").append("<div id='TB_window'></div>");TB_show(i.caption,i.url,b);return false}}if(c.length>1){goImage=Array();for(var C=0;C<c.length;C++){goImage[C]=K(h(c[C],"image_"+C+"",""));jQuery("#TB_ThumbnailLink_"+C+"").click(goImage[C])}}var E=K(k);var H=K(l);if(k.html){jQuery("#TB_prev").click(E)}if(l.html){jQuery("#TB_next").click(H)}document.onkeydown=function(i){if(i==null){keycode=event.keyCode}else{keycode=i.which}switch(keycode){case 27:TB_remove();break;case 190:if(l.html){document.onkeydown=null;H()}break;case 188:if(k.html){document.onkeydown=null;E()}break}};TB_position();jQuery("#TB_load").remove();jQuery("#TB_ImageOff").click(TB_remove);jQuery("#TB_window").css({display:"block"})};imgPreloader.src=e}else{var d=e.match(/\?(.+)/)[1];var s=TB_parseQuery(d);TB_WIDTH=(s.width*1)+0;TB_HEIGHT=(s.height*1)+0;var g=TB_WIDTH-0,m=TB_HEIGHT-0;if(e.indexOf("TB_iframe")!=-1){urlNoQuery=e.split("TB_");jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+q+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent' style='width:"+(g)+"px;height:"+(m)+"px;' onload='TB_showIframe()'> </iframe>")}else{jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+q+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a></div></div><div id='TB_ajaxContent' style='width:"+g+"px;height:"+m+"px;'></div>")}jQuery("#TB_closeWindowButton").click(TB_remove);if(e.indexOf("TB_inline")!=-1){jQuery("#TB_ajaxContent").html(jQuery("#"+s.inlineId).html());TB_position();jQuery("#TB_load").remove();jQuery("#TB_window").css({display:"block"})}else{if(e.indexOf("TB_iframe")!=-1){TB_position();if(frames.TB_iframeContent==undefined){jQuery("#TB_load").remove();jQuery("#TB_window").css({display:"block"});jQuery(document).keyup(function(v){var i=v.keyCode;if(i==27){TB_remove()}})}}else{jQuery("#TB_ajaxContent").load(e,function(){TB_position();jQuery("#TB_load").remove();jQuery("#TB_window").css({display:"block"})})}}}jQuery(window).resize(TB_position);document.onkeyup=function(i){if(i==null){keycode=event.keyCode}else{keycode=i.which}if(keycode==27){TB_remove()}}}function TB_showIframe(){jQuery("#TB_load").remove();jQuery("#TB_window").css({display:"block"})}function TB_remove(){jQuery("#TB_imageOff").unbind("click");jQuery("#TB_overlay").unbind("click");jQuery("#TB_closeWindowButton").unbind("click");jQuery("#TB_TopCloseWindowButton").unbind("click");jQuery("#TB_window").fadeOut("fast",function(){jQuery("#TB_window,#TB_overlay,#TB_HideSelect").remove()});jQuery("#TB_load").remove();return false}function TB_position(){var b=TB_getPageSize();var a=TB_getPageScrollTop();var c={width:TB_WIDTH,left:(a[0]+(b[0]-TB_WIDTH)/2),top:(a[1]+(b[1]-TB_HEIGHT)/2)};jQuery("#TB_window").css(c);jQuery("#TB_window").css("margin-top",0)}function TB_overlaySize(){if(window.innerHeight&&window.scrollMaxY||window.innerWidth&&window.scrollMaxX){yScroll=window.innerHeight+window.scrollMaxY;xScroll=window.innerWidth+window.scrollMaxX;var a=document.documentElement;var c=(a&&a.clientWidth)||document.body.clientWidth||window.innerWidth||self.innerWidth;var b=(a&&a.clientHeight)||document.body.clientHeight||window.innerHeight||self.innerHeight;xScroll-=(window.innerWidth-c);yScroll-=(window.innerHeight-b)}else{if(document.body.scrollHeight>document.body.offsetHeight||document.body.scrollWidth>document.body.offsetWidth){yScroll=document.body.scrollHeight;xScroll=document.body.scrollWidth}else{yScroll=document.body.offsetHeight;xScroll=document.body.offsetWidth}}jQuery("#TB_overlay").css({height:yScroll,width:xScroll});jQuery("#TB_HideSelect").css({height:yScroll,width:xScroll})}function TB_load_position(){var b=TB_getPageSize();var a=TB_getPageScrollTop();jQuery("#TB_load").css({left:(a[0]+(b[0]-100)/2),top:(a[1]+((b[1]-100)/2))}).css({display:"block"})}function TB_parseQuery(c){if(!c){return{}}var e={};var b=c.split(/[;&]/);for(var a=0;a<b.length;a++){var d=b[a].split("=");if(!d||d.length!=2){continue}e[unescape(d[0])]=unescape(d[1]).replace(/\+/g," ")}return e}function TB_getPageScrollTop(){var a;var b;if(self.pageYOffset||self.pageXOffset){a=self.pageYOffset;b=self.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollTop||document.documentElement.scrollLeft){a=document.documentElement.scrollTop;b=document.documentElement.scrollLeft}else{if(document.body){a=document.body.scrollTop;b=document.body.scrollLeft}}}arrayPageScroll=new Array(b,a);return arrayPageScroll}function TB_getPageSize(){var c=document.documentElement;var a=window.innerWidth||self.innerWidth||(c&&c.clientWidth)||document.body.clientWidth;var b=window.innerHeight||self.innerHeight||(c&&c.clientHeight)||document.body.clientHeight;arrayPageSize=new Array(a,b);return arrayPageSize};
