var warenkorb = new Array();
var nArraySize;
var nCurModus = 0;
var sCurImage;

var bReFill = 0;
var bNavBar = 0;

var nSize = 8;

var aProductArray = new Array(nSize);

var nPos = 0;

for (i = 0; i < nSize; i++)
{
	aProductArray[i] = new Array(2);
}

aProductArray[0][0] = "Spezialthemen";
aProductArray[0][1] = 0.0;

aProductArray[1][0] = "Aktien USA";
aProductArray[1][1] = 0.00;

aProductArray[2][0] = "Aktien Europa";
aProductArray[2][1] = 0.00;

aProductArray[3][0] = "Aktien Osteuropa";
aProductArray[3][1] = 0.00;

aProductArray[4][0] = "Aktien Asien";
aProductArray[4][1] = 0.00;

aProductArray[5][0] = "Aktien Schwellenlände/Osteuropa";
aProductArray[5][1] = 0.00;

aProductArray[6][0] = "Devisen- und Rentenmärkte";
aProductArray[6][1] = 0.00;

aProductArray[7][0] = "Rohstoffe";
aProductArray[7][1] = 0.00;
	
 function SetBestellung()
 {
 	var bArtikel = 0;
 	if (document.cookie.indexOf(1) > -1)
	{
		window.document.senden.fAktienNordAmerika.checked = true;
		thema1.src=img1.src;
		bArtikel = 1;
	}
	
	if (document.cookie.indexOf(2) > -1)
	{
		window.document.senden.fAktienEuropa.checked = true;
		thema2.src=img2.src;
		bArtikel = 1;
	}
	
	if (document.cookie.indexOf(4) > -1)
	{
		window.document.senden.fAktienAsien.checked = true;
		thema4.src=img4.src;
		bArtikel = 1;
	}
	
	if (document.cookie.indexOf(5) > -1)
	{
		window.document.senden.fAktienSchwellenlaender.checked = true;
		thema3.src=img3.src;
		bArtikel = 1;
	}
	
	if (document.cookie.indexOf(6) > -1)
	{
		window.document.senden.fDevisenUndRentenmaerkte.checked = true;
		thema5.src=img5.src;
		bArtikel = 1;
	}
	
	if (document.cookie.indexOf(7) > -1)
	{
		window.document.senden.fRohstoffe.checked = true;
		thema6.src=img6.src;
		bArtikel = 1;
	}
	
	if (bArtikel == 1)
	{
		thema7.src=img7.src;
	}
 }
 
 

	
 function check()
 {
   if((window.document.senden.fName.value == "") ||
   	(window.document.senden.fVorname.value == "") ||
   	(window.document.senden.fStrasse.value == "") ||
   	(window.document.senden.fPlz.value == "") ||
   	(window.document.senden.fOrt.value == "") ||
   	(window.document.senden.fLand.value == "") ||
   	(window.document.senden.fMail.value == "") ||
   	(window.document.senden.fBankinstitut.value == "") ||
   	(window.document.senden.fBankleitzahl.value == "") ||
   	(window.document.senden.fKontonummer.value == "") ||
   	(window.document.senden.fKontoinhaber.value == "") ||
   	(window.document.senden.fTelefon.value == ""))
   {
   	alert('Sie müssen alle Pflichtfelder ausfüllen !');
   	return;
   }
   
   if (window.document.senden.fMail.value.indexOf("@") == -1)
   {
   	alert('Sie müssen eine gültige E-MAIL Adresse angeben !');
   	return;
   }
   
   if(window.document.senden.fAGB.checked == false)
   {
   	alert('Sie müssen die AGB akzeptieren, anderenfalls ist eine Bestellung nicht möglich.');
   	return;
   }
   

    if(/*(window.document.senden.fAktienOsteuropa.checked == false) && */
	(window.document.senden.fAktienEuropa.checked == false) &&
	(window.document.senden.fAktienNordAmerika.checked == false) &&
	(window.document.senden.fAktienAsien.checked == false) &&
	(window.document.senden.fAktienSchwellenlaender.checked == false) &&
	(window.document.senden.fDevisenUndRentenmaerkte.checked == false) &&
	(window.document.senden.fRohstoffe.checked == false) &&
	(window.document.senden.fSpezialthemen.checked == false))
   {
   	alert('Sie müssen mindestens einen Themenbereich auswählen, anderenfalls ist eine Bestellung nicht möglich.');
   	return;
   }
     
   window.document.senden.submit();

 }

