jQuery.preloadImages = function(images) {
	for ( var i = 0; i < images.length; i++) {
		jQuery("<img>").attr("src", images[i]);
	}
}


$(function() {

	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});

		  //todays date + 60
		  var textDate=Date.parse('today').add(60).days().toString("MMMM d, yyyy");
		  $('#date-60').empty().html(textDate);	
	

		 // hides the slickbox as soon as the DOM is ready
		  $('#popup1', 'popup2', 'popupinfo').hide();
		 // shows the slickbox on clicking the noted link
		  $('#popup1-show').click(function() {
		 $('#popup1').show('slow');
		 return false;
		  });
		  
		 $('#popup2-show').click(function() {
		 $('#popup2').show('slow');
		 return false;
		  });
		 
		 $('#popupinfo-show').click(function() {
		 $('#popupinfo').show('slow');
		 return false;
		  });
		  
		  // hides the slickbox on clicking the noted link
		 $('#popup1-hide').click(function() {
		 $('#popup1').hide('fast');
		 return false;
		  });
		  
		 $('#popup2-hide').click(function() {
		 $('#popup2').hide('fast');
		 return false;
		  });
		 
		  $('#popupinfo-hide').click(function() {
		 $('#popupinfo').hide('fast');
		 return false;
		  });
  
 
   var path = location.pathname.substring(1);
   if(path){
	// Find the link in the left nav whose href matches the url passed and add the named class
	thislink = $('.leftnav_content a[href$="' + path + '"]')
	thislink.addClass('selected');
	parentObj = thislink.parent().parent();
	parentObj.find('li.primarylink a').addClass('selected');
   }
   
   


	$('img#nav1').hover(function() {
		$(this).attr("src","/images/btn-login-roll.png");
			}, function() {
		$(this).attr("src","/images/btn-login.png");
	});
	
	$('img#nav2').hover(function() {
		$(this).attr("src","/images/btn-contactgrants-roll.png");
			}, function() {
		$(this).attr("src","/images/btn-contactgrants.png");
	});


   
   
   
 });


