$(function() {
	Cufon.replace('#nav ul li a',{hover:true});
	Cufon.replace('.reemplazar',{hover:true});
	
	if($('#slider').length){
		$('#slide-promo').carousel('#prev', '#next');
		
		//Funcion para el autoscroll
		function slide(){
			$('#next').click();
		}
		//Ejecuta el scroll cada X segundos
		var intervalId = window.setInterval(slide, 5000);
	}
	
	
	
	if($('a[rel=facebox],area[rel=facebox]').length){
		$('a[rel=facebox]').facebox();
		$('area[rel=facebox]').click(function(){
			$.facebox({ajax: $(this).attr('href')});
			return false;
		});
	}	
	
	if($('#slider_content').length){
		$('#slider_content ul').cycle();
	}

	if($('select#opciones').length){
		$('select#opciones').msDropDown();
	}
	
	/*$("ul.noti-list li div.noticia-img").live('mouseover', function() {
		
		$(this).stop();
		$(this).parent().find('div.noticia-content').stop();
		$(this).find('img').stop();

		$(this).animate({width: '150px', height: '117px'});
		$(this).parent().find('div.noticia-content').animate({width: '140px'});
		$(this).find('img').animate({width: '150px', height: '117px'});

	});
	
	$("ul.noti-list li div.noticia-img").live('mouseout', function() {
		
		$(this).stop();
		$(this).parent().find('div.noticia-content').stop();
		$(this).find('img').stop();

		$(this).animate({width: '130px', height: '97px'});
		$(this).parent().find('div.noticia-content').animate({width: '160px'});
		$(this).find('img').animate({width: '130px', height: '97px'});

	});*/
	$("#noti ul li img").live('mouseover', function() {
		
		$(this).stop();
		$(this).parent().parent().find('div.contenedorli').stop();
		$(this).find('img').stop();

		$(this).animate({width: '150px', height: '117px'});
		$(this).parent().parent().find('div.contenedorli').animate({width: '121px'});
		$(this).find('img').animate({width: '150px', height: '117px'});

	});
	
	$("#noti ul li img").live('mouseout', function() {
		
		$(this).stop();
		$(this).parent().parent().find('div.contenedorli').stop();
		$(this).find('img').stop();

		$(this).animate({width: '120px', height: '97px'});
		$(this).parent().parent().find('div.contenedorli').animate({width: '153px'});
		$(this).find('img').animate({width: '130px', height: '97px'});

	});

});

/* Genera la url para la miniatura */
function thumb($img, $x, $y, $r){
	$x = $x || 0;
	$y = $y || 0;
	$r = $r || 0;
	$return = "foto.php?src="+$img+"&x="+$x+"&y="+$y+"&r="+$r;
	return $return;
}
