
function exp (id) {
  if (document.getElementById("exp_" + id).style.display == "none") {
    document.getElementById("exp_" + id).style.display = "";
  } else {
    document.getElementById("exp_" + id).style.display = "none";
  }
}



function expandcollapse( ptr )
{
  var img = ptr.firstChild;
  var contentspan = ptr.nextSibling.nextSibling;

  /* img und contentspan benutzen ... */
}


function sety(smilie) {
smilie = ""+smilie+"";
document.form1.text.value=document.form1.text.value + smilie
}

function expand(listID) {
	if (listID.style.display=="none") {
		listID.style.display="";
	} else {
		listID.style.display="none";
	}
	window.event.cancelBubble=true;
}

function contract(listID) {
	if (listID.style.display=="show") {
	        listID.style.display="";
	} else {
	        listID.style.display="none";
	}
	window.event.cancelBubble=true;
}

function swap (id) {
  if (document.getElementById("div_" + id).style.display == "none") {
    document.getElementById("img_" + id).src = "minus.gif";
    document.getElementById("div_" + id).style.display = "";
  } else {
    document.getElementById("img_" + id).src = "plus.gif";
    document.getElementById("div_" + id).style.display = "none";
  }
}

function swap_menu (id) {
  if (document.getElementById("div_" + id).style.display == "none") {
    document.getElementById("div_" + id).style.display = "";
  } else {
    document.getElementById("div_" + id).style.display = "none";
  }
}

function insert(code, id)
{
	document.getElementById(id).value = document.getElementById(id).value + code;
}

function set(smilie) {
smilie = ""+smilie+"";
document.eintrag.inhalt.value=document.eintrag.inhalt.value + smilie
}

function popup(was)
{
	window.open(was,"Popup","width=460,height=300,resizable=yes, scrollbars=yes, toolbar=no, location=no, menubar=no");
}

function setCheckboxes(the_form, do_check)
{
    var elts      = (typeof(document.forms[the_form].elements['selected_db[]']) != 'undefined')
                  ? document.forms[the_form].elements['selected_db[]']
                  : (typeof(document.forms[the_form].elements['selected_tbl[]']) != 'undefined')
          ? document.forms[the_form].elements['selected_tbl[]']
          : document.forms[the_form].elements['selected_fld[]'];
    var elts_cnt  = (typeof(elts.length) != 'undefined')
                  ? elts.length
                  : 0;

    if (elts_cnt) {
        for (var i = 0; i < elts_cnt; i++) {
            elts[i].checked = do_check;
        } // end for
    } else {
        elts.checked        = do_check;
    } // end if... else

    return true;
}



/* Tooltip Funktion */
/********************/

var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = 20;
var toolTipSTYLE = "";

function initToolTips()
{
	if (ns4 || ns6 || ie4 || ie55)
	{
		if (ns4)
		{
			toolTipSTYLE = document.toolTipLayer;
		}
		else if (ns6)
		{
			toolTipSTYLE = document.getElementById("toolTipLayer").style;
		}
		else if (ie4 || ie55)
		{
			toolTipSTYLE = document.all.toolTipLayer.style;
		}

		if (ns4)
		{
			document.captureEvents(Event.MOUSEMOVE);
		}
		else
		{
			toolTipSTYLE.visibility = "visible";
			toolTipSTYLE.display	= "none";
		}

		document.onmousemove = moveToMouseLoc;
	}

	NaviHelperLeft = findPosX (document.getElementById('NavigationControl'));
}

function toolTip (msg, width)
{
	fg = "#000000";
	bg = "#FFFFCC";

	if (toolTip.arguments.length < 1) // hide
	{
		if (ns4)
		{
			toolTipSTYLE.visibility = "hidden";
		}
		else
		{
			toolTipSTYLE.display = "none";
		}
	}
	else // show
	{
		/*if (!fg)
		{
			fg = "#000000";
		}

		if (!bg)
		{
			bg = "#FFFFCC";
		}*/

		if (!width)
		{
			width = 180;
		}
		if (width == 0)
		{
			width = null;
		}

		var content =
		'<table width="' + width + '" border="0" cellspacing="1" cellpadding="0" bgcolor="' + fg + '"><td>' +
		'<table width="' + width + '" height="30" border="0" cellspacing="0" cellpadding="5" bgcolor="' + bg +
		'"><td align="left"><span class="tooltip">' + msg +
		'&nbsp\;</span></td></table></td></table>';

		if (ns4)
		{
			toolTipSTYLE.document.write(content);
			toolTipSTYLE.document.close();
			toolTipSTYLE.visibility = "visible";
		}
	    else if (ns6)
		{
			document.getElementById("toolTipLayer").innerHTML = content;
			toolTipSTYLE.display = 'block';
		}
		else if (ie4 || ie55)
		{
			document.all("toolTipLayer").innerHTML = content;
			toolTipSTYLE.display = 'block';
		}
		else
		{
			document.all("toolTipLayer").innerHTML = content;
			toolTipSTYLE.display = 'block';
		}
	}
}

function moveToMouseLoc(e)
{
	if (ns4 || ns6)
	{
		x = e.pageX;

		if ((x + 220) > window.screen.availWidth)
		{
			x = window.screen.availWidth - 210;
		}

		y = e.pageY;
	}
	else
	{
		x = event.x + document.body.scrollLeft;

		if ((x + 220) > window.screen.availWidth)
		{
			x = window.screen.availWidth - 210;
		}

		y = event.y + document.body.scrollTop;
	}

	toolTipSTYLE.left = x + offsetX;
	toolTipSTYLE.top  = y + offsetY;


	//
	// get left, top, width, height for active dropdown
	//
	/*if (ActiveDropDown)
	{
		var aleft   = ActiveDropDown.offsetLeft;
		var awidth  = aleft + ActiveDropDown.offsetWidth;

		if (ns4 || ns6)
		{
			var atop    = ActiveDropDown.offsetTop - 20; // 18
			var aheight = atop + ActiveDropDown.offsetHeight + 20;

			x = e.pageX;
			y = e.pageY;
		}
		else
		{
			var atop    = ActiveDropDown.offsetTop - 18; // 16
			var aheight = atop + ActiveDropDown.offsetHeight + 18;

			x = event.x + document.body.scrollLeft;
			y = event.y + document.body.scrollTop;
		}

		//
		// Check if the mouse was moved outside the bound-area
		//
		if (!(x >= aleft && x <= awidth && y >= atop && y <= aheight) && !(x >= NaviHelperLeft && x >= (aleft - 25) && x <= awidth && y >= atop && y <= (atop + 18)))
		{
			ActiveDropDown.style.display = "none";

			//
			// Get id for the main navi item
			//
			id = ActiveDropDown.id.replace ("Div", "");

			//
			// Set background, color
			//
			if (document.getElementById(id).style.fontWeight == "normal" || document.getElementById(id).style.fontWeight == "")
			{
				document.getElementById(id).style.backgroundColor = "#7B7B7B";
				document.getElementById(id).style.color			  = "#CECECE";
			}

			//
			// Show form elements / flash
			//
			if (DropDownExceptions != null)
			{
				for (i = 0; i < DropDownExceptions.length; i++)
				{
					document.getElementById(DropDownExceptions[i]).style.visibility = "visible";
				}
			}
		}
	}*/

	return true;
}


function navimove (aobject, bgcolor, linkcolor)
{
	//
	// Get id for the main navi item
	//
	id = aobject.id.replace ("Div", "");

	//
	// Set background, color
	//
	document.getElementById(id).style.backgroundColor = bgcolor;
	document.getElementById(id).style.color			  = linkcolor;
}
