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

$(document).ready(function() { 
	$('ul.navMain').superfish({ 
	    delay: 500,                                     // one second delay on mouseout
	    animation: {opacity:'show',height:'show'},      // fade-in and slide-down animation
	    speed: 'fast',                                  // faster animation speed
	    autoArrows: false,                              // disable generation of arrow mark-up
	    dropShadows: false                              // disable drop shadows
	}); 

	$(".find_team").colorbox({width:"600px", height:"85%", initialWidth:100, initialHeight:100, iframe:true, href:'/modal/find_team'
	});

	$(".find_team_button").colorbox({width:"600px", height:"85%", initialWidth:100, initialHeight:100, iframe:true, href:'/modal/find_team'
	});
	
	$(".forward").colorbox({width:"800px", height:"85%", initialWidth:100, initialHeight:100, iframe:true
	});

	$(".tell_a_friend").colorbox({width:"800px", height:"85%", initialWidth:100, initialHeight:100, iframe:true
	});

	$(".become_a_friend").colorbox({width:"800px", height:"85%", initialWidth:100, initialHeight:100, iframe:true
	});

	$(".dollarAmt").click(function() {
            $("#amount").val($("#dollarAmt").val());
        });
	$(".donateToggle").click(function(){
            if($(this).attr("rel")) { $("#amount").val($(this).attr("rel")); }
            $("#expandingForm").slideToggle("fast", function() { $("#donationPackages").hide(); });
            $(this).toggleClass("active"); return false;
	});
	$(".donationPackages a").hoverIntent(function() {
			$(this).next("span").animate({opacity: "show", top: "-105px"}, "slow");
			}, function() {
			$(this).next("span").animate({opacity: "hide", top: "-116px"}, "normal");
	});
	
	$(".question:first").addClass("active");
	$(".answer:not(:first)").hide();

		
	$(".question").click(function(){
		$(this).next(".answer").slideFadeToggle("normal");
		$(this).toggleClass("active");
	});

}); 

function mirror_to_url(source_id, dest_id)
{
	var nonAlphaNum=/[^0-9,a-z,A-Z]/gi;
	var source_text = document.getElementById(source_id).value;
	var dest_text = document.getElementById(dest_id).value;
	var cleaned_text = source_text.toLowerCase();
	cleaned_text=cleaned_text.replace(nonAlphaNum, "_");
	if(dest_text == cleaned_text.substring(0,dest_text.length))
	{
		document.getElementById(dest_id).value = cleaned_text;
	}
}