$(document).ready(function() {
	
	//Función random
	function IsNumeric(n) {
		return !isNaN(n);
	} 
	var numLow = 1 ;
	var numHigh =  3 ;
	var adjustedHigh = (parseFloat(numHigh) - parseFloat(numLow)) + 1;
	var numRand = Math.floor(Math.random()*adjustedHigh) + parseFloat(numLow);
	if ((IsNumeric(numLow)) && (IsNumeric(numHigh)) && (parseFloat(numLow) <= parseFloat(numHigh)) && (numLow != '') && (numHigh != '')) {
		$("#wlcm").attr({src: "images/welcome/wellcome_0"+numRand+".png"});
	} else {
		$("#wlcm").attr({src: "images/welcome/wellcome_01.png" });
	};
	
	//animación del index
	$('#delorean').css({'margin-left':'60px'});
	
	$('#wellcome img').load(function(){
		setTimeout(function(){
		$('#wellcome').fadeIn(1000,
			function() {
				$('nav').animate({
					opacity:'show',
					paddingLeft: '+=10px',
				}, 'normal',
					function() {
						$('#delorean').animate({
							opacity:'show',
							marginRight: '+=60px'
						}, 'slow','easeOutElastic',
							function() {
								$('#html5').animate({
									opacity:'show',
									paddingTop: '+=30px'
								}, 'normal');
							});
					});
			});
		}, 600);
	});
		
	//hover de los botones del index
	$('nav li a').hover(function() {
		$(this).animate({
			paddingLeft: '+=10px'}, 200);
	}, function() {
		$(this).animate({
			paddingLeft: '-=10px'}, 600, 'easeOutBounce');
	});
	
	//tooltip delorean
	$('#delorean img').hover(
		function(){
			$('#card').animate({
				opacity:'show',
				marginTop:'-100px'
			},'slow');

		},function(){
			$('#card').animate({
				opacity:'hide',
				marginTop:'-90px'
			},'slow');
		}
	);
	
});

/* Random original
function IsNumeric(n){
    return !isNaN(n);
} 
$(function(){
    $("#getit").click(function() {
        var numLow = $("#lownumber").val();
        var numHigh = $("#highnumber").val();
        var adjustedHigh = (parseFloat(numHigh) - parseFloat(numLow)) + 1;
        var numRand = Math.floor(Math.random()*adjustedHigh) + parseFloat(numLow);
        if ((IsNumeric(numLow)) && (IsNumeric(numHigh)) && (parseFloat(numLow) <= parseFloat(numHigh)) && (numLow != '') && (numHigh != '')) {
            $("#randomnumber").text(numRand);
        } else {
            $("#randomnumber").text("Careful now...");
        }
        return false;
    });
    $("input[type=text]").each(function(){
        $(this).data("first-click", true);
    });
    $("input[type=text]").focus(function(){
        if ($(this).data("first-click")) {
            $(this).val("");
            $(this).data("first-click", false);
            $(this).css("color", "black");
        }
    });
}); */
