// JavaScript Document
jQuery(document).ready(function() {
	
	jQuery('.socialpress-button').bind("mouseover", function(){
		
		// Hovered link
		var hover_link = jQuery(this);
		
		if(hover_link.hasClass("effect-fade")){
			hover_link.siblings().stop().animate({"opacity": 0.2}, 500);
		}else if(hover_link.hasClass("effect-hover")){
			var image =  hover_link.find("img");
			src = image.attr("src").replace(/\.(gif|jpg|png)/, "_hover.$1");
			image.attr("src", src);
		}
	});
	
	jQuery('.socialpress-button').bind("mouseout", function(){
		
		// Hovered link
		var hover_link = jQuery(this);
		
		if(hover_link.hasClass("effect-fade")){
			hover_link.siblings().stop().animate({"opacity": 1}, 500);
		}else if(hover_link.hasClass("effect-hover")){
			var image =  hover_link.find("img");
			src = image.attr("src").replace("_hover.", ".");
			image.attr("src", src);
		}
	});
	
	/**
	 * Handles toggoling of menus
	 */
	jQuery('.toggle-buttton').bind('click', function() {
		var content = jQuery(this).parent().next();
		var button = jQuery(this);
		if(content.is(':visible')){
			content.animate({
				opacity: 0,
				height: 'toggle'
				}, 500, 'swing');
			button.html("+");	
		}else{
			content.animate({
				opacity: 1,
				height: 'toggle'
				}, 500, 'swing');
			button.html("-");							  
		}
	});
	
});

function socialpress_confirm_delete(url){
	if(confirm("Are you sure you want to delete this item?")){
		window.location = url;	
	}
}