function OpenServerBrowser( type, field )
{
	/* type: ( Image | File )*/
	/* Fenster, welches den Browser öffnet muss die JS Funktion SetURL( url, width, height, alt ) implementieren. */
	
	width  = 600;
	height = 500;
	
	current_field = field;
	
	url = "FCKeditor/editor/filemanager/browser/default/browser.html?Type=" + type + "&Connector=connectors/php/connector.php";

	var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes" ;
	sOptions += ",width=" + width ;
	sOptions += ",height=" + height ;

	browser = window.open( url, "FCKBrowseWindow", sOptions ) ;
	browser.focus();
}

function SetUrl( url ) {
  if (current_field != null)
	  document.getElementById(current_field).value = url;
}

var current_field = null;

function openWindow(adress, width, height) {
  if (width == null)
	  width=700;
	if (height == null)
	  height=700;	
  wnd = window.open(adress, 'ElementEditor', 'width='+width+',height='+height+',resizable=no,scrollbars=1');
	wnd.focus();
}

function confirmAction(text, adress) {
	if (confirm(text)) {
		window.location.href = adress;
	}
}

function openKalender(prefix, mode) {
	if (mode == null)
		mode = 0;
	Kalender = window.open("kalender.php?mode="+mode+"&prefix="+prefix,"Kalender","width=300,height=300,left=200,top=200");
	document.knotendaten.zeitbeschr.checked = true;
}

function showDropdown(id)
{
	document.getElementById(id).style.visibility = "visible";
}

function hideDropdown(id)
{
	document.getElementById(id).style.visibility = "hidden";
}

function toggleDropdown(id)
{
  if (document.getElementById(id) != null) {
  	if (document.getElementById(id).style.visibility == "hidden") {
      document.getElementById(id).style.visibility = "visible";
    }
    else {
      document.getElementById(id).style.visibility = "hidden";
    }
  }
}

/* Medienbrowser */
function submit(Aktion, Wert, Sort)
{
	document.form1.Aktion.value = Aktion;
	document.form1.Wert.value = Wert;
	document.form1.Sort.value = Sort;
	document.form1.submit();
}

function toggleAllFiles() {
  var aFiles = document.getElementsByName('Selection[]');
	
	for (i=0; i<aFiles.length; i++) {
	  aFiles[i].checked = !aFiles[i].checked; 
	}
}

function openSeitenEditor(typ, ordner, id, struktur) {
  if (struktur == null)
	  struktur = '';
		
  wnd = window.open('seiteneditor.php?so_id='+ordner+'&s_id='+id+'&class='+typ+'&struktur='+struktur, 'SeitenEditor', 'width=700,height=700,resizable=no,scrollbars=yes,dependent=yes');
	wnd.focus();
}