/*
 * Copyright 2008, Peter Rowntree. All Rights Reserved.
 * http://www.hdyn.com/wr/common/contact.php?addr=pr
 * needs: nothing
 * fake visa:
 * http://localhost/payPalStd/ccNums.php
 * 000
 * exp. in future
 */
 
//------------------------------settings----------------------------------------
var g_sandbox=false;
var g_ppAcctEmail=g_sandbox?"paypal_1186716406_biz@hdyn.com":"hdpaypal@hdyn.com";
//------------------------------------------------------------------------------

function pay()
{  
   try
   {
   		var domainName=document.getElementById("domain").value;
      var f=document.getElementById("f2");
      f.custom.value=domainName;
      f.item_name.value="hosting ("+domainName+")";	//127 chars max
      f.business.value=g_ppAcctEmail;
      f.action=g_sandbox?"https://www.sandbox.paypal.com/cgi-bin/webscr":"https://www.paypal.com/cgi-bin/webscr";
      f.method="post";
      f.submit();
   }
   catch(e)
   {
      alert(typeof e.message == "undefined" ? e : e.message);
   }
}

//appropriate for query str; does not entitize "&"; assumes keys are OK; encodes vals
function buildKVStr(keyArr,valArr)
{
	var outArr=[];
	for(var i=0; i<keyArr.length; ++i)
	{
		outArr[i]=keyArr[i]+"="+encodeURIComponent(valArr[i]);
	}
	return outArr.join("&");
}