<!-- Paypal Shopping feature -->
<form style="margin-bottom:0px;" name="paypalview" action="https://www.paypal.com/cgi-bin/webscr/" method="post">
	<input type="hidden" name="cmd" value="_cart" />
	<input type="hidden" name="business" value="${paypalEmail}" />
	<input type="hidden" name="display" value="1" />
</form>                  
<form style="margin-bottom:0px;" name="paypal" action="https://www.paypal.com/cgi-bin/webscr/" method="post">
	<input type="hidden" name="cmd" value="_cart" />
	<input type="hidden" name="add" value="1" />
	<input type="hidden" name="business" value="${paypalEmail}" />
	<input type="hidden" name="currency_code" value="${paypalCurrency}" />
	<input type="hidden" name="amount" value="" />       
	<input type="hidden" name="item_name" value="" />
	<input type="hidden" name="item_number" value="" />
<%            
	int i, j; 

	if (chameleon.paypalShippingUsed)
		out.println("\t<input type=\"hidden\" name=\"shipping\" value=\"\" />");
		
	if (!chameleon.isEmpty(chameleon.paypalHandling)) {
		if (chameleon.paypalHandlingCartwise)
			out.println("\t<input type=\"hidden\" name=\"handling_cart\" value=\"" + chameleon.paypalHandling + "\" />");
		else
			out.println("\t<input type=\"hidden\" name=\"handling\" value=\"" + chameleon.paypalHandling + "\" />");
	}
	
	if (chameleon.usePaypalInline) {
		
		// Paypal hint
		out.println("\t<strong>" + chameleon.paypalHint + "</strong>");
		
		// All items as Radio buttons
		if (chameleon.paypalItemsCount > 1) {
			for (i = 0; i < chameleon.paypalItemsCount; i++) {
				out.println("\t<label><input type=\"radio\" name=\"options\" value=\"" + i + "\" onclick=\"updatePrice(" + i + ")\"/>" + 
					chameleon.paypalItems[i][0] + "</label>");
			}
		}
		
		// Select box
		if (chameleon.paypalUseSelect) {
			out.println("\t<input type=\"hidden\" name=\"on0\" value=\"$text.selected\" />");
			out.println("\t<select name=\"os0\">");
			for (i = 0; i < chameleon.paypalSelectCount; i++)
				out.println("\t<option value=\"" + chameleon.paypalSelect[i] + "\">" + chameleon.paypalSelect[i] + "</option>");
			out.println("\t</select>");
		}
		
		// Quantity box
		if (chameleon.paypalUseQuantity)
			out.println("\t<input type=\"text\" name=\"quantity\" value=\"1\" size=\"2\" />");
			
		// Price box (=0 when more than 1 options - controlled by JavaScript to display selected options price)
		out.print("\t&nbsp;<input style=\"font-size:90%; border:1px solid #888888; text-align:center;\" type=\"text\" name=\"price\" id=\"price\" readonly=\"readonly\" value=\"" + chameleon.paypalCurrency + " ");
		if (chameleon.paypalItemsCount > 1)
			out.print("0");
		else
			out.print(chameleon.paypalItems[0][1]);
		out.println("\" size=\"12\" />");
		
		// Add to cart button - Form sent by JavaScript
		out.println("\t&nbsp;<span class=\"current\"><a href=\"javascript:submitPaypal();\">&nbsp;" + chameleon.replaceString(texts.getString("addtoCart"), " ", "&nbsp;") + "&nbsp;</a></span>");
		// View Cart button - Form sent by JavaScript
		out.println("\t&nbsp;<span class=\"current\"><a href=\"javascript:viewPaypal();\">&nbsp;" + chameleon.replaceString(texts.getString("viewCart"), " ", "&nbsp;") + "&nbsp;</a></span>");	
	}
	else {
		
		if (chameleon.paypalUseSelect) {
			out.println("\t<input type=\"hidden\" name=\"on0\" value=\"$text.selected\" />");
			out.println("\t<input type=\"hidden\" name=\"os0\" value=\"\" />");
		}

		if (chameleon.paypalUseQuantity)
			out.println("\t<input type=\"hidden\" name=\"quantity\" value=\"1\" />");

		out.println("\t<div style=\"padding:4px; text-align:center;\"><span class=\"comment\">" + chameleon.paypalHint + "</span></div>");
		out.println("\t<table cellspacing=\"2\" cellpadding=\"2\" border=\"0\" align=\"center\">");
		
		// All items as separate lines with "Add to cart" buttons
			
		for (i = 0; i < chameleon.paypalItemsCount; i++) {
			out.println("\t<tr><td class=\"smalltxt\" style=\"text-align:left; font-weight:bold;\">" + chameleon.paypalItems[i][0] + "</td>");
			
			// Select box
			
			if (chameleon.paypalUseSelect) {
				out.println("\t<td><select name=\"select" + i + "\">");
				
				for (j = 0; j < chameleon.paypalSelectCount; j++)
					out.println("\t\t<option value=\"" + chameleon.paypalSelect[j] + "\">" + chameleon.paypalSelect[j] + "</option>");
				
				out.println("\t</select></td>");
			}

			// Quantity box
			if (chameleon.paypalUseQuantity)
				out.println("\t<td><input type=\"text\" name=\"quantity" + i + "\" value=\"1\" size=\"2\" /></td>");

			// Price (+ shipping)

			out.print("\t<td class=\"smalltxt\">" + chameleon.paypalCurrency + " " + chameleon.paypalItems[i][1]);
			
			if (chameleon.paypalShippingUsed && chameleon.paypalItems[i][2].length() > 0)
				out.print(" (+" + chameleon.paypalItems[i][2] + ")");
			
			out.println("</td>");
			
			// Add to cart button - Form sent by JavaScript
			out.println("\t<td class=\"current\"><a href=\"javascript:submitPaypal(" + i + ");\">&nbsp;" + chameleon.replaceString(texts.getString("addtoCart"), " ", "&nbsp;") + "&nbsp;</a></td></tr>");
			
		}
		
		out.println("\t</table>");
		
		// View Cart button - Form sent by JavaScript
		out.println("\t<div style=\"padding:4px; text-align:center;\"><span class=\"current\" style=\"padding:4px;\"><a href=\"javascript:viewPaypal();\">&nbsp;" + chameleon.replaceString(texts.getString("viewCart"), " ", "&nbsp;") + "&nbsp;</a></span></div>");	
	}
%>
</form>
