function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  
  // Hide all currently visible layers
  newsItems = ['news1', 'news2', 'news3']
  if(whichLayer.substr(0,4) == 'news') {
	  for(i = 0; i < newsItems.length; i++) {
		d = document.getElementById(newsItems[i]);
		d.className = 'hidden-layer';
		d.style.display = 'none';
	  }
  }
  
  
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  if(vis.display==''||vis.display=='block'){
	  elem.className = 'hidden-layer';
	  vis.display = 'none';
  }else {
	  elem.className = 'visible-layer';
	  vis.display = 'block';
  }
}

jQuery(document).ready(function(){
  // Activat Scroll to
  $('#navigation a').click(function(){
    to = $(this).attr('rel');
    $.scrollTo("a[name*="+to+"]",1000);
    return(false);
  });
  
  //client list logo cycle
  $('#clients').cycle({ 
    fx:    'fade', 
    speed:  800,
	timeout: 1000,
	pause: 1
 });
  
  
  
  // Activate Contact links
  $('a.toggle').click(function(){
    rel = $(this).attr('rel');
    $("#contact-info a.toggle.active").removeClass('active');
    $(this).addClass('active');
    
    $("#contact-info div.active").removeClass('active');
    $("div#"+rel).addClass('active');
  });
});