function transparency(element, percentage) {

	var i, count, objStyle;

	if (document.getElementById) {

		obj = element;

		// Prozentwert
		percentage = (typeof (percentage) == "undefined") ? 50
				: 100 - percentage;

		// Anzahl der passenden Elemente
		count = (obj.length) ? obj.length : 1;

		// Elemente durchgehen
		for (i = 0; i < count; i++) {
			objStyle = (obj.length) ? obj[i].style : obj.style;
			objStyle.filter = "Alpha(opacity=" + percentage + ")";
		}

	}
}


function negativ(element) {

	var i, count, objStyle;

	if (document.getElementById) {

		obj = element;

		// Anzahl der passenden Elemente
		count = (obj.length) ? obj.length : 1;

		// Elemente durchgehen
		for (i = 0; i < count; i++) {
			objStyle = (obj.length) ? obj[i].style : obj.style;
			objStyle.filter = "XRay()";
		}

	}
}

function openPage(url) {
	window.open(url, '_self');
}

function closePage() {
	window.close();
}

function fenster(url) {
	var popup = window.open(url, 'popup', 'width=380, height=440, left=50, top=50');
	popup.focus();
}

function submitLink(link) {
	document.register.action = link;
	document.register.submit();
}

function autoScroll(element_name) {
	var radios = document.getElementsByName(element_name);
	for (i = 0; i < radios.length; ++i) {
		if (radios[i].checked == true) {
			radios[i].scrollIntoView(true);
			break;
		}
	}
}

function scroller(message, seed) {

	var out = " ";
	var count = 0;

	if (seed > 100) {
		seed--;
		cmd = "scroller('" + message + "'," + seed + ")";
		timerTwo = window.setTimeout(cmd, 100);

	} else if (seed <= 100 && seed > 0) {
		for (count = 0; count < seed; count++) {
			out += " ";
		}
		out += message;
		seed--;
		window.status = out;
		cmd = "scroller('" + message + "'," + seed + ")";
		timerTwo = window.setTimeout(cmd, 100);

	} else if (seed <= 0) {
		if (-seed < message.length) {
			out += message.substring(-seed, message.length);
			seed--;
			window.status = out;
			cmd = "scroller('" + message + "'," + seed + ")";
			timerTwo = window.setTimeout(cmd, 100);
		} else {
			window.status = " ";
			timerTwo = window.setTimeout("scroller('" + message + "', 100)", 75);
		}
	}
}

function removeAllChildNodes(container) {
	if (container == null) {
		return;
	}
	while(container.hasChildNodes()){
		container.removeChild(container.lastChild);
	}
}

function comboBox(el, redirect, place, add, remove) {
    var val = el.options[el.selectedIndex].value;
	var button_place = document.getElementById(place);
    var _parent = el.parentNode;
	var el_temp = el;

	var ok =  document.createElement('input');
	ok.type = 'submit';

	removeAllChildNodes(button_place);

    if(!val) {
		var input = document.createElement('input');
		input.style.width = '228';
		_parent.removeChild( el );
		_parent.appendChild( input );

		ok.style.color = '#FFB300';
		ok.value = add;
		button_place.appendChild( ok );

		ok.onclick = function() {
			var new_val = input.value;
			_parent.removeChild( input );
			button_place.removeChild( ok );
			_parent.appendChild( el_temp );

			if (new_val && new_val.length > 0) {
				var opt = el.options;
				var contains = false;
				for(i = 0; i < opt.length; i++) {
					if (opt[i].value == new_val) {
						contains = true;
						break;
					}
				}
				if (!contains) {
					var o = new Option(new_val, new_val);
					var l = opt.length;
					var tmp = opt[l - 1];
					opt[l - 1] = o;
					opt[l] = tmp;
					el.selectedIndex = l - 1;
					window.location = redirect + '&addSecVenue=' + new_val;
				}
			}
		};
    } else if (val != '_'){
		ok.style.color = '#FF0000';
		ok.value = remove
		button_place.appendChild( ok );

		ok.onclick = function() {
			button_place.removeChild( ok );
			var sel = el.selectedIndex;
			el.options[sel] = null;
			window.location = redirect + '&delSecVenue=' + sel;
		};
	}
}

