

//=============================================================================
// create singleton object
if(typeof ms =="undefined"){var ms = {};}
//=============================================================================
// public methods
ms =
{
	//==========================================================================
	CURRENT_SCREEN : String(),
	//==========================================================================
	init : function	()
	{
		this.CURRENT_SCREEN = "empty";
	},
	//==========================================================================
	showOffscreen : function(inIdName)
	{
		ms.hideOffscreen();
		this.CURRENT_SCREEN = inIdName;
		ms.util.changeClass(this.CURRENT_SCREEN, 'onscreen');
		//flashPlayer.disableFlash(true);
	},
	hideOffscreen : function()
	{
		if(this.CURRENT_SCREEN!="empty")
		{
			ms.util.changeClass(this.CURRENT_SCREEN, 'offscreen');
			this.CURRENT_SCREEN = "empty";
			//flashPlayer.disableFlash(false);
		}
	},
	showOverlay : function(inIdName){
		//ms.hideOverlay();
		//this.CURRENT_SCREEN = inIdName;
		//flashPlayer.disableFlash(true);
		//flashPlayer.showOverlay(inIdName);
	},
	hideOverlay : function(){
		//if(this.CURRENT_SCREEN!="empty"){
			//this.CURRENT_SCREEN = "empty";
			//flashPlayer.disableFlash(false);
			//flashPlayer.hideOverlay();
		//}
	}
}
//==============================================================================
// private utility methods
ms.util =
{
	//==========================================================================
	
	//==========================================================================
	// use
	// ms.util.changeClass("someIdName", "class1");
	// ms.util.changeClass("someIdName", "class1 class2 class3");
	changeClass : function(inIdName, inClass)
	{
		try{
			var cNode = this.getNode(inIdName);
		}catch(e){
			//alert("1: " + e + " | " + node);
		}
		try{
			cNode.className = inClass;
		}catch(e){
			//alert("2: " + node + " | " + document.embeds + " | " + document.embeds[inElement]);
		}
	},
	//==========================================================================
	//	use
	//	ms.util.setStyle("body", "backgroundColor", "#222222");
	//	ms.util.setStyle("container", "height", 100, "px");
	setStyle : function(inIdName, inAttribute, inValue, inSuffix)
	{
		var cNode = this.getNode(inIdName);
		var value = (inSuffix != undefined)? inValue + inSuffix : inValue;
		cNode.style[inAttribute] = value;
	},
	//==========================================================================
	// use
	// ms.util.createNode("someParentIdName", "newIdName", "class1");
	// ms.util.createNode("someParentIdName", "newIdName", "class1 class2 class3");
	createNode : function(inParentNode, inIdName, inClassName)
	{
		// create div
		var newNode = document.createElement('div');
		// assign class to div
		newNode.className = inClassName;
		// assign id to div
		newNode.id = inIdName;
		// get reference to parent div
		var parentNode = this.getNode(inParentNode);
		// append new div to parent div
		parentNode.appendChild(newNode);
	},
	//==========================================================================
	// checks for multiple browser types and returns
	// the correct Flash object reference
	// use
	// var nodeReference = ms.util.getNode("someIdName")
	getNode : function(inIdName)
	{
		if(window.document[inIdName])
		{
			return window.document[inIdName];
		}
		if(navigator.appName.indexOf("Microsoft Internet")==-1)
		{
			if(document.embeds && document.embeds[inIdName])
				return document.embeds[inIdName];
			else
				return document.getElementById(inIdName);
		}
		else
		{
			return document.getElementById(inIdName);
		}
	}
}
ms.init();