// JScript File
var heightScreen;
var widthScreen;

var x = 10;
var y = 35;

heightScreen = screen.availHeight - y;
widthScreen = screen.availWidth  - x;

var widthHPAreaIntestazione = widthScreen;
var heightHPAreaIntestazione = 55;
var heightHPAreaBenvenuto = 20;
var heightHPAreaPercNav = 20;
var widthHPAreaMenu = 200;
var heightAreaPB = 20;
var heightAreaCliente = 45;

var heightTab = 20;
var widthTab = 105;

var widthTabPiccolo = 80;

var costanteHeightTab = 4;
var costanteWidthTab = 2;

/* Gestione Area Navigazione*/
var PercorsoNavigazione = "";
var VoceScelta = "";
/* ----------------------------- */


/* ----------------------------- */

function launch(caso)
{
	var strFeature;
	strFeature = "location=no, toolbar=no, status=no, menubar=no, resizable=yes";
	strFeature = strFeature + ", top=0, left=0";
	strFeature = strFeature + ", height=" + heightScreen +", width=" + widthScreen;
	
	var url="";
	if(caso==1)
	{
	    url="Home1_1.Htm";
	    window.open('../Home/Home1_1.Htm','NAC',strFeature);
	}
}
/* ----------------------------- */	
function Naviga(id, url)
{
	document.getElementById(id).src=url;
}
/* ----------------------------- */
function AbilitaVoceMenu(cartella,voce)
{
    var iframe = document.getElementById("HPAreaMenu");
    iframe.contentWindow.Abilita(iframe.contentWindow.document.getElementById(cartella),iframe.contentWindow.document.getElementById(voce));
}
/* ----------------------------- */
function DisabilitaVoceMenu(cartella,voce)
{
    var iframe = document.getElementById("HPAreaMenu");
    iframe.contentWindow.Disabilita(iframe.contentWindow.document.getElementById(cartella),iframe.contentWindow.document.getElementById(voce));
}
// JScript File
function LogOut()
{
   top.window.close();
}
/* ----------------------------- */

/* trim di una stringa */
function Trim(input)
{
	return input.replace(/(^\s*)|(\s*$)/g, "");
}

function Rimpiazza(stringa,cerca,rimpiazza)
{
    if(typeof(top.Sostituisci) == "unknown")
        return Sostituisci(stringa,cerca,rimpiazza);
    else
	    return top.Sostituisci(stringa,cerca,rimpiazza);
}

function Posizione(dimensioneSchermo,dimensioneFinestra)
{
	var posizione = (dimensioneSchermo / 2) - (dimensioneFinestra / 2);
		if(posizione < 0) 
			posizione=0;

	return posizione;	
}

function ApriModale(altezza,larghezza,url)
{
    var sopra = Posizione(window.screen.availHeight,altezza);
	var sinistra = Posizione(window.screen.availWidth,larghezza);
    var aspetto = "dialogHeight: " + altezza + "px; dialogWidth: " + larghezza + "px; dialogTop: " + sopra + "px; dialogLeft: " + sinistra + "px; edge: Raised; center:yes; help:no; resizable:no; status:no;";
    return top.window.showModalDialog(url,"",aspetto);
}

function ApriReport(url)
{
	window.open(url);
}

function ChiudiModale()
{
    window.close();
}


/*Espandi Racchiudi Menu*/
function EspandiRacchiudi(obj,voci)
{   

    var categoria = document.getElementById(voci);
    EspandiRacchiudiOggetto(obj,categoria);
}

function EspandiRacchiudiOggetto(obj,objCategoria)
{   
    //immagine = new Image();
    //debugger;
    if(objCategoria.style.display=='')
    {
        if (obj.children.length > 0)
            if (obj.children[0].tagName == 'IMG')
                obj.children[0].src = 'Images/arrowRight.png';
        //obj.innerText = '+';
        //immagine.src   = '../SeiReportManager/Images/arrowDown.png';
        //obj.appendChild(immagine);
        objCategoria.style.display = 'none';
    }
    else
    {
        
        if (obj.children.length > 0)
            if (obj.children[0].tagName == 'IMG')
                obj.children[0].src = 'Images/arrowDown.png';
        //obj.innerText = '-';
        //immagine.src   = '../SeiReportManager/Images/arrowRight.png';
        //obj.appendChild(immagine);
        objCategoria.style.display = '';
    }
}

function  EspandiRacchiudiRighe(obj,idRighe)
{ 
    var righeCategoria = document.getElementById(idRighe);
    
    if(typeof(righeCategoria.length)=='undefined')
    {
        EspandiRacchiudiOggetto(obj,righeCategoria)
    }
    else
    {
        for(i=0;i<righeCategoria.length;i++)
           EspandiRacchiudiOggetto(obj,righeCategoria[i]);
    }
}

/* gestione tabulatore */
function AbilitaTab(indice)
{
    parent.Tabulatore1.rows[0].cells[indice].className = "TabDisattivo";
    parent.Tabulatore1.tabSelezionato = indice + 0;
}
function AbilitaTabEvidenziato(indice)
{
    parent.Tabulatore1.rows[0].cells[indice].className = "TabDisattivoEvidenziato";
    parent.Tabulatore1.tabSelezionato = indice + 0;
}
function DisabilitaTab(indice)
{
    parent.Tabulatore1.rows[0].cells[indice].className = "TabDisabilitato";
}