jQuery(document).ready(function() {
						   
	// ---------------------------------------------------------------
	// -- Category Tabs ----------------------------------------------
	// ---------------------------------------------------------------
	
	var tabContainers = jQuery('div#left > div');
	
	jQuery('#right ul > li > a').click(function(){
		tabContainers.hide().filter(this.hash).show();
		jQuery('#right ul > li').removeClass('current');
		jQuery(this).parent().addClass('current');
		return false;
	}).filter(':first').click();


	// ---------------------------------------------------------------
	// -- Media > Photos ---------------------------------------------
	// ---------------------------------------------------------------
	
	if(jQuery('#content #left h1:contains("Photos")').length > 0 || jQuery('#content #left h1:contains("photos")').length > 0){
		
		// fetch from Flickr JSON feed
		jQuery.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?id=10135920@N08&lang=en-us&format=json&jsoncallback=?", function(data){
			jQuery('#content #left h1:contains("Photos")').after('<div id="photos"></div>');
			jQuery.each(data.items, function(i,item){
				var imgThumb = item.media.m
				var imgLarge = item.media.m
				imgThumb = imgThumb.slice(0, imgThumb.length - 5) + "s.jpg";
				imgLarge = imgLarge.slice(0, imgLarge.length - 6) + ".jpg";
				jQuery("<img/>").attr({src: imgThumb}).appendTo("#photos").wrap("<a href='" + imgLarge + "'></a>").parent().attr({title: item.title, rel: "shadowbox[sara_dimmick]"});
			});
			jQuery('#photos').append('<div class="clear"></div>');
		});
	}


	// ---------------------------------------------------------------
	// -- Media > Video ----------------------------------------------
	// ---------------------------------------------------------------
	
	if(jQuery('#content #left h1:contains("Videos")').length > 0 || jQuery('#content #left h1:contains("video")').length > 0){
		jQuery('#videos a').each(function(){
			var currentTitle = jQuery(this).children('img').attr('title');
			jQuery(this).append('<span>'+currentTitle+'</span>').attr({rel:"shadowbox;width=240;height=180;", title: currentTitle});
		});
		jQuery('#videos').after('<div class="clear"></div>');
	}



	// ---------------------------------------------------------------
	// -- Media > Web & Print ----------------------------------------
	// ---------------------------------------------------------------
	
	if(jQuery('#content #left h1:contains("Web & Print")').length > 0 || jQuery('#content #left h1:contains("web & print")').length > 0){
		jQuery('#webprint a').each(function(){
			var currentTitle = jQuery(this).children('img').attr('title');
			jQuery(this).append('<span>'+currentTitle+'</span>').attr({rel:"shadowbox;width=240;height=180;", title: currentTitle});
		});
		jQuery('#webprint').after('<div class="clear"></div>');
	}

});// --- End $(document).ready ---


Shadowbox.loadSkin('classic', 'http://www.physeq.com/wp-content/themes/physeq/shadowbox/skin');
Shadowbox.loadLanguage('en', 'http://www.physeq.com/wp-content/themes/physeq/shadowbox/lang');
Shadowbox.loadPlayer(['img','swf','flv','qt','wmp','iframe','html'], 'http://www.physeq.com/wp-content/themes/physeq/shadowbox/player');

window.onload = Shadowbox.init;
