// added by Andreas Schläpfer 20060922
// mailto spam protection
function sendAnotatedMail(name_part1, name_part2, company, domain, subject, body) {
	locationstring = 'ma' + 'il' + 'to:' + name_part1 + name_part2 + '@' + company + '.' + domain + "?subject=" + escape(subject) + "&body=" + escape(body);
	window.location.replace(locationstring);
}
function sendSimpleMail(name_part1, name_part2, company, domain) {
	locationstring = 'ma' + 'il' + 'to:' + name_part1 + name_part2 + '@' + company + '.' + domain;
	window.location.replace(locationstring);
}

function scrol_left() {
  pp--;
  if (pp<0) {
    pp=pm-1;
  }
  mm_show();
}

function scrol_right() {
  pp++;
  if (pp>pm-1) {
    pp=0;
  }
  mm_show();
}

function scroll(direction) {
  if (direction == "right") scrol_right();
  if (direction == "left") scrol_left();
}

var timerID;
var contSCR = false;

function start_scroll(direction) {
  stop_scroll();
  scroll(direction);
  contSCR = true;
  setTimeout('continue_scroll("'+direction+'");',750);
 // window.setInterval(increase_scroll(direction),1500);
}

function continue_scroll(direction) {
  if (contSCR) {
    contSCR = false;
    timerID=setInterval('scroll("'+direction+'");', 250)
  }
}

function increase_scroll(direction) {
  //stop_scroll();
  if (contSCR) {
    contSCR = false;
    if (direction == "left") sid = self.setInterval(scrol_left(),100);
    if (direction == "right") sid = self.setInterval(scrol_right(),100);
  }
}

function stop_scroll() {
 contSCR = false;
 timerID=clearInterval(timerID);
}

function mm_show() {
  var m=1;
  var n=0;
  for (var i=0;i<pm;i++) {
  //document.open();
    m=i+pp+1;
    n++;
    if ( m>pm) m=m-pm;
    //window.alert("m="+m+",  n="+n+",  i="+i);
    if (n<6) {
    //alert ( "Nummer ist "+m );
      //if( document.getElementById ) document.write("<p>DOM1</p>");
      //if( document.all ) document.write("<p>DOM2</p>");
      //if( document.layers ) document.write("<p>DOM3</p>");
      ////mmb[m].moveToAbsolute( box[n].pageY(), box[n].pageX() );
      //mmb[m].moveTo( box[n].top(), box[n].left() );
      //moveXY("mmObject"+m,getX("box"+n),getY("box"+n));
      //mmb[m].show();css.visibility = "visible";
      mmb[m].gehNach(getX("box"+n), getY("box"+n));
      //mmb[m].gehNach(n*160+200, 280);
      mmb[m].zeige();

    } else {
      //mmb[m].hide();
      mmb[m].verstecke();
      mmb[m].gehNach( 0, 0 );
    }
  //document.close();
  }

}

function moveXY(id, x, y) {
   if (document.getElementById) {
      document.getElementById(id).style.left = x+"px";
      document.getElementById(id).style.top = y+"px";
   }
   else if (document.all) {
      document.all[id].style.left = x+"px";
      document.all[id].style.top = y+"px";
   }
   else if (document.layers) {
      document.layers[id].left = x;
      document.layers[id].top = y;
   }
}
function getX(id) {
  if (document.getElementById) {
    obj = document.getElementById(id);
    var x=0;
    while (obj!=null){
      x+=obj.offsetLeft;
      obj=obj.offsetParent;
    }
    return x;
  } else if (document.all) {
    obj = document.all[id];
    var x=0;
    while (obj!=null){
      x+=obj.offsetLeft;
      obj=obj.offsetParent;
    }
    return x;
  } else if (document.layers) {
      return document.layers[id].pageX;
  }
}
function getY(id) {
  if (document.getElementById) {
    obj = document.getElementById(id);
    var x=0;
    while (obj!=null){
      x+=obj.offsetTop;
      obj=obj.offsetParent;
    }
    if (navigator.userAgent.toLowerCase().indexOf("ie")>-1) {
      return x;
    } else {
      return x-150;
    }
  } else if (document.all) {
    obj = document.all[id];
    var x=0;
    while (obj!=null){
      x+=obj.offsetTop;
      obj=obj.offsetParent;
    }
    return x;
  } else if (document.layers) {
      return document.layers[id].pageY;
  }
}

function aendern(text){
   if (document.getElementById) {
      var zelleEl = document.getElementById("zelle");
      zelleEl.firstChild.nodeValue = text;
   }
   else if (document.all) {
      document.all.zelle.innerText = text;
   }
   else if (document.layers) {
      document.hilfsLayer.top = document.zelle.pageY;
      document.hilfsLayer.left = document.zelle.pageX;
      document.hilfsLayer.document.write(text);
      document.hilfsLayer.document.close();
      document.zelle.visibility = "hidden";
      document.hilfsLayer.visibility = "visible";
   }
}


