// JavaScript Document
function convertir_a_color_hexadecimal(red, green, blue) {
	
	var hexadecimal = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F") 
	
	function f_aux (color) {
		var hexaDec = Math.floor(color / 16)
		var hexaUni = color % 16;
		return hexadecimal[hexaDec] + hexadecimal[hexaUni] 
	}
	
	return f_aux(red) + f_aux(green) + f_aux(blue);
}

$(document).ready(function () {
	$.each( $(".h1"), function (i, h1) {
		var texto = $(h1).text();
		$(h1).after('<div class="h1_sombra"></div>');
		
		red_green_blue = 185;
		
		for (var n=0; n < 37; n++) {
			red_green_blue = (red_green_blue > 0) ? red_green_blue - 5 : 0;
			color = convertir_a_color_hexadecimal(red_green_blue, red_green_blue, red_green_blue);
			
			$(h1).next("div").append('<div><div style="margin-top:' + (n-45) + 'px; color: #' + color + '">' + texto + '</div></div>');
		}
	});
});
