function gsygetObj(name)
{
  if (document.getElementById)
    {
      this.obj = document.getElementById(name);
      this.style = document.getElementById(name).style;
    }
  else if (document.all)
    {
      this.obj = document.all[name];
      this.style = document.all[name].style;
    }
  else if (document.layers)
    {
      if (document.layers[name])
	{
	  this.obj = document.layers[name];
	  this.style = document.layers[name];
	}
      else
	{
	  this.obj = document.layers.testP.layers[name];
	  this.style = document.layers.testP.layers[name];
	}
    }
}

function gsyfindPosX(obj)
{
  var curleft = 0;
  if (obj.offsetParent)
    {
      while (obj.offsetParent)
	{
	  curleft += obj.offsetLeft
	    obj = obj.offsetParent;
	}
    }
  else if (obj.x)
    curleft += obj.x;
  return curleft;
}

function gsyfindPosY(obj)
{
  var curtop = 0;
  var printstring = '';
  if (obj.offsetParent)
    {
      while (obj.offsetParent)
	{
	  curtop += obj.offsetTop
	    obj = obj.offsetParent;
	}
    }
  else if (obj.y)
    curtop += obj.y;
  return curtop;
}

function activate_ads()
{
  try
    {
      var il = new gsygetObj('gsyadtop');
      newX = gsyfindPosX(il.obj);
      newY = gsyfindPosY(il.obj);
      var x = new gsygetObj('gsyadtopload');
      x.style.top = newY + 'px';
      x.style.left = newX + 'px';
      x.style.display='inline';
    }
  catch(err)
    {
    }


  try
    {
      var il = new gsygetObj('gsyadrectangle');
      newX = gsyfindPosX(il.obj);
      newY = gsyfindPosY(il.obj);
      var x = new gsygetObj('gsyadrectangleload');
      x.style.top = newY + 'px';
      x.style.left = newX + 'px';
      x.style.display='inline';
    }
  catch(err)
    {
    }


  try
    {
      var il = new gsygetObj('gsyadright');
      newX = gsyfindPosX(il.obj);
      newY = gsyfindPosY(il.obj);
      var x = new gsygetObj('gsyadrightload');
      x.style.top = newY + 'px';
      x.style.left = newX + 'px';
      x.style.display='inline';
    }
  catch(err)
    {
    }
}

var current_tab;

function showOnglet(element) {
  
  
  $("#ongletHeader li").each(function (i) {
      //alert(this.id);
      if (this.id == 'menu'+element) {
        $(this).removeClass();
        $(this).addClass('current');
        //alert("on affiche " + this.id);
      }
      else {
        //alert("on cache " + this.id);
        $(this).removeClass('current');
        $(this).addClass('inactive');
      }
    });
  
  
  $(".shout").each(function (i) {
      //alert(this.id);
      if (this.id == 'shout'+element) {
        //alert("on cache " + this.id);
        $(this).removeClass('invisible');
        
      }
      else {
        $(this).addClass('invisible');
      }
    });
      
    current_tab = element;  
    
    activate_ads();
}

function logAccess (tab) {

  $.get('shoutbox_access_'+tab+'.html');

}


