var SolutionMapComposer;

function smnavigate(id) 
{ 
	if (window.SolutionMapComposer)
	{
		SolutionMapComposer.smnavigate(id);
	}
	else
	{
		window.location.href = id+'.htm'; 
	}		
}

function smnavigate_cbs(id) 
{ 
	smnavigate(id); 
}

var __openCBSBox = null;
function toggleCBSSelector(id, forceOnOff)
{
	if (id && id != '')
	{
		
		if (window.event )
		{
			event.cancelBubble = true;
			event.returnValue = false;
		}
	}	
	
	if (__openCBSBox != null)
	{
		if ((forceOnOff != null && !forceOnOff) ||__openCBSBox.id != id || (window.event && event.srcElement.tagName == 'BODY'))
			__openCBSBox.style.display='none';
	}
		
	var box = (id != null && id != "") ? document.getElementById(id) : null;
	if (box != null)
	{
		
		if (forceOnOff || box.style.display=='none')
		{
			if (box.parentElement && box.parentElement.tagName != "BODY")
				document.body.appendChild(box);
			var x = document.body.scrollLeft + (window.event ? event.clientX : 0);
			var y = document.body.scrollTop + (window.event ? event.clientY : 0);
			box.style.position='absolute';
			box.style.posLeft = x + 10;
			box.style.posTop = y + 5;
			
			__openCBSBox = box;
			
			box.style.display = '';
			
			var offs =  document.body.scrollLeft + document.body.clientWidth - (box.clientWidth + box.style.posLeft);
			if (offs < 0)
				box.style.posLeft += (offs + 10);
			offs =  document.body.scrollTop + document.body.clientHeight - (box.clientHeight + box.style.posTop);
			if (offs < 0)
				box.style.posTop += (offs + 10);	
		}	
		else 
		{
			box.style.display='none';
			__openCBSBox = null;
			
		}	
	}
	
}

function SMNavigateToGeneralInfo()
{
	window.location.href = 'http://www.sap.com/businessmaps';
}


function SMNavigateToDataFile(file)
{

	window.location.href = file
}


function toggleNextRowDisplay(row)
{
	try {
		if (window.event) {
		
			if (event.srcElement.tagName == "A")
				return false;
			
			event.cancelBubble=true;
			event.returnValue=false;
		}
		
		var nextRow = row.parentElement.rows[row.rowIndex+1];
		nextRow.runtimeStyle.display = nextRow.currentStyle.display=='none' ? 'block' : 'none';
	}
	catch (e)
	{
		;
	}
}

	var globalExpandScenarioGroupsToggle = 0;

	function displayStyleScenarioGroupContent(elem)
	{
		var local = elem.showExpanded;
		return (0 == (isNaN(local) || local <= globalExpandScenarioGroupsToggle ? globalExpandScenarioGroupsToggle : local) % 2) ? 'none' : 'block';
	}
	
	function toggleLocalExpand(elem)
	{
		elem.showExpanded = (elem.showExpanded > globalExpandScenarioGroupsToggle) ? globalExpandScenarioGroupsToggle : globalExpandScenarioGroupsToggle + 1;
	}
	
	function toggleNextRowDisplay2(row)
	{
	
		try {
			if (window.event) {
		
				if (event.srcElement.tagName == "A")
					return false;
				
				event.cancelBubble=true;
				event.returnValue=false;
			}
			
			var nextRow = row.parentElement.rows[row.rowIndex+1];
			//nextRow.runtimeStyle.display = nextRow.currentStyle.display=='none' ? 'block' : 'none';
			toggleLocalExpand(nextRow);
		}
		catch (e)
		{
			;
		}

	}

