state = new Array();
show = new Array();
change = new Array();

function changethetab(nr)
{
	currenttab=0;
	if(nr==10) 
		{
		nr = 2;
		if(window.location.href.search('#') > (-1))
			{
			currenttab = window.location.href.split('#');
			for(h=0; h<=3; h++) if(currenttab[1]==h) nr=h;
			}
		}
	for(h=1; h<=3; h++) // aktuellen Status auslesen
		{
		tab = 'tab'+h;
		this_state = (document.getElementById(tab).className);
		if(this_state != 'selected') state[h] = this_state; 
		}
	for(i=1; i<=3; i++) // neuen Status festlegen
		{
		tab = 'tab' + i;
		show[i] = (nr==i)? 'block' : 'none';
		change[i] = (nr==i)? 'selected' : state[i];
		}
	for(j=1; j<=3; j++) // neuen Status anwenden
		{
		tab = 'tab' + j;
		document.getElementById(tab).className = change[j];
		for(k=0; k<=3; k++)
			{
			content = 'cont'+j;
			document.getElementById(content).style.display = show[j];
			}
		}
}

