// Sitestat function
function sitestat ( ns_l )
{
  if ( typeof ( siteStatLink ) != 'undefined' )
    ns_l += '.' + sitestatCreateSafeString ( siteStatLink );

  // Client date
  ns_l += '&amp;ns__t=' + (new Date()).getTime();
  ns_pixelUrl = ns_l;
  // Referer
  ns_0=document.referrer;
  ns_0= ( ns_0.lastIndexOf ( '/' ) == ns_0.length - 1 ) ? ns_0.substring ( ns_0.lastIndexOf ( '/' ), 0 ) : ns_0;
  if ( ns_0.length > 0 )
    ns_l += '&amp;ns_referrer=' + escape ( ns_0 );

  // Write the image
  if ( document.images )
  {
    ns_1 = new Image ();
    ns_1.src = ns_l;
  }
  else
    document.write ( '<img src="' + ns_l + '" style="width: 1px; height: 1px; visibility: hidden;" alt="" />' );
}

function sitestatCreateSafeString ( url )
{
  for ( a = 0; a < url.length; a ++ )
    if ( !url.substring ( a, a + 1 ).match ( /[0-9a-z]/i ) )
      if ( a > 0 && url.substring ( a - 1, a ).match ( /-/i ) )
        url = url.substring ( 0, a ) + url.substring ( a + 1, url.length );
      else
        url = url.substring ( 0, a ) + '-' + url.substring ( a + 1, url.length );


  return url;
}

windowOldOnload = window.onload;

window.onload = function()
{
  if ( windowOldOnload != null )
    windowOldOnload ();

  setNav ();
  setNone ( 'coll-items', 1 );
  citems ( 'coll-items' );
}

function setNav ()
{
  var item = document.getElementById ( 'directnaar' );
  var itemmenu = document.getElementById ( 'nav_directnaar' );

  if (item)
  {
    item.onmouseover = function ()
    {
      this.className = 'over';
      document.getElementById ( 'nav_directnaar' ).style [ 'visibility' ] = 'visible';
    };

    item.onmouseout = function ()
    {
      this.className = '';
      document.getElementById ( 'nav_directnaar' ).style [ 'visibility' ] = 'hidden';
    };
  }
  
  if (itemmenu)
  {
    itemmenu.onmouseout = function ()
    {
      document.getElementById ( 'directnaar' ).className = '';
      this.style [ 'visibility' ] = 'hidden';
    };
  }
}

function citems ( ID )
{
  if ( document.getElementById ( ID ) )
  {
    var entries = document.getElementById ( ID ).getElementsByTagName ( 'a' );
    for ( i = 0; i < entries.length ; i ++ )
    {
      if ( entries [ i ].parentNode.tagName.toLowerCase () == 'span' )
      {
        entries [ i ].onclick = function ()
        {
          setNone ( 'coll-items', 0 );

          this.className = 'active';
          this.parentNode.parentNode.getElementsByTagName ( "table" ) [ 0 ].style [ 'display' ] = 'block';
          return false;
        }
      }
    }
  }
}

function setNone ( ID, start )
{
  if ( document.getElementById ( ID ) )
  {
    var entries = document.getElementById ( ID ).getElementsByTagName ( 'table' );

    for ( j = start; j < entries.length; j ++ )
    {
      entries [ j ].parentNode.getElementsByTagName ( 'a' ) [ 0 ].className = '';
      entries [ j ].style [ 'display' ] = 'none';
    }
  }
}
