function openPopup(URL,WIDTH,HEIGHT){
	if(!WIDTH) WIDTH=600;
	if(!HEIGHT) HEIGHT=600;
	popup = window.open(URL,"popup","width="+WIDTH+", height="+HEIGHT+", scrollbars=yes,resizable=yes");
}

function PreloadImages(url) {
  bild = new Image();
  bild.src = url;
  return bild;
}

var FormChanged = false;

function formchange(object) {
//	alert(object.className);
	object.className = object.className+' edited';
	FormChanged = true;
}

function closeUploads() {
	self.opener.location.reload();
	self.close();
}

function openUploads(URL,WIDTH,HEIGHT){
	var check = true;
	if(FormChanged != false) {
		check = confirm("Das Formular enthält ungespeicherte Änderungen! Sollen diese Änderungen verworfen werden?\n\nSie sollten ihre Änderungen speichern, bevor Sie die Uploads bearbeiten.\nKlicken Sie dazu auf Abbrechen und speichern Sie Ihre Eingaben wie gewohnt.");
		if (check == true) {
			FormChanged = false;
		}
	}

	if(FormChanged == false) {
		if(!WIDTH) WIDTH=600;
		if(!HEIGHT) HEIGHT=600;
		popup = window.open(URL,"popup","width="+WIDTH+", height="+HEIGHT+", scrollbars=yes,resizable=yes");
	}
}


		function myKlapp(id){
				var status_id = 'status_'+id;
				if(document.getElementById(id).style.display=="none") {
					document.getElementById(id).style.display="block";
					document.getElementById(status_id).value = "open";
				} else {
					document.getElementById(id).style.display="none";
					document.getElementById(status_id).value = "closed";
				}
			}

		function showTable(id) {

			foo = new Array;
			foo[0] = Array("news_0_open", "news_0");
			foo[1] = Array("news_1_open", "news_1");
			foo[2] = Array("news_2_open", "news_2");

			for(i = 0; i < foo.length; ++i) {
				for (a = 0; a < foo[i].length; ++a){
					if(foo[i][a] == id) {
						for (x = 0; x < foo[i].length; ++x) {
							var display;

							var status_id = 'status_'+foo[i][x];
								if (foo[i][x] == id) {
								document.getElementById(foo[i][x]).style.display="block";

								if(document.getElementById(status_id)) document.getElementById(status_id).value = "open";

								else alert('Hidden Field ' + status_id +' fehlt');
							} else {
								document.getElementById(foo[i][x]).style.display="none";
								if(document.getElementById(status_id)) document.getElementById(status_id).value = "closed";
								else alert('Hidden Field ' + status_id +' fehlt');
							}
						}
					}
				}
			}
		}


<!-- Begin
/* Created by: Husay :: http://www.communitxt.net */

var arrInput = new Array(0);
var last_id = false;
var arrInputValue = new Array(0);

function addInput(next_id) {

  last_id = next_id+1;

  arrInput.push(arrInput.length);
  arrInputValue.push("");
  display(last_id);
}

function display(new_id) {
  document.getElementById('multi_uploads').innerHTML="";
  for (intI=0;intI<arrInput.length;intI++) {
    document.getElementById('multi_uploads').innerHTML+=createInput(arrInput[intI]+last_id, arrInputValue[intI], new_id);
  }
}

function saveValue(intId,strValue) {
  arrInputValue[intId]=strValue;
}

function createInput(id,value, size) {
  return "<input name=\"upload"+id+"\" class=\"additional_upload\" type='file' "+ id +"'><br>";
}

function deleteInput() {
  if (arrInput.length > 0) {
     arrInput.pop();
     arrInputValue.pop();
  }
  display();
}
// End -->

/* Window Höhe ermitteln */
FULLHEIGHT = document.documentElement.clientHeight;


/* New Functions, die prototype verwenden */
var first = true;
function showNews(id,container,element){
	if (first == true){
		first = false;
		new Effect.BlindDown($(id),{duration:0.2});
		$('status_' + id).value = "open";
		return false;
	}
	myElements = $('container').getElementsByClassName(element);

	for (myElement in myElements)
	{
		if (myElements[myElement].id)
		{

			var status_id = 'status_'+myElements[myElement].id;

			if ( (myElements[myElement].id == id ) && ( $(status_id).value != "open" ) )
			{
				new Effect.BlindDown(myElements[myElement].id,{duration:0.2});
				$(status_id).value = "open";
			}
			else
			{
				new Effect.BlindUp(myElements[myElement].id,{duration:0.2});
				$(status_id).value = "closed";
			}
		}
	}
}

function Blindthis(id){
	if($(id).style.display == "none"){
		new Effect.BlindDown(id,{duration:0.5});
	}
	else {
		new Effect.BlindUp(id,{duration:0.5});
	}
}

// Richtige Höhe

function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
function giveHeight(element){
	myHeight = getPageSize();
	$(element).style.height = myHeight[1] + "px";
}

