function popwin(URLPICT,FENSTERNAME,FENSTERATTRIBUTE)
{
window.open(URLPICT,FENSTERNAME,FENSTERATTRIBUTE)
}

function Bestellformular(tmpVorname, tmpNachname, tmpStrasse, tmpPlz, tmpOrt, tmpTelefon, tmpTelefax, tmpEmail, tmpAGB) {
var html="";
var gesamt=0;
var pos=0;
var str_x = "test";
var arr_x;
var strAgb;

html = html + '<html>';
html = html + '<link rel="stylesheet" type="text/css" href="style.css">';
html = html + '<body bgcolor=#EEEDFD>';

html = html + '<form name="formular3">';
html = html + '<table>';
html = html + '<tr><td colspan=2><h3><center>Ihre Adresse</h3></td></tr>';

html = html + '<tr><td>Vorname</td>';
html = html + '	   <td><input type="TEXT" name="vname" size="25" value="' + tmpVorname + '"></td></tr>';
html = html + '<tr><td>Nachname</td>';
html = html + '    <td><input type="text" name="nname" size="25" value="' + tmpNachname + '"></td></tr>';

html = html + '<tr><td>Strasse</td>';
html = html + '    <td><input type="TEXT" name="str" size="30" value="' + tmpStrasse + '"></td></tr>';
html = html + '<tr><td>PLZ / Ort</td>';
html = html + '    <td><input type="TEXT" name="plz" size="10" maxlength="5" value="' + tmpPlz + '">';
html = html + '       <input type="TEXT" name="ort" size="25" value="' + tmpOrt + '"></td></tr>';
html = html + '<tr><td>Telefon</td>';
html = html + '    <td><input type="TEXT" name="tel" size="30" value="' + tmpTelefon + '"></td></tr>';
html = html + '<tr><td>Telefax</td>';
html = html + '    <td><input type="TEXT" name="fax" size="30" value="' + tmpTelefax + '"></td></tr>';
html = html + '<tr><td>E-Mail</td>';
html = html + '    <td><input type="TEXT" name="email" size="40" value="' + tmpEmail + '"></td></tr>';

if (tmpAGB==true)
{html = html + '<tr><td colspan=3><input type="checkbox" name="agb" checked>Ich habe die <a class=agb" href="javascript:parent.Oben.popwin(\'http://www.abzurkasse.de/agb.htm\',\'agb\',\'toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=680,height=400\')" class="agb">allgemeinen Geschäftsbedingungen</a> gelesen und akzeptiert.</td></tr>';}
else
{html = html + '<tr><td colspan=3><input type="checkbox" name="agb">Ich habe die <a href="javascript:parent.Oben.popwin(\'http://www.abzurkasse.de/agb.htm\',\'agb\',\'toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=680,height=400\')" class="agb">allgemeinen Geschäftsbedingungen</a> gelesen und akzeptiert.</td></tr>';}

if (browsertyp==1)
	{html = html + '<tr><td colspan=3><center><input type="image" src="http://www.ab-zur-kasse.de/bestellen.gif" onclick="parent.Oben.checkInput(document.formular3.vname.value,document.formular3.nname.value,document.formular3.str.value,document.formular3.plz.value,document.formular3.ort.value,document.formular3.tel.value,document.formular3.fax.value,document.formular3.email.value,document.formular3.agb.checked)">&nbsp;<input type="image" src="http://www.ab-zur-kasse.de/back.gif" onclick="parent.Oben.WarenkorbZeigen()"></td></tr>';}
else
	{html = html + '<tr><td colspan=3><center><a href="javascript:parent.Oben.checkInput(document.forms[0].vname.value,document.forms[0].nname.value,document.forms[0].str.value,document.forms[0].plz.value,document.forms[0].ort.value,document.forms[0].tel.value,document.forms[0].fax.value,document.forms[0].email.value,document.forms[0].agb.checked)"><img src="http://www.abzurkasse.de/bestellen.gif" border=0</a>&nbsp;<a href="javascript:parent.Oben.WarenkorbZeigen()"><image border=0 src="http://www.abzurkasse.de/back.gif"></a></form></td></tr>';}

html = html + '</table></blockquote>';
html = html + '</body></html>';

parent.Inhalt.document.close();
parent.Inhalt.document.open ("text/html");
parent.Inhalt.document.write (html);
}

