// JavaScript Document
function mostrar() { 
   $("#pop").fadeIn('slow'); 

} //checkHover
$(document).ready(function(){ 

$("#the_lights").fadeTo(1,0);
  $("#turnoff").click(function () {
    $("#the_lights").css({'display' : 'block'});
    $("#the_lights").fadeTo("slow",1);
  });
	document.getElementById("the_lights").style.display="block";
    $("#the_lights").fadeTo("slow",0.8);

  $("#cerrar").click(function () {
    document.getElementById("the_lights").style.display="block";
	
    $("#the_lights").fadeTo("slow",0);
	$("#the_lights").css({'display' : 'none'});
  });

//hover effect to all ui-state-default elements

var img_w = $("#pop img").width() + 10; 
   var img_h = $("#pop img").height()+28; 
    
   //Darle el alto y ancho 
 $("#pop").css('width', img_w + 'px'); 
   $("#pop").css('height', img_h + 'px'); 
    
   //Esconder el popup 
   $("#pop").hide();
   var w = $(this).width(); 
   var h = $(this).height(); 
    
   //Centra el popup    
   w = (w/2) - (img_w/2); 
   h = (img_h/6); 
   $("#pop").css("left",w + "px"); 
   $("#pop").css("top",h + "px");

  //temporizador, para que no aparezca de golpe 
   setTimeout("mostrar()",2000);

 $("#pop").click(function (){ 
      $(this).fadeOut('slow'); 
   });
 

});
