<!--
var default_menge = 1;
var protocol = window.location.protocol;
var tmp_bem="Bemerk";
//Schlosser 09.03.2001: bug_no CC_200000333, ie and nc format urls for local websites different,
//nc converts the colon in the drive to the pipe sign -> conflics with the article delimiter in the
//cookie, Solution: use double pipe signs to separate articles in the cookie
var article_delimiter = "||";
var no_dec_places=2;

//#########################################################
//Browsertyp:
var ie = (navigator.appName == "Microsoft Internet Explorer");
if(ie)
{
	var col = 66;
}
else
{
	var col = 47;
}

//################################################
// switches for functions: true=on false=off
var sw_over = true; 	//check and overwrite articels with same order number in the SC, do not change if there are variants
			//otherwise system of variants has to be changed!

// daraus resultiert
var abstand = 0;
if (sw_prs == true) abstand++;
if (sw_vrt == true) abstand++;
abstand = 4+abstand;

//###################################################
var jetzt = new Date();
var TagInWoche = jetzt.getDay();
var Tag = jetzt.getDate();
var Jahr = jetzt.getYear();
if (Jahr < 1000) Jahr+=1900;
var Jahresmonat = jetzt.getMonth();
var Auszeit = new Date(jetzt.getTime() + 1000*60*60*24*365*10); //ten years
var kunde_Verfall = Auszeit.toGMTString();
var sc_expiry_time = new Date(jetzt.getTime() + 1000*60*60*24*10*1); // ten days
var sc_expiry = sc_expiry_time.toGMTString();
var eachVariant = new Array();

/****************************************
@Name: unescapeString
******************************************/
function unescapeString(stringparam)
{
	var inputString = new String(stringparam);
	var resultString = new String("");
	var inputlen=inputString.length;
	var radix=10;
	var i;

	for (i=0; i<inputlen; i++)
	{
		myChar=inputString.charAt(i);
		if (myChar == '&')
		{
			myChar=inputString.charAt(++i);
			if (myChar == '#')
			{

				if (inputString.charAt(i+1) == 'x')
				{
					i++;
					radix = 16;
				}
				else
				{
					radix = 10;
				}

				startPos=i;
				myCharCode=0;
				while (i++ < inputlen && (myChar=inputString.charAt(i)) != ';')
				{
					myCharCode *= radix;
					myCharCode += parseInt(myChar, radix);
				}
				resultString+=String.fromCharCode(myCharCode);
			}
			else
			{
				resultString+='&';
				resultString+=myChar;
			}
		}
		else
			resultString+=myChar;
	}

	return resultString;
}

/****************************************
@Name: myAlert
******************************************/
function myAlert(stringparam)
{
	alert(unescapeString(stringparam));
}

/****************************************
@Name: doNothing
******************************************/
function doNothing () {}

/****************************************
@Name: loadNav
******************************************/
function loadNav(navfile)
{
	var navigation = parent.nav;
	if (navigation == null)
		navigation = parent.parent.nav;
	if (navigation != null && navigation.location.href.indexOf(navfile) == -1)
		navigation.location.href = navfile;
	return;
}

/****************************************
@Name: goToPP
******************************************/
function goToPP(branch)
{
	var myurl=str_pp_base_url+"%26elementID="+branch;
	open(unescape(myurl));
}

/****************************************
@Name: goToPPF
******************************************/
function goToPPF(file)
{
	location.href=file;
}

/****************************************
@Name: add2cart
******************************************/
function add2cart(number)
{
	add2cart2(PartOrderInfo[number]);
}

/****************************************
@Name: add2cart2
******************************************/
function add2cart2(orderstring)
{
	Warenkorb(orderstring);
	return;
}


/*****************************************
@Name:  Warenkorb
@Datum:     01.05.1999
@Version:   01
*****************************************/
function Warenkorb(myArt,shopDir)
{

	//Normal CAD
	var undefined;
	if(shopDir == undefined){shopDir ="";}


	var aktArt = myArt.split("**");
	var myAnz="";
	if (aktArt[2] == "$$")
	{
		aktArt[2] = "";
	}
	if (aktArt[4] == "$$")
	{
		aktArt[4] = "";
	}
	var myBst = aktArt[0];
	var myWK  = LeseCookie("Produkt").split(article_delimiter); //"Produkt" wird uebergeben um den richtigen Cookienamen bilden zu koennen
	var myInd = getBstnrIndex(myWK, myBst); //Index des Artikel, falls dieser im WK, sonst -1
	//Test, ob es eine Bestellnummer gibt
	if (myBst.length > 0)
	{
		// auslesen der vorhanden Anzahl des Artikels im WK
		if (myInd != "-1" && (aktArt[6] == "" || sw_vrt == false) && sw_over == true)
		{
			myAnz = myWK[myInd].split("@@")[1];
		}
		// Default-Anzahl festlegen
		else
		{
			var myStf = aktArt[3].split("$$");
			if (myStf[0] != '')
			{
				myAnz = "" + myStf[0];
			}
			else
			{
				myAnz = default_menge;
				aktArt[3] = default_menge+"$$";
			}
		}
		myArt = aktArt.join("**");

		var akt = myArt +"@@" +myAnz;
		SetzeCookie("aktArtikel", akt);
		SetzeCookie("Index", "");


		//CAD und Normal
		if (shopDir == ""){
		   if (location.href.indexOf("/servlet/") > -1 && ie)
			location.href="../shop/edit.htm";
		    else
		       location.href="shop/edit.htm";

		}else{
		   if (location.href.indexOf("/servlet/") > -1 && ie)
		      location.href="../../" + shopDir + "/shop/edit.htm";
		   else
		      location.href="../../" + shopDir + "/shop/edit.htm";
		}
	}
	else
	{
		myAlert(str_keine_angaben);
	}
}

