function jsMainMenu(id, action){
	if(confirm("Sei sicuro di voler proseguire?")){
	window.location = 'adminPages_TreeMainEXEC.asp?sOp='+action+'&ID='+id;
	}
}
function jsSubMenu(id, action){
	if(confirm("Sei sicuro di voler proseguire?")){
	window.location = 'adminPages_TreeSubEXEC.asp?sOp='+action+'&ID='+id;
	}
}
function jsPages(id, idPlus, fileType, action){
	if(confirm("Sei sicuro di voler proseguire?")){
	window.location = 'adminPagesEXEC.asp?sOp='+action+'&id='+id+'&fileType='+fileType+'&idPlus='+idPlus;
	}
}
function jsPagesList(id, idPlus, fileType, action){
	if(confirm("Sei sicuro di voler proseguire?")){
	window.location = 'adminPagesListEXEC.asp?sOp='+action+'&id='+id+'&fileType='+fileType+'&idPlus='+idPlus;
	}
}
function jsPagesListElements(id, IdElement, idPlus, fileType, action, subMenu){
	if(confirm("Sei sicuro di voler proseguire?")){
	window.location = 'adminPagesListElementsEXEC.asp?sOp='+action+'&id='+id+'&fileType='+fileType+'&idPlus='+idPlus+'&IdElement='+IdElement+'&subMenu='+subMenu;
	}
}
function jsHome(id, idPlus, fileType, action){
	if(confirm("Sei sicuro di voler proseguire?")){
	window.location = 'adminHomeEXEC.asp?sOp='+action+'&id='+id+'&fileType='+fileType+'&idPlus='+idPlus;
	}
}
function jsUser(id, action){
	if(confirm("Sei sicuro di voler proseguire?")){
	window.location = 'adminUsersEXEC.asp?sOp='+action+'&ID='+id;
	}
}
function jsFaq(id, idPlus, fileType, action){
	if(confirm("Sei sicuro di voler proseguire?")){
	window.location = 'adminFaqEXEC.asp?sOp='+action+'&id='+id+'&fileType='+fileType+'&idPlus='+idPlus;
	}
}
function jsNL(id, idPlus, fileType, action){
	if(confirm("Sei sicuro di voler proseguire?")){
	window.location = 'adminNLEXEC.asp?sOp='+action+'&id='+id+'&fileType='+fileType+'&idPlus='+idPlus;
	}
}
function jsNLSend(id, action){
	if(confirm("Sei sicuro di voler proseguire?")){
	window.location = 'adminNLSend.asp?sOp='+action+'&id='+id;
	}
}
function jsLink(id, idPlus, fileType, action){
	if(confirm("Sei sicuro di voler proseguire?")){
	window.location = 'adminLinksEXEC.asp?sOp='+action+'&id='+id+'&fileType='+fileType+'&idPlus='+idPlus;
	}
}
function jsProposal(id, action){
	if(confirm("Sei sicuro di voler proseguire?")){
	window.location = 'adminRequestInfoEXEC.asp?sOp='+action+'&id='+id;
	}
}
/**********************************************************************
   Validazione di una data passata in un unico campo 
***********************************************************************/
function isDateString(dateStr) {
	var datePat = /^(\d{1,2})(\/)(\d{1,2})(\/)(\d{4})$/;
    var matchArray = dateStr.match(datePat); // is the format ok?
	var TipoDiErrore = '';
    if (matchArray == null) {
		return false;
    }
   day = matchArray[1]; // parse date into variables
   month = matchArray[3]; 
   year = matchArray[5];
    if (month < 1 || month > 12) { // check month range
		return false;
    }
    if (day < 1 || day > 31) {
        return false;
    }
    if ((month==4 || month==6 || month==9 || month==11) && day==31) {
        return false;
    }
    if (month == 2) { // check for february 29th
        var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
        if (day > 29 || (day==29 && !isleap)) {
            return false;
        }
    }
    return true; // date is valid
}

/**********************************************************************
   Controllo se campo passato è un anno valido compreso fra 1900 e oggi
***********************************************************************/
function isYear (s) {
		var d;
		d = new Date();
		var yyyy = d.getFullYear()
		if ((notNull(s)) && (notBlank(s)) && (isSize(s, 4)) && (!isNaN(s)) && (isInRange(s, 1900, yyyy)) ) { 
			return true; 
		} else { 
			return false;
		}
}

/*************************************************************
	Controllo del Codice Fiscale - solo a livello di sintassi
**************************************************************/
	function Trim(stringa)
	   {
	   reTrim=/\s+$|^\s+/g;
	   return stringa.replace(reTrim,"");
	   }
	function isCodFisc(cod_fisc)
	   {
	   var re = /^[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]$/;
	   Codice=Trim(cod_fisc.toUpperCase());
		return re.test(Codice)
	   }

