function markAll() {
	checkboxes = document.getElementsByTagName('input');

	for (var i = 0; i < checkboxes.length; i++) {
		
		checkbox = checkboxes[i];
		
		if (checkbox.type != 'checkbox') {
			continue;
		}
		
		checkbox.checked = true; 
	}  
}

function markNone() {
	checkboxes = document.getElementsByTagName('input');

	for (var i = 0; i < checkboxes.length; i++) {
		
		checkbox = checkboxes[i];
		
		if (checkbox.type != 'checkbox') {
			continue;
		}
		
		checkbox.checked = false; 
	}  
}

function showElement(element, type) {
	if (document.getElementById) {
		switch (type) {
			case 1:	eval("document.getElementById(element).style.visibility = \"visible\"");	break;
			case 2:	eval("document.getElementById(element).style.display    = \"block\"");		break;
		}
	}
}

function hideElement(element, type) {
	if (document.getElementById) {
		switch (type) {
			case 1:	eval("document.getElementById(element).style.visibility = \"hidden\"");		break;
			case 2:	eval("document.getElementById(element).style.display    = \"none\"");		break;
		}
	}
}

function changeColor(element, color) {
	if (document.getElementById) {
		eval("document.getElementById(element).style.color = \""+ color +"\"");
	}
}

function hideTextdecoration(element) {
	if (document.getElementById) {
		eval("document.getElementById(element).style.textDecoration = \"none\"");
	}
}

function showFormElement(form, element, id) {
	var selektiert = form.elements[id].value;
	
	if (selektiert == 2) {
		showElement(element);
		return false;
	}
	else {
		hideElement(element);
		return false;
	}
}

function openPopup(url, name, w, h) {
	leftPosition = (screen.width)  ? (screen.width - w) / 2  : 0;
	topPosition  = (screen.height) ? (screen.height - h) / 4 : 0;

	Fenster = window.open(url, name,'height='+h+',width='+w+',top='+topPosition+',left='+leftPosition+',scrollbars=1,resizable');
}

function openFilemanagerImg(targetField, imgByGallery, countId, imageDirectory, type) {
	w = 645;
	h = 460;

	LeftPosition = (screen.width)  ? (screen.width - w) / 2  : 0;
	TopPosition  = (screen.height) ? (screen.height - h) / 2 : 0;

	Fenster = window.open('tiny_mce/plugins/filemanager/InsertFile/insert_file.php?targetField='+targetField+'&imageDirectory='+imageDirectory+'&imgByGallery='+imgByGallery+'&countId='+countId+'&type='+type,'fileManager','height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=0,resizable');
}

function closeWindow() {
	window.close();
}

function closeForward(url) {
	opener.location.href = url;
	top.close();
}

function showOther(source) {
	if (source == "Anderes") {
		document.getElementById('otherland').style.display = "block";
	}
	else {
		document.getElementById('otherland').style.display = "none";
	
		var index = document.getElementById('otherlandfield').selectedIndex;

		if (index > 0) {
			document.getElementById('otherlandfield').selectedIndex = 0;
		}
	}
}

function loadImages() {
	document.Vorladen = new Array();

	if (document.images) {
		for (var i = 0; i < loadImages.arguments.length; i++) {
			document.Vorladen[i] = new Image();
			document.Vorladen[i].src = loadImages.arguments[i];
		}
	}
}