function XElement(id) {
   if (document.getElementById) {
      this.el = document.getElementById(id);
      this.css = this.el.style;
   }
   else if (document.all) {
      this.el = document.all[id];
      this.css = this.el.style;
   }
   else if (document.layers) {
      this.el = document.layers[id];
      this.css = this.el;
   }
   this.x = parseInt(this.css.left);
   this.y = parseInt(this.css.top);
   this.ax = parseInt(this.left);
   this.ay = parseInt(this.top);
   this.zIndex = this.css.zIndex;
   this.sichtbar = true;
   if (document.layers) {
      this.breite = this.el.document.width;
      this.hoehe = this.el.document.height;
   }
   else {
      this.breite = this.el.offsetWidth;
      this.hoehe = this.el.offsetHeight;
   }
   this.gehNach = XElement_gehNach;
   this.zeige = XElement_zeige;
   this.verstecke = XElement_verstecke;
}

function XElement_gehNach(x,y) {
   this.css.left = x;
   this.css.top = y;
   this.x = x;
   this.y = y;
}

function XElement_zeige() {
   this.css.visibility = "visible";
   this.sichtbar = true;
}

function XElement_verstecke() {
   this.css.visibility = "hidden";
   this.sichtbar = false;
}

function scroller() {
  for (var i=0;i<pm;i++) {
    oa = "mmObject"+i;
    if ( i < pp ) {
      document.getElementById(oa).style.visibility = "hidden";
      //document.getElementById(oa).style.display = "none";
      document.getElementById(oa).style.position = 'absolute';
    } else if ( i > pp+4 ) {
      document.getElementById(oa).style.visibility = "hidden";
      //document.getElementById(oa).style.display = "none";
      document.getElementById(oa).style.position = 'absolute';
    } else {
      document.getElementById(oa).style.visibility = "visible";
      //document.getElementById(oa).style.display = "block";
      document.getElementById(oa).style.position = 'relative';
    }
  }
}

var current0 = 0;
var current1 = 1;
var current2 = 2;
var current3 = 3;
var current4 = 4;
var windowSpec = windowSpec;
var imagesArray = new Array;
var linksArray= new Array;

//window.onLoad=resizeImages;
//window.onresize=resizeImages;


function resizeImages()
{
imgWidth=Math.round((window.innerWidth-60)/5);
imgSpace=Math.round((window.innerWidth)/5);
//window.alert("Size is "+imgWidth);
//document.mmObject0.style = "position:absolute; left:10; top:250; width:"+imgWidth+"mm; height:"+imgWidth+"mm; margin:0px; overflow:hidden; border:0px; color:#4444ff;";
document.mmObject0.width.value = imgWidth;
document.mmObject0.height.value = imgWidth;
//document.mmObject0.left.value = 10;
//document.mmObject0.top.value = 250;
//document.mmObject1.style = "position:absolute; left:10+"+(1*imgSpace)+"; top:250; width:"+imgWidth+"mm; height:"+imgWidth+"mm; margin:0px; overflow:hidden; border:0px; color:#4444ff;";
document.mmObject1.width.value = imgWidth;
document.mmObject1.height.value = imgWidth;
//document.mmObject1.left.value = 10+1*imgSpace;
//document.mmObject1.top.value = 250;
document.mmObject2.width.value = imgWidth;
document.mmObject2.height.value = imgWidth;
//document.mmObject2.left.value = 10+2*imgSpace;
//document.mmObject2.top.value = 250;
document.mmObject3.width.value = imgWidth;
document.mmObject3.height.value = imgWidth;
//document.mmObject3.left.value = 10+3*imgSpace;
//document.mmObject3.top.value = 250;
document.mmObject4.width.value = imgWidth;
document.mmObject4.height.value = imgWidth;
//document.mmObject4.left.value = 10+4*imgSpace;
//document.mmObject4.top.value = 250;
}

function selectCurrentImage(val)
{
if (val==-2){
current0=0;
current1 = 1;
current2 = 2;
current3 = 3;
current4 = 4;
}
if (val==2){
current0= imagesArray.length-1;
current1= imagesArray.length-2;
current2= imagesArray.length-3;
current3= imagesArray.length-4;
current4= imagesArray.length-5;
}
if (val==-1){
current0 = current0+val;
current1 = current1+val;
current2 = current2+val;
current3 = current3+val;
current4 = current4+val;
}
if (val==1){
current0 = current0+val;
current1 = current1+val;
current2 = current2+val;
current3 = current3+val;
current4 = current4+val;
}
if (current0 < 0) current0 = imagesArray.length-1;
if (current1 < 0) current1 = imagesArray.length-1;
if (current2 < 0) current2 = imagesArray.length-1;
if (current3 < 0) current3 = imagesArray.length-1;
if (current4 < 0) current4 = imagesArray.length-1;

if (current0> imagesArray.length-1) current0 = 0;
if (current1> imagesArray.length-1) current1 = 0;
if (current2> imagesArray.length-1) current2 = 0;
if (current3> imagesArray.length-1) current3 = 0;
if (current4> imagesArray.length-1) current4 = 0;

document.mmObject0.src = imagesArray[current0];
document.mmObject1.src = imagesArray[current1];
document.mmObject2.src = imagesArray[current2];
document.mmObject3.src = imagesArray[current3];
document.mmObject4.src = imagesArray[current4];
}

function followLink0()
{
window.open(document.href =linksArray[current0],'Details',windowSpec);
}
function followLink1()
{
window.open(document.href =linksArray[current1],'Details',windowSpec);
}
function followLink2()
{
window.open(document.href =linksArray[current2],'Details',windowSpec);
}
function followLink3()
{
window.open(document.href =linksArray[current3],'Details',windowSpec);
}
function followLink4()
{
window.open(document.href =linksArray[current4],'Details',windowSpec);
}
