function gf(){
	
	var pag1,pag2,pag3,pag3,pag5;
	var PagActual,TotalPag1,TotalPag,GrupoPagActual,GrupoTotalPag,GrupoSig,GrupoAnt;

if (!document.all)
   document.Busca.activ.focus();
else
   {
	document.forms[0].activ.value=reemplazar(document.forms[0].activ.value,"+"," ");
    document.forms[0].activ.focus();
   //document.forms[0].activ.style.backgroundColor="#FBD400";
   //document.forms[0].activ.value=reemplazar(document.forms[0].activ.value,"+"," ");
   
   }
}

////////////////////////////////////////////////////////////////////////////////

function obtenerfecha()
{
	FechaHoy=new Date();
	anyoact=FechaHoy.getFullYear();
	document.write(anyoact);
}

///////////////////////////////////////////////////////////////////////////////


function pon_actividad()
{

 if (navigator.appName=="Netscape")
 {
	 if (document.Busca.ctopten.selectedIndex!=0){
	  document.Busca.activ.value=document.Busca.ctopten[document.Busca.ctopten.selectedIndex].text;
	  document.Busca.activ_tt.value=document.Busca.ctopten[document.Busca.ctopten.selectedIndex].value;
	 }
	 else{
	   document.Busca.activ.value='';
	   document.Busca.activ_tt.value='';
	 }
 //enviar();
 }
 else
 {
	 if(document.forms[0].ctopten.selectedIndex!=0){
	  document.forms[0].elements[9].value=document.Busca.ctopten[document.forms[0].ctopten.selectedIndex].text;
	  document.forms[0].elements[3].value=document.Busca.ctopten[document.forms[0].ctopten.selectedIndex].value;
	 }
	 else{
	  document.forms[0].elements[9].value='';
	  document.forms[0].elements[3].value='';
	 }

 //enviar();
 }
}

////////////////////////////////////////////////////////////////////////////////

function pon_actividadFA(name,code)
{

 if (navigator.appName=="Netscape")
 {
 document.Busca.activ.value=name;
 document.Busca.activ_tt.value=code;
 //enviar();
 }
 else
 {
 document.forms[0].elements[9].value=name;
 document.forms[0].elements[3].value=code;
 //enviar();
 }
}

////////////////////////////////////////////////////////////////////////////////



function pon_localidad(name,loc_code,prov_code)
{

 if (navigator.appName=="Netscape")
 {
 document.Busca.poblacion.value=name;
 document.Busca.localidad.value=loc_code;
 document.Busca.provincia.value=prov_code;

 //enviar();
 }
 else
 {
  
  document.forms[0].elements[11].value=name;
  document.forms[0].elements[5].value=loc_code;
  document.forms[0].elements[6].value=prov_code;


 }
}

////////////////////////////////////////////////////////////////////////////////


function borra(DnEvents)
{
 K = navigator.appName=="Netscape" ? DnEvents.which : DnEvents.keyCode
 if ((navigator.appName=="Netscape") && (K!=13) )
 {
 document.Busca.activ_tt.value='';
 }
 else
 {
 if (K!=13)
 document.forms[0].elements[3].value='';
 }
}

////////////////////////////////////////////////////////////////////////////////


function borraLoc(DnEvents)
{
 K = navigator.appName=="Netscape" ? DnEvents.which : DnEvents.keyCode
 if ((navigator.appName=="Netscape") && (K!=13) )
 {
 document.Busca.localidad.value='0';
 document.Busca.provincia.value='0';
 }
 else
 {
 if (K!=13){
	 document.forms[0].elements[5].value='0';
	 document.forms[0].elements[6].value='0';
 }
 }
}

////////////////////////////////////////////////////////////////////////////////


function  enviarfrm(frm)
{

document.Busca.submit();

/*
if (navigator.appName=="Netscape")
  {
    if ( document.Busca.activ.value=='') {alert('Debe rellenar al menos el campo Actividad'); }
    else{
         if ((document.Busca.activ.value!='' ) && (document.Busca.poblacion.value==''))
               {alert('Debe completar el campo Poblacion o Empresa para poder enviar el formulario'); }
 else 
   document.Busca.submit();
        }
  }

else
  {if ( document.forms[0].activ.value=='') { alert('Debe rellenar al menos el campo Actividad'); }
 
   else{ 
   
          if ((document.forms[0].activ.value!='' ) &&  (document.forms[0].poblacion.value==''))
             {alert('Debe completar el campo Poblacion o Empresa para poder enviar el formulario'); }
          else
             document.forms[0].submit();

       }
  }
*/

}

