var ausf	=	new	Array();
var equip	=	new	Array();
equip[ 0 ]	=	new Array();

// JavaScript Document <- alles klar... Setzt vermutlich die Höhe der Inhalte der rechten Seite neu
function resizeSP () {
	var hoehe;
	hoehe = document.getElementById('INFOH').offsetHeight;
	document.getElementById('SP1').style.height = hoehe - 14 +'px';
	document.getElementById('SP2').style.height = hoehe - 14 +'px';
}

/*
	Bekommt eine ID übergeben.
	Holt sich den Wert des passenden Textfeldes.
	Prüft den Inhalt des Textfeldes.
	Ruft, falls korrekt die neue Seite zum Hinzufügen in den Warenkorb auf.
	Aktualisiert die Seite.
*/
function addWK( ArtID, MinCount, Target )
{
	Action	=	"add";
	InpID	=	'wk_value_' + ArtID;
	
	Anzahl	=	document.getElementById( InpID ).value;

	if( isNaN( Anzahl ) )
	{
		alert( InsertNumber );
	}
	else
	{
		// Artikel ist unterhalb der minimalen Bestellmenge
		// mindestbestellmenge wird im Warenkorb gepürft, da man einzeln auch mehrmals was hinzufügen kann und nicht immer die aktuelle Bestellmenge des Warenkorbs sieht
//		MinCount	=	1;
		if( Anzahl < MinCount )
		{
			alert( LowBasketCount + ": " + MinCount );
		}
		else
		{
			EString	=	"";
			// alles Zubehör durchgehen, falls vorhanden
			if( equip[ 0 ].length > 0 ) {
				for( i=0; i<equip[ 0 ].length; i++ ) {
					EString	+=	"&zub" + i + "=" + equip[ 0 ][ i ][ 0 ] + "&zubcount" + i + "=" + parseInt( document.getElementById( "zub" + i ).value );
				}
			}
			// prüfen, ob es eine Ausführung gibt - und ob diese dann ausgewählt ist
			if( Art = document.getElementById( "ausf" + ArtID ) ) {
				if( Art.options[ Art.selectedIndex ].value != "0" ) {
//					fenster	=	window.open("change_wk.asp?action=" + Action + "&idart=" + ArtID + "&anzahl=" + Anzahl + "&idaus=" + Art.options[ Art.selectedIndex ].value + "&equip=" + EString + "&towk=" + Target , "", "width=1,height=1,left=-100,top=-100,status=yes");
					redirect( "&wk_action=" + Action + "&wk_idart=" + ArtID + "&wk_anzahl=" + Anzahl + "&wk_idaus=" + Art.options[ Art.selectedIndex ].value + "&wk_equip=" + EString + "&wk_towk=" + Target );
				}
				else {
					alert( SelectStyle );
				}
			}
			else {
//				fenster	=	window.open("change_wk.asp?action=" + Action + "&idart=" + ArtID + "&anzahl=" + Anzahl + "&equip=" + EString + "&towk=" + Target, "", "width=1,height=1,left=-100,top=-100,status=yes");
				redirect( "&wk_action=" + Action + "&wk_idart=" + ArtID + "&wk_anzahl=" + Anzahl + "&wk_equip=" + EString + "&wk_towk=" + Target );
			}
		}
	}
}

/*
	ruft ein Fenster auf, welches einen Eintrag aus dem Warenkorb löscht.
*/
function delWK( ArtID, AusfID )
{
	Action	=	"del";
	if( isNaN( AusfID ) ) { AusfID = 0 };
//	fenster	=	window.open("change_wk.asp?action=" + Action + "&idart=" + ArtID + "&idaus=" + AusfID, "", "width=1,height=1,left=-100,top=-100,status=yes");
	redirect( "&wk_action=" + Action + "&wk_idart=" + ArtID + "&wk_idaus=" + AusfID );
}
// löscht ein Zubehör zu einem Artikel aus dem Warenkorb
function delZub( ZubID, WKID )
{
	Action	=	"del"
//	fenster	=	window.open("change_wk.asp?action=" + Action + "&idart=" + ZubID + "&idwk=" + WKID, "", "width=1,height=1,left=-100,top=-100,status=yes");
	redirect( "&wk_action=" + Action + "&wk_idart=" + ZubID + "&idwk=" + WKID );
}
function redirect( Link ) {
	Location	=	location.href.split( "#" );
	Location	=	Location[ 0 ];
	location.href	=	Location + Link;
}

