// SHOW HIDE LAYERS

function findPosition(object) {									// finds the position of a given object, used as reference point for our layer
		var positionLeft = positionTop = 0;							// declare variables to store co-ordinates
		if (object.offsetParent) {									// offsetParent returns the position from the nearest element in this case our link that was clicked
			do {
				positionLeft += object.offsetLeft;					// store the position
				positionTop += object.offsetTop;
			} while (object = object.offsetParent);
		}
		return [positionLeft,positionTop];							// return the co-ordinates of the link
	}
 
	function openLayer(object, myLayer)								// shows the layer and changes its position based on the given object
	{
		var coords = findPosition(object);							// get our co-ordinates from the findPosition function
		var layer = document.getElementById(myLayer);
		layer.style.top = 0 + coords[1] + 'px'; 					// change the 100 to alter co-ordinates of popup
		layer.style.left = 0 + coords[0] + 'px';					// places it from the top left corner of our object, in this case the link clicked.
		document.getElementById(myLayer).style.display='inline';	// show the layer
	}
 
	function closeLayer(myLayer) {
		document.getElementById(myLayer).style.display='none';
	}
	
	function endLayer(myLayer) {
		document.getElementById(myLayer).style.display='none';
	}

// EXPANDING MENU


function showElement(layer){
	var myLayer = document.getElementById(layer);
	if(myLayer.style.display=="none"){
	myLayer.style.display="block";
	myLayer.backgroundPosition="top";
	} else {
	myLayer.style.display="none";
	}
	}
	
	
//POPUPS

function MM_openBrWindow(theURL,winName,features) { 
  (window.open(theURL, winName, features, false));

}