// Preload background image
var logo = new Image();
logo.src = "../images/d_defensa.jpg";
logo.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var one = new Image();
one.onload = displaySplash;
one.src = "../images/nro_home_01.jpg";
one.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var two = new Image();
two.onload = displaySplash;
two.src = "../images/nro_home_01.jpg";
two.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}


var three = new Image();
three.onload = displaySplash;
three.src = "../images/nro_home_03.jpg";
three.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}


var seven = new Image();
seven.onload = displaySplash;
seven.src = "../images/nro_home_07.jpg";
seven.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}


var four = new Image();
four.onload = displaySplash;
four.src = "../images/nro_home_04.jpg";
four.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}


var five = new Image();
five.onload = displaySplash;
five.src = "../images/nro_home_05.jpg";
five.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var six = new Image();
six.onload = displaySplash;
six.src = "../images/nro_home_06.jpg";
six.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}


var seven = new Image();
seven.onload = displaySplash;
seven.src = "../images/nro_home_07.jpg";
seven.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}


var eight = new Image();
eight.onload = displaySplash;
eight.src = "../images/nro_home_08.jpg";
eight.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var nine = new Image();
nine.onload = displaySplash;
nine.src = "../images/nro_home_09.jpg";
nine.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var ten = new Image();
ten.onload = displaySplash;
ten.src = "../images/nro_home_10.jpg";
ten.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var eleven = new Image();
eleven.onload = displaySplash;
eleven.src = "../images/nro_home_11.jpg";
eleven.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var twuelve = new Image();
twuelve.onload = displaySplash;
twuelve.src = "../images/nro_home_12.jpg";
twuelve.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var thirdteen = new Image();
thirdteen.onload = displaySplash;
thirdteen.src = "../images/nro_home_13.jpg";
thirdteen.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var fourteen = new Image();
fourteen.onload = displaySplash;
fourteen.src = "../images/nro_home_14.jpg";
fourteen.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var fifteen = new Image();
fifteen.onload = displaySplash;
fifteen.src = "../images/nro_home_15.jpg";
fifteen.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var sixteen = new Image();
sixteen.onload = displaySplash;
sixteen.src = "../images/nro_home_16.jpg";
sixteen.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var seventeen = new Image();
seventeen.onload = displaySplash;
seventeen.src = "../images/nro_home_16.jpg";
seventeen.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}


var eighteen = new Image();
eighteen.onload = displaySplash;
eighteen.src = "../images/nro_home_17.jpg";
eighteen.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var abajo = new Image();
abajo.onload = displaySplash;
abajo.src = "../images/frase_home_abajo.jpg";
abajo.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}

var arriba = new Image();
arriba.onload = displaySplash;
arriba.src = "../images/frase_home_arriba.jpg";
arriba.onerror = function() {
  alert("Error al cargar imagen: "+ this.src);
}


//
//	EVENT FUNCTIONS
//
function displaySplash() {
  // Numberos
  setTimeout(function() {
    $("#logo").fadeIn("slow");
  }, 200);

  setTimeout(function() {
    $("#logoHome").show();
  }, 240);

  setTimeout(function() {
    $("#logo").fadeOut("slow");
  }, 1000);

  // Unidades
  setTimeout(function() {
    $("#one").fadeIn("slow");
  }, 2000);

  setTimeout(function() {
    $("#three").fadeIn("slow");
  }, 2000);
  
  setTimeout(function() {
    $("#seven").fadeIn("slow");
  }, 2000);

  setTimeout(function() {
    $("#sixteen").fadeIn("slow");
  }, 2000);

  setTimeout(function() {
    $("#eighteen").fadeIn("slow");
  }, 2000);

  setTimeout(function() {
    $("#thirdteen").fadeIn("slow");
  }, 2000);

    setTimeout(function() {
    $("#two").fadeIn("slow");
  }, 3000);

  setTimeout(function() {
    $("#eight").fadeIn("slow");
  }, 3000);

  setTimeout(function() {
    $("#ten").fadeIn("slow");
  }, 3000);

  setTimeout(function() {
    $("#fifteen").fadeIn("slow");
  }, 3000);

      setTimeout(function() {
    $("#four").fadeIn("slow");
  }, 4000);

  setTimeout(function() {
    $("#five").fadeIn("slow");
  }, 4000);

  setTimeout(function() {
    $("#eleven").fadeIn("slow");
  }, 4000);

  setTimeout(function() {
    $("#seventeen").fadeIn("slow");
  }, 4000);

        setTimeout(function() {
    $("#six").fadeIn("slow");
  }, 5000);

  setTimeout(function() {
    $("#twuelve").fadeIn("slow");
  }, 5000);

  setTimeout(function() {
    $("#fourteen").fadeIn("slow");
  }, 5000);

  setTimeout(function() {
    $("#nine").fadeIn("slow");
  }, 5000);

    setTimeout(function() {
    $("#arriba").fadeIn("slow");
  }, 5500);

  setTimeout(function() {
    $("#abajo").fadeIn("slow");
  }, 5500);

  setTimeout(function() {
    $("#mainMenu").show();
  }, 6000);

  return false;
}
