// JavaScript Document
// jQuery interface programmed by David Cole
// www.davidrcole.com
     	$(function () {
//		Deprecated
/*     		//tabs
	     	var tabContainers = $('#work_list div');
               tabContainers.hide().filter(':first').show();
			
               $('#work_list ul.tabNavigation a').click(function () {
               	tabContainers.hide();
                    tabContainers.filter(this.hash).fadeIn(300);
                    $('#work_list ul.tabNavigation a').removeClass('selected');
                    $(this).addClass('selected');
                    return false;
               }).filter(':first').click();
*/			
			//change link HREF to REL (this leaves valid links for non-javascript users)
			$('a.thumb, a.post_link, li.cat-item a').attr('rel', function() { return $(this).attr('href');
			//clear href attribute
			}).removeAttr('href');
			
			//UI Slider scrollbar
			$("#slider").slider({ animate: true, change: handleSliderChange, slide: handleSliderChange });
			//count number of LI elements and multiply by width of 250px
			var thumbs_width = $('#thumbs ul li').length * 250;
			//slide the div, based on relationship of ui.value and thumbs_width
			function handleSliderChange(e, ui) {
				$("#thumbs_scroll").attr({scrollLeft: ui.value * (thumbs_width / 400) }); }

			//on thumbnail or Name menu click
			$('a.thumb, a.post_link').click(function() { 
				//show the loader
				$('#loader').fadeIn('fast');
				//scroll up slightly to fix scrolling problem
				if ($('#gallery').is(':hidden')) { $.scrollTo('-=5', 100); }					
				//AJAX load gallery content based on REL attribute
				$('#gallery').load($(this).attr('rel'), function() {
					//after load (callback), hide the loader
					$('#loader').fadeOut('fast');
					//if the gallery isn't visible, slide it down, then scroll to the Post Header
					if ($('#gallery').is(':hidden')) {
						$('#gallery').slideDown(750, function(){ 
							$.scrollTo('#top_collapse', 750); 
							//add Hide This button to bottom
							$('#bottom_collapse').css({'visibility' : 'visible'});
						});
					}					
				});
			});
		//end Document Ready				
		});