//-----------------------------------------------------------------------------------------------------------------
function getLayer(layerName)
{	
	return getLayerObject(layerName,"","visible");
	//attribute the div object to the menu object
//	if(myBrowser=="Netscape")
//	{					
//		return(window.document.layers[layerName]);				
//	}
//	else
//	{
//		return(eval(layerName));
//	}	
}

//-----------------------------------------------------------------------------------------------------------------

function getWidth(){

	//Determine Screen Width depending on browser		
	var MyWidth ;

	//NETSCAPE 4+
	if(myBrowser=="Netscape")
	{
		MyWidth = window.innerWidth;
	}
	
	//IE 4+
	if(myBrowser=="Explorer" || version == "5")
	{
		MyWidth = document.body.clientWidth ;
	}

	return MyWidth;
}




//-----------------------------------------------------------------------------------------------------------------
function Relative_Item(name,theleft)
{
	this.Reference = getLayer(name);	
	this.Left = theleft
}
//-----------------------------------------------------------------------------------------------------------------


//ADD AN ELEMENT TO THE RELATIVE LIST
//-----------------------------------------------------------------------------------------------------------------
function Relative(canvaWidth)
{	
	
	//create array to hold relative items
	this.Childs = new Array();
	
	//Canva vars
	this.CanvaWidth = canvaWidth;

	//insert object to keep relative to this canva
	this.Childs = new Array();
				
	//the Position function reposition the object relatively to the window width
	function rePosition()
	{	
		if(this.Childs.length > 0)
		{	
		
			//get inner width of window
			MyWidth = getWidth();

			//window is wider than canva
			if(MyWidth > this.CanvaWidth)
			{
				//calculate canva left
				Canva_Left = Math.round((MyWidth - this.CanvaWidth) / 2);	
			}
			//window is narower
			else
			{
				Canva_Left = 0;
			}
		

			//Apply new position to all childs
			for(i in this.Childs)
			{					
				newLeft = Canva_Left + this.Childs[i].Left

				//alert("left " + newLeft);
				//alert("layer " + this.Childs[i].Reference.id + " : " + newLeft);
								
				//EXPLORER
				
				if(myBrowser=="Explorer" || version == "5")
				{				
					this.Childs[i].Reference.style.left = newLeft										
				}
				//NETSCAPE
				else
				{		
					this.Childs[i].Reference.left = newLeft
				}
							
			}
		}		
	}

	//add function to object
	this.Position = rePosition;
}
//-----------------------------------------------------------------------------------------------------------------
