//--------------------------------------------------------------------------------------//
function GetFromFile_ObjectCode () {
var URL, iPos, fileNAME, ObjectCode
    URL		 = document.URL
    iPos	 = URL.lastIndexOf("/")
    if (iPos<=6)  iPos=URL.lastIndexOf("\\")
    fileNAME     = URL.substring(iPos+1)
    ObjectCode   = fileNAME.substring(5,9)
    return ObjectCode
}
//--------------------------------------------------------------------------------------//
function GetFromFile_SectionNNCode () {
var URL, iPos, fileNAME, ObjectCode
    URL		 = document.URL
    iPos	 = URL.lastIndexOf("/")
    if (iPos<=6)  iPos=URL.lastIndexOf("\\")
    fileNAME     = URL.substring(iPos+1)
    ObjectCode   = fileNAME.substring(2,4)
    return ObjectCode
}
//--------------------------------------------------------------------------------------//
function PRINT_ImageBIG(SectionNNCode,ObjectCode) {
var FileName, imgSRC
    FileName = "P" + SectionNNCode + "_" + ObjectCode + "_00BIG.jpg"
    imgSRC   = "<IMG SRC=" + FileName + ">"
    document.write (imgSRC)
}


var GLOBAL_SectionNNCode	// codice numerico della sezione	p.es. 41
var GLOBAL_SectionAACode	// codice alfabetico della sezione	p.es. CA = Case
var GLOBAL_ObjectCode		// codice dell'oggetto			p.es. CA01

    GLOBAL_SectionNNCode	= GetFromFile_SectionNNCode	()
    GLOBAL_ObjectCode		= GetFromFile_ObjectCode	()
    GLOBAL_SectionAACode	= GLOBAL_ObjectCode.substring(0,2)


//-------------------------------------------------------------------------------
function EstraiLinguaggioAttuale (Valore, Linguaggio) {
//-------------------------------------------------------------------------------
var iPos, Risultato, Item
    iPos = Valore.indexOf("^")
    if (iPos==-1)
    {
	Risultato = Valore
    }
    else
    {
	Item = Valore.split("^")
	if (Linguaggio=="i") Risultato=Item[0]; else Risultato=Item[1]
    }
    return Risultato
}

//-------------------------------------------------------------------------------
function PRINT_InLinguaAttuale (Valore) {
//-------------------------------------------------------------------------------
    document.write ( EstraiLinguaggioAttuale (Valore, LANGUAGE) )
}


//-------------------------------------------------------------------------------
function GetRep (Codice, Campo) {
//-------------------------------------------------------------------------------
var iPos1, iLen1, iPos2, iPos3, Valore
    iPos1 = RepObj.indexOf(Codice+":"+Campo)
    iLen1 = Codice.length + 1 + Campo.length
    if (iPos1>=0)
    {
	iPos2 = RepObj.indexOf("=",iPos1)
	iPos3 = RepObj.indexOf("|",iPos1)
	if ( (iPos2>=0) & (iPos3>=0) & (iPos3>iPos2) )
	{
	   // Valore = "["+RepObj.substring(iPos2+1,iPos3)+"]"
	      Valore = "" +RepObj.substring(iPos2+1,iPos3)+""
	}
	else Valore = "[ERRORE: manca = oppure |]"
    }
    else Valore = "[ERRORE: manca la chiave =>" + Codice+":"+Campo + "<="

    Valore = Valore.replace("[iD1]","(larghezza)")
    Valore = Valore.replace("[iD2]","(profondità)")
    Valore = Valore.replace("[iD3]","(altezza)")
    return EstraiLinguaggioAttuale (Valore,LANGUAGE)
}

//-------------------------------------------------------------------------------
function PutRep (Codice, Campo) {
//-------------------------------------------------------------------------------

    document.write ( GetRep (Codice, Campo) )

}



//-------------------------------------------------------------------------------
function PutTitle (Codice, Campo, Prefix) {
//-------------------------------------------------------------------------------
    return "<title>"
		 + Prefix
		 + " - " + GetRep (Codice, Campo)
		 + "</title>"
}