function versionimpresa(fechamostrar)
	{
		window.open("versionimpresa.php?fecha="+fechamostrar,"","width=500,height=650,help=No, status=No,Scrollbars,center=Si");
	}

function presionaenter(evt)
{										
	if (evt.keyCode==13)
	{	
		validarFormulario();		
		return false;			
	}
	else
	{
		return true;
	}
}



function fondlist1(cuenta)
{	
	document.getElementById(cuenta).style.background="#fafafa";	
}

function fondlist2(cuenta)
{

	document.getElementById(cuenta).style.background="#ffffff";	
}


function Reloj(){  
var LaFecha=new Date(); 
var Mes=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"); 
var diasem=new Array('domingo','lunes','martes','miercoles','jueves','viernes','sabado'); 
var diasemana=LaFecha.getDay(); 
var FechaCompleta=""; 
var NumeroDeMes=""; 
var hora = LaFecha.getHours(); 
if(hora<10){hora="0"+hora;}; 
var minuto = LaFecha.getMinutes();  
if(minuto<10){minuto="0"+minuto;}; 
var segundo = LaFecha.getSeconds(); 
if(segundo<10){segundo="0"+segundo;}; 
NumeroDeMes=LaFecha.getMonth(); 
FechaCompleta=hora+":"+minuto+":"+segundo+" | "+ diasem[diasemana]+" "+LaFecha.getDate()+" de "+Mes[NumeroDeMes]+" de "+LaFecha.getFullYear()+"&nbsp;|&nbsp;New York, NY"; 
document.getElementById('smart').innerHTML=FechaCompleta; 
setTimeout('Reloj()',1000) 
}
  
function encerar1(forma)
{			
	document.formulario.categoria.value="";
	document.formulario.nombrecompa.value="";
	document.formulario.zipcode.value="";			
	return;
}

function encerar2(forma)
{			
	document.formulario.superclave.value="";
	return;
}

function cambia(cuenta)
{	
	document.getElementById(cuenta).style.background="transparent";
}

function cambia2(cuenta)
{
	document.getElementById(cuenta).style.background="#E0ECFE";	
}
function cambia3(cuenta)
{
	document.getElementById(cuenta).style.background="#FFFF00";
}
function cambia4(cuenta)
{	
	document.getElementById(cuenta).style.background="#f5f75a";
}

function msng(mensaje)
{
	alert(mensaje);
	return;
}


function validarFormulario()
{		
		status="";
		control="";
		
		if ((trim(document.formulario.provincia.value) == "")&&(trim(document.formulario.ciudad.value) == "")&&(trim(document.formulario.direccion.value) == ""))
		{
			control=document.formulario.provincia;
		}
				
		if (control != "")
		{
			alert("Tiene que ingresar un criterio de búsqueda...");
			status = "Este campo no puede estar en blanco";
			control.value="";
			control.focus();
			return false;
		}
		else
		{					
			document.formulario.submit();
		}
}
	
function trim(s)
{
  		while (s.substring(0,1) == ' ')
		{
    		s = s.substring(1,s.length);
  		}
  		while (s.substring(s.length-1,s.length) == ' ')
		{
    		s = s.substring(0,s.length-1);
  		}
  		return s;		
}
	
function confirmar( mensaje, destino)
{
		if (confirm(mensaje))
		{
			document.location = destino;
		}
}			






function validaregistro(forma)
{
	status="";
	control="";
	// VALIDAMOS LOS CAMPOS REQUERIDOS
	// nick del usuario
	if (trim(document.form1.usu.value) == "")
	{
		control=document.form1.usu;
	} else {
		ban=0;
		aux=document.form1.usu.value;
		n=aux.length;			
		for (i=0;i<n-1;i++)
		{
			if (aux.substr(i,1)==' ')
				ban=1;				
		}
	}
		
	// clave de usuario
	if (trim(document.form1.pas.value) == "")
	{
		control=document.form1.pas;
	} else {
		ban2=0;
		aux=document.form1.pas.value;
		n=aux.length;			
		for (i=0;i<n-1;i++)
		{
			if (aux.substr(i,1)==' ')
				ban2=1;				
		}
	}
						
	if (control != "")
	{
		alert("Debe ingresar datos en los dos campos: Uusario y Password....");
		status = "Este campo no puede estar en blanco";
		control.value="";
		control.focus();
		return false;
	}
	if (ban==1)
	{
		alert("El nombre de usuario no puede tener espacios...");
		return false;
	}
	if (ban2==1)
	{
		alert("El password no puede tener espacios...");
		return false;
	}		
	return true;		
}
	
	
function validaclasificado()
	{
		status="";
		control="";
				
		if (trim(document.form1.des.value) == "")
			control=document.form1.des;		
		if (trim(document.form1.cat.value) == "0")
			control=document.form1.cat;
		if (trim(document.form1.tit.value) == "")
			control=document.form1.tit;
	
		if (control != "")
		{
			alert("Los campos marcados con * son obligatorios...");
			status = "Este campo no puede estar en blanco";
			control.focus();
			return false;
		}
	}
	
	

	
