// JavaScript Document
start_l_bg="#DEDEDE"
start_t_c="#913D26"
start_l_bg_o="#FCF08D"
start_t_c_o="#800000"
l_bg="#DEDEDE"
t_c="#800000"
l_bg_o="#EFEFEF"
t_c_umo="#800000";
l_ooo_c="#FFFFFF"

cursPosX=0
cursPosY=0

//KursInhaltBox-Variablen
idKIBox=0
idKITBox=0

function mover(divid,ooo,cjn,hou,eID,seID)
{  
  if (ooo=="over") {
   document.getElementById(divid).style.backgroundColor=l_ooo_c
  if (cjn==1)
   document.getElementById(divid).style.color=t_c_umo 
  else
   document.getElementById(divid).style.color=t_c
  showNavi(eID,seID) 
 }
 else {
  document.getElementById(divid).style.backgroundColor=l_bg	
  if (cjn==1)
   document.getElementById(divid).style.color=t_c   
  else
   document.getElementById(divid).style.color=t_c_umo
  showNavi(eID,seID)
 }
}

function start_mover(ooo,divid)
{
 if (ooo=="over")
 {
  document.getElementById(divid).style.backgroundColor=start_l_bg_o
  document.getElementById(divid).style.color=start_t_c_o
 }
 else
 {
  document.getElementById(divid).style.backgroundColor=start_l_bg	
  document.getElementById(divid).style.color=start_t_c
 }
}

function but_mover(nr,butn)
{  
  document.images[nr].src=eval(butn).src
}

function menueSichtbar(nlobag,hm,um,pfids)
{
 umTagId="um"+hm
 document.getElementById(umTagId).style.visibility="visible"
 aktivLink(nlobag,hm,um,pfids)
}

function showNavi(eID,seID)
{
 //alert("HALLO")
 var arrEAll=new Array(arrE1,arrE2,arrE3)
 var arrEE=new Array()
 var strE=""
 var iStart=eID-1
 var vglID=-1
 var indV=-1
 for (i=iStart;i<arrEAll.length;i++)
 {
  iP=i+1
  if (iP>eID) break
  else
  {    
   if (arrEAll[i])
   {
	for (j=0;j<arrEAll[i].length;j++)
    {	
	 if (arrEAll[i].length>0) indV=arrEAll[i][j]
	 if (eID>1)
	 {
	  strE=arrEAll[i][j].substring(3)	
      arrEE=strE.split("-")	 
	  if (eID==2) var vglID=arrEE[0]
	  else var vglID=arrEE[1]
	  if (seID==vglID) document.getElementById(indV).style.visibility='visible'
	  else document.getElementById(indV).style.visibility='hidden'
	 }
	 else document.getElementById(indV).style.visibility='visible'	
	}
   }
  }
 }
 if (eID==2)
 {for (i=0;i<arrE3.length;i++) {indV=arrE3[i];document.getElementById(indV).style.visibility='hidden';}}

}

function hideNavi()
{
 arrEAll=new Array(arrE1,arrE2,arrE3)
 for (i=0;i<arrEAll.length;i++)
 {  
  for (j=0;j<arrEAll[i].length;j++)
  {document.getElementById(arrEAll[i][j]).style.visibility='hidden'}    
 } 
}

function closeNavi(e)
{
 vonlinks=0
 vonrechts=750
 vonoben=160
 vonunten=660
 if (document.all)
 {
  if (event.clientX<vonlinks || event.clientY<vonoben || event.clientY>vonunten || event.clientX>vonrechts)	 
   hideNavi()
 } 
 else
 {
  if (e.pageX<vonlinks || e.pageY<vonoben || e.pageY>vonunten || e.pageX>vonrechts) hideNavi()	    
 }	
}

