function createRequestObject()
	{
		var http_request = null;
		if(window.XMLHttpRequest)
		{
			http_request = new XMLHttpRequest();
			if(http_request.overrideMimeType)
				http_request.overrideMimeType("text/xml");
		}
		else if(window.ActiveXObject)
		{
			try
			{
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e)
			{
				try
				{
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){}
			}
		}
		return http_request;
	}
	
	var http_request;
	function loadSmartBarmessages(){
		var url = "GetSmartBar.aspx";
		var gameId = document.getElementById("gameId");
		
		http_request = createRequestObject();
		if(gameId.value != ""){
			url += "?gameId=" + gameId.value
		}
		http_request.open("POST", url, true);
		http_request.onreadystatechange = updateSmartBar
		http_request.send("&dummy=" + Math.random());
	}
	
	function updateSmartBar(){
		if (http_request.readyState == 4) {
			if (http_request.status == 200) {
				fillSmartBarCell();
			}
		}
	}
	var smartBarDivList;
	function fillSmartBarCell(){
		var smartBarCell = document.getElementById("smartBarCell");
		for(var i=0; i< http_request.responseXML.getElementsByTagName("Message").length; i++){
			var _html = "<div style='display: none;vertical-align:top;border-color:Green;border-width:2px;width:90%'>"
			_html += http_request.responseXML.getElementsByTagName("Message")[i].childNodes[0].nodeValue
			_html += "</div>";
			smartBarCell.innerHTML += _html;
		}
		var smartBarCell = document.getElementById("smartBarCell");
		smartBarDivList = smartBarCell.getElementsByTagName("DIV");
		//alert(smartBarDivList.length);
		if(smartBarDivList.length > 0)
			smartBarDivList[0].style.display = "block";
		
		window.setTimeout("startSmartBarEffects(0)", 5000);
	}
	
	function startSmartBarEffects(currentIndex){
		Effect.Fade(smartBarDivList[currentIndex], {duration: 0.5});
		
		if(currentIndex >= smartBarDivList.length - 1)
			currentIndex = 0
		else
			currentIndex = currentIndex + 1;
		var _function = 'startSmartBarEffects(' + currentIndex + ')'
		window.setTimeout(_function, 5000);
		
		var _function = 'showNextSmartBarItem(' + currentIndex + ')'
		window.setTimeout(_function, 500);
	}
	
	function showNextSmartBarItem(index){
		smartBarDivList[index].style.display = "block";
	}
	window.setTimeout("loadSmartBarmessages()", 3000)
	
	
	function changeAvatarMode(mode){
		var avatarMovie = thisMovie('kidsAvatar');
		if(avatarMovie != null || avatarMovie != undefined)
			avatarMovie.changeMode(mode);
	}
	function thisMovie(movieName) {
		if (navigator.appName.indexOf("Microsoft") != -1) {
			return window[movieName]
		}
		else{
			return document[movieName]
		}
	}
