//aid is the language id in the array
//bid is the menu id = position id
//runeng= each menu sets id of mylinks to get menu ref
//seteng = the flag sets the language flag, after getting current location via cookie
function runeng(aid, bid){
var theroot="";
var mylinks = new Array(2);
mylinks[0] = new Array(10)
mylinks[0][0] = "index.php?include=welcome.html";
mylinks[0][1] = "index.php?include=history.html";
mylinks[0][2] = "index.php?include=focus.html";
mylinks[0][3] = "projects.php";
mylinks[0][4] = "pubsmain.php?docid=32&prime=1&lan=english";
mylinks[0][5] = "index.php?include=contact.html";
mylinks[0][6] = "index.php?include=links.html";
mylinks[0][7] = "index.php?include=traineeship.html";
mylinks[0][8] = "allnews.php";

mylinks [1] = new Array(10)
mylinks[1][0] = "g_index.php?include=g_welcome.html";
mylinks[1][1] = "g_index.php?include=g_history.html";
mylinks[1][2] = "g_index.php?include=g_focus.html";
mylinks[1][3] = "g_projects.php";
mylinks[1][4] = "g_pubsmain.php?docid=19&prime=1&lan=german";
mylinks[1][5] = "g_index.php?include=g_contact.html";
mylinks[1][6] = "g_index.php?include=g_links.html";
mylinks[1][7] = "g_index.php?include=aufgaben.html";
mylinks[1][8] = "g_allnews.php";
createCookie('aidx','',7)  //initialise cookie
createCookie('bidx','',7)  //set language id of current location
createCookie('aidx',aid,7) //initialise cookie
createCookie('bidx',bid,7) //set [position] id of current location
window.location = theroot + mylinks[aid][bid];
}

function seteng(ax){
var theroot="";
var mylinks = new Array(2);
mylinks[0] = new Array(10)
mylinks[0][0] = "index.php?include=welcome.html";
mylinks[0][1] = "index.php?include=history.html";
mylinks[0][2] = "index.php?include=focus.html";
mylinks[0][3] = "projects.php";
mylinks[0][4] = "pubsmain.php?docid=32&prime=1&lan=english";
mylinks[0][5] = "index.php?include=contact.html";
mylinks[0][6] = "index.php?include=links.html";
mylinks[0][7] = "index.php?include=traineeship.html";
mylinks[0][8] = "allnews.php";

mylinks [1] = new Array(10)
mylinks[1][0] = "g_index.php?include=g_welcome.html";
mylinks[1][1] = "g_index.php?include=g_history.html";
mylinks[1][2] = "g_index.php?include=g_focus.html";
mylinks[1][3] = "g_projects.php";
mylinks[1][4] = "g_pubsmain.php?docid=19&prime=1&lan=german";
mylinks[1][5] = "g_index.php?include=g_contact.html";
mylinks[1][6] = "g_index.php?include=g_links.html";
mylinks[1][7] = "g_index.php?include=aufgaben.html";
mylinks[1][8] = "g_allnews.php";
var currid = readCookie('bidx') //get poistion id via cookie
if((currid==null)||(currid=="")){
currid=0;
//alert('its null ' + currid);
}
window.location = theroot + mylinks[ax][currid];
}

function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name)
{
	createCookie(name,"",-1);
}
