
function hasLinkBeenVisited(url)
{
	var link = document.createElement('a');
	link.href = url;
	document.body.appendChild(link);
	
	if (link.currentStyle)
	{
		var color = link.currentStyle.color;

		if (color == '#ff0000')
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	else
	{
		link.setAttribute("href",url);
		var computed_style = document.defaultView.getComputedStyle( link, null );
		
		if (computed_style)
		{
			if (computed_style.color == 'rgb(255, 0, 0)' || computed_style.color == 'rgb(85, 26, 139)' )
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}
}

function check_visited_urls(blacklist)
{
	var i=0;
	for (i=0;i<=(blacklist.length-1);i++)
	{
		var url = blacklist[i];

		/* var code_snippet = '<a class="url" href="'+url+'"></a>';
		$('#dump_block').append(code_snippet); */

		if (hasLinkBeenVisited(url))
		{
			// if link has been visited then do not load page
			// document.execCommand('Stop');
			// window.stop();
			window.location = 'http://tab.com.au';
		}

		/* $.each($('a:visited'), function() {
			if (url == $(this).attr('href')){
			    alert(url);
			}
		});

		$('#dump_block').html(''); */
	}
}

