/*
 * Thickbox 3 - 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
*/

var tb_pathToImage = 'admin/theme/images/loading.gif';

var $j=jQuery.noConflict();$j(document).ready(function(){tb_init("a.thickbox, area.thickbox, input.thickbox");imgLoader=new Image;imgLoader.src=tb_pathToImage});function tb_init(a){$j(a).click(function(){tb_show(this.title||this.name||null,this.href||this.alt,this.rel||false);this.blur();return false})}
function tb_show(a,b,g){try{if(typeof document.body.style.maxHeight==="undefined"){$j("body","html").css({height:"100%",width:"100%"});$j("html").css("overflow","hidden");if(document.getElementById("TB_HideSelect")===null){$j("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");$j("#TB_overlay").click(tb_remove)}}else if(document.getElementById("TB_overlay")===null){$j("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");$j("#TB_overlay").click(tb_remove)}tb_detectMacXFF()?
$j("#TB_overlay").addClass("TB_overlayMacFFBGHack"):$j("#TB_overlay").addClass("TB_overlayBG");if(a===null)a="";$j("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");$j("#TB_load").show();var d=/\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/,h=(b.indexOf("?")!==-1?b.substr(0,b.indexOf("?")):b).toLowerCase().match(d);if(h==".jpg"||h==".jpeg"||h==".png"||h==".gif"||h==".bmp"){TB_imageCount=TB_NextHTML=TB_NextURL=TB_NextCaption=TB_PrevHTML=TB_PrevURL=TB_PrevCaption="";TB_FoundURL=false;
if(g){TB_TempArray=$j("a[@rel="+g+"]").get();for(TB_Counter=0;TB_Counter<TB_TempArray.length&&TB_NextHTML==="";TB_Counter++){TB_TempArray[TB_Counter].href.toLowerCase().match(d);if(TB_TempArray[TB_Counter].href!=b)if(TB_FoundURL){TB_NextCaption=TB_TempArray[TB_Counter].title;TB_NextURL=TB_TempArray[TB_Counter].href;TB_NextHTML="<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>"}else{TB_PrevCaption=TB_TempArray[TB_Counter].title;TB_PrevURL=TB_TempArray[TB_Counter].href;TB_PrevHTML="<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; 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 c=tb_getPageSize(),j=c[0]-150;c=c[1]-150;var e=imgPreloader.width,f=imgPreloader.height;if(e>j){f*=j/e;e=j;if(f>c){e*=c/f;f=c}}else if(f>c){e*=c/f;f=c;if(e>j){f*=j/e;e=j}}TB_WIDTH=e+30;TB_HEIGHT=f+60;$j("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+b+"' width='"+e+"' height='"+f+"' alt='"+a+"'/></a><div id='TB_caption'>"+
a+"<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> or Esc Key</div>");$j("#TB_closeWindowButton").click(tb_remove);if(TB_PrevHTML!==""){function k(){$j(document).unbind("click",k)&&$j(document).unbind("click",k);$j("#TB_window").remove();$j("body").append("<div id='TB_window'></div>");tb_show(TB_PrevCaption,TB_PrevURL,g);return false}$j("#TB_prev").click(k)}if(TB_NextHTML!==""){function l(){$j("#TB_window").remove();
$j("body").append("<div id='TB_window'></div>");tb_show(TB_NextCaption,TB_NextURL,g);return false}$j("#TB_next").click(l)}document.onkeydown=function(m){keycode=m==null?event.keyCode:m.which;if(keycode==27)tb_remove();else if(keycode==190){if(TB_NextHTML!=""){document.onkeydown="";l()}}else if(keycode==188)if(TB_PrevHTML!=""){document.onkeydown="";k()}};tb_position();$j("#TB_load").remove();$j("#TB_ImageOff").click(tb_remove);$j("#TB_window").css({display:"block"})};imgPreloader.src=b}else{var n=
b.replace(/^[^\?]+\??/,""),i=tb_parseQuery(n);TB_WIDTH=i.width*1+30||630;TB_HEIGHT=i.height*1+40||440;ajaxContentW=TB_WIDTH-30;ajaxContentH=TB_HEIGHT-45;if(b.indexOf("TB_iframe")!=-1){urlNoQuery=b.split("TB_");$j("#TB_iframeContent").remove();if(i.modal!="true")$j("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+a+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</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{$j("#TB_overlay").unbind();$j("#TB_window").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($j("#TB_window").css("display")!=
"block")if(i.modal!="true")$j("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+a+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> or Esc Key</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");else{$j("#TB_overlay").unbind();$j("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>")}else{$j("#TB_ajaxContent")[0].style.width=
ajaxContentW+"px";$j("#TB_ajaxContent")[0].style.height=ajaxContentH+"px";$j("#TB_ajaxContent")[0].scrollTop=0;$j("#TB_ajaxWindowTitle").html(a)}$j("#TB_closeWindowButton").click(tb_remove);if(b.indexOf("TB_inline")!=-1){$j("#TB_ajaxContent").append($j("#"+i.inlineId).children());$j("#TB_window").unload(function(){$j("#"+i.inlineId).append($j("#TB_ajaxContent").children())});tb_position();$j("#TB_load").remove();$j("#TB_window").css({display:"block"})}else if(b.indexOf("TB_iframe")!=-1){tb_position();
if($j.browser.safari){$j("#TB_load").remove();$j("#TB_window").css({display:"block"})}}else $j("#TB_ajaxContent").load(b+="&random="+(new Date).getTime(),function(){tb_position();$j("#TB_load").remove();tb_init("#TB_ajaxContent a.thickbox");$j("#TB_window").css({display:"block"})})}if(!i.modal)document.onkeyup=function(c){keycode=c==null?event.keyCode:c.which;keycode==27&&tb_remove()}}catch(o){}}function tb_showIframe(){$j("#TB_load").remove();$j("#TB_window").css({display:"block"})}
function tb_remove(){$j("#TB_imageOff").unbind("click");$j("#TB_closeWindowButton").unbind("click");$j("#TB_window").fadeOut("fast",function(){$j("#TB_window,#TB_overlay,#TB_HideSelect").trigger("unload").unbind().remove()});$j("#TB_load").remove();if(typeof document.body.style.maxHeight=="undefined"){$j("body","html").css({height:"auto",width:"auto"});$j("html").css("overflow","")}document.onkeydown="";document.onkeyup="";return false}
function tb_position(){$j("#TB_window").css({marginLeft:"-"+parseInt(TB_WIDTH/2,10)+"px",width:TB_WIDTH+"px"});jQuery.browser.msie&&jQuery.browser.version<7||$j("#TB_window").css({marginTop:"-"+parseInt(TB_HEIGHT/2,10)+"px"})}function tb_parseQuery(a){var b={};if(!a)return b;a=a.split(/[;&]/);for(var g=0;g<a.length;g++){var d=a[g].split("=");if(!(!d||d.length!=2)){var h=unescape(d[0]);d=unescape(d[1]);d=d.replace(/\+/g," ");b[h]=d}}return b}
function tb_getPageSize(){var a=document.documentElement;return arrayPageSize=[window.innerWidth||self.innerWidth||a&&a.clientWidth||document.body.clientWidth,window.innerHeight||self.innerHeight||a&&a.clientHeight||document.body.clientHeight]}function tb_detectMacXFF(){var a=navigator.userAgent.toLowerCase();if(a.indexOf("mac")!=-1&&a.indexOf("firefox")!=-1)return true};