jQuery.extend({
	random: function(X) {
	    return Math.floor(X * (Math.random() % 1));
	},
	randomBetween: function(MinV, MaxV) {
	  return MinV + jQuery.random(MaxV - MinV + 1);
	}
});

//$.random(int); entre 0 y un valor
//$.randomBetween(minValue, maxValue); entre 2 valores

var random = $.random(17); /*numero de mosaicos*/
var timer;

function ramdomize(){
		clearTimeout(timer);
		jQuery(".item_" + random).stop().fadeTo(500, 0.0);
		random = $.random(17);
		jQuery(".item_" + random).stop().fadeTo(500, 0.8);
		timer = window.setTimeout('ramdomize()', 3000);
}

jQuery(document).ready(function(){

	ramdomize();	

	jQuery(".mosaico-container-text").css("opacity", 0.0)
	jQuery(".mosaico-container-text").css("backgroundColor", '#000')
	
	jQuery(".mosaico-container-text").hover(function(){
		
		jQuery(this).stop().fadeTo(400, 0.8);
		},function(){
		jQuery(this).stop().fadeTo(400, 0.0);
		}
	);

	clicks=0;
	jQuery('#idSearch').focus(function(){
		jQuery(this).css("background-color", 'rgba(255, 255, 255, 0.6)');
		jQuery(this).css("color", 'black');
	}).blur(function(){
		jQuery(this).css("background-color", 'rgba(255, 255, 255, 0.1)');
		jQuery(this).css("color", 'white');});
	
	jQuery('.ico_comentar').click(function(){
		if(clicks==0){
			jQuery('.nuevo_comentario').stop().animate({
						 	'height': "300px"
						  },500); 
							clicks=1;
							}
							
		else if(clicks==1){
			jQuery('.nuevo_comentario').stop().animate({
						 	'height': "0px"
						  },0); 
							clicks=0;
							}
	})
	jQuery('.transparente').css("opacity", 0.9)		
	jQuery(".transparente").hover(function(){
		
		jQuery('.transparente').stop().fadeTo(400, 0.6);
		jQuery(this).stop().fadeTo(400, 1.0);
		},function(){
		jQuery('.transparente').stop().fadeTo(400, 0.9);
		}
	);
});

/*
$(window).resize(function() {
	fondo();
});

function fondo(){
	if (window.innerWidth > 1024){
	}
}
*/
