	//=================================================================================================================================================================================================
	//==== DICHIARAZIONE DELLE VARIABILI GLOBALI ======================================================================================================================================================
	//=================================================================================================================================================================================================

		var w3c = ( document.getElementById ? true : false ) ;		// true: DOM suported
		var webeditorLOADED_ITA = false ;
		var webeditorLOADED_ENG = false ;
		//var webeditorLOADED_FRA = false ;
		//var webeditorLOADED_DEU = false ;


	//=================================================================================================================================================================================================
	//==== GESTIONE DEI FORM ==========================================================================================================================================================================
	//=================================================================================================================================================================================================

		function formAction( ACTION ) {
			var doAction ;
			var returnValidate ;
			switch ( ACTION ) {
				//------------------------------------------------------------------------------------------------------------------------
				case "SAVE" :			// FORM modulo
					returnValidate = formValidate(document.form_modulo);
					if (returnValidate) {
						print_Loader() ;
						document.form_modulo.submit() ;
					}
					break ;
				//------------------------------------------------------------------------------------------------------------------------
				case "DELETE" :			// FORM modulo
					doAction = true ;
					with (document) {
						doAction = confirm('Sei sicuro di voler procedere con l\'eliminazione?') ;
						if(!doAction) return ;
						if (form_modulo.categoryArea) {
							doAction = confirm(' Attenzione! La cancellazione della Categoria implica l\'eliminazione irreversibile\n della relativa cartella remota e di tutti i suoi file e sottocartelle. \n\n Continuare?') ;
						}
						if(doAction)  form_modulo_delete.submit() ;
					}
					break ;
				//------------------------------------------------------------------------------------------------------------------------
				case "DELETE_LIST" :		// FORM elenco
					var deleteListCHECK = false ;
					with (document.form_elenco) {
						for (var i=0; i < elements.length; i++) {
							if (elements[i].type == 'checkbox' && elements[i].name == 'check_delete') {
								if (elements[i].checked) {
									deleteListCHECK = true ;
									break ;
								}
							}
						}
						if (deleteListCHECK) {
							submit();
						}
					}
					break ;
				//------------------------------------------------------------------------------------------------------------------------
				case "RESET" :			// Reset del FORM modulo
					document.form_modulo_reset.submit() ;
					break ;
				//------------------------------------------------------------------------------------------------------------------------
				case "SEARCH" :			// FORM ricerca
					returnValidate = formValidate(document.form_ricerca);
					if (returnValidate) {
						print_Loader() ;
						document.form_ricerca.submit() ;
					}
					break ;
				//------------------------------------------------------------------------------------------------------------------------
				default :
					//
					break ;
				//------------------------------------------------------------------------------------------------------------------------
			}
		}

	//=================================================================================================================================================================================================
	//==== GESTIONE DEI CHECKBOX DELLE LISTE ==========================================================================================================================================================
	//=================================================================================================================================================================================================

		function selectAllList( ACTION ) {
			with (document.form_elenco) {
				for (var i=0; i < elements.length; i++) {
					if (elements[i].type == 'checkbox' && elements[i].name == 'check_delete') {
						if (ACTION == 'SELECT') {
							elements[i].checked = true;
							document.getElementById("select_button_a").style.display = 'none' ;
							document.getElementById("deselect_button_a").style.display = 'inline' ;
						}
						if (ACTION == 'DESELECT') {
							elements[i].checked = false;
							document.getElementById("deselect_button_a").style.display = 'none' ;
							document.getElementById("select_button_a").style.display = 'inline' ;
						}
					}
				}
			}
		}

	//=================================================================================================================================================================================================
	//==== ELENCO: FUNZIONI PULSANTIERA PAGING ========================================================================================================================================================
	//=================================================================================================================================================================================================

	function paging_test_inputPage(iPAGECOUNT, iPAGECURRENT, PAGEURL, ENABLE_AJAX) {
		var inputPage = document.form_paging.paging_inputPage ;

		if ( isNaN(inputPage.value) || ( (inputPage.value <= 0) || (parseInt(inputPage.value) > iPAGECOUNT) ) )
			inputPage.value = iPAGECURRENT;
		else {
			var returnNoAjax ;
			if (ENABLE_AJAX == 'True')
				returnNoAjax = gotoAjax_List(PAGEURL + '&pgn=' + inputPage.value) ;
			else
				returnNoAjax = true ;

			if (returnNoAjax)
				document.location = PAGEURL + '&pgn=' + inputPage.value ;
		}
		return false;
	}

	//=================================================================================================================================================================================================

	function gotoAjax_List(urlSTRING) {
		var areaID = getVariables['area'] ;
		var tmpDIV_ID ;
		var urlAjax = urlSTRING.replace('default.asp', 'js/ajax/ajax_manager.asp') ;

		urlAjax = urlAjax + '&act_ajax=list'

		var returnNoAjax = ajaxRequest(urlAjax, 'corpo_elenco_div') ;
		//var returnNoAjax = true ;	//AJAX debugger

		return returnNoAjax ;
	}

	//=================================================================================================================================================================================================

	function print_Loader() {
		if ((typeof(document.getElementById("modulo_fieldset")) != "undefined")&&(document.getElementById("modulo_fieldset") != null))	 document.getElementById("modulo_fieldset").style.display = 'none' ;
		if ((typeof(document.getElementById("design_container")) != "undefined")&&(document.getElementById("design_container") != null)) document.getElementById("design_container").style.display = 'none' ;
		if ((typeof(document.getElementById("progressDIV")) != "undefined")&&(document.getElementById("progressDIV") != null))		 document.getElementById("progressDIV").style.display = 'block' ;
	}

	function showMenuPages(MENU_ID) {
		if (document.getElementById("show_pages_list_"+ MENU_ID).style.display == "block") {
			document.getElementById("show_pages_list_"+ MENU_ID).style.display = 'none' ;
			document.getElementById("show_pages_image_"+ MENU_ID).src = "layout/gif/webeditorbar.expand.gif" ;
		} else {
			document.getElementById("show_pages_list_"+ MENU_ID).style.display = 'block' ;
			document.getElementById("show_pages_image_"+ MENU_ID).src = "layout/gif/webeditorbar.collapse.gif" ;
		}
	}

	//=================================================================================================================================================================================================
	//==== ELENCO: ONCLICK SULLA SINGOLA RIGA =========================================================================================================================================================
	//=================================================================================================================================================================================================

	var lastID = "" ;

	function gotoAjax_Module(thisID, elementH, divID, getString) {		//getString facoltativo
		if (elementH == '') elementH = false ;

		if (thisID != '') {
			getString = getString + '&id=' + thisID.substr(1,thisID.length) ;
			if ( (lastID != "") && (document.getElementById(lastID) != null)  && (typeof(document.getElementById(lastID)) != "undefined") ) {
				document.getElementById(lastID).className = "elenco_li" ;
			}
			document.getElementById(thisID).className = "elenco_li_selected" ;
			lastID = thisID ;
		}
		var urlAjax = 'js/ajax/ajax_manager.asp?' + getString + '&act_ajax=module' ;

		var returnNoAjax = ajaxRequest(urlAjax, divID) ;
		//var returnNoAjax = true ;	//AJAX debugger

		if (returnNoAjax)					// Non è possibile interagire con Ajax; visualizza con refresh della pagina
			document.location = 'default.asp?' + getString ;
		else {
			webeditorLOADED_ITA = false ;
			webeditorLOADED_ENG = false ;
			//webeditorLOADED_FRA = false ;
			//webeditorLOADED_DEU = false ;
		}
	}

	//=================================================================================================================================================================================================
	//==== WEBEDITOR ==================================================================================================================================================================================
	//=================================================================================================================================================================================================

	function load_WebEditor( WEBEDITOR_ID ) {
		if (!document.getElementById( WEBEDITOR_ID ))
			return ;

		var oWEBeditor = new WSxEditor( WEBEDITOR_ID ) ;
		oWEBeditor.BasePath = '/admin/webeditor/' ;
		oWEBeditor.Width = '374' ;
		oWEBeditor.Height = '205' ;
		oWEBeditor.Value = '' ;
		oWEBeditor.ToolbarSet = 'Basic' ;
		oWEBeditor.ReplaceTextarea() ;
		webeditorLOADED = true ;
		if (WEBEDITOR_ID == "WEBeditor_ITA")  webeditorLOADED_ITA = true ;
		if (WEBEDITOR_ID == "WEBeditor_ENG")  webeditorLOADED_ENG = true ;
		//if (WEBEDITOR_ID == "WEBeditor_FRA")  webeditorLOADED_FRA = true ;
		//if (WEBEDITOR_ID == "WEBeditor_DEU")  webeditorLOADED_DEU = true ;
	}

	//=================================================================================================================================================================================================

	function showWebEditor( WEBEDITOR_ID ) {
		if ( document.getElementById( WEBEDITOR_ID ).disabled == true ) return ;
		if (WEBEDITOR_ID == "WEBeditor_ITA")  chkLOADED = webeditorLOADED_ITA ;
		if (WEBEDITOR_ID == "WEBeditor_ENG")  chkLOADED = webeditorLOADED_ENG ;
		//if (WEBEDITOR_ID == "WEBeditor_FRA")  chkLOADED = webeditorLOADED_FRA ;
		//if (WEBEDITOR_ID == "WEBeditor_DEU")  chkLOADED = webeditorLOADED_DEU ;

		if (!chkLOADED) {
			load_WebEditor( WEBEDITOR_ID ) ;
			document.getElementById( WEBEDITOR_ID +"_showbar_img" ).src = "layout/gif/webeditorbar.collapse.gif" ;
		} else {
			if (document.getElementById( WEBEDITOR_ID ).style.display == "block") {
				document.getElementById( WEBEDITOR_ID ).style.display = 'none' ;
				document.getElementById( WEBEDITOR_ID +"___Frame" ).style.display = 'block' ;
				document.getElementById( WEBEDITOR_ID +"_showbar_img" ).src = "layout/gif/webeditorbar.collapse.gif" ;
			} else {
				document.getElementById( WEBEDITOR_ID ).style.display = 'block' ;
				document.getElementById( WEBEDITOR_ID +"___Frame").style.display = 'none' ;
				document.getElementById( WEBEDITOR_ID +"_showbar_img" ).src = "layout/gif/webeditorbar.expand.gif" ;
			}
		}
	}

	//=================================================================================================================================================================================================
	//==== CONTROLLI INSERIMENTO CAMPI INPUT ==========================================================================================================================================================
	//=================================================================================================================================================================================================

	function isDigitAlphaNumber(e) {
		var returnValue = false ;
		if (typeof(e.which) == "undefined") {
			//## Explorer
			if ((e.keyCode >= 48) && (e.keyCode <= 57))	returnValue = true ;		// 0-9
			if ((e.keyCode >= 65) && (e.keyCode <= 90))	returnValue = true ;		// A-Z
			if ((e.keyCode >= 97) && (e.keyCode <= 122))	returnValue = true ;		// a-z
			if (e.keyCode == 13)				returnValue = true ;		// RETURN
			if (e.keyCode == 8)				returnValue = true ;		// BACKSPACE
		} else {
			//## Firefox
			if ((e.which >= 48) && (e.which <= 57))		returnValue = true ;		// 0-9
			if ((e.which >= 65) && (e.which <= 90))		returnValue = true ;		// A-Z
			if ((e.which >= 97) && (e.which <= 122))	returnValue = true ;		// a-z
			if (e.which == 13)				returnValue = true ;		// RETURN
			if (e.which == 8) 				returnValue = true ;		// BACKSPACE
			if ((e.keyCode >= 35) && (e.keyCode <= 40))	returnValue = true ;		// FRECCIE, INIZIO, FINE
			if (e.keyCode == 9)				returnValue = true ;		// TAB
			if (e.keyCode == 46)				returnValue = true ;		// CANC
			if (e.keyCode == 116)				returnValue = true ;		// F5
		}
		return returnValue ;
	}

	//=================================================================================================================================================================================================

	function isDigitNumber(e) {
		var returnValue = false ;
		if (typeof(e.which) == "undefined") {
			//## Explorer
			if ((e.keyCode >= 48) && (e.keyCode <= 57))	returnValue = true ;		// 0-9
			if (e.keyCode == 46)				returnValue = true ;		// .
			if (e.keyCode == 13)				returnValue = true ;		// RETURN
			if (e.keyCode == 8)				returnValue = true ;		// BACKSPACE
		} else {
			//## Firefox
			if ((e.which >= 48) && (e.which <= 57))		returnValue = true ;		// 0-9
			if (e.which == 46)				returnValue = true ;		// .
			if (e.which == 13)				returnValue = true ;		// RETURN
			if (e.which == 8) 				returnValue = true ;		// BACKSPACE
			if ((e.keyCode >= 35) && (e.keyCode <= 40))	returnValue = true ;		// FRECCIE, INIZIO, FINE
			if (e.keyCode == 9)				returnValue = true ;		// TAB
			if (e.keyCode == 46)				returnValue = true ;		// CANC
			if (e.keyCode == 116)				returnValue = true ;		// F5
		}
		return returnValue ;
	}

	//=================================================================================================================================================================================================
	//=================================================================================================================================================================================================

	function display_position_order(SELECT_VALUE) {
		if (SELECT_VALUE == "no") {
			document.getElementById("priorita_no").style.display  = 'inline';
			document.getElementById("priorita_2nd").style.display = 'none';
			document.getElementById("footer").options[0].selected = true ;
		} else {
			document.getElementById("priorita_no").style.display  = 'none';
			document.getElementById("priorita_2nd").style.display = 'inline';
		}
	}
	function chk_footer_value(SELECT_VALUE) {
		if ((SELECT_VALUE == "no")&&(document.getElementById("positionmenu").value == "no")) {
			document.getElementById("footer").options[0].selected = true ;
		}
	}

	function goto_slider_area(AREA_VALUE) {
		if (AREA_VALUE == "MAIN")  document.getElementById("gotoMAINslider").value = 1;
		if (AREA_VALUE == "SUB")   document.getElementById("gotoSUBslider").value = 1;
		formAction('SAVE');
	}

	function get_file_url(FORM_REFERENCE, MAIN_FOLDER, PATH_STRING, FILE_TYPE, IMG_WIDTH, IMG_HEIGHT) {
		return fileBrowserOpener(true, 'slider', FORM_REFERENCE, FILE_TYPE, MAIN_FOLDER, PATH_STRING, '', IMG_WIDTH, IMG_HEIGHT);
	}

	function show_content(THIS_ID) {
		data_area = document.getElementById( "contenuti_"+ THIS_ID ) ;

		if (data_area.style.display == "inline") {
			data_area.style.display = "none" ;
		} else {
			data_area.style.display = "inline" ;
		}
	}

	function switch_allega_file(TYPE_VALUE, THIS_ID) {
		if (TYPE_VALUE == "si") {
			document.getElementById("file_allegato_"+THIS_ID).style.display = "inline" ;
			document.getElementById("immagine_testata_"+THIS_ID).style.display = "none" ;
		} else {
			document.getElementById("file_allegato_"+THIS_ID).style.display = "none" ;
			document.getElementById("immagine_testata_"+THIS_ID).style.display = "inline" ;
		}
	}
	function switch_maggiori_info(TYPE_VALUE, THIS_ID) {
		if (TYPE_VALUE == "file") {
			document.getElementById("file_area_"+THIS_ID).style.display = "inline" ;
			document.getElementById("url_area_"+THIS_ID).style.display = "none" ;
		} else {
			document.getElementById("file_area_"+THIS_ID).style.display = "none" ;
			document.getElementById("url_area_"+THIS_ID).style.display = "inline" ;
		}
	}

	function changePassword() {
		if (document.getElementById("inputPassword").style.display == 'none') {
			document.getElementById("buttonPassword").style.display = 'none' ;
			document.getElementById("inputPassword").style.display = 'block' ;
			document.getElementById("Password").disabled = false ;
			document.form_modulo.Password.focus() ;
		} else {
			document.getElementById("buttonPassword").style.display = 'block' ;
			document.getElementById("inputPassword").style.display = 'none' ;
			document.getElementById("Password").disabled = true ;
		}
	}
	//=================================================================================================================================================================================================
	//=================================================================================================================================================================================================
