var detect = navigator.userAgent.toLowerCase();
var OS, browser, version, total, thestring;

function getBrowserInfo() {
	if (checkIt('konqueror')) {
		browser = "Konqueror";
		OS = "Linux";
	}
	else if (checkIt('chrome')) browser	 = "Chrome"
	else if (checkIt('safari')) browser	 = "Safari"
	else if (checkIt('firefox')) browser = "Firefox"
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser	 = "Opera"
	else if (checkIt('webtv')) browser	 = "WebTV"
	else if (checkIt('icab')) browser	 = "iCab"
	else if (checkIt('msie 6')) browser	 = "IE6"
	else if (checkIt('msie 7')) browser	 = "IE7"
	else if (!checkIt('compatible')) {
		browser = "Netscape Navigator";
		version = detect.charAt(8);
	}
	else browser = "An unknown browser";

	if (!version) version = detect.charAt(place + thestring.length);

	if (!OS) {
		if (checkIt('linux')) OS 	= "Linux";
		else if (checkIt('x11')) OS = "Unix";
		else if (checkIt('mac')) OS = "Mac"
		else if (checkIt('win')) OS = "Windows"
		else OS 					= "an unknown operating system";
	}
}

function checkIt(string) {
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

function hideShowTags(tag, visibility)
{
	selects = document.getElementsByTagName(tag);
	for(i = 0; i < selects.length; i++)
	{
		selects[i].style.visibility = visibility;
	}
}

function prepare(height, overflow)
{
	htm = document.getElementsByTagName('html')[0];
	bod = document.getElementsByTagName('body')[0];

	htm.style.height = height;
	htm.style.overflow = overflow; 

	bod.style.height = height;
	bod.style.overflow = overflow;
}

function initialize()
{
	if (browser == 'IE6')
	{	
		//prepare('', '');
		
		hideShowTags('select', 'hidden');
	
		overlayFrame = document.getElementById('overlay-alertbox');
		overlayFrame.style.height =  1000 + document.body.scrollTop+ "px";
		
		alertBox = document.getElementById('alertbox');
		alertBox.style.top = 100 + document.body.scrollTop + "px";
	}
	
	hideShowTags('object', 'hidden');
}

function acceptLang()
{
	document.getElementById('overlay-alertbox').style.display = "none";
	document.getElementById('alertbox').style.display = "none";
	
	if (browser == 'IE6')
	{
		hideShowTags('select', 'visible');
		hideShowTags('object', 'visible');
	}
	if (browser == 'IE7')
	{	
		hideShowTags('object', 'visible');
	}
	else if (browser == "Firefox")
	{
		hideShowTags('object', 'visible');
	}
	else
	{
		hideShowTags('object', 'visible');
	}
}

window.onload = function()
{
	getBrowserInfo();
	initialize();
}
