function testausgabe( p_id ) {
 alert("Testausgabe: "+p_id);
} // End testausgabe

function anzahlBilder( p_bilderkategorie_id ) {
 if (p_bilderkategorie_id==""){
// if (p_bilderkategorie_id==6){
//  return 0;
  $("#AnzahlBilder").text("keine");
 }
 if (window.XMLHttpRequest){
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
 } else {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
 }
 xmlhttp.onreadystatechange=function(){
  if (xmlhttp.readyState==4 && xmlhttp.status==200){
//   var anzahlBilder=xmlhttp.responseText;
//   return anzahlBilder;
  $("#AnzahlBilder").text("nun " + xmlhttp.responseText);
  $("#Ergebnis").prepend("Die Kategorie enthält nun " + xmlhttp.responseText + "  Bilder.<br>");
  }
 }

 var jetzt = new Date();
 var msec = jetzt.getTime();
 xmlhttp.open("GET","pages/anzahl-bilder.php?p_id="+p_bilderkategorie_id+"&p_msec="+msec,true);
 xmlhttp.send();
} // anzahlBilder

function getFilename( p_id ) {
 var url = document.getElementById('Browse'+p_id).value;
 if (url == '')
  return;
 var suche = url.lastIndexOf("\\");
 var filename;
 if(suche != -1) 
  filename = url.substr(suche+1);
 else
  filename = url;
 document.getElementById('Datei' + p_id).value = filename;
 document.getElementById('Browse' + p_id).style.display = 'none';
 document.getElementById('Datei' + p_id).style.display = 'inline';
// document.getElementById('Button' + p_id).style.display = 'inline';
} // End getFilename

function dochNicht( p_id ) {
// var i = document.getElementById('Browse' + p_id).parentNode.parentNode.rowIndex;
// document.getElementById('Dateien').deleteRow(i);

 document.getElementById('Browse' + p_id).value = '';
 //alert(document.getElementById('Browse' + p_id).value);
 document.getElementById('Datei' + p_id).style.display = 'none';
// document.getElementById('Button' + p_id).style.display = 'none';
 document.getElementById('Browse' + p_id).style.display = 'block';
} // End dochNicht

function redirect( where ) {
 location.href=where;
 return true;
} // End redirect

function doSubmit(r){
 document.tom_form.p_request.value = r;
 document.tom_form.submit();
} // End doSubmit()

function doMRU(r,z){
 if(r==null){r='LOESCHEN'}
 if(r=='LOESCHEN')
  bestaetigen= confirm("Wirklich löschen?");
 else
  bestaetigen = true;
 if (bestaetigen== true){
  document.tom_form.p_request.value = r;
  document.tom_form.p_rows.value = z;
  document.tom_form.submit();
 }
} // End doMRU()

function set_tab_index( tab_index ){
 document.getElementById("tab_index").value = tab_index;
 document.tom_form.submit();
} // End set_tab_index()

function first_field(field1) {
 if(document.getElementById){
  if(document.getElementById(field1)){
   var theField = document.getElementById(field1);
   if((theField.type!="hidden")&&(!theField.disabled)){
    theField.focus();}
   }
  return true;
 }
} // End of first_field()

function submitEnter(itemObj,e){
 var keycode;
 if (window.event) keycode = window.event.keyCode;
 else 
  if (e) keycode = e.which;
  else return true;
 if (keycode == 13) {
  doSubmit(itemObj.id);
  return false;
 } else
  return true;
}

function confirmDelete(msg,req){
 if(req==null){req='Delete'}
 var confDel = msg;
 if(confDel ==null){
  confDel= confirm("Wirklich löschen?");
 } else {
  confDel= confirm(msg);
 }
 if (confDel== true){
  doSubmit(req);
 }
}

function confirmAction(msg,req){
 if(req==null){req='Delete'}
 var confDel = msg;
 if(confDel ==null){
  confDel= confirm("Wirklich löschen?");
 } else {
  confDel= confirm(msg);
 }
 if (confDel== true){
  doSubmit(req);
 }
}


