$(document).ready(function() {

	var totalHeight = $('#header').height();
	totalHeight += $('#home-content').height();

	resize(totalHeight);

	//PEPS.rollover.init();
	
	$("ul.sf-menu").superfish();
	
	$(".ro").mouseover(function(){
		imgsrc = $(this).attr("src");
//		matches = imgsrc.match(/_r/);
//		if (!matches) {
			imgsrcON = imgsrc.replace(/.png$/ig,"_r.png");
			$(this).attr("src", imgsrcON);
//		}
	});
	
	$(".ro").mouseout(function(){
		$(this).attr("src", imgsrc);
	});
	
	$(function() {
		$('.rollover').hover(function() {
			var currentImg = $(this).attr('src');
			$(this).attr('src', $(this).attr('hover'));
			$(this).attr('hover', currentImg);
		}, function() {
			var currentImg = $(this).attr('src');
			$(this).attr('src', $(this).attr('hover'));
			$(this).attr('hover', currentImg);
		});
	});
	
	$('.peopleNav').hover(function() {
		var className = $(this).attr('id');
		var origClassName = $('#imageSelected').children('img').attr('class');
		$('.peopleImage').children('.'+origClassName).hide();
		$('.peopleImage').children('.'+className).show();
		}, 
	    function () {
	    var className = $(this).attr('id');
	    var origClassName = $('#imageSelected').children('img').attr('class');
	    $('.peopleImage').children('.'+className).hide();
	    $('.peopleImage').children('.'+origClassName).show();
	});
	
	$('.peopleNavMain').hover(function() {
		var className = $(this).attr('id');
		//var origClassName = $('#imageSelected').children('img').attr('class');
		//$('.peopleImage').children('.'+origClassName).hide();
		$('.peopleImageItem').hide();
		$('.peopleImage').children('.'+className).show();
		}, 
	    function () {
//	    var className = $(this).attr('id');
//	    var origClassName = $('#imageSelected').children('img').attr('class');
//	    $('.peopleImage').children('.'+className).hide();
//	    $('.peopleImage').children('.'+origClassName).show();
	});
});

//PEPS = {};
//
//PEPS.rollover =
//{
//   init: function()
//   {
//      this.preload();
//     
//      $(".ro").hover(
//         function () { $(this).attr( 'src', PEPS.rollover.newimage($(this).attr('src')) ); },
//         function () { $(this).attr( 'src', PEPS.rollover.oldimage($(this).attr('src')) ); }
//      );
//   },
//
//   preload: function()
//   {
//      $(window).bind('load', function() {
//         $('.ro').each( function( key, elm ) { $('<img>').attr( 'src', PEPS.rollover.newimage( $(this).attr('src') ) ); });
//      });
//   },
//   
//   newimage: function( src )
//   {
//      return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + '_r' + src.match(/(\.[a-z]+)$/)[0];
//   },
//
//   oldimage: function( src )
//   {
//      return src.replace(/_r\./, '.');
//   }
//};
         
         
function resize(height) {
	$('#homepage').css({'height' : height});	
}