// **** PROMESAS ****

document.write('<script type="text/javascript" src="demo/promesas/promesas.txt"></script>')

TablaZP = new Array("#Zonas#v1#")
TablaJP = new Array("#Jugadores#v1#")

function CZP(datos){
  datos=datos.split("|")
  nz=TablaZP.length
  TablaZP[nz]=new DatosCZP(nz,datos)
}

function CJP(datos){
  datos=datos.split("|")
  nj=TablaJP.length
  TablaJP[nj]=new DatosCJP(nj,datos)
}

function DatosCZP(numero,datos){
  this.num     = numero
  this.carpeta = datos[0]
  this.titulo  = datos[1]
}

function DatosCJP(numero,datos){
  this.num     = numero
  this.carpeta = datos[0]
  this.archivo = datos[1]
  this.nombre  = datos[2]
}

function MuestraPromesa()
{
  JPHome=GetCookie("JPHome")
  if(JPHome)
  {
    datos=JPHome.split("|")
    JPHomeN=parseInt(datos[0])
    JPHomeF=new Date(datos[1])
  }
  else
  {
    JPHomeN=0
    JPHomeF=new Date()
  }

  ahora=new Date()
  marca=JPHomeF
  marca.setTime(marca.getTime()+(1*1*60*60*1000)) // 1 horas
  if(JPHomeN>0 && marca>ahora)
  {numero=JPHomeN}
  else
  {
    numero=JPHomeN+1
    largolista=TablaJP.length-1
    if(numero>largolista){numero=1}

    JPHome=numero+"|"+ahora
    caduca=new Date()
    caduca.setTime(caduca.getTime()+(365*24*60*60*1000))
    SetCookie("JPHome",JPHome,caduca,"/",null,null)
  }

  MuestraPromesaHome(numero)
}

function MuestraPromesaHome(numero)
{
  carpeta=TablaJP[numero].carpeta
  foto=TablaJP[numero].archivo+".gif"
  nombre=TablaJP[numero].nombre

  html='<div style="border: 1px solid BBBBBB; padding: 3px; width: 240; height: 80">'
  html=html+'<table class="tablajugador" border="0" cellpadding="0" cellspacing="2" width="200"></td>'
  html=html+'<tr><td align="center">'
  html=html+'<img height="65" border="0" src="demo/promesas/'+carpeta+'/'+foto+'"></td>'
  html=html+'<td align="center">'+nombre+'</td>'
  html=html+'</tr></table>'
  html=html+'</div>'
  html=html+'<a href="demo/promesas/campo.html">Vea la DEMO de Jóvenes Promesas</a><br>'
  //html=html+'<a href="accesozona/promesas.html">Conozca TODAS las Jóvenes Promesas</a>'
  
  document.write(html)
}
