function checktext(tOj){
  if(tOj.value.length>2000){
    //tOj.style.backgroundColor='red';
    tOj.style.color='red';
    tOj.value = tOj.value.slice(0,2000);
    //tOj.disabled=true;
  } else {
    //tOj.style.backgroundColor='white';
    tOj.style.color='green';
    //tOj.disabled=false;
  }
  
  document.getElementById("counter").innerHTML = 2000 - tOj.value.length;
}

/** der AJAX-Teil */

//globale Instanz von XMLHttpRequest
var xmlHttp = false;
 
//XMLHttpRequest-Instanz erstellen
//... fr Internet Explorer
try {
    xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
    try {
        xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {
        xmlHttp  = false;
    }
}
//... fr Mozilla, Opera, Safari usw.
if (!xmlHttp  && typeof XMLHttpRequest != 'undefined') {
    xmlHttp = new XMLHttpRequest();
}

function saveOnom()
{

  var errormsg = "";
  var url = "";
  
  var idocat = document.form.idocat.value;
  url += 'idocat=' + escape(idocat);
  
  var uin = document.form.uin.value;
  url += '&uin=' + escape(uin);



  var storyid = document.form.storyid.value;
  url += '&storyid=' + escape(storyid);
  
  var ok = "0";
  if(document.form.ok.checked) ok = "1";
  url += '&ok=' + escape(ok);
  
  var text = document.form.text.value;
  if(text=="") errormsg += "Das Textfeld ist leer.<br>";
  url += '&text=' + escape(text);
  
  
  if(errormsg!=""){
    document.getElementById("msgfeld").innerHTML = "Ein Fehler ist aufgetreten:<br>" + errormsg;
    document.getElementById("msgfeld").style.color='red';
  }else{
    if (xmlHttp) {
      xmlHttp.open('POST', './ajax/oscar.php');
      xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      xmlHttp.send(url);
      xmlHttp.onreadystatechange = function () {
         if (xmlHttp.readyState == 4) {
             response = xmlHttp.responseText.split(/\|/);
             document.getElementById("msgfeld").innerHTML = response[1];
             if(response[0]=="ERROR"){
               document.getElementById("msgfeld").style.color='red'; //funktioniert nicht
             }else if(response[0]=="SUCCESS"){
               document.getElementById("msgfeld").style.color='green'; //funktioniert nicht
             }
         }
      };

    }
  }


}// Ende saveQuote

function deleteonom(idocat,storyid){
  var url = "idocat=" + idocat + "&storyid=" + storyid + "&action=delete";

  if (xmlHttp) {
      xmlHttp.open('POST', './ajax/oscar.php');
      xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      xmlHttp.send(url);
      xmlHttp.onreadystatechange = function () {
         if (xmlHttp.readyState == 4) {
             response = xmlHttp.responseText.split(/\|/);
             document.getElementById("msgfeld").innerHTML = response[1];
             if(response[0]=="ERROR"){
               document.getElementById("msgfeld").style.color='red'; //
             }else if(response[0]=="SUCCESS"){
               document.getElementById("msgfeld").style.color='green'; //
             }
         }
      };

      
    }
}

