ia_preInit();

function ia_preInit() {
  window.onload=ia_nospam;
 
  if(typeof(document.getElementById)=="undefined" 
  || typeof(document.getElementsByTagName)=="undefined"
  || typeof(document.doctype)=="undefined"
  || (navigator.userAgent.match(/\b(opera|konqueror)\b/i))
  || (!ia_registerEvent(window,"load",ia_init))
  
  ) {
   return;
  }
  img=new Image();
   document.write(
    '<style type="text/css">'
    +'#content_box { visibility: hidden } '
    +'</style>'
  );

}

function ia_init() {
  ia_initMenuAnchors();
  ia_initLangAnchors();
  ia_reveal();
  
}

function ia_initMenuAnchors() {
  var anchors=document.getElementById("navigation"
            ).getElementsByTagName("a");
  for(var j=anchors.length; j-->0;) {
    var a=anchors[j];
    if(a.className=="nav") {
      var fx=new Function(
        "ia_reveal(this.href); return false;"
      );
      a.onclick=fx;
    }
  }
}

function ia_initLangAnchors() {
  var anchors=document.getElementById("languages"
            ).getElementsByTagName("a");
  for(var j=anchors.length; j-->0;) {
    var a=anchors[j];
    a.onmouseover = ia_langFly_over;
    a.onmouseout = ia_langFly_out;
  }
}

function ia_langFly_over() {
  ia_langFly(this, true);
}
function ia_langFly_out(ev) {
  ia_langFly(this, false);
}
function ia_langFly(a, over) {
  var img=a.getElementsByTagName("img")[0];
  img.src = over
      ? img.src.replace(
        /\blang_([a-z]{2})\.gif$/, "lang_$1_a.gif")
      :img.src=img.src.replace(/_a\.gif$/,".gif");
  
  if(over && document.getElementById("content")!=null) {
    ia_reveal("");
  } else {
    ia_reveal();
  }
 
}




function ia_reveal(href) {
  var closing=typeof(href)=="string";
  var contentBox=document.getElementById("content_box");
 
  if(contentBox==null || contentBox.className=="invisible") {
    if(closing && href.length>0) {
       location.href=href;
    }
    return;
  }
  
  
  ia_reveal_href=closing?href:"";
  ia_reveal_millis=800;
 
  var now=new Date().getTime();
  var dir=closing?-1:1;
  if(typeof(ia_reveal_time)=="number" && typeof(ia_reveal_dir)=="number") {
    if(ia_reveal_dir==dir) return;
    var elapsed=now-ia_reveal_time;
    if(elapsed<ia_reveal_millis) {
      now=now-ia_reveal_millis+elapsed;
    }
  } 
  ia_reveal_time=now;
  ia_reveal_dir=dir;
  
  contentBox.style.visibility="visible";
  if(navigator.userAgent.match(/MSIE.*Win.*/)) {
    ia_reveal_height=contentBox.offsetHeight;
    
    contentBox.style.borderBottomStyle="solid";
    contentBox.style.top=contentBox.offsetTop+"px";
    contentBox.style.left=contentBox.offsetTop+"px";
    contentBox.style.position="absolute";
    ia_reveal_setHeight=function(h) {
      if(h<=0) h=0;
    
      contentBox.style.borderBottomStyle=
        (h==0 || h>= ia_reveal_height)?"none":"solid";
      
      contentBox.style.clip = 
        "rect(0px,"+contentBox.offsetWidth+"px,"+h+"px,0px)";
      contentBox.style.height=h+"px";
      contentBox.style.position="static";
      
    }
  } else {
    var main=document.getElementById("main");
    ia_reveal_height=main.offsetHeight+main.offsetTop;
    var mainBox=document.getElementById("main_box");
    var cover=document.getElementById("cover");
    if(cover==null) {
     cover=document.createElement("div");
     cover.id="cover";
     cover.style.width=mainBox.offsetWidth+"px";;
     mainBox.insertBefore(cover,mainBox.lastChild);
    }
    
    ia_reveal_setHeight=function(h) {
      h=ia_reveal_height-h;
      if(h<=0) h=0;
      cover.style.visibility=h>0?"visible":"hidden";
      cover.style.height=h+"px";
    }
     
  }
    
  
  ia_reveal_loop();
  
  function ia_reveal_loop() {
    function setHeight(h) {
      ia_reveal_setHeight(h);
    }
    
    var now=new Date().getTime();
    var elapsed=now-ia_reveal_time;
    if(elapsed>=ia_reveal_millis) {
      
      setHeight(ia_reveal_dir<0?0:ia_reveal_height);
      if(ia_reveal_href.length>0) {
        setTimeout(function() { location.href=ia_reveal_href }, 60);
      }
      return;
    }
    
    var angle=Math.PI*elapsed/ia_reveal_millis/2;
    var factor=ia_reveal_dir<0?Math.cos(angle):Math.sin(angle);
    setHeight(Math.round(factor*ia_reveal_height));
    if(typeof(ia_reveal_timeout)!="undefined") clearTimeout(ia_reveal_timeout);
    ia_reveal_timeout=setTimeout(ia_reveal_loop,40);
  }
  
}


function ia_nospam() {
  var aa=document.links;
  var rxFind=/^mailto:.*/;
  var rxRepl=/\{AT\}/g;
  for(var j=aa.length; j-->0;) {
    var a=aa[j];
    if(rxFind.test(a.href)) {
      a.href=a.href.replace(rxRepl,"@");
      a.innerHTML=a.innerHTML.replace(rxRepl,"@");
    }
  }
}

