/* ------------------------------------------------------------------------- */

/* 	--- LAYER FUNCTIONS 
	--- modifica la visualizzazione e posizione di layers
 		swapLayerView		nasconde un layer se è visibile, lo visualizza se è nascosto
   		showLayer			rende un layer visibile
   		hideLayer			nasconde un layer
		viewLayer			rende un layer visibile e gli assegna una posizione */
		
function swapLayerView(argId) {
	document.getElementById(argId).style.display=(document.getElementById(argId).style.display!='block')?'block':'none';
}

function showLayer(argId) {
	document.getElementById(argId).style.display="block";
}

function showInlineLayer(argId) {
	document.getElementById(argId).style.display="inline";
}

function viewLayer(argId,argTop,argLeft) {
	document.getElementById(argId).style.display="block";
	document.getElementById(argId).style.top=argTop+"px";
	document.getElementById(argId).style.left=argLeft+"px";
}

function hideLayer(argId) {
	document.getElementById(argId).style.display="none";
}

function exist(id) { return document.getElementById(id); }

/* ------------------------------------------------------------------------- */

function findPosY(obj) {
	var posTop = 0;
	while (obj.offsetParent) {
		posTop += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return posTop;
}
function findPosX(obj) {
	var posLeft = 0;
	while (obj.offsetParent) {
		posLeft += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return posLeft;
}

/* ------------------------------------------------------------------------- */

/* 	--- LOADIMAGE 
	--- carica una nuova immagine in un IMG con ID
 		argId		id del tag IMG
   		argSrc		path della nuova immagine
   		argAlt		nuovo testo alternativo (empty per non modificare) */
		
function loadImage(argId,argSrc,argAlt){
	document.getElementById(argId).src = argSrc;
	if (argAlt != '') document.getElementById(argId).alt = argAlt;
}

/* ------------------------------------------------------------------------- */