////////////////////////////////////////////////////////////////////////////////

function Pulsada(DnEvents)
{
 K = navigator.appName=="Netscape" ? DnEvents.which : DnEvents.keyCode
 if (K==13) 
 enviar(); }

if (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)>=4) // Para Netscape
 {
 document.onkeydown = Pulsada
 document.captureEvents(Event.KEYDOWN)
}

 ///////////////////////////////////////////////////////////////////////////////

function enviar()
{

/*
 if (navigator.appName=="Netscape")
 {    if ( document.Busca.activ.value=='')   
   { alert('Debe rellenar el campo Actividad');}
   else
    {  
       if ((document.Busca.activ.value!='' ) &&   
     (document.Busca.poblacion.value==''))
    {
      alert('Debe rellenar el campo Actividad para poder enviar el formulario');}
       else
    document.Busca.submit();
    }
  }
  
 else
 { if ( document.forms[0].activ.value=='' && document.forms[0].empresa.value=='')
    {alert('Rellene al menos un campo Actividad o Empresa');}
  else
    {
  if ( (document.forms[0].empresa.value=='' && document.forms[0].activ.value!='') && (document.forms[0].poblacion.value==''))
        {alert('Debe completar el campo Poblacion o Empresa para poder enviar el formulario');}
  else 
    document.forms[0].submit();
    }   
 }
 */
 document.Busca.submit();
}

////////////////////////////////////////////////////////////////////////
function open_window(w)
{
     if(w == 1) {
      window.open("../TDHome/1/categorias.html","Categorias",       "toolbar=0,location=0,resizable=0,directories=0,status=0,menubar=0,scrollbars=1,height=420,width=600,left=200px,top=100px");}
 	 else if (w==2)
	{
 	  window.open("../TDHome/1/pop_localidades.html","Mapa", "toolbar=0,location=0,resizable=0,directories=0,status=0,menubar=0,scrollbars=1,height=550,width=720,left=200px,top=100px");	       	 
	}
}

/////////////////////////////////////////////////////////
function open_help(iNum){
      
      window.open("../TDHome/1/help"+iNum+".html","Ayuda",       "toolbar=0,location=0,resizable=0,directories=0,status=0,menubar=0,scrollbars=1,height=420,width=730,left=200px,top=100px");
 
}

/////////////////////////////////////////////////////////
function open_info(sLang){
window.open("/TDHome/"+sLang+"/infoLegal.html","Info","toolbar=1,location=1,resizable=1,directories=1,status=0,menubar=1,scrollbars=1,height=600,width=740,left=0px,top=0px");
}

