// **** CAMPOS ****

document.write('<script type="text/javascript" src="campos/campos.txt"></script>')

TablaCF = new Array("#Campos-GMap#v3#")

function CCF(datos){
  datos=datos.split("|")
  nc=TablaCF.length
  TablaCF[nc]=new DatosCCF(nc,datos)
}

function DatosCCF(numero,datos){
  this.num     = numero
  this.pais    = datos[0]
  this.ciudad  = datos[1]
  this.nombre  = datos[2]
  this.equipo  = datos[3]
  this.enviado = datos[4]
  this.lon     = datos[5]
  this.lat     = datos[6]
}

function MuestraCampo()
{
  CFHome=GetCookie("CFHome")
  if(CFHome)
  {
    datos=CFHome.split("|")
    CFHomeN=parseInt(datos[0])
    CFHomeF=new Date(datos[1])
  }
  else
  {
    CFHomeN=0
    CFHomeF=new Date()
  }

  ahora=new Date()
  marca=CFHomeF
  marca.setTime(marca.getTime()+(1*1*60*60*1000)) // 1 horas
  if(CFHomeN>0 && marca>ahora)
  {numero=CFHomeN}
  else
  {
    numero=CFHomeN+1
    largolista=TablaCF.length-1
    if(numero>largolista){numero=1}

    CFHome=numero+"|"+ahora
    caduca=new Date()
    caduca.setTime(caduca.getTime()+(365*24*60*60*1000))
    SetCookie("CFHome",CFHome,caduca,"/",null,null)
  }

  MuestraCampoHome(numero)
}

function MuestraCampoHome(numero)
{
  pais=TablaCF[numero].pais
  ciudad=TablaCF[numero].ciudad
  nombre=TablaCF[numero].nombre

  html='<span>'
  html=html+'<img border="0" height="30" src="imagenes/compassw.gif" alt="Campos de Fútbol">'
  html=html+'<br>De los '+(TablaCF.length-1)+' campos enviados por'
  html=html+'<br>nuestros visitantes conozca...'
  html=html+'<a href="campos/campos.html?c='+numero+'">'
  html=html+'<br><b>'+nombre+'</b>'
  html=html+'<br>'+pais+' - '+ciudad
  html=html+'</a></span>'

  document.write(html)
}

