function tabbar(action,hl) {
document.form.jsaction.value = action;
document.form.newhl.value = hl;
document.form.submit();
}

function formchanged ()
	{
	document.form.form_changed.value = 'yes';
	}


// Set Focus on the first field that contains an error
function errfocus (fieldname)
		{
		document.forms[0].elements[fieldname].focus();
		}

// Rückfrage (Ja,Nein) auslösen, Aktion zwischenspeichern

function ChangedConfirmSubmit(action,message)
	{
	confirmtype = "2";
	if (document.form.form_changed.value == 'yes' && message != '')
		{
		nextaction = action;
		openQuestion("Yes,No,Cancel",message);
		}
	else
		{
		ActionSubmit(action);
		}
	}
	
function ConfirmSubmit(action,message) 
{
  confirmtype = "1";
	if (message != '')
		{
		nextaction = action;
		openQuestion('Yes,No',message);
		}
	else
		{
		ActionSubmit(action);
		}
}

// zeigt ein Rückfragefenster
//   unter buttons wird eine Liste erwartet, die die Buttons bilden soll
//	 unter msg die Nachricht, die auf dem Fenster gezeigt werden soll */
function openQuestion(buttons,msg)
{
  Fenster = window.open("shared/dsp_confirm.cfm?buttons=" + buttons + "&msg=" + msg,"openQuestion","fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
	Fenster.resizeTo(240,160);
	Fenster.moveTo(screen.width / 2 - 125, screen.height / 2 - 60);
}


	
// Nimmt die Antwort aus dem Rückfragefenster entgegen
function getanswer(answer)
{
  switch(confirmtype + "=" + answer)
	{
	  case "1=Yes":
		  ActionSubmit(nextaction);
			break;
		case "1=No":
			break;
		case "2=Yes":
		  ActionSubmit("2" + nextaction);
			break;
		case "2=No":
		  ActionSubmit(nextaction);
		case "2=Cancel":
		break;
	}
}

// Aktion über URL-Variable verschicken.
	function ActionSubmit(action) {
		document.forms[0].jsaction.value = action;
		document.forms[0].submit();
	}

function formsubmit(action,message) {
	if (message != '')
		{if (confirm (message) == true)
			{
			document.forms[0].action = document.forms[0].action + "?action=" + action;
			document.forms[0].submit();
			}
		}
	else
		{
		document.forms[0].action = document.forms[0].action + "?action=" + action;
		document.forms[0].submit();
		}
}

<!-- begin to hide script contents from old browsers
function checksearch()
  {
	var searchlen = document.forms[0].searchterm.value;
	if(searchlen == "")
		{
		alert("Please type in keyword(s) to search!");
		}
	else {
			ActionSubmit('act_content_search');
		 }
  }
// end hiding script from old browsers -->



function popitup(destination,win_name,win_dim) 
{
		window.open (destination ,win_name,win_dim + ',' + 'resizable=yes,scrollbars=yes,toolbar=no,Left=250,Top=250,status=no,directories=no,menubar=no,location=tabelle');
	}

function noSpamMailLink(user,domain,tld,param) {
	locationstring = "mailto:" + user + "@" + domain + "." + tld + param;
	window.location = locationstring;
}

function displayCount(totalcount)
{
	var answeredcount = 0;
	var remainingcount = totalcount;
	var score = 0;
	var elmID = "INPUT";
	for (i = 0; i < document.getElementsByTagName(elmID).length; i++)
	{
		obj = document.getElementsByTagName(elmID)[i];
		if (obj.name.indexOf("answer_") == 0 && obj.checked){
			answeredcount = answeredcount+1;
			remainingcount = remainingcount-1;
			if (obj.value == 1 || obj.value == 0){
				score = score+1;
			}
		}
	}
	document.forms[0].elements['pointsanswered'].value=answeredcount;
	document.forms[0].elements['pointsremaining'].value=remainingcount;
	document.forms[0].elements['score'].value=score;
}

var secs;
var timerID = null;
var timerRunning = false;
var delay = 1000;
function initTimer(s)
{
	secs = s;
    StopTheClock();
    StartTheTimer();
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID);
    timerRunning = false;
}

function StartTheTimer()
{
    if (secs<0)
    {
        StopTheClock();
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
        ActionSubmit('act_workouts_evaluation_upd_sec');
    }
    else
    {
		if (secs==130)
		{
			alertpopup('alertfive',1);
		}
		
		if (secs==120)
		{
			alertpopup('alertfive',0);
		}			
		
		if (secs==40)
		{
			alertpopup('alert',1);
		}
		
		if (secs==30)
		{
			alertpopup('alert',0);
		}			
		
		var minutes = Math.floor( secs / 60 );
		var seconds = secs - (minutes*60);
        document.forms[0].elements['timer'].value = ((minutes < 10) ? "0" : "") + minutes + ((seconds < 10) ? ":0" : ":") + seconds;
		document.forms[0].elements['timelimit'].value = secs;
        secs = secs - 1;
        timerRunning = true;
        timerID = self.setTimeout("StartTheTimer()", delay);
    }
}

function alertpopup(szDivID, iState) // 1 visible, 0 hidden
    {
        if(document.layers)    //NN4+
        {
           document.layers[szDivID].visibility = iState ? "show" : "hide";
        }
        else if(document.getElementById)      //gecko(NN6) + IE 5+
        {
            var obj = document.getElementById(szDivID);
            obj.style.visibility = iState ? "visible" : "hidden";
        }
        else if(document.all)       // IE 4
        {
            document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
        }
    }