$(document).ready(function(){

	$('#nav').superfish({
		dropShadows: false,
		onInit: function(){
			$('li:has(ul)>a:first-child span.sf-sub-indicator',this).each(function(key, a) {
				var $a = $(a);
				$a.html($.trim($a.html()));
			});
		}
	});
	
	if (window.location == 'http://www.sierrasraceagainstmeningitis.com/') {
		$('#cycle') 
			.after('<div id="cycle-nav" class="clearfix">') 
			.cycle({ 
				timeout: 6000, 
				pager: '#cycle-nav' 
		});
	}
	
	$("#tabs").tabs();
	
	$('a.fancybox').fancybox();

//	$('dl.gallery-item a').attr('rel','gallery');
//	$('dl.gallery-item a[rel="gallery"]').fancybox();

//	$('#input_1_1').watermark('Full Name');

//	$('#movie').flash({
//		swf: '/wp-content/themes/bb/video/slider.swf',
//		width: 600,
//		height: 200,
//		wmode: 'transparent',
//		flashvars: {
//
//		}
//	});

	$("#registerForm").validate({
    invalidHandler: function(form, validator) {
      var errors = validator.numberOfInvalids();
      if (errors) {
        var message = errors == 1
          ? 'You missed 1 field. It has been highlighted in red'
          : 'You missed ' + errors + ' fields. They have been highlighted';
        $("div.error span").html(message);
        $("div.error").show();
      } else {
        $("div.error").hide();
      }
    }		
	});

	$('a.top').click(function(){
	     $('html, body').animate({scrollTop: '0px'}, 300);
	     return false;
	});

	$("#recent-posts li:last-child").addClass("last");	
	
});