/*
	Für den Formchecker.
*/
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

/*
	Zum Formularchecken.
*/
function MM_validateForm() { //v4.0 
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' ist erforderlich.\n'; }
  } if (errors) alert(Formerror);
  document.MM_returnValue = (errors == '');
}

/*
	Prüft bei den Visitenkarten, ob eine falsche Eingabe gemacht wurde
*/
function checkBestellung()
{
	return true;
}

/*
	Prüft, ob bei den Artikeln Enter gedrück wird und aktiviert bei
	Bedarf die add Funktion.
*/
function checkEnter(ArtID, MinCount )
{
	Browser = navigator.appName;
	if( Browser == "Netscape" )
	{
		if( EnterHit )
		{
			addWK( ArtID, MinCount );
		}
	}
	else
	{
		key	=	window.event.keyCode;
		if( key == 13)
		{
			addWK( ArtID, MinCount );
		}
	}

}

var	EnterHit	=	false;

function checkEnterAll( Ereignis )
{
	Browser	=	navigator.appName;
	if( Browser == "Netscape" )
	{
		if( Ereignis.which == 13 )
		{
			EnterHit	=	true;
		}
		else
		{
			EnterHit	=	false;
		}
	}
}

function checkBusinessCard()
{
	return true;
}

document.onkeydown = checkEnterAll;
/*
	reagiert auf Änderung einer Ausführung
	setzt Preis und Artikelnummer neu anhand des dynamisch generierten Arrays
*/
function changeArt( ID, Sel ) {
	if( src = ausf[ ID ][ Sel.options[ Sel.selectedIndex ].value ] ) {
		document.getElementById( "artnr" + ID ).innerHTML		=	src[ 0 ];
		document.getElementById( "preisdiv" + ID ).innerHTML	=	src[ 1 ];
		document.getElementById( "wk_value_" + ID ).value		=	src[ 2 ];
	}
	else {
		document.getElementById( "artnr" + ID ).innerHTML		=	"";
		document.getElementById( "wk_value_" + ID ).value		=	"";
		if( src = ausf[ ID ][ Sel.options[ 1 ].value ] ) {
			document.getElementById( "preisdiv" + ID ).innerHTML	=	src[ 1 ];
		}
	}
}

function changeArtDetail( ID, Sel ) {
	hideallFields();
	
	AID	=	0;
	if( src = ausf[ ID ][ Sel.options[ Sel.selectedIndex ].value ] ) {
		AID	= Sel.options[ Sel.selectedIndex ].value;
//		document.getElementById( "imgdetail" ).style.backgroundImage	=	"url(" + src[ 2 ] + ")";
		document.getElementById( "imgsrc" ).src	=	src[ 2 ];
		document.getElementById( "PREIS2" ).innerHTML	=	src[ 1 ];
		document.getElementById( "detailprice" ).innerHTML = src[ 1 ];
		if( atext = document.getElementById( "ausftext" + Sel.options[ Sel.selectedIndex ].value ) ) {
			atext.style.visibility	=	"visible";
		}
		if( atext = document.getElementById( "ausftext" + Sel.options[ Sel.selectedIndex ].value ) ) {
			atext.style.position	=	"static";
		}
		document.getElementById( "wk_value_" + ID ).value = src[ 3 ];
		document.getElementById( "stylename" ).innerHTML	=	src[ 4 ];
	}
	else {
		if( src = ausf[ ID ][ 0 ] ) {
			document.getElementById( "imgdetail" ).style.backgroundImage	=	"url(" + src[ 2 ] + ")";
			document.getElementById( "PREIS2" ).innerHTML	=	src[ 1 ];
			document.getElementById( "ausftext1" ).style.visibility	=	"visible";
			document.getElementById( "ausftext1" ).style.position	=	"static";
			document.getElementById( "wk_value_" + ID ).value = src[ 3 ];
			document.getElementById( "stylename" ).innerHTML	=	src[ 4 ];
		}
	}
	changeEquip( AID );
	calculateEquip( ID );
	calculateItem( ID );
}

