// <img src="images/x-click-but22.gif" title="Order this using PayPal" border="0" style="cursor:pointer; vertical-align: bottom;" onclick="PayPalTransaction('BOOK: Mei Ling discovers Jack Miner','ISBN: 0-9699984-2-2' , '7.95', 'USD');" />

function PayPalTransaction (vitem_name, vitem_number, vamount, vcurrency_code) {

	if (!document.getElementById('PPForm')) {
		
		form 					= document.createElement("form");
		form.id 				= 'PPForm';
		form.action				= 'https://www.paypal.com/cgi-bin/webscr';
		form.method				= 'post';
		form.target				= 'paypal';	
		
		cmd						= document.createElement("input");
		business				= document.createElement("input");
		no_shipping				= document.createElement("input");
		vreturn					= document.createElement("input");
		cancel_return			= document.createElement("input");
		add						= document.createElement("input");
		item_name				= document.createElement("input");
		item_number				= document.createElement("input");
		amount					= document.createElement("input");
		currency_code			= document.createElement("input");
	
		
		cmd.type 				= 'hidden';
		business.type			= 'hidden';
		no_shipping.type		= 'hidden';
		vreturn.type 			= 'hidden';
		cancel_return.type		= 'hidden';
		add.type				= 'hidden';
		item_name.type			= 'hidden';
		item_number.type		= 'hidden';
		amount.type				= 'hidden';
		currency_code.type		= 'hidden';
		
		
		cmd.id 					= 'cmd';
		business.id				= 'business';
		no_shipping.id			= 'no_shipping';
		vreturn.id 				= 'return';
		cancel_return.id		= 'cancel_return';
		add.id					= 'add';
		item_name.id			= 'item_name';
		item_number.id			= 'item_number';
		amount.id				= 'amount';
		currency_code.id		= 'currency_code';
		
		
		cmd.name 				= 'cmd';
		business.name			= 'business';
		no_shipping.name		= 'no_shipping';
		vreturn.name 			= 'return';
		cancel_return.name		= 'cancel_return';
		add.name				= 'add';
		item_name.name			= 'item_name';
		item_number.name		= 'item_number';
		amount.name				= 'amount';
		currency_code.name		= 'currency_code';	
		
			
		form.appendChild(cmd);
		form.appendChild(business);
		form.appendChild(no_shipping);
		form.appendChild(vreturn);
		form.appendChild(cancel_return);
		form.appendChild(add);
		form.appendChild(item_name);
		form.appendChild(item_number);
		form.appendChild(amount);
		form.appendChild(currency_code);
		
		document.body.appendChild(form);	
	}
	
	document.getElementById('cmd').value 			= '_cart';
	document.getElementById('business').value 		= 'janetruestorybooks@yahoo.ca';
	document.getElementById('no_shipping').value 	= '1';
	document.getElementById('return').value 		= 'http://www.truestorybooks.com/';
	document.getElementById('cancel_return').value 	= 'http://www.truestorybooks.com/';
	document.getElementById('add').value 			= '1';
	document.getElementById('item_name').value 		= vitem_name;
	document.getElementById('item_number').value 	= vitem_number;
	document.getElementById('amount').value 		= vamount;
	if (vcurrency_code != undefined)
		document.getElementById('currency_code').value 		= vcurrency_code;	
		
	document.getElementById('PPForm').submit();
}
