$(document).ready(TB_init);function TB_init(){$("a.thickbox").click(function(event){event.preventDefault();this.blur();var caption=this.title||this.name||"";var group=this.rel||false;TB_show(caption,this.href,group);});} function TB_show(caption,url,rel){if(!$("#TB_HideSelect").length){$("body").append("
");$("#TB_overlay").click(TB_remove);} $(window).scroll(TB_position);TB_overlaySize();$("body").append("
");TB_load_position();var baseURL=url.match(/(.+)?/)[1]||url;var testAttachment=0;var attachmentcheck=baseURL.toLowerCase().match('act=attach&type=post&id=');if(attachmentcheck!='') {testAttachment=1;} var imageURL=/\.(jpe?g|png|gif|bmp)/gi;if((baseURL.match(imageURL))&&(attachmentcheck==null)) {attachmentcheck=baseURL.match(imageURL);} if(attachmentcheck){var dummy={caption:"",url:"",html:""};var prev=dummy,next=dummy,imageCount="";if(rel){function getInfo(image,id,label){return{caption:image.title,url:image.href,html:"  "+label+""}} var imageGroup=$("a[@rel="+rel+"]").get();var foundSelf=false;for(var i=0;ix){imageHeight=imageHeight*(x/imageWidth);imageWidth=x;if(imageHeight>y){imageWidth=imageWidth*(y/imageHeight);imageHeight=y;}}else if(imageHeight>y){imageWidth=imageWidth*(y/imageHeight);imageHeight=y;if(imageWidth>x){imageHeight=imageHeight*(x/imageWidth);imageWidth=x;}} TB_WIDTH=imageWidth+30;TB_HEIGHT=imageHeight+60;$("#TB_window").append(""+caption+""+"
"+caption+"
"+imageCount+prev.html+next.html+"
close
");$("#TB_closeWindowButton").click(TB_remove);function buildClickHandler(image){return function(){$("#TB_window").remove();$("body").append("
");TB_show(image.caption,image.url,rel);return false;};} var goPrev=buildClickHandler(prev);var goNext=buildClickHandler(next);if(prev.html){$("#TB_prev").click(goPrev);} if(next.html){$("#TB_next").click(goNext);} document.onkeydown=function(e){if(e==null){keycode=event.keyCode;}else{keycode=e.which;} switch(keycode){case 27:TB_remove();break;case 190:if(next.html){document.onkeydown=null;goNext();} break;case 188:if(prev.html){document.onkeydown=null;goPrev();} break;}} TB_position();$("#TB_load").remove();$("#TB_ImageOff").click(TB_remove);$("#TB_window").css({display:"block"});} imgPreloader.src=url;}else{var queryString=url.match(/\?(.+)/)[1];var params=TB_parseQuery(queryString);TB_WIDTH=(params['width']*1);TB_HEIGHT=(params['height']*1);var ajaxContentW=TB_WIDTH,ajaxContentH=TB_HEIGHT;if(url.indexOf('TB_iframe')!=-1){urlNoQuery=url.split('TB_');$("#TB_window").append("
"+caption+"
");}else{$("#TB_window").append("
"+caption+"
");} $("#TB_closeWindowButton").click(TB_remove);if(url.indexOf('TB_inline')!=-1){$("#TB_ajaxContent").html($('#'+params['inlineId']).html());TB_position();$("#TB_load").remove();$("#TB_window").css({display:"block"});}else if(url.indexOf('TB_iframe')!=-1){TB_position();if(frames['TB_iframeContent']==undefined){$("#TB_load").remove();$("#TB_window").css({display:"block"});$(document).keyup(function(e){var key=e.keyCode;if(key==27){TB_remove()}});}}else{$("#TB_ajaxContent").load(url,function(){TB_position();$("#TB_load").remove();$("#TB_window").css({display:"block"});});}} $(window).resize(TB_position);document.onkeyup=function(e){if(e==null){keycode=event.keyCode;}else{keycode=e.which;} if(keycode==27){TB_remove();}}} function TB_showIframe(){$("#TB_load").remove();$("#TB_window").css({display:"block"});} function TB_remove(){$("#TB_imageOff").unbind("click");$("#TB_overlay").unbind("click");$("#TB_closeWindowButton").unbind("click");$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').remove();});$("#TB_load").remove();return false;} function TB_position(){var pagesize=TB_getPageSize();var arrayPageScroll=TB_getPageScrollTop();var style={width:TB_WIDTH,left:(arrayPageScroll[0]+(pagesize[0]-TB_WIDTH)/2),top:(arrayPageScroll[1]+(pagesize[1]-TB_HEIGHT)/2)};$("#TB_window").css(style);} function TB_overlaySize(){if(window.scrollMaxY>=0||window.scrollMaxX>=0){yScroll=window.innerHeight+window.scrollMaxY;xScroll=window.innerWidth+window.scrollMaxX;}else if(document.body.scrollHeight>0||document.body.scrollWidth>0){yScroll=document.body.scrollHeight+document.body.offsetHeight;xScroll=document.body.scrollWidth+document.body.offsetHeight;}else{yScroll=document.body.clientWidth;xScroll=document.body.clientWidth;} $("#TB_overlay").css({"height":yScroll+"px","width":xScroll+"px"});$("#TB_HideSelect").css({"height":yScroll+"px","width":xScroll+"px"});} function TB_load_position(){var pagesize=TB_getPageSize();var arrayPageScroll=TB_getPageScrollTop();$("#TB_load").css({left:(arrayPageScroll[0]+(pagesize[0]-100)/2),top:(arrayPageScroll[1]+((pagesize[1]-100)/2))}).css({display:"block"});} function TB_parseQuery(query){if(!query) return{};var params={};var pairs=query.split(/[;&]/);for(var i=0;i