// marry 'find us on' with 'facebook' button
$(document).ready(function() {
	$('li.fb-btn a').hover(
		function() {
			$('#main-nav a.fb-txt').css('border-bottom','1px solid #FFF');
			$('#sub-footer a.fb-txt').css('border-bottom','1px solid #4d4c4c');
			$('a.fb-btn span').css('background-position','0 -26px');
		},
		function() {
			$('a.fb-btn span').css('background-position','0 0');
			$('a.fb-txt').css('border-bottom','0');
		}
	);
	
	$('.autotab').keydown(function(event) {
		//save previously entered value prior to keyup event
		$(this).attr('prevValue', $(this).val());
	});
	 
	$('.autotab').keyup(function(event) {
		var newValue = $(this).val();
		//see if the textbox had its value changed
		if ($(this).attr('prevValue') != newValue) {
			//see if the number of entered characters is equal or greater
			//than the allowable maxlength
			if (newValue.length == $(this).attr('maxlength')) {
				//set focus on the next field with autotab class
				$(this).next('.autotab').focus();
			}
			//save newly entered value for the next execution of this event
			$(this).attr('prevValue', newValue)
		}
	});
	
	$('.fancyYouTube').click(function() {			
		$.fancybox({
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'href'			: this.href,
			'width'			: 640,
			'height'		: 360,
			'padding' 		: 0,
			'type'			: 'swf',
			'swf'			: {
				'wmode'				: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});
		return false;
	});
});
