 $(document).ready(function() {
	var desc_on = true; // boolean: turn on link descriptions?
	var swaps = {	"artwork" : ["p_sun", "view selected works from my artwork portfolio"], 
					"resume" : ["p_kite", "view my resume"],
					"travel" : ["p_balloon", "view photos from my trips and vacations"], 
					"teaching" : ["p_paper", "slides and PDFs for the courses I teach"], 
					"coding" : ["p_leaf", "coding projects I've worked on"],
					"about" : ["p_bird", "all about me"] 
				};
	/* Show/hide image icons on hover. */
	$(".toggleAble").hoverIntent(function() { $("#"+swaps[$(this).attr("id")][0]).fadeIn(); 
										if (desc_on)
											$("#link_description").html('['+swaps[$(this).attr("id")][1]+']').fadeIn();
								},
								 function() { $("#"+swaps[$(this).attr("id")][0]).fadeOut("fast"); 
										if (desc_on)
											$("#link_description").html("").fadeOut("fast");
								}
						); 
	/* Show all when hover on logo. */
	$("#logo").hoverIntent(function() { $(".retract").fadeIn("slow"); }, function() { $(".retract").fadeOut("fast"); } );
	
	/* Load proper content on resume */
	$(".resume-load").click(function() {
		var source = $("#"+$(this).attr("href").substring(1)).html();
		$("#resume-load-info").parent().fadeIn().animate({height: 300}); // if not already
		$("#resume-load-info").slideUp("normal", function () { $("#resume-load-info").html(source).slideDown(); });
		return false;
	});
	
	$(".open-project").click(function() {
		var source = $("#"+$(this).attr("href").substring(1)).html();
		$("#coding-load-info").parent().fadeIn().animate({height: 300}); // if not already
		$("#coding-load-info").slideUp("normal", function () { $("#coding-load-info").html(source).slideDown(); });
		return false;
	});
	
	if ($("#recitation-files")) {
		$.getJSON("labdata.data", function(data) { 
		  var root = data.root;
		  var wkstRoot = data.root_wkst;
          $.each(data.items, function(i,item){
            var newBullet = $("<li/>").html("<a href=\""+root+item.url+"\">"+item.title+" <span>("+item.desc+")</span></a>");
			newBullet.append("<div align='right'><a class='wkst' href='"+wkstRoot+item.wkst+"'>wkst</a> | <a class='wkst' href='"+wkstRoot+item.wkst_sol+"'>sol</a></div>");
			newBullet.appendTo("#recitation-files");
          });
		});
	}
});