function moverBG(posX,posY,goSameDirTimes,goneSameDir,movX,movY,picDivId,grenzeX,grenzeY)
{
 grenzeXY=0
 step=1 
 timeS=220
 //alert(document.getElementById('idImg').style.top + " " + document.getElementById('idImg').style.left + " " + movX + " " + movY) 
 //alert ("davor: " + posX + " " +  movX + " " + posY + " " + movY)
 posX=eval(posX+movX)
 posY=eval(posY+movY)
 document.getElementById(picDivId).style.top=posY + "px"
 document.getElementById(picDivId).style.left=posX + "px" 
 goneSameDir++ 
 //alert(posX + " " + posY + " " + document.getElementById(picDivId).style.top + " " + document.getElementById(picDivId).style.left + " " + goneSameDir + " " + goSameDirTimes)
 if (goSameDirTimes==goneSameDir || posX<=grenzeXY || posY>=grenzeY || posX>=grenzeX || posY<=grenzeXY)
 {
  goneSameDir=0
  goSameDirTimes=zufallsZahl(20,80)
  if (posX==grenzeXY) movX=1
  if (posX==grenzeX) movX=-1
  if (posY==grenzeXY) movY=1
  if (posY==grenzeX) movY=-1  
  if (posX!=grenzeXY && posX!=grenzeX && posY!=grenzeXY && posY!=grenzeY)
  {
   if (0+movX==1 && 0+movY==1) {movX=-1;movY=1;}
   else
   {
    if (0+movX==-1 && 0+movY==1) {movX=-1;movY=-1;}
    else
	{
	 if (0+movX==-1 && 0+movY==-1) {movX=1;movY=-1;}
     else
	  if (0+movX==1 && 0+movY==-1) {movX=1;movY=1;} 
	}
   }   	  	
   //alert ("nacH Schleife: " + posX + " " +  movX + " " + posY + " " + movY)
  }  
 }
 nextMove(posX,posY,timeS,goSameDirTimes,goneSameDir,movX,movY,picDivId,grenzeX,grenzeY)
}

function zufallsZahl(minV, maxV)
{
 if (minV==0 && maxV==1)  
  return Math.round((Math.random()*maxV)+minV)
 else
  return Math.floor((Math.random()*maxV)+minV)
}

function nextMove(posX,posY,timeS,goSameDirTimes,goneSameDir,movX,movY,picDivId,grenzeX,grenzeY)
{
 window.setTimeout("moverBG(" + posX + "," + posY + "," + goSameDirTimes + "," + goneSameDir + "," + movX + "," + movY + ",'" + picDivId + "'," + grenzeX + "," + grenzeY + ")",timeS)
}

var ie = document.all?1:0;
var w3c = document.getElementById?1:0;
var ns4 = document.layers?1:0;
var sHeight = 330; // Scrollhoehe der einzelnen News
var steps = 1; // Anzahl der Pixel, um die der Ticker verschoben wird
var pause = 60; // Verzoegerungszeit des Intervalls in Millisekunden
var tWait=0;
var pass = false; // Boolsche Variable zur Verhinderung des ersten Leerdurchlaufs
var i = 0; // Zaehler fuer das nachfolgende Array
var fontHeight=10
var tTicker

function tIntro() { 
if(ie) { 
 var tTicker = document.all.tTicker;
 tTicker.style.pixelTop = sHeight;
 tScrollIE();
} 
else { 
 if(w3c)
 { 
  tTicker = document.getElementById('tTicker');
  tTicker.style.top = sHeight + "px";
  tScrollW3C();
 }
 else {
   if(ns4) {
     tTicker = document['tSpot'].document['tTicker'];
     tTicker.top = sHeight;
     tTicker.captureEvents(Event.MOUSEOVER|Event.MOUSEOUT);
     tScrollNS4();
   }
 }
}
tTicker.onmouseover= function() {steps = 0;} // Event-Handler initialisieren
tTicker.onmouseout = function() {steps = 1;}
}

function gibH(strV,del)
{
 arrAnz=strV.split(del)
 if (w3c) var fontHeight=10
 else if(ie) var fontHeight=6
 else if (ns4) var fontHeight=10
 return arrAnz.length*2*fontHeight 
}

