function showFT(id) {
    if (document.getElementById) {
      if (document.getElementById(id).style.visibility == 'visible')
      {
        document.getElementById(id).style.visibility = 'hidden';
        document.getElementById(id).style.display = 'none';
      }
      else
      {
        document.getElementById(id).style.visibility = 'visible';	  
        document.getElementById(id).style.display = 'block';
      }
    }
  }
          
function trimFT(s)
	{		
		return s.replace(/\s/gi,"");
	}
	
function checaDatosFT() {
    var fecha_ini = new Date(document.formFT.fiaa.value,document.formFT.fimm.value-1,document.formFT.fidd.value)
    var fecha_fin = new Date(document.formFT.ffaa.value,document.formFT.ffmm.value-1,document.formFT.ffdd.value)
	var fecha_hoy = new Date()
	var mes_aux = new String(fecha_ini.getMonth()+1)
	var dia_aux = new String(fecha_ini.getDate())
	if(mes_aux.length==1)
	mes_aux='0'+mes_aux
	if(dia_aux.length==1)
	dia_aux='0'+dia_aux
	var str_aux = new String(fecha_ini.getFullYear()+'/'+mes_aux+'/'+dia_aux)
	document.formFT.FIni.value=str_aux
	mes_aux = new String(fecha_fin.getMonth()+1)
	dia_aux = new String(fecha_fin.getDate())
	if(mes_aux.length==1)
	mes_aux='0'+mes_aux
	if(dia_aux.length==1)
	dia_aux='0'+dia_aux
	str_aux = new String(fecha_fin.getFullYear()+'/'+mes_aux+'/'+dia_aux)
	document.formFT.FFin.value=str_aux	
	if ((trimFT(document.formFT.texto.value)=="") && (trimFT(document.formFT.lugarevento.value)==""))
	{
		alert('Por favor introduzca personaje, lugar o evento.')
		document.formFT.texto.focus();
		return false;
	}
	if (fecha_fin>fecha_hoy) 
	{
		alert('La fecha final solo puede ser hasta hoy.');
		return false;
	}
	if (fecha_ini>fecha_fin) 
	{
		alert('La fecha inicial no puede ser mayor a la fecha final.');
		return false;
	}
	dominio = document.domain.toLowerCase();
    pUrl = document.location.href.toLowerCase();
var site ;

if (dominio.indexOf('busquedas') != -1){
	site = dominio.replace("www.","");
	site = site.replace("gruporeforma.","");
	site = site.replace("envivo.","");
	site = site.replace(".com","");}
else if (pUrl.indexOf('elnorte') != -1)
	site = 'elnorte';
else if (pUrl.indexOf('reforma') != -1)
	site = 'reforma';
else if (pUrl.indexOf('mural') != -1)
	site = 'mural';
else if (pUrl.indexOf('palabra') != -1)
	site='palabra'
else
	site = 'elnorte';
document.formFT.texto.value=document.formFT.texto.value.replace(/[<]/g,'');
document.formFT.texto.value=document.formFT.texto.value.replace(/[>]/g,'');
//alert('liga a fototienda=' + "http://www." + site + ".com/fototienda/Busquedaresultado.aspx?texto=" + document.formFT.texto.value +"&FIni=" + document.formFT.FIni.value +"&FFin=" + document.formFT.FFin.value + "&Seccion=" + document.formFT.seccion.value + "&grcidorigen=3");
document.formFT.action ="http://www." + site + ".com/fototienda/Busquedaresultado.aspx?texto=" + document.formFT.texto.value +"&FIni=" + document.formFT.FIni.value +"&FFin=" + document.formFT.FFin.value + "&Seccion=" + document.formFT.seccion.value;
return true;
}

function fixFechasFT()
{
	anioMinBusqueda=2001;
	var fecha_hoy = new Date();
	anioMaxBusqueda= fecha_hoy.getFullYear();		
	i=0;
	for (x=anioMinBusqueda;x<=anioMaxBusqueda;x++)
	{					
		nueva = new Option(x,x);
		nueva1 = new Option(x,x);
		eval("document.formFT.fiaa.options[i]=nueva");
		eval("document.formFT.ffaa.options[i]=nueva1");
		i++;
	}
	document.formFT.fidd.selectedIndex = fecha_hoy.getDate()-1;	
	document.formFT.ffdd.selectedIndex = fecha_hoy.getDate()-1;
	document.formFT.fimm.selectedIndex = fecha_hoy.getMonth();
	document.formFT.ffmm.selectedIndex = fecha_hoy.getMonth();
	document.formFT.fiaa.selectedIndex = (i-2);
	document.formFT.ffaa.selectedIndex = (i-1);
}