$(document).ready(function() {
	$('.cabecera').click(function(){
		console.log('click')
	})
	$('.less').hide();
	$("li.selected").corner();	
	$('.destacado .info').children().not(":first").hide();
	$('.pics').cycle({fx:     'scrollHorz', 
	    prev:   '#prev', 
	    next:   '#next',
	    timeout: 4000,
	    speed:2000,	    	        
	    before:function(currSlideElement, nextSlideElement, options, forwardFlag){	    	
	    	nameId = $(nextSlideElement).attr('name');
	    	$('.destacado .info').children().hide();
	    	$('#info-'+nameId).fadeIn("slow");
	    } 
    });
    
    $(".pics").corner();
    $("#map_canvas").corner();    
    $('.weare span').each(function(){    	
    	var ttip = $(this).data('tooltip');
    	$(this).tooltip({
	    	track: true,
	    	fixPNG: true,
	    	delay: 0,
			showURL: false,				
			extraClass: ttip,			
			top: -125,
			left: -60			
	    }).hover(function() {
	        id = $(this).attr('id');
	        idr = id.split("-");
	        id = idr[1]
	        $('#show-'+id).hide();
	        $('#hide-'+id).show();
	        //$(this).css('color', $(this).data('color'));
	        Cufon.replace('.cuentas .body,.cuentas h3,.arte .body,.arte h3,.social .body,.social h3,.tecnologia .body,.tecnologia h3,.produccion .body,.produccion h3',{ fontFamily: 'helvetica_neue' });
	        
	    }, function() {
	        //$(this).css('color', "#000");
	        $('#show-'+id).show();
	        $('#hide-'+id).hide();
	        
	    });
    });    
    $('a[id^="button-"]').click(function () {
      id = $(this).attr('id');      
      id = id.split("-");      
      id = id[1];
      showPost(id);
      
    })
    $('a[id^="close-button-"]').click(function () {
      id = $(this).attr('id');      
      id = id.split("-");      
      id = id[2];
      hidePost(id);      
    })
    
    $('.gif').hover(function(){    	
    	gif = $(this).data('ani');    	
    	src = $(this).attr('src');    	    	
    	$(this).attr('src',gif);
    },function(){
    	$(this).attr('src',src);
    })
});
function showPost(id){
	$('#post-'+id).show('fast');
    $('#button-'+id).parent().hide();
    $('#close-button-'+id).parent().show();
}
function hidePost(id){
	$('#post-'+id).hide('fast');
    $('#close-button-'+id).parent().hide();
    $('#button-'+id).parent().show();
}
Cufon.replace('.cabecera ul.menu  li a,.posts .post .post-info .title a,.somos .intro2,.posts .post .post-content .more a, .posts .post .post-content .less a,.encuentranos .post .lado .title,.footer .titulo,.destacado .info .content .titulo,.sidebar h3 ',{ fontFamily: 'helvetica_neue' });
Cufon.replace('.posts .post .post-info .client,.sidebar .servicios .title span,.sidebar .servicios .description,.footer .enlaces ul li a,.clientes .lado ul li span,.posts .post .post-content .contenido,.destacado .info .content .logo',{ fontFamily: 'helvetica_neue_roman' });
Cufon.replace('.posts .post .post-content .descripcion,.encuentranos .post .lado .descripcion',{fontFamily: 'bodomi_mt' });
Cufon.replace('.somos .weare span',{ fontFamily: 'helvetica_neue_nc'});
Cufon.replace('.somos .intro',{ fontFamily: 'garamond'});


