
function validateStyle()
{	var stylePath = findStylePath(getActiveStyleSheet());
	if(stylePath == null)
		stylePath = findStylePath(getPreferredStyleSheet());	

	if(stylePath == null)
	{	alert("An error occurred validating the style sheet for this page.");
		return;
	}

	location.href = "http://jigsaw.w3.org/css-validator/validator?uri=http://www.coffeeblack.org" + stylePath;
}

function findStylePath(title)
{	var link;

	for(var i = 0, linkElements = document.getElementsByTagName("link");
		link = linkElements[i]; i++)
	{	if(link.getAttribute("rel").indexOf("style") != -1
			&& link.getAttribute("title") == title && !link.disabled)
		{	return link.getAttribute("href");
		}
	}

	return null;
}
