				
function callExecuted( callingFunction, useHtml )
{
	switch ( callingFunction )
	{	
		case "disableRoomLazyMode":	
			document.location.href = "room.aspx";
			break;
		case "getContactImportData":
			populateContactImportData( useHtml );
			break;
		case "getRoomValue":
			document.getElementById("spnRoomValue").innerHTML = useHtml;
			loadRoom();
			if( gFirstLoad )
			{getWhiteboards();}
			break;
		case "getWhiteboards":
			populateWhiteboards( useHtml );
			if ( gShowHideWhiteboard )
			{showHideWhiteboard();}
			if ( gViewUserId == "" && gFirstLoad )
			{
				time_chatExists = setTimeout("getChatExists()", 10); 
				var time_getChatModified;
			}
			gFirstLoad = false;
			break;
		case "loadHotspot":
			if ( useHtml != "" )
			{loadSavvyboard( useHtml );}
			break;
		case "sendContactImportInvites":
			contactImportInvitesSent();
			break;
	}
}

function disableRoomLazyMode()
{
	gCallingFunction = "disableRoomLazyMode";
	postData = "action=update&dataElement=roomStaticRoomId&roomId=" + gRoomId;
	getData("/servers/libraryserver.aspx", postData);
}

function editWhiteboard()
{
	if ( document.getElementById("lstWhiteboards").style.display == "none" )
	{document.location.href = "managewhiteboard.aspx";}
	else
	{document.location.href = "/managewhiteboard.aspx?whiteboardId=" + document.getElementById("lstWhiteboards").value;}
}

function getRoomValue( roomId )
{	
	gRoomId = roomId;
	gCallingFunction = "getRoomValue";
	postData = "action=get&dataElement=roomvalue&roomId=" + gRoomId;	
	getData("/servers/webroomserver.aspx", postData);
}

function getWhiteboards()
{
	useUserId = gViewUserId;
	if ( gViewUserId == "" || gUserId == gViewUserId )
	{
		useUserId = gUserId;
	}
	gCallingFunction = "getWhiteboards";
	postData = "action=get&dataElement=whiteboards&viewUserId=" + useUserId;	
	getData("/servers/whiteboardserver.aspx", postData);	
}

function loadRoom()
{
	var so = new SWFObject("/MediaLibrary/room.swf", "Lazy", "640", "381", "8", "#FFFFFF");
	so.addVariable("roomId", gRoomId);
	so.write("divRoom");
}

function loadHotspot( hotspotId )
{
	gCallingFunction = "loadHotspot";
	postData = "action=get&dataElement=hotspotwhiteboardid&roomId=" + gRoomId + "&hotspotId=" + hotspotId;	
	getData("/servers/hotspotserver.aspx", postData);	
}
function unloadHotspot()
{}

function loadSavvyboard( whiteboardId )
{
	selectList = document.getElementById("lstWhiteboards");
	for( i = 0; i < selectList.options.length; i++ )
	{
		if( whiteboardId == selectList.options[i].value )
		{selectList.options[i].selected = true;}
		else
		{selectList.options[i].selected = false;}
	}
	document.getElementById("whiteboard").src = "whiteboard.aspx?whiteboardId=" + whiteboardId;
}

function loadWhiteboardCode()
{
	document.getElementById("txtWhiteboardCode").value = '<iframe frameborder="0" style="border-color:#ffc38d;border-style:solid;" width="600" height="800" src="http://www.MarketAmerica.com/whiteboard.aspx?whiteboardId=' + 
		document.getElementById("lstWhiteboards").value + '"></iframe>';
	popupContainer('whiteboardCode', -10, -225);
}

function manageRoom()
{
	document.location.href = "/managerooms.aspx?roomId=" + document.getElementById("lstRooms").value;
}

function showHideWhiteboard()
{
	oDiv = document.getElementById("divWhiteboard");
	if ( oDiv.style.display == "none" )
	{
		oDiv.style.display = "block";
		document.getElementById("imgCollapseWhiteboard").src = "/Images/collapse_b.gif";
		setSessionNode( "Session", "DivWhiteboard", "Show" );
	}
	else
	{
		oDiv.style.display = "none";
		document.getElementById("imgCollapseWhiteboard").src = "/Images/collapse_a.gif";
		setSessionNode( "Session", "DivWhiteboard", "Hide" );
	}
}

function loadWhiteboard()
{document.getElementById("whiteboard").src = "/whiteboard.aspx?whiteboardId=" + document.getElementById("lstWhiteboards").value;}

function loadEditMode()
{
	document.getElementById("leftNavControl_toolbar").style.display = "none";
	document.getElementById("leftNavControl_manageInfo").style.display = "none";
	document.getElementById("leftNavControl_viewVitals").style.display = "none";
	document.getElementById("leftNavControl_viewStats").style.display = "none";
}

function loadShop()
{document.location.href = "/shop.aspx";}

function loadViewMode()
{
	document.getElementById("leftNavControl_toolbar").style.display = "block";
	document.getElementById("leftNavControl_manageInfo").style.display = "block";
	document.getElementById("leftNavControl_viewVitals").style.display = "block";
	document.getElementById("leftNavControl_viewStats").style.display = "block";
}

function populateWhiteboards( whiteboardsHtml )
{
	selectList = document.getElementById("lstWhiteboards");
	if ( whiteboardsHtml != "" )
	{
		selectList.style.display = "block";
		selectList.options.length = 0;
		arrWhiteboards = whiteboardsHtml.split(':~:');
		for( i = 0; i < arrWhiteboards.length; i++ )
		{
			arrWhiteboard = arrWhiteboards[i].split("*~*");
			addOption( selectList, arrWhiteboard[0], arrWhiteboard[1] );
		}
		arrWhiteboard = arrWhiteboards[0].split("*~*");
		loadWhiteboard( arrWhiteboard[0] );
	}
	else
	{
		selectList.style.display = "none";
		document.getElementById("spnViewWhiteboard").style.display = "none";
		if (gViewUserId == "")
		{document.getElementById("spnNoWhiteboardEdit").style.display = "block";}
		else
		{document.getElementById("spnNoWhiteboardView").style.display = "block";}
	}
}

function setRoomLazyMode()
{document.location.href = "/staticrooms.aspx?roomId=" + gRoomId;}

