var XMLHTTP = null;
var mtext = null;
var ok = "";
var meld1 = "";
document.onkeydown=keyDown;
//------------------------------------------------------------------------------------------------------------------------
function keyDown(e)
{
 e=(!e)?window.event:e;
 k=(e.which)?e.which:e.keyCode;
 if(k==13)
 {
  return false;
 }
}
//------------------------------------------------------------------------------------------------------------------------
function clickSpD()
{
 document.form1.t02sprache.value="D";
 TexteHolen("D") 
}
//------------------------------------------------------------------------------------------------------------------------
function clickSpE()
{
 document.form1.t02sprache.value="E";
 TexteHolen("E")
}
//------------------------------------------------------------------------------------------------------------------------
 function clickSpF()
{
 document.form1.t02sprache.value="F";
 TexteHolen("F")
}
//------------------------------------------------------------------------------------------------------------------------
function Start()
{
 mtext = document.form1.t02meldung.value;
 if (mtext == "%%meldung%%") {document.form1.t02meldung.value = "";};
 if (document.form1.t02sprache.value =="" ) {document.form1.t02sprache.value ="D"};
 if (document.form1.t02sprache.value =="D") {TexteHolen("D")};
 if (document.form1.t02sprache.value =="E") {TexteHolen("E")};
 if (document.form1.t02sprache.value =="F") {TexteHolen("F")};
 if (document.form1.t02r1.value =="") {document.form1.t02r1.value ="1";};
 document.form1.lbt02abtt.selectedIndex = [0];
 document.form1.lbt02abmm.selectedIndex = [0];
 document.form1.lbt02abjj.selectedIndex = [0];
 document.form1.lbt02abtt.selectedIndex = [document.form1.t02abtt.value];
 if (document.form1.t02abmm.value ==  "Jan") {document.form1.lbt02abmm.selectedIndex = [1]};
 if (document.form1.t02abmm.value ==  "Feb") {document.form1.lbt02abmm.selectedIndex = [2]};
 if (document.form1.t02abmm.value ==  "Mar") {document.form1.lbt02abmm.selectedIndex = [3]};
 if (document.form1.t02abmm.value ==  "Apr") {document.form1.lbt02abmm.selectedIndex = [4]};
 if (document.form1.t02abmm.value ==  "May") {document.form1.lbt02abmm.selectedIndex = [5]};
 if (document.form1.t02abmm.value ==  "Jun") {document.form1.lbt02abmm.selectedIndex = [6]};
 if (document.form1.t02abmm.value ==  "Jul") {document.form1.lbt02abmm.selectedIndex = [7]};
 if (document.form1.t02abmm.value ==  "Aug") {document.form1.lbt02abmm.selectedIndex = [8]};
 if (document.form1.t02abmm.value ==  "Sep") {document.form1.lbt02abmm.selectedIndex = [9]};
 if (document.form1.t02abmm.value ==  "Oct") {document.form1.lbt02abmm.selectedIndex = [10]};
 if (document.form1.t02abmm.value ==  "Nov") {document.form1.lbt02abmm.selectedIndex = [11]};
 if (document.form1.t02abmm.value ==  "Dec") {document.form1.lbt02abmm.selectedIndex = [12]};
 if (document.form1.t02abjj.value == "2007") {document.form1.lbt02abjj.selectedIndex = [01]};
 if (document.form1.t02abjj.value == "2008") {document.form1.lbt02abjj.selectedIndex = [02]};
 if (document.form1.t02abjj.value == "2009") {document.form1.lbt02abjj.selectedIndex = [03]};
 if (document.form1.t02abjj.value == "2010") {document.form1.lbt02abjj.selectedIndex = [04]};
}
//------------------------------------------------------------------------------------------------------------------------
function TexteHolen(x)
{
 var param="/tt_bilder/tt-002d.txt";
 if (x=="D") {param="/tt_bilder/tt-002d.txt"};
 if (x=="E") {param="/tt_bilder/tt-002e.txt"};
 if (x=="F") {param="/tt_bilder/tt-002f.txt"};
 XMLHTTP = null;
 if (window.XMLHttpRequest) { XMLHTTP = new XMLHttpRequest(); } else if (window.ActiveXObject) { try { XMLHTTP = new ActiveXObject("Msxml2.XMLHTTP"); } catch (ex) { try { XMLHTTP = new ActiveXObject("Microsoft.XMLHTTP"); } catch (ex) { } } }
 XMLHTTP.open("GET", param, true);
 XMLHTTP.onreadystatechange = TexteAusgeben;
 XMLHTTP.send(" ");
}
//------------------------------------------------------------------------------------------------------------------------
function TexteAusgeben()
{
 if (XMLHTTP.readyState == 4)
 {
  var wa = new MakeArray(23);
  var NewString  = XMLHTTP.responseText;
  var NewString1 = NewString.replace(/&eacute/g, "é");
  var NewString2 = NewString1.replace(/&ecirc/g, "ê");
  var NewString3 = NewString2.replace(/&egrave/g, "è");
  var sd2 = NewString3.replace(/&agrave/g, "à");
  
  wa = sd2.split(";");
  document.getElementById('l001').firstChild.nodeValue = wa[0];
  document.getElementById('l002').firstChild.nodeValue = wa[1];
  document.getElementById('l004').firstChild.nodeValue = wa[5];
  document.getElementById('l005').firstChild.nodeValue = wa[6];
  document.getElementById('l006').firstChild.nodeValue = wa[7];
  document.getElementById('l007').firstChild.nodeValue = wa[8];
  document.getElementById('l008').firstChild.nodeValue = wa[9];
  document.getElementById('l009').firstChild.nodeValue = wa[10];
  document.getElementById('l010').firstChild.nodeValue = wa[11];
  document.getElementById('l011').firstChild.nodeValue = wa[12];
  document.getElementById('l012').firstChild.nodeValue = wa[13];
  document.getElementById('l013').firstChild.nodeValue = wa[14];
  document.getElementById('l014').firstChild.nodeValue = wa[15];
  document.getElementById('l015').firstChild.nodeValue = wa[16];
  document.getElementById('l016').firstChild.nodeValue = wa[19];
  document.getElementById('l017').firstChild.nodeValue = wa[20];
  document.getElementById('l018').firstChild.nodeValue = wa[21];
  document.getElementById('l019').firstChild.nodeValue = wa[22];
  document.getElementById('l020').firstChild.nodeValue = wa[23];
  document.getElementById('l021').firstChild.nodeValue = wa[25];
  document.form1.b001.value = wa[17];
  meld1 = wa[18];
  if (document.form1.t02astyle.value == "1") {document.getElementById('l004').firstChild.nodeValue = wa[24]};
  document.form1.lbt02r1.options.length = 0;
  document.form1.lbt02r1.options[0] = new Option(wa[2],1);
  document.form1.lbt02r1.options[1] = new Option(wa[3],2);
  document.form1.lbt02r1.options[2] = new Option(wa[4],3);
  document.form1.wza.value = wa[26];  
 }
}
//------------------------------------------------------------------------------------------------------------------------
function MakeArray(n)
{
 for (var i=0; i<n; i++) {
 this[i] = 0;
 }
 this.length = n;
}
//------------------------------------------------------------------------------------------------------------------------
function CheckForm()
{
 document.form1.t02r1.value = "";
 DatumTest();
 if (ok == "1") {document.form1.submit()};
 if (ok == "0") {document.form1.lbt02abtt.focus()};
}
//------------------------------------------------------------------------------------------------------------------------
function DatumTest()
{
 ok = "1";
 var tag = document.form1.t02abtt.value; 
 var mon = document.form1.t02abmm.value; 
 var jah = document.form1.t02abjj.value; 

 if (tag == "00" )  {ok = "0"; alert (meld1); return;};
 if (mon == "NIX")  {ok = "0"; alert (meld1); return;};
 if (jah == "0000") {ok = "0"; alert (meld1); return;};

 if (tag > "")
 {
  if (jah < "2007") {ok = "0"};
  if (mon == "Jan") if (tag > "31") {ok = "0"};
  if (mon == "Feb") if (tag > "29") {ok = "0"};
  if (mon == "Mar") if (tag > "31") {ok = "0"};
  if (mon == "Apr") if (tag > "30") {ok = "0"};
  if (mon == "May") if (tag > "31") {ok = "0"};
  if (mon == "Jun") if (tag > "30") {ok = "0"};
  if (mon == "Jul") if (tag > "31") {ok = "0"};
  if (mon == "Aug") if (tag > "31") {ok = "0"};
  if (mon == "Sep") if (tag > "30") {ok = "0"};
  if (mon == "Oct") if (tag > "31") {ok = "0"};
  if (mon == "Nov") if (tag > "30") {ok = "0"};
  if (mon == "Dec") if (tag > "31") {ok = "0"};
  if (ok == "0") {alert (meld1); return;}
 }
}
//-------------------------------------------------------------------------------------------------------
function LogOut(n)
{
// if (n == "9"){alert("hier brauche ich den link zu der seite zu der zurückgesprungen wird"); window.close()};           // ende
 if (n == "1"){document.form1.t02r1.value = n; document.form1.submit();};  // wechsel zur Auftragserfassung
}
//-------------------------------------------------------------------------------------------------------
function lbr1fuell()
{
 var lfd = document.form1.lbt02r1.selectedIndex;
 document.form1.t02r1.value = document.form1.lbt02r1.options[lfd].value;
}
//------------------------------------------------------------------------------------------------------------------------
function lbttfuell()
{
 var lfd = document.form1.lbt02abtt.selectedIndex;
 document.form1.t02abtt.value = document.form1.lbt02abtt.options[lfd].value;
}
//------------------------------------------------------------------------------------------------------------------------
function lbmmfuell()
{
 var lfd = document.form1.lbt02abmm.selectedIndex;
 document.form1.t02abmm.value = document.form1.lbt02abmm.options[lfd].value;
}
//------------------------------------------------------------------------------------------------------------------------
function lbjjfuell()
{
 var lfd = document.form1.lbt02abjj.selectedIndex;
 document.form1.t02abjj.value = document.form1.lbt02abjj.options[lfd].value;
}
//------------------------------------------------------------------------------------------------------------------------
