var clipTop = 0;
var clipWidth = 520;
var clipBottom = 405;   //425
var topper = 0;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;
var untermenu = 0;
var nWert = 0;

function init(wer,back){
  DHTML = (document.getElementById || document.all || document.layers)
  if (!DHTML) return;
  var x = new getObj('einzelseite2');
  if (document.layers){
    lyrheight = x.style.clip.bottom;
    lyrheight += 20;
    //alert(lyrheight);
    if(lyrheight >= 475) vis('visible',wer,back); //420
    else if(lyrheight < 475) vis('hidden',wer,back);
    x.style.clip.top = clipTop;
    x.style.clip.left = 0;
    x.style.clip.right = clipWidth;
    x.style.clip.bottom = clipBottom;
  }
  else if (document.getElementById || document.all){
    lyrheight = x.obj.offsetHeight;
    lyrheight += 20;
    //alert(lyrheight);
    if(lyrheight >= 475) vis('visible',wer,back);  //425
    else if(lyrheight < 475) vis('hidden',wer,back);
    x.style.clip = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
  }
}
function scrollayer(layername,amt,tim,back){
  if (!DHTML) return;
  thelayer = new getObj(layername);
  if (!thelayer) return;
  amount = amt;
  theTime = tim;
  realscroll(back);
}
function stopScroll(){
  if (time) clearTimeout(time);
  return;
}
function realscroll(back){
  if (!DHTML) return;
  clipTop += amount;
  clipBottom += amount;
  topper -= amount;
  if (clipTop < 0 || clipBottom > lyrheight){
    clipTop -= amount;
    clipBottom -= amount;
    topper += amount;
    return;
  }
  if (document.getElementById || document.all){
    clipstring = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
    thelayer.style.clip = clipstring;
    thelayer.style.top = topper;
    vis('visible',untermenu,back);
  }
  else if (document.layers){
    thelayer.style.clip.top = clipTop;
    thelayer.style.clip.bottom = clipBottom;
    thelayer.style.top = topper;
    vis('visible',untermenu,back);
  }
  time = setTimeout('realscroll()',theTime);
}
function toTop(back){
  if (!DHTML) return;
  clipTop = 0;
  clipBottom = 405; //425
  topper = 0;
  if (document.getElementById || document.all){
    clipstring = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
    thelayer.style.clip = clipstring;
    thelayer.style.top = topper;
    vis('visible',untermenu,back);
  }
  else if (document.layers){
    thelayer.style.clip.top = clipTop;
    thelayer.style.clip.bottom = clipBottom;
    thelayer.style.top = topper;
    vis('visible',untermenu,back);
  }
}

function vis(val,wer,back){
  if (!DHTML) return;
  //alert("oben:"+clipTop+" ,unten: "+clipBottom+" ,Höhe:"+lyrheight);
  if (clipTop > 0){
    top.document.pfeilh.style.visibility = val;
    top.document.pfeilt.style.visibility = val;
  }
  else{
    top.document.pfeilh.style.visibility = 'hidden';
    top.document.pfeilt.style.visibility = 'hidden';
  }
  if (clipBottom < lyrheight) top.document.pfeilr.style.visibility = val;
  else top.document.pfeilr.style.visibility = 'hidden';
  //Aufruf des SubSubMenüs
  if (untermenu != wer) ssmenu(wer,back);
}

function roll(back)
{
amount = event.wheelDelta/10;
thelayer = new getObj('einzelseite2');

  if (!DHTML) return;
  clipTop -= amount;
  clipBottom -= amount;
  topper += amount;
  if (clipTop < 0 || clipBottom > lyrheight){
    clipTop += amount;
    clipBottom += amount;
    topper -= amount;
    return;
  }
  if (document.getElementById || document.all){
    clipstring = 'rect('+clipTop+' '+clipWidth+' '+clipBottom+' 0)'
    thelayer.style.clip = clipstring;
    thelayer.style.top = topper;
    vis('visible',untermenu,back);
  }
  else if (document.layers){
    thelayer.style.clip.top = clipTop;
    thelayer.style.clip.bottom = clipBottom;
    thelayer.style.top = topper;
    vis('visible',untermenu,back);
  }
}

function getObj(name){
  if (document.getElementById){
    this.obj = document.getElementById(name);
    this.style = document.getElementById(name).style;
  }
  else if (document.all){
    this.obj = document.all[name];
    this.style = document.all[name].style;
  }
  else if (document.layers){
    this.obj = document.layers[name];
    this.style = document.layers[name];
  }
}


/* Definition der Variablen
1=Agentur
2=Leistungsspektrum/Planung,Einkauf&Controlling
3=Leistungsspektrum/Marktforschung
4=Leistungsspektrum/Mediaumsetzung
*/
function ssmenu(wer,back){
  untermenu = wer;
  if(wer==1){
    top.document.getElementById('ssmenu1').style.display = 'block';
    top.document.getElementById('ssmenu2').style.display = 'none';
    top.document.getElementById('ssmenu3').style.display = 'none';
    top.document.getElementById('ssmenu4').style.display = 'none';
  }
  else if(wer==2){
    top.document.getElementById('ssmenu2').style.display = 'block';
    top.document.getElementById('ssmenu1').style.display = 'none';
    top.document.getElementById('ssmenu3').style.display = 'none';
    top.document.getElementById('ssmenu4').style.display = 'none';
  }
  else if(wer==3){
    top.document.getElementById('ssmenu3').style.display = 'block';
    top.document.getElementById('ssmenu1').style.display = 'none';
    top.document.getElementById('ssmenu2').style.display = 'none';
    top.document.getElementById('ssmenu4').style.display = 'none';
  }
  else{
    top.document.getElementById('ssmenu1').style.display = 'none';
    top.document.getElementById('ssmenu2').style.display = 'none';
    top.document.getElementById('ssmenu3').style.display = 'none';
    top.document.getElementById('ssmenu4').style.display = 'none';
  }
  if(back==1){
    top.document.getElementById('ssmenu4').style.display = 'block';
  }
}
function weiss(wer){
  for(i=1;i<5;i++){
    document.getElementById("sslink"+i).style.color="#FFFFFF";
  }
  if(wer!=99) document.getElementById("sslink"+wer).style.color="#ffffff";
}

function chkFormular(obj)
{
 if(obj.vorname.value == "")
  {
   alert("Bitte geben Sie Ihren Vornamen ein!");
   document.formular.vorname.focus();
   return false;
  }
 if(document.formular.nachname.value == "")
  {
   alert("Bitte geben Sie Ihren Nachnamen ein!");
   document.formular.nachname.focus();
   return false;
  }
 if(document.formular.firma.value == "")
  {
   alert("Bitte geben Sie Ihre Firma an!");
   document.formular.firma.focus();
   return false;
  }
 if(document.formular.email.value == "")
  {
   alert("Bitte geben Sie Ihre E-Mail-Adresse ein!");
   document.formular.email.focus();
   return false;
  }
  if(document.formular.email.value.indexOf('@') == -1 ||  document.formular.email.value.indexOf('.') == -1)
  {
   alert("Bitte geben Sie eine gueltige E-Mail-Adresse!");
   document.formular.email.focus();
   return false;
  }
}