//background cycle
$(function() {
	$('#head-flasher').cycle({ timeout: 0, next: 'img.logo:hover', speed: 250 });
}); 
//random featured profiles
$(function() {
 var randomNum = Math.floor(Math.random()*2);
$('div#featured-profile div.profile:eq(' + randomNum + ')').css("display", "block");
});
//sidebar tab toggler
$(document).ready(function(){
	 $(".hide").hide();
	 $("a.toggle").click(function(event){
	 $(this).parents(".panel").find(".hide").toggle("fast");
	 $(this).parents(".panel").find("ul,div").removeClass("hide");
	 $(this).parents(".panel-group").find(".hide").hide("fast");
	 $(this).parents(".panel").find("ul,div").addClass("hide");
	 return false;
	});
}); 
//comment toggler
$(document).ready(function(){
	 $(".comment-content").hide();
	 $("a.comment-toggle").click(function(event){
	 $(this).parents(".commentlist").find(".comment-content").toggle("fast");
	 return false;
	});
}); 
//head flasher
$(function() {
	$('body').mouseenter(function(){ $('#head-flasher').cycle('pause'); return false; });
	$('img.logo').mouseover(function() { $('#head-flasher').cycle('resume'); return false; });
	$('img.logo').mouseout(function() { $('#head-flasher').cycle('pause'); return false; });

	$('#head-flasher').cycle({
		fx: 'fade',
		speed: 1,
		timeout: .1,
	});
});
//Anchor Slider by Cedric Dugas http://www.position-absolute.com
$(document).ready(function() {
	$("a.anchorLink").anchorAnimate()
});

jQuery.fn.anchorAnimate = function(settings) {

 	settings = jQuery.extend({
		speed : 400
	}, settings);	
	
	return this.each(function(){
		var caller = this
		$(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = $(caller).attr("href")
			
			var destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
				window.location.hash = elementClick
			});
		  	return false;
		})
	})
}