function checkInput(tmpVorname, tmpNachname, tmpStrasse, tmpPlz, tmpOrt, tmpTelefon, tmpTelefax, tmpEmail, tmpAGB) 
{

var errorfields='';
var error=0;
var errornumbers;
var CheckEmail;
var tmpEmail2;
var arrEmail;

//Nachname
	if (tmpNachname == '' || tmpNachname == ' ' )
	{
		if (errorfields == '')
		{errorfields = errorfields + 'Nachname';}
		else
		{errorfields = errorfields + ', Nachname';}

	}

//Vorname
	if (tmpVorname == '' || tmpVorname == ' ' )
	{
		if (errorfields=='')
		{errorfields = errorfields + 'Vorname';}
		else
		{errorfields = errorfields + ', Vorname';}

	}

//Strasse
	if (tmpStrasse == '' || tmpStrasse == ' ' )
	{
		if (errorfields=='')
		{errorfields = errorfields + 'Strasse';}
		else
		{errorfields = errorfields + ', Strasse';}

	}

//PLZ
	if (tmpPlz == '' || tmpPlz == ' ' )
	{
		if (errorfields=='')
		{errorfields = errorfields + 'Postleitzahl';}
		else
		{errorfields = errorfields + ', Postleitzahl';}
	}
//Ort
	if (tmpOrt == '' || tmpOrt == ' ' )
	{
		if (errorfields=='')
		{errorfields = errorfields + 'Ort';}
		else
		{errorfields = errorfields + ', Ort';}
	}
//Telefon
	if (tmpTelefon == '' || tmpTelefon == ' ' )
	{
		if (errorfields=='')
		{errorfields = errorfields + 'Telefon';}
		else
		{errorfields = errorfields + ', Telefon';}
	}
//Email
	if (tmpEmail == '' || tmpEmail == ' ' )
	{
		if (errorfields=='')
		{errorfields = errorfields + 'Email';}
		else
		{errorfields = errorfields + ', Email';}

	}

	if (errorfields != '') 
	{
		alert('Bitte füllen Sie die folgenden Felder aus: ' + errorfields);
		error=1;
	}
	else
	{
		if (tmpAGB==0)
		{
			alert('Sie können die Leistungen nur buchen, wenn Sie den allgemeinen Geschäftsbedingungen zustimmen!');
			error=1;
		}
	}

if (error==0)
{
	if (tmpTelefon.substr (0,1) != '0')
	{
		alert('Bitte geben Sie eine gültige Telefonnummer ein!\n Die Telefonnummer muss mit einer "0" beginnen!');
		error=1;
	}
}

if (error==0)
{
	errornumbers='0123456789 ';
	for (i=0; i<tmpTelefon.length; i++)
	{
		if ( tmpTelefon.substr (i,1) != errornumbers.substr (0,1) && tmpTelefon.substr (i,1) != errornumbers.substr (1,1) && tmpTelefon.substr (i,1) != errornumbers.substr (2,1) && tmpTelefon.substr (i,1) != errornumbers.substr (3,1) && tmpTelefon.substr (i,1) != errornumbers.substr (4,1) && tmpTelefon.substr (i,1) != errornumbers.substr (5,1) && tmpTelefon.substr (i,1) != errornumbers.substr (6,1) && tmpTelefon.substr (i,1) != errornumbers.substr (7,1) && tmpTelefon.substr (i,1) != errornumbers.substr (8,1) && tmpTelefon.substr (i,1) != errornumbers.substr (9,1) && tmpTelefon.substr (i,1) != errornumbers.substr (10,1) && error==0)
		{
			alert('Bitte geben Sie eine gültige Telefonnummer ein!\nEs sind nur die folgenden Zeichen zugelassen: 0123456789 und das Leerzeichen!');
			error=1;
		}
	}
}

if (error==0)
{
	if (tmpTelefon.length < 7)
	{
		alert('Bitte geben Sie eine gültige Telefonnummer ein!');
		error=1;
	}
}

if (error==0)
	{bestaetigen(tmpVorname, tmpNachname, tmpStrasse, tmpPlz, tmpOrt, tmpTelefon, tmpTelefax, tmpEmail);}
else
	{Bestellformular(tmpVorname, tmpNachname, tmpStrasse, tmpPlz, tmpOrt, tmpTelefon, tmpTelefax, tmpEmail, tmpAGB);}
}

