function chng(x) {
if(x==0) valact()
if(x==3) document.prterform.elements[4].value=document.prterform.elements[3].value
if(x==4) document.prterform.elements[3].value=document.prterform.elements[4].value
}
function exswap()
{
	return
}
function cons(xx) { botonpres=xx.value }
function closeform()
{
        swapin()
        fld=0
        if(botonpres=="Consultar")
        {
                for(i=0;i<nhd;i++) if( document.prterform.elements[i].value!="") fld=1
                if(fld==0) document.prterform.elements[0].value="*"
                return true
        }
	return true
}
function insert(rrow)
{
row=nhd+nrd*ncd+rrow*(ncd+1)
rw=(document.prterform.elements[row].value)-1
if(document.prterform.elements[row+1].value !="")
if(document.prterform.elements[nhd+(nrd-1)*ncd].value=="")
{
	swapin()
	for(i=nrd-1;i>rw;i--) for (j=0;j<ncd;j++)
	document.prterform.elements[nhd+i*ncd+j].value=document.prterform.elements[nhd+i*ncd+j-ncd].value
	for (j=0;j<ncd;j++) document.prterform.elements[nhd+i*ncd+j].value=""
	swapout()
}
else alert ("NO PERMITE NUEVA INSERCION")
else
{
	swapin()
	for(i=rw; i<nrd-1;i++) for (j=0;j<ncd;j++)
	document.prterform.elements[nhd+i*ncd+j].value=document.prterform.elements[nhd+i*ncd+j+ncd].value
	for (j=0;j<ncd;j++)
	document.prterform.elements[nhd+i*ncd+j].value=""
	swapout()
}
}
function clearform()
{
lreg=nhd+nrd*ncd+lin*(ncd+1)
for (i=0;i<lreg;i++)
{
	document.prterform.elements[i].value=""
	if(document.prterform.elements[i].type=="checkbox")
		document.prterform.elements[i].checked=false
}
document.prterform.elements[i++].disabled=false
document.prterform.elements[i++].disabled=true
document.prterform.elements[0].readOnly=false
tp=0
for (j=i;j< document.prterform.elements.length;j++)
if(document.prterform.elements[j].type=="text") document.prterform.elements[j].value=""
swapout()
}
