function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
		func();
		}
	}
}

function trim(str) {
	return str.replace(/^\s*|\s*$/g,"");
}

var w = null;
function show_pop(url, win_width, win_height) {

	var win_offset_x = 0;
	var win_offset_y = 0;

	// open venster
	var strProperties = 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,left=' + win_offset_x + ',top=' + win_offset_y + ',width=' + win_width + ',height=' + win_height;
	if (!w) {
		w = window.open(url,'w',strProperties);
	}
	else {
		if (!w.closed) w.location.href = url;
		else w = window.open(url,'w',strProperties);
	}
	if (window.focus) {
		w.focus();
	}
}

function closePop() {
	if (w) {
		if (!w.closed) {w.close(); w=null;}
	}
}

