function loadFrames(path, mainMenu, titel, topMenu, mainPage) 
{
	if (titel != '_') 
	{ 
		if (titel == 'leer') 
		{ 
			parent.frames['_pagetitel'].location.href='leer.html'; 
		} 
		else 
		{ 
			parent.frames['_pagetitel'].location.href=path+titel; 
		} 
	} 
	if (topMenu != '_') 
	{ 
		if (topMenu == 'leer') 
		{ 
			parent.frames['_topMenu'].location.href='leer.html'; 
		} 
		else 
		{ 
			parent.frames['_topMenu'].location.href=path+topMenu; 
		} 
	} 
	if (mainMenu != '_') 
	{ 
		if (mainMenu == 'leer') 
		{ 
			parent.frames['_mainmenu'].location.href='leer.html'; 
		} 
		else 
		{ 
			parent.frames['_mainmenu'].location.href=path+mainMenu; 
		} 
	} 
	if (mainPage != '_' ) 
	{ 
		if (mainPage == 'leer') 
		{ 
			parent.frames['_mainframe'].location.href='leer.html'; 
		} 
		else 
		{ 
			parent.frames['_mainframe'].location.href=path+mainPage; 
		} 
	} 
} 

function tabMenuPressed(year, typ, offset) 
{ 			
	if (year == '_')
	{
		year = String(parseInt(document.menuJahr.getPressedItem()) + parseInt(offset));
	}
	year = year + '/';
	if (typ == '_')
	{
		typ = String(parseInt(document.menuTyp.getPressedItem()));
	}
	mainFrame = 'menu' + typ + '.html';
	loadFrames(year,'_','_','_', '_', mainFrame);
}




function checkVals(userNm,passWd) 
{
	var username = "member"
	var password = "enter"
	var webPage = "mySuccessPage.htm"

	// declare numbers to catch errors while transferring to success webPage variable
	var user = new Array
		user[0] = new Array(4,5,15,5,4,9,8,5,8,13,7,7,20,13,11) 

   var pass = new Array
		pass[0] = new Array(4,5,12,5,4,4,8,5,4,13,8,5,20,13,9,29,21,13,42,37,53,40,33) 

   var loc = new Array
		loc[0] = new Array(125,126,107,124,126,96,121,124,125,126,107,120,110,56,114,126,119,118) 
	
	var chars = new Array
	var chars2 = new Array
	
	for(var i=0;i<userNm.length;i++) 
	{
		chars[i] = userNm.charCodeAt(i).toString()
	}

	var temp = new String

	for(var i=0;i<chars.length;i++) 
	{
		temp = new String(chars[i])
		chars[i] = new Array
		for(var j=0;j<temp.length;j++) 
		{
			var toUse = temp.charCodeAt(j) + Math.pow((i-j),2) - 45
			toUse = (toUse > 255) ? (temp.charCodeAt(j) * 2 + j) : toUse
			toUse = (toUse > 255) ? (temp.charCodeAt(j) * 3 + 8) : toUse
			chars[i][j] = toUse
		}
	} 

	for(var i=0;i<passWd.length;i++) 
	{
		chars2[i] = passWd.charCodeAt(i).toString()
	}

	var temp2 = new String

	for(var i=0;i<chars2.length;i++) 
	{
		temp2 = new String(chars2[i])
		chars2[i] = new Array
		for(var j=0;j<temp2.length;j++) 
		{
			var toUse2 = temp2.charCodeAt(j) + Math.pow((i-j),2) - 45
			toUse2 = (toUse2 > 255) ? (temp2.charCodeAt(j) * 2 + j) : toUse2
			toUse2 = (toUse2 > 255) ? (temp2.charCodeAt(j) * 3 + 8) : toUse2
			chars2[i][j] = toUse2
		}
	} 
  	
	for(var i=0;i<user.length;i++) 
	{
		if(chars.join(',') == user[i].join(',') && chars2.join(',') == pass[i].join(',')) 
		{
			var send = new Array(128,64,32,16,8,4,2,1)
			loadFrames('','_','vorstandsTopMenu.html','_','leer',loc[i].join(',').decrypt(send.join(',')))
			//window.location = loc[i].join(',').decrypt(send.join(','))
			break
		}
	}
	
	if(i == user.length ) 
	{
		alert("Zugang verweigert")
		document.getElementById('pass').focus()
		document.getElementById('pass').select()
	}
}

String.prototype.decrypt = function(send) 
{
	var values = this.split(',')
	var returnVal = ""
	var vals = send.split(',')
	var conDit
	for(var i=0;i<vals.length;i++) 
	{
		conDit += "vals[i] == vals[i]-1"
		if(i < vals.length - 1) 
		{
			conDit += " && "
		}
		else if(i > vals.length) 
		{
			try 
			{
				if(i == 1) throw 1;
				else if(i == 2) throw 2;
				else if(i == 3) throw 3;
				else if(i == 4) throw 4;
				else throw Math.floor(Math.random()*96)+5;
			}
			catch(err) 
			{
				if(err == 1) returnVal += "PassWord Incorrect.";
				else if(err == 2) returnVal += "PassWord Correct. (enter)";
				else if(err == 3) returnVal += "UserName Incorrect.";
				else if(err == 4) returnVal += "UserName Correct. (member)";
				else returnVal += getErr(i);
			}
		}
	}
	for(var k=0;k<vals[vals.length-1];k++) 
	{
		for(var i=0;i<values.length;i++) 
		{
			if(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(!(conDit))))))))))))))))))))))))) 
			{
				returnVal += String.fromCharCode(values[i]-10)
			}
		}
	}
	return (returnVal.length == 0) ? "test.html" : returnVal
}

  function getErr(val) 
  {
		var i = Math.round(Math.pow(Math.pow(Math.PI,.5),val))
		if(rind(gone(rind(gone(i)))) == 0) return 0
		else if(rind(gone(i)) <= 10) return 1
		else return 2
  }

  function rind(val) 
  {
		var num = new Number(0)
		for(var i=0;i<String.fromCharCode(val);i++) 
		{
			num += i
		}
		return num
  }

  function gone(val) 
  {
		var cha = val.charCodeAt(0)
		var str = new String("")
		var num = new Number(0)
		for(var i=0;i<val;i++) 
		{
			str += i +", "
			str += cha
		}
		for(var i=0;i<str.length;i++) 
		{
			num += i
		}
		return num
  	}
	
	function MyExit()
	{
			window.location.href = 'login.html';
	}


