// Nicola Zordan, 18:36 3/16/2001
// PayPal 


function PayPalURL(PayPalUser,returnPage,item,itemType,price,shipping,quantity,image) {
// URL Sample, Quantity=1
// https://www.paypal.com/xclick/
// business=Nicola.Zordan@bigfoot.com
// &item_name=A
// &item_number=An
// &amount=10.00
// &shipping=9.00
// &shipping2=8.00
// &qunatity=12.00
// &undefined_quantity=11.00
// &handling=7.00
// &image_url=http://www.NicolaZordan.net/Nik/nz_logo.gif
// &return=http://www.NicolaZordan.net/JavaWeb/objects.htm
// &cancel_return=http%3A//www.NicolaZordan.net/JavaWeb/objects.htm
// &no_shipping=1

//var PayPalGeneric='https://secure.paypal.com/xclick/business=Nicola.Zordan%40bigfoot.com&undefined_quantity=1&item_name=BarChart&item_number=JavaWeb+Download&amount=20.00&shipping=0.01&return=http%3A//www.mclink.it/personal/MC2074/JavaWeb/objects.htm';
var PayPal='https://secure.paypal.com/xclick/';
var returnURL=returnPage, userEmail=PayPalUser;
  PayPal='https://secure.paypal.com/xclick/';  
  if (userEmail == null || userEmail == '') { userEmail='Nicola.Zordan@bigfoot.com'; };
  if (userEmail != null && userEmail != '') { PayPal=PayPal+'business='+userEmail; }; 
  if (item != null && item != '') { PayPal=PayPal+'&item_name='+item; }; 
  if (itemType != null && itemType != '') { PayPal=PayPal+'&item_number='+itemType; }; 
  if (price != null && price != '') { PayPal=PayPal+'&amount='+price; }; 
  if (shipping != null && shipping != '') { PayPal=PayPal+'&shipping='+shipping; }; 
//  if (shipping2 != null && shipping2 != '') { PayPal=PayPal+'&shipping2='+shipping2; };
//  if (handling != null && handling != '') { PayPal=PayPal+'&handling='+handling; };
//  if (quantity != null && quantity != '' && quantity != 0) { PayPal=PayPal+'&quantity='+quantity; }; 
//  if (quantity != null && quantity != '' && quantity != 0) { PayPal=PayPal+'&undefined_quantity='+quantity; }; 
  if (quantity != null && quantity != '' && quantity != 0) { PayPal=PayPal+'&quantity='+quantity; }
   else { PayPal=PayPal+'&undefined_quantity=1'; };
  if (image != null && image != '') { PayPal=PayPal+'&image_url='+image; }; 
  if (returnURL == null || returnURL=='') { returnURL= 'http://www.NicolaZordan.net/JavaWeb/objects.htm' };  
  PayPal=PayPal+'&return='+returnURL;  
  PayPal=PayPal+'&cancel_return='+returnURL;  
//alert('f:['+PayPal+'] \nh: ['+'https://secure.paypal.com/xclick/business=Nicola.Zordan%40bigfoot.com&undefined_quantity=1&item_name=Fuzzy&item_number=Smalltalk+Download&amount=50.00&shipping=0.01&return=http%3A//www.mclink.it/personal/MC2074/Smalltalk/objects.htm'+']');
//  PayPal=PayPal+'&cancel_return='+returnURL;  
  return(PayPal);
};

function PayPalAddToCartURL(PayPalUser,returnPage,item,itemType,price,shipping,quantity,image) {
// URL Sample
// https://www.paypal.com/cart/
// add=1
// &business=Nicola.Zordan@bigfoot.com
// &item_name=B
// &item_number=Bn
// &amount=10.00
// &shipping=9.00
// &shipping2=8.00
// &handling=7.00
// &image_url=http://www.NicolaZordan.net/Nik/nz_logo.gif
// &return=http://www.NicolaZordan.net/JavaWeb/objects.htm
// &cancel_return=http://www.NicolaZordan.net/JavaWeb/objects.htm

var Quantity;
var PayPal='https://www.paypal.com/cart/';
var returnURL=returnPage, userEmail=PayPalUser;
  PayPal='https://secure.paypal.com/cart/';  
  Quantity=1;
  if (quantity != null && quantity != '' && quantity != 0) { Quantity = quantity; };
  if (Quantity != null && Quantity != '' && Quantity != 0) { PayPal=PayPal+'add='+Quantity; };
//  if (quantity != null && quantity != '' && quantity != 0) { PayPal=PayPal+'&undefined_quantity='+quantity; }; 
  if (userEmail == null || userEmail == '') { userEmail='Nicola.Zordan@bigfoot.com'; };
  if (userEmail != null && userEmail != '') { PayPal=PayPal+'&business='+userEmail; }; 
  if (item != null && item != '') { PayPal=PayPal+'&item_name='+item; }; 
  if (itemType != null && itemType != '') { PayPal=PayPal+'&item_number='+itemType; }; 
  if (price != null && price != '') { PayPal=PayPal+'&amount='+price; };
  if (shipping != null && shipping != '') { PayPal=PayPal+'&shipping='+shipping; }; 
//  if (shipping2 != null && shipping2 != '') { PayPal=PayPal+'&shipping2='+shipping2; };
//  if (handling != null && handling != '') { PayPal=PayPal+'&handling='+handling; };
  if (image != null && image != '') { PayPal=PayPal+'&image_url='+image; }; 
//  PayPal=PayPal+'&undefined_quantity=1';
  if (returnURL == null || returnURL=='') { returnURL= 'http://www.NicolaZordan.net/JavaWeb/objects.htm' };  
  PayPal=PayPal+'&return='+returnURL;  
  PayPal=PayPal+'&cancel_return='+returnURL;  
//alert('f:['+PayPal+'] \nh: ['+'https://secure.paypal.com/xclick/business=Nicola.Zordan%40bigfoot.com&undefined_quantity=1&item_name=Fuzzy&item_number=Smalltalk+Download&amount=50.00&shipping=0.01&return=http%3A//www.mclink.it/personal/MC2074/Smalltalk/objects.htm'+']');
  return(PayPal);
};

