/*******************************************

                Jason Maas
	         ~~~~~~~~~~~~~~~~~
            page custom scripts

*******************************************/


// JQUERY
jQuery.preloadImages = function() {
	for(var i = 0; i<arguments.length; i++) {
		jQuery("<img>").attr("src", arguments[i]);
	}
}

// FUNCTIONS
function openItemInSeparateWindow(url, width, height) {
	window.open(url,'secondwindow','width='+width+',height='+height+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=yes');
}
function readMore(pos) {
	// Turn More content on
	if (pos == 1) {
		$('#open').hide();
		$('#prof').show();
		$('#pers').show();
		$(document.body).css('background-image', 'url(img/environment/tree-full-fade.jpg)');
	} 
	// Turn More content off
	else {
		$('#open').show();
		$('#prof').hide();
		$('#pers').hide();
		$(document.body).css('background-image', '');
	}
}

// SETUP
$(document).ready(function(){
	// Create Image Areas
	$('.imagearea').imagearea({ 'speed': 300 });
	
	// Create "Read More" link
	$('a#readon').click(function(){ readMore(1); });
	$('a#readoff').click(function(){ readMore(0); });
	
	// Preload Fade Tree
	$.preloadImages("img/environment/tree-full-fade.jpg");
});