function popup(url, id, width, height)
{
	if(id == null) id = "xooloo_popup";
	if(width == null) width=770;
	if(height == null) height = 500;

	var winHandle = window.open(url, id, "status=no,directories=no,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes,width=" + width + ",height=" + height + ",innerHeight=" + height + ",innerWidth=" + width);

	return winHandle;
}

function addToFavorites() 
{
	var url = 'http://www.xooloo.fr';
	var title = 'Xooloo - Le Web + Net';
	
	if (window.sidebar) 
	{ 
		// Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	}
	else if(window.external) 
	{
		window.external.AddFavorite(url, title);
	}
	else if(window.opera && window.print) 
	{
		window.alert('Faites CTRL+D pour ajouter Xooloo à vos favoris !');
	}
}

var tnCurIndex = 0;
var tnScrolling = false;
var tnDirection = 'left';
var tns = null;
var tnMaxIndex = 0;


function doScroll()
{
	if(!tnScrolling) return false;

	tnScrolling = false;
	if(tnDirection == 'left')
	{
  if(tnCurIndex > 0)
  {
	$('fleched').show();
	  if(--tnCurIndex == 0) 
	{
	  $('flecheg').hide();        
	}
	  tnScrolling = true;
  }
	}
	else
	{
  if(tnCurIndex < tnMaxIndex)
  {
	$('flecheg').show();
	  if(++tnCurIndex == tnMaxIndex)
	{
	  $('fleched').hide();
	}
	  tnScrolling = true;
  }
	}

 for(var i=0, len=tns.length; i<len; ++i)
 {
   if((i < tnCurIndex) || (i > tnCurIndex+3))
   {
	 Element.hide(tns[i]);
   }
   else
   {
	 Element.show(tns[i]);
   }
 }

	setTimeout(doScroll, 200);
};

function startScroll(direction)
{
	tnScrolling = true;
	tnDirection = direction;
	tns = $$('div.scrollable');

	doScroll();
};

function stopScroll()
{
	tnScrolling = false;
};


