// JavaScript Document

$(document).ready(function(){
	$('div.tabNavbar div').click(function() {
		var curChildIndex = $(this).prevAll().length + 1;
		$(this).parent().children('.current').removeClass('current');
		$(this).addClass('current');
		$(this).parent().next('.tabContainer').children('.current').hide('fast',function() {
			$(this).removeClass('current');
			$(this).parent().children('div:nth-child('+curChildIndex+')').show('normal',function() {
				$(this).addClass('current');
			});
		});
		return false;								
	});
	$('div#emailHotspot').click(function() {	
		var mailtoHref = 'mailto:';
		mailtoHref = mailtoHref + 'rockmarcello';
		mailtoHref = mailtoHref + '@aol.com';
		window.location.href = mailtoHref;
		return false;
	});
	setNavitemHeight();
});

/*	Adjusts the size of the middle background section and the top margin of the <a> text.
	Magic numbers represent the white area of the with expanding the middle section (70)
	and without expanding it; can't use the actual heights of the sections because of the shading and shadow*/
function setNavitemHeight() {
	$('.nav-left li a').each(function(i) {
		var navitemHeight = $(this).height();
		var newMiddleHeight;
		var topMargin;
		if (navitemHeight > 70) {
			newMiddleHeight = navitemHeight - 70;
			topMargin = 10;
			$(this).parent().children('.navbackgroundmiddle').height(newMiddleHeight);
		} else {
			topMargin = (90 - navitemHeight)/2;	
		}
		$(this).css('margin-top', topMargin);
	});	
}