
var IE = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("Mac") < 0);


function getobject(obj){
if (document.getElementById)
return document.getElementById(obj)
else if (document.all)
return document.all[obj]
}




function getPageSize(){

var xScroll, yScroll;

if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight){ // Explorer 6 strict mode
xScroll = document.documentElement.scrollWidth;
yScroll = document.documentElement.scrollHeight;
} else { // Explorer Mac...would also work in Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}

var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}

// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}

// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}


arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}



var popup_build = "";

function iframe(inlineURL)
{



if (popup_build == "")
{

		var objBody = document.getElementsByTagName("body").item(0);
		
		var objOverlay = document.createElement("div");
		objOverlay.setAttribute('id','inline');
		objBody.appendChild(objOverlay);

		var objSchliessenLink = document.createElement("a");
		objSchliessenLink.setAttribute('href','javascript:hideInline("inline")');
		objSchliessenLink.innerHTML = 'pop-up schlie&szlig;en [x]';
		objOverlay.appendChild(objSchliessenLink);


		var objInlineFrame = document.createElement("iframe");
		objInlineFrame.setAttribute('id','inline-frame');
		objInlineFrame.setAttribute('name','inline-frame');
        objInlineFrame.setAttribute('frameBorder',"0");
		objInlineFrame.setAttribute('hspace',"0");
		objInlineFrame.setAttribute('src','');
		objOverlay.appendChild(objInlineFrame);
	
	
		var objLightboxBg = document.createElement("div");
		objLightboxBg.setAttribute('id','lightbox-bg');
		objBody.appendChild(objLightboxBg);
		
		popup_build = "yes";

}


arrayPageSize = getPageSize();

// vertikale Zentrierung
breite = "720";
posLeft = (arrayPageSize[2] - breite) / 2;

if (posLeft <= 0)	{
  getobject("inline").style.left = "0px";	}

else	{
  getobject("inline").style.left = posLeft + "px";	}


//  75% hoehe
  getobject("inline").style.height = arrayPageSize[3] / 1.33 + "px";



if (document.all && !window.opera)	{
	winYOffset = document.body.scrollTop;	}

else if (document.getElementById)	{
	winYOffset = window.pageYOffset;
	winYOffset = 0;
	}

//  top bei 75% hoehe
  inlineTop = (arrayPageSize[3] / 9) + winYOffset;
  getobject("inline").style.top = inlineTop + "px";


// Seite aufrufen
// getobject("inline-frame").src = inlineURL;
  parent.frames[0].location.replace(inlineURL);
  getobject("inline").style.display= "block";
  


// IE

if (document.all && !window.opera)	{

// select ie sichtbarkeit

for(i = 0; i < document.getElementsByTagName("select").length; i++)
{
  document.getElementsByTagName("select")[i].style.visibility = "hidden";
}

getobject("inline").style.position= "absolute";
getobject("inline").style.top= (document.documentElement.scrollTop + inlineTop) + "px";

}



// nicht-IE

else if (document.getElementById)	{
	getobject("inline").style.position= "fixed";
}


// FF iframe Höhe anpassen

if (getobject("inline-frame").offsetTop)	{
  getobject("inline-frame").style.height = parseInt(getobject("inline").style.height) - getobject("inline-frame").offsetTop + "px";	}


  getobject("lightbox-bg").style.height = arrayPageSize[1] + "px";
  getobject("lightbox-bg").style.display = "block";
  getobject("lightbox-bg").onclick = function() { hideInline(); }
  

}


function lbTargetParent()
{

	if (document.getElementsByTagName("body")[0].className == "lb")
	{  
			for(i = 0; i < document.getElementsByTagName("a").length; i++)			{
				document.getElementsByTagName("a")[i].target = "_blank";			}
	}
}

onload = function() { lbTargetParent(); }


function hideInline()
{
  getobject("inline").style.display= "none";
  getobject("inline-frame").src = "";
  getobject("lightbox-bg").style.display = "none";


if (document.all && !window.opera)
  {
  for(i = 0; i < document.getElementsByTagName("select").length; i++)	{
	  document.getElementsByTagName("select")[i].style.visibility = "visible";	}
  }

}




function Info(inlineURL)
{

  // getobject("info").style.visibility = "shown";
  getobject("info").style.visibility = "visible";
}


function hideInfo()
{
  getobject("info").style.visibility = "hidden";
}






function toggleView(Ebene, him)

{
  // getobject("inline").style.visibility = "hidden";


  if (getobject(Ebene).style.display  == "none")	{

  getobject(Ebene).style.display = "block";

  linkOldText = him.firstChild.nodeValue;
  him.firstChild.nodeValue = "Kalender ausblenden";
}

else
{
  getobject(Ebene).style.display = "none";
//  him.firstChild.nodeValue = "Kalender anzeigen";

  him.firstChild.nodeValue = linkOldText;
}

}














