/**
 * opens a popup window
 */
var popUps = new Array();
function openPopup(source, popupname, attributes) {
	if(!source) {
		 return;
	}
	if (!popUps[popupname] || popUps[popupname].closed==true) {
		window.open(source,popupname,attributes);
	} else {
		popUps[popupname].close();
		popUps[popupname] = window.open(source,popupname,attributes);
	}
}


/**
* set events, w3c-compatible and ie
*/
function addEvent(obj, eventType, func, useCaption)
{
	try {
		if(location.href.indexOf(".print.") != -1) {
			return;
		}
		if (!obj || !eventType || !func) {
			return false;
		} else if (obj.addEventListener) {
			obj.addEventListener(eventType, func, useCaption);
			return true;
		} else if (obj.attachEvent) {
			var retVal = obj.attachEvent("on"+eventType, func);
			return retVal;
		} else {
			return false;
		}
	} catch(exc){}
}

/**
 * set a css class for a html element
 */
function setClass(element, className) {
	if(element == null || className == null) {
		return;
	}

	if(document.all && !window.opera) {
		element.className = className;
	} else{
		element.setAttribute("class", className);
	}
}

/**
 * remove a css class from a html element
 */
function removeClass(element) {
	if(element == null) {
		return;
	}

	if(document.all && !window.opera) {
		element.className = "";
	} else{
		element.removeAttribute("class");
	}
}

/**
 * get the name of a css class from a html element
 */
function getClassName(element) {
	if(element == null) {
		return "";
	}
	var className = document.all && !window.opera ? element.className : element.getAttribute("class");
	return className == null ? "" : className;
}