// IE Browser-Detection
function getIEVersionNumber() {
	var ua = navigator.userAgent;
	var MSIEOffset = ua.indexOf("MSIE ");
	if (MSIEOffset == -1) {
		return 0;
	} else {
		return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
	}
}

//var ie55 = getIEVersionNumber() >= 5.5;


function popup(mylink, winname,w,h) {
	var breit = (w)? "width=" + w : "width=700";
	var hoch = (h)? "height=" + h : "height=500";

	if (!window.focus) return true;
	var href;
	if (typeof(mylink) == 'string')
		href=mylink;
	else
		href=mylink.href;
	window.open(href, winname, breit + ',' + hoch + ',scrollbars=yes, resizable=yes, menubar=yes').focus();
	return false;
}
var newWin;
function imgPopUp(cont, winname,w,h) {
	var width = (w)? (w) : 700;
	var height = (h)? (h) : 500;


	width += 70;
	height += 135;
	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;

		newWin = window.open("", winname, param + ',scrollbars=no, resizable=yes, menubar=no');
		newWin.resizeTo(width, height);
		setTimeout("putInWindow('" + cont + "')", 50);
		newWin.focus();

	return false;
}
function putInWindow(cont) {
	var newCont = "<html><head><title>Zoomansicht</title></head>";
	newCont += "<style type='text/css'>a img {border: solid 1px #000;} a:hover img {border: solid 1px #fff;}</style>"
	newCont += "<body style='background: #A5AAB0;margin: 0; padding: 30px 30px 45px 30px; height: 100%'>"
	newCont += "<div style='position: absolute; z-index: 1; font: 11px Verdana, sans-serif; color:#8A8A8A; margin-top: 30%; text-align: center;'>Bild wird geladen...</div>"
	newCont += "<div style='position: relative; z-index: 100;'><a href='#' onclick='self.close();'><img src='"+ cont + "'></a></div>";
	newCont += "<div style='position: relative; z-index: 100;padding-top: 10px;  text-align: center; color: #606060; font-size: 11px; font-family: Arial, Helvetica, sans-serif;'>Zum Schließen bitte auf das Bild klicken</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;
		}
	}
	return false;
}


function openHide(id) {
	obj = document.getElementById(id);
	obj.style.display = (obj.style.display == "block")? "none" : "block";
}

function applyShadow(targetElement, shadowColor, shadowOffset) {
  if (typeof(targetElement) != 'object') {
    targetElement = document.getElementById(targetElement);
  }
  var value = targetElement.firstChild.nodeValue;
  targetElement.style.position = 'relative';
  targetElement.style.zIndex = 1;

  var newEl = document.createElement('span');
  newEl.appendChild(document.createTextNode(value));
  newEl.className = 'shadowed';
  newEl.style.color = shadowColor;
  newEl.style.position = 'absolute';
  newEl.style.left = shadowOffset + 'px';
  newEl.style.top = shadowOffset + 'px';
  newEl.style.zIndex = -1;

  targetElement.appendChild(newEl);
}