function showInline(him)
{
link = him.id;
ebene = him.id.substring(5, him.id.length);
eintragsId = ebene.substring(0, ebene.indexOf("-"));

// alert (link +  "  " + ebene + "  " + eintragsId);


// alle inlines verbergen

if (getobject(eintragsId + "-kurzinfo"))	{
  getobject(eintragsId + "-kurzinfo").style.display = "none";		}

if (getobject(eintragsId + "-referenzen"))	{
  getobject(eintragsId + "-referenzen").style.display = "none";		}

if (getobject(eintragsId + "-gage"))	{
  getobject(eintragsId + "-gage").style.display = "none";		}

if (getobject(eintragsId + "-news"))	{
  getobject(eintragsId + "-news").style.display = "none";		}

if (getobject(eintragsId + "-fotos"))	{
  getobject(eintragsId + "-fotos").style.display = "none";		}

if (getobject(eintragsId + "-details"))	{
  getobject(eintragsId + "-details").style.display = "none";		}



// gewähltes Inlnie anzeigen

  getobject(ebene).style.display = "block";



// alle links zurücksetzen

if (getobject("link-" + eintragsId + "-kurzinfo"))	{
  getobject("link-" + eintragsId + "-kurzinfo").className = "inaktiv";		}

if (getobject("link-" + eintragsId + "-referenzen"))	{
  getobject("link-" + eintragsId + "-referenzen").className = "inaktiv";	}

if (getobject("link-" + eintragsId + "-gage"))	{
  getobject("link-" + eintragsId + "-gage").className = "inaktiv";		}

if (getobject("link-" + eintragsId + "-news"))	{

// alert(getobject("link-" + eintragsId + "-news").className);
	if ( getobject("link-" + eintragsId + "-news").className.indexOf("aktuell") >= 0 )	{
	  getobject("link-" + eintragsId + "-news").className = "aktuell inaktiv";		}

	else	{
	  getobject("link-" + eintragsId + "-news").className = "inaktiv";	}
}

if (getobject("link-" + eintragsId + "-fotos"))	{
  getobject("link-" + eintragsId + "-fotos").className = "inaktiv";		}

if (getobject("link-" + eintragsId + "-details"))	{
  getobject("link-" + eintragsId + "-details").className = "inaktiv";		}




// gewählten link aktiv setzen

if ( getobject(link).className.indexOf("aktuell") >= 0 )	{
  getobject(link).className = "aktuell aktiv";		}

else	{
  getobject(link).className = "aktiv";	}


  him.blur();
}







function toggleDivs(him,mode)
{

link = him.id;

// link-togglediv-1 --> togglediv-1
ebene = him.id.substring(5, him.id.length);

// togglediv-1 --> togglediv-
eintragsId = ebene.substring(0, ebene.indexOf("-")+1);


// nicht "single" = alles aus gewählten an

if (mode != "single")
{

// alle toggleDivs verbergen

var EbenenZaehler = 1;

while(EbenenZaehler <= 99) {

	toggleDivsId = eintragsId + EbenenZaehler;

	if (getobject(toggleDivsId))	{
	  getobject(toggleDivsId).style.display = "none";	}

	EbenenZaehler++;
}


// gewählten ExtraDiv anzeigen
  getobject(ebene).style.display = "block";
}




// mode "single" = bestimmten div an-/ausschalten

else
{
  if (getobject(ebene).style.display == "none" || getobject(ebene).style.display == "" )		{
    getobject(ebene).style.display = "block";	}
	
  else		{
    getobject(ebene).style.display = "none";	}
}


}







function toggleSubCatRub180708(him)
{

var textShow = encodeURI('Text zu "einblenden"');
var textHide = encodeURI('Text zu "ausblenden"');

  if (him.nextSibling.nextSibling.className  == "subhidden")	{

	him.nextSibling.nextSibling.className  = "subshown";
	him.className = "toggle-subcat-hide";
	him.title = decodeURI(textHide);
	him.firstChild.nodeValue = decodeURI(textHide);
	}

  else	{

	him.nextSibling.nextSibling.className  = "subhidden";
	him.className = "toggle-subcat";
	him.title = decodeURI(textShow);
	him.firstChild.nodeValue = decodeURI(textShow);
	}

him.blur();

}




function toggleBranchen(him)
{

var textShow = encodeURI('Text zu "einblenden"');
var textHide = encodeURI('Text zu "ausblenden"');

  if (him.nextSibling.nextSibling.style.display  == "block")	{
	him.nextSibling.nextSibling.style.display  = "none";
	him.className = "toggle-subcat";
	him.title = decodeURI(textShow);
	him.firstChild.nodeValue = decodeURI(textShow);

	}

  else	{
	him.nextSibling.nextSibling.style.display  = "block";
	him.className = "toggle-subcat-hide";
	him.title = decodeURI(textHide);
	him.firstChild.nodeValue = decodeURI(textHide);
	}

him.blur();

}






