/*
 * 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
*/
		  
var tb_pathToImage='/_media/images/icons/loading.gif';
$(document).ready(function(){tb_init("a.thumbnail");imgLoader=new Image();imgLoader.src=tb_pathToImage});function tb_init(selector){$(selector).click(function(){var subject=$(this).children('[id$=SubjectLabel]').text();var message=$(this).children('[id$=MessageLabel]').text();var emailLink=(subject.length>0)?'<a href="/Contact/?subject='+subject+'&message='+message+'">PURCHASE &raquo;</a>':'';var caption='<p class="whiteText">'+($(this).children('[id$=TitleLabel]').text()||this.title||'')+'</p>'+$(this).children('[id$=DescriptionLabel]').html()+emailLink;var title=this.title||null;var url=this.href||this.alt;var group=this.rel||false;tb_show(caption,title,url,group);this.blur();return false})}function tb_show(caption,title,url,imageGroup){$(window).scrollTop(0);if(typeof document.body.style.maxHeight==='undefined'){$('body','html').css({height:'100%',width:'100%'});$('html').css('overflow','hidden');if(document.getElementById('TB_HideSelect')===null){$('body').append('<iframe id="TB_HideSelect"></iframe><div id="TB_overlay"></div><div id="TB_window"></div>');$('#TB_overlay').click(tb_remove)}}else{if(document.getElementById('TB_overlay')===null){$('body').append('<div id="TB_overlay"></div><div id="TB_window"></div>');$('#TB_overlay').click(tb_remove)}}$('#TB_overlay').addClass(tb_detectMacXFF()?'TB_overlayMacFFBGHack':'TB_overlayBG');if(caption===null){caption=''}$('body').append('<div id="TB_load" class="roundedCorners"><img src="'+imgLoader.src+'" /><br/><br/>Loading Image</div>');$("#TB_load").show();var baseURL;if(url.indexOf('?')!==-1){baseURL=url.substr(0,url.indexOf('?'))}else{baseURL=url}var urlString=/\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;var urlType=baseURL.toLowerCase().match(urlString);if(urlType==".jpg"||urlType==".jpeg"||urlType==".png"||urlType==".gif"||urlType==".bmp"){TB_PrevCaption='';TB_PrevTitle='';TB_PrevURL='';TB_PrevEmailLink='';TB_PrevHTML='';TB_NextCaption='';TB_NextTitle='';TB_NextURL='';TB_NextEmailLink='';TB_NextHTML='';TB_FoundURL=false;if(imageGroup){TB_Elements=$('a[rel='+imageGroup+']');for(var i=0;((i<TB_Elements.length)&&(TB_NextHTML===''));i++){var urlTypeTemp=TB_Elements[i].href.toLowerCase().match(urlString);if(!(TB_Elements[i].href==url)){var subject=$(TB_Elements[i]).children('[id$=SubjectLabel]').text();var message=$(TB_Elements[i]).children('[id$=MessageLabel]').text();var emailLink=subject.length>0?'<br/><a href="/Contact/?subject='+subject+'&message='+message+'">PURCHASE &raquo;</a>':'';if(TB_FoundURL){TB_NextCaption='<p>'+($(TB_Elements[i]).children('[id$=TitleLabel]').text()||TB_Elements[i].title||'')+'</p>'+$(TB_Elements[i]).children('[id$=DescriptionLabel]').html()+emailLink;TB_NextURL=TB_Elements[i].href||TB_Elements[i].alt;TB_NextHTML='<div id="TB_next"><div class="imageNav roundedCorners"><a href="#">Next &raquo;</a></div></div>'}else{TB_PrevCaption='<p>'+($(TB_Elements[i]).children('[id$=TitleLabel]').text()||TB_Elements[i].title||'')+'</p>'+$(TB_Elements[i]).children('[id$=DescriptionLabel]').html()+emailLink;TB_PrevURL=TB_Elements[i].href||TB_Elements[i].alt;TB_PrevHTML='<div id="TB_prev"><div class="imageNav roundedCorners"><a href="#">&laquo; Prev</a></div></div>'}}else{TB_FoundURL=true}}}imgPreloader=new Image();imgPreloader.onload=function(){imgPreloader.onload=null;var pagesize=tb_getPageSize();var x=pagesize[0]-150;var y=pagesize[1]-250;var imageWidth=imgPreloader.width;var imageHeight=imgPreloader.height;if(imageWidth>x){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_window').append($(['<div id="TB_closeWindow"><a href="#" id="TB_closeWindowButton" title="Close or ESC key">Close</a></div>','<div id="TB_ImageWrapper">',TB_PrevHTML,TB_NextHTML,'<img id="TB_Image" src="',url,'" width="',imageWidth,'" height="',imageHeight,'" alt="',title,'"/>','</div>','<div id="TB_caption"></div>'].join('')));$('#TB_caption').append(caption);$('#TB_prev, #TB_next').css({'position':'absolute','top':0,'width':parseInt(imageWidth/2),'height':imageHeight});$('#TB_next').css('left',parseInt(imageWidth/2));TB_WIDTH=imageWidth;TB_HEIGHT= $('#TB_window').height();$('#TB_closeWindowButton').click(tb_remove);if(!(TB_PrevHTML=='')){function goPrev(){if($(document).unbind('click',goPrev)){$(document).unbind('click',goPrev);}$('#TB_window').remove();$('body').append('<div id="TB_window"></div>');tb_show(TB_PrevCaption,TB_PrevTitle,TB_PrevURL,imageGroup);return false}$('#TB_prev').click(function(){goPrev()});$('#TB_prev').hover(function(){var _this=this;navPrevHoverTimeout=setTimeout(function(){$(_this).children('div.imageNav').fadeIn(350)},500)},function(){clearTimeout(navPrevHoverTimeout);$(this).children('div.imageNav').fadeOut(200)})}if(!(TB_NextHTML=='')){function goNext(){$('#TB_window').remove();$('body').append('<div id="TB_window"></div>');tb_show(TB_NextCaption,TB_NextTitle,TB_NextURL,imageGroup);return false}$('#TB_next').click(function(){goNext()});$('#TB_next').hover(function(){var _this=this;navNextHoverTimeout=setTimeout(function(){$(_this).children('div.imageNav').fadeIn(350)},500)},function(){clearTimeout(navNextHoverTimeout);$(this).children('div.imageNav').fadeOut(200)})}$(document).keydown(function(e){switch(e.keyCode){case 27:tb_remove();break;case 39:if(!(TB_NextHTML=='')){goNext();$(document).unbind('keydown')}break;case 37:if(!(TB_PrevHTML=='')){goPrev();$(document).unbind('keydown');}break}});$(window).resize(function() {	tb_position();});tb_position();$('#TB_load').remove();$('#TB_ImageOff').click(tb_remove);$('#TB_window').css({display:'block'});};imgPreloader.src=url}}function tb_remove(){$('#TB_imageOff').unbind('click');$('#TB_closeWindowButton').unbind('click');$('#TB_window').fadeOut('fast',function(){$("#TB_window,#TB_overlay,#TB_HideSelect").trigger('unload').unbind().remove()});$('#TB_load').remove();if(typeof document.body.style.maxHeight=='undefined'){$('body','html').css({height:'auto',width:'auto'});$('html').css('overflow','')}document.onkeydown='';document.onkeyup='';return false}function tb_position(){$('#TB_window').css({marginLeft:"-"+parseInt((TB_WIDTH/2),10)+"px",width:TB_WIDTH+"px"});if(!(jQuery.browser.msie&&jQuery.browser.version<7)){$('#TB_window').css({marginTop:"-"+parseInt((TB_HEIGHT > $(window).height()-100 ? $(window).height()-100 : TB_HEIGHT)/2)+"px"});}}function tb_getPageSize(){var de=document.documentElement;var w=window.innerWidth||self.innerWidth||(de&&de.clientWidth)||document.body.clientWidth;var h=window.innerHeight||self.innerHeight||(de&&de.clientHeight)||document.body.clientHeight;arrayPageSize=[w,h];return arrayPageSize}function tb_detectMacXFF(){var userAgent=navigator.userAgent.toLowerCase();if(userAgent.indexOf('mac')!=-1&&userAgent.indexOf('firefox')!=-1){return true}}


