var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}



	function Conferma(testo)
	{
	return confirm(testo);	
	}


	function ImpostaCSS()
	{		
	DisabilitaCSS(0);
	}

	function Svuota1(id)
	{
	document.getElementById(id).value='';
	}	
	
	function Svuota(valoreiniziale, idcampo)
	{
  	oggInp=document.getElementById(idcampo);
  	valoreInp=oggInp.value;
  	if (valoreiniziale==valoreInp)
			 {
			 oggInp.value='';
			 }
	}
	
	
        function CheckLength1(nomecampo, nomeconta, numcar)
          {
          with (document.modulo1)
            {
            chars=nomecampo.value
            if (chars.length > numcar)
              {
              nomecampo.value=chars.substr(0,numcar);
        			nomecampo.value.substring(0,numcar);
              nomecampo.focus();
              }
            nomeconta.value=numcar-nomecampo.value.length;
            }
          }

        function CheckLength2(nomecampo, nomeconta, numcar)
          {
          with (document.modulo2)
            {
            chars=nomecampo.value
            if (chars.length > numcar)
              {
              nomecampo.value=chars.substr(0,numcar);
        			nomecampo.value.substring(0,numcar);
              nomecampo.focus();
              }
            nomeconta.value=numcar-nomecampo.value.length;
            }
          }
          
        function CheckLength3(nomecampo, nomeconta, numcar, nomeform)
          {
          with (document.nomeform)
            {
            chars=nomecampo.value
            if (chars.length > numcar)
              {
              nomecampo.value=chars.substr(0,numcar);
        			nomecampo.value.substring(0,numcar);
              nomecampo.focus();
              }
            nomeconta.value=numcar-nomecampo.value.length;
            }
          }		  
		  
function ControllaCampoTesto(nome, nomecampo)
{
	vlCampo=document.forms[1].elements[nome].value;
	if (vlCampo=="") 
	{
		alert("Attenzione! Il campo '"+nomecampo+"' è obbligatorio.");
		document.forms[1].elements[nome].focus();		
		}
}   


function ControllaRadio(nome)
{
	radObj=document.forms[0].elements["nome"];
	for (a=0; a<radObj.length; a++)
	
	{
		if (radObj[a].checked==true )
			{
				return true;
			}
		}	
	
}

function DisabilitaCSS(indice_nodis)
{
	for (i=0; i<=4; i++)
	{
		if (i==indice_nodis)
		{
			document.styleSheets[i].disabled = false
		}
		else
		{
			document.styleSheets[i].disabled = true
		}
	}
	
}


function stili_on_off(indice_stile,valore) {
	DisabilitaCSS();
  document.styleSheets[indice_stile].disabled = valore
}


function setCookie(sNome, sValore, iGiorni) {
var dtOggi = new Date()
var dtExpires = new Date()
dtExpires.setTime
(dtOggi.getTime() + 24 * iGiorni * 3600000)
document.cookie = sNome + "=" + escape(sValore) + "; expires=" + dtExpires.toGMTString();
}


function getCookie(sNome) {
// genera un array di coppie "Nome = Valore"
// NOTA: i cookies sono separati da ';'
var asCookies = document.cookie.split("; ");
// ciclo su tutti i cookies
for (var iCnt = 0; iCnt < asCookies.length; iCnt++)
{
// leggo singolo cookie "Nome = Valore"
var asCookie = asCookies[iCnt].split("=");
if (sNome == asCookie[0]) {
return (unescape(asCookie[1]));
}
}

// SE non esiste il cookie richiesto
return("");
}

function ApriChat(idaprichat)	{
	aa=document.getElementById(idaprichat);
	valchat=aa.checked;
	bb=document.getElementById('nick');
	valnick=bb.value;
	if (valchat==true) 
	{
	url="http://www.jetlake.it/content/accesso_chat_jetlake.asp?nickname="+valnick+"#titolopagina"
	window.open(url, 'miaFinestra','width=770, height=550 ,toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=yes');
	return true;
	}
}


function showImg(percorso,nomeimmagine)
	{
	aa=document.getElementById(nomeimmagine).src=percorso;
	return aa;
	
	}