$(function(){
    $('#backgroundInfoLink').html($('.pCont .0').html());
				
	$('ul.homeGalNav li a').each(function(num){
		$(this).mouseover(function(){
			
			$('ul.homeGalNav li').each(function(){  
			    $(this).removeClass('highlighted');
			});
			
			if(this.className == 'active' || this.className == null || this.className == '' || this.className == 'last'){
				var thisHref = $(this).parent().children('span').text();
								
				$('#backgroundInfoLink').html($('.pCont .' + num).html());
				$(this).parent().addClass('highlighted');
				addHref($(this).attr("href"));
				slideTo(num, thisHref);
			}
			
			return false;
		});
	});
});
function addHref(href)
{
    $('.homeGalImgContainer a').attr({href:href});
}
function slideTo(passedNum, passedHref){
	$('ul.homeGalNav li a.inActive').removeClass('on');
	showImage(passedNum, passedHref);
}
function showImage(passedNum, passedHref){
	$('.homeGalImgContainer img').attr({src:passedHref});
	$('ul.homeGalNav li a.inActive').each(function(){
		$(this).removeClass('inActive').removeClass('active');
		backgroundInfo(passedNum);
	});
}
function backgroundInfo(passedNum){
	$('.pCont div').each(function(pNum){
		if(this.className == passedNum){
			$(this).prependTo('.pCont');
		}
		$('.homeGalBackgroundInfo').next().show();
	});
}