if (typeof(CA) == 'undefined') CA = {};

CA.FormPlaceholder = $.klass({
	initialize: function(field) {
		if (!field) return false;

		var original_value = field.val();

		field.focus(function() {
			if (this.value == original_value) this.value = '';
			$(this).addClass('selected');
		});

		field.blur(function() {
			if (this.value == '') this.value = original_value;
			$(this).removeClass('selected');
		});
	}
}); // CA.FormPlaceholder


$(document).ready(function() {
  if ( window.isIE7 || window.isIE6 ) {
  } else {
  	// nav drop downs
  	$('#nav ul:first').superfish({ 
  		hoverClass: 'hover',
  		delay: 550,
  		animation: {opacity:'show', height:'show'}, 
  		speed: 'fast',
  		disableHI: true,
  		autoArrows: false
  	});      
  }

	if ( $('body').hasClass('about') ) {
		if ( window.isIE6 ) {
			var featuredimageFx = 'fade';
		}
		else {
			var featuredimageFx = 'shuffle';		
		}
		$('#featuredimage img:first').addClass('first');
		$('#featuredimage').cycle({
			fx: featuredimageFx,
			timeout: 0,
			next: '#next',
			prev: '#previous'
		});
	} else if ( $('body').hasClass('riders') && $('body').hasClass('single') ) {
		// temp: remove post thumbnail
		$('#ridergallery ul').find('li:first').remove();
		// temp: remove hero image
		$('#ridergallery ul').find('li:first').remove();
		// add remaining images to gallery
		$('#ridergallery a')
			.attr('rel', 'gallery')
			.removeAttr('title');

		$('#ridergallery a').fancybox({
			overlayShow:true,
			overlayOpacity:.7,
			overlayColor:'#000',
			padding:0,
			hideOnContentClick:false
		});
	} else if ( $('body').hasClass('products') ) {
    $('#productslist li:odd').addClass('alt');

    $('#productslist a').fancybox({
			overlayShow:true,
			overlayOpacity:.7,
			overlayColor:'#000',
			padding:10,
			hideOnContentClick:false
		});
	}
	new CA.FormPlaceholder($('#searchinput'));
	new CA.FormPlaceholder($('#email'));
}); // document.ready

Cufon.replace('#content h2', { hover:true });
Cufon.replace('#content .posttitle h3');
Cufon.replace('#comments h3');
Cufon.replace('#sidebar h3');
Cufon.replace('#herotitle h2');
Cufon.replace('#team span.name');