<!--
function open_help(pag,dir)
{
   window.open("../../teleworkweb/"+dir+"/"+pag,"Help","top=0,left=0,width=850,height=500,scrollbars=yes,resizable=yes");
}
function dateFormat(dt2format){
   s1 = document.getElementById(dt2format).value;
   switch (s1.length){
   	case 2:	s1+='-';
		break;
		
	case 5: s1+='-';
		break;
   }
   document.getElementById(dt2format).value = s1;
}
function updatetab(valore,tipo,filtro)
{
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        liveSearchReq = new XMLHttpRequest();
        liveSearchReq.onreadystatechange = debug;
        liveSearchReq.open("POST", "../utility/update_tab.php?valore="+valore+"&tipo="+tipo+"&filtro="+filtro,true);
        liveSearchReq.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        liveSearchReq = new ActiveXObject("Microsoft.XMLHTTP");
        liveSearchReq.onreadystatechange = debug;
        if (liveSearchReq) {
            liveSearchReq.open("POST", "../utility/update_tab.php?valore="+valore+"&tipo="+tipo+"&filtro="+filtro,true);
            liveSearchReq.send();
        }
    }
}
function debug()
{
   var strRes;
   if (liveSearchReq.readyState == 4)
   {
      strRes=liveSearchReq.responseText;
      if (strRes.length>0)
         prompt("",strRes);
   }
}
function clessidra(indice)
{
   var v = new Array(2);
   v[0]="default;";
   v[1]="../utility/sand.ani";
   document.getElementsByTagName("body")[0].style.cursor=v[indice];
}
var aySound = new Array();
aySound[0] = "../utility/chimes.wav";
aySound[1] = "../utility/errore.wav";

document.write('<BGSOUND id="auIEContainer">')
IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0;
NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0;
ver4 = IE||NS? 1:0;
onload=auPreload;

function auPreload() {
if (!ver4) return;
if (NS) auEmb = new Layer(0,window);
else {
Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
document.body.insertAdjacentHTML("BeforeEnd",Str);
}
var Str = '';
for (i=0;i<aySound.length;i++)
Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
if (IE) auEmb.innerHTML = Str;
else {
auEmb.document.open();
auEmb.document.write(Str);
auEmb.document.close();
}
auCon = IE? document.all.auIEContainer:auEmb;
auCon.control = auCtrl;
}
function auCtrl(whSound,play) {
if (IE) this.src = play? aySound[whSound]:'';
else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
}
function playSound(whSound) { if (window.auCon) auCon.control(whSound,true); }
function stopSound(whSound) { if (window.auCon) auCon.control(whSound,false); }

	function checkDate(objdate){
		//alert(objdate.value);
		if (objdate.value != "") {
			if (isDate(objdate.value) == false) {
				mayPass = false;
				objdate.select();
				objdate.focus();
				eval('document.searchengine.'+objdate.name+'.style.backgroundColor="red"');
				alert("La data non contiene valori corretti")
			}else{
				eval('document.searchengine.'+objdate.name+'.style.backgroundColor=""');
				mayPass = true;
			}
		}else{
			eval('document.searchengine.'+objdate.name+'.style.backgroundColor=""');
			mayPass = true;
		}
	}
    function isDate(inputV) {
		if (inputV) {
			var year = inputV.substring(6);
			var month = inputV.substring(3,5);
			var day = inputV.substring(0,2);

			if (( inputV.charAt(2) != "-" )){
				return false;
			}
			if (( inputV.charAt(5) != "-" )) {
				return false;
			}
			if (!isNumber(day)){
				return false;
			}
			if (!isNumber(month)){
				return false;
			}
			if (!isNumber(year)){
				return false;
			}
			if (day.length != 2){
				return false;
			}
			if (month.length != 2){
				return false;
			}
			if (year.length != 4){
				return false;
			}
			if (day>31){
				return false;
			}
			if (month>12){
				return false;
			}
			
			return true;
		}
		
    }

	//onKeyUp="dateFormat('DT%=com.getIDCOMUNICAZIONI(i)%')"
	
	function isNumber(inputValue) {
	   var ret = true;
	   var alreadypoint = false;
	      if (inputValue == 0){
		  	  return ret;
		  }
	      if (!parseFloat(inputValue)) {
		  	ret=false;
			return ret;
		  } else {
		  	for (var i=0;i< inputValue.length;i++) {
				if (inputValue.charAt(i) != ".")  {
					if (inputValue.charAt(i) != "0") {
						if (!parseFloat(inputValue.charAt(i))) {
							ret=false;
							break;
						}
					}
				} else {
					if( alreadypoint )
						ret=false;
					else
						alreadypoint=true;
				}
			}
		  }
		if (inputValue.charAt(0) =='.'){
			ret = false;
		}
		if (inputValue.charAt(inputValue.length -1) =='.'){
			ret = false;
		}
		return ret;
	}
	
	function checkNumber(objnumber){
		if (objnumber.value != "") {
			if (isNumber(objnumber.value) == false) {
				mayPass = false;
				objnumber.select();
				objnumber.focus();
				eval('document.searchengine.'+objnumber.name+'.style.backgroundColor="red"');
			}else{
				eval('document.searchengine.'+objnumber.name+'.style.backgroundColor=""');
				mayPass = true;
			}
		}else{
			eval('document.searchengine.'+objnumber.name+'.style.backgroundColor=""');
			mayPass = true;
		}
	}
var keyCode;
//-->
