/**********************************************
acDiv.js -x/01/01
Autor: jaime.crespillo.vilchez
Comentarios: azulcore@ono.com
************************************************/
function acDiv(capa,x,y,z,w,h,visibility,bgcolor,contenido){
	acCreator(capa,x,y,z,w,h,visibility,bgcolor,contenido);
	this.w=w;
	this.h=h;
	this.ie4=(document.all)? true:false;
	if(document.getElementById){
		this.nST = document.getElementById(capa).style;
		this.strName = 'document.getElementById("'+capa+'")';
		this.name = document.getElementById(capa);
	}else{
		this.nST = (this.ie4) ? this.name.style : document.layers[capa];
		this.name = (this.ie4) ? document.all[capa] : document.layers[capa];
		this.strName = (this.ie4) ? 'document.all["'+capa+'"]' : 'document.layers["'+capa+'"]';
	}
	this.nom = capa;
}
acDiv.prototype.refresh=function (x,y,z,w,h,color,str){
	if(x!=null) this.setLeft(x);
	if(y!=null) this.setTop(y);
	if(z!=null) this.setZindex(z);
	if(w!=null)	this.setClipWidth(0,w);
	if(h!=null)	this.setClipHeight(0,h);
	if(color!=null)	this.setColor(color);
	if(str!=null) this.writeString(str);
}
acDiv.prototype.writeString=function wDivTD(contenido){
	if(this.ie4){
		this.name.innerHTML = contenido;
	} else {
		this.name.document.open();
		this.name.document.write(contenido);
		this.name.document.close();	
	}
}
acDiv.prototype.show=function (){this.nST.visibility = 'visible';}
acDiv.prototype.hide=function (){this.nST.visibility = 'hidden';}
acDiv.prototype.setLeft=function (l){ this.nST.left=l;}
acDiv.prototype.setTop=function (t){this.nST.top=t;}
acDiv.prototype.getTop=function (){return parseInt(this.nST.top);}
acDiv.prototype.getLeft=function (){return parseInt(this.nST.left);}
acDiv.prototype.setXY=function (x,y){this.setLeft(x);this.setTop(y);}
acDiv.prototype.setZindex=function (z){this.nST.zIndex=z;}
acDiv.prototype.getZindex=function (){return this.nST.zIndex;}
acDiv.prototype.getHeight=function getHeight(){
	if(this.ie4) return this.name.offsetHeight;
	else return this.name.document.height;
}
acDiv.prototype.getWidth=function getWidth(){
	if(this.ie4) return this.name.offsetWidth;
	else return this.name.document.width;
}
acDiv.prototype.setColor=function(color){(this.ie4) ? this.nST.backgroundColor=color : this.nST.bgColor=color;}
acDiv.prototype.setClipWidth=function(left,width){
	this.w=width;
	if(this.ie4){
		this.nST.clip="rect(0px,"+this.w+"px,"+this.h+"px,"+left+"px)";
	}else{
		this.nST.clip.width=width;
		this.nST.clip.left=left;}
}
acDiv.prototype.setClipHeight=function(top,height){	
	this.h=height;
	if(this.ie4){
		this.nST.clip="rect("+top+"px,"+this.w+"px,"+this.h+"px,0px)";
	}else{
		this.nST.clip.height=height;
		this.nST.clip.top=top;}
}
acDiv.prototype.setClip=function(left,top,width,height){
	this.h=height;
	this.w=width;
	if(this.ie4){
		this.nST.clip="rect("+top+"px,"+this.w+"px,"+this.h+"px,"+left+"px)";
	}else{
		this.nST.clip.right=this.w;
		this.nST.clip.left=left;
		this.nST.clip.height=this.h;
		this.nST.clip.bottom=height;}
}
acDiv.prototype.mOver=function(e){
	eval(this.strName+".onmouseover = function(event){"+e+"}");
	//if(!this.ie4) eval(gtfr0this.strName+".captureEvents(Event.MOUSEOVER)");
}
acDiv.prototype.mOut=function(e){
	eval(this.strName+".onmouseout = function(event){"+e+"}");
	//if(!this.ie4) eval(this.strName+".captureEvents(Event.MOUSEOUT)");
}
acDiv.prototype.mOnClick=function(e){
	eval(this.strName+".onclick = function(event){"+e+"}");
	if(!this.ie4) eval(this.strName+".captureEvents(Event.CLICK)");
}
acDiv.prototype.mOnDown=function(e){
	eval(this.strName+".onmousedown = function(event){"+e+"}");
	if(!this.ie4) eval(this.strName+".captureEvents(Event.MOUSEDOWN)");
}
acDiv.prototype.mOnUp=function(e){
	eval(this.strName+".onmouseup = function(event){"+e+"}");
	if(!this.ie4) eval(this.strName+".captureEvents(Event.MOUSEUP)");
}
acDiv.prototype.drageando=false;
acDiv.prototype.drag=function (e){
	this.xC = (!this.ie4)? e.pageX : event.x+document.body.scrollLeft;
	this.yC = (!this.ie4)? e.pageY : event.y+document.body.scrollTop;
	if(this.drageando){
		this.setLeft(this.xC);
		this.setTop(this.yC);
	}return true;
}
// acCreator based on teknoCreator 1.0 (Emi)
function acCreator(id,left,top,stack,width,height,visibility,vcolor,contenido) {
	var obj=document.createElement("DIV");
    obj.style.position="absolute";
	obj.style.left=left;
	obj.style.top=top;
	obj.style.zIndex=stack;
	obj.style.width=width;
	obj.style.height=height;
	obj.style.vibility=visibility;
	if (contenido != null) {
		obj.innerHTML=contenido;
	}
	if (vcolor != null) {
		obj.style.backgroundColor=vcolor;
	}
    obj.id=id;
    document.body.appendChild(obj);
}