Cufon.replace('.headline, .billboardHeadline', { fontFamily: 'alfalfa' });
Cufon.replace('#billboardMessage h1, #billboardMessage p, #featuredQuote p, #content h1, #fullCol h1, #pageNotFound h1, #colA h1, h2, h3, h4, .view, .grid th, .more-link, #footer p, #footer li, .cta, .cta2', { fontFamily: 'gotham', hover: true });
jQuery('.headline, .billboardHeadline, #billboardMessage h1, #billboardMessage p, h1, h2, h3, h4, .view, .grid th, .more-link, #footer p, #footer li, .cta, .cta2').css('visibility','visible');

Cufon.replace('h1.itk_headline', { fontFamily: 'Gotham2', hover: true });

jQuery("a[rel='external']").attr("target","_blank");

// back to top scroll function. Any link with a hash () will scroll to that id on the page
/*
//This version breaks parameterized urls in IE
$('a[href*=]').click(function() {
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
		var $target = $(this.hash);
		$target = $target.length && $target
		|| $('[name=' + this.hash.slice(1) +']');
		if ($target.length) {
		var targetOffset = $target.offset().top;
		$('html,body')
		.animate({scrollTop: targetOffset}, 500);
		return false;
		}
	}
});
*/
$(document).ready(function() {
		$('a[href=#top]').click(function(){
		$('html, body').animate({scrollTop:0}, 'slow');
		return false;
	});
});
$(document).ready(function() {
	$("a.scroll").anchorAnimate();
});

jQuery.fn.anchorAnimate = function(settings) {

 	settings = jQuery.extend({
		speed : 500
	}, settings);	
	
	return this.each(function(){
		var caller = this
		$(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = $(caller).attr("href")
			
			var destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
				window.location.hash = elementClick
			});
		  	return false;
		})
	})
}

jQuery("form").validate({
  rules: {
    confirmEmail: {
      equalTo: "#email"
    }
  }
});

jQuery('img.imgBW').mouseover(function() {
	jQuery(this).fadeOut('slow');
	jQuery(this).next().fadeIn('slow'); // the next sibling should be .imgColor
});

jQuery('img.imgColor').mouseout(function() {
	jQuery(this).fadeOut('slow');
	jQuery(this).prev().fadeIn('slow'); // the previous sibling should be .imgBW
});


Cufon.now();
