function showContentEinsatz(id) {
        var name = 'einsaetzeItemContent_'+id;

        if (document.getElementById(name).className == 'einsaetzeItemContentOpened')
                document.getElementById(name).className = 'einsaetzeItemContentClosed';
        else
                document.getElementById(name).className = 'einsaetzeItemContentOpened';

        var name = 'einsaetzeItemHead_'+id;

        if (document.getElementById(name).className == 'einsaetzeItemHeadlineOpened')
                document.getElementById(name).className = 'einsaetzeItemHeadlineClosed';
        else
                document.getElementById(name).className = 'einsaetzeItemHeadlineOpened';
}

function switchColorEinsatzOver(obj) {
         obj.style.backgroundColor="#D22A14";
}

function switchColorEinsatzOut(obj) {
         obj.style.backgroundColor="#C11601";
}

function goToUrlEinsatz(select) {
        var wert = select.options[select.options.selectedIndex].value;
        if (wert == "leer") {
                select.form.reset();
                return;
        } else {
                select.form.reset();
                window.location.href = 'index.php?content=einsaetze&action=YearSearch&YearSearch_Year='+wert;
        }
}

function goToUrlAktivitaeten(select) {
        var wert = select.options[select.options.selectedIndex].value;
        if (wert == "leer") {
                select.form.reset();
                return;
        } else {
                select.form.reset();
                window.location.href = 'index.php?content=aktivitaeten&action=YearSearch&YearSearch_Year='+wert;
        }
}

function preload() {

}

function showFooterShadow() {
        if (navigator.appName !="Netscape")
                colordepth = screen.colorDepth;
        else
                colordepth = screen.pixelDepth;

        if (colordepth >=24)
                document.getElementById("tableMainBottomShadow").style.visibility = 'visible';
}

function switchColorTextField(obj,option) {
        switch (option) {
                case "light":
                        obj.className="TextFieldClicked";
                        break;
                case "dark":
                        obj.className="TextField";
                        break;
        }
}

function newWindow(url, width, height) {
        nameOfPopup = "popup"+Math.round(Math.random()*10000);
        popup = window.open(url, nameOfPopup, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+width+",height="+height);
        popup.focus();
        return popup;
}

function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function getPageEventCoords(evt) {
	var coords = {left:0, top:0};
	if (evt.pageX) {
		coords.left = evt.pageX;
		coords.top = evt.pageY;
	} else if (evt.clientX) {
		coords.left = evt.clientX + document.body.scrollLeft - document.body.clientLeft;
		coords.top = evt.clientY + document.body.scrollTop - document.body.clientTop;
		// include html element space, if applicable
		if (document.body.parentElement && document.body.parentElement.clientLeft) {
			var bodParent = document.body.parentElement;
			coords.left += bodParent.scrollLeft - bodParent.clientLeft;
			coords.top += bodParent.scrollTop - bodParent.clientTop;
		}
	}
	return coords;
}


function getScrollPos() {

	var scrollPos;
	if (typeof window.pageYOffset != 'undefined') {
	   scrollPos = window.pageYOffset;
	}
	else if (typeof document.compatMode != 'undefined' &&
		 document.compatMode != 'BackCompat') {
	   scrollPos = document.documentElement.scrollTop;
	}
	else if (typeof document.body != 'undefined') {
	   scrollPos = document.body.scrollTop;
	}

	return scrollPos;

}

function moveIt(e) {

	if (document.getElementById('largeImageContainer').style.visibility=='visible') {
		
		var deltaY = getPageEventCoords(e).top-488;
		if (deltaY<getScrollPos())
			deltaY=getScrollPos();
		
		document.getElementById('largeImageContainer').style.left = '372px';
		document.getElementById('largeImageContainer').style.top = deltaY+'px';
		document.getElementById('largeImage').style.width = '514px';
		
	}

	return false;

}

function showLargerPhoto(imgUrl, e) {
	document.onmousemove=moveIt;
	document.getElementById('largeImage').src=imgUrl;
	document.getElementById('largeImageContainer').style.visibility = 'visible';					


}

function hideLargerPhoto() {				
	document.onmousemove='';
	document.getElementById('largeImageContainer').style.visibility = 'hidden';
	document.getElementById('largeImage').src='';
}

