function chng(x) {
if(x==0) valact()
}
//function exswap()
//{
	//return
//}
function cons(xx) { botonpres=xx.value }
function insert(rrow)
{
row=nhd+nrd*ncd+rrow*(ncd+1)
rw=(document.textaform.elements[row].value)-1
if(document.textaform.elements[row+1].value !="")
if(document.textaform.elements[nhd+(nrd-1)*ncd].value=="")
{
	swapin()
	for(i=nrd-1;i>rw;i--) for (j=0;j<ncd;j++)
	document.textaform.elements[nhd+i*ncd+j].value=document.textaform.elements[nhd+i*ncd+j-ncd].value
	for (j=0;j<ncd;j++) document.textaform.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.textaform.elements[nhd+i*ncd+j].value=document.textaform.elements[nhd+i*ncd+j+ncd].value
	for (j=0;j<ncd;j++)
	document.textaform.elements[nhd+i*ncd+j].value=""
	swapout()
}
}
function clearform()
{
lreg=nhd+nrd*ncd+lin*(ncd+1)
for (i=0;i<lreg;i++)
{
	document.textaform.elements[i].value=""
	if(document.textaform.elements[i].type=="checkbox")
		document.textaform.elements[i].checked=false
}
document.textaform.elements[i++].disabled=false
document.textaform.elements[i++].disabled=true
document.textaform.elements[0].readOnly=false
tp=0
for (j=i;j< document.textaform.elements.length;j++)
if(document.textaform.elements[j].type=="text") document.textaform.elements[j].value=""
swapout()
}
fld=location.href.split("?").slice(-1)
//alert(window.opener.document.cotizform.elements[fld/1+1].value)
document.textaform.elements[0].value=descr[window.opener.document.cotizform.elements[fld].value]
document.textaform.elements[1].value=window.opener.document.cotizform.elements[(fld/1+1)].value
mynew=window.opener.document.cotizform.elements[(fld/1+3)].value
b=mynew.split("|")
mynew=b[0]
for (i=1;i<b.length;i++) mynew=mynew+"\r"+b[i]
document.textaform.elements[2].value=mynew
function closeform()
{
	mynew=""
	mystring=document.textaform.elements[2].value
	for (i=0;i<mystring.length;i++)
	{
		if( 10 == mystring.charCodeAt(i)) mynew=mynew + "|"
		else mynew=mynew + mystring.charAt(i)
	}
		
	//alert(window.opener.document.cotizform.elements[(fld/1+3)].name)
	window.opener.document.cotizform.elements[(fld/1+3)].value=mynew
        self.close()
}
