jQuery.fn.fadeToggle = function(speed, easing, callback) {
  return this.animate({opacity: 'toggle'}, speed, easing, callback);  
};


$(document).ready(function() {	

	$("img.rollover").hover(
				function()
					{
						this.src = this.src.replace("_off","_on");
					},
				function()
					{
						this.src = this.src.replace("_on","_off");
					}
					);

	$('li.headlink').hover(
		function() { $('ul', this).css('display', 'block');},
		function() { $('ul', this).css('display', 'none'); });
		
		
	$('div.clickable').bind('click', function() {
		window.location = $(this).attr("href");
		return false;
	});

	$('.stop_click').click(function(event){ event.stopPropagation(); });
	
	
	$('#submit_button').click(function() {
		$('#submit_button').hide();
		$('.loader').show();
	});


});


jQuery.ajaxSetup({ 
  'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
});

jQuery.fn.submitWithAjax = function() {
  this.submit(function() {
    $.post(this.action, $(this).serialize(), null, "script");
    return false;
  })
  return this;
};

$(document).ready(function() {
  $("#new_favorite").submitWithAjax();
  $("#join_campaign").submitWithAjax();
  $('.button-to').submitWithAjax();
  $("#gift_tabs").tabs();


})
