
var ns4
if (document.layers) 
	ns4 = true;
else
	ns4 = false;

function layerObj(id){
	//this.css=document.all[id].style;
	if (ns4) 
		this.css=document.layers["meulayer"].document.layers[id]
	else
		this.css=document.getElementById(id).style;
	this.x=this.css.pixelLeft;
	this.y=this.css.pixelTop;
	this.moveBy=moveBy;
	this.moveTo=moveTo;
	this.hide=hide;
	this.show=show;
	this.clipping=clipping;
}

function moveBy(x,y){
	this.x+=x;
	this.y+=y;
	this.css.left=this.x;
	this.css.top=this.y;
}

function moveTo(x,y){
	this.x=x;
	this.y=y;
	this.css.left=this.x;
	this.css.top=this.y;
}

function hide(){
	this.css.visibility="hidden";
}

function show(){
	this.css.visibility="visible";
}

function clipping (l,t,r,b) {
	if(ns4) {
	   this.css.clip.top=t;
	   this.css.clip.right=r;
	   this.css.clip.bottom=b;
	   this.css.clip.left=l;
	   }
//	  else   if (ie||ns5){
	  this.css.clip="rect(" + t + "px " + r + "px " + b + "px " + l + "px)";
//	}
// tentar pegar os valores originais
}
function init(){

	//meulayer=new layerObj('layer1');
//	loop();
	dynclickLayer= new layerObj('meuclicklayer');
	dynoverLayer= new layerObj('meuoverlayer');
	dynclickLayer.clipping(0,0,0,0);
	dynoverLayer.clipping(0,0,0,0);
}

function loop(){
	meulayer.moveBy(5,5);
	if(meulayer.css.pixelTop<600)setTimeout('loop()',20);
}