function PayPalWriteURL(userEmail,returnPage,item,itemType,price,shipping) {
  document.write('<A HREF="'+PayPalURL(userEmail,returnPage,item,itemType,price,shipping)+'" target="_blank">');
//You need to add the closing reference </A>
};

function PayPalWrite(payText,userEmail,returnPage,item,itemType,price,shipping) {
var text=payText;
  PayPalWriteURL(userEmail,returnPage,item,itemType,price,shipping);
  document.write('<IMG SRC="http://www.NicolaZordan.net/Nik/dollars.gif" BORDER="0" ALT="Pay" align="top">');
  document.write(text);
  document.write('</A>');
};

var PayPalWindow;
function PayPalOpen(windowName,userEmail,returnPage,item,itemType,price,shipping) {
var windowID=windowName, url;
  if (windowID== null || windowID == '') { windowID='PayPal'; };
  url=PayPalURL(userEmail,returnPage,item,itemType,price,shipping);
  PayPalWindow=window.open(url,windowID);
  PayPalWindow.focus();
};

function PayPalWriteOpen(payText,windowName,userEmail,returnPage,item,itemType,price,shipping) {
var text=payText;
  document.write('<A HREF="JavaScript:PayPalOpen(\''+payText+'\',\''+windowName+'\',\''+userEmail+'\',\''+returnPage+'\',\''+item+'\',\''+itemType+'\',\''+price+','+shipping+')">');
  document.write('<IMG SRC="http://www.NicolaZordan.net/Nik/dollars.gif" BORDER="0" ALT="Pay" align="top">');
  document.write(text);
  document.write('</A>');
};



//good
//https://secure.paypal.com/xclick-auction/business=Nicola.Zordan%40bigfoot.com&method=magic&shipping=5
// bad https://secure.paypal.x.com/xclick/business=Nicola.Zordan%40bigfoot.com&undefined_quantity=1&item_name=BarChart&item_number=JavaWeb+Download&amount=20.00&shipping=0.01&return=http%3A//www.mclink.it/personal/MC2074/JavaWeb/objects.htm
//https://secure.paypal.com/xclick/business=Nicola.Zordan%40bigfoot.com&undefined_quantity=1&item_name=BarChart&item_number=JavaWeb+Download&amount=20.00&shipping=0.01&return=http%3A//www.mclink.it/personal/MC2074/JavaWeb/objects.htm

//HREF Generic
//<A HREF="https://secure.paypal.com/xclick/business=Nicola.Zordan%40bigfoot.com&undefined_quantity=1&return=http%3A//www.mclink.it/personal/MC2074/Smalltalk/objects.htm" target="_blank">
//<IMG SRC="http://images.paypal.com/images/x-click-but8.gif" BORDER="0" ALT="Make payments with PayPal - it's fast, free and secure!" align="right">
//<IMG SRC="http://www.mclink.it/personal/MC2074/Nik/dollars.gif" BORDER="0" ALT="Register and pay now" align="top">
//Register</A>

//HREF Specific
//<A HREF="https://secure.paypal.com/xclick/business=Nicola.Zordan%40bigfoot.com&undefined_quantity=1&item_name=Fuzzy&item_number=Smalltalk+Download&amount=50.00&shipping=0.01&return=http%3A//www.mclink.it/personal/MC2074/Smalltalk/objects.htm" target="_blank"><IMG SRC="http://www.mclink.it/personal/MC2074/Nik/dollars.gif" BORDER="0" ALT="Register and pay now" align="top">
//Register</A>



//Simple
//https://secure.paypal.com/xclick-auction/business=Nicola.Zordan%40bigfoot.com&method=magic&shipping=5

//Generic
//https://secure.paypal.com/xclick/business=Nicola.Zordan%40bigfoot.com&undefined_quantity=1&return=http%3A//www.mclink.it/personal/MC2074/JavaWeb/objects.htm
//https://secure.paypal.com/xclick/business=Nicola.Zordan%40bigfoot.com&undefined_quantity=1&item_name=BarChart&item_number=JavaWeb+Download&amount=20.00&shipping=0.01&return=http%3A//www.mclink.it/personal/MC2074/JavaWeb/objects.htm

//Base
//https://secure.paypal.com/xclick/business=Nicola.Zordan%40bigfoot.com&undefined_quantity=1&return=http%3A//www.NicolaZordan.net/Nik/PayPal.htm


