// 
//  ssNav.js
//  
//  Created by Steve Stedman on 2009-02-28.
//  Copyright 2009 Stedman Design. All rights reserved.
// 

(function($){
    $.fn.extend({
		ssNav: function(targetBlock) {
			var navLinks = $('> li > a', $(this)),
				currentTab = null,
				animating = false;

			currentTab = ($.inArray(location.hash, $.map(navLinks, function(n) {return n.hash;})) > -1) ? location.hash : navLinks[0].hash;
			
			// highlight initial tab
			$('a[href$=' + currentTab + ']', $(this)).parent('li').addClass('here');

			// hide all but the current element
			$('> div:not(' + currentTab + ')', '#' + targetBlock).hide();
			
			// do something when nav links are clicked
			return $(this).bind('click', function(e) {
				// don't try anything if already animating
				if (animating) {
					return false;
				} else {
					animating = true;
				}

				var $target = $(e.target),
					newTab = $target[0].hash;
				
				// change tab highlight to current
				$('.here').removeAttr('class');
				$target.parent('li').addClass('here');
				
				// animate the content change
	            $(currentTab).fadeOut('fast', function(){
	                $(newTab).fadeIn('slow');
	                currentTab = newTab;
					animating = false; 
                });
                // return false;
			});
		}
    });
})(jQuery);


$(function(){
	$('#homepage #navList').ssNav('content');

	var imageDir = '/wp-content/themes/haft/images/';
	$('#tranz').crossSlide({
		sleep: 3, //in sec
		fade: 1.25   //in sec
	}, [
		{ src: imageDir + 'highwaysign2.jpg' },
		{ src: imageDir + 'bussign2.jpg' }
	]);
});
