/**********************************************************************
*  function layerObj is a function that just declares a layer object  *
* and initializes some of its properties. It also has functions to    *
* manipulate the layers in a cross-browser environment.		      *
***********************************************************************/

function layerObj(name,w,h,x,y,z)
{
 this.objRef = findLayer(name);
 this.objStyle = (!is_nav4)?this.objRef.style:null;
 this.doc = (is_nav)?this.objRef.document:null; //for ns 4 x-ref
 this.name=name;
 this.zIndex=z;
 this.width=w;
 this.hieght=h;
 this.xPos=x;
 this.yPos=y;
 this.bgColor='white';
}//end layerObj


/************************************************************************
* setbgColor Color changes the background color of the block and returns *
* the current color of the background to the object.                    *
************************************************************************/
function blocksetbgColor(color)
{
 if (is_nav4) this.objRef.bgColor = color;
 else if (is_ie4) this.objStyle.backgroundColor = color;
 this.bgColor=color;
}//end setbgColor


/************************************************************************
* The Hide function, hides the specified layer from view                *
************************************************************************/
function blockhide()
{if(is_nav4) this.objRef.visibility = "hide";
else this.objStyle.visibility="hidden";
//if(is_nav6)//takes care of window repaint issues if layers overlap
//window.resizeBy(1,0);
}//end hide

function blocksetZindex(index)
{this.objRef.zIndex=index; this.zIndex=index;}//end setZ-inndex

/************************************************************************
* The show function, shows the specified layer into view                *
************************************************************************/
function blockshow()
{if(is_nav4) this.objRef.visibility = "show";
else this.objStyle.visibility="visible";

}//end show


/************************************************************************
* The show function, shows the specified layer into view                *
************************************************************************/
function blockcollapse()
{if(is_nav4) this.objRef.visibility ="collapse";
else this.objStyle.visibility="collapse";
}//end collapse



/************************************************************************
* The display function, does the same as show except it changes the     *
* block style which makes the pg expand or contaract upon use. It allows*
* styles, block, inline, list-item, none as valid parameters.		*
************************************************************************/
function blockdisplay(val)
{if(is_nav4) this.objRef.display = val;
else this.objStyle.display=val;
}//end show

/************************************************************************
* The scaleBy function scalesBy the layer to the passed width and hieght*
* int passed as the parameter.                                          *
************************************************************************/
function blockscaleby(w,h)
{if(is_nav4) this.objRef.resizeBy(w,h);
else {this.objStyle.width+=w; this.objStyle.height+=h;}
}//end scale

/************************************************************************
* The scaleTo function scales the layer to the passed width and hieght  *
* int passed as the parameter.                                          *
************************************************************************/
function blockscaleto(w,h)
{if(is_nav4) this.objRef.resizeTo(w,h);
else {this.objStyle.width+=w; this.objStyle.height+=h;}
}//end scale

/************************************************************************
* The shiftTo funciton moves a specified object to a the x and y        *
* positons specified in the parameters                                  *
************************************************************************/
function blockshiftTo(x,y)
{
	if (x!=null) 
      {
	  	this.xPos = x;
		if (is_nav4) this.objRef.left = this.xPos;
		//if(is_ie) this.objStyle.pixelLeft = this.xPos;
		else this.objStyle.left = this.xPos;
	  }
	
  if (y!=null) 
     {
		this.yPos = y;
		if (is_nav4) this.objRef.top = this.yPos;
		//if(is_ie) this.objStyle.pixelTop = this.yPos;
		else this.objStyle.top = this.yPos;
	 }
}//end shiftTo

/************************************************************************
* The function LayerWrite is a cross browser solution to dynamically    *
* write to a layer. Parameter passed is the html or that is to be       *
* diplayed inside the layer.											*
*************************************************************************/
function blocklayerwrite(txt)
{
 if(txt)
 if(is_nav4)
   {this.doc.open(); this.doc.write(txt); this.doc.close();}
 if(adv_brow_func||is_ie4)
    this.objRef.innerHTML=txt;
}//end blocklayerwrite

layerObj.prototype.setbgColor=blocksetbgColor;
layerObj.prototype.hide=blockhide;
layerObj.prototype.divCollapse=blockcollapse;
layerObj.prototype.show=blockshow;
layerObj.prototype.shiftTo=blockshiftTo;
layerObj.prototype.scaleBy=blockscaleby;
layerObj.prototype.scaleTo=blockscaleto;
layerObj.prototype.layerWrite=blocklayerwrite;
layerObj.prototype.changeDisplay=blockdisplay;
/****************************************************************************
* example on use: the main interface to create the object is:               *
* newLayer = new layerObj(name,width,height,x position,y position,z index)  *
* Now the associated functions with the object are:                         *
* newLayer.hide(), newLayer.show(), newLayer.shiftTo(X position, Y position)*
* newLayer.scaleBy(width, height), newLayer.scaleTo(width, height)          *
* newLayer.layerWrite(HTML)													*
****************************************************************************/