/* 
  Author: Lucas Mourelle
*/

// variables:
var botoneras_ocultas = false;

// on ready:
$(document).ready(function(){

	// on scroll:
	$(window).scroll(function(){
		// if user scrolls down (and windows is wide):
		if( ($(window).scrollTop() > 200) && ($(window).width() >= 768) ){
			// if navigation is not hidden:
			if(botoneras_ocultas == false){
				//console.log("go ahead and HIDE it");
				// go ahead and hide it:
				botoneras_ocultas = true;
				//$("#header").css({backgroundColor:"transparent"});
				$("#header").addClass("hidden-back");
				if($("html").width() >= 1000){
					//$("#sidebar").css({backgroundColor:"transparent"});
					$("#sidebar").addClass("hidden-back");
				}
			}
		} else {
			// if user is on top of the page,
			// and if navigation is hidden:
			if(botoneras_ocultas == true){
				//console.log("go ahead and make it VISIBLE");
				// go ahead and make it visible:
				botoneras_ocultas = false;
				//$("#header").css({backgroundColor:"#1d1d1d"});
				$("#header").removeClass("hidden-back");
				//$("#sidebar").css({backgroundColor:"#00C291"});
				$("#sidebar").removeClass("hidden-back");
			}
		}
	}); // end scroll.
	
	// check small images:
	$('div.entry-content p[class!="contenedor-img-small"] > img').parent().addClass("contenedor-img-small");
	$('div.entry-content p[class!="contenedor-img-small"] > a > img').parent().parent().addClass("contenedor-img-small");
	
}); // end ready.
