
function showChilds(tree,id){
	if(document.getElementById('tr_'+tree+'_'+id).style.display!='inline'){
		try{document.getElementById('tr_'+tree+'_'+id).style.display='inline';}catch(e){}
		try{document.getElementById('img_'+tree+'_'+id).src='../img/minus.gif';}catch(e){}
	}
	else{
		try{document.getElementById('tr_'+tree+'_'+id).style.display='none';}catch(e){}
		try{document.getElementById('img_'+tree+'_'+id).src='../img/plus.gif';}catch(e){}
	}
}



function treeAction(transId, nodeId){
	/*
	arrGet=new Array();
	
	try{
		arrGet=parseGET();
	}catch(e){}
	
	setGetVar(arrGet,'type_vi',transId);
	setGetVar(arrGet,'type_id',nodeId);
	//arrGet['id']=nodeId;
	document.location=getUrl(arrGet);
	*/
	
	document.location.href  = "?action=imob&type_vi=" + transId + "&type_id=" + nodeId ;
}


function parseGET(){
	sUrl=document.location.href;
	arrUrl=sUrl.split('?');
	if(arrUrl.length<2)return null;
	sGET=arrUrl[1];
	arrGet=sGET.split('&');
	_GET=new Array();

	for(i=0;i<arrGet.length;i++){
		GetVar=new Object();
		
		sVar=arrGet[i];
		if(Trim(sVar.split('=')[0]).length>0 && Trim(sVar.split('=')[1]).length>0){
			GetVar.key=Trim(sVar.split('=')[0]);
			GetVar.value=Trim(sVar.split('=')[1]);
			_GET[_GET.length]=GetVar;
		}

		
	}
	return _GET;
}

function setGetVar(arr, key, value){
	//debugger;
	found=false;
	for(i=0;i<arr.length;i++){
		if(arr[i]['key']==key){
			found=true;
			tempObj=new Object();
			tempObj.key=key;
			tempObj.value=value;

			arr[i]=tempObj;
			return arr;
		}

	}
	if(!found){
		tempObj=new Object();
		tempObj.key=key;
		tempObj.value=value;

		arr[arr.length]=tempObj;
	}
}


function getUrl(arrVars){
	//debugger
	sAddress=document.location.href.split('?')[0]+'?';
	for(i=0;i<arrVars.length;i++){
		sAddress+=arrVars[i]['key']+"="+arrVars[i]['value']+"&";
	}
	
	return sAddress;
}

function Trim(TRIM_VALUE){
	if(TRIM_VALUE.length < 1){
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE==""){
		return "";
	}
	else{
		return TRIM_VALUE;
	}
} //End Function

function RTrim(VALUE){
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
		return"";
	}
	var iTemp = v_length -1;

	while(iTemp > -1){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;

	} //End While
	return strTemp;

} //End Function

function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";

	var iTemp = 0;

	while(iTemp < v_length){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp = iTemp + 1;
	} //End While
	return strTemp;
} //End Function



function submitParam(act,val){
	oFrm=document.createElement('form');
	oFrm.action=document.location.href;
	oFrm.method='POST';
	oHidden=document.createElement('input');
	oHidden.type='hidden';
	oHidden.name=act;
	oHidden.value=val;
	oFrm.append(oFrm);
	document.body.append(oFrm);
	oFrm.submit();
}