function findPos(obj) {

	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}

	return [curleft,curtop];

}






function toggleDiv(div,jump)
{



if (getobject(div).style.display == "none")
{



  if(IE)
  {
	getobject(div).style.setAttribute('filter', 'alpha(opacity=0)', false);
  }

  else
  {
	getobject(div).style.opacity = 0;
	getobject(div).style.MozOpacity = 0;
  }


  getobject(div).style.display= "block";


  if(jump)
  {
	posarray = findPos(getobject(div));
	window.scrollTo(0,posarray[1]);
  }


  else
  {
	// location.href = "#" + div;
  }


  var counter = 0.0;
  FadeIn(div,counter);
}





else
{
  var counter = 1;
  FadeOut(div,counter);
}



}






function FadeIn(ebene,i) {



if(IE)
{
	getobject(ebene).style.setAttribute('filter', 'alpha(opacity='+(i*100)+')', false);
}

else
{
	getobject(ebene).style.opacity = i;
	getobject(ebene).style.MozOpacity = i;
}


  var PlayWith = "'" + ebene + "'";


  if(i >= 1)
  {
    window.clearTimeout(fade);

	if(IE)
	{
	  getobject(ebene).style.removeAttribute('filter', 'alpha', false);
	}
  }


  else
  {
    i = i + 0.1;
    var fade = window.setTimeout("FadeIn("+PlayWith+","+i+")",10);
  }

}





function FadeOut(ebene,j) {



if(IE)
{
	getobject(ebene).style.setAttribute('filter', 'alpha(opacity='+(j*100)+')', false);
}

else
{
	getobject(ebene).style.opacity = j;
	getobject(ebene).style.MozOpacity = j;
}


  var PlayWith = "'" + ebene + "'";


  if(j > 0)
  {
    j = j - 0.1;
    var fadeout = window.setTimeout("FadeOut("+PlayWith+","+j+")",10);
  }


  else

  {
	window.clearTimeout(fadeout);
	getobject(ebene).style.display = "none";

	window.resizeBy(-0.1,0);
	window.resizeBy(0.1,0);
  }

}



function Hide(div)
{
	getobject(div).style.display = "none";
}



function NotYet()
  {

		var objBody = document.getElementsByTagName("body").item(0);
		
		
		var objOverlay = document.createElement("div");
		objOverlay.setAttribute('id','overlay');
		//objOverlay.style.display = 'none';
		objOverlay.onclick = function() { myLightbox.end(); }
		objBody.appendChild(objOverlay);
		
		var objLightbox = document.createElement("div");
		objLightbox.setAttribute('id','lightbox');
		//objLightbox.style.display = 'none';
		
				objLightbox.style.position = 'absolute';
		objLightbox.onclick = function(e) {	// close Lightbox is user clicks shadow overlay
			if (!e) var e = window.event;
			var clickObj = Event.element(e).id;
			if ( clickObj == 'lightbox') {
				myLightbox.end();
			}
		};
		objBody.appendChild(objLightbox);
			
		var objOuterImageContainer = document.createElement("div");
		objOuterImageContainer.setAttribute('id','out_erImageContainer');
		objOuterImageContainer.style.width = '100%';
		objOuterImageContainer.style.height = '140px';
		objOuterImageContainer.style.position = 'absolute';
		
				objOuterImageContainer.style.left = 0;
								objOuterImageContainer.style.top = "50%";
		
		objOuterImageContainer.innerHTML = '<span style="width: 440px; display: block; margin: 0 auto; text-align: center; border: 1px solid red; padding: 4em;">Diese Funktion steht noch nicht zur Verfügung.</span>';
		objBody.appendChild(objOuterImageContainer);

	

  }


function ShowCart()
{

    var cookies = document.cookie.split(';');

    for (var i = 0; i < cookies.length; i++) {
		if (cookies[i].indexOf("ShopPOSCount") > -1)
		{

		 var cartIcon = window.location.protocol + "//"  + window.location.hostname + "/static/images/icon-cart.gif";
		 var cartItems = cookies[i].substr(cookies[i].indexOf("=") + 1 ,cookies[i].length);

		 document.write('<td class=\"cart\"><div><a href=\"https://' + window.location.hostname + '/cgi-bin/shop.cgi?Art=Warenkorb\"><img src=\"' + cartIcon + '\" width=\"27\" height=\"20\" alt=\"Warenkorb\" /> <span><span id=\"pos-count\">' + cartItems + '</span> Artikel</span></a></div></td>');
		 
		getobject("meta-wk").innerHTML = "(" + cartItems + ")"; 
		
		}
    }

 
}
  