function changeEquip( AID ) {
	for( i=0; i<equip[ AID ].length; i++ ) {
		anz			=	document.getElementById( "zub" + i );
		anz.value	=	equip[ AID ][ i ][ 3 ];
	}
}


function hideallFields() {
	Counter	=	1;
	Height	=	0;
	while( div = document.getElementById( "ausftext" + Counter ) ) {
		div.style.visibility	= "hidden";
		div.style.position		= "absolute";
		Counter++;
	}
}

function setFieldSize() {
return;
	Counter	=	1;
	Height	=	0;
	while( div = document.getElementById( "ausftext" + Counter ) ) {
		TmpHeight	=	div.offsetHeight;
		if( TmpHeight > Height ) {
			Height	=	TmpHeight;
		}
		Counter++;
	}
	
	document.getElementById( "TXTAUSF" ).style.height	=	Height + "px";
}
// fügt einen Artikel zum Merkzettel hinzu oder entfernt ihn (je nach action)
function toNotepad( ID , Action ) {
	fenster	=	window.open("change_notes.asp?action=" + Action + "&idart=" + ID, "", "width=1,height=1,left=-100,top=-100,status=yes");
}
// Änderung des Zubehörs - Preisberechnung - Summe Zubehör und Konfiguration
function calculateEquip( ID ) {
	AID		=	0;
	if( Sel = document.getElementById( "ausf" + ID ) ) {
		AID	= Sel.options[ Sel.selectedIndex ].value;
	}

	Summe	=	0;
	for( i=0; i<equip[ AID ].length; i++ ) {
		if( Item = equip[ AID ][ i ] ) {
			if( ! isNaN( Item[ 2 ] ) ) {
				if( anzahl	=	parseInt( document.getElementById( "zub" + i ).value ) )
				{
					if( anzahl < 0 ) {
						anzahl	=	Math.abs( anzahl );
						document.getElementById( "zub" + i ).value	=	anzahl;
					}
				}
				else {
						anzahl	=	0;
				}
				Summe	+=	Item[ 2 ] * anzahl;
			}
		}
	}
	
	totalequip	=	Summe;
	// Funktion muss angepasst werden, wenn es mehrere währungen gibt
	if( div = document.getElementById( "equipprice" ) ) div.innerHTML =	formatNumber( Summe );
	if( div = document.getElementById( "totalequip" ) ) div.innerHTML =	formatNumber( Summe );

	calculateConfig();
}
// berechnet eine Artikelanzahländerung für die Details
function calculateItem( ID ) {
	Price	=	0;
	// Prüfen, ob es verschiedene Ausführungen gibt oder nicht
	if( ausf.length > 0 ) {
		Sel	=	document.getElementById( "ausf" + ID );
		if( src = ausf[ ID ][ Sel.options[ Sel.selectedIndex ].value ] ) {
			T_Price	=	src[ 1 ].replace( /\./g, "" );
			T_Price	=	T_Price.replace( /&nbsp;&euro;/, "" );
			T_Price	=	T_Price.replace( /&euro;&nbsp;/, "" );
			T_Price	=	T_Price.replace( /,/, "." );
			Price	=	parseFloat( T_Price );
		}
		else {
			if( src = ausf[ ID ][ Sel.options[ 1 ].value ] ) {
				T_Price	=	src[ 1 ].replace( /\./g, "" );
				T_Price	=	T_Price.replace( /&nbsp;&euro;/, "" );
				T_Price	=	T_Price.replace( /,/, "." );
				Price	=	parseFloat( T_Price );
			}
		}
	}
	else {
		Price	=	itemprice;
	}
	anzahl	=	0;
	val	=	document.getElementById( "wk_value_" + ID ).value;
	if( anzahl = parseInt( val ) ) {
		if( anzahl < 0 ) {
			anzahl	=	Math.abs( anzahl );
			document.getElementById( "wk_value_" + ID ).value	=	anzahl;
		}
	}
	else {
		anzahl	=	0;
	}
	totalitem	=	anzahl * Price;
	document.getElementById( 'totalitem' ).innerHTML	=	formatNumber( totalitem );

	calculateConfig();
}
// berechnet die komplette Konfiguration aus
// und prüft auf Entereingabe
function calculateConfig() {
	total	=	totalitem + totalequip;
	document.getElementById( 'total' ).innerHTML	=	formatNumber( total );

	if( window.event ) {
		if( key = window.event.keyCode ) {
			if( key == 13) {
				addWK( ArtID, CountDel );
			}
		}
	}
}

