var ventana = null;
/*function abrirPopUp (url, nombre, ancho, alto, x, y)
{
	var caracteristicas_ventana = "";
	caracteristicas_ventana += "dependent";
	caracteristicas_ventana += ",directories=no";
	caracteristicas_ventana += ",height="+alto;
	caracteristicas_ventana += ",hotkeys=no";
	//caracteristicas_ventana += ",innerHeight";
	//caracteristicas_ventana += ",innerWidth";
	caracteristicas_ventana += ",location=NO";
	caracteristicas_ventana += ",menubar=no";
	//caracteristicas_ventana += ",outerHeight";
	caracteristicas_ventana += ",personalbar=no";
	caracteristicas_ventana += ",resizable=yes";
	caracteristicas_ventana += ",screenX=0";
	caracteristicas_ventana += ",screenY=0";
	caracteristicas_ventana += ",scrollbars=yes";
	caracteristicas_ventana += ",status=no";
	caracteristicas_ventana += ",titlebar=no";
	caracteristicas_ventana += ",toolbar=no";
	caracteristicas_ventana += ",width="+ancho;
	caracteristicas_ventana += ",z-lock=yes";
	caracteristicas_ventana += ",left="+x;
	caracteristicas_ventana += ",top="+y;
	var ventana=window.open(url,nombre,caracteristicas_ventana);
	
	// return ventana;
}//Fin abrirPopUp()  */

function cerrarVentana()
{
	objeto = document.getElementById("form");
	if( id_mensaje==0 )
	{
		objeto_premio = document.getElementById("id_premio");
		if(objeto_premio.innerHTML=="1")
		{
			document.location.reload();
		}		
		objeto.innerHTML = "";
		objeto.style.display = "none";
		objeto.style.left = "0px";
		ocultarFondo();
	}
	else
	{
		objeto = document.getElementById("mensaje");
		objeto.innerHTML = "<div class='mensaje'>Por favor espere un momento se esta enviando el correo</div>";
	}
}

function getViewportSize() {
    var x, y;
    if (self.innerHeight) { // MOS
        y = self.innerHeight;
        x = self.innerWidth;
    } else if (document.documentElement && document.documentElement.clientWidth) { // IE6 Strict
        x = document.documentElement.clientWidth;
        y = document.documentElement.clientHeight;
    } else if (document.body.clientHeight) { // IE quirks
        y = document.body.clientHeight;
        x = document.body.clientWidth;
    }
    return {x: x, y: y};
}


var _timer_tooltip = 0;

function cerrarToolTip()
{
	var objeto = document.getElementById("tooltip");
	objeto.innerHTML = "";
	objeto.style.display="none";
	
	clearInterval(_timer_tooltip);
	
}//Fin de cerrarToolTip()

function mostrarToolTip(empresa,premio,descripcion,fila,columna,entregados,img_premio,num_premios_quedan)
{
	var objeto = document.getElementById("tooltip");
	
	objeto.innerHTML = "";
	clearInterval(_timer_tooltip);
	
	if( empresa == "undefined" )
	{
		cerrarToolTip();
		return;
	}
	
	if( premio == ""){
		//premio = "";
		num_premios_quedan = 0;
	}
	
	premio = premio.replace("__",";");
	premio = premio.replace("_p_","%");
	
	if( entregados==1 ){
		//premio = "";
		num_premios_quedan = 0;
	}//Fin de if( entregados==1 )
	
	objeto.style.top = 155+(fila*20)+"px";
	if (self.innerWidth) { // MOS
		objeto.style.left = (self.innerWidth/2)-510+(columna*20)+"px";
  } else if (document.documentElement && document.documentElement.clientWidth) { // IE6 Strict
    objeto.style.left = (document.documentElement.clientWidth/2)-510+(columna*20)+"px";
  } else if (document.body.clientHeight) { // IE quirks
    objeto.style.left = (document.body.clientWidth/2)-510+(columna*20)+"px";
  }
  
  var imagen_premio = '';
  if(img_premio != ''){
     imagen_premio = '<center><img src="/Logos/'+img_premio+'" ></center>';
  }
  
  if(num_premios_quedan<0){
    num_premios_quedan = 0;
  }//Fin de if(num_premios_quedan<0)
  
  var premios_restantes = '';
  premios_restantes = '<table border="0" align="center" width="110"><tr><td><span class="premio_res">Premios Restantes</span></td><td><span class="num_premios">'+num_premios_quedan+'</span></td></tr></table>';
    
	objeto.innerHTML = "<img src='/Includes/Imagenes/tooltip_top.png'><div class='tooltip_middle'><div class='contenido_tooltip'><span class='bold'>"+premio+"</span>"+imagen_premio+premios_restantes+"</div></div><img src='/Includes/Imagenes/tooltip_bottom.png'>";
	
	objeto.style.display="block";
	
	_timer_tooltip = setInterval("cerrarToolTip()",7000);
	
}//Fin de mostrarToolTip

function mostrarFondo()
{
	var ventana = getViewportSize();	
	var objeto = document.getElementById('capa_inicio_fondo');
	objeto.style.display = "block"; 
	
	objeto.style.width = ventana.x+"px";
	objeto.style.height= (screen.height+500)+"px";
}

function ocultarFondo()
{
	var objeto = document.getElementById('capa_inicio_fondo');
	objeto.style.display = "none"; 
}

function mostrarCapaInicio()
{
	var ventana = getViewportSize();	
	var objeto = document.getElementById('capa_inicio_fondo');
	objeto.style.display = "block"; 
	
	objeto.style.width = ventana.x+"px";
	objeto.style.height= (screen.height+100)+"px";
	
	objeto = document.getElementById('capa_inicio_imagen');
	objeto.style.display = "block"; 

}//Fin de mostrarCapaInicio()

function cerrarCapaInicio()
{
	var objeto = document.getElementById('capa_inicio_imagen');
	objeto.style.display = "none"; 
	
	var objeto = document.getElementById('capa_inicio_fondo');
	objeto.style.display = "none"; 

	return  false;
}//Fin de cerrarCapaInicio()

function cambiarCiudad(ciudad){
  window.location='Index.php?m=gestion&accion=abrir_grillas_ciudad&ciudad='+ciudad+'&cambiar_ciudad=true';
}                    

function cambiarCiudadImagen(){
	
	var usu_ciu_id = document.getElementById('usu_ciu_id').value;

  window.location='Index.php?m=gestion&accion=abrir_grillas_ciudad&ciudad='+usu_ciu_id+'&cambiar_ciudad=true';
}             

