var SH=null;
var BUT=null;

function show_form(id)
{
if (!SH)

		{
	var FRM=document.getElementById('rq_form');
	FRM=FRM.cloneNode(true);
	FRM.setAttribute('id', null);
	var cell=document.getElementById('cell_'+id);
	cell.appendChild(FRM);
	FRM.style.display='block';
	FRM.id_value=id;
	FRM.q=FRM.getElementsByTagName('input')[0];
	SH=FRM;
		}

return false;
}

function close_rq()
{
	SH.parentNode.removeChild(SH);
	SH=null;
}

function show_form_a(but)
{
	BUT=but;
	but.style.display="none";
	var FRM=document.getElementById('rq_form');
	FRM.style.display='block';
return false;
}

function close_form()
{
	var FRM=document.getElementById('rq_form');
	FRM.style.display="none";
	BUT.style.display="block";
	BUT=null;
}

function go_save()
{
	var frm=document.getElementById('form_to_save');
	var _id=document.createElement('input');
	_id.setAttribute('type', 'hidden');
	_id.setAttribute('name', 'id');
	_id.setAttribute('value', SH.id_value);

	var _q=document.createElement('input');
	_q.setAttribute('type', 'hidden');
	_q.setAttribute('name', 'q');
	_q.setAttribute('value', SH.q.value);


	frm.appendChild(_id);
	frm.appendChild(_q);

	frm.submit();
	return false;
}

function chk_int1(inp)
{
		if (isNaN(inp.value))
				{
				if (inp.value=='') {} else {inp.value=inp.ch_val||'';}
				} else if (parseFloat(inp.value)==parseInt(inp.value))
				{
				inp.ch_val=inp.value;
				//if (inp.value>10) {inp.value=10; inp.ch_val=10}
				} else
				{
				if (inp.value=='') {} else {inp.value=inp.ch_val||'';}
				}
}

function go_save_a()
{
var frm=document.getElementById('form_to_save');
frm.submit();
return false;
}
