var popUpWin;
function popup(mylink, winname,w,h) {
	var breit = (w)? "width=" + (w + 40) : "width=700";
	var hoch = (h)? "height=" + (h + 40) : "height=500";
	
	if (!window.focus) return true;
	var href;
	if (typeof(mylink) == 'string')
		href=mylink;
	else
		href=mylink.href;
	popUpWin = window.open(href, winname, breit + ',' + hoch + ',scrollbars=yes, resizable=yes, menubar=yes');
	popUpWin.focus();
	return false;
}
var newWin;
function imgPopUp(cont, winname,w,h) {
	var width = (w)? (w) : 700;
	var height = (h)? (h) : 500;
	var left = parseInt((screen.availWidth/2) - (width/2));
	var top = parseInt((screen.availHeight/2) - (height/2));
	var param = "width=" + width + ", height=" + height + ", left=" + left + ", top=" + top; 
	if (!newWin || newWin.closed) {
		newWin = window.open("", winname, param + ',scrollbars=no, resizable=yes, menubar=no');
		setTimeout("putInWindow('" + cont + "')", 50);
		newWin.focus();
	} else {
		if (newWin.name != winname) {
			putInWindow(cont);
			newWin.resizeTo(width, height);
			newWin.moveTo(left, top);
			newWin.name = winname
		}
		newWin.focus();
	}
	return false;
}
function putInWindow(cont) {
	var newCont = "<html><head><title>Preview</title></head>";
	newCont += "<body style='margin: 0; padding: 0; height: 100%'>"
	newCont += "<div style='position: relative; z-index: 1; font: 11px Verdana, sans-serif; color:#8A8A8A; margin-top: 30%; text-align: center;'>Bild wird geladen...</div>"
	newCont += "<div style='position: absolute; z-index: 100; top: 0'><img src='"+ cont + "'></div>";	
	newCont += "</body></html>";
	newWin.document.write(newCont);
	newWin.document.close();
}

function checkChangeForm() {
	if(window.top.topFrame.changeForm == true) {
		if (confirm("Es wurden anscheinend Änderungen am Formular durchgeführt.\n Klicken Sie Abbrechen um die Änderungen speichern zu können.\n Klicken Sie OK wenn Sie die Änderungen nicht speichern möchten")) {
			return true;
		} else {
			return false;
		}
	} else {
		return false;
	}
}


function openHide(id) {
	obj = document.getElementById(id);
	obj.style.display = (obj.style.display == "block")? "none" : "block";
}