// JavaScript Document
function trim(stringa){
    while (stringa.substring(0,1) == ' '){
        stringa = stringa.substring(1, stringa.length);
    }
    while (stringa.substring(stringa.length-1, stringa.length) == ' '){
        stringa = stringa.substring(0,stringa.length-1);
    }
    return stringa;
}

function toggle(id) {
	var img=document.getElementById('img_'+id);
	if(document.getElementById(id).style.display=='none') {
		img.src='/images/icon_minus.gif';
		document.getElementById(id).style.display='';
	} else {
		img.src='/images/icon_plus.gif';
		document.getElementById(id).style.display='none';
	}
}

function closeNex(aobj) {
	trobj=aobj.parentNode.parentNode;
	var nex=trobj.nextSibling;
	var img=aobj.firstChild;
// 	for (i=0;i<100;i++) {
	while (true) {
// 		debugger;
		if (nex){
			if (nex.firstChild.tagName=='TD') {
				if (nex.style.display=='none') {
					nex.style.display='';
					img.src='/images/icon_minus.gif';
				} else {
	// 			if (nex.style.display=='') {
					nex.style.display='none';
					img.src='/images/icon_plus.gif';
				}
				nex=nex.nextSibling;
			} else {
				break;
			}
		} else {
			break;
		}
	}
}
function searchform(el) {
	if(document.getElementById('professione').value!='0') {
		if(document.getElementById('check2').checked) {
			el.action="ricerca_avanzata.php";
			el.submit();
			return true;
		} else {
			el.action="ricerca.php";
			el.submit();
			return true;
		}
	} else {
		alert('Seleziona una professione.');
		return false;
	}
}

function ajguide(text,elo) {
	if(text!='') {
		var offL = 200;
		var offT = 0;
		var ciko = document.getElementById('guide');
		ciko.style.display='block';
			
		var pos = _bsn.DOM.getPos(elo);
		ciko.style.left = ( pos.x + offL ) + "px";
		ciko.style.top 	= ( pos.y + offT ) + "px";
	
		ciko.innerHTML = "<strong>Guida in Linea</strong><br />"+text;
	}
}

function ajhideguide(guide) {
	var ciko = document.getElementById(guide);
	ciko.style.display='none';
}

visibile = 'tiporicerca_1';
function showonly(id) {
// 	alert(id);
	document.getElementById(visibile).style.display='none';
	document.getElementById(id).style.display='';
	visibile=id;
}

function jumpto(val, id, url) {
	document.location = url+'/admin/action.php?id='+id+'&newtype='+val+'&mode=edit';
}
