function getViewportSize() {
	var size = [0, 0];
	if (typeof window.innerWidth != "undefined") {
		size = [window.innerWidth, window.innerHeight];
	}
	else if (typeof document.documentElement != "undefined" && typeof document.documentElement.clientWidth != "undefined" && document.documentElement.clientWidth != 0) {
		size = [document.documentElement.clientWidth, document.documentElement.clientHeight];
	}
	else {
		size = [document.getElementsByTagName("body")[0].clientWidth, document.getElementsByTagName("body")[0].clientHeight];
	}
	return size;
}

function createFullBrowserFlash() {
	swfobject.createCSS("html", "height:100%;");
	swfobject.createCSS("body", "height:100%;");
	swfobject.createCSS("#container", "margin:0; width:100%; height:100%; min-width:1000px; min-height:800px;");
	window.onresize = function() {
		var el = document.getElementById("container");
		var size = getViewportSize();
		el.style.width = size[0] < 1024 ? "1000px" : "100%";
		el.style.height = size[1] < 800 ? "800px" : "100%";
	};
	window.onresize();
}

function extract_key()
{
	if (window.location.href.indexOf('message') != -1)
	{
		var arr = window.location.href.split('/');
		return arr[arr.length - 1];
	}
	return null;
}

function hide(element_id)
{
  var element = document.getElementById(element_id);
  element.style.display = "none";
}

function set_lang(lang, element)
{
  $('post_language').value = lang;
	var links = $('select_lang').select('a');
	
	if (typeof(element) != 'undefined')
	{
	  for(var i = 0; i < links.length; i++)	{ links[i].className = '';}
	  element = $(element);
	  element.className = 'active';
	}
}
