var xmlHttp
var dest

function addAWK(name, value, wob)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) { return; }        
var url="/anbkorb.htm";
url=url+"?name="+name+"&value="+value+"&wob="+wob;
dest="WOBInfo";
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 


function setAWK(values, wob)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) { return; }        
var url="/anbkorb.htm";
url=url+"?mode=2&wob="+wob+"&values="+values;
dest="anbcontent";
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 


function toggleTextField(chk, img) {
  if (chk.value == 'J') { chk.value = 'N' } else { chk.value = 'J'};
  if (chk.value == 'J') { img.src = '/images/okbig.gif'; } else { img.src = '/images/okbig_empty.gif'; }
}


function isFieldChecked(chk) {
  if (chk.value == 'J') { return true } else { return false };
}


function setFormValue(aform, wob) {

  var postValue = '';
  for (var i = 0; i < aform.elements.length; i++)
    postValue = postValue + aform.elements[i].name + '=' + aform.elements[i].value + '|';

  while (postValue.indexOf("\n") > 0) {
    postValue = postValue.replace(/\n/, "\\n");
  }  

//  alert(postValue);
//  new ktAjaxSplit('/anbkorb.htm', {postBody: 'mode=2&wob='+wob+'&values='+postValue, updatenames: 'WOBInfo|anbcontent', onComplete: function(transport){ alert('fertig:  '+transport.responseText); } });
  new ktAjaxSplit('/anbkorb.htm', {postBody: 'mode=2&wob='+wob+'&values='+postValue, updatenames: 'WOBInfo|anbcontent' });

}

function setFormValueAndClearVal(afield, aform, wob) {
  aform.elements[afield].value = "0";
  afield.value = 0;
  setFormValue(aform, wob);
}

function stateChanged() { 
if (dest != "") {
if (xmlHttp.readyState==4) { 
   document.getElementById(dest).innerHTML = xmlHttp.responseText; } }
}

function GetXmlHttpObject() {
var xmlHttp=null;
try {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest(); }
  catch (e) {
  // Internet Explorer
  try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } }
return xmlHttp;
}

