/*
*  rollObj.js
* ----------------------------------------------------------------------------
*  Copyright © 1995-2001 Intesys S.r.l. Verona (I). All rights reserved.
* ----------------------------------------------------------------------------
*  Data e versione:
*	26/11/2001 - 1.00
* ----------------------------------------------------------------------------
*  Descrizione:
*	Libreria per la gestione dei rollover.
* ----------------------------------------------------------------------------
*/

var imgActive = ''


function rollOn(obj) {
	if (typeof(obj) == 'object' && (
		(arguments[1] == 'selected' && (typeof(obj.sel) == 'object' || typeof(obj.active) == 'object'))
		|| (!obj.on && typeof(obj.active) == 'object') )) {
		if (arguments[1] == 'selected' && typeof(obj.sel) == 'object') {
			obj.src = obj.sel.src
		} else
			obj.src = obj.active.src
		obj.on = true
		return true
	} else return false
}


function rollOff(obj) {
	if (typeof(obj) == 'object' && obj.on && obj != imgActive && typeof(obj.inactive) == 'object') {
		obj.src = obj.inactive.src
		obj.on = false
		return true
	} else return false
}


function setOn(obj) {
	var memImgActive = imgActive
	if (typeof(obj) == 'object') {
		rollOn(obj, 'selected')
		imgActive = obj
	} else {
		imgActive = ''
	}
	if (typeof(memImgActive) == 'object') rollOff(memImgActive)
	return true;
}


function preload(obj, srcActive, srcSel) {
	if (typeof(obj) == 'object' && obj.src) {
		obj.active = new Image()
		obj.active.src = srcActive
		obj.inactive = new Image()
		obj.inactive.src = obj.src
		if (srcSel) {
			obj.sel = new Image()
			obj.sel.src = srcSel
		}
		obj.on = false
		return true
	} else return false
}


function getImgByName(name, path) {
    if (typeof(document.images[name]) == 'object') return document.images[name]
    else {
        if (document.layers && typeof(path.document.images[name]) == 'object')
			return path.document.images[name]
        else return '';
    }
}


function setStatus(statusText) {
	if (document.all || !document.getElementById) {
		window.status = statusText;
	}
	return true;
}


