var periodIntv;
/*
	@brief Submitted eine Seite per JavaScript, dabei kann man die Form Attribute beeinflussen, nur wenn
	per POST die Daten versendet werden, kann die Variable 'action' mit Queryanweisung etwas bewirken.
	@param OBJECT/STRING (formthis) Formular auf das zugegriffen werden soll
	@param STRING (action) dabei werden 4 formen berücksichtigt:
		- index.php             //action wird ersetzt
		- index.php?test=5      //action wird ersetzt
		- ?test=5               //action wird ersetzt
		- test=5                //action wird angehängt
		oder
		- test=5&test2=3...      //action wird angehängt
	@param STRING (target) definiert das Targetattribut vom FORM-Tag z.B.: '_self', '_blank' ...)
	@param STRING (encoding) definiert den Encodingattribut vom FORM-Tag
*/
function submitPage(formthis, action, method, target, encoding) {
	if (action && action.length) {
		if (action.indexOf('?') >= 0) {
			//ersetzen (2,3 Fall)
			formthis.form.action = action;
		} else {
			if (action.indexOf('=') >= 0) {
				//anhängen (4 Fall)
				if (!formthis.form.action.length) { 
					//falls Form kein Attribut-Action definiert hat, dann Urlquery aus Adresszeile nehmen und Wert anhängen
					form_action = location.search;
				
				} else {
					//wenn Form Attribut-Action definiert hat, dann Wert anhängen
					form_action = formthis.form.action;
				}
				
				if (form_action[action.length-1] == '?') /* Fragezeichen am Ende */
					pre = '';
				else if (form_action[0] == '?')          /* Fragezeichen am Anfang */
					pre = '&';
				else if (form_action.indexOf('?') >= 0)       /* Fragezeichen irgendwo im String */
					pre = '&';
				else
					pre = '?';
					
				formthis.form.action = form_action + pre + action;
			} else {
				//ersetzen (1 Fall)
				formthis.form.action = action;
			}
		}
	}

	if (method)
		formthis.form.method = method;
	if (target)
		formthis.form.target = target;
	if (encoding)
		formthis.form.encoding = encoding;    
	
	formthis.form.submit();
}

function resetPage(formthis) {
	formthis.form.reset();
}

function periodSubmit(time, formthis, action, method, target, encoding) {
	periodIntv = setInterval("submitPage("+formthis+","+action+", "+method+", "+target+", "+encoding+")", time);
}

function stopperiodSubmit() {
	clearInterval(periodIntv);
}