ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
dom = ((document.getElementById)&&(!ie4))?true:false;   // ns6 etc.
var xPos=0;
var yPos=0;

if(ns4)	document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = captPosi;
/******************************************************************************/
function captPosi(eve){
	var yMas = window.screen.availHeight - document.body.clientHeight - document.body.topMargin - 20;		
	if(ns4 || dom){
		xPos = eve.pageX;
		yPos = eve.pageY;
	}
	else{
	   xPos = event.x+document.body.scrollLeft - 10;
	   yPos = event.y+document.body.scrollTop + yMas;

	}
}
/******************************************************************************/
function AbrirVentanaXY(url, ancho, alto)
{
	if (ancho == null)
		ancho = 400;

	if (alto == null)
		alto = 300;
	window.open(url, '_blank', 'toolbar=no, location=no, directories=no, status=no, scrollbars=no, resizable=no, copyhistory=no, width=' + ancho + ', height=' + alto + ', left=' + xPos + ',top=' + yPos);
}
/******************************************************************************/
function AbrirVentana(url, ancho, alto)
{
	if (ancho == null)
		ancho = 50;

	if (alto == null)
		alto = 50;

	window.open(url, '_blank', 'toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=no, copyhistory=no, width=' + ancho + ', height=' + alto + ', left=0, top=0');
}

//-----------------------------------------------------------------------
function AbrirVentanaModal(url, ancho, alto)
{
	var lns4 = (document.layers)? true:false;
	var lie4 = (document.all)? true:false;

	if (ancho == null)
		ancho = 400;

	if (alto == null)
		alto = 300;

	if (lie4)
	{
		if (url.indexOf("?") >= 0)
			window.showModalDialog(url+'&flotante=1', null, 'dialogWidth=' + ancho + 'px; dialogHeight=' + alto + 'px');
		else
			window.showModalDialog(url+'?flotante=1', null, 'dialogWidth=' + ancho + 'px; dialogHeight=' + alto + 'px');
	}
	else
	{
		if (url.indexOf("?") >= 0)
			window.open(url+'&flotante=1', '_blank', 'toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=no, copyhistory=no, width=' + ancho + ', height=' + alto + ', left=0, top=0, alwaysRaised=yes');
		else
			window.open(url+'?flotante=1', '_blank', 'toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=no, copyhistory=no, width=' + ancho + ', height=' + alto + ', left=0, top=0, alwaysRaised=yes');
	}
}
//-----------------------------------------------------------------------
function vaciar(campo){
  var objcod;
  var objdes;  
  var objcampo;    
  objcampo = eval('document.formulario.'+campo);  
  if (objcampo == null){
	objcod = eval('document.formulario.cod_'+campo);
	objcod.value ='';
	objdes = eval('document.formulario.des_'+campo);
	objdes.value ='';
  }	
  else objcampo.value='';
}
//-----------------------------------------------------------------------
function Imprimir()
{
	var ns4 = (document.layers)?true:false;
	var ie4 = (document.all)?true:false;

	if (ns4)
		window.print();
	else
	{
		var nombreObjeto = '<object id="idObjeto" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
		document.body.insertAdjacentHTML('beforeEnd', nombreObjeto);
		idObjeto.ExecWB(6, 1);
		idObjeto.outerHTML = '';
	}
}
/******************************************************************************/
function visualizar(img,path){
if (img.length > 0)
   AbrirVentana(path+img,800,600);			
}
/******************************************************************************/
function Localidad(cod_provincia,cod_localidad,localidad){
            this.cod_provincia=cod_provincia;
            this.cod_localidad=cod_localidad;
            this.localidad=localidad;          
}
/******************************************************************************/