var currentdoc = getcurrentdoc();
var number;
var indexnum;
var curlocation;
var lennext;

arr = new Array("Start","Start","Table of Pictures", "Preface", "OPAS Overview", "What is OPAS about?", "Possible fields of Applications for OPAS", "Components of OPAS", "How to use OPAS", "Starting OPAS", "User Components", "Configurator", "Entry Fields ", "Main Window", "Attributes Window", "Assets Window", "Scenarios Window", "Results Pages", "Simulation Results Page", "Allocation Results Page", "Visualization of Assets and Underlyings", "The Concepts",  "What is done where?", "Data Flow", "Books", "Attributes", "Multi Asset Constraint", "Benchmark-Portfolio", "Current Portfolio",  "Assets", "Valuation of Assets", "Fixed Coupon Bond", "Floating Rate Bond", "Zero Bond", "Currency", "Equity Index Future", "Bond Future", "Interest Rate Future", "Arbitrage Asset",  "Scenarios", "Horizon date vs. Reallocation date", "Level Scenario", "Volatility Scenario", "Visualization of Scenarios", "Volatility Modeling", "Correlation Modeling", "Correlation Scenario", "Underlying Forex", "Underlying Equity Index", "Underlying Yield Curve", "Predefined Scenarios",  "Simulation", "The data for the Simulation", "Results of the Simulation process",  "Optimization", "Optimization Issues", "Results of the Optimization", "Helpful Hints and FAQs",  "Known Problems and Work arounds",  "Example Book",  "Complementary information, services and tools","Contacting Olsen Support", "Glossary", "Index", "End"); 

function getcurrentdoc()
{
	curlocation = "" + parent.frames[1].document.location;
	number = getsubstring(curlocation);
	if (number ==null)
	{		number = "1";	}
	return number;
}

function getsubstring(str)
{
	var s = str.indexOf(".htm");
	var s1 = str.lastIndexOf("/");
	var s2 = str.substring((s1+1),s);
	var number1 = ((s2 < 9)? (s2.substring(3,4)): (s2.substring(2,4)));		
	return number1;
}

function getlink(number)
{	
	var x  = ((number > 9)? 2:3 );
	switch(parseInt(x))
	{
		case 2:		link = ("00" + number+".htm");break;
		case 3:		link = ("000" + number+".htm");break;
		default :	link = ("0001.htm");
	}
	return link;
}

function next()
{
	if (number == 63)
	{
		alert("End of document");
		nextlink = getlink(number);
		return nextlink;
	}
	var nlink = number-1+2;
	nextlink = getlink(nlink);
	return nextlink;
}

function next1()
{
	parent.frames[1].document.location = next();
}

function previous()
{
	if (number == 1)
	{
		alert("This is the first page");
		previouslink = getlink(number);
		return previouslink;
	}
	var nlink = number-1;
	previouslink = getlink(nlink);
	return previouslink;
}

function previous1()
{
	parent.frames[1].document.location = previous();
}


function up()
{
	var number2 = eval(number);
	switch (number2)
	{
		case 1    :   	upno = "1"; break;
		case 2    : 	upno = "1"; break;
		case 3    : 	upno = "1"; break;
		case 4    : 	upno = "1"; break;
		case 5    : 	upno = "4"; break;
		case 6    : 	upno = "4"; break;
		case 7    : 	upno = "4"; break;
		case 8    : 	upno = "1"; break;
		case 9    : 	upno = "8"; break;
		case 10    : 	upno = "8"; break;
		case 11    : 	upno = "8"; break;
		case 12    : 	upno = "11"; break;
		case 13    : 	upno = "11"; break;
		case 14    : 	upno = "11"; break;
		case 15    : 	upno = "11"; break;
		case 16    : 	upno = "11"; break;
		case 17    : 	upno = "8"; break;
		case 18    : 	upno = "17"; break;
		case 19    : 	upno = "17"; break;
		case 20    : 	upno = "17"; break;
		case 21    : 	upno = "1"; break;
		case 22    : 	upno = "21"; break;
		case 23    : 	upno = "21"; break;
		case 24    : 	upno = "21"; break;
		case 25    : 	upno = "24"; break;
		case 26    : 	upno = "24"; break;
		case 27    : 	upno = "24"; break;
		case 28    : 	upno = "24"; break;
		case 29    : 	upno = "21"; break;
		case 30    : 	upno = "29"; break;
		case 31    : 	upno = "29"; break;
		case 32    : 	upno = "29"; break;
		case 33    : 	upno = "29"; break;
		case 34    : 	upno = "29"; break;
		case 35    : 	upno = "29"; break;
		case 36    : 	upno = "29"; break;
		case 37    : 	upno = "29"; break;
		case 38    : 	upno = "29"; break;
		case 39    : 	upno = "21"; break;
		case 40    : 	upno = "39"; break;
		case 41    : 	upno = "39"; break;
		case 42    : 	upno = "39"; break;
		case 43    : 	upno = "39"; break;
		case 44    : 	upno = "39"; break;
		case 45    : 	upno = "39"; break;
		case 46    : 	upno = "39"; break;
		case 47    : 	upno = "39"; break;
		case 48    : 	upno = "39"; break;
		case 49    : 	upno = "39"; break;
		case 50    : 	upno = "39"; break;
		case 51    : 	upno = "21"; break;
		case 52    : 	upno = "51"; break;
		case 53    : 	upno = "51"; break;
		case 54    : 	upno = "21"; break;
		case 55    : 	upno = "54"; break;
		case 56    : 	upno = "54"; break;
		case 57    : 	upno = "1"; break;
		case 58    : 	upno = "1"; break;
		case 59    : 	upno = "1"; break;
		case 60    : 	upno = "1"; break;
		case 61    : 	upno = "1"; break;
		case 62    : 	upno = "1"; break;
		case 63    : 	upno = "1"; break;
		default    :    upno = "1";                         
	}
	return upno;
}

function up1()
{
 	parent.frames[1].document.location = getlink(up());
}

function freload()
{
	parent.frames[0].document.location.reload();
}

function shownavigationnext()
{
	numb = eval(number);
	document.write(arr[numb+1]);
//	lennext = arr[number+1].length;
}

function shownavigationup()
{
	numb = eval(up());
	document.write(arr[numb]);
}

function shownavigationprevious()
{
	numb = eval(number);
	document.write(arr[numb-1]);
}

function display()
{
	for (i=0; i<64; i++)
	{
		if (i==0)
		{	
			document.write("<option selected value=0> Select a Link </option>");
		}
		else
		{
			document.write("<option value =" + i + " >" + arr[i] + "</option>");
		}
	}
}
function changelinks(sel) 
{ 
	qty = sel.options[sel.selectedIndex].value;
	if (qty == 0)
	qty = 1;
	parent.frames[1].document.location = getlink(qty);
}