// Fechas
function fechas() {
	$('.datetime').each(function() {
		var fecha = jQuery.timeago( $(this).attr('datetime') );
		$(this).text( fecha );
	});
	setTimeout(function () { fechas(); }, 6000);
};

jQuery(function ($) {

	// Formatear las fechas
	fechas();

	// Blur en formularios
	$("input.blur").focus(function () {
		if( this.value == this.defaultValue ) { this.value = ""; }
	}).blur(function() {
		if( !this.value.length ) { this.value = this.defaultValue; }
	});
	
	// Destacados
	$('.destacados').cycle({delay:  2000, speed:  500, pause: 1});
	
	$( 'div.youtube-embed' ).each( function() {
		var video_id = $( this ).text();
		$( this ).text( '' );
		$( '<div/>' ).appendTo( this ).attr( { id : 'youtube-' + video_id } );
		swfobject.embedSWF( "http://www.youtube.com/v/" + video_id + "&enablejsapi=1&playerapiid=player1&rel=0",
                       'youtube-' + video_id, "210", "158", "8", null, null, {}, {} );
	} );
});

