// *** generica funzione per il movimento di un layer  ***
// @objname id del layer
// @dx incremento orizzontale
// @dy incremento verticale
function movelayerxy(objname,x,y)
{	
	if(ie4)
		var objp=eval("document.all['"+objname+"'].style");
	else
		var objp=eval("document.layers['"+objname+"']");
        var dimtmp=(ie4)? parseInt(objp.left.split("px")[0]):objp.left;
	dimtmp=x;
	objp.left=(ie4)? dimtmp+"px":dimtmp;
        dimtmp=(ie4)? parseInt(objp.top.split("px")[0]):objp.top;
	dimtmp=y;
	objp.top=(ie4)? dimtmp+"px":dimtmp;
}






// ritorna la proprietà di un layer
// @objname id del layer
// @propstr proprietà da analizzare
// @return il valore della proprietà richiesta
function getlayerproperty(objname,propstr)
{
	if (ie4)
	{
		var objp=eval("document.all['"+objname+"']");
		if (propstr == 'width') return objp.scrollWidth;
		else if (propstr == 'height') return objp.scrollHeight;
		else if (propstr == 'left') return objp.style.pixelLeft;
		else if (propstr == 'top') return objp.style.pixelTop;
		else if (propstr == 'visibility') return (objp.style.visibility=="visible");
		else if (propstr == 'HTML') return objp.innerHTML;
		else if (propstr == 'backgroundcolor') objp.style.backgroundColor;
		else if (propstr == 'clip') return objp.style.clip;
		else if (propstr == 'clipleft') 
		{
			var clipv = objp.style.clip.split("rect(")[1].split(")")[0].split("px");
			return parseInt(clipv[3]);
		}
		else if (propstr == 'cliptop') 
		{
			var clipv = objp.style.clip.split("rect(")[1].split(")")[0].split("px");
			return parseInt(clipv[0]);
		}
		else if (propstr == 'clipbottom') 
		{
			var clipv = objp.style.clip.split("rect(")[1].split(")")[0].split("px");
			return parseInt(clipv[2]);
		}
		else if (propstr == 'clipright') 
		{
			var clipv = objp.style.clip.split("rect(")[1].split(")")[0].split("px");
			return parseInt(clipv[1]);
		}
	}	
	else
	{
		var objp=eval("document.layers['"+objname+"']");
		if (propstr == 'width') return objp.document.width;
		else if (propstr == 'height') return objp.document.height;
		else if (propstr == 'left') return objp.left;
		else if (propstr == 'top') return objp.top;
		else if (propstr == 'visibility') return (objp.visibility=="show");
		else if (propstr == 'backgroundcolor') return objp.bgColor;
		else if (propstr == 'clipleft') return objp.clip.left;
		else if (propstr == 'cliptop') return objp.clip.top;
		else if (propstr == 'clipbottom') return objp.clip.bottom;
		else if (propstr == 'clipright') return objp.clip.right;
	}	
}




// modifica la proprietà di un layer
// @objname id del layer
// @propstr proprietà da modificare
// NOTA: nel caso in cui propstr='visibility' newvalue=valore booleano (=true,false)
function setlayerproperty(objname,propstr,newvalue)
{
	if (ie4)
	{
		var objp=eval("document.all['"+objname+"']");
		if (propstr == 'width') objp.style.width=newvalue;
		else if (propstr == 'height') objp.style.height=newvalue;
		else if (propstr == 'left') objp.style.left=newvalue+"px";
		else if (propstr == 'top') objp.style.top=newvalue+"px";
		else if (propstr == 'onmousemove') eval("objp.onmousemove="+newvalue);
		else if (propstr == 'onmouseover') eval("objp.onmouseover="+newvalue);
		else if (propstr == 'onmouseout') eval("objp.onmouseout="+newvalue);
		else if (propstr == 'visibility') 
			if (newvalue == true)
				objp.style.visibility="visible";
			else
				objp.style.visibility="hidden";
		else if (propstr == 'HTML') objp.innerHTML=newvalue;
		else if (propstr == 'backgroundcolor') objp.style.backgroundColor=newvalue;
		else if (propstr == 'clip') 
			objp.style.clip=newvalue;
		else if (propstr == 'clipright') 
		{
			var clipv = objp.style.clip.split("rect(")[1].split(")")[0].split("px");
			tt=parseInt(clipv[0]);
			rr=parseInt(clipv[1]);
			bb=parseInt(clipv[2]);
			ll=parseInt(clipv[3]);
			objp.style.clip="rect("+tt+"px "+newvalue+"px "+bb+"px "+ll+"px)";
		}
		else if (propstr == 'clipleft') 
		{
			var clipv = objp.style.clip.split("rect(")[1].split(")")[0].split("px");
			tt=parseInt(clipv[0]);
			rr=parseInt(clipv[1]);
			bb=parseInt(clipv[2]);
			ll=parseInt(clipv[3]);
			objp.style.clip="rect("+tt+"px "+rr+"px "+bb+"px "+newvalue+"px)";
		}
		else if (propstr == 'clipbottom') 
		{
			var clipv = objp.style.clip.split("rect(")[1].split(")")[0].split("px");
			tt=parseInt(clipv[0]);
			rr=parseInt(clipv[1]);
			bb=parseInt(clipv[2]);
			ll=parseInt(clipv[3]);
			objp.style.clip="rect("+tt+"px "+rr+"px "+newvalue+"px "+ll+"px)";
		}
		else if (propstr == 'cliptop') 
		{
			var clipv = objp.style.clip.split("rect(")[1].split(")")[0].split("px");
			tt=parseInt(clipv[0]);
			rr=parseInt(clipv[1]);
			bb=parseInt(clipv[2]);
			ll=parseInt(clipv[3]);
			objp.style.clip="rect("+newvalue+"px "+rr+"px "+bb+"px "+ll+"px)";
		}
		else // aggiunge una nuova proprietà 
			eval("document.all['"+objname+"']."+propstr+"="+newvalue);
	}	
	else
	{
		var objp=eval("document.layers['"+objname+"']");
		if (propstr == 'width') objp.height=newvalue;
		else if (propstr == 'height') objp.width=newvalue;
		else if (propstr == 'left') objp.left=newvalue;
		else if (propstr == 'top') objp.top=newvalue;
		else if (propstr == 'onmousemove') eval("objp.onmousemove="+newvalue);
		else if (propstr == 'onmouseover') eval("objp.onmouseover="+newvalue);
		else if (propstr == 'onmouseout') eval("objp.onmouseout="+newvalue);
		else if (propstr == 'visibility')
			if (newvalue == true)
				objp.visibility="show";
			else
				objp.visibility="hide";
		else if (propstr == 'HTML') 
		{			
			objp.document.open();
			objp.document.write(newvalue);
			objp.document.close();
		}
		else if (propstr == 'backgroundcolor') objp.bgColor=newvalue;
		else if (propstr == 'clipright') 
			objp.clip.right=newvalue;
		else if (propstr == 'clipleft') 
			objp.clip.left=newvalue;
		else if (propstr == 'clipbottom') 
			objp.clip.bottom=newvalue;
		else if (propstr == 'cliptop') 
			objp.clip.top=newvalue;
		else // aggiunge una nuova proprietà 
			eval("document.layers['"+objname+"']."+propstr+"="+newvalue);
	}	
}


function rollover(imagename,newimageobj)
{
  var oldimageobj=eval("document."+imagename);
  var img=eval(newimageobj);
  oldimageobj.src=img.src;
}

