function doTree(code){
//--------------------------
var theForm = document.forms[0];
theForm.tree.value = code;	
theForm.submit();
}

function doTreeIdx(_code, _name, _idx){
//--------------------------
var theForm = document.forms[0];
var theElm = eval('theForm.'+_name);
theForm.tree.value = _code;	
theElm.value = _idx;	
theForm.submit();
}


function doSubTree(code){
//--------------------------
var theForm = document.forms[0];
theForm.sub_tree.value = code;	
theForm.submit();
}


function doLng(code){
//--------------------------
var theForm = document.forms[0];
theForm.lng.value = code;	
theForm.submit();
}


function doCmd(code){
//--------------------------
var theForm = document.forms[0];
theForm.action.value = code;	
theForm.submit();
}

function doPages(code, pg){
//--------------------------
var theForm = document.forms[0];
var theElm = eval('theForm.'+code);
theElm.value = pg;	
theForm.submit();
}

function doDiv(_code, _type){
//--------------------------
	var theElm = document.getElementById(_code);
	if(_type==1)
		theElm.style.display='block';
	if(_type==0)
		theElm.style.display='none';
}

function chgData( type, fldname ){
//------------------------------------------------------------------
	var theForm = document.forms[0];
	var theDay = eval('theForm.'+fldname+'_d');	
	var theMonth = eval('theForm.'+fldname+'_m');	
	var theYear = eval('theForm.'+fldname+'_y');	
	var theDate = eval('theForm.'+fldname);	
	if(type<2){
		if((theMonth.value=='01')||(theMonth.value=='03')||(theMonth.value=='05')||(theMonth.value=='07')||(theMonth.value=='08')||(theMonth.value=='10')||(theMonth.value=='12')) {
			dtaDays(31, fldname);
		}
		if((theMonth.value=='04')||(theMonth.value=='06')||(theMonth.value=='09')||(theMonth.value=='11')) {
			dtaDays(30, fldname);
		}
		if((theMonth.value=='02')&&(theYear.value!='')){
			if((parseInt(theYear.value)%4)==0){
				dtaDays(29, fldname);
			}else{
				dtaDays(28, fldname);
			} 
		}
	}		
	if(theYear.value==''){
		theMonth.value='';
		theDay.value='';
	}
	theDate.value = theYear.value+'-'+theMonth.value+'-'+theDay.value;
	if(theDate.value=='--')
		theDate.value = ''; 
}

function dtaDays( nr, fldname ){
//----------------------------------------------------	
	var theElement = eval('document.frmAll.'+ fldname +'_d');
	theElement.options.length=0;
	for(i=1;i<=nr;i++){
		if(i<10){	ii = '0'+i; 	}else{ ii = i;} 
		theElement.options[i-1] = new Option(ii, ii);
	}	
}