function open_images(path,nombre_comercial,ancho,alto)
{
options="width=1000,left=1,toolbar=0,titlebar=1,minimizable=1,status=0,menubar=0,scrollbars=1,resizable=1,location=0,directories=0";
 w=window.open("about:blank","wlogo",options)


if (ancho==0)
{
	ancho=275;
}

if (alto==0)
{
	alto=300;
}
 var html = '';
// html = '<HTML><head><title>LOGO</title></head><BODY><IMG SRC="'+formulario.elements["tmplogo"].value+'" HEIGHT="75" BORDER="0"></BODY></HTML>';
//html = '<HTML><head><title>LOGO</title></head><BODY><IMG SRC="../contratos/DD5/46/DD54657V/54657B1.jpg"></BODY></HTML>';

html='<HTML><head><title>LOGO</title></head><BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0 marginwidth="0" marginheight="0"><TABLE cellSpacing=0 cellPadding=0 align=center border=0></TABLE></BODY></HTML>';
html= '<HTML><HEAD><TITLE>TU DISTRITO</TITLE> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"><LINK href="../css/home_page.css" type=text/css rel=stylesheet> <META content="MSHTML 6.00.2800.1276" name=GENERATOR> </HEAD>';
html=html + '<BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0 marginwidth="0" marginheight="0"> <TABLE cellSpacing=0 cellPadding=0 border=0> <TBODY>   <TR>     <TD><BR>      <TABLE height=50 cellSpacing=0 cellPadding=0 border=0>';
html=html + '<TBODY> <TR> <TD width=200><IMG height=40 width="200" src="../images/logotipo_tudistrito_mup.gif" width=138></TD> <TD> <TABLE cellSpacing=0 cellPadding=0 border=0> <TBODY>  <TR> <TD bgColor=#aaaaaa><IMG height=2 src="../images/transp.gif" width=2></TD></TR>';
html=html + '<TR> <TD><A class=datos href="http://www.tudistrito.com/servlets/XS_Channel?page=prod&amp;lang=1">GUÍA de PRODUCTOS TU DISTRITO &gt;</A></TD></TR> <TR> <TD bgColor=#aaaaaa><IMG height=2 src="../images/transp.gif" width=2></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>';
html=html + '<TR> <TD> <TABLE cellSpacing=0 cellPadding=0 border=0> <TBODY> <TR bgColor=#aaaaaa> <TD colSpan=2><IMG height=10 src="../images/pestanap.gif" width=40></TD></TR> <TR>';
html=html + '<TD colSpan=2><IMG height=5 src="../images/transp.gif" width=5></TD></TR> <TR> <TD vAlign=top> <DIV align=left><FONT class=head-mup>' + nombre_comercial + '</FONT>';
html=html + '<BR> </DIV></TD> <TD width=120>&nbsp; </TD> </TR> <TR> <TD vAlign=top><IMG height=5 src="../images/transp.gif" width=5></TD> <TD width=120>&nbsp;</TD></TR></TBODY></TABLE>';
html=html + '<TABLE height=130 cellSpacing=0 cellPadding=0 border=0> <TBODY> <TR > <TD align=left vAlign=top><SPAN class=tex-gris_mups><IMG height=2 src="../images/transp.gif" width=2></SPAN></TD> </TR> <TR> ';
html=html + '<TD height="128" align=left vAlign=top><IMG height=5 src="../images/transp.gif" width=5> <IMG widht=' + ancho + ' height=' + alto + ' SRC="' + path + '"></TD> </TR> </TBODY> </TABLE>  <TABLE cellSpacing=0 cellPadding=0 border=0> <TBODY> <TR> <TD ><IMG height=2 src="../images/transp.gif" width=2></TD>';
html=html + '</TR></TBODY></TABLE><BR><TABLE cellSpacing=0 cellPadding=0 width=200 align=center border=0> <TBODY> <TR> <TD><IMG height=10 src="../images/print.gif" width=11><FONT class=text-mup2>&nbsp;<A class=datos href="javascript:self.print();">Imprimir</A> </FONT></TD> <TD> <DIV align=right><IMG height=10 src="../images/close.gif" width=11><FONT class=text-mup2>&nbsp;&nbsp;<A class=datos href="javascript:self.close();">Cerrar</A> </FONT></DIV></TD></TR></TBODY></TABLE><BR>';
html=html + '<TABLE cellSpacing=0 cellPadding=0 border=0> <TBODY> <TR> <TD bgColor=#aaaaaa><IMG height=2 src="../images/transp.gif" width=2></TD></TR> <TR> <TD><A class=datos href="http://www.tudistrito.com/servlets/AutoResponder?res=2&amp;lang=1" target=_blank>Si encuentra algún dato incorrecto acceda a nuestro formulario</A></TD></TR> <TR> <TD bgColor=#aaaaaa><IMG height=2 src="../images/transp.gif" width=2></TD></TR></TBODY></TABLE></TD></TR>';
html=html + '<TR><TD><BR><TABLE cellSpacing=0 cellPadding=0 bgColor=#0050a4 border=0> <TBODY><TR><TD background="../images/pie_mup.gif" width="550"> <DIV class=pie align=center>© 2002-07, Tu Distrito Holding S.L.<A class=legal href="http://www.tudistrito.com/TDHome/1/infoLegal.html" target=_blank>Aviso Legal</A> </DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR> </BODY></HTML>';

 w.document.open();
 w.document.write(html);
 w.document.close();
}

function reemplazar(texto,s1,s2)
{	
	return texto.split(s1).join(s2);
	
}


function abreVentana2(loc,nombre,kind) {
options1="toolbar=0,status=0,menubar=0,scrollbars=1,resizable=1,location=0,directories=0,width=600,height=470,left=50,top=50";
options2="toolbar=0,status=0,menubar=0,scrollbars=1,resizable=1,location=0,directories=0,width=800,height=510,left=0,top=0";
if (kind== 1 ) subvent=window.open(loc, nombre, options1);
else subvent=window.open(loc+'&lang=1', nombre, options2); 
};

//////////////////////////////////////////////////////////////////