/*****************************************
@Name:   EditItem
@Datum:     01.05.1999
@Version: 01
*****************************************/
function EditItem()
{
  var myDatensatz = LeseCookie("aktArtikel");
  var myArtikel = myDatensatz.split("@@")[0];
  var myAnzahl  = myDatensatz.split("@@")[1];
  var myBestellNr = myArtikel.split("**")[0];
  var myBez     = unescape(myArtikel.split("**")[1]);
  var myCurSet	= myArtikel.split("**")[4];
  var myPunSet	= myArtikel.split("**")[5];
  var myVrtSet  = myArtikel.split("**")[6];



/********* Anpassung Holmer *************/

	var myFln = myArtikel.split("**")[6];

	if(myFln == "")
		var myFln = myArtikel.split("**")[7];

/********** ENDE Anpassung Homer***********/


  
	var wthprs = myArtikel.split("**")[10];
	var noprs = myArtikel.split("**")[9];
	var myBen = wthprs;
	if (noprs != "" ){
		var wthprs = noprs;
		var myBen = noprs;
}

	/* Anpassung Holmer */
	/*var myBen = myArtikel.split("**")[10];*/

	/*if (myPrsSet == "undefined"){*/
	/*	var myBen = myArtikel.split("**")[9];*/
	
	/*}*/
	
	/* Anpassung Ende */


  // split single variants
  if(myVrtSet.length > 1) // in case of variants
    {
      	var myvariants = myVrtSet.split("##");
      	for (i=0; i<myvariants.length; i++)
      		eachVariant[i] = myvariants[i].split("$$");
     }
  var myPrsSet   = myArtikel.split("**")[2];
  var myPrs      = myPrsSet.split("$$");
  var myStfSet   = myArtikel.split("**")[3];
  var myStf      = myStfSet.split("$$");

  var myCur   = myCurSet.split("$$");
  var myPun   = myPunSet.split("$$");

  var inWK = LeseCookie("Index");

  var myWK = LeseCookie("SC").split(article_delimiter);
   //***************************  begin of html-code ******************************************
	document.write("<table width='550' border='0' align='center'><tr><td class='orderpageheader'>" + str_add);
	document.write("</td></tr><tr><td height='5'>&nbsp;</td></tr></table>");

	document.write('<TABLE width="550" align="center">');

	// Textstring festlegen
	document.write('<TR><TD class="text">' + str_artikel + '&nbsp;&nbsp; ' + myBez + '</TD></TR>');
	document.write('<TR><TD class="text">' + str_bst + '&nbsp;' + myBestellNr + '</TD></TR>');
	
	/******ANPASSUNG HOMER****/
	document.write('<TR><TD class="text">Benennung: &nbsp;' + myBen + '</TD></TR>');
	/******ENDE ANPASSUNG HOLMER***/
	if ((myVrtSet == "" || inWK != "") && !(getBstnrIndex(myWK, myBestellNr) == -1 || sw_over == false))
		document.write('<TR><TD class="text" id="in_cart">' + str_gelegt + '</TD></TR>');
	else
		document.write('<TR><TD class="text" id="in_cart">' + str_legen + '</TD></TR>');
	document.write('</table><br>');

	document.write('<TABLE width="550" align="center">');
	document.write('<TR><TD class="text">' + str_anz + '&nbsp;<INPUT TYPE="TEXT" NAME="Anzahl" Value="');
	document.write(myAnzahl + '" SIZE="5"></TD></TR></TABLE><br>');

	//Abfrage ob Preise fuer den Artikel existieren
	if ((sw_prs == true) && (myPrsSet != ""))
	{
		var len = myPrs.length-1;
		document.write('<TABLE width="550" align="center"><TR><TD class="text" valign="top" rowspan="' + len + '">' + str_stuf + ': </TD>');
		for(i=0; i < len; i++)
		{
			if (i > 0)
				document.write('<TR>');
			if (myStf[i] == '')
				myStf[i]= 1;
			if (myPun[i] == '')
				myPun[i]= str_unit;
			document.write('<TD class="text" align="right">' + myStf[i] +  ' ' + myPun[i] + '</TD>');
			document.write('<TD class="text" align="right">' + myPrs[i] +'</TD><TD class="text" align="left" width="150">' + myCur[i] + '</TD></TR>');
		}
		document.write('</TABLE><br>');
	}
	else
	{
		document.write('<TABLE width="550" align="center"><TR><TD class="text">' + str_noprice + '</TD></TR></TABLE><br>');
	}

	//Abfrage ob Extras fuer den Artikel existieren
	var myExt = myArtikel.split("**")[8];
 	var myZub = myExt.split(";");
	if ((sw_ext == true) && (myExt != ""))
	{
		var anzZub = myZub.length-1;
		document.write('<table width="550" align="center"><TR><TD class="text">' + str_zub);
		document.write('&nbsp;<select name="Extra"><option>' + str_nozub);
		for (i=0 ; i < anzZub; i++)
		{
			if (myZub[anzZub] == i && myZub[anzZub] != "")
				document.write('<option selected>' + myZub[i].split("##")[0] );
			else
				document.write('<OPTION>' + myZub[i].split("##")[0] );
		}
		document.write('</select></tr></TABLE>');

		document.write('<table width="550" align="center"><tr>');
		// DR: store packaging unit and currency in extra variables
		var packaging_unit = myPun[0];
		var currency = myCur[0];
		for(i=0; i < anzZub; i++)
		{
			myaktZub = myZub[i].split("##");
			myZuPrs = myaktZub[1].split("$$");
			myZuStf = myaktZub[2].split("$$");
			if (myZuPrs[0] != "")
			{
				var anzahl_preise = myZuStf.length-1;  //letztes Feld ist immer leer!
				document.write('<td rowspan="' + anzahl_preise + '" class="text" valign="top">&nbsp;' + myZub[i].split("##")[0] + ': </td><td width="10">&nbsp;</td>');
				if (anzahl_preise == 1)
					document.write('<TD align="right" class="text">' + (myZuStf[1]) + packaging_unit + '</TD>');
				else
					document.write('<TD align="right" class="text">' + str_bis + '&nbsp;' + (myZuStf[1]-1) + '&nbsp;' + packaging_unit + '</TD>');
				document.write('<TD align="right" class="text">' + myZuPrs[0] +'</TD><TD class="text" align="left"> ' + currency + '</TD><td width="30">&nbsp;</td></TR>');
				for (j=1; j<myZuStf.length-1; j++)
				{
					if (j > 1)
						document.write('<TR>');
					document.write('<td width="10">&nbsp;</td><TD align="right" class="text">' + str_ab + '&nbsp;' + myZuStf[j] + '&nbsp;' + packaging_unit + '</TD>');
					document.write('<TD align="right" class="text">' + myZuPrs[j] + '</TD><TD class="text"> ' + currency + '</TD><td width="30">&nbsp;</td></TR>');
				}
			}
			else
			{
				document.write('<TR><td valign="top" class="text">&nbsp;' + myZub[i].split("##")[0] + ': </td><td width="10">&nbsp;</td>');
				document.write('<TD colspan="3" valign="top" class="text">' + str_noprice + '</TD><td width="30">&nbsp;</td></TR>');
			}
		}
		document.write('</table><br>');
	}

	//Abfrage ob Varianten fuer Artikel existieren
	if ((sw_vrt == true)&&(myVrtSet != ""))
	{
      		document.write('<TABLE width="550" ALIGN="CENTER">');
      		document.write('<TR><TD class="text">' + str_opt + '</TD></TR>');
      		for (i=0; i < myvariants.length; i++)
      		{
			if (eachVariant[i].length > 1 || sw_over == false) // wenn Variante noch nicht passend fuer den WK gekuerzt ist
			{
      				document.write('<TR><TD class="text">' + eachVariant [i][0] + '&nbsp;&nbsp;');
      				document.write('<select name="' + eachVariant [i][0] + '" size="1" width="100">');
      				document.write('<option selected value="nochoice">' + str_noopt + '</option>');
      				for (j=1; j < eachVariant[i].length; j++)
      					document.write('<option value="' + eachVariant [i][j] + '">' + eachVariant [i][j]+'</option>');
      				document.write('</select>');
      				document.write('</TD></TR>');
      			}
			else
				document.write('<TR><TD class="text">' + eachVariant [i][0] + '</TD></TR>');
		}
       		document.write('</TABLE><br>');
    	}

	// Button
	document.write('<div align="center">');
	document.write('<input class="button" type=submit name="order" value="' + str_ok + '">&nbsp;&nbsp;&nbsp;');
	/*if( window.name == 'searchoutput' )  // jumped to sc from PAS*/
		document.write('<input class="button" type=button name="back" value="' + str_back + '" onClick="javascript:window.history.back()">');  // if from PAS history back
	/*else*/
	/*	document.write('<input class="button" type=button name="back" value="' + str_back + '" onClick="location.href=\'' + myFln + '\'">');*/
	document.write('</div>');
}


/*****************************************
@Name: setArtikelAnzahl
@Datum:   01.05.1999
@Version: 01
*****************************************/
function setArtikelAnzahl()
{
	var Anzahl = document.Bestellung.Anzahl.value;
	//akt Artikel lesen
	var myDatensatz = LeseCookie("aktArtikel");

	var myArtikel = myDatensatz.split("@@")[0];




	var myItem = myArtikel.split("**");
	var myBst = myArtikel.split("**")[0];
	var myVrt = myArtikel.split("**")[6];
	var variants = myVrt.split("##");
	var myExt = myArtikel.split("**")[8];
	var myZub = myExt.split(";");
	var myStf  = myArtikel.split("**")[3];


/********* Anpassung Holmer *************/

	var myFln = myArtikel.split("**")[6];
	var Ben = myArtikel.split("**")[10];

	if(myFln == "")
		var myFln = myArtikel.split("**")[7];

/********** ENDE Anpassung Homer***********/

	//Warenkorb lesen
	var myWarenkorb = LeseCookie("SC");
	var myWK = myWarenkorb.split(article_delimiter);
	var myInd = getBstnrIndex(myWK, myBst);

	//Index des Artikel, der aus Warenkorb heraus editiert wird
	var inWK = ""+LeseCookie("Index");
	//zaehlervariable fuer anzahl der felder, noetig fuer variantenabfrage
	var numoffields = 1;

	//auf korrekte Bestellmenge ueberpruefen
	if(isNum(Anzahl,myStf))
	{
		Anzahl = parseFloat(Anzahl);
		//wenn Extras existieren
		if (sw_ext == true && myZub != "")
		{
			anzZub = myZub.length-1;
			if (document.Bestellung.Extra.selectedIndex == 0)
				myZub[anzZub] = "";
			else
				myZub[anzZub]= document.Bestellung.Extra.selectedIndex-1;
			myItem[8] = myZub.join(";");
			myArtikel = myItem.join("**");
			numoffields += 1;
		}

		// wenn Varianten existieren
		if (sw_vrt == true && myVrt.length > 1)
  		{

			var selected_variant;
			message = '';
			var selVrt = '';
			for (i=0; i < variants.length; i++)
			{
				if (document.forms[0].elements[numoffields+i] && document.forms[0].elements[numoffields+i].options)
				{
					selected_variant = document.forms[0].elements[numoffields+i].options[document.forms[0].elements[numoffields+i].selectedIndex].text;
					selVrt += eachVariant [i][0] + ': ' + selected_variant + '##';
				}
                        	else
				{
					selected_variant = eachVariant [i][0];
					selVrt += selected_variant + '##';
				}
				if (selected_variant == str_noopt)
					message += str_no_variant + ' ' + eachVariant [i][0] + '\n';
			}

    			if (message != '')
    			{
    				myAlert(message);
    				return;
			}
    			selVrt = selVrt.substr(0,selVrt.length-2);  // last two characters ('##') are cut
   	 		myItem[6] = selVrt;
			myArtikel = myItem.join("**");
  		}
		else
		{
			//wenn Artikelnr. schon im WK UND Ueberschreiben aktiviert, Index der Artikelnr. an inWK uebergeben
			if (myInd != -1 && sw_over == true)
				inWK = myInd;
		}

		//wenn Artikel schon im WK
		if (inWK != "")
		{
			//Artikel in der WK-Kette ersetzen
			myWK[inWK] = myArtikel+"@@"+Anzahl;
			myCookieNeu = myWK.join(article_delimiter);
		}
		else
		{
			if (myWarenkorb.length == 0)
				myCookieNeu = myArtikel + "@@" + Anzahl;
			else
				myCookieNeu = myWarenkorb + article_delimiter + myArtikel + "@@" + Anzahl;
		}

		SetzeCookie("SC", myCookieNeu);
		if( window.name == 'searchoutput' )  // check if from PAS
			window.history.back();  // if from PAS history back
		else
			location.href = myFln;
	}
	//keine korrekte Bestellmenge
	else
	{
		document.Bestellung.elements[0].focus();
		document.Bestellung.elements[0].select();
		myAlert(str_ZahlFormat);
	}
}


