function start() {
	for ( var i = 1; i <= 10; i++ ) {
		if ( document.getElementById( "timer"+i ) ) {
			var params = document.getElementById( "timer"+i ).title.split( "_" );
			var time = parseInt( params[1] );
			var type = params[3];
			timer( "timer"+i, time, type );
		}
	}
}

function timer( timer, time, type ) {
	var t = time;
	if ( t > 0 ) {
		var h = Math.floor( t / 3600 );
		var m = Math.floor( ( t - h * 3600 ) / 60 );
		var s = t - h * 3600 - m * 60;
		if ( type == 1 ) {
			if ( h == 0 ) h = "";
			else h = h + " Hre. ";
			if ( m == 0 && h == 0 ) m = "";
			else m = m + " Min. ";
			if ( s == 0 && m == 0 && h == 0 ) s = "";
			else s = s + " Sec.";
			document.getElementById( timer ).firstChild.nodeValue = h + m + s;
		} else if ( type == 2 ) {
			if ( m < 10 ) m = "0" + m;
			if ( s < 10 ) s = "0" + s;
			document.getElementById( timer ).firstChild.nodeValue = h + ":" + m + ":" + s;
		}
		var time = t - 1;
		window.setTimeout( 'timer( "'+timer+'", "'+time+'", "'+type+'" )', 1000 );
	} else {
		if ( type == 1 ){
			document.getElementById( timer ).firstChild.nodeValue= "Finished!";
			window.location.href = window.location.pathname + window.location.search;
		}
		else if ( type == 2 ) document.getElementById( timer ).firstChild.nodeValue= "Arrived!";
	}
}
function CheckAll(){
	if(document.mails_data.ALL){
		var c = document.mails_data.ALL.checked;
	}
	for (var i=0;i<document.mails_data.elements.length;i++){
		var e = document.mails_data.elements[i];
 		  	if(e.name != 'ALL') e.checked = c;
   	}
}
var formfeld="";
var maxlang=1500;

function mails_anschlaege()	{
if (document.mails_answer.text.value.length > maxlang){
	alert("The maximum number of " + maxlang + " characters has been reached.");
	document.mails_answer.text.value = formfeld;
	return;
}else{
	formfeld = document.mails_answer.text.value;
	document.mails_answer.anzeigen.value = (maxlang - document.mails_answer.text.value.length);
	}
}

