/* bgIframe Copyright 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Version 2.1.1 $Rev: 2447 $ $LastChangedDate: 2007-07-21 18:45:56 -0500 (Sat, 21 Jul 2007) $
 */
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);

function chunk(array, process, context){
    var array = array.concat();   //clone the array
    var timers = new Array();
    setTimeout(function(){
        var item = array.shift();
        process.call(context, array.length, item);
        if (array.length > 0){
			timers.push( setTimeout(arguments.callee, 25) );
        }
    }, 25);
    return timers;
}

$(function(){
	
	$("#addLink").click(function(e){
			var currentNum = parseInt($(this).attr('rel'));
			var $html = $("#linkPrototype").clone();
			var NEWHTML = $html.html().replace(/##NUM##/g, currentNum+1);
			//alert($html);
			$("#linkPlaceholder").append(NEWHTML);
			$(this).attr('rel', currentNum+1);
			$('#added_social').attr('value', currentNum+1);
			e.preventDefault();
		});
	/*
	(function(){
		$.each($('.checklistBox'),function(){
			$this = $(this);
			if($this.find(':checked:first').length > 0){
				var checkedScrollTop;
				$.each($this.find(':checked'),function(){
					var top = $(this).offset().top;
					if(checkedScrollTop === undefined || top < checkedScrollTop){
						checkedScrollTop = top;
					}
				});
				var scrollTop = checkedScrollTop - $this.offset().top;
				if(scrollTop > 5){
					scrollTop = scrollTop - 1 - parseInt($this.css('padding-top'));
					$this.animate({scrollTop: scrollTop+"px"},1000);
				}
			}
		});
	})();
	*/
	
	
	/*
	 ************************
	 *	Start Photo Gallery	* 
 	 *	Author: Levi Dawson	*
	 ************************
	 */
	//hide elements
	$('#loadingImg').hide();
	$('#galnext, #galprev').hide();
	//resets the value of the hidden input fields used for calling the
	//next img. this adds or subtracts 1 from the hidden field.
	//it finds the thumbnail's href by the index number supplied
	//by the the hidden field's value
	function reset_index_num(x){
		if(x=='add'){
			imgnumber($('#nextimg').val(),'');
			var nextimg = $('#nextimg').val();
			loadimage($('.img_holder:eq('+nextimg+')').children().attr('href'));
			
			if($('#nextimg').val()=='1' && $('#previmg').val()=='0'){
				$('#nextimg').attr('value', parseInt($('#nextimg').val()) + 1);
			} else {
				$('#nextimg').attr('value', parseInt($('#nextimg').val()) + 1);
				$('#previmg').attr('value', parseInt($('#previmg').val()) + 1);
			}
		} else if(x=='sub') {
			imgnumber($('#nextimg').val(),true);
			var previmg = $('#previmg').val();
			loadimage($('.img_holder:eq('+previmg+')').children().attr('href'));
			$('#nextimg').attr('value', parseInt($('#nextimg').val()) - 1);
			$('#previmg').attr('value', parseInt($('#previmg').val()) - 1);
		} else {
			
			if($('p#imgnum span').text() == '1'){
				if($('#nextimg').val() == '1' && $('#previmg').val() == '0') {
					$('#nextimg').attr('value', parseInt(x) + 1);
				} else {
					$('#nextimg').attr('value', parseInt(x) + 1);
					$('#previmg').attr('value', parseInt(x) - 1);
				}
			} else {
				$('#nextimg').attr('value', parseInt(x) + 1);
				$('#previmg').attr('value', parseInt(x) - 1);
			}
		}
	}
	function showbtn(ifhover){
		if(ifhover == true){
			$('#galprev').fadeIn('fast');
			$('#galnext').fadeIn('fast');
		} else {
			$('#galprev').fadeIn('fast').delay(1000).fadeOut('slow');
			$('#galnext').fadeIn('fast').delay(1000).fadeOut('slow');
		}
		if($('#previmg').val() == '-1'){
			$('#galprev').fadeOut('fast');
		}
		if($('#nextimg').val() == '1' && $('#previmg').val() == '0'){
			$('#galprev').fadeOut('fast');
		}
		if (parseInt($('#nextimg').val()) == $('#totalimgs').val()) {
			$('#galnext').fadeOut('fast');
		}
	}
	function imgnumber(idx, ifprev){
		if(ifprev != ''){
			$('p#imgnum span').text(parseInt(idx) - 1);
		} else {
			//adding 1 cause index nums start at 0
			$('p#imgnum span').text(parseInt(idx) + 1);
		}
	}
	//adds the loading gif and loads the new specific img
	function loadimage(x){
		$('#loadingImg').show();
		var img = new Image();
		$(img).load(function(){
			$('#loadingImg').hide();
			$('#med-img').fadeOut('fast',function(){
				$('#med-img').attr('src', x).fadeIn('fast');
			});
		}).attr('src', x);
	}
	//popup the gallery
	$('#see-all-photos a').click(function(){
		$('#gallery_popup_holder').fadeIn('slow');
		//set hidden input fields value for next and pre btn
		$('#nextimg').attr('value', '1');
		$('#previmg').attr('value', '0');
	});
	//close the gallery
	$('#close').click(function(){
		$('#gallery_popup_holder').fadeOut('slow');
	});
	//show the prev and next buttons
	$('#med-img-holder').hover(function(){
		showbtn(true);
	}, function(){
			$('#galprev, #galnext').fadeOut('fast');
	});
	//for all the thumbnails
	//change the image and reset the hidden input fields
	$('.img_holder a').click(function(e){
		loadimage($(this).attr('href'));
		imgnumber($(this).parent().index(),'');
		showbtn(false);
		reset_index_num($(this).parent().index());
		e.preventDefault();
	});
	//next button
	$('#galnext').click(function(e){
		reset_index_num('add');
		showbtn(true);
		e.preventDefault();
	});
	//prev button
	$('#galprev').click(function(e){
		reset_index_num('sub');
		e.preventDefault();
		showbtn(true);
	});
	
	//////End photo gallery
	
	$('.h-w-i').click(function(e){
		$('#h-w-i-holder').fadeIn('slow');
		e.preventDefault();
	});
	$('#close-h-w-i').click(function(e){
		$(this).parent().fadeOut('slow');
		e.preventDefault();
	});
	
	$('#search_by_mlsid input').keyup(function(){
		this.value = this.value.replace(/[^0-9\.]/g,'');
	});
	$('#search-other a').click(function(e){
		e.preventDefault();
		var link = $(this).attr('href');
		var link = link.substring(1, link.length);
		
		$('#search_overlay').remove();
		$Overlay = $('<div id="search_overlay" class="simple-overlay" style="display:none;"></div>');
		$Overlay.appendTo('form#quicksearchform').fadeTo('slow', 0.5, function(){
			$('#'+link+'').fadeIn('slow');
		});
	});
	$('#search_by_addy a, #search_by_mlsid a').click(function(e){
		$('#search_by_addy input').val('');
		$('#search_by_mlsid input').val('');
		$(this).parent().parent().fadeOut('slow', function(){
			$('#search_overlay').fadeOut('slow', function(){
				$('#search_overlay').remove();
			})
		});
	});
	
	
	$("a[rel=external]").click(function(){ $(this).attr('target','_blank'); });
	
	// main nav submenu animation
	var $HeaderNav = $('#HeaderNav');
	$HeaderNav.find('> ul > li > ul').each(function(){
		var $this = $(this);
		$this.data('originalHeight',$this.height());
		$this.hide().css({left:-1, opacity:0, height:0})
	});
	$HeaderNav.find('> ul > li').hover(
		function(){
			var $this = $(this).addClass('hover');
			var $ul = $this.find('> ul').show();
			$ul.stop(true).css({}).delay(75).animate({height:$ul.data('originalHeight'),opacity:1}, 350);
		},
		function(){
			var $this = $(this).removeClass('hover');
			var $ul = $this.find('> ul');
			$ul.stop(true).css({}).delay(120).animate({height:0,opacity:0}, 250);
		}
	);
	
	
});


/*
*Populates quick search $Min and $Max based on
*type of radio btn selected (Sale/Lease)
*/
$(document).ready(function() {
	$('#radio-sale').click(function(){
			$('#lease-min, #lease-max').hide();
			$('#sale-min, #sale-max').show();
			$('#lease-min, #lease-max').val('').attr('selected',true);
	});
	$('#radio-lease').click(function(){
			$('#lease-min, #lease-max').show();
			$('#sale-min, #sale-max').hide();
			$('#sale-min, #sale-max').val('').attr('selected',true);
	});
	$("#radio-sale").click();
	
	$("#HomeUser").click(function() {
		if($(this).val() == 'Username') {
			$(this).val('');
		}
	});
	
	$("#HomePass").click(function() {
		if($(this).val() == 'Password') {
			$(this).val('');
		}
	});
	
	$(".videoRssItem").find('a').attr('target', '_blank');
	$(".videoRssItem").find('a').attr('rel', 'nofollow');
	
});

/*
*Changes the filepath for the flowplayer
*on the video page
*/
$("#vidthumbholer a").click(function(){
	flowplayer("player", "/flowplayer-3.2.4.swf", {
		clip: {
			url:$(this).attr('href'),
			scaling: 'orig'
		}
	});
	return false;
});

/* Thickbox 3 - By Cody Lindley (http://www.codylindley.com)
 * Copyright 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
 * Modified By Andy Blackwell - jQuery 1.3 compatible & Auto Width&Height set to around 70% of window
 */
var tb_pathToImage = "/images/loading.gif";
//eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(o).2A(9(){1k(\'a.19, 2B.19, 2C.19\');1l=1m 1n();1l.L=2D});9 1k(b){$(b).q(9(){6 t=P.Q||P.1o||M;6 a=P.v||P.1K;6 g=P.1L||R;1a(t,a,g);P.2E();G R})}9 1a(d,f,g){2F{3(1M o.z.H.1N==="1O"){$("z","12").r({A:"1P%",s:"1P%"});$("12").r("1Q","2G");3(o.1R("1p")===M){$("z").u("<S 5=\'1p\'></S><4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").q(I)}}n{3(o.1R("B")===M){$("z").u("<4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").q(I)}}3(1S()){$("#B").1T("2H")}n{$("#B").1T("2I")}3(d===M){d=""}$("z").u("<4 5=\'J\'><1U L=\'"+1l.L+"\' /></4>");$(\'#J\').2J();6 h;3(f.N("?")!==-1){h=f.2K(0,f.N("?"))}n{h=f}6 i=/\\.1V$|\\.1W$|\\.1X$|\\.1Y$|\\.1Z$/;6 j=h.1q().20(i);3(j==\'.1V\'||j==\'.1W\'||j==\'.1X\'||j==\'.1Y\'||j==\'.1Z\'){1r="";1s="";13="";1t="";1u="";T="";1v="";1w=R;3(g){E=$("a[@1L="+g+"]").2L();21(C=0;((C<E.1b)&&(T===""));C++){6 k=E[C].v.1q().20(i);3(!(E[C].v==f)){3(1w){1t=E[C].Q;1u=E[C].v;T="<1c 5=\'22\'>&1d;&1d;<a v=\'#\'>2M &2N;</a></1c>"}n{1r=E[C].Q;1s=E[C].v;13="<1c 5=\'23\'>&1d;&1d;<a v=\'#\'>&2O; 2P</a></1c>"}}n{1w=1e;1v="1n "+(C+1)+" 2Q "+(E.1b)}}}U=1m 1n();U.1f=9(){U.1f=M;6 a=24();6 x=a[0]-25;6 y=a[1]-25;6 b=U.s;6 c=U.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}14=b+30;1g=c+2R;$("#8").u("<a v=\'\' 5=\'26\' Q=\'1x\'><1U 5=\'2S\' L=\'"+f+"\' s=\'"+b+"\' A=\'"+c+"\' 1K=\'"+d+"\'/></a>"+"<4 5=\'2T\'>"+d+"<4 5=\'2U\'>"+1v+13+T+"</4></4><4 5=\'2V\'><a v=\'#\' 5=\'V\' Q=\'1x\'>1y</a> 1z 1A 1B</4>");$("#V").q(I);3(!(13==="")){9 15(){3($(o).O("q",15)){$(o).O("q",15)}$("#8").D();$("z").u("<4 5=\'8\'></4>");1a(1r,1s,g);G R}$("#23").q(15)}3(!(T==="")){9 1C(){$("#8").D();$("z").u("<4 5=\'8\'></4>");1a(1t,1u,g);G R}$("#22").q(1C)}o.1h=9(e){3(e==M){K=28.2a}n{K=e.2b}3(K==27){I()}n 3(K==2W){3(!(T=="")){o.1h="";1C()}}n 3(K==2X){3(!(13=="")){o.1h="";15()}}};16();$("#J").D();$("#26").q(I);$("#8").r({W:"X"})};U.L=f}n{6 l=f.2c(/^[^\\?]+\\??/,\'\');6 m=2d(l);14=(m[\'s\']*1)+30||Y.2e(1i($(1j).s())*0.2f);1g=(m[\'A\']*1)+2Y||Y.2e(1i($(1j).A())*0.2f);Z=14-30;11=1g-2Z;3(f.N(\'2g\')!=-1){1D=f.1E(\'31\');$("#18").D();3(m[\'1F\']!="1e"){$("#8").u("<4 5=\'2h\'><4 5=\'1G\'>"+d+"</4><4 5=\'2i\'><a v=\'#\' 5=\'V\' Q=\'1x\'>1y</a> 1z 1A 1B</4></4><S 2j=\'0\' 2k=\'0\' L=\'"+1D[0]+"\' 5=\'18\' 1o=\'18"+Y.2l(Y.1H()*2m)+"\' 1f=\'1I()\' H=\'s:"+(Z+29)+"p;A:"+(11+17)+"p;\' > </S>")}n{$("#B").O();$("#8").u("<S 2j=\'0\' 2k=\'0\' L=\'"+1D[0]+"\' 5=\'18\' 1o=\'18"+Y.2l(Y.1H()*2m)+"\' 1f=\'1I()\' H=\'s:"+(Z+29)+"p;A:"+(11+17)+"p;\'> </S>")}}n{3($("#8").r("W")!="X"){3(m[\'1F\']!="1e"){$("#8").u("<4 5=\'2h\'><4 5=\'1G\'>"+d+"</4><4 5=\'2i\'><a v=\'#\' 5=\'V\'>1y</a> 1z 1A 1B</4></4><4 5=\'F\' H=\'s:"+Z+"p;A:"+11+"p\'></4>")}n{$("#B").O();$("#8").u("<4 5=\'F\' 32=\'33\' H=\'s:"+Z+"p;A:"+11+"p;\'></4>")}}n{$("#F")[0].H.s=Z+"p";$("#F")[0].H.A=11+"p";$("#F")[0].34=0;$("#1G").12(d)}}$("#V").q(I);3(f.N(\'35\')!=-1){$("#F").u($(\'#\'+m[\'2n\']).2o());$("#8").2p(9(){$(\'#\'+m[\'2n\']).u($("#F").2o())});16();$("#J").D();$("#8").r({W:"X"})}n 3(f.N(\'2g\')!=-1){16();3($.1J.36){$("#J").D();$("#8").r({W:"X"})}}n{$("#F").37(f+="&1H="+(1m 38().39()),9(){16();$("#J").D();1k("#F a.19");$("#8").r({W:"X"})})}}3(!m[\'1F\']){o.2q=9(e){3(e==M){K=28.2a}n{K=e.2b}3(K==27){I()}}}}3a(e){}}9 1I(){$("#J").D();$("#8").r({W:"X"})}9 I(){$("#3b").O("q");$("#V").O("q");$("#8").3c("3d",9(){$(\'#8,#B,#1p\').3e("2p").O().D()});$("#J").D();3(1M o.z.H.1N=="1O"){$("z","12").r({A:"2r",s:"2r"});$("12").r("1Q","")}o.1h="";o.2q="";G R}9 16(){$("#8").r({3f:\'-\'+1i((14/2),10)+\'p\',s:14+\'p\'});3(!(2s.1J.3g&&2s.1J.3h<7)){$("#8").r({3i:\'-\'+1i((1g/2),10)+\'p\'})}}9 2d(a){6 b={};3(!a){G b}6 c=a.1E(/[;&]/);21(6 i=0;i<c.1b;i++){6 d=c[i].1E(\'=\');3(!d||d.1b!=2){3j}6 e=2t(d[0]);6 f=2t(d[1]);f=f.2c(/\\+/g,\' \');b[e]=f}G b}9 24(){6 a=o.3k;6 w=1j.2u||2v.2u||(a&&a.2w)||o.z.2w;6 h=1j.2x||2v.2x||(a&&a.2y)||o.z.2y;2z=[w,h];G 2z}9 1S(){6 a=3l.3m.1q();3(a.N(\'3n\')!=-1&&a.N(\'3o\')!=-1){G 1e}}',62,211,'|||if|div|id|var||TB_window|function||||||||||||||else|document|px|click|css|width||append|href||||body|height|TB_overlay|TB_Counter|remove|TB_TempArray|TB_ajaxContent|return|style|tb_remove|TB_load|keycode|src|null|indexOf|unbind|this|title|false|iframe|TB_NextHTML|imgPreloader|TB_closeWindowButton|display|block|Math|ajaxContentW||ajaxContentH|html|TB_PrevHTML|TB_WIDTH|goPrev|tb_position||TB_iframeContent|thickbox|tb_show|length|span|nbsp|true|onload|TB_HEIGHT|onkeydown|parseInt|window|tb_init|imgLoader|new|Image|name|TB_HideSelect|toLowerCase|TB_PrevCaption|TB_PrevURL|TB_NextCaption|TB_NextURL|TB_imageCount|TB_FoundURL|Close|close|or|Esc|Key|goNext|urlNoQuery|split|modal|TB_ajaxWindowTitle|random|tb_showIframe|browser|alt|rel|typeof|maxHeight|undefined|100|overflow|getElementById|tb_detectMacXFF|addClass|img|jpg|jpeg|png|gif|bmp|match|for|TB_next|TB_prev|tb_getPageSize|150|TB_ImageOff||event||keyCode|which|replace|tb_parseQuery|floor|75|TB_iframe|TB_title|TB_closeAjaxWindow|frameborder|hspace|round|1000|inlineId|children|unload|onkeyup|auto|jQuery|unescape|innerWidth|self|clientWidth|innerHeight|clientHeight|arrayPageSize|ready|area|input|tb_pathToImage|blur|try|hidden|TB_overlayMacFFBGHack|TB_overlayBG|show|substr|get|Next|gt|lt|Prev|of|60|TB_Image|TB_caption|TB_secondLine|TB_closeWindow|190|188|40|45||TB_|class|TB_modal|scrollTop|TB_inline|safari|load|Date|getTime|catch|TB_imageOff|fadeOut|fast|trigger|marginLeft|msie|version|marginTop|continue|documentElement|navigator|userAgent|mac|firefox'.split('|'),0,{}))
$(function(){tb_init("a.thickbox, area.thickbox, input.thickbox");imgLoader=new Image();imgLoader.src=tb_pathToImage});function tb_init(b){$(b).live("click",function(){var t=this.title||this.name||null;var a=this.href||this.alt;var g=this.rel||false;tb_show(t,a,g);this.blur();return false})}function tb_show(g,h,i){try{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)}}if(tb_detectMacXFF()){$("#TB_overlay").addClass("TB_overlayMacFFBGHack")}else{$("#TB_overlay").addClass("TB_overlayBG")}if(g===null){g=""}$("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");$("#TB_load").show();var j;if(h.indexOf("?")!==-1){j=h.substr(0,h.indexOf("?"))}else{j=h}var k=/\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;var l=j.toLowerCase().match(k);if(l==".jpg"||l==".jpeg"||l==".png"||l==".gif"||l==".bmp"){TB_PrevCaption="";TB_PrevURL="";TB_PrevHTML="";TB_NextCaption="";TB_NextURL="";TB_NextHTML="";TB_imageCount="";TB_FoundURL=false;if(i){TB_TempArray=$("a[rel="+i+"]").get();for(TB_Counter=0;((TB_Counter<TB_TempArray.length)&&(TB_NextHTML===""));TB_Counter++){var m=TB_TempArray[TB_Counter].href.toLowerCase().match(k);if(!(TB_TempArray[TB_Counter].href==h)){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 a=tb_getPageSize();var x=a[0]-150;var y=a[1]-150;var b=imgPreloader.width;var c=imgPreloader.height;if(b>x){c=c*(x/b);b=x;if(c>y){b=b*(y/c);c=y}}else{if(c>y){b=b*(y/c);c=y;if(b>x){c=c*(x/b);b=x}}}TB_WIDTH=b+30;TB_HEIGHT=c+60;$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+h+"' width='"+b+"' height='"+c+"' alt='"+g+"'/></a><div id='TB_caption'>"+g+"<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>");$("#TB_closeWindowButton").click(tb_remove);if(!(TB_PrevHTML==="")){function d(){if($(document).unbind("click",d)){$(document).unbind("click",d)}$("#TB_window").remove();$("body").append("<div id='TB_window'></div>");tb_show(TB_PrevCaption,TB_PrevURL,i);return false}$("#TB_prev").click(d)}if(!(TB_NextHTML==="")){function f(){$("#TB_window").remove();$("body").append("<div id='TB_window'></div>");tb_show(TB_NextCaption,TB_NextURL,i);return false}$("#TB_next").click(f)}document.onkeydown=function(e){if(e==null){keycode=event.keyCode}else{keycode=e.which}if(keycode==27){tb_remove()}else{if(keycode==190){if(!(TB_NextHTML=="")){document.onkeydown="";f()}}else{if(keycode==188){if(!(TB_PrevHTML=="")){document.onkeydown="";d()}}}}};tb_position();$("#TB_load").remove();$("#TB_ImageOff").click(tb_remove);$("#TB_window").css({display:"block"})};imgPreloader.src=h}else{var n=h.replace(/^[^\?]+\??/,"");var o=tb_parseQuery(n);TB_WIDTH=(o.width*1)+30||$(window).width()*0.6;TB_HEIGHT=(o.height*1)+40||$(window).height()*0.8;ajaxContentW=TB_WIDTH-30;ajaxContentH=TB_HEIGHT-45;if(h.indexOf("TB_iframe")!=-1){urlNoQuery=h.split("TB_");$("#TB_iframeContent").remove();if(o.modal!="true"){$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+g+"</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()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW+29)+"px;height:"+(ajaxContentH+17)+"px;' > </iframe>")}else{$("#TB_overlay").unbind();$("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW+29)+"px;height:"+(ajaxContentH+17)+"px;'> </iframe>")}}else{if($("#TB_window").css("display")!="block"){if(o.modal!="true"){$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+g+"</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{$("#TB_overlay").unbind();$("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>")}}else{$("#TB_ajaxContent")[0].style.width=ajaxContentW+"px";$("#TB_ajaxContent")[0].style.height=ajaxContentH+"px";$("#TB_ajaxContent")[0].scrollTop=0;$("#TB_ajaxWindowTitle").html(g)}}$("#TB_closeWindowButton").click(tb_remove);if(h.indexOf("TB_inline")!=-1){$("#TB_ajaxContent").append($("#"+o.inlineId).children());$("#TB_window").unload(function(){$("#"+o.inlineId).append($("#TB_ajaxContent").children())});tb_position();$("#TB_load").remove();$("#TB_window").css({display:"block"})}else{if(h.indexOf("TB_iframe")!=-1){tb_position();if($.browser.safari){$("#TB_load").remove();$("#TB_window").css({display:"block"})}}else{$("#TB_ajaxContent").load(h+="&random="+(new Date().getTime()),function(){tb_position();$("#TB_load").remove();tb_init("#TB_ajaxContent a.thickbox");$("#TB_window").css({display:"block"})})}}}if(!o.modal){document.onkeyup=function(e){if(e==null){keycode=event.keyCode}else{keycode=e.which}if(keycode==27){tb_remove()}}}}catch(e){}}function tb_showIframe(){$("#TB_load").remove();$("#TB_window").css({display:"block"})}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/2),10)+"px"})}}function tb_parseQuery(a){var b={};if(!a){return b}var c=a.split(/[;&]/);for(var i=0;i<c.length;i++){var d=c[i].split("=");if(!d||d.length!=2){continue}var e=unescape(d[0]);var f=unescape(d[1]);f=f.replace(/\+/g," ");b[e]=f}return b}function tb_getPageSize(){var a=document.documentElement;var w=window.innerWidth||self.innerWidth||(a&&a.clientWidth)||document.body.clientWidth;var h=window.innerHeight||self.innerHeight||(a&&a.clientHeight)||document.body.clientHeight;arrayPageSize=[w,h];return arrayPageSize}function tb_detectMacXFF(){var a=navigator.userAgent.toLowerCase();if(a.indexOf("mac")!=-1&&a.indexOf("firefox")!=-1){return true}};

$('#gallery_holder a').click(function(e){
	var $newPath = $(this).attr('rel');
	$('img#medImg').attr('src', $newPath);
	e.preventDefault();
});