// Formatiert für 2 Kommastellen
function formatNumber( Zahl ) {
	Zahl	=	Math.round( Zahl * 100 ) / 100;
	Rest	=	Zahl % 1;
	Rest	=	Math.round( Rest * 100 ) / 100;
	if( Rest < 10 ) {
		if( Rest == 0 ) {
			Zahl	=	Zahl.toString() + ".00";
		}
		else {
			Zahl	=	Zahl.toString() + "0";
		}
	}
	else {
		Zahl	=	Zahl.toString();
	}
	Zahl	=	Zahl.split( "." );
	Zahl	=	Zahl[0] + "," + Zahl[1].substring( 0, 2 );
	// hin und wieder wurde als 3. ziffer nachkommastelle eine 0 ausgegeben - diese wird nun abgeschnitten
//	Zahl	=	Zahl.replace( ".", "," );
	
	return Zahl + "&nbsp;&euro;";
}
function changeToStyle( ID, ArtID ) {
	Sel	=	document.getElementById( 'ausf' + ArtID );
	for( i=0; i<Sel.options.length; i++ ) {
		if( Sel.options[ i ].value == ID ) {
			Sel.selectedIndex	=	i;
			break;
		}
	}
	changeArtDetail( ArtID, Sel );
}
function changeDelivery( CB ) {
	Style	=	"block"
	if( ! CB.checked ) {
		Style	=	"none"
	}
	document.getElementById( 'HIDDENDELI' ).style.display	=	Style;
	document.getElementById( 'HIDDENBILL' ).style.display	=	Style;
}
function chooseDelivery( Sel ) {
	Adr	=	Adressen[ Sel.selectedIndex ];
	document.order.elements[ "d_firma" ].value		=	Adr[ 0 ];
	if( Adr[ 1 ] == "Herr" || Adr[ 1 ] == "" ) {
		document.order.elements[ "d_anrede" ].selectedIndex	=	0;
	}
	else {
		document.order.elements[ "d_anrede" ].selectedIndex	=	1;
	}
	document.order.elements[ "d_nachname" ].value	=	Adr[ 2 ];
	document.order.elements[ "d_vorname" ].value	=	Adr[ 3 ];
	document.order.elements[ "d_strasse" ].value	=	Adr[ 4 ];
	document.order.elements[ "d_plz" ].value		=	Adr[ 5 ];
	document.order.elements[ "d_ort" ].value		=	Adr[ 6 ];
	if( Adr[ 7 ] == "germany" || Adr[ 7 ] == "" ) {
		document.order.elements[ "d_land" ].selectedIndex	=	0;
	}
	else {
		if( Adr[ 7 ] == "swiss" ) {
			document.order.elements[ "d_land" ].selectedIndex	=	1;
		}
		else {
			document.order.elements[ "d_land" ].selectedIndex	=	2;
		}
	}
	document.order.elements[ "d_telefon" ].value	=	Adr[ 8 ];
	document.order.elements[ "d_telefax" ].value	=	Adr[ 9 ];
}
function VerifyMail(adresse)
	{
	//adresse = document.form1.zugemail.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);
	if ((place > -1)&&(adresse.length >2)&&(point > 1))
		{
		return true;
		}
	else
		{
		return false;
		}
	}

