
// function per nascondere il loading
function hideLoading() {
	if (document.getElementById('loading')) {
		document.getElementById('loading').style.visibility='hidden';
	}
	return;
}

// function per settare il nome html della finestra
function set_window_name() {
	window.name='vb_zero';
	return;
}

// function per eseguire il submit dei form con l'enter
// uso: <input ...  onKeyPress='return submit_on_enter(event)'>
function submit_on_enter(event) {
	var code=0;
	if (document.layers) code=event.which;
	else code=event.keyCode;
	if (code==13) {
//			document.search_form.search_submit.click();
		document.forms.login_form.submit();
		return false;
	}
}


// function per la formattazione degli <input type='text'>
function formatForms() {
	if (!document.getElementsByTagName) return;
	var oi=0;
	var thisObj;
	var objs = document.getElementsByTagName("input");
	for (oi=0;oi<objs.length;oi++) {
		thisObj = objs[oi];
		if(thisObj.getAttribute('type') == 'text'){
			thisObj.className = 'input_text ' + thisObj.className;
		}
		else if(thisObj.getAttribute('type') == 'password'){
			thisObj.className = 'input_password ' + thisObj.className;
		}
	}
}

function popup_print() {
	var url_new='popup_print.php?&print=true';
	var nome_new='stampa';
	var w=530;
	var h=600;
	if (w>screen.availWidth) w=screen.availWidth;
	if (h>screen.availHeight) h=screen.availHeight;
	var winx=(screen.availWidth-w)/4;
	var winy=((screen.availHeight-h)/3);
	if (winx<0) winx=0;
	if (winy<0) winy=0;
	var condizioni="toolbar=yes,location=no,directories=no,status=yes,menubar=yes,channelmode=no,dependent=no,fullscreen=no,scrollbars=yes,resizable=yes,width="+w+",height="+h+",left="+winx+",top="+winy+",screenX="+winx+",screenY="+winy;
	popUp=window.open(url_new, nome_new, condizioni);
	popUp.resizeTo(w,h);
	popUp.focus();
	return;
}

function popup_credits() {
	var url_new='popup_credits.php';
	var nome_new='credits';
	var w=410;
	var h=200;
	if (w>screen.availWidth) w=screen.availWidth;
	if (h>screen.availHeight) h=screen.availHeight;
	var winx=(screen.availWidth-w)/4;
	var winy=((screen.availHeight-h)/3);
	if (winx<0) winx=0;
	if (winy<0) winy=0;
	var condizioni="toolbar=no,location=no,directories=no,status=yes,menubar=no,channelmode=no,dependent=no,fullscreen=no,scrollbars=no,resizable=yes,width="+w+",height="+h+",left="+winx+",top="+winy+",screenX="+winx+",screenY="+winy;
	popUp=window.open(url_new, nome_new, condizioni);
	popUp.resizeTo(w,h);
	popUp.focus();
	return;
}

function popup_inst_tree_rebuilder() {
	var url_new='inst_tree_rebuilder.php';
	var nome_new='tree_rebuilder';
	var w=600;
	var h=200;
	if (w>screen.availWidth) w=screen.availWidth;
	if (h>screen.availHeight) h=screen.availHeight;
	var winx=(screen.availWidth-w)/4;
	var winy=((screen.availHeight-h)/3);
	if (winx<0) winx=0;
	if (winy<0) winy=0;
	var condizioni="toolbar=no,location=no,directories=no,status=yes,menubar=no,channelmode=no,dependent=no,fullscreen=no,scrollbars=no,resizable=yes,width="+w+",height="+h+",left="+winx+",top="+winy+",screenX="+winx+",screenY="+winy;
	popUp=window.open(url_new, nome_new, condizioni);
	popUp.resizeTo(w,h);
	popUp.focus();
	return;
}

