/* Hilfsfunktion */
function byId(element) { return document.getElementById(element); }

/* Rechtsklick deaktivieren */
function click (e) {
  if (!e)
    e = window.event;
  if ((e.type && e.type == "contextmenu") || (e.button && e.button == 2) || (e.which && e.which == 3)) {
    if (window.opera)
      window.alert("Diese Funktion ist deaktiviert.");
    return false;
  }
}

/* Funktionen für Schnellsuchformular-Formatierung */
function activate() {  
	element = byId('suchfeld');
	vorbelegung = 'Suchtext';
	
  if (element.value == vorbelegung) {
    element.value = '';
	}
  element.className = 'normal';
	element.style.backgroundColor = '#FFFFC0';
}

function leave() {
	element = byId('suchfeld');
	vorbelegung = 'Suchtext';
	
  if (element.value == '') {
    element.value = vorbelegung;  
    element.className = 'vorbelegung';
  }
  element.style.backgroundColor = '#FFFFFF';
}

/* Trim - Funktion für Strings*/
function trim(str) {
	return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

/* Nachbildung der Hover-Funktionalität für IE6 */
function hover(element, css, wert) {
	element.style[css] = wert;
	element.style.cursor = "pointer";
}

/* URL in neuem Fenster öffnen */
function oeffneFenster(url) {
	var width = window.outerWidth;
	var height = window.outerHeight;
	if (width == null || height == null) {
		width 	= document.body.offsetWidth;
		height 	= document.body.offsetHeight;
	}
	window.open(url, "_blank", "width="+width+", height="+height+", left=0, top=0, resizable=yes, toolbar=yes, menubar=yes, status=yes, location=yes, scrollbars=yes");
}

/* Eventhandler */
if (document.layers) document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = click;
document.oncontextmenu = click;
window.onload = leave;
