/* striping plugin by Joel Birch */
$.fn.stripeAnything = function(){
	return this.each(function(){
		var children = $(this).find('>*');
		children.filter(':nth-child(odd)').addClass('alt');
		children.filter(':nth-child(even)').addClass('even');
	});
};
$(document).ready(function() {

	// Product Hovers
	$('.productcontainer p a').hover(function () {
		$(this).find('span').css({'background-color' : 'black'}).stop().animate( {'bottom': '-1'}, 'fast');	//set to -1 to fix IE6 issue
    }, function () {
		$(this).find('span').css({'background-color' : 'transparent'}).stop().animate( {'bottom': '-18'}, 'fast');	// hides last line of text
	});
	
	// Local Scroll
	function filterPath(string) {
		return string
			.replace(/^\//,'')  
			.replace(/(index|default).[a-zA-Z]{3,4}$/,'')  
			.replace(/\/$/,'');
		}
		$('a[href*=#]').each(function() {
			if ( filterPath(location.pathname) == filterPath(this.pathname)
			&& location.hostname == this.hostname
			&& this.hash.replace(/#/,'') ) {
			var $targetId = $(this.hash), $targetAnchor = $('[name=' + this.hash.slice(1) +']');
			var $target = $targetId.length ? $targetId : $targetAnchor.length ? $targetAnchor : false;
			if ($target) {
				var targetOffset = $target.offset().top;
				$(this).click(function() {
					$('html, body').animate({scrollTop: targetOffset}, 400);
					return false;
				});
			}
		}
	});
	
	// Open links in a new window if rel is set to external
	$('a[rel="external"]').click( function() { window.open( $(this).attr('href') ); return false; });
	
	// Set height of central column if smaller than 500px...
	//	if($('#copy').height() < 500){ $('#copy').height(500); }
	
});