/*
Copyright Piotr Zagawa, 29-12-2008
All Rights Reserved
vetch@vetch.magot.pl
*/

function isIExplorer()
{
	var sBrowser = navigator.appName.toLowerCase();
	if (sBrowser.indexOf("internet") != -1)
		if (sBrowser.indexOf("explorer") != -1)
			return true;
	return false;
}

function IExplorerVersion()
{
	var majorVersion = 0;
	var fullVersion = "";
	var agent = navigator.userAgent;
	if ((verOffset = agent.indexOf("MSIE")) != -1)
	{
		fullVersion = agent.substring(verOffset + 5);
		if ((ix=fullVersion.indexOf(";")) != -1)
			fullVersion=fullVersion.substring(0, ix);
		if ((ix=fullVersion.indexOf(" ")) != -1)
			fullVersion=fullVersion.substring(0, ix);
		majorVersion = parseInt('' + fullVersion, 10);
		if (isNaN(majorVersion))
			majorVersion = parseInt(navigator.appVersion,10);
	}
	return majorVersion;
}

function writeExplorerInfo()
{
	if (isIExplorer())
	{
		if (IExplorerVersion() < 8.0)
		{
			var sTitle = "<h3>Attention</h3>"
			var sInfo = "<p>My website is designed for browsers compatible with W3C standards.</p>";
			sInfo += "<p>Your browser, Microsoft Internet Explorer, is not fully compatible with internet standards and does not work correctly.</p>";
			sInfo += "<p>Please use newer version of Internet Explorer, Firefox, Safari or Opera browser for browsing my website.</p>";
			sInfo += "<p>Thank you.</p>";		
			sInfo = "<p>" + sInfo + "</p>";
			document.write("<div id='ieInfo'>" + sTitle + sInfo + "</div>");
		}
	}
}

