
function appear ( id ) {
    new Effect.toggle(id, 'appear');
}

function klapptext ( id ) {
    new Effect.toggle(id, 'blind');
}

function over (id) {
    $(id).src = '/gfx/lay/lay_'+id+'_mo.jpg';
}
function out (id) {
    $(id).src = '/gfx/lay/lay_'+id+'.jpg';
}

function link (url) {
    location.href = url;
}

function getPageOffsetLeft(el) {
  // Return the x coordinate of an element relative to the page.
  var x = el.offsetLeft;
  if (el.offsetParent != null)
    x += getPageOffsetLeft(el.offsetParent);
  return x;
}

function getPageOffsetTop(el) {
  // Return the x coordinate of an element relative to the page.
  var y = el.offsetTop;
  if (el.offsetParent != null)
    y += getPageOffsetTop(el.offsetParent);
  return y;
}

var currentload = '';

function show_pm( id ) {
	if ( currentload != 'pm_' + id ) {
		if ( $('hover').style.display == 'none' ) new Effect.toggle('hover', 'blind');
		$('hover').innerHTML = ' Daten werden geladen ...'; //<img src="gfx/ico/spinner.gif" />
	  	$('hover').style.left = getPageOffsetLeft($('mitte')) + 'px';
	  	$('hover').style.top = getPageOffsetTop($('mitte')) + 10 + 'px';
	  	//$('hover').style.top = mousepos_y + 10 + 'px';
		new Ajax.Updater('hover', './lib/ajax/mailsystem.php', { parameters: 'id=' + id, asynchronous:false });
	  	currentload = 'pm_' + id;
	}
	else new Effect.toggle('hover', 'blind');
}

function new_pm ( id ) {
	if ( currentload != 'new_' + id ) {
		if ( $('hover').style.display == 'none' ) new Effect.toggle('hover', 'blind');
		$('hover').innerHTML = ' Daten werden geladen ...'; //<img src="gfx/ico/spinner.gif" />
	  	$('hover').style.left = getPageOffsetLeft($('mitte')) + 'px';
	  	$('hover').style.top = getPageOffsetTop($('mitte')) + 10 + 'px';
	  	//$('hover').style.top = mousepos_y + 10 + 'px';
		new Ajax.Updater('hover', './lib/ajax/new_pm.php', { parameters: 'id='+id, asynchronous:false });
	  	currentload = 'new_' + id;
	}
	else new Effect.toggle('hover', 'blind');
}
function submit_pm ( to ) {
    $('hidden_text').value = $('text').value;
    $('hidden_topic').value = $('topic').value;
    $('hidden_frm').action += to + '/';
    $('hidden_frm').submit();
}

function getlen ( id, maxlimit ) {
	var zahl;
	zahl = maxlimit - $(id).value.length;

	$(id + '_counter').innerHTML = zahl;
}