// @group WIDGETS

// @group AMAIL
/*
 * jQuery aMail plug-in 1.0
 * (c) 2009 Max Ya  ( http://iHackWeb.com )
 * Inspired by epemail plugin/
 *
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
*/
$.fn.amail = function(sAt,sDot,sRepl){

    if (!sAt)
            sAt = '||';

    if (!sDot)
            sDot = '|';

    if (!sRepl)
            sRepl = 'NOSPAM';

    this.each(function() {
        el = $(this);
        mail = el.text().replace(sAt,'@').replace(sDot,'.').replace(sRepl,'');
        el.each(function(){
        el.attr('href','mailto:' + mail);
        if(el.attr('title')){
            el.html(el.attr('title'));
        }else{
            el.html(mail);
            }
        });
    });
};

$(function(){
	$('a.nospam').amail('[arroba]','[punto]');
});
// @end AMAIL
// @end WIDGETS



//>>> MAPAS
$(function(){
   
   var enlaceMapa = $("#toggle-google-map1"),
       divGoogleMaps = $("#google-map1");

   enlaceMapa.one('click', function(e){
      e.preventDefault();
      divGoogleMaps.html('<iframe src="'+ enlaceMapa.attr('href') +'"></iframe>')
      			   .show('fast');
      
      enlaceMapa.click(function(e){
          e.preventDefault();
          divGoogleMaps.slideToggle();
      });
   });
   
});
// <<< MAPAS



//>>> DRILLDOWN
$(function(){
   
   $(".drilldown").click(function(e){
       e.preventDefault();
       $(this).toggleClass('on');
   });
   
});
//<<< DRILLDOWN



//>>> PERFIL & AVISO LEGAL TOGGLE
$(function(){
   
   var aVerPerfil = $(".ver-perfil"),
       aToggleAvisoLegal = $("#toggle_aviso_legal"),
       aHideAvisoLegal = $("#hide_aviso_legal"),
       divAvisoLegal = $("#aviso_legal");
	
   aVerPerfil.click(function(e){
       e.preventDefault();
       $(this).parent().next().slideToggle();
   });
   
   aToggleAvisoLegal.click(function(e){
       e.preventDefault();
       aToggleAvisoLegal.toggleClass('animated-scroll');
       divAvisoLegal.slideToggle("fast", function(){
    	   aToggleAvisoLegal.trigger('click.scroll');
       });
   });
   
   aHideAvisoLegal.click(function(e){
       e.preventDefault();
       aToggleAvisoLegal.removeClass('animated-scroll');
       divAvisoLegal.slideUp();
   });
   
});
//<<< PERFIL & AVISO LEGAL TOGGLE




/*
 *  SCROLL ANIMADO
 *  Dependencias: jQuery
 *  Uso: Asignar clase 'animated-scroll' a enlaces que sean anclas
 *  ----------------------------------
 *  Túbal Martín @ margenn - mayo 2010
 *  Todos los derechos reservados   
 */

$(function(){var a=$(window),b=$(document);$(".animated-scroll").live("click.scroll",function(g){var f=this.hash,j=a.height(),d=b.height(),i=Math.ceil($(f).offset()["top"]),c,h;g.preventDefault();i=(i>(d-j))?(d-j):i;h=window.setInterval(function(){c=Math.ceil(a.scrollTop());if(c==i){window.location.hash=f;window.clearInterval(h);}else{if(c<i){c+=Math.ceil((i-c)/10);}else{c-=Math.ceil((c-i)/10);}window.scrollTo(0,c);}},10);});});


/*
 *  SCROLLABLE
 *  Dependencias: jQuery & jQuery tools
 *  ----------------------------------
 *  Túbal Martín @ margenn - mayo 2010  
 */

$(function(){$(".controls .prev, .controls .next").click(function(e){e.preventDefault();});var a=$("#galeria-trabajos").scrollable({keyboard:true,circular:true}).autoscroll({autoplay:true,autopause:true,interval:4000});var b=a.data("scrollable");$("#pause").toggle(function(c){c.preventDefault();$(this).removeClass("on");b.stop();},function(c){c.preventDefault();$(this).addClass("on");b.play();});});

