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 fecha()
{
print1=""; // WeekDay
print2=""; // Month
print3=""; // Year
print4=0; // Date
print5=0; // Month
today = new Date(); // Init date
weekday = today.getDay(); // Day
month = today.getMonth(); // Month
date = today.getDate(); // Date
year=today.getFullYear(); // Year
print3=year;
print4=date;
print5=(month+1);
if (weekday == 6) print1='Sabado';
if (weekday == 0) print1='Domingo';
if (weekday == 1) print1='Lunes';
if (weekday == 2) print1='Martes';
if (weekday == 3) print1='Miercoles';
if (weekday == 4) print1='Jueves';
if (weekday == 5) print1='Viernes';
if (month == 0) print2='Enero';
if (month == 1) print2='Febrero';
if (month == 2) print2='Marzo';
if (month == 3) print2='Abril';
if (month == 4) print2='Mayo';
if (month == 5) print2='Junio';
if (month == 6) print2='Julio';
if (month == 7) print2='Agosto';
if (month == 8) print2='Septiembre';
if (month == 9) print2='Octubre';
if (month == 10) print2='Noviembre';
if (month == 11) print2='Diciembre';// STOP HIDE -->
document.write(print1+' '+print4+' de '+print2+' de '+print3);
}


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(); 
aux=" am";
if(hora>12){hora=hora-12; aux=" pm"; }; 
if(hora==12){aux=" pm"; }; 
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+aux+" | "+ diasem[diasemana]+" "+LaFecha.getDate()+" de "+Mes[NumeroDeMes]+" de "+LaFecha.getFullYear(); 
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;
		}
}			