// window.onload = PicLinks();

function PicLinks () {
 var i, uri, video, webinfo;
 var agent = navigator.userAgent.toLowerCase();
 var standard = (agent.indexOf("msie") > -1 && agent.indexOf("win") > -1) ? 0 : 1;

 for (i=0; i<document.links.length; i++) {
  uri = ""+document.links[i];
  
  if (uri.search(/\/print$/) > -1) {
   document.links[i].onclick =  function() {
    printcontent();
    return false;
   }
  }
  
  if (uri.search(/\/pic\//) > -1) {
   var array  = uri.match(/\/pic\/\w+\//);
   var path   = array[0];
   var folder = path.replace(/\/pic|\//g, "");
   var height;
   switch (folder) {
    case "title":
     document.links[i].onclick = function() {
      height = this.href.match(/\d+$/);
      document.images.dynpic.height = height;
      document.images.dynpic.src    = this.href;
      window.scrollTo(0, 80);
      return false;
     }
     break;
    case "medium":
     document.links[i].onclick = function() {
      height = this.href.match(/\d+$/);
      this.firstChild.style.margin = "0px";
      this.firstChild.width  = 200;
      this.firstChild.height = height;
      this.firstChild.src = this.href;
      this.blur();
      return false;
     }
     break;
    default: 
     break;
   }
  }
  
  if (uri.search(/\/vid\//) > -1) {
   document.links[i].onclick = function() {
    var href = "" + this.href;
    var file = standard ? "/vid/?" : "/vid/axwmp.html?";
    var html = href.replace(/\/vid\//, file);
    video = window.open(html,"video","width=384,height=352,location=no,menubar=no,resizable=yes,scrollbars=no,status=yes,toolbar=yes");
    video.focus();
    return false;
   }
  }  
  
  if (uri.search(/^http:\/\/www\.lotus-kbic\.de/) == 0) {
   document.links[i].onclick = function() {
    webinfo = window.open(this.href,"webinfo","width=650,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=yes");
    webinfo.focus();
    return false;
   }
  }
  
  if (uri.search(/#top$/) > -1) {
   document.links[i].onclick = function() {
    window.scrollTo(0, 0); 
    return false;
   }
  }
 }
}

// Print
function printcontent () {
 var pathname  = window.location.pathname;
 var printdata = pathname.replace(/\/\w*$/, "/print");
 window.open(printdata,"printwindow");	
}

// Productsmenu
var name;
function rider (a,b) {
 name = a == 2 || a == 3 ? "right" : "left";
 b = b ? "over" : "out";
 document["rider"+a].src = this[name+b].src;
}

var menu0, menu1, menu2, r1, r2, r3, r4;
function productsmenu (a) {
 if (document.getElementById) {
  menu0 = document.getElementById("menu0").style;
  menu1 = document.getElementById("menu1").style;
  menu2 = document.getElementById("menu2").style;
  r1    = document.getElementById("r1");
  r2    = document.getElementById("r2");
  r3    = document.getElementById("r3");
  r4    = document.getElementById("r4");
 } 
 else if (document.all) {
  menu0 = document.all.menu0.style;
  menu1 = document.all.menu1.style;
  menu2 = document.all.menu2.style;
  r1    = document.all.r1;
  r2    = document.all.r2;
  r3    = document.all.r3;
  r4    = document.all.r4;
 }
 if (menu0 && menu1 && menu2) {
  rider(a);
  switch (a) {
   case 1:
    r1.blur();
    menu0.display    = "none";
    menu0.visibility = "hidden";
    menu1.display    = "block";
    menu1.visibility = "visible";
    break;
   case 2:
    r2.blur();
    menu0.display    = "none";
    menu0.visibility = "hidden";
    menu2.display    = "block";
    menu2.visibility = "visible";
    break;
   case 3:
    r3.blur();
    menu1.display    = "none";
    menu1.visibility = "hidden";
    menu2.display    = "block";
    menu2.visibility = "visible";
    break;
   case 4:
    r4.blur();
    menu2.display    = "none";
    menu2.visibility = "hidden";
    menu1.display    = "block";
    menu1.visibility = "visible";
    break;
   default:
    break;
  }
 }
}

// button
function button (a,b) {
 b = b ? "over" : "out";
 document[a].src = this[a+b].src;
}