function tScrollIE() { // IE-Scroller
var tTicker = document.all.tTicker;
tH=gibH(tArrContent[0],"<br>")
//if (tTicker.style.pixelTop<-1000) alert (tTicker.style.pixelTop)
if(pass == 1 && tTicker.style.pixelTop >= -tH) {
tTicker.style.pixelTop -= steps; // Ticker nach oben scrollen
}
else {
tTicker.style.pixelTop = sHeight;
tTicker.innerHTML = tArrContent[i]; // News ins Dokument schreiben
if(i == tArrContent.length - 1) // Zaehler hochzaehlen bzw. zuruecksetzen
i = 0; 
else i++;
pass = true;
steps = 1;
}
if(tTicker.style.pixelTop <= -sHeight/6) {
steps = 1; // Scrollen am Ende beschleunigen
}
setTimeout("tScrollIE()", pause);
}

function tScrollW3C() { // Scroller fuer W3C-kompatible Browser
tTicker = document.getElementById('tTicker');
tH=gibH(tArrContent[0],"<br>")
if(pass == 1 && parseInt(tTicker.style.top) >= -tH) { 
tTicker.style.top = parseInt(tTicker.style.top) - steps + "px";
}
else { 
tTicker.style.top = sHeight + "px";
tTicker.innerHTML = tArrContent[i];

if(i == tArrContent.length - 1)
i = 0; 
else i++;
pass = true;
steps = 1;
}
if(parseInt(tTicker.style.top) <= -sHeight/6) {
steps = 1;
}
setTimeout("tScrollW3C()", pause);
}


function tScrollNS4() { // Scroller fuer NS 4
tH=gibH(tArrContent[0],"<br>")
if(pass == 1 && tTicker.top >= -tH) {
tTicker.top -= steps;
}
else {
tTicker.top = sHeight;
with(tTicker.document) {
open();
write(tArrContent[i]);
close();
}
if(i == tArrContent.length - 1)
i = 0; else i++;
pass = true;
steps = 1;
}
if(tTicker.top <= -sHeight/6) {
steps = 1;
}
setTimeout("tScrollNS4()", pause);
}

function moveKIBox(e)
{
 if (idKIBox!="0" && idKIBox!="1")
 {
  if (document.all)
  {
   document.getElementById(idKIBox).style.top=eval(event.clientY-200) + "px"
  } 
  else
  {
   document.getElementById(idKIBox).style.top=eval(e.pageY-200) + "px"
  }
  idKIBox="1"
 }
}

function setIdKIBox(idB,idT,strAE)
{
 if (idKIBox=="0")
 {
  var praeB="b"
  var praeT="t"
  var delAE="§"
  if (strAE.indexOf(delAE)>-1)
   arrAE=strAE.split(delAE)
  else
   arrAE=new Array(strAE)	
  for (i=0;i<arrAE.length;i++)
  {
   document.getElementById(praeB + arrAE[i]).style.visibility="hidden"
   document.getElementById(praeT + arrAE[i]).style.visibility="hidden"
  }
  idKIBox=idB
  idKITBox=idT
  document.onmousemove=moveKIBox
  document.getElementById(idKIBox).style.visibility="visible"
  document.getElementById(idKITBox).style.visibility="visible"    
 }  
}

function hideKIBox()
{
 idKIBox="0"
}

function closeKIBox(idNr)
{
 var praeB="b"
 var praeT="t"
 document.getElementById(praeB + idNr).style.visibility="hidden"
 document.getElementById(praeT + idNr).style.visibility="hidden"
 document.getElementById(praeB + idNr).style.cursor="default"
}

function sEM(flagWer)
{
 var url="http://www.makotech.de/comm/ajax_func.php?bea=" + flagWer
 new Ajax.Request(url, {
  onSuccess : function(resp) {	  
    location.href='mailto:' + resp.responseText;
  },
  onFailure : function(resp) {
    alert("Es ist ein Fehler aufgetreten.");
  }
  });
}

