function _toggleSection(a){
	var c=a.id.indexOf("_");
	if(c==-1){return false}
	var b="cp"+a.id.substring(c);
	if(a.name=="on"){
		_setEltDisplay(b,"");
		a.name="off";
	} else {
		_setEltDisplay(b,"none");
		a.name="on";
	}
	return false;
}

var tt = null;
var visible = false;
var xOffset = -5;
var yOffset = 20;

var mouseDownX = 0;
var mouseDownY = 0;

// param: event - the mouse event
// return: none
// global: set mouseDownX and mouseDownY
function showPosition(e) {
    e=e||window.event
	mouseDownX = e.clientX + ( document.documentElement.scrollLeft || document.body.scrollLeft );
	mouseDownY = e.clientY + ( document.documentElement.scrollTop || document.body.scrollTop );
	window.status = 'X: ' + mouseDownX + ', Y: ' + mouseDownY
}

//document.onmousemove = showPosition

// param: divId - id of surrounding of the tooltip div
//        anchorId - id of 'mehr' anchor
// return: none
function toggleTt(divId, anchorId, xOffsetUser, yOffsetUser) {
  if (xOffsetUser == undefined)
	  xOffsetUser = 0;
	  
  if (yOffsetUser == undefined)
	  yOffsetUser = 0;	
  
  var oIframe = null;
	if(visible == true) {
		tt.style.display = "none";
		visible = false;

	} else {
		// get tooltip
		tt = document.getElementById(divId);
		
		var anchorElement = document.getElementById(anchorId);
		
		if ( ! anchorElement ) {
			return false;
		}
		
		//Determine the absolute position of the more link
		var curleft = 0;
		var curtop = 0;
		
		var currentObject = anchorElement;
		if ( currentObject.offsetParent ) {
			curleft = currentObject.offsetLeft;
			curtop = currentObject.offsetTop;
			while ( currentObject = currentObject.offsetParent ) {
				curleft += currentObject.offsetLeft
				curtop += currentObject.offsetTop
			}
		}

		//Make it visible
		tt.style.display = "block";
		visible = true;

		//Insert into the body
		var thisBody = document.getElementsByTagName("body")[0];
		thisBody.insertBefore( tt, thisBody.firstChild );

		//Determine the current window size and visible area
		var windowSize = new WindowSize();

		//Adjust width of the element if >30% of page width to 30%
		if ( tt.offsetWidth > ( 0.3 * windowSize.width ) ) {
			tt.style.width = Math.floor( (0.3 * windowSize.width) ) +"px";
		}

		//Use a help cursor
		anchorElement.style.cursor = "help";
		
		//Adjust if they are off-screen
		if ( (curtop + yOffset + tt.offsetHeight) > windowSize.visibleBottom ) {
			//Try to go to the top
			var curtopTmp = (curtop - (anchorElement.offsetHeight + tt.offsetHeight)) - 5;
			if (curtopTmp > windowSize.visibleTop) {
				curtop = curtopTmp;
			}
		}
		if ( (curleft + xOffset + tt.offsetWidth) > (windowSize.width - 10) ) {
			//Go to the left
			curleft = (curleft + anchorElement.offsetWidth + 5) - tt.offsetWidth;
		}

		//Set the position
		tt.style.left = (curleft + xOffset) + "px";
		tt.style.top = (curtop + yOffset ) + "px";
		tt.style.position = "absolute";

		if (document.all && tt.firstChild.nodeName.toLowerCase()=='iframe') {
			tt.firstChild.style.width = tt.clientWidth + 'px';
			tt.firstChild.style.height = tt.clientHeight + 'px';
		}
	}	
} 

/**
 * "Class" for determining the size of the current display window
 */
function WindowSize() {

	//The total height of the window
	this.height = 100;

	//The width of the window
	this.width = 100;

	//The top and bottom location of the visible area
	this.visibleTop = 0;
	this.visibleBottom = 100;

	/**
	 * Refreshes the values by re-calculating the window size
	 */
	this.refresh = function() {

		//Cross browser code
		if (window.innerHeight) { // all except Explorer
			this.height = window.innerHeight;
			this.width = window.innerWidth;
			this.visibleTop = window.pageYOffset;
		}
		else if (document.documentElement ) {
			// Explorer 6 Strict Mode
			var docElement = document.documentElement;
			if ( docElement.clientHeight ) {
				this.height = docElement.clientHeight;
				this.width = docElement.clientWidth;
				this.visibleTop = docElement.scrollTop;
			}
		}
		else if (document.body) // other Explorers
		{
			var docBody = document.body;
			this.height = docBody.clientHeight;
			this.width = docBody.clientWidth;
			this.visibleTop = docBody.scrollTop;
		}		
		
		//Use the top to calculate the bottom value
		this.visibleBottom = this.visibleTop + this.height;
	};

	//Execute the function
	this.refresh();
}    

function setVisibility(a,c){
	if(!document.getElementById){
		return false
	}
	var b=document.getElementById(a);
	if(b){
		b.style.display=c
	}
	return false
}

function toggleSection(a){
	var toggleImage = a.getElementsByTagName("img")[0];
	if ( toggleImage === null ) {
		return false;
	}
	var containedList = a.parentNode.getElementsByTagName("ul")[0];
	if ( containedList === null ) {
		return false;
	}
 
	if( toggleImage.src.search(/plus\.gif/) > -1 ) {
		toggleImage.src = toggleImage.src.replace(/plus\.gif/, "minus.gif");
		containedList.style.display = "";
	} else {
		toggleImage.src = toggleImage.src.replace(/minus\.gif/, "plus.gif");
		containedList.style.display = "none";
	}
 
	return false;

}
