// JavaScript Document
function layer(layerid, objName)
	{
		this.id = layerid;
		this.objName = objName;
		this.speed = config_speed;
		this.jump = config_jump;
		this.getObject = function() {   
			if (document.getElementById)
			  {
				return document.getElementById(this.id);
			  }
			else if (document.all)
			  {
				return document.all[this.id];
			  }
			else if (document.layers)
			  {
				return document.layers[this.id];
			  }
		}
		this.me = this.getObject();
		this.style = this.me.style;
		this.getHeight = function(layer_id)	{
				if (document.layers)
					return document.layers[layer_id].document.height;
				else if (document.all)
					return document.all[layer_id].clientHeight;
				else if (document.getElementById)
					return document.getElementById(layer_id).clientHeight;
			}
			this.numHeight = parseInt(this.getHeight(this.id + "_inner"));				
		if(document.all)
			{
				this.style.height = 'auto';
				this.numHeight = parseInt(this.getHeight(this.id));				
				this.style.height='0px';
			}
		
		
		this.expand = function () { 
			clearTimeout(this.timeout);
			this.style.display='block';
			if(parseInt(this.style.height + 0) < this.numHeight)
				{
					this.style.height = parseInt(parseInt(this.style.height+0) + this.jump) + 'px';
					this.timeout = setTimeout(this.objName+'.expand()', this.speed);
				}
			}
		
		this.contract = function () { 
			clearTimeout(this.timeout);
			if(parseInt(this.style.height + 0) > 0)
				{
					this.style.height = parseInt(parseInt(this.style.height+0) - this.jump) + 'px';
					this.timeout = setTimeout(this.objName+'.contract()', this.speed);
					if(parseInt(this.style.height + 0) <= (this.jump*2))
						{
							this.style.display='none';
						}
				}
			}
			
			
		this.hide = function() { this.style.visibility = 'hidden'; }
		this.show = function() { this.style.visibility = 'visible'; }

		/* PATCH FOR MSIE LEFT ISSUES : THE LAYERS SEEM TO BE MISSING 10 pixels of every thing */
		this.ismsie = (navigator.userAgent.match("MSIE 6")) ? 10 : 0;
		
		/* SETTING UP RELATIVE POSITION OF THE LAYERS 
			USED as layer_object.rel_left(amount_of_left_moving, layer_relative_to_which_to_move_left) 
			
			AND 
			
			layer_object.rel_top(amount_of_top_moving, layer_relative_to_which_to_move_top) 
		*/
		this.rel_left = function(reqleft, tolayerid) { this.style.left = parseInt(parseInt(document.getElementById(tolayerid).offsetLeft + 0) +  parseInt(reqleft) + this.ismsie) + 'px';}
		this.rel_top = function(reqtop, tolayerid) { this.style.top = parseInt(parseInt(document.getElementById(tolayerid).offsetTop + 0) +  parseInt(reqtop)+ this.ismsie) + 'px';}
	}
	
	
function nav_layer(id,html,layer_extra,left_amt, left_id)
	{
		document.write("<div id='"+id+"' "+layer_extra+" onmouseover='"+id+".expand();' onmouseout='"+id+".contract();'><div id='"+id+"_inner'>"+html+"</div></div>");
		lyr = new layer(id,id);
		lyr.rel_top(config_top,left_id);
		lyr.rel_left(left_amt,left_id);
		lyr.style.display='none';
		return lyr;
	}

