var isNN4up = (document.layers)? true : false;
var isIE4up = (document.all)? true : false;

function changeText(id, str) {
          if (isIE4up) {
              document.all[id].innerHTML = str;
          }
          if (isNN4up) { 
              document.layers[id].left=x;
              document.layers[id].top=y;
          }
      }

function MLchangecontents(con){
	var o=this;
	changeText(this.id,con);
}

function MLalpha(a){
	var lid=this.id;
	if (isIE4up) {
		document.all[lid].filters.alpha.opacity=a;
	}
}

function MLshow() {
	var o;
	if(isIE4up){o=document.all[this.id].style;} else {o=document.layers[this.id];}
	if (isNN4up) o.visibility = "show";
	else if (isIE4up) o.visibility = "visible";
}

function MLhide() {
	if(isIE4up){o=document.all[this.id].style;} else {o=document.layers[this.id];}
	if (isNN4up) o.visibility = "hide";
	else if (isIE4up) o.visibility = "hidden";
}

function MLmove(x,y){
this.left=x;
this.top=y;
	if (document.all)   {

		choose = document.all[this.id].style;

    	choose.posLeft = x;
    	choose.posTop = y;

    }

    else    {

		choose = document.layers[this.id];

    	choose.left = x;

    	choose.top = y;

	}

        }

function MyLayer(pid,L,T,W,H,bgColor,pvisible,zIndex) {
 if (document.layers) {
  if (document.layers[pid]) {
   alert ('Layer with this ID already exists!')
   return
  }
  var LR=document.layers[pid]=new Layer(W)
  LR.name= pid
  LR.left= L
  LR.top = T
  LR.clip.height=H
  LR.visibility=(null==pvisible || 1==pvisible ? 'show' : 'hide')
  if(null!=zIndex)  LR.zIndex=zIndex
  if(null!=bgColor) LR.bgColor=bgColor
 }
 else if (document.all) {
  if (document.all[pid]) {
   alert ('Layer with this ID already exists!')
   return
  }
  var LR= '\n<DIV id='+pid+' style="position:absolute'
  +'; left:'+L
  +'; top:'+T
  +'; width:'+W
  +'; height:'+H
  +'; clip:rect(0,'+W+','+H+',0)'
  +'; visibility:'+(null==pvisible || 1==pvisible ? 'visible':'hidden')
  +(null==zIndex  ? '' : '; z-index:'+zIndex)
  +(null==bgColor ? '' : '; background-color:'+bgColor)
  +';filter:alpha(opacity=100)"></DIV>'
  document.body.insertAdjacentHTML("BeforeEnd",LR);
 }
 this.id=pid;
 this.width=W;
 this.length=H;
 this.left=L;
 this.top=T;
 this.background=bgColor;
 this.visible=pvisible;
 this.zindex=zIndex;
 this.changeContents=MLchangecontents;
 this.show=MLshow;
 this.hide=MLhide;
 this.alpha=MLalpha;
 this.move=MLmove;
}

