/****************************************************************
resume.js
This file supports the dynamic functions of the resume.html page.
This code is intentionally not compressed for review purposes
*****************************************************************/

(function($) {
	$(function() { //on DOM ready
		//start by hiding all of the sections
		$(".ResumeSection").addClass("hidden");
		
		var sOptions = {};
		$("#SectionMenu li a").click(function() {
			//hide all sections and remove the selected class from the menu
			$(".ResumeSection").addClass("hidden");
			$("#SectionMenu li a").removeClass("selected");
			//determine which section to show, and show it
			$("#div" + $(this).attr("title").replace(/\s/g,"_")).removeClass("hidden");
			//select this label in the menu, but don't keep the focus here, otherwise the focus box is displayed
			$(this).addClass("selected");
			$(this).blur();
			return false;
		}).effect("slide",sOptions,300,menuLoaded);
		
		//set up the dialog to display code samples
		$("#dialogCode").dialog({
			bgiframe: true,
			autoOpen: false,
			width: 750,
			height:500,
			resizeable: true,
			modal: true,
			overlay: {
				backgroundColor: '#000',
				opacity: 0.5
			},
			buttons: {
				'OK': function() {
					$(this).dialog('close');
				},
				'Print': function() {
					frames["codeFrame"].print();
				}
			}
		});
		
		//set all code links to display in the dialog
		$(".CodeLink").click(function(){
			var sURL=$(this).attr("href");
			$("#codeFrame").attr("src",sURL);
			if(!$("#dialogCode").dialog("isOpen")) $("#dialogCode").dialog("open");
			return false;
		});
		
		//set up external links to open in a new window
		$("a.external").attr("target","_blank");
		
		//set up prettyPhoto
		$("a[rel^='prettyPhoto']").prettyPhoto();

	});
})(jQuery);
function menuLoaded() {
	$("#divIntroduction").removeClass("hidden");
	$("#SectionMenu li a:first").addClass("selected");
}