// checkt die Formulardaten für die Bestellung
function submitOrder() {
	CheckArr	=	new	Array( "firma", "nachname", "vorname", "strasse", "plz", "ort", "email", "telefax" );
	Liefer		=	document.getElementById( 'alternative' ).checked;
	Zahlungsart	=	document.order.elements[ 'zahlungsart' ];
	for( i=0; i<Zahlungsart.length; i++ ) {
		if( Zahlungsart[ i ].checked == true ) {
			Zahlungsart	=	Zahlungsart[ i ].value;
			break;
		}
	}
	error		=	""; // Rechnungsadresse
	error2		=	""; // Lieferadresse
	error3		=	""; // Email

	for( i=0; i<CheckArr.length; i++ ) {
		if( Check = document.order.elements[ "b_" + CheckArr[ i ] ] ) {
			if( Check.value == "" ) {
				error +=	FormFailure[ CheckArr[ i ] ] + ' ' + Required;
			}
			else {
				if( CheckArr[ i ] == "email" ) {
					if( ! VerifyMail( Check ) ) {
						error3	=	FormFailure[ "validateMail" ];
					}
				}
			}
		}
		else {
			if( Check = document.order.elements[ CheckArr[ i ] ] ) {
				if( Check.value == "" ) {
					error +=	FormFailure[ CheckArr[ i ] ] + ' ' + Required;
				}
				else {
					if( CheckArr[ i ] == "email" ) {
						if( ! VerifyMail( Check.value ) ) {
							error3	=	FormFailure[ "validateMail" ];
						}
					}
				}
			}
		}
		if( Liefer ) {
			if( Check = document.order.elements[ "d_" + CheckArr[ i ] ] ) {
				if( Check.value == "" ) {
					error2 +=	FormFailure[ CheckArr[ i ] ] + ' ' +Required;
				}
			}
		}
	}
	if( error != "" ) error = FormFailure[ "rechnung" ] + "\n" + error + "\n";
	if( error2 != "" ) error2 = FormFailure[ "lieferung" ] + "\n" + error2;
	error += error2 + error3;
	if( error != "" ) {
		alert( error );
		return false;
	}
	if( Zahlungsart == "bill" ) {
		if( SessionUser ) {
			alert( FormFailure[ "registration" ] );
			return false;
		}
	}
	if( Zahlungsart == "plastic" && false ) {
		alert( "Zahlungsart momentan aus technischen Gründen deaktiviert." );
		return false;
	}
	B_Land	=	document.order.elements[ "b_land" ];
	B_Land	=	B_Land.options[ B_Land.selectedIndex ].value;
	if( document.order.elements[ "taxnumber" ].value == "" && B_Land == "austria" ) {
		alert( FormFailure[ "taxnumber" ] );
		return false;
	}
	GSC	=	document.getElementById( 'gsc' );
	if( ! GSC.checked ) {
		alert( FormFailure[ "gsc_required" ] );
		return false;
	}
	return true;
}
// prüft, ob das Land Zoll verlangt und gibt die Berechnung entsprechend aus
function checkDuty(Sel) {
	try {
		if( Sel.name == "d_land" || !document.getElementById( 'alternative' ).checked ) {
			
			Index	=	Sel.selectedIndex;
			if( !document.getElementById( 'alternative' ).checked ) {
				document.order.elements[ "d_land" ].selectedIndex	=	Index;
			}
			dtext	=	document.getElementById( 'dutytext' );
			dprice	=	document.getElementById( 'dutyprice' );
			tprice	=	document.getElementById( 'gesamtprice_0' );
			Cnt		=	0;
			if( Sel.options[ Sel.selectedIndex ].value == "swiss" ) {
				Cnt	=	1;
//				get('taxrow').style.visibility = "hidden";
				document.getElementById('taxrow').style.visibility = "hidden";
			}
			else {
				if( Sel.options[ Sel.selectedIndex ].value != "germany" ) {
					Cnt	=	2;	
				}
//				get('taxrow').style.visibility = "visible";
				document.getElementById('taxrow').style.visibility = "visible";
			}
			dtext.innerHTML		=	Dutytext[ Cnt ];
			dprice.innerHTML	=	Dutyprice[ Cnt ];
			tprice.innerHTML	=	Total[ Cnt ];
			tprice	=	document.getElementById( 'gesamtprice_1' );
			tprice.innerHTML	=	Total[ Cnt ];
		}
	}
	catch( e ) { }
}
function get( ID ) {
	return	document.getElementById( ID );
}
function checkLogistik( Sel ) {
	Land	=	Sel.options[ Sel.selectedIndex ].value;
	if( Land == "germany" ) {
		if( Ele = get( "versandkosten_0" ) ) {
			Ele.style.display	=	"";	
		}
		if( Ele = get( "versandkosten_1" ) ) {
			Ele.style.display	=	"none";	
		}
		if( Ele = get( "gesamtkosten_0" ) ) {
			Ele.style.display	=	"";
		}
		if( Ele = get( "gesamtkosten_1" ) ) {
			Ele.style.display	=	"none";
		}
		if( Ele = get( "zws_0" ) ) {
			Ele.style.display	=	"";
		}
		if( Ele = get( "zws_1" ) ) {
			Ele.style.display	=	"none";
		}
		if( Ele = get( "mwst_0" ) ) {
			Ele.style.display	=	"";
		}
		if( Ele = get( "mwst_1" ) ) {
			Ele.style.display	=	"none";
		}
	}
	else {
		if( Ele = get( "versandkosten_0" ) ) {
			Ele.style.display	=	"none";
		}
		if( Ele = get( "versandkosten_1" ) ) {
			Ele.style.display	=	"";
		}
		if( Ele = get( "gesamtkosten_0" ) ) {
			Ele.style.display	=	"none";
		}
		if( Ele = get( "gesamtkosten_1" ) ) {
			Ele.style.display	=	"";
		}
		if( Ele = get( "zws_0" ) ) {
			Ele.style.display	=	"none";
		}
		if( Ele = get( "zws_1" ) ) {
			Ele.style.display	=	"";
		}
		if( Ele = get( "mwst_0" ) ) {
			Ele.style.display	=	"none";
		}
		if( Ele = get( "mwst_1" ) ) {
			Ele.style.display	=	"";
		}
	}
}
// newsletter eintrag
function submitNewsletter() {
	email	=	document.getElementById( "newsmail" ).value;
	if( VerifyMail( email ) ) {
		location.href="index.asp?action=newsletter&change=add&email=" + email;	
	}
	else {
		alert( FormFailure[ "validateMail" ] );
	}
}
function checkNewsletterSubmit() {
	Browser = navigator.appName;
	if( Browser == "Netscape" )
	{
		if( EnterHit )
		{
			submitNewsletter();
		}
	}
	else
	{
		key	=	window.event.keyCode;
		if( key == 13)
		{
			submitNewsletter();
		}
	}
}
function checkContact() {
	CheckArr	=	new	Array( "name", "firma", "strasse", "plz_ort", "telefon", "email" );
	return( checkForm( CheckArr, "contact" ) );
}
// prüft die Formularfelder des Kontaktformulars
function checkForm( CheckArr, Form ) {
	error	=	"";
	for( i=0; i<CheckArr.length; i++ ) {
		if( Check = document.forms[ Form ].elements[ CheckArr[ i ] ] ) {
			if( Check.value == "" ) {
				if( CheckArr[ i ] == "taxnumber" ) {
					error +=	FormFailure[ CheckArr[ i ] ];
				}
				else {
					error +=	FormFailure[ CheckArr[ i ] ] + ' ' + Required;
				}
			}
			else {
				if( CheckArr[ i ] == "email" ) {
					if( ! VerifyMail( Check.value ) ) {
						error	+=	FormFailure[ "validateMail" ];
					}
				}
			}
		}
	}
	if( error != "" ) {
		alert( error );
		return false;
	}
	return true;
}
function checkRegistration() {
	CheckArr	=	new	Array( "kundennummer", "firma", "name", "vorname", "strasse", "plz", "ort", "telefon", "email", "taxnumber" );
	return( checkForm( CheckArr, "registration" ) );
}
function checkAdd( ID, Count ) {
	if( key = window.event.keyCode ) {
		if( key == 13 ) {
			addWK( ID, Count );
		}
	}
}
function checkPasswords() {
	p1	=	document.getElementById('pass1');
	p2	=	document.getElementById('pass2');
	if( p1.value != p2.value ) {
		alert( FormFailure[ "enter_same_password" ] );
		return false;
	}
	if( p1.value.length < 6 ) {
		alert( FormFailure[ "minimum_password_size" ] );
		return false;
	}
	return true;
}
//	springt zur anderen Sprache
function changeLanguage( Sel )
{
	lan	=	Sel.options[ Sel.selectedIndex ].value;
	ln	=	location.href;
	ln	=	ln.split( "#" );
	ln	=	ln[ 0 ];
	if( ln.indexOf( '?' ) != -1 )
	{
		location.href	=	ln + "&changelang=" + lan;
	}
	else
	{
		location.href	=	ln + "?changelang=" + lan;
	}
}
