function ofuscateMail(){

    var mails = $('a');
    var at = "[en]";
    var dot = "[punto]";
    mails.each(function(){
        var referencia = $(this).attr("href");
        if (referencia){
            var ref = referencia.split(":",1);
            if (ref == "mailto" ) {
                var addr = $(this).text().replace(at,"@").replace(dot,".");
                $(this).after('<a href="mailto:'+addr+'" title="'+ addr +'">'+ addr +'</a>');
                $(this).remove();

            }
        }
    });

}


$(document).ready(function() {
    // Substitución @ para los mails visibles.
    ofuscateMail();
	 // Fancybox
    var url = window.location;    
    var match = url.pathname.indexOf("_galeria");
    if (match != -1) { 
        var paco = new String(url.pathname.split("_galeria:"));        
        var content = paco.split(",");
        var number = content[1].split("/");
        var getrel = number[0];// id galery
        $('a.fancyBox').each(function(){
         if ($(this).attr('rel') == getrel) {
             $(this).fancybox({'overlayShow':true,frameWidth:1010,frameHeight:500, 'titleShow' : false}).trigger('click');   //abrir directamente
         }
        });       
        
    }

    $('a.fancyBox').fancybox({'width' : 1010, 'height' : 500, 'titleShow' : false});
	
    $('input[type="text"],textarea,input[type="password"]').focus(function() {
		$(this).addClass("focusField");
    }).blur(function() {
    	$(this).removeClass("focusField");
    });
	equalHeight($(".equalHeight_ul li"));
    equalHeight($(".equalHeight_div"));
});
function equalHeight(group) {
    var tallest = 0;
    group.each(function() {
        var thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}
