// JavaScript Document
	
	var undefined;
	
	// *************************************************************
	// *************************************************************
	// ******************  BROWSER SNIFFER *************************
	// *************************************************************
	// *************************************************************
		var exclude=1;
		var agt=navigator.userAgent.toLowerCase();
		var win=0;var mac=0;var lin=1;
		if(agt.indexOf('win')!=-1){win=1;lin=0;}
		if(agt.indexOf('mac')!=-1){mac=1;lin=0;}
		var lnx=0;if(lin){lnx=1;}
		var ice=0;
		var ie=0;var ie4=0;var ie5=0;var ie6=0;var com=0;var dcm;
		var op5=0;var op6=0;var op7=0;
		var ns4=0;var ns6=0;var ns7=0;var mz7=0;var kde=0;var saf=0;
		if(typeof navigator.vendor!="undefined" && navigator.vendor=="KDE"){
			var thisKDE=agt;
			var splitKDE=thisKDE.split("konqueror/");
			var aKDE=splitKDE[1].split("; ");
			var KDEn=parseFloat(aKDE[0]);
			if(KDEn>=2.2){
				kde=1;
				ns6=1;
				exclude=0;
				}
			}
		else if(agt.indexOf('webtv')!=-1){exclude=1;}
		else if(typeof window.opera!="undefined"){
			exclude=0;
			if(/opera[\/ ][5]/.test(agt)){op5=1;}
			if(/opera[\/ ][6]/.test(agt)){op6=1;}
			if(/opera[\/ ][7-9]/.test(agt)){op7=1;}
			}
		else if(typeof document.all!="undefined"&&!kde){
			exclude=0;
			ie=1;
			if(typeof document.getElementById!="undefined"){
				ie5=1;
				if(agt.indexOf("msie 6")!=-1){
					ie6=1;
					dcm=document.compatMode;
					if(dcm!="BackCompat"){com=1;}
					}
				}
			else{ie4=1;}
			}
		else if(typeof document.getElementById!="undefined"){
			exclude=0;
			if(agt.indexOf("netscape/6")!=-1||agt.indexOf("netscape6")!=-1){ns6=1;}
			else if(agt.indexOf("netscape/7")!=-1||agt.indexOf("netscape7")!=-1){ns6=1;ns7=1;}
			else if(agt.indexOf("gecko")!=-1){ns6=1;mz7=1;}
			if(agt.indexOf("safari")!=-1 || (typeof document.childNodes!="undefined" && typeof document.all=="undefined" && typeof navigator.taintEnabled=="undefined")){mz7=0;ns6=1;saf=1;}
			}
		else if((agt.indexOf('mozilla')!=-1)&&(parseInt(navigator.appVersion)>=4)){
			exclude=0;
			ns4=1;
			if(typeof navigator.mimeTypes['*']=="undefined"){
				exclude=1;
				ns4=0;
				}
			}
		if(agt.indexOf('escape')!=-1){exclude=1;ns4=0;}
		if(typeof navigator.__ice_version!="undefined"){exclude=1;ie4=0;}
	
	// *************************************************************
	// *************************************************************
	// ******************  BROWSER SNIFFER *************************
	// *************************************************************
	// *************************************************************

	
	function jsArticoli(ID, sLang, sOp){
		if(confirm("Sei sicuro di voler proseguire?")){
		window.location = 'adminStampaEXEC.asp?sOp='+sOp+'&ID='+ID+'&sLang='+sLang;
		}
	}
	function jsArticoliCat(ID, sOp){
		if(confirm("Sei sicuro di voler proseguire?")){
		window.location = 'adminStampaCATExec.asp?sOp='+sOp+'&ID='+ID;
		}
	}
	
	function jsComunicati(ID, sLang, sOp){
		if(confirm("Sei sicuro di voler proseguire?")){
		window.location = 'adminComunicatiEXEC.asp?sOp='+sOp+'&ID='+ID+'&sLang='+sLang;
		}
	}
	
	function jsKuminda(ID, IdImg, fileType, sOp){
		if(confirm("Sei sicuro di voler proseguire?")){
		window.location = 'adminKumindaEXEC.asp?sOp='+sOp+'&ID='+ID+'&IdImg='+IdImg+'&fileType='+fileType;
		}
	}
	
	function jsThematic(ID, IdImg, fileType, sOp){
		if(confirm("Sei sicuro di voler proseguire?")){
		window.location = 'adminThematicEXEC.asp?sOp='+sOp+'&ID='+ID+'&IdImg='+IdImg+'&fileType='+fileType;
		}
	}
	function jsExpo(ID, sOp){
		if(confirm("Sei sicuro di voler proseguire?")){
		window.location = 'adminExpoEXEC.asp?sOp='+sOp+'&ID='+ID;
		}
	}
	function jsNews(ID, sOp){
		if(confirm("Sei sicuro di voler proseguire?")){
		window.location = 'adminNewsEXEC.asp?sOp='+sOp+'&ID='+ID;
		}
	}
	function jsAppun(ID, sOp){
		if(confirm("Sei sicuro di voler proseguire?")){
		window.location = 'adminAppunEXEC.asp?sOp='+sOp+'&ID='+ID;
		}
	}
	function jsApprof(ID, sOp){
		if(confirm("Sei sicuro di voler proseguire?")){
		window.location = 'adminApprofEXEC.asp?sOp='+sOp+'&ID='+ID;
		}
	}
	
	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
	}
	
	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 popup(sUrl){
		openPopupStd( sUrl, 600, 600, 'yes');	
	}
	
	function openPopupStd( url, dimx, dimy, sScroll) {
		dimwidth = dimx;
		dimheight = dimy;
		x = (800 - dimwidth)/2, y = (600 - dimheight)/2;
		if (screen) {
			x = (screen.availWidth - dimwidth)/2;
			y = (screen.availHeight - dimheight)/2;
		}
		finestra1 = window.open(url,'','location=no,status=no,scrollbars='+sScroll+',resizable=no,width='+dimwidth+',height='+dimheight+',screenX='+x+',screenY='+y+',top='+y+',left='+x);
		finestra1.focus();
	}
	
	String.prototype.Replace = function(s1, s2){
		return this.split(s1).join(s2);
	}
	
	function replaceHtmlSpecialChars(str) {
		var sHtml = str;
		return sHtml.Replace("’","'").Replace("“","\"").Replace("”","\"").Replace("–", "-").Replace("€", "&euro;");
		return sHtml;
	}
	
	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 txtValida(oObj1, oObj2, sTrue, sFalse){
	  if (document.getElementById(oObj1).checked){
		  document.getElementById(oObj2).innerHTML = sTrue.toString();
	  }else{
		  document.getElementById(oObj2).innerHTML = sFalse.toString();
	  }
    }
	
	//**************************************************************
	// SHOW - HIDE OBJECT
	//**************************************************************
	//if(document.layers) { var ns4 = true; }
	//if(document.all && !document.getElementById) { var ie4 = true; }
	//if(document.all && document.getElementById) {var ie5 = true;};
	//if(document.addEventListener) {var nn6 = true};
	
	function showObject(obj) {
		var myObj;
		if (ns4) {
			 myObj = document[obj];
			 myObj.visibility = "show";
		}else if (ie4) {
			 myObj = document.all[obj];
			 myObj.style.visibility = "visible";
		} else {
			document.getElementById(obj).style.display = '';
		}
	}
	
	function hideObject(obj) {
		var myObj;
		if (ns4) {
			 myObj = document[obj];
			 myObj.visibility = "hide";
		} else if (ie4) {
			 myObj = document.all[obj];
			 myObj.style.display = "none";
		} else {
			document.getElementById(obj).style.display = 'none';
		}
	}
	
	function JsShowHideObject(obj){
		var myObj;
		if (ns4) {
			 myObj = document[obj];
			 if (myObj.visibility == "show") { myObj.visibility = "hide" }
			  else { myObj.visibility = "show" }
		}else if (ie4) {
			 myObj = document.all[obj];
			 if (myObj.style.visibility == "visible") { myObj.style.visibility = "none" }
			  else { myObj.style.visibility = "visible" }
		} else {
			myObj = document.getElementById(obj);
			 if (myObj.style.display == '') { myObj.style.display = 'none' }
			  else { myObj.style.display = '' }
		}
	}
	//**************************************************************
	// SHOW - HIDE OBJECT
	//**************************************************************
	function menuRedirect(oObj, sLink){
		document.location.href = sLink;	
		oObj.style.cursor = "hand";
	}

	function bgAlternate(oObj, sColor){
		oObj.style.backgroundColor=sColor;
	}

	function classAlternate(oObj, sClass){
		oObj.className=sClass;
	}
	
	String.prototype.Replace = function(s1, s2){
		return this.split(s1).join(s2);
	}
	
	function replaceHtmlSpecialChars(str) {
		var sHtml = str;
		return sHtml.Replace("’","'").Replace("“","\"").Replace("”","\"").Replace("–", "-").Replace("€", "&euro;");
		return sHtml;
	}
	
	function textCounter(field, countfield, maxlimit) {
		if (field.value.length > maxlimit) { // if too long...trim it!
			field.value = field.value.substring(0, maxlimit);
			// otherwise, update 'characters left' counter
		} else { 
			countfield.value = maxlimit - field.value.length;
		}
	}