function showEA(flagWer,idN)
{ 
 var url="http://www.makotech.de/comm/ajax_func.php?bea=" + flagWer
 new Ajax.Request(url, {
  onSuccess : function(r) {	  
	document.getElementById(idN).style.visiblity="visible"
	document.getElementById(idN).setAttribute("title","Klicken Sie hier, um eine Nachricht an " + r.responseText + " zu senden.")
	document.getElementById(idN).setAttribute("alt","Klicken Sie hier, um eine Nachricht an " + r.responseText + " zu senden.")
  },
  onFailure : function(r) {
    alert("Es ist ein Fehler aufgetreten.");
  }
  });
}

function showKInfo(intLID,intMP,strID_Link)
{
 var url="http://www.makotech.de/comm/ajax_func.php?lgid=" + intLID + "&mp=" + intMP
 //var url="http://localhost/makotech/comm/ajax_func.php?lgid=" + intLID + "&mp=" + intMP
 new Ajax.Request(url, {
  onSuccess : function(r) {
        //alert(r.responseText)
        //alert(findPosY($(strID_Link)))
        $('div_kinfobox_id').style.top=(findPosY($(strID_Link))-190) + 'px'
        //alert($('div_kinfobox_id').style.top)
        document.getElementById('div_ktextinfobox_id').innerHTML=r.responseText
	document.getElementById('div_kinfobox_id').style.display='block'
        //document.getElementById('div_ktextinfobox_id').style.display='block'
        //document.getElementById('closeButId').style.display='block'
  },
  onFailure : function(r) {
    alert("Es ist ein Fehler aufgetreten.");
  }
  });
}

function searchD(elem,sb_elem)
{
 for (i=0;i<sb_elem.length;i++)
 {
  //alert (elem.value.substr(0,elem.value.length) + ' --- ' + sb_elem.options[i].text.substr(0,elem.value.length))
  var txt1=elem.value.substr(0,elem.value.length)
  var txt2=sb_elem.options[i].text.substr(0,elem.value.length)
  if (txt1.toLowerCase()==txt2.toLowerCase())
  {
   sb_elem.options[i].selected=true
   break
  }
 }
}

function getCursorPos(e)
{
 if (document.all) { 
   cursPosX = window.event.clientX
   cursPosY = window.event.clientY
 }
 else {cursPosX = e.pageX;cursPosY = e.pageY;} 
}

function showPicInWin(elemWin,elemImg,imgSrc,strAlt,elemUS,ooo)
{ 
 if (ooo==1)
 {
  elemWin.style.visibility='visible'
  elemImg.src=imgSrc
  elemImg.title=strAlt
  elemImg.alt=strAlt
  elemUS.innerHTML=strAlt
 }
 else elemWin.style.visibility='hidden'
}

function showPicOnCursor(elemWin,elemImg,imgSrc,strAlt,elemUS,ooo)
{  
 if (elemImg.src!=imgSrc) elemImg.src=imgSrc
 if (elemImg.title!=strAlt) elemImg.title=strAlt
 if (elemImg.alt!=strAlt) elemImg.alt=strAlt
 if (elemUS.alt!=strAlt) elemUS.innerHTML=strAlt 
 //alert(cursPosX)
 cursPosX=cursPosX>500 ? cursPosX-620 : cursPosX-160
 cursPosY=cursPosY>500 ? cursPosY-690 : (cursPosY>300 ? cursPosY-360 : cursPosY-160)
 elemWin.style.left=cursPosX + 'px'
 elemWin.style.top=cursPosY + 'px'
 elemWin.style.visibility='visible'
 //alert(elemWin.style.top)
}

function hidePicOnCursor(elemWin,elemImg)
{
 elemWin.style.visibility='hidden'
}

function findPosX(obj)
{
 var curleft = 0;
 if(obj.offsetParent) { while(obj.offsetParent) {curleft += obj.offsetLeft;obj = obj.offsetParent;} }
 else if(obj.x) curleft = obj.x;
 return curleft;
}

function findPosY(obj)
{
 var curtop = 0;
 if(obj.offsetParent) { while(obj.offsetParent) {curtop += obj.offsetTop;obj = obj.offsetParent;} }
 else if(obj.y) curtop = obj.y;
 return curtop;
}


