this.focus();

// handle keyboard events
var moz = false;
if (navigator.appName == "Mozilla" || (navigator.appName == "Netscape" && navigator.appVersion.indexOf("4.") == -1))
   moz = true;

if (moz){
   document.addEventListener("keyup",keypress,true);
   document.addEventListener("click",anularBotonDerecho,true);
   
}
else if(navigator.appName == "Netscape" && navigator.appVersion.indexOf("4.x") != -1){
   document.captureEvents(Event.KEYPRESS);
   childw.document.captureEvents(Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP);

}
//else{
//}


if (!moz)  {
   document.onkeypress = keypress;
   document.onkeydown = keypress;
   document.onkeyup = keypress;
   document.onClick = anularBotonDerecho;
   document.onMouseUp=  anularBotonDerecho;
   document.onmousedown=anularBotonDerecho;
}

     

function anularBotonDerecho() {
    if (event.button==2 ) {
     alert('copyright © cangurus.com.co');
    }
  }
// perform action based on keypress and state info
function keypress(e) { 
   if (navigator.appName == "Microsoft Internet Explorer") 
      tmp = event.keyCode;
   else if (moz)
      tmp = e.keyCode;

   if (tmp==93)
        alert("copyright © cangurus.com.co");
   //else if (tmp==17)
        //alert("copyright © cangurus.com.co");
   //else if (tmp==18)
        //alert("copyright © cangurus.com.co");
   

  document.forms[0].elements[0].value = tmp;
}

function avisarSeleccion()
{
    alert("Seleccionando Texto");
}
function EventoDrag(){
alert("No se puede arrastrar la imagen.")
}


