/**
  * User Interface Functions
  * Author: Jens Ansorg
  */

function downloadPopup(anchor) {
  var strFeatures = "top=50,left=50,width=620,height=370,toolbar=no,menubar=yes,resizable=yes,scrollbars=yes";
  var newWin = window.open("about:blank", anchor.target, strFeatures);
  newWin.focus();
  return true;
}


/*
  taken from bcg.de
	checks if given formfield is empty (="").
	returns true if formfield is empty otherwise it returns false
*/
function isEmptyFormField(field) {
	var result = true;

	if(field != null)
		if(field.value != "")
			result = false;

	return result;
}

/*
  taken from bcg.de
	shows an alert with the name of the given form field and focus on the form field
*/
function FormFieldEmptyWarning(field) {
	if(field != null) {
		alert('Please fill in "' + field.name + '"');
		field.focus();
	} else {
		alert('Please fill in all fields');
	}
}

/* some helper functions for mozilla/ie compatibility */
function _getEvent (e) {
	return  (e) ? e :	window.event;
}

function _getEventTarget (evt) {
	return (window.event) ? evt.srcElement : evt.target;
}

function getNextSibling(elem) {
	var nextElem = elem.nextSibling;
	if (nextElem.nodeType == 3) {
		return getNextSibling(nextElem);
	} else {
		return nextElem;
	}
}

function _stopEventBubbling(evt) {
  if (window.event) {
    evt.cancelBubble = true;
  } else {
    evt.stopPropagation();
  }
}

/* give some debug output */
function __getElementInfo(elem) {
	alert( elem.id + "\n" + elem.tagName + "\n" + elem.nodeType + "\n" + elem.className );
}
