var ActiveDivId, MaxHeight, MinHeight;
var Step = 20;
var LastElement = null;


function ChangeMenu(MenuType)
{
	var i;

	for(i = 0; i < AllLayers.length; i++)
		document.all[AllLayers[i][0]].style.height = 1;

	document.all[AllLayers[MenuType][0]].style.height = AllLayers[MenuType][1];
}


function HideDiv()
{
	if(parseInt(ActiveDivId.style.height) <= MinHeight)
    {
		window.clearInterval(Interval);
        	ActiveDivId.style.height = MinHeight;
    }
	else
		ActiveDivId.style.height = parseInt(ActiveDivId.style.height) - Step;
}

function ShowDiv()
{
	if(parseInt(ActiveDivId.style.height) >= MaxHeight)
    {
		window.clearInterval(Interval);
        ActiveDivId.style.height = MaxHeight;
    }
	else
		ActiveDivId.style.height = parseInt(ActiveDivId.style.height) + Step;
}

function ShowHideTitle(DivId, NewMaxHeight, NewMinHeight)
{
    ActiveDivId = DivId;
    MaxHeight = NewMaxHeight;
    MinHeight = NewMinHeight;

	if(parseInt(DivId.style.height) <= NewMinHeight)
		Interval = window.setInterval("ShowDiv()", 1);
	else
		Interval = window.setInterval("HideDiv()", 1);
}

function ShowView(NewPageAddress, ActionId)
{
	if(LastElement)
	{
		LastElement.style.backgroundColor = "#7EA7B8";
		//LastElement.style.textDecoration = "none";
	}
	event.srcElement.style.backgroundColor = "#999999";
	//event.srcElement.style.textDecoration = "underline";
	LastElement = event.srcElement;

	EndViewCall = document.frames[0].document.getElementById("hidEndViewCall");
	if(ActionId)
		EndViewCall.onclick(ActionId, NewPageAddress, null, false);
	else
	{
		EndViewCall.onclick(View.ACTION_ID_GENERALEDITVIEW_SHOWPAGE, NewPageAddress, null, false);
	}
}

function ChangePage(NewPageAddress)
{
	if(LastElement)
	{
		LastElement.style.backgroundColor = "#81ACBC";
		//LastElement.style.textDecoration = "none";
	}
	event.srcElement.style.backgroundColor = "#81ACBC";
	//event.srcElement.style.textDecoration = "underline";
	LastElement = event.srcElement;
    document.all.mainframe.src = NewPageAddress;
}

function Show3MSReport()
{
	var Str;

	if(LastElement)
		LastElement.style.backgroundColor = "#81ACBC";
	event.srcElement.style.backgroundColor = "#999999";
	LastElement = event.srcElement;
	Str = event.srcElement.id.split("tdReport");

	if(Str.length < 2)
		Str = event.srcElement.id.split("tdStatistics");
	ShowReport(parseInt(Str[1]));
}

function AddSeries(TableId)
{
    var i, j;
	Colors = [0x008000,0x0000ff,0xff00ff,0xeeffee,0x999999,0x22bb33,0x667788];

	document.all.chrtAnalysis.RemoveAllSeries();
    document.all.chrtAnalysis.Header.Text.Clear();

	for(i = 0; i < TableId.rows[1].cells.length; i++)
	{
    	document.all.chrtAnalysis.AddSeries(1);	// 1 : asBar

    	document.all.chrtAnalysis.Series(i).AsBar.BarStyle = 6;
    	document.all.chrtAnalysis.Series(i).Marks.Visible = true;

    	document.all.chrtAnalysis.Series(i).Marks.Style = 2;
    	document.all.chrtAnalysis.Series(i).Title = TableId.rows[1].cells[i].innerText;
    	document.all.chrtAnalysis.Series(i).ColorEachPoint = false;
    	document.all.chrtAnalysis.Series(i).Marks.Style = 0;

    	for(j = 2; j < TableId.rows.length; j++)
    			document.all.chrtAnalysis.Series(i).Add(TableId.rows[j].cells[i].innerText, TableId.rows[j].cells[TableId.rows[j].cells.length - 1].innerText, Colors[i]);
		document.all.chrtAnalysis.Series(i).Color = Colors[i];
    }
}





