var child = new Array();
var child_count = 0;

function popup(url, w, h) {
	if (!w) w = 740;
	if (!h) h = 500;	
	child[child_count] = window.open(url, '', 'width='+w+',height='+h+',status=yes,scrollbars=yes,resizable=yes');
	child_count += 1;
	return false;
}

function popup_with_size(url,width,height){
	
	child[child_count] = window.open(url, '', 'width=' + width + ',height=' + height + ',status=yes,scrollbars=yes,resizable=yes');
	child_count += 1;
	
	return false;
}

function refresh_opener() {
	var win = window;

	while(o = win.opener) {
		url = o.location.href;
		if (url.match(/SESSION/i)) {
			o.location.replace(url);
			window.setTimeout("self.focus();", 800);
		}
		/*
		else {
			alert('Die darunterliegende Seite wurde nicht refreshed\nda keine Session in der URL gefunden wurde.');
		}
		*/
		win = o;
	}
}

function refresh_opener_close() {
	refresh_opener();
	if (window.opener) self.close();
}

function close_popup() {
	if (window.opener) window.opener.focus();
	window.close();
	return false;
}

function cleanup(){
	for(i=0;i<child_count;i++){
		if(child[i] && child[i].open && !child[i].closed){
			child[i].close();
		}
	}
}

function mdb_reset(_elem_)
{
	document.getElementById(_elem_+'mdb_file').value = "please choose";
	document.getElementById(_elem_+'mdb_id').value = 0;
	return false;
}

