
/* javascript für das neue hauptmenü */

function dshow(id) {
	document.getElementById(id).style.display = "block";
}

function dhide(id) {
	document.getElementById(id).style.display = "none";
}

/*
function blendOut(id) {
	var element = document.getElementById(id);

	element.style.opacity = 0.15;

	element.style.filter = "Alpha(opacity=15)";
	element.style.mozOpacity= "0.15";

	// MSIE ONLY
	var ua = navigator.userAgent.toLowerCase();
	var iebrowser = (ua.indexOf("msie") > -1 && ua.indexOf("opera") == -1);

	if (iebrowser) {
		setChildAlpha(element, 15);
	}

}

function blendIn(id) {
	var element = document.getElementById(id);

	element.style.opacity = 1.0;

	element.style.filter="Alpha(opacity=100)";
	element.style.mozOpacity="1.0";

	// MSIE ONLY
	var ua = navigator.userAgent.toLowerCase();
	var iebrowser = (ua.indexOf("msie") > -1 && ua.indexOf("opera") == -1);

	if (iebrowser) {
		setChildAlpha(element, 100);
	}
}

function setChildAlpha(parent,alpha) {
	if (parent.hasChildNodes()) {

		for (var i = 0; i < parent.childNodes.length; i++) {

			if (parent.childNodes[i].nodeName == "div") {
				parent.childNodes[i].style.filter = "Alpha(opacity="+alpha+")";
				parent.childNodes[i].style.opacity = alpha/100.0;
				setChildAlpha(parent.childNodes[i], alpha);
			}
		}

	}
}
*/
function highlight_block(group) {
	if (navi_aktiver_block != group) {
		var navi_content = document.getElementById("navi_content"+group);
		navi_content.className = "navi_content_highlighted";
	}
}
function dehighlight_block(group) {
	if (navi_aktiver_block != group) {
		var navi_content = document.getElementById("navi_content"+group);
		navi_content.className = "navi_content";
	}
}

function highlight_zeile(group,id) {

	var element = document.getElementById("navi_zeile"+group+"_"+id);
	element.style.backgroundColor = "#cf4f10";
}

function dehighlight_zeile(group,id) {

	var element = document.getElementById("navi_zeile"+group+"_"+id);
	element.style.backgroundColor = "";
}

/* /javascript für das neue hauptmenü */

/* JS für Hot Spots */
var highlight_box_shown = 1;

function highlight_box_show(no) {
	alt_text = document.getElementById("highlight-box-show-" + highlight_box_shown);
	alt_text.style.display = "none";
	alt_image = document.getElementById("highlight-box-text-" + highlight_box_shown);
	alt_image.style.display = "none";
	alt_spalt = document.getElementById("highlight-box-preview-hover-" + highlight_box_shown);
	alt_spalt.style.display = "none";
	highlight_box_shown = no;
	neu_text = document.getElementById("highlight-box-show-" + no);
	neu_text.style.display = "block";
	neu_image = document.getElementById("highlight-box-text-" + no);
	neu_image.style.display = "block";
	neu_spalt = document.getElementById("highlight-box-preview-hover-" + no);
	neu_spalt.style.display = "block";
}
/* JS für Hot Spots ENDE */

// Funktionen, um Bild zu ersetzen

function arrayFind (field, search) {
  for (var i = 0; i < field.length; i++) {
    if (field[i] == search) {
      return i;
    }
  }
  return -1;
}

function showImagePopup(linkId)
{
  var data = imagePopupData[linkId];
  popup = $('project-image-popup');
  heading = $('project-image-popup-heading');
  image = $('project-image-popup-image');

  heading.innerHTML = data['label'];
  image.src = data['url'];
  popup.style['display'] = "block";
}

function hideImagePopup()
{
  popup = $('project-image-popup');
  popup.style['display'] = "none";
}

function prepareImagePopupLinks()
{


  for (var linkId in imagePopupData) {
    link = $(linkId);
    link.href = "javascript:showImagePopup('"+linkId+"')";
    link.target = "_self";
  }
}

function positionImagePopup(e)
{
	popup = $('project-image-popup');
	if (popup == undefined) return;

	// calculate popup position
	winWidth = document.viewport.getWidth();
	popupWidth = popup.getWidth();
//alert("winWidth: "+winWidth+" popupWidth: "+popupWidth);
	posX = Math.round((winWidth / 2) - (popupWidth / 2));
	if (posX < 25) posX = 25;
	popup.style.left = posX+'px';
//alert("positioned to x: "+posX);
}

var bugRiddenCrashPronePieceOfJunk=(navigator.userAgent.indexOf('MSIE 5')!=-1&&navigator.userAgent.indexOf('Mac')!=-1)
var W3CDOM=(!bugRiddenCrashPronePieceOfJunk&&typeof document.getElementsByTagName!='undefined'&&typeof document.createElement!='undefined');

var sizeStyles = new Array("Small Text", "", "Large Text");
var sizeStyle = 1;

function adjustFontSize(direction)
{
  var newSize = sizeStyle + direction;
  if (newSize < 0) return false;
  if (newSize > 2) return false;
  setActiveStyleSheet(sizeStyles[newSize]);
  sizeStyle = newSize;
}

// StyleSwitcher functions written by Paul Sowden
function setActiveStyleSheet(title) {
    // terminate if we hit a non-compliant DOM implementation
    if (!W3CDOM){return false};

    var i, a, main;
    for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
        if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
            a.disabled = true;
            if (a.getAttribute("title") == title) {
                a.disabled = false;
            }
        }
    }
};


/* Javascript fuer die Teamseite */
/*
function team_show(name) {
	var Bild = document.getElementById("team_bild_"+name);
	Bild.style.zIndex = 3;
}

function team_hide(name) {
	var Bild = document.getElementById("team_bild_"+name);
	Bild.style.zIndex = 1;
}
*/

/* Javascript für die Teamseite */
var team_letztes_highlight = "";

function team_show(der) {
  if (der != team_letztes_highlight)
    team_hide(team_letztes_highlight);
  team_letztes_highlight = der;

  var Bild = document.getElementById("team_bild_" + der);

  Bild.style.zIndex = 3;

  document.getElementById("team_infobild").src = '/img/team/team_' + der + '.gif';
}

function team_hide(der) {
  if (der != "") {
    var Bild = document.getElementById("team_bild_" + der);
    Bild.style.zIndex = 1;

  document.getElementById("team_infobild").src = '/img/team/team_info.gif';
  }
}
/* Javascript für die Teamseite - Ende */

/* Javascript für das Kontaktformular - Start */
function doFocus(id) {
	var element = document.getElementById(id);
	if (element) {
		element.style.backgroundColor = "#d0ffc5";
	}
}
function doBlur(id) {
	var element = document.getElementById(id);
	if (element) {
		element.style.backgroundColor = "";
		if (element.value != "") {
			document.getElementById(id + 'Tick').style.visibility = "visible";
		} else {
			document.getElementById(id + 'Tick').style.visibility = "hidden";
		}
	}
}

function contactInterestsChanged(e)
{
	var oic = $('OtherInterestsContainer');
	if ($(e).getValue() == 'Sonstiges') {
		oic.update('<input type="text" name="data[Contactform][interest]" id="ContactformInterestOther" class="input" style="width: 250px;" />');
	} else {
		oic.update('');
	}
}
/* Javascript für das Kontaktformular - Ende */