/*************************************************************

	varie
	
**************************************************************/

	   
	function confirmLink( sMessage, sUrl ) {
		//alert( sMessage+'\n'+sUrl );
		if (confirm(sMessage)) window.navigate(sUrl);
	}

	function ShowHideElement( sObjectId ) {
		var oObj = document.getElementById(sObjectId);
		if (oObj.style.display=='') { oObj.style.display='none' }
		else { oObj.style.display='' }
	}
	
	function lyChange( sId ) {
		var oNote = document.getElementById('nodo_'+sId);
		if (oNote.style.display=="none") { oNote.style.display='' }
		else { oNote.style.display="none" }
	}
	
	function todayDate(){
	   var d, s = "";          
	   d = new Date();
	   var giorno, mese, anno;
	   giorno = d.getDate();
	   if (giorno.toString().length <= 1) {
		giorno = '0' + giorno;
	   }  
	   mese = d.getMonth() + 1;
	   if (mese.toString().length <= 1) {
		mese = '0' + mese;
	   }  
	   anno = d.getYear();
	   
	   s += giorno + "/";                   
	   s += mese + "/";            
	   s += anno;                         
	   return(s);                               
	}
	
	function calendarOnClick(obj){
		if (notBlank(obj.value)) {
			if (!isDateString(obj.value)) {
				obj.value = todayDate();
			}
		}
	}
	
	// sostituisce , con .
	function replaceComma( obj ){
	   var r, re;                    
	   var ss = obj.value;
	   re = new RegExp(",");
	   obj.value = ss.replace(re, ".");    
	   return(obj.value);                   
	}
	
	function isBoxChecked(obj) {
		if (obj.length != undefined ) {
			for (var i=0; i < obj.length ;i++) {
				if (obj[i].checked) return true;
			}
		} else {
			if (obj.checked) return true;
		}
	}
	
	function moveCheckedValues(obj1, obj2){
		obj2.value = '';
		if (obj1.length != undefined) {
			for (var i=0; i < obj1.length ;i++) {
				if (obj1(i).checked) obj2.value += obj1(i).value + ",";
			}
		} else {
			if (obj1.checked) obj2.value += obj1.value + ",";
		}
	}

	function noHtml(txt) {
		a = txt.indexOf('<');
		b = txt.indexOf('>');
		len = txt.length;
		c = txt.substring(0, a);
		if(b == -1) {
		   b = a;
		}
		d = txt.substring((b + 1), len);
		txt = c + d;
		cont = txt.indexOf('<');
		if (cont != -1) {
		  txt = noHtml(txt);
		}
		return txt;
	 }

function HotKeyMenu(e, hotkey, url)
{
	
	var key = window.event ? e.keyCode : e.which;
	var keychar = String.fromCharCode(key);
	var test = String.fromCharCode(hotkey);

//	alert(key+' keychar='+keychar);
	//if(hotkey==1){
//		keychar='?';	
//	}
	
	
//	alert(key);
	
	
	if( key==9786 && hotkey==1){
		document.location=url;
	}
	
	if( key==9787 && hotkey==2){
		document.location=url;
	}
	
	if( key==9829 && hotkey==3){
		document.location=url;
	}
	
	if( key==9830 && hotkey==4){
		document.location=url;
	}
	if( key==9827 && hotkey==5){
		document.location=url;
	}
	if( key==9824 && hotkey==6){
		document.location=url;
	}
	if( key==8226 && hotkey==7){
		document.location=url;
	}
	if( key==9688 && hotkey==8){
		document.location=url;
	}
	if( key==9675 && hotkey==9){
		document.location=url;
	}
	if( key==9689 && hotkey==10){
		document.location=url;
	}
	
	if( key==9794 && hotkey==11){
		document.location=url;
	}
	if( key==9792 && hotkey==12){
		document.location=url;
	}
	if( key==9834 && hotkey==13){
		document.location=url;
	}
	if( key==9835 && hotkey==14){
		document.location=url;
	}
	if( key==9788 && hotkey==15){
		document.location=url;
	}
	if( key==9658 && hotkey==16){
		document.location=url;
	}
	if( key==9668 && hotkey==17){
		document.location=url;
	}
	if( key==8597 && hotkey==18){
		document.location=url;
	}
	if( key==8252 && hotkey==19){
		document.location=url;
	}
	if( key==182 && hotkey==20){
		document.location=url;
	}
	//if(keychar==hotkey){
//
//			document.location=url;
//	}

	//alert(key+' keychar='+keychar);
	//reg = /\d/;
	//return !reg.test(keychar);
}

function Numerico(ogg){
		if(isNaN(ogg)==true || ogg>20 || ogg==5 || ogg==15){
			alert("Il Campo deve essere numerico e compreso da 1 a 20 escluso il 5 e il 15.");
			return;
		}
}
