$(document).ready(function(){

// Add hover class
$(".switch, .pos").hover(function() {
	$(this).addClass("hover");
},function() {
	$(this).removeClass("hover");
});

// Wrap UL with DIV for Skim plugin so User doesn't have to do it manually
$(".gallery ul").wrap("<div class='skim'></div>");

// iPhoto effect Skim plugin
$(window).bind("load", function() {
    $(".skim").skim();
});

/* Fade in contentwrapper after other content has loaded
$(".contentwrapper").delay(600).fadeTo(800, 1); */

// Auto add links to image thumbnails
$(".gallery ul li img").each(function() {
	var $this = $(this);
	var $fileName = $this.attr("src").split("/").pop();
	var $directory = $(this).attr("src").split("/",3).join("/");
	var $fileName = $fileName.split("_").pop();
	$this.wrap("<a></a>").parent().attr("href",$directory + "/" + $fileName);
});

// Colorbox gallery
$(".gallery ul li a").colorbox({transition:"elastic",initialWidth:550,initialHeight:550});

$(".gallery ul").each(function(i,val) {
	$(this).find("a").attr("rel","list_"+i);						   
});

$(".gallery td ol").each(function() {
	$(this).find("li:first").append("<div class='arrow'></div>");
});

$(".gallery td").wrapInner("<div class='pos'></div>")
$(".gallery td .pos").hover(function() {
	var $theContent = $(this).find("ol").html();
	/* $(this).find("ol").html($theContent).show(); */
},function() {
	$(this).find("ol").hide();
});

/*
// Take the text in the first ol li and move it to the left column
// Create the container in the left column first
$(".navigation").after("<div class='description'></div>");
$(".gallery td").hover(function() {
	var $theContent = $(this).find("ol li:first").clone();
	$(".description").html($theContent).show();
},function() {
	$(".description").hide();
});



// Tooltip plugin
$('.gallery li a').tooltip({ 
	track: false,
    delay: 500, 
    showURL: false, 
	fade: 250
});
$('.switch a').tooltip({ 
	track: true,
    delay: 0, 
    showURL: false, 
	fade: 500
});
*/


});

