/*
##############################################################################
# UCC User Created Content Version $version
# 2002 (c) J3S Jan Sass	und Sven Sass GbR, info@j3s.de
##############################################################################
# copying prohibited, single site license granted to PFS
# Created 13/06/2002	Last Modified today
##############################################################################
*/

function lite(o) {o.style.backgroundColor = '#C7E3CF'; o.style.cursor= 'hand'}
function dark(o) {o.style.backgroundColor = '';}

function openlink(link, name, width, height,toolbar) {
 if (typeof (name)   =='undefined') { name='popup';}
 if (typeof (width)  =='undefined') { width=800;}
 if (typeof (height) =='undefined') { height=600;}

 // pass additional hoverwidth information =)
 if(typeof(current_hover_width) != 'undefined' && current_hover_width != -1) {
   var hoverwidth= current_hover_width;
   link+= "&hoverwidth="+hoverwidth;
 }
if (typeof (toolbar)=='undefined') { toolbar='status=yes,scrollbars=yes,resizable=yes,width='+width+',height='+height;}
 var posx= Math.round((screen.availWidth -width )/2);
 var posy= Math.round((screen.availHeight-height)/2);
 toolbar += ",left="+posx+",top="+posy;
 var popup = window.open(link,name,toolbar);
 popup.focus();
 return false;
}

function Demystify(data) {
  var chars=data.split(",");
  for (var c in chars){
    document.write(String.fromCharCode(chars[c]-37));
  }
}

var col=0;
var col_width=395; // cp. article settings "column width" + spacing
if (document.all) col_width+=3;
var use_fancy_scroller=1;
var scroll_pixels=3;
var moves=0;

function UpdateNavigation () {
  moves=0;
  document.getElementById('currentpage').innerHTML = Math.round((col+2)/2);

  if (col>0) {
    document.getElementById('prevcol').style.visibility = 'visible';
  } else {
    document.getElementById('prevcol').style.visibility = 'hidden';
  }

  if (col < cols-1) {
    document.getElementById('nextcol').style.visibility = 'visible';
  } else {
    document.getElementById('nextcol').style.visibility = 'hidden';
  }
}

function NextPage() {
  if (col < cols-1) {
    col++;
    UpdateNavigation();
    if (use_fancy_scroller) {
      viewport_x=-col_width*col;
      setTimeout('scrollViewport()',0);
    } else {
      document.getElementById('viewport').style.marginLeft = -col_width*col+'px';
    }
  }

  return false;
}

function PrevPage () {
  if (col > 0) {
    col--;
    UpdateNavigation();
     if (use_fancy_scroller) {
      viewport_x=-col_width*col;
      setTimeout('scrollViewport()',0);
    } else {
      document.getElementById('viewport').style.marginLeft = -col_width*col+'px';
    }
  }
  return false;
}

function scrollViewport() {
  var repeat = 0;
  moves++;

  var curx = document.getElementById('viewport').style.marginLeft;
  if (curx=='') curx=0;
  curx = parseInt(curx);
  if (curx < viewport_x) {
    if (Math.abs(curx - viewport_x) < scroll_pixels ) {
      curx=viewport_x;
    } else {
      repeat=1;
      curx=Math.round((viewport_x+curx*4)/5);
    }
  }

  if (curx > viewport_x) {
    if (Math.abs(curx - viewport_x) < scroll_pixels ) {
      curx=viewport_x;
    } else {
      repeat=1;
      curx=Math.round((viewport_x+curx*4)/5);
    }
  }

  document.getElementById('viewport').style.marginLeft = curx + 'px';
  if (repeat && moves<30) setTimeout('scrollViewport()',30);
}