function AddWarenkorb(nr)
{
	if (document.cookie.indexOf(nr) == -1)
	{
		document.cookie =  document.cookie + "|" + nr;
		window.location.reload();
	}
}

function GetEuro(value)
{
	var preis;
	preis = parseFloat(value);
	return preis.toFixed(2) + " €";
}




function PrintPayPal()
{
	var data     = "";
	var sAnzahl  = "";
	var sPreis   = "";
	 
	if (document.cookie) 
	{
		erstellen();
		
		document.write('<form name="paypal_send" action="https://www.paypal.com/cgi-bin/webscr" method="post">');
		document.write('<input type="hidden" name="cmd" value="_xclick" />');
   		document.write('<input type="hidden" name="business" value="seller_1200849069_biz@it-sorge.de " />'); // info@haku-shop.de
   		document.write('<input type="hidden" name="item_name" value="Ihre Haku-Shop Bestellung" />');
   		document.write('<input type="hidden" name="amount" value="' + berechnen_paypal() + '" />');
   		document.write('</form><script>document.cookie="";document.paypal_send.submit();</script>');
 	} 
	else 
	{
		sAnzahl  = "0";
		sPreis   = "0.00";
	}
}


function Recalc(nr)
{	
	if (document.cookie.indexOf(nr) == -1)
	{
		AddWarenkorb(nr);
	}
	else
	{
		var data = "";
		
		for(j = 1; j<8; j++)
		{	
			if ((document.cookie.indexOf(j) > -1) && (j != nr))
			{
				data += ("" + j + "|");
			}
		}
		
		document.cookie = data;
		window.location.reload();	
	}
}


function GetPreis()
{
	var dPreis = 0.0;
	
	for(j = 1; j<8; j++)
	{	
		if (document.cookie.indexOf(j) > -1)
		{
			dPreis   += aProductArray[j][1];
		}
	}	
	
	document.write(dPreis.toFixed(2));
}

function PrintWarenkorbInfo()
{
	var dPreis = 0.0;
	var dAnzahl = 0;
	 
	if (document.cookie) 
	{
		
		
		data = document.cookie;
 		
 		for(j = 1; j<8; j++)
		{	
			if (document.cookie.indexOf(j) > -1)
			{
				if (j%2 != 0)
				{
					document.write('<tr  id="normal" style="background-color:#FFFFFF"><td colspan="2" width="150">');
					document.write(aProductArray[j][0]);
					document.write('</td></tr>');
				}
				else
				{				
					document.write('<tr  id="normal" style="background-color:#EEEEEE"><td colspan="2" width="150">');
					document.write(aProductArray[j][0]);
					document.write('</td></tr>');
				}
				
				dAnzahl++;
				dPreis   += aProductArray[j][1];
			}
		}
		
	} 
	else 
	{
		sPreis   = "0.00";
	}
		
	document.write('<tr  id="normal" style="background-color:#EEEEEE;"><td width="90">');
	
	if (dAnzahl == 1)
	{
		document.write('<b>' + dAnzahl +  ' Position</b>');
     	}
     	else
     	{
		document.write('<b>' + dAnzahl +  ' Positionen</b>');
        }
        
        document.write('</td>');
        document.write('<td align="right" width="60" nowarp>');
        document.write('<b> ' + dPreis.toFixed(2) + ' €</b>');
        document.write('</td></tr>');
        
}