function bestaetigen(tmpVorname, tmpNachname, tmpStrasse, tmpPlz, tmpOrt, tmpTelefon, tmpTelefax, tmpEmail) {

	var html;
	var i;
	var arr_x;
	var str_x;
	var gesamt=0;
	var gesamtStr='';

	vorname=tmpVorname;
	nachname=tmpNachname;
	strasse=tmpStrasse;
	plz=tmpPlz;
	ort=tmpOrt;
	telefon=tmpTelefon;
	telefax=tmpTelefax;
	email=tmpEmail;

	html = '<html><head>';

	html = html + '</head>';
	html = html + '<body bgcolor=#EEEDFD><h3>Bitte bestätigen Sie Ihre Eingaben:</h3>';

	html = html + '<form name="formular" method="post" action="http://www.abzurkasse.de/send.php">';
	html = html + '<input type=hidden name="vname" value="' + vorname + '">';
	html = html + '<input type=hidden name="nname" value="' + nachname + '">';
	html = html + '<input type=hidden name="str" value="' + strasse + '">';
	html = html + '<input type=hidden name="plz" value="' + plz + '">';
	html = html + '<input type=hidden name="ort" value="' + ort + '">';
	html = html + '<input type=hidden name="tel" value="' + telefon + '">';
	html = html + '<input type=hidden name="fax" value="' + telefax + '">';
	html = html + '<input type=hidden name="email" value="' + email + '">';

	html = html + '<table><tr><td style="vertical-align:top"><font size=-1><b>Ihre Anschrift:</td><td width=20>&nbsp;</td>';
	html = html + '<td style="vertical-align:top"><font size=-1>';
	html = html + vorname + ' ' + nachname + '<br>';
	html = html + strasse + '<p>';
	html = html + plz + ' ' + ort + '</td><td width=20>&nbsp;</td><td style="vertical-align:top"><font size=-1>';

	if (telefon != '')
		{html = html + 'Tel: ' + telefon + '<br>';}
	if (telefax != '')
		{html = html + 'Fax: ' + telefax + '<br>';}
	if (email != '')
		{html = html + "E-Mail: " + email;}

	html = html + '</td></tr></table><p><br><table>';

	html = html + '<table border=0 cellpadding=0 cellspacing=0>';

	html = html + '<tr bgcolor=#7C7C7C><td width=50><font color="#FFFFFF"><b>&nbsp;&nbsp;&nbsp;Nr.</td><td><font color="#FFFFFF"><b>Beschreibung</td><td width=100>&nbsp;</td><td><font color="#FFFFFF"><b>Preis</td><td>&nbsp;</td></tr>';
	for (i=0; i < ArrPreis.length; i++) 
	{

		if (i % 2 > 0)
		{
			color='#C0C0C0';
		}
		else
		{
			color='#E6E6E6';
		}

		gesamt = gesamt + eval(ArrPreis[i]);
		arr_x = ArrPreis[i].split(".");
		str_x = arr_x[0] + "," + arr_x[1];

		html = html + '<tr bgcolor="' + color + '"><td style="vertical-align:top"><font size=-1><b>&nbsp;&nbsp;&nbsp;' + (eval(i)+1) + '.</td><td style="vertical-align:top"><font size=-1><b>' + ArrArtikel[i] + '</b></td><td style="vertical-align:top">&nbsp;</td><td style="vertical-align:top"><font size=-1><b>' + str_x + ' EUR</b></td></tr>';

		html = html + '<tr bgcolor="' + color + '"><td colspan=5>&nbsp;</td></tr>';
	}


	if (i % 2 > 0)
	{
		color='#C0C0C0';
		grafik="remove.gif";
	}
	else
	{
		color='#E6E6E6';
		grafik="remove.gif";
	}

	if (gesamt < 50)
	{
		gesamt=gesamt+4;
		html = html + '<tr bgcolor="' + color + '"><td style="vertical-align:top"><font size=-1><b>&nbsp;&nbsp;&nbsp;1 x </td><td style="vertical-align:top"><font size=-1><b>Versandkostenanteil</b></td><td style="vertical-align:top">&nbsp;</td><td style="vertical-align:top"><font size=-1><b>4 EUR</b></td><td style="vertical-align:top">&nbsp;</td></tr>';
	}

	gesamtStr = runde(gesamt);


	html = html + '<tr><td colspan=2>&nbsp;</td><td bgcolor="#7C7C7C" align=right><font color="#FFFFFF"><b>Gesamt:&nbsp;&nbsp;&nbsp;</td><td bgcolor="#7C7C7C"><font size=-1 color="#FFFFFF"><b>' + gesamtStr + ' EUR</td><td bgcolor="#7C7C7C">&nbsp;</td></tr>';
	html = html + '</table>';

	for (i=0; i < ArrPreis.length; i++) 
	{
		html = html + '<input type="hidden" name="Leistung' + (i+1);
		html = html + '" value="' + ArrArtikel[i];

		html = html + ' / Preis: ' + ArrPreis[i] + 'EUR';

		html = html + '">';
	}

	html=html+'<input type="hidden" name="gesamt" value="'+gesamtStr+'">';

	html = html + '	<font size=-1><b><p>Gewünschte Zahlungsart: <select NAME="zahlung" size="1">';
	html = html + '	<option SELECTED VALUE="Vorkasse">Vorauskasse</option>';
	html = html + '	<option VALUE="Nachnahme">Nachnahme (zzgl. 8 EUR)</option>';
	html = html + '	</select>';

	if (browsertyp==1)
		{html = html + '<table><tr><td style="vertical-align:top"><input type=image src="http://www.abzurkasse.de/send.gif" width="121" height="30"></form></td><td style="vertical-align:top"><form name=zurueck><input type=image src="http://www.abzurkasse.de/back.gif" width="121" height="30" onclick="parent.Oben.Bestellformular(\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\')"></td></tr></table>';}
	else
		{html = html + '<table><tr><td style="vertical-align:top"><input type="SUBMIT" name="Abschicken" value="Bestellung abschicken" onclick="funktion()"></td><td style="vertical-align:top"><form name=zurueck><input type="reset" name="back" value="Zurück" onclick="parent.Oben.Bestellformular(\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\')"></td></tr></table>';}

	html = html + '</body></html>'

	parent.Inhalt.document.close();
	parent.Inhalt.document.open ("text/html");
	parent.Inhalt.document.write (html);
}

function selectWert(sObj) {
  with (sObj) return options[selectedIndex].value;
}