var IS_NUM_VAL_IDX = 0;
var IS_DATE_VAL_IDX = 1;
var IS_EMAIL_VAL_IDX = 2;
var IS_EURO_VAL_IDX = 3;
var IS_DATE_VAL_IDX1 =4;

function CheckEmail(obj) {
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
	return filter.test(obj.value);
}

function CheckValue(w, obj, label) {
	if(obj.value.length == 0) return true;
	switch(w) {
		case IS_NUM_VAL_IDX:
			if(!CheckNumber(obj)) {
				self.alert("Warning: invalid value in field \"" + label + "\"!");
				obj.focus();
				obj.select();
				return false;
			}
			break;
		case IS_EMAIL_VAL_IDX:
			if(!CheckEmail(obj)) {
				self.alert("Attenzione: indirizzo email non valido!\n\n" +
					"(formato richiesto \"username@host.domain\")");
				obj.focus();
				obj.select();
				return false;
			}
			break;
		case IS_EURO_VAL_IDX:
			if(!CheckEuro(obj)) {
				self.alert("Warning: invalid Euro value in field \"" + label + "\"!");
				obj.focus();
				obj.select();
				return false;
			}
			break;
		case IS_DATE_VAL_IDX:
			var err = CheckDate(obj.value);
			if(err.length != 0) {
				if (err=='data'){
					self.alert("Attenzione: " + label + " non valida!\n\n" +
					"(formato richiesto \"gg/mm/aaaa\")");
				}
				else {
					self.alert("Attenzione: " + err + " non valido nel campo \"" + label + "\"!\n\n" +
					"(formato richiesto \"gg/mm/aaaa\")");
				}
				obj.focus();
				obj.value ="";
				obj.select();
				return false;
				
			}
			break;
		case IS_DATE_VAL_IDX1:
			var err = CheckDate1(obj.value);
			if(err.length != 0) {
				if (err=='data'){
					self.alert("Attenzione: " + label + " non valida!\n\n" +
					"(formato richiesto \"gg/mm/aaaa\")");
				}
				else {
					self.alert("Attenzione: " + err + " non valido nel campo \"" + label + "\"!\n\n" +
					"(formato richiesto \"gg/mm/aaaa\")");
				}
				obj.focus();
				obj.value ="";
				obj.select();
				return false;
				
			}
			break;			
		default:
			return false;
	}
	return true;
}
function OpenDoc(doc){
	window.open("ViewDoc.asp?docpath="+doc, "docAllegato","width=700,height=550,toolbar=no,menubar=no,title=yes,scrollbars=1,resizable=1").focus();
}

		var opened = new Object();
		var toShutDown = new Array(10);
		
		function labelOn(label, obj, idmenu){
			document.getElementById(obj).src =label;
			submenuOn(idmenu);
		}
		function labelOff(label, obj, idmenu){
			document.getElementById(obj).src =label;
			submenuOff(-1);
		}
		function submenuOn(idmenu){
			var sp = document.getElementById("sottomenu_"+idmenu);	
			sp.style.visibility = "visible";
			toShutDown[idmenu] = false;
		}
		function checkForShutDown() {
			var sp;

			for (var i = 1; i < 9; i++) {
				if (toShutDown[i]) {
					sp = document.getElementById("sottomenu_"+i);	
					if (typeof(sp) == "undefined") continue;
					sp.style.visibility = "hidden";
				}
			}
		}
		
		function submenuOff(idmenu){
			if (idmenu == -1) {
				for (var i = 1; i < 9; i++) {
					toShutDown[i] = true;
				}
			}
			else {
				toShutDown[idmenu] = true;
			}	
			window.setTimeout("checkForShutDown()", .2*1000);
		}
		function submenuNotView(){
			document.getElementById('sottomenu').style.visibility = "hidden";
		}
		
function apriBooking(lingua){
window.open("http://www.palcoabruzzo.it/booking/main.asp?linguaid=IT&evento_id_pagina=0","BOL","width=930,height=660,menubar=0,resizable=yes,scrollbars=yes, status=0,titlebar=0,toolbar=0,left=0,top=0")
}
