<!--

  function add(i_id,i_name,i_no,i_price,i_weight,i_discount) {
	
		i_amount = eval('document.forms[0].amount_'+i_id).value;
			  	if(i_amount <= '0')     
{
alert("Damit wir Ihre Bestellung bearbeiten können, ist es notwendig, dass Sie zumindest einen Artikel auswählen!");       
return false;     
}
    
		stop = 0;
		temp = '';
		tempvars = '';
		tempvarsprice = 0.00;
		tempvarsno = '';
		tempvarsid = '';
    for(i=0;i<document.forms[0].elements.length;i++) {
		  if (document.forms[0].elements[i].name.indexOf('sel_'+i_id+'_') > -1 && stop == 0) {
			  for(y=0;y<document.forms[0].elements[i].options.length;y++) {
				  if (document.forms[0].elements[i].options[y].selected == true){
					  if (document.forms[0].elements[i].options[y].value == 'not_sel') {
						  alert('Bitte wählen sie zuerst einen Wert aus für: '+document.forms[0].elements[i].options[y].text);
							stop = 1;
						}
						else {
						  temp = document.forms[0].elements[i].options[y].value.split('|');
						  tempvars = tempvars + temp[0]+', ';
  						tempvarsprice = parseFloat(tempvarsprice) + parseFloat(temp[1]);
							tempvarsno = tempvarsno + temp[2] + '-';
							tempvarsid = tempvarsid + temp[3] + '_';	}}}}}
							
		if (tempvarsno != '') {
		  tempvarsno = tempvarsno.substring(0,tempvarsno.length - 1); }							
							
    
		i_text = '';
		for(i=0;i<document.forms[0].elements.length;i++) {
		  if (document.forms[0].elements[i].name.indexOf('i_text_'+i_id+'_') > -1 && stop == 0) {
			  if (document.forms[0].elements[i].value == '') {
				  alert('Bitte Text eingeben !');
					stop = 1;
				}				
				else {
				  i_text = document.forms[0].elements[i].value; }
			}
		}						
								
		if (stop == 0) {
		  if (tempvars.length > 0) {
			  tempvars = tempvars.substring(0,tempvars.length - 2);	}
				
		  exists = 0;		
			for(i=0;i<parent.basket.idx.length;i++) {
			  tempid = parent.basket.idx[i];
				if (tempid == i_id + tempvarsid + i_text) {
				  x = i;
					i_amount = parseInt(i_amount) + parseInt(parent.basket.amount[x]);
					exists = 1; }}
						
      if (exists == 0) {
  	    x = parent.basket.idx.length; }
				
      parent.basket.amount[x] = i_amount;
  		parent.basket.idx[x] = i_id + tempvarsid + i_text;
	  	parent.basket.name[x] = i_name;
  		if (tempvarsno != '') {
	  	  parent.basket.no[x] = i_no + '-' +tempvarsno; }
      else {
	  	  parent.basket.no[x] = i_no; }		  		
			parent.basket.weight[x] = i_weight;
  		parent.basket.itemprice[x] = parent.round(parseFloat(i_price) + parseFloat(tempvarsprice));
			parent.basket.variants[x] = tempvars;
			parent.basket.itemtext[x] = i_text;
			
	  	
		  result = 0.00;
  		resultprice = 0.00;
	  	temp = i_discount.split('|');
      if (temp.length > 0) {
		    for(a=0;a<temp.length;a++) {
			    curtemp = temp[a].split('#');
  				am = curtemp[0];
	  			pr = curtemp[1];
		  		if(parseInt(i_amount) >= parseInt(am)) {
			  	  result = pr; }}}
  		resultprice = parseFloat(parent.basket.itemprice[x]) - ((parseFloat(parent.basket.itemprice[x]) / 100.00) * parseFloat(result));
			parent.basket.itemdiscount[x] = i_discount;
	  	parent.basket.price[x] = parent.round(resultprice);
      parent.basket.total[x] = parent.round(parseFloat(parent.basket.amount[x]) * parseFloat(parent.basket.price[x])); 			
  		parent.basketstateFrame.location.reload();
  				
	  }		
	}
	
	function openrab(str,iname,iprice) {
    F1 = window.open("about:blank","Fenster1","width=400,height=200,left=200,top=100");	
	  temp = str.substring(0,str.length-1);
		temp1 = temp.split('|');
    body = ''; 
		for (i=0;i<temp1.length;i++) {
		  temp2 = temp1[i];
			temp3 = temp2.split('#');
			eprice = parseFloat(iprice) - ((parseFloat(iprice) / 100.00) * parseFloat(temp3[1]));
			eprice = F1.opener.parent.round(eprice);
			body = body + '<tr><td align="right" style="border-right:1px solid black;">'+temp3[0]+'<\/td>\n'
			       +'<td align="right" style="border-right:1px solid black;"><b>'+eprice+' &euro;</b><\/td>\n'
			       +'<td align="right">'+temp3[1]+'%<\/td><\/tr>\n';
		}
		header = '<html>\n'
		        +'<head>\n'
						+'<title>Mengenrabatt !<\/title>\n'
						+'<link rel="stylesheet" type="text\/css" href="..\/styles\/main.css" \/>\n'
						+'<body>\n'
						+'<p><b>'+iname+' Grundpreis: '+iprice+' &euro;<\/b><\/p>\n'
						+'<table border="0" cellspacing="0" cellpadding="5" style="border:1px solid black;" width="100%" align="center">\n'
						+'<tr>\n'
						+'<th class="bgdark" style="border:0px solid black;border-bottom:1px solid black;"><span class="fgwhite">ab Menge:<\/span><\/th>\n'
						+'<th class="bgdark" style="border:0px solid black;border-bottom:1px solid black;"><span class="fgwhite">Preis<\/span><\/th>\n'
						+'<th class="bgdark" style="border:0px solid black;border-bottom:1px solid black;"><span class="fgwhite">Prozent:<\/span><\/th>\n'												
						+'<\/tr>\n';
    footer = '<\/table>\n'
		        +'<p align="right"><a href="javascript:self.close();">Fenster schließen<\/a><\/p>\n'
		        +'<\/body><\/html>\n';
		i_text = header + body + footer;
    F1.document.writeln(i_text);		
	}
-->

