/*
 *
 * Copyright (c) 2006 Sam Collett (http://www.texotela.co.uk)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 */

/* Hides and adds a nice slide effect to bookmark icons */
var servicios;
var enviar;
servicios=0;
enviar=0;
jQuery.fn.shareitBtn = function()
{
	return this.click(
		function(){
			var href = jQuery(this).attr('href');
			MostrarConsulta("vacio.html")
			if (href=="#comparte-servicios") {

				jQuery("#comparte-servicios").slideToggle(250);
				if (servicios==1) {servicios=0;}else {servicios=1;}
				if (enviar==1) {
					jQuery("#comparte-enviar").slideToggle(250);
					enviar=0;
				}
			}
			if (href=="#comparte-enviar") {
				jQuery("#comparte-enviar").slideToggle(250);
				if (enviar==1) {enviar=0;}else {enviar=1;}
				if (servicios==1) {
					jQuery("#comparte-servicios").slideToggle(250);
					servicios=0;
				}				
			}
			
			//return false;
		}
	);
}


/* Adds a tooltip effect to the icons */
jQuery.fn.shareitHover = function()
{
	return this.hover(
		function(){
			jQuery(this).find('img').each(function(){
				var alt = jQuery(this).attr('alt');
				var tip = jQuery(this).ancestors('.comparte').find('.tip');
				tip.html(alt);
			});
		},
		function(){
			var tip = jQuery(this).ancestors('.comparte').find('.tip');
			tip.html(tip.attr('title'));
		}
	);
}


/* Initialization. Hides all divs and starts the tooltip effect */
var shareitInit = function() {
	jQuery('.comparte').hide();
	jQuery('.tip').each(function(){
		jQuery(this).attr('title',jQuery(this).html());
	});	
	servicios=0;
enviar=0;
}


/* Start the script */
jQuery(document).ready(function(){
	shareitInit();
});
