/* ******************************************************************************** */
/* Things to do when the document is loaded (jQuery) ****************************** */
/* ******************************************************************************** */
$(document).ready(function(){
	// Loop through the navigation menu items and switch this page's image to the _f3 image 
	// First find the current page id
	var pageHref = window.location.pathname.replace(/^.*\/([^\/\?]*)\//,"$1");
    $("#nav a").each(function(i) {
    	//alert('pageHref = '+pageHref+', this href = '+$(this).attr("href")+', regexp='+$(this).attr("href").replace(/^.*\/([^\/\?]*)\??.*$/,"$1"));
		if ($(this).attr("href")==pageHref || 
				($(this).attr("href") == "/" && pageHref=="") ||
				$(this).attr("href").replace(/^.*\/([^\/\?]*)\??.*\/$/,"$1")==pageHref)  {
			// this is the current page link - deactivate it and set the f3 image
			$(this).css("background-image",$(this).css("background-image").replace(/.jpg/,"_f3.jpg"));
			// Add the arrow graphic
			$(this).append("<div id='selector'>&nbsp;</div>");
			//alert('this now = '+$(this).html());
		}
	});
	// Set the leftBar height to equal the height of the content div
	var topMargin = parseInt($("#main").css('top').replace(/px/,""));
	var contentHeight = parseInt($("#main").css('height').replace(/px/,""));
	 $("#leftbar").css('height',(contentHeight+topMargin+31)+"px");
});


// //////////////////////////////////////////////////////////////////////////// //
// GLOBAL FUNCTIONS
// //////////////////////////////////////////////////////////////////////////// //

function setupPortfolio() {
	$("#portfolioscreen")
		.css('background-image','url(images/pf_bluechair.jpg)');
	
}

function obfuscate() {
	return 'm'+'a'+'i'+'l'+'t'+'o'+':'+
			'j'+'e'+'d'+'@'+'j'+'k'+'o'+'o'+'p'+'s'+'.'+'c'+'o'+'m';
}