var drag = "inaktiv";
aktivX = 10;
aktivY = 10;
navebene = null;
aktivZindex = 100;

if (window.name == "" || window.name.indexOf("X",0) == -1)
{
    window.name = "10X10X0";
}
nav_infos = window.name.split("X");
        
function noSpam(user,domain){
    window.location = "mailto:" + user + "@" + domain;
    return false;
}

function init() {
    anzeige = true;
    if (nav_infos[2] == 0)
    {
         anzeige = false;
    }
    navebene =  new dObj(nav_infos[0],nav_infos[1],"navigation",true);
    
    nav_inhalt = new dObj("","","navinhalt",anzeige);
    if (!anzeige)
    {
        document.images['plusminus'].src = '/img/nav_plus_ani.gif';
    }
    //if (document.captureEvents) // Netscape
    //{
      // document.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
    //}
    document.onmouseup = mup;
    document.onmousemove = mmove;
    navebene.gehNach(parseInt(nav_infos[0]),parseInt(nav_infos[1]));
    externalLinks();
    //alert(self.location.href);
    if (self.location.href == "http://www.klik-info.ch/") {
    	setTimeout("auto_toggle()", 9900);
    }
}

function externalLinks() { 
 if (document.getElementsByTagName)
 {
    var anchors = document.getElementsByTagName("a"); 
    for (var i = 0; i < anchors.length; i++) 
    { 
        var anchor = anchors[i]; 
        if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
        {
            anchor.target = "_blank";
        }
    }
  }
} 

window.onload = init;

function mmove(e){
   if (drag == "inaktiv") 
   {
       return;
   }
   var neuX = (e) ? e.pageX : event.clientX + document.body.scrollLeft;
   var neuY = (e) ? e.pageY : event.clientY + document.body.scrollTop;
   var distX = (neuX-aktivX);
   var distY = (neuY-aktivY);
   aktivX = neuX;
   aktivY = neuY;
   navebene.gehNach(navebene.x+distX,navebene.y+distY);
   window.name = navebene.x+"X"+navebene.y+"X"+nav_infos[2];
} 

function mup(e){
   drag = "inaktiv";
} 

function auto_toggle()  {
  if (nav_infos[2] != 1) {
  	 document.images['plusminus'].src= '/img/nav_minus.gif';
     nav_inhalt.zeige();
     nav_infos[2] = 1; 
  	 window.name = navebene.x+"X"+navebene.y+"X"+nav_infos[2];
	  i = 1;
	  while (i < 12) {
		setTimeout("move_menu('+')", i * 60);
		i++;
	  }
	  setTimeout("up_move()", 700);
  }
}

function up_move() {
  i = 1;
  while (i < 12) {
  	setTimeout("move_menu('-')", i * 60);
  	i++;
  }
}

function move_menu(vorzeichen) {
	gotoy = vorzeichen == "+" ? 2 : -2;
	navebene.gehNach(navebene.x, navebene.y + gotoy);
}

function nav_toggle(pfad){
    if (nav_infos[2] == 1)
    {
        document.images['plusminus'].src=pfad+'img/nav_plus_ani.gif';
        nav_inhalt.verstecke();
        nav_infos[2] = 0;
    }
    else
    {
        document.images['plusminus'].src=pfad+'img/nav_minus.gif';
        nav_inhalt.zeige();
        nav_infos[2] = 1;     
    }
    window.name = navebene.x+"X"+navebene.y+"X"+nav_infos[2];
}

function pfeil(ort,pfad,bild) {
    if (bild != 'w')
    {
        bild = 'nav_pfeil';
    }
    document.images[ort].src=pfad+'img/'+bild+'.gif';
}