// JQUERY DOM READY
$(document).ready(function() {
	// ToggleVal entry from input labels
	$(".toggleval").toggleVal({ populateFrom: "label", removeLabels: true });
	
	// Team Photo Fading
	$('#contact ul li div').hide();
	$('#contact ul li').hoverIntent(
		function(){
			$(this).find('div').fadeIn();
		}, function(){
			$(this).find('div').fadeOut();
	});
	
	// Gallery Logic
	$('#gallery .arrow.right').bind('click', function(){
		if ($('#gallery #image .on').next().length > 0){
			thisClass = $('#gallery #image .on').next();
			$('#gallery #image li').removeClass('on');
			thisClass.addClass('on');
			$('#gallery #image').stop(true, true).animate({left:	'-=449' }, 1000);
		}
		return false;
	});
	$('#gallery .arrow.left').bind('click', function(){
		if ($('#gallery #image .on').prev().length > 0){
			thisClass = $('#gallery #image .on').prev();
			$('#gallery #image li').removeClass('on');
			thisClass.addClass('on');
			$('#gallery #image').stop(true, true).animate({left:	'+=449' }, 1000);
		}
		return false;
	});
	$('#gallery area').bind('click', function(){
		substringed = $(this).attr('href').substr(1);
		leftScroll = (substringed * -449)+449;
		$('#gallery #image').fadeOut();
		$('#gallery #image').animate({left: leftScroll}, 1000, function(){ $('#gallery #image').fadeIn('slow') });
		$('#gallery #image li').removeClass('on');
		$('#gallery #image .' + substringed).addClass('on');
	});

});