/*****************************************
@ Name:   isNum()
@Datum:   26.05.1999
@Version:    01
*****************************************/
function isNum(_wert,_stf)
{
	var dif="";
	var stf = _stf.split("$$");
	var stf_length = stf.length-2;
	var tmp=_wert;				//temporaere Menge
	parseInt(_wert);

	for(z=0; z<_wert.length; z++)
	{
		teilString = _wert.substring(z, z+1);

		if((teilString < "0" || teilString > "9") && teilString != ".")
		{
			return false;
		}
	}
	if (sw_prs_art == true)	// selling units
	{
		var anz_org=_wert;			//original anz
		var tmp_i=stf_length+1;
		var tmp_org=stf_length+1;

		for(i=stf_length; i>=0; i--)
		{
			var ganzzahl = new Array();
			dif=_wert-parseInt(stf[i]);	//Differenz zw. Bestellmenge und VE (mit der groessten beginnend)
			if (dif==0) 			//Differenz gleich Null Bestellmenge ok
				return(true);
			if (dif<0 && i==0)
			{
				if(tmp_i==tmp_org)
				{
					tmp_i--;
					tmp_org--;
				}
				_wert=anz_org;
				i=tmp_i;
			}
			if (dif>0)
			{
				_wert=dif;	//Bestellwert gleich Differenz

				for(g=i-1; g>=0; g--)
				{

					if (_wert>=stf[g])
					{
						var tmp2=0;

						ganzzahl_einf=String(dif/stf[g]);
						if (ganzzahl_einf.indexOf(".")==-1)
						{
							anz_org=_wert;
							tmp_i=g+1;
							g=0;
						}
						else
						{
							for(gz=g; gz>0; gz--)
							{
								tmp2 = dif-stf[gz];
								ganzzahl[gz]=String(tmp2/stf[gz-1])
								if (ganzzahl[gz].indexOf(".")==-1)
								{
									anz_org=_wert;
									tmp_i=g+1;
									gz=0;
									g=0;
								}
							}
						}
					}
				}
				i++;	//i wird eins hochgezaehlt, damit man mit der gleichen VE weiterrechnen kann
			}

		}
		return(false);
	}
	else {	// no selling units but gradated prices
		if (Number(_wert) < Number(stf[0]))
			return(false);
		else
			return (true);
	}
	return (true);
}


/*****************************************
@Name: Edit2
@Datum:   01.05.1999
@Version: 01
*****************************************/
function Edit2(ind)
{
	var myWarenkorb = LeseCookie("SC").split(article_delimiter);
	SetzeCookie("Index", ind);
	SetzeCookie("aktArtikel", myWarenkorb[ind]);
	location.href="edit.htm";
}


/*****************************************
@ Name:   getBstnrIndex
@Datum:   01.05.1999
@Version:    01
*****************************************/
function getBstnrIndex(warenkorb, myBstnr)
{
	//Array in dem die Indize der Artikel mit der gesuchten Bestellnummer gespeichert werden
	var index = new Array();
	var z=0;
	if (warenkorb != "")
	{
		for (l = 0; l < warenkorb.length; l++)
		{
			//Bestellnummer der Artikel im Warenkorb
			tmpBstnr = warenkorb[l].split("**")[0];
			if(tmpBstnr == myBstnr)
			{
				index[z] = l;
				z++;
			}
		}
	}
	if (z == 0)  return -1;
	else return(index);
}


/*****************************************
@ Name:   SetzeCookie
@Datum:   01.05.1999
@Version:    01
*****************************************/
function SetzeCookie(myname, myCart)
{
	var url=document.URL;
	var mycookiename = getCookiename(url,3);
	myCart = escape(myCart);
	// Kundendaten
	if(myname == "Kunde")
	{
		var myDate = new Date(kunde_Verfall);
		myDate = myDate.toGMTString();
		if(ie)
			document.cookie = myname + "=" + myCart + "; expires = " + kunde_Verfall;
		else
			document.cookie = myname + "=" + myCart + "; expires=" + myDate+"; ";
	}
	// Produktdaten
	if (myname == "SC")
	{
		var myDate = new Date(sc_expiry);
		myDate = myDate.toGMTString();
		if(ie)
			document.cookie = mycookiename + "=" + myCart + "; expires = " + sc_expiry;
		else
			document.cookie = mycookiename + "=" + myCart + "; expires=" + myDate+"; ";
	}

	if (myname == "Kunde")     parent.parent.parent.menu.document.hidden.myCst.value = myCart;
	if (myname == "SC")    	   parent.parent.parent.menu.document.hidden.myWK.value = myCart;
	if (myname == "Index")     parent.parent.parent.menu.document.hidden.myID.value = myCart;
	if (myname == "aktArtikel")   parent.parent.parent.menu.document.hidden.myAdd.value = myCart;
	if (myname == "WK_Zustand")   parent.parent.parent.menu.document.hidden.aktuell.value = myCart;
	if (myname == "Bemerk")    parent.parent.parent.menu.document.hidden.myInhalt.value = myCart;
}


/*****************************************
@ Name:  LeseCookie
@Datum:     22.12.1999
@Version:   00
*****************************************/
function LeseCookie(cName)
{
	var url=document.URL;
	if(cName=="SC")
	{
		var mycookiename = getCookiename(url,3);
	}
	if(cName=="Produkt")
	{
		cName="SC";
		var mycookiename = getCookiename(url,2);
	}
	if(cName=="Kunde")
	{	mycookiename=cName;	}

	if(document.cookie && (cName=="SC" || cName=="Kunde") && document.cookie.length < 4096)
	{
		var inhalt = document.cookie.split("; ");
		var tmp = inhalt.length;
		for(var i=0; i<tmp; i++)
		{
			var nextValue = inhalt[i].split("=");
			if(nextValue[0] == mycookiename && nextValue.length == 2)
			{
				return unescape(nextValue[1].replace(/##/g, ";"));
			}
		}
		return "";
	}
	else
	{
		if (cName == "SC")  return unescape(parent.parent.parent.menu.document.hidden.myWK.value);
		if (cName == "Index")  return unescape(parent.parent.parent.menu.document.hidden.myID.value);
		if (cName == "aktArtikel")  return unescape(parent.parent.parent.menu.document.hidden.myAdd.value);
		if (cName == "Kunde")  return unescape(parent.parent.parent.menu.document.hidden.myCst.value);
		if (cName == "WK_Zustand")  return unescape(parent.parent.parent.menu.document.hidden.aktuell.value);
		if (cName == "Bemerk")  return unescape(parent.parent.parent.menu.document.hidden.myInhalt.value);
	}
}


/*****************************************
@ Name:   WarenkorbLoeschen
@Datum:   01.05.1999
@Version:    01
*****************************************/
function WarenkorbLoeschen()
{
	if(LeseCookie("WK_Zustand") == "WARENKORB_LEER")
		myAlert(str_warenkorb_leer );
	else
	{
		Check = confirm(unescapeString(str_frage));
		if(Check == true)
		{
			SetzeCookie("SC","");
			SetzeCookie("Bemerk", "");
			SetzeCookie("WK_Zustand", "WARENKORB_LEER");
			parent.cont.location.href="sc_r.htm";
		}
	}
}


/*****************************************
@ Name:  LeseISC
@Datum:     07.01.2000
@Version:   00
*****************************************/

function LeseISC(WK)
{
	var myArtikel = new Array();
	var Artikel = WK.split("@@")[0];
	myArtikel[6] = ""+WK.split("@@")[1];
	myArtikel[0] = ""+Artikel.split("**")[0];
	myArtikel[1] = ""+Artikel.split("**")[1];
	myArtikel[7] = ""+Artikel.split("**")[7];
	myArtikel[4] = ""+Artikel.split("**")[4];
	myArtikel[9] = ""+Artikel.split("**")[9];	

	//CAD Normal
	//Rücksprung auf ModellView vom Warenkorb aus
	myArtikel[10] = ""+Artikel.split("**")[10];

	if (myArtikel[9] != "" ){
		myArtikel[10] = myArtikel[9];
	myArtikel[7] = ""+Artikel.split("**")[6];
}
	//Extra
	if (sw_ext == true)
	{

		var extra = Artikel.split("**")[8];
		var myZub = extra.split(";");
		var anzZub = myZub.length-1;
		var sel = myZub[anzZub];
		


		if (sel != "")
		{
			var aktZub = myZub[sel];
			var prsZub = ZubPreis(myArtikel[6], aktZub.split("##")[1], aktZub.split("##")[2]);
			myArtikel[8] = aktZub.split("##")[0] + "$$" + prsZub;
		}
		else {  myArtikel[8] = ""; }
	}
	else
	{
		myArtikel[8] = "";
	}
	if (sw_vrt == true)
	{
		myArtikel[2] = ""+Artikel.split("**")[6];
	}
	else
	{
		myArtikel[2] = "";
	}

	if (sw_prs == true)
	{
		prs = Artikel.split("**")[2];
		stf = Artikel.split("**")[3];


		// work-around when article prices are displayed in two different currencies like German Marks and Euro
		var curArr = myArtikel[4].split("$$");
		var prsArr = prs.split("$$");
		var stfArr = stf.split("$$");
		if (curArr.length >= 2 && curArr[0] != curArr[1] && (curArr[0] == "EUR" || curArr[1] == "EUR") && curArr[1] != "")
		{
			var cur_neu = new Array();
			var prs_neu = new Array();
			var stf_neu = new Array();
			var j=0;
			for (i=0; i<curArr.length; i++)
			{
				if (curArr[i] != "EUR")
				{
					cur_neu[j] = curArr[i];
					prs_neu[j] = prsArr[i];
					stf_neu[j] = stfArr[i];
					j++;
				}
			}
			prs = prs_neu[0];
			for (i=1; i<prs_neu.length; i++)
			{
				prs = prs + "$$" + prs_neu[i];
			}
			stf = stf_neu[0];
			for (i=1; i<stf_neu.length; i++)
			{
				stf = stf + "$$" + stf_neu[i];
			}
		}
		// Ende
		myArtikel[3] = "" + Preis_best(myArtikel[6], prs, stf);
	}
	else
	{
		myArtikel[3] = "";
	}

	return(myArtikel)
}

/*****************************************
@ Name:   ZubPreis
@Datum:   13.12.1999
@Version:    01
*****************************************/
function ZubPreis(anz, Prs, stufen)
{
	var preis=Prs.split("$$");
	var stufe=stufen.split("$$");
	if (Prs == "$$")
		return("");
	for (j=(stufe.length-1); j >=0; j--)
	{
		stf = parseInt(stufe[j]);
		if (stf<=anz)
		{
			var kprs = parseFloat(preis[j]);
			return(FormatPreis(kprs * anz));
		}
	}
	return(0);
}

/*****************************************
@ Name:   Preis_best
@Datum:   13.12.1999
@Version:    01
*****************************************/
function Preis_best(anz, Prs, stufen)
// Structure
// s1 : p1 (ab s1 Einheiten, kostet p1 PRO EINHEIT!)
// s2 : p2 (ab s2 Einheiten, kostet p2 PRO EINHEIT!)
{
	var preis=Prs.split("$$");
	var stufe=stufen.split("$$");
	var stf_length=stufe.length-2;//there is one more element in array because of $$ at the end
	var kprs=0;		//total sum

	if (preis[0] == "") return(0);

	// determine number of decimal places
	var x = preis[0].split(".");
	if (x.length > 1)
		no_dec_places = x[1].length;
	else
		no_dec_places = 0;

	// just 1 Stufe is given
	if (stufe.length == 2)
	{
		kprs = preis[0];  // the only price
		kprs = parseFloat(kprs);
		if (sw_prs_art == false)
			return(FormatPreis(kprs*anz));		//Price multiplied by quantity
		else
			return(FormatPreis(anz/stufe[0]*kprs));	//Quantity divided by VE multiplied by price for VE
	}

	// more than 1 Stufe are given
	// price per piece
	if (sw_prs_art == false)
	{
		stf = parseInt(stufe[(stf_length)]);
		if (anz >= stf) //* if zahl greater than all stufen */
		{
			kprs = preis[(stf_length)];  // the price of 1 Stufe lower
			kprs = parseFloat(kprs);
			return(FormatPreis(kprs*anz));
		}
		for (j=0; j < (stf_length+1); j++)
		{
			stf = parseInt(stufe[j]);
			if (stf > anz) //the first time Stufe is greater than Anzahl
			{
				kprs = preis[j-1];  // the price of 1 Stufe lower
				kprs = parseFloat(kprs);
				return(FormatPreis(kprs*anz));
			}
		}
	}
	//price per packing unit
	else
	{
		var anz_org=anz;		//original quantity
		var tmp_i=stf_length+1;		//temporary i (length of stufe-array+1)
		var tmp_org=stf_length+1;	//temporary original i (length of stufe-array+1)
		var tmp_prs=0;			//temporary total sum
		// for-loop starting with the highest stufe
		for(i=stf_length; i>=0; i--)
		{
			var ganzzahl = new Array();
			dif=anz-parseInt(stufe[i]);	//difference between quantity and packing unit of this stufe
			if (dif==0)
				return(FormatPreis(kprs+parseFloat(preis[i])));
			if (dif<0 && i==0)
			{
				if(tmp_i==tmp_org)
				{
					tmp_i--;
					tmp_org--;
				}
				anz=anz_org;
				kprs=tmp_prs;
				i=tmp_i;
			}
			if (dif>0)
			{
				kprs += parseFloat(preis[i]);
				anz=dif;	//Bestellwert gleich Differenz

				for(g=i-1; g>=0; g--)
				{
					if (anz>=stufe[g])
					{
						var tmp2=0;
						ganzzahl_einf=String(anz/stufe[g]);
						//if this
						if (ganzzahl_einf.indexOf(".")==-1)
						{
							anz_org=anz;
							tmp_prs=kprs;
							tmp_i=g+1;
							g=0;
						}
						else
						{
							for(gz=g; gz>0; gz--)
							{
								tmp2 = anz-stufe[gz];
								ganzzahl[gz]=String(tmp2/stufe[gz-1])
								if (ganzzahl[gz].indexOf(".")==-1)
								{
									anz_org=anz;
									tmp_prs=kprs;
									tmp_i=g+1;
									gz=0;
									g=0;
								}
							}
						}
					}
				}
				i++;	//i wird eins hochgezaehlt, damit man mit der gleichen VE weiterrechnen kann
			}

		}
	}
	return(0);
}


/*****************************************
@ Name:   StartWarenkorb
@Datum:   01.05.1999
@Version:    01
*****************************************/
function StartWarenkorb()
{
	var gesprs = 0;
	var myWKall = LeseCookie("SC");
	var myWK = myWKall.split(article_delimiter);
	var url=document.URL;

	Tabkopf("sc");

	//einbinden des Applets
	CallSetAppletValues();


	if(myWK == "")
	{
		WarenkorbLeer();
	}

	else
	{
    var cur="";
		for(l=0; l<myWK.length; l++)
		{
			//Parameter des Artikels auslesen
			myArtikel = LeseISC(myWK[l]);
			//Preis auf Gesamtpreis addieren
			gesprs += parseFloat(myArtikel[3]);
			//Preis fuer Extra auf Gesamtpreis addieren
			if (myArtikel[8] != "" && myArtikel[8].split("$$")[1] != "")
			{
				gesprs += parseFloat(myArtikel[8].split("$$")[1]);
			}
			// set currency only if a currency/price is given
			if (myArtikel[4].split("$$")[0].length > 0)
				cur = myArtikel[4].split("$$")[0];
			//CAD NORMAL
			WerteAusgeben(myArtikel[0], unescape(myArtikel[1]), myArtikel[2], myArtikel[3], myArtikel[6], myArtikel[7], myArtikel[8],l, cur, myArtikel[10]);

		}
		document.write('<INPUT TYPE=HIDDEN NAME="cursym" VALUE="' + cur + '">');

		SetzeCookie("WK_Zustand", "WARENKORB");
		if (sw_prs == true)
		{
			gesprs=FormatPreis(gesprs);
			Gesamtpreis(gesprs, cur);
		}
	}
	TabEnde();
}


/*****************************************
@ Name:   Tabkopf
@Datum:   01.05.1999
@Version:    01
*****************************************/
function Tabkopf(type)
{
	var url=document.URL;
	if (url.indexOf("sc_r.htm") > -1)
	{
		document.write("<table width='550' border='0' align='center'><tr><td class='cartheader'>" + str_inh);
		document.write("</td></tr></table>");
		document.write('<FORM method="POST" action="/sendorder.php" NAME="Korb" onSubmit="return check()">');
		document.write('<div align="center"><TABLE border="0" width="550">');
		document.write('<TR><TD class="text" colspan=' + abstand + '>' + str_minimum);
		document.write('<br><br>' + str_important + '</td></tr></table></DIV><BR>');

		kunde = LeseCookie("Kunde").split("|");
		//if no kunden-cookie found, create a new kunden-array
		if (kunde.length < 2)
			kunde = new Array ("","","","","","","","","","","","","");
		for (i=0; i<kunde.length; i++)
			document.writeln('<input type=hidden name=' + strfields[i] + ' value="' + kunde[i] + '">');
	}
	if (url.indexOf("fax") > -1)
	{
		document.write('<HR width="550">');
		styleclass="faxheader";
		tablestyle="faxtable";
	}
	if (url.indexOf("sc_r.htm") > -1)
	{
		styleclass="header";
		tablestyle="carttable";
	}

	document.write('<div align="center"><TABLE width="550" align="center" class="' + tablestyle + '"><TR>');

	document.write('<TD class="' + styleclass + '">');
	document.write(str_bestellnummer);
	document.write('</TD>');

	document.write('<TD class="' + styleclass + '">');
	document.write(str_produktbezeichnung);
	document.write('</TD>');
	/* Anpassung Holmer */

	document.write('<TD class="' + styleclass + '">');
	document.write(str_benennung);
	document.write('</TD>');
	
	/* Anpassung Ende */
	if(sw_vrt == true)
	{
		document.write('<TD class="' + styleclass + '">');
		document.write(str_vrt);
		document.write('</TD>');
	}
	if(sw_prs == true)
	{
		document.write('<TD class="' + styleclass + '">');
		document.write(str_prs);
		document.write('</TD>');
	}
	document.write('<TD class="' + styleclass + '">');
	document.write(str_anzahl);
	document.write('</TD>');

	if (type == "sc")
	{
		document.write('<TD class="' + styleclass + '">');
		document.write(str_pos);
		document.write('</TD>');
	}

	document.write('</TR>');
}


/*****************************************
@ Name:   WerteAusgeben
@Datum:   01.05.1999
@Version:    01
*****************************************/
function WerteAusgeben(Id, Bez, Vrt, Prs, Anzahl, File, Extra, index, cur, Ben)
{
	var url=document.URL;
	if (url.indexOf("fax.htm") > -1)
	{
		document.write('<HR width="550">');
		styleclass="fax";
	}
	if (url.indexOf("sc_r.htm") > -1)
	{
		styleclass="";
	}
	if (Id != "err999" && Bez != "err999"  && Anzahl != "err999")
	{
		document.write('<TR>');
		document.write('<TD class="' + styleclass + 'ordernumber" nowrap>' + '&nbsp;' + Id);

		if (sw_ext == true && Extra != "")
		{
			document.write('<br>&nbsp;' + str_extra);
		}

		document.write('<INPUT TYPE=HIDDEN NAME="Artikel[' + index + ']" VALUE="' + Id + '"></TD>');

		document.write('<TD class="' + styleclass + 'productname"><a href="' + File + '">' + Bez + '</a>');
		document.write('<INPUT TYPE=HIDDEN NAME="Bezeichnung[' + index + ']" VALUE="' + Bez + '">');

		if (sw_ext == true && Extra != "")
		{
			document.write('<br>' + Extra.split("$$")[0]);
		}

 		/* Anpassung Holmer */
		document.write('</TD>');
		document.write('<TD class="' + styleclass + 'productname">' + Ben + '');
		document.write('<INPUT TYPE=HIDDEN NAME="Benennung[' + index + ']" VALUE="' + Ben + '">');
		/* Anpassung Ende*/
		
		document.write('</TD>');

		if(sw_vrt == true)
		{
			if (Vrt != "")
			{
			var eachVrt = Vrt.split('##');
			document.write('<TD class="' + styleclass + 'variant">');
				if (sw_over == false)
				{
					for(i=0; i < eachVrt.length-1; i++)
						{document.write('<a href="javascript:Edit2(' + index + ')">' + eachVrt[i] + '</a><br />');}
					document.write('<a href="javascript:Edit2(' + index + ')">' + eachVrt[eachVrt.length-1] + '</a>');//last one is written without break
					variant = eachVrt.join(", ");
					document.write('<INPUT TYPE=HIDDEN NAME="' + str_mail_variant + '" VALUE="' + variant.replace(/"/, "&quot;") + '">');
				}
				else
				{
				  for(i=0; i < eachVrt.length-1; i++)
				  {
					document.write(eachVrt[i] + '<br />');
				  }
				  document.write(eachVrt[eachVrt.length-1]);//last one is written without break
				  variant = eachVrt.join(", ");
				  document.write('<INPUT TYPE=HIDDEN NAME="' + str_mail_variant + '" VALUE="' + variant.replace(/"/, "&quot;") + '">');
				}
			document.write('</TD>');
			}
			else
			{
				document.write('<TD class="' + styleclass + 'variant">&nbsp;</TD>');
			}
		}

		if(sw_prs == true)
		{
			if (Prs != 0)
			{
				document.write('<TD class="' + styleclass + 'currency">');
				document.write(cur + '&nbsp;' + Prs + '<INPUT TYPE=HIDDEN NAME="Preis[' + index + ']" VALUE="' + Prs + '">');
				if (sw_ext == true && Extra != "")
				{
					if (Extra.split("$$")[1] == "")
						document.write('<br>' + str_noprice_sc);
					else
					{
						document.write('<br>' + cur + '&nbsp;' + Extra.split("$$")[1]);
						document.write('<INPUT TYPE=HIDDEN NAME="Extra[' + index + ']" VALUE="' + Extra.split("$$")[0] + '">');
						document.write('<INPUT TYPE=HIDDEN NAME="PreisExtra[' + index + ']" VALUE="' + Extra.split("$$")[1] +'">');
					}
				}
				document.write('</TD>');
			}
			else
				document.write('<TD class="' + styleclass + 'currency">' + str_noprice_sc + '</TD>');
		}
		document.write('<TD class="' + styleclass + 'quantity">');
		document.write('<INPUT TYPE=HIDDEN NAME="Anzahl[' + index + ']" SIZE=6 VALUE="' + Anzahl + '">');
		document.write('<a href="javascript:Edit2(' + index + ')">' + Anzahl + '</a>');
		document.write('</TD>');
		document.write('<TD class="' + styleclass + 'checkbox"><INPUT TYPE=CHECKBOX NAME=pos' + index + ' onClick="return DeleteArticle(' + index + ')"></TD>');
		document.write('</TR>');
	}
}

/*****************************************
@ Name:   Gesamtpreis
@Datum:   01.05.1999
@Version:    01
*****************************************/
function Gesamtpreis(gesprs, cur)
{
    myCur = cur.split("$$")[0];

	document.write('<TR><TD COLSPAN=' + (abstand-3) + ' align="right" class="text">');
	document.write(str_gesamtprs + ': </TD>');
	document.write('<TD class="cartsum">' + myCur + '&nbsp;' + gesprs);
	document.write('</TD><TD colspan="2">&nbsp;</TD></TR>');
}

/*****************************************
@ Name:   TabEnde
@Datum:   01.05.1999
@Version:    01
*****************************************/
function TabEnde()
{
	var url=document.URL;
	var bemerk="";
	document.writeln('</TABLE></DIV>' + '<BR>' + '');
	
	document.writeln('<div align="center"><TABLE align="center" width="550" border="0">');
	document.writeln('<tr><td class="textbold" width="100">' + str_hinweis_liefertermin + '</td>');
	document.writeln('<td class="text"><input type=text name="liefertermin" value="' + getdate() + '" size=15 maxlength=10 onBlur="PruefeDatum(document.Korb.liefertermin.value,'+ getyear() +',2400)"></td></tr>');


	document.writeln('<tr><td class="textbold" width="100">' + str_hinweis_versand + '</td>');
	document.writeln('<td><select name="versandart"  value="ver" size="1">');
	document.writeln('<option>' + versand1 + '</option>');
	document.writeln('<option>' + versand2 + '</option>');
	document.writeln('<option>' + versand3 + '</option>');
	document.writeln('<option>' + versand4 + '</option>');
	document.writeln('<option>' + versand5 + '</option>');
	document.writeln('<option>' + versand6 + '</option>');
	document.writeln('<option>' + versand7 + '</option>');
	document.writeln('<option>' + versand8 + '</option>');
	document.writeln('<option>' + versand9 + '</option>');
	document.writeln('<option>' + versand10 + '</option>');
	document.writeln('<option>' + versand11 + '</option>');
	document.writeln('<option>' + versand12 + '</option>');
	document.writeln('</select>');
	document.writeln('</td></tr></table></Div>');

	
	document.writeln('<div align="center"><TABLE align="center" width="550" border="0">');
	bemerk = LeseCookie("Bemerk");

	if (url.indexOf("sc_r.htm") > -1)
	{
		document.writeln('<tr><td class="text" colspan=2>' + str_bemerk + '</td></tr>');

		document.writeln('<input type=hidden name="remark_text" value="' + str_mail_bemerk + '">');
		document.writeln('<tr><td class="text" colspan=2><TEXTAREA NAME="remark" COLS=' + col + ' ROWS=5 onChange="javascript:SetzeCookie(');
		document.writeln('tmp_bem,this.value)">' + bemerk + '</textarea></td></tr>');
		document.writeln('<tr><td class="textbold" colspan=2>&nbsp;</td></tr>');
		document.writeln('<tr><td class="textbold" colspan=2><br>' + str_hinweis_auftrag + '</td></tr>');
		document.writeln('<tr><td class="text" colspan=2>' + str_hinweis_auftrag_text + '</td></tr>');
		document.writeln('<tr><td class="text" colspan=2>&nbsp;</td></tr>');
		document.writeln('<tr><td class="text" colspan="2"><input type="checkbox" name="AGB_GTB" value="AGBs wurden akzeptiert">' + agb_accept + '</td></tr>');  		
		//document.writeln('<tr><td class="viewagb" colspan="2"><a href="javascript:window.open(\'' + agb_url  + '\',\'newWindow\',\'width=800, height=600 scrollbars=yes\')">' + agb_view + '</a></td></tr>');  	
		//document.writeln('<tr><td class="viewagb" colspan="2" onClick="window.open(\'' + agb_url  + '\',\'newWindow\',\'width=800, height=600 scrollbars=yes\')">' + agb_view + '</td></tr>');  	

		document.writeln('<tr><td class="text" colspan=2>&nbsp;</td></tr>');
		document.writeln('<tr><td  align="left" width=50%><input class="button" type=submit name="inquiry" value="' + str_anfr_button + '"></td>');
		document.writeln('<td align="right"><input class="button" type=submit name="order" value="' + str_best_button + '"></td></tr>' + '');
		
		document.writeln('<input type=hidden name="price1" value="' + str_mail_price + '">');
		document.writeln('<input type=hidden name="price2" value="' + str_mail_extraprice + '">');
		document.writeln('<input type=hidden name="order_txt" value="' + str_order + '">');
		document.writeln('<input type=hidden name="inquiry_txt" value="' + str_inquiry + '">');
		document.writeln('<input type=hidden name="other_txt" value="' + str_other + '">');

		document.writeln('<input type=hidden name="str_company" value="' + str_mail_company + '">');
		document.writeln('<input type=hidden name="str_division" value="' + str_mail_division + '">');
		document.writeln('<input type=hidden name="str_title" value="' + str_mail_title + '">');
		document.writeln('<input type=hidden name="str_customername" value="' + str_mail_customername + '">');
		document.writeln('<input type=hidden name="str_position" value="' + str_mail_position + '">');
		document.writeln('<input type=hidden name="str_email" value="' + str_mail_email + '">');
		document.writeln('<input type=hidden name="str_street" value="' + str_mail_street + '">');
		document.writeln('<input type=hidden name="str_zip" value="' + str_mail_zip + '">');
		document.writeln('<input type=hidden name="str_city" value="' + str_mail_city + '">');
		document.writeln('<input type=hidden name="str_country" value="' + str_mail_country + '">');
		document.writeln('<input type=hidden name="str_telephone" value="' + str_mail_telephone + '">');
		document.writeln('<input type=hidden name="str_fax" value="' + str_mail_fax + '">');
		document.writeln('<input type=hidden name="str_comment" value="' + str_mail_comment + '">');
		document.writeln('<input type=hidden name="str_order_subject" value="' + str_mail_order_subject + '">');
		document.writeln('<input type=hidden name="str_inquiry_subject" value="' + str_mail_inquiry_subject + '">');
		document.writeln('<input type=hidden name="str_other_subject" value="' + str_mail_other_subject + '">');

		document.writeln('<input type=hidden name="str_liefertermin" value="' + str_mail_liefertermin + '">');
		document.writeln('<input type=hidden name="str_versandart" value="' + str_mail_versandart + '">');

		document.writeln('<input type=hidden name="comp_email" value="' + str_comp_email + '">');
		document.writeln('<input type=hidden name="Katalogversion" value="' + str_catalog_version + '">');
		document.writeln('<input type=hidden name="return_link_text" value="' + str_return_link_text + '">');
		document.writeln('<input type=hidden name="return_link_url" value="' + str_return_link_url + '">');
		document.writeln('</table></div></FORM><br>');
	}
	if (url.indexOf("fax_enq") > -1)
	{
		document.writeln('<tr><td class="text">' + str_bemerk_anfr + '</td></tr><tr><td>&nbsp;</td></tr>');
		document.writeln('<tr><td class="text">' + bemerk + '</td></tr><tr><td>&nbsp;</td></tr>');
		document.writeln('<tr><td class="text">' + str_catversion + ' ' + str_catalog_version + '</td></tr></table>');
		document.write('<BR><HR width="550">');
	}
	if (url.indexOf("fax_order") > -1)
	{
		document.writeln('<tr><td class="text">' + str_bemerk_best + '</td></tr><tr><td>&nbsp;</td></tr>');
		document.writeln('<tr><td class="text">' + bemerk + '</td></tr><tr><td>&nbsp;</td></tr>');
		document.writeln('<tr><td class="text">' + str_catversion + ' ' + str_catalog_version + '</td></tr></table>');
		document.write('<BR><HR width="550">');
	}
}


/*****************************************
@ Name:   WarenkorbLeer
@Datum:   01.05.1999
@Version:    01
*****************************************/
function WarenkorbLeer()
{


	document.write('<TR>' + '');
	document.write('<TD class="emptycart" COLSPAN=' + abstand + ' align="center">' + '');
	document.write(str_warenkorb_leer + '');
	document.write('</TD>' + '');
	document.write('</TR>' + '');
	SetzeCookie("WK_Zustand", "WARENKORB_LEER");

}


/*****************************************
@ Name:   DeleteArticle
@Datum:   26.07.2001
@Version:    01
*****************************************/
function DeleteArticle(index)
{
	Check = confirm(unescapeString(str_delete_article));
	if(Check == true)
	{
		var cart = LeseCookie("SC").split(article_delimiter);
		cart = extrahiereElement(cart, index);
		newCart = cart.join(article_delimiter);
		SetzeCookie("SC", newCart);
		location.href = "sc_r.htm";
	}
	else
		return false;
}


/*****************************************
@ Name:   extrahiereElement
@Datum:   01.05.1999
@Version:    01
*****************************************/
function extrahiereElement(myArray, myIndex)
{
	var myCache = new Array();
	j = 0;
	for (i=0; i<myArray.length; i++)
		if (i != myIndex) {
			myCache[j] = myArray[i];
			j = j+1;
		}
	return myCache;
}



/*****************************************
@ Name:   check
@Datum:   01.05.1999
@Version:    01
*****************************************/
function check()
{
	var myKundendaten = LeseCookie("Kunde").split("|");
	var zust = LeseCookie("WK_Zustand");

	if(zust == "WARENKORB_LEER")
	{
		myAlert(str_warenkorb_leer );
		return false;
	}
	if (myKundendaten.length == 1 || myKundendaten == ",,,,,,,,,,,,")
	{
		myAlert(str_user_daten);
		window.location.href="kunde.htm";
		return false;
	}

	if (!document.Korb.AGB_GTB.checked) {
		alert(str_agb_required);
		return false;

	}
	Check = confirm(unescapeString(str_loesche_sc));

	if(Check == true)
	{
		SetzeCookie("SC", "");
		SetzeCookie("Bemerk", "");
		
	}

	
	return true;
}


/*****************************************
@ Name:   check_intern
@Datum:   01.05.1999
@Version:    01
*****************************************/
function check_intern()
{
	var myKundendaten = LeseCookie("Kunde").split("|");
	adresse = document.Korb.address.value;
	var zust = LeseCookie("WK_Zustand");

	if(zust == "WARENKORB_LEER")
	{
		myAlert(str_warenkorb_leer );
	}
	else
	{
		// check email
		var Ergebnis = adresse.match(/^[\w\.\-]+@([\w\-]+\.)*[\w\-]{2,63}\.[a-zA-Z]{2,4}$/);
		if (Ergebnis == null)
		{
			myAlert(str_adresse);
			document.Korb.address.focus();
		}
		else
		{
			Check = confirm(unescapeString(str_loesche_sc));
			if(Check == true)
			{
				SetzeCookie("SC", "");
				SetzeCookie("Bemerk", "");
			}
			document.Korb.submit();
		}
	}
}


/*****************************************
@ Name:   Fax
@Datum:   01.05.1999
@Version: 02
*****************************************/
function Fax(art)
{
  var zust = LeseCookie("WK_Zustand");

  if(zust == "WARENKORB_LEER")
  {
	myAlert(str_warenkorb_leer );
  }
  if(zust == "BENUTZER_DATEN")
  {
	myAlert(str_benutzer_daten);
  }

  if(zust == "WARENKORB" || zust == "FORMATIERUNG")
  {
	if (art == "anfrage")
    		parent.cont.location.href="fax_enq.htm";
	else
    		parent.cont.location.href="fax_order.htm";
  }
}


/*****************************************
@ Name:   Fax_Format
@Datum:   01.05.1999
@Version: 02
*****************************************/
function Fax_Format(art)
{
	var myWKall = LeseCookie("SC");
	var myWK = myWKall.split(article_delimiter);

	Kopfzeile();
	printUserData(0);
	Tabkopf("fax");

	for(l=0; l<myWK.length; l++)
	{
		//Parameter des Artikels auslesen
		myArtikel = LeseISC(myWK[l]);
		Fax_Aufzeichnen(myArtikel[0], myArtikel[1], myArtikel[2], myArtikel[3], myArtikel[6],myArtikel[8], myArtikel[4].split("$$")[0],myArtikel[10]);
	}
	TabEnde();
	SetzeCookie("WK_Zustand", "FORMATIERUNG");
}

/*****************************************
@ Name:   Kopfzeile
@Datum:   01.05.1999
@Version:    01
*****************************************/
function Kopfzeile()
{
	document.write('<TABLE width="550" align="center">');

	document.write('<TR><TD height="60" width="40%">&nbsp;</TD> <TD width="25%">&nbsp;</TD><TD width="35%">&nbsp;</TD></TR>');

	document.write('<TR><TD class="fax_to">' + str_an + '</TD><TD>&nbsp;</TD>');
	document.write('<TD class="fax_date">' + str_datum + '&nbsp;');
	document.write(str_wochentag[TagInWoche] + ',&nbsp;' + Tag + '.&nbsp;' + str_monat[Jahresmonat] + '&nbsp;' + Jahr);
	document.write('</TD></TR>');

	document.write('<TR><TD class="fax_address">' + str_comp_name + '<BR>' + str_comp_str + '</TD>');

	document.write('<TD rowspan=2>&nbsp;</TD><TD rowspan=2 valign=bottom class="fax_faxnr">' + str_comp_fax + '</TD>');

	document.write('<TR><TD class="fax_city">' + str_comp_ort + '</TD></TR></TABLE>');
	document.write('<HR width="550"><BR>');
}


/*****************************************
@ Name:   Fax_Aufzeichnen
@Datum:   01.05.1999
@Version:    01
*****************************************/
function Fax_Aufzeichnen(BestellNr, Bezeichnung, Variante, Preis, Anzahl, Extra, cur, Benennung)
{
	document.write('<TR>');

	document.write('<TD class="faxordernumber">');
	document.write(BestellNr);
	if (sw_ext == true && Extra != "")
	{
		document.write('<br>' + str_ext);
	}
	document.write('</TD>' + '');

	document.write('<TD class="faxproductname">');
	document.write(Bezeichnung);
	if (sw_ext == true && Extra != "")
	{
		document.write('<br>' + Extra.split("$$")[0]);
	}
	document.write('</TD>');
	document.write('<TD class="faxproductname">');
	document.write(Benennung);
	document.write('</TD>');
	if(sw_vrt == true)
	{
		var eachVariante = Variante.split('##');
		document.write('<TD class="faxvariant">');
		for(i=0; i < eachVariante.length-1; i++)
				{document.write(eachVariante[i] + '<br />');}
				document.write(eachVariante[eachVariante.length-1]);
		document.write('</TD>');
	}

	if(sw_prs == true)
	{
		if (Preis != 0)
		{
			document.write('<TD class="faxcurrency">');
			document.write(cur + '&nbsp;' + Preis);
			if (sw_ext == true && Extra != "")
			{
				if(Extra.split("$$")[1] != "")
					document.write('<br>' + cur + '&nbsp;' + Extra.split("$$")[1]);
				else
					document.write('<br>' + str_noprice_sc);
			}
			document.write('</TD>');
		}
		else
			document.write('<TD class="faxcurrency">' + str_noprice_sc + '</TD>');
	}

	document.write('<TD class="faxquantity">');
	document.write(Anzahl);
	document.write('</TD>');

	document.write('</TR>');
}

/*****************************************
@ Name:   printUserData
@Datum:   22.02.2001
@Version:    02
*****************************************/
function printUserData(asform)
{
	var url   = document.URL;
	var kunde = LeseCookie("Kunde").split("|");
	var isFax = false;

	if(kunde.length > 1)
	{
		// get userdata of cookie
		var userData = getUser(kunde);
	}
	else
	{	// init new user
		var myLeerData = new Array();
		for (i=0; i<13; i++)
		{
			myLeerData[i] = "";
		}
		var userData = getUser(myLeerData);
	}

	/* selection of style class to be used */
	if (url.indexOf("fax") > -1)
	{
		styleclass_key="fax_senderaddress";
		styleclass_val="fax_senderaddress";
		isFax = true;
	}
	else
	{
		styleclass_key="designationuserdata";
		styleclass_val="userdata";
	}

	if (url.indexOf("fax") == -1)
	{
		document.write("<table width='550' border='0' align='center'><tr><td class='userdataheader'>" + str_userdata);
		document.write("</td></tr><tr><td height='5'>&nbsp;</td></tr></table>");
	}


	document.write('<TABLE width="550" align="center">');
	document.write('<TR><TD class="' + styleclass_key + '">' + strCompany + ': ');
	if (!isFax && strmustkrit[0] == true) document.write('<font class="star">*</font>');
	document.write('</TD><TD class="' + styleclass_val + '">' + printInput("company",userData.company,asform,"vCard.Company") + '</TD>');

	document.write('<TD class="' + styleclass_key + '">' + strDivision + ': ');
	if (!isFax && strmustkrit[1] == true) document.write('<font class="star">*</font>');
	document.write('</TD><TD class="' + styleclass_val + '">' + printInput("division",userData.division,asform,"vCard.Department") + '</TD></TR>');

	document.write('<TR><TD class="' + styleclass_key + '">' + strTitle + ': ');
	if (!isFax && strmustkrit[2] == true) document.write('<font class="star">*</font>');
	document.write('</TD><TD class="' + styleclass_val + '">' + printInput("title",userData.title,asform,"") + '</TD>');

	document.write('<TD class="' + styleclass_key + '">' + strName + ': ');
	if (!isFax && strmustkrit[3] == true) document.write('<font class="star">*</font>');
	document.write('</TD><TD class="' + styleclass_val + '">' + printInput("namen",userData.namen,asform,"vCard.DisplayName") + '</TD></TR>');

	document.write('<TR><TD class="' + styleclass_key + '">' + strPosition + ': ');
	if (!isFax && strmustkrit[4] == true) document.write('<font class="star">*</font>');
	document.write('</TD><TD class="' + styleclass_val + '">' + printInput("position",userData.position,asform,"vCard.JobTitle") + '</TD>');

	document.write('<TD class="' + styleclass_key + '">' + strEmail + ': ');
	if (!isFax && strmustkrit[5] == true) document.write('<font class="star">*</font>');
	document.write('</TD><TD class="' + styleclass_val + '">' + printInput("email",userData.email,asform, "vCard.Email") + '</TD></TR>');

	document.write('<TR><TD class="' + styleclass_key + '">' + strStreet + ': ');
	if (!isFax && strmustkrit[6] == true) document.write('<font class="star">*</font>');
	document.write('</TD><TD class="' + styleclass_val + '" colspan="3">' + printInput("street",userData.street,asform, "vCard.Business.StreetAddress") + '</TD></TR>');

	document.write('<TR><TD class="' + styleclass_key + '">' + strZip + ': ');
	if (!isFax && strmustkrit[7] == true) document.write('<font class="star">*</font>');
	document.write('</TD><TD class="' + styleclass_val + '">' + printInput("zip",userData.zip,asform, "vCard.Business.Zipcode") + '</TD>');

	document.write('<TD class="' + styleclass_key + '">' + strCity + ': ');
	if (!isFax && strmustkrit[8] == true) document.write('<font class="star">*</font>');
	document.write('</TD><TD class="' + styleclass_val + '">' + printInput("city",userData.city,asform, "vCard.Business.City") + '</TD></TR>');

	document.write('<TR><TD class="' + styleclass_key + '">' + strCountry + ': ');
	if (!isFax && strmustkrit[9] == true) document.write('<font class="star">*</font>');
	document.write('</TD><TD class="' + styleclass_val + '" colspan="3">' + printInput("country",userData.country,asform, "vCard.Business.Country") + '</TD></TR>');

	document.write('<TR><TD class="' + styleclass_key + '">' + strTelephone + ': ');
	if (!isFax && strmustkrit[10] == true) document.write('<font class="star">*</font>');
	document.write('</TD><TD class="' + styleclass_val + '">' + printInput("tel",userData.tel,asform, "vCard.Business.Phone") + '</TD>');

	document.write('<TD class="' + styleclass_key + '">' + strFax + ': ');
	if (!isFax && strmustkrit[11] == true) document.write('<font class="star">*</font>');
	document.write('</TD><TD class="' + styleclass_val + '">' + printInput("fax",userData.fax,asform, "vCard.Business.Fax") + '</TD></TR>');

	document.write('<tr><TD class="' + styleclass_key + '" valign="top">' + strComment + ':</TD>');
	document.write('<TD class="' + styleclass_val + '" colspan="3">' + printInput2("comment",52,4,userData.comment,"userData.comment",asform,"") + '</TD></TR>');
	if (!isFax)
	{
		document.write('<tr><td colspan=4 height=30><font class="star">* - ' + str_must + '</font></TD></TR>');
	}
	document.write('</TABLE>');


	if (!isFax)
	{
	   document.write('<TABLE ALIGN=CENTER WIDTH=550><TR>');
	   document.write('<TD><INPUT class="button" TYPE="BUTTON" VALUE="' + str_DatenUebernehmen + '" onClick="javascript:UebernehmeDaten()"></TD>');
   	   document.write('<TD><INPUT TYPE="BUTTON" class="button" VALUE="' + str_back + '" onClick="history.back()"></TD>');
	   document.write('</TR></TABLE>');
	}

	SetzeCookie("WK_Zustand","BENUTZER_DATEN");
}


/*****************************************
@ Name:   printInput
@Datum:   21.05.1999
@Version:    01
*****************************************/
function printInput(variable,value,astext,vcard)
{
	// Maxlength beschreibt max. Anzahl der Zeichen
	// Size=  Anzahl der angezeigten  Zeichen
	var lendis=25;
	var maxlen = 40;
	if(astext)
	{
		var input = "<INPUT TYPE=TEXT NAME=" + variable + " MAXLENGTH=" + maxlen + " SIZE=" + lendis + " VALUE=\"" + value;

		if (vcard != '')
			input += "\" VCARD_NAME = \"" + vcard;

		input += "\">";

		return input;
	}
	else
		return(value);
}

/*****************************************
@ Name:   printInput2
@Datum:   21.05.1999
@Version:    01
  *****************************************/
function printInput2(variable,len,hei,value,valuename,astext)
{
	if(astext)
		return('<TEXTAREA NAME=' + variable + ' COLS=' + len + ' ROWS=' + hei + '>'+value+'</textarea>');
	else
		return(value);
}


/*****************************************
@ Name:   getUser()
@Datum:   21.05.1999
@Version:    01
*****************************************/
// create a user
function getUser(myData)
{
	this.company = myData[0];
	this.division = myData[1];
	this.title = myData[2];
	this.namen = myData[3];
	this.position = myData[4];
	this.email = myData[5];
	this.street = myData[6];
	this.zip = myData[7];
	this.city = myData[8];
	this.country = myData[9];
	this.tel = myData[10];
	this.fax = myData[11];
	this.comment = myData[12];
	return(this);
}

/*****************************************
@ Name:   CheckEingabe()
@Datum:   21.05.1999
@Version:    01
*****************************************/
function CheckEingabe()
{
	var add=0;
	var out = "";
	var checkEmail = false;
	for (i=0; i<strmustkrit.length; i++)
	{
		// check email if mandatory field or if field is not empty
		if (document.userform.elements[i].name == "email" &&
		    (strmustkrit[i] == true || document.userform.elements[i].value != ""))
			checkEmail = true;
		if (document.userform.elements[i].value == "" && strmustkrit[i] == true)
		{
			out += "\n - " +strkunde[i];
			add++;
		}
	}
	if (add != 0)
	{
		myAlert(str_bitte+out)
		return false;
	}

	if (checkEmail)
	{
		var email = document.userform.email.value;
		var Ergebnis = email.match(/^[\w\.\-]+@([\w\-]+\.)*[\w\-]{2,63}\.[a-zA-Z]{2,4}$/);
		if (Ergebnis)
			return true;
		else
		{
			myAlert(str_adresse);
			return false;
		}
	}
	return true;
}


/*****************************************
@ Name:   UebernehmeDaten()
@Datum:   21.05.1999
@Version:    01
*****************************************/
function UebernehmeDaten()
{
	if (CheckEingabe())
	{
		kunde = document.userform.company.value;
		kunde += '|' + document.userform.division.value;
		kunde += '|' + document.userform.title.value;
		kunde += '|' + document.userform.namen.value;
		kunde += '|' + document.userform.position.value;
		kunde += '|' + document.userform.email.value;
		kunde += '|' + document.userform.street.value;
		kunde += '|' + document.userform.zip.value;
		kunde += '|' + document.userform.city.value;
		kunde += '|' + document.userform.country.value;
		kunde += '|' + document.userform.tel.value;
		kunde += '|' + document.userform.fax.value;
		kunde += '|' + document.userform.comment.value+" ";
		SetzeCookie("Kunde", kunde);
		myAlert(str_DatenGespeichert);
		window.location.href="sc_r.htm";
	}
}

/*****************************************
@ Name:   FormatPreis
@Datum:   10.12.1999
@Version:    01
*****************************************/

function FormatPreis(preis)
{
	//Preis formatieren
	if (preis == "")
		return("");
	preis = Math.round(preis*100)/100;
	prs = String(preis);
	prs0 = "" +prs.split(".")[0];
	prs1 = "" +prs.split(".")[1];
	if (prs1 == "undefined")
		prs1 = "";

	// format price with defined number of decimal places
	if (no_dec_places == 0)
		return(prs0);

	if (no_dec_places == prs1.length)
		return prs;

	if (prs1.length < no_dec_places)
	{
		for (var ndp=prs1.length; ndp<no_dec_places; ndp=ndp+1)
			prs1 = prs1 + "0";
		return(prs0 + "." + prs1);
	}

	if (prs1.length > no_dec_places)
		return(prs0 + "." + prs1.substr(0,no_dec_places));

	return(prs);
}


/*****************************************
@ Name:   Warenkorb_Ausdrucken
@Datum:   01.05.1999
@Version:    01
*****************************************/
function Warenkorb_Ausdrucken()
{
	var zust=LeseCookie("WK_Zustand");
	if(zust== "WARENKORB_LEER")
	{
		myAlert(str_warenkorb_leer );
	}
	if(zust == "BENUTZER_DATEN")
	{
		myAlert(str_benutzer_daten);
	}

	if(zust== "WARENKORB" || zust== "FORMATIERUNG")
	{
		parent.cont.focus();
		parent.cont.window.print();
	}
}


/*****************************************
@ Name:   getCookiename
@Datum:   05.02.2001
@Version:    02
*****************************************/
function getCookiename(url,Tiefe)
{
   if (protocol == "http:")
   {
       var url_split=url.split("/");
   }
   else
   {
		//Schlosser 09.03.2001: ie and netscape have different url format for local websites
		//example ie: file://d:\programme\web2cad\cc\website\html\deutsch\p_a01b01c01d01.htm
		//example nc: file:///d|/programme/web2cad/cc/website/html/deutsch/p_a01b01c01d01.htm
		//bug no. CC_200000333
        if (ie)
			var url_split=url.split("\\");
		else
		{
			var url_split=url.split("/");
			return(url_split[4]+url_split[url_split.length-Tiefe]);
		}
   }

   return(url_split[1]+url_split[url_split.length-Tiefe]);
}
/*****************************************
@ Name:  saveShoppingCart
@Datum:   24.06.2003
@Version:    01
*****************************************/
function saveShoppingCart()
{
	var mainFrame=window.open('','cont');

	var cart = LeseCookie("SC");


	if(comparePrimitiveStrings(cart, "") != 0 )
	{
		mainFrame.document.basket.SaveShoppingCart();

	}
	else
	{
		myAlert(str_warenkorb_leer);
	}

}
/*****************************************
@ Name:  loadShoppingCart
@Datum:   24.06.2003
@Version:    01
*****************************************/
function loadShoppingCart()
{
	var mainFrame=window.open('','cont');

	if(mainFrame.document.basket)
	{
		mainFrame.document.basket.LoadShoppingCart();

	}

}
/*****************************************
@ Name:  comparePrimitiveStrings
@Datum:   24.06.2003
@Version:    01
*****************************************/
function comparePrimitiveStrings( a, b )
{

	if( a > b )
		return 1;
	else if ( a < b )
		return -1;

	return 0;
}

/*****************************************
@ Name:  AddArticle
@Datum:   26.06.2003
@Version:    01
*****************************************/
function addArticle(artNr,artBezeichnung,temp1,artPreis,temp2,temp3,artAnzahl,artfile,temp4,temp5,cadfile)
{
	var cart = LeseCookie("SC");

	var cartArray = cart.split(article_delimiter);
	var index = getBstnrIndex(cartArray, artNr);

	if(comparePrimitiveStrings(cart, "") != 0 )
	{
		cart += "||";
	}
	if (index == -1)	// not yet in shopping cart
		cart += artNr + "**" + artBezeichnung + "**********" + temp1 + "**" + artfile + "******" + cadfile + "@@" + artAnzahl;
	else
	{
		if (sw_over == true)
		{
			artAnzahl = Number(cartArray[index].split("@@")[1]) + Number(artAnzahl);
		}
		cartArray[index] = artNr + "**" + artBezeichnung + "**********" + temp1 + "**" + artfile + "******" + cadfile + "@@" + artAnzahl;
		cart = cartArray.join(article_delimiter);
	}

	SetzeCookie("SC", cart);
}

/*****************************************
@ Name:   addCSVArticle
@Datum:   26.06.2003
@Version:    01
*****************************************/
function addCSVArticle(csvLine)
{
	var delimiter = ",";
	var article = csvLine.split(delimiter);
	addArticle(article[0],article[1],article[2],article[3],article[4],article[5],article[6],article[7],article[8],article[9],article[10]);
}

/*****************************************
@ Name:   SetAppletValues
@Datum:   26.06.2003
@Version:    01
*****************************************/
function SetAppletValues(Artikel)
{
	/*
		Possible Parameters for this applet: see ShoppingCart.java
	*/
	document.write("<APPLET NAME='basket' code='de.web2cad.shoppingcart.shoppingcart' CODEBASE='shoppingcart' width='0' height='0' archive='javasoft.jar' MAYSCRIPT>");
	document.write("<PARAM NAME='cabinets' value='ie.cab' />");
	document.write("<PARAM NAME='Artikel' VALUE='" + Artikel + "'>");
	document.write("<PARAM NAME='saveCartAtOnce' VALUE='false'>");
	document.write("<PARAM NAME='errorMessageInvalidFileFormat' VALUE='Invalid File Format! \nLoading stopped'>");
	document.write('</APPLET>');

}


/*****************************************
@ Name:  CallSetAppletValues
@Datum:   26.06.2003
@Version:    01
*****************************************/
function CallSetAppletValues()
{
	var Artikel = "";
	var myWKall = LeseCookie("SC");
	if(myWKall)
	{
		var myWK = myWKall.split(article_delimiter);

		for(i=0; i<myWK.length; i++)
		{
			Artikel = Artikel + LeseISC(myWK[i]);
			Artikel = Artikel + article_delimiter;
		}
 	}
	SetAppletValues(Artikel);
}


/*****************************************
@ Name:  importFinished
@Datum:   09.07.2003
@Version:    01
*****************************************/
function importFinished()
{
	location.reload();
}

/*****************************************
@ Name:   getdate leifert das aktuelle Datum
@Datum:   06.05.2003
@Version: 01
@Autor:   Weigelt
*****************************************/
function getdate()
{
	var date=new Date();
	var dd=date.getDate();
	var mm=date.getMonth() + 1;
	var yy=date.getFullYear();
	var aktdate;

	  if(dd<10)dd="0"+dd;
	  if(mm<10)mm="0"+mm;

	aktdate = dd+"."+mm+"."+yy;
	return aktdate;
}

/*****************************************
@ Name:   getyear leifert das aktuelle Jahr
@Datum:   06.05.2003
@Version: 01
@Autor:   Weigelt
*****************************************/
function getyear()
{
	var date=new Date();
	var yy=date.getFullYear();
	//alert("Jahr"+yy);
	return yy;
}

/*****************************************
@ Name:   getday liefert das aktuellen Tag
@Datum:   06.05.2003
@Version: 01
@Autor:   Weigelt
*****************************************/
function getday()
{
	var date=new Date();
	var dd=date.getDate();
	return dd;
}

/*****************************************
@ Name:   getmonth liefert das aktuellen Monat
@Datum:   06.05.2003
@Version: 01
@Autor:   Weigelt
*****************************************/
function getmonth()
{
	var date=new Date();
	var mm=date.getMonth() + 1;
	return mm;
}


/*****************************************
@ Name:   PruefeDatum
@Datum:   06.05.2003
@Version: 01
@Autor:   Weigelt
*****************************************/
function PruefeDatum(Datum,Startjahr,Endjahr)
{
	var Datum, Tag, Monat, Jahr, Laenge, tageMonat;
	Laenge=Datum.length;

	if (Laenge==10 && Datum.substring(2,3)=="." && Datum.substring(5,6)==".")
	{
		Tag=parseInt(Datum.substring(0,2),10);
		Monat=parseInt(Datum.substring(3,5),10);
		Jahr=parseInt(Datum.substring(6,10),10);
	}
	else
	{
	Fehlermeldung();return false;
	}

	if (Monat==4 || Monat==6 || Monat==9 || Monat==11)
	{
		tageMonat=30;
	}
	else if (Monat==1 || Monat==3 || Monat==5 || Monat==7 || Monat==8 || Monat==10 || Monat==12)
	{
		tageMonat=31;
	}
	else if(Monat==2 && Jahr%4==0 && Jahr%100!=0 || Jahr%400==0)
	{
		tageMonat=29;
	}
	else if(Monat==2 && Jahr%4!=0 || Jahr%100==0 && Jahr%400!=0)
	{
		tageMonat=28;
	}

	if (Tag>=1 && Tag>=getday() &&Tag<=tageMonat && Monat>=1 && Monat<=12 && Monat>=getmonth() && Jahr>=Startjahr && Jahr<=Endjahr)
	{
		//alert("Das Datum wurde korrekt eingegeben!");
		return true;
	}
	else
	{
		Fehlermeldung();
		return false;
	}
}
//-->