function viewHide(id) 
{
var targetId, srcElement, targetElement;
var targetElement;

targetElement = document.getElementById('tabla1');
targetElement.style.display = "none";
targetElement = document.getElementById('tabla2');
targetElement.style.display = "none";

targetElement = document.getElementById(id);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
} else {
targetElement.style.display = "none";
} 

}
function abrir_popup(theURL,winName,features) { 
  		window.open(theURL,winName,features);
}
function confirmSubmit(){
				var agree=confirm("Esta seguro de eliminar la fila de la factura ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function confirm_c(){
				var agree=confirm("Esta seguro de anular la categoria? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_bebe(){
				var agree=confirm("Esta seguro de anular los datos del bebe? ");
				if (agree)
					return true ;
				else
					return false ;
}

function conf_color(){
				var agree=confirm("Esta seguro de eliminar el color de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;}
function conf_loc(){
				var agree=confirm("Esta seguro de eliminar el cliente de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}

function validarCliente(obj){
	ok  = false;
	if(obj.cliente_id != null && obj.cliente_id.value == ""){
		alert("Para realizar una factura primero debe seleccionar un cliente de la lista");
		obj.cliente_id.focus();
	}else{
		ok = true;
	}
	return ok;
}
function validarDetalle(obj){
	ok  = false;
	if(obj.cantidad != null && obj.cantidad.value == ""){
		alert("Por favor ingrese una cantidad");
	}else if(obj.descripcion != null && obj.descripcion.value == ""){
		alert("Por favor ingrese una descripcion o detalle");
	}else if(obj.precio != null && obj.precio.value == "" && obj.total != null && obj.total.value == "" ){
		alert("Por favor ingrese un valor en el total o en el valor unitario para poder realizar la operacion que desea");
	}else{
		ok = true;
	}
	return ok;
}
function v_movimiento(obj){
	ok  = false;
	if(obj.producto_id != null && obj.producto_id.value == ""){
		alert("Por favor seleccione un producto de la lista");
		obj.producto_id.focus();
	}else if(obj.cantidad != null && obj.cantidad.value == ""){
		alert("Por favor ingrese la cantidad del movimiento");
		obj.cantidad.focus();
	}else if(obj.responsable != null && obj.responsable.value == ""){
		alert("Por favor ingrese el nombre de la persona responsable del movimiento");
		obj.responsable.focus();
	}else{
		ok = true;
	}
	return ok;
}
function confirmPrint(){
				var agree=confirm("Esta seguro de generar la factura, recuerde que si acepta no podra hacer modificaciones posteriores a esta factura ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function confirmPrint_I(){
				var agree=confirm("Esta seguro de generar el Comprobante de Ingreso, recuerde que si acepta no podra hacer modificaciones posteriores a este Comprobante ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function EnterSubmit() { 
if (13 == window.event.keyCode) 
document.encabezado.submit()
}
function checkEnterKey() { 
if (13 == window.event.keyCode) 
document.add.descripcion.value += "<br>"; 
}
function checkEnterKey2() { 
if (13 == window.event.keyCode) 
document.act.descripcion.value += "<br>"; 
}
function enviar(){
document.encabezado.submit()
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function v_ingreso(obj){
	ok  = false;
	if(obj.login != null && obj.login.value == ""){
		alert("No ha ingresado su nombre de usuario");
		obj.login.focus();
	}else if(obj.password != null && obj.password.value == ""){
		alert("No ha ingresado su password / Clave");
		obj.password.focus();
	}else{
		ok = true;
	}
	return ok;
}
function v_reservar(obj){
	ok  = false;
	if(obj.nombre != null && obj.nombre.value == ""){
		alert("No ha ingresado su nombre para la reserva");
		obj.nombre.focus();
	}else if(obj.telefono != null && obj.telefono.value == ""){
		alert("No ha ingresado su telefono para la reserva");
		obj.telefono.focus();
	}else{
		ok = true;
	}
	return ok;
}
function v_buscar(obj){
	ok  = false;
	if(obj.p_apellido != null && obj.p_apellido.value == ""){
		alert("No ha ingresado el primer apellido del bebe a buscar");
		obj.p_apellido.focus();
	}else if(obj.s_apellido != null && obj.s_apellido.value == ""){
		alert("No ha ingresado el segundo apellido del bebe a buscar");
		obj.s_apellido.focus();
	}else{
		ok = true;
	}
	return ok;
}

function v_usuarios(obj){
	ok  = false;
	if(obj.nombre != null && obj.nombre.value == ""){
		alert("No ha ingresado el nombre del usuario");
		obj.nombre.focus();
	}else if(obj.apellidos != null && obj.apellidos.value == ""){
		alert("No ha ingresado apellidos");
		obj.apellidos.focus();
	}else if(obj.perfil != null && obj.perfil.value == ""){
		alert("No ha seleccionado un perfil para el usuario");
		obj.perfil.focus();
	}else if(obj.ciudad != null && obj.ciudad.value == ""){
		alert("No ha seleccionado una ciudad de la lista ");
		obj.ciudad.focus();
	}else if(obj.login != null && obj.login.value == ""){
		alert("No ha ingresado un nombre de usuario valido ");
		obj.login.focus();
	}else if(obj.password != null && obj.password.value == ""){
		alert("No ha ingresado un password valido ");
		obj.password.focus();
	}else if(obj.telefono != null && obj.telefono.value == ""){
		alert("No ha ingresado un numero telefonico ");
		obj.telefono.focus();
	}else if(obj.direccion != null && obj.direccion.value == ""){
		alert("No ha ingresado una direccion ");
		obj.direccion.focus();
	}else if(obj.email != null && obj.email.value == ""){
		alert("No ha ingresado un e-mail");
		obj.email.focus();
	}else if(obj.email.value != ""){
		var ind1, ind2, ind3;
		ind1 = obj.email.value.indexOf('@');
		ind2 = obj.email.value.indexOf('.');
		ind3 = obj.email.value.lastIndexOf('@');
		if ((ind1<=0) || (ind2<=0) || (ind3 != ind1))	{
			alert("El correo electrónico ingresado no es válido");
			obj.email.focus();
		}else{
			ok = true;
		}
	}else{
		ok = true;
	}
	return ok;
}

function v_contacto(obj){
	ok  = false;
	if(obj.nombres != null && obj.nombres.value == ""){
		alert("No ha ingresado su nombre");
		obj.nombres.focus();
	}else if(obj.apellidos != null && obj.apellidos.value == ""){
		alert("No ha ingresado apellidos");
		obj.apellidos.focus();
	}else if(obj.pais != null && obj.pais.value == ""){
		alert("No ha ingresado el pais de origen");
		obj.pais.focus();
	}else if(obj.ciudad != null && obj.ciudad.value == ""){
		alert("No ha ingresado una ciudad de origen ");
		obj.ciudad.focus();
	}else if(obj.ocupacion != null && obj.ocupacion.value == ""){
		alert("No ha ingresado una ocupacion ");
		obj.ocupacion.focus();
	}else if(obj.profesion!= null && obj.profesion.value == ""){
		alert("No ha ingresado su profesion ");
		obj.profesion.focus();
	}else if(obj.medio != null && obj.medio.value == ""){
		alert("Sellecciona de la lista como llegaste a Nosotros ");
		obj.medio.focus();
	}else if(obj.email != null && obj.email.value == ""){
		alert("No ha ingresado un e-mail");
		obj.email.focus();
	}else if(obj.email.value != ""){
		var ind1, ind2, ind3;
		ind1 = obj.email.value.indexOf('@');
		ind2 = obj.email.value.indexOf('.');
		ind3 = obj.email.value.lastIndexOf('@');
		if ((ind1<=0) || (ind2<=0) || (ind3 != ind1))	{
			alert("El correo electrónico ingresado no es válido");
			obj.email.focus();
		}else{
			ok = true;
		}
	}else{
		ok = true;
	}
	return ok;
}
function v_clientes(obj){
	ok  = false;
	if(obj.nombre_bebe != null && obj.nombre_bebe.value == ""){
		alert("No ha ingresado el nombre del bebe");
		obj.nombre_bebe.focus();
	}else if(obj.apellido1 != null && obj.apellido1.value == ""){
		alert("No ha ingresado el primer apellido del bebe");
		obj.apellido1.focus();
	}else if(obj.apellido2 != null && obj.apellido2.value == ""){
		alert("No ha ingresado el segundo apellido del bebe");
		obj.apellido2.focus();
	}else if(obj.direccion != null && obj.direccion.value == ""){
		alert("No ha ingresado  una dirección");
		obj.direccion.focus();
	}else if(obj.telefono != null && obj.telefono.value == ""){
		alert("No ha ingresado telefono ");
		obj.telefono.focus();
	}else if(obj.email != null && obj.email.value == ""){
		alert("No ha ingresado un e-mail");
		obj.email.focus();
	}else if(obj.email.value != ""){
		var ind1, ind2, ind3;
		ind1 = obj.email.value.indexOf('@');
		ind2 = obj.email.value.indexOf('.');
		ind3 = obj.email.value.lastIndexOf('@');
		if ((ind1<=0) || (ind2<=0) || (ind3 != ind1))	{
			alert("El correo electrónico ingresado no es válido");
			obj.email.focus();
		}else{
			ok = true;
		}
	}else{
		ok = true;
	}
	return ok;
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}