
//function per mostrare un layer
function showdiv(id_div) {
	if (document.getElementById(id_div)) {
		document.getElementById(id_div).style.visibility='visible';
	}
	return;
}


//function per nascondere un layer
function hidediv(id_div) {
	if (document.getElementById(id_div)) {
		document.getElementById(id_div).style.visibility='hidden';
	}
	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 eseguire il submit dei form con l'enter
// uso: <input ...  onKeyPress='return submit_on_enter(event)'>
function submit_on_enter_left(event) {
	var code=0;
	if (document.layers) code=event.which;
	else code=event.keyCode;
	if (code==13) {
		document.forms.preLoginForm.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;
		}
		else if(thisObj.getAttribute('type') == 'checkbox'){
			thisObj.className = 'checkbox ' + thisObj.className;
		}
		else if(thisObj.getAttribute('type') == 'radio'){
			thisObj.className = 'radio ' + thisObj.className;
		}
		else if(thisObj.getAttribute('type') == 'button'){
			thisObj.className = 'button ' + thisObj.className;
		}
		else if(thisObj.getAttribute('type') == 'submit'){
			thisObj.className = 'submit ' + thisObj.className;
		}
	}
}

function open_popup(popup_url,popup_name,popup_width,popup_height,popup_toolbar,popup_location,popup_directories,popup_status,popup_menubar,popup_scrollbars,popup_resizable) {
	if (popup_width>screen.availWidth) popup_width=screen.availWidth;
	if (popup_height>screen.availHeight) popup_height=screen.availHeight;
	var winx=(screen.availWidth-popup_width)/4;
	var winy=((screen.availHeight-popup_height)/3);
	if (winx<0 || winx + popup_width > screen.availWidth) winx=0;
	if (winy<0 || winy + popup_height > screen.availHeight) winy=0;
	var conditions="toolbar="+popup_toolbar+",location="+popup_location+",directories="+popup_directories+",status="+popup_status+",menubar="+popup_menubar+",channelmode=no,dependent=no,fullscreen=no,scrollbars="+popup_scrollbars+",resizable="+popup_resizable+",width="+popup_width+",height="+popup_height+",left="+winx+",top="+winy+",screenX="+winx+",screenY="+winy;
	popUp=window.open(popup_url, popup_name, conditions);
	popUp.resizeTo(popup_width,popup_height);
	popUp.focus();
	return;
}

function popup_credits() {
	popup_url 			= "popup/popup_credits.php";
	popup_name 			= "credits";
	popup_width 		= 410;
	popup_height 		= 200;
	popup_toolbar 		= "no";
	popup_location 		= "no";
	popup_directories 	= "no";
	popup_status 		= "yes";
	popup_menubar 		= "no";
	popup_scrollbars 	= "no";
	popup_resizable 	= "yes";
	open_popup(popup_url,popup_name,popup_width,popup_height,popup_toolbar,popup_location,popup_directories,popup_status,popup_menubar,popup_scrollbars,popup_resizable);
}

function popup_privacy() {
	popup_url 			= "resources/privacy.pdf";
	popup_name 			= "privacy";
	popup_width 		= 700;
	popup_height 		= 450;
	popup_toolbar 		= "no";
	popup_location 		= "no";
	popup_directories 	= "no";
	popup_status 		= "yes";
	popup_menubar 		= "no";
	popup_scrollbars 	= "no";
	popup_resizable 	= "yes";
	open_popup(popup_url,popup_name,popup_width,popup_height,popup_toolbar,popup_location,popup_directories,popup_status,popup_menubar,popup_scrollbars,popup_resizable);
}

function popup_zoom(md5) {
	popup_url 			= "popup/popup_zoom.php?v=" + md5;
	popup_name 			= "credits";
	popup_width 		= 1040;
	popup_height 		= 780;
	popup_toolbar 		= "no";
	popup_location 		= "no";
	popup_directories 	= "no";
	popup_status 		= "yes";
	popup_menubar 		= "no";
	popup_scrollbars 	= "yes";
	popup_resizable 	= "yes";
	open_popup(popup_url,popup_name,popup_width,popup_height,popup_toolbar,popup_location,popup_directories,popup_status,popup_menubar,popup_scrollbars,popup_resizable);
}

function popup_how() {
	popup_url 			= "popup/popup_how.php";
	popup_name 			= "how";
	popup_width 		= 480;
	popup_height 		= 500;
	popup_toolbar 		= "no";
	popup_location 		= "no";
	popup_directories 	= "no";
	popup_status 		= "yes";
	popup_menubar 		= "no";
	popup_scrollbars 	= "yes";
	popup_resizable 	= "yes";
	open_popup(popup_url,popup_name,popup_width,popup_height,popup_toolbar,popup_location,popup_directories,popup_status,popup_menubar,popup_scrollbars,popup_resizable);
}




