protected void RedirectToPaypal(decimal AMOUNT)
    {
        String saleString = Request.QueryString["Sale"];
        String companyString = Request.QueryString["Company"];
        UTILITIES.GiftCardReady GCready = new UTILITIES.GiftCardReady();
        GCready.FromName = fromName.Text;
        GCready.FromEmail = fromEmail.Text;
        GCready.ToName = toName.Text;
        GCready.ToEmail = toEmail.Text;
        if (message.Value.Contains("Please Enter Your Greeting text here")){
            GCready.TEXT = "";
        }
        else{GCready.TEXT = message.Value;}

        GCready.amount = AMOUNT;
        GCready.STRVAL = "$ " + AMOUNT.ToString("0.00");
        GCready.TYPE = rbChoice.SelectedIndex;
        GCready.DIR_BACKBMP = backgroundImage.Value;
        GCready.DIR_TXTBMP = "";
        displayName = cbDisplayNames.Checked;
        GCready.DisplayName = displayName;
        Random random = new Random();
        GCready.paypalID = DateTime.Now.ToString("yyMMddHHmmss") + fromEmail.Text.Replace('@', '-') + random.Next(1000).ToString("000");
        GCready.SalesID = "00000000-0000-0000-0000-000000000000";
        String CompanyID = "00000000-0000-0000-0000-000000000000";
        decimal salesDeal = 0;
        GoDine a = new GoDine();
        if (saleString != null && UniqueIDisValid(saleString))
        {
            GCready.SalesID = saleString;
            try
            {
                salesDeal = a.getDealRateForSellerID(new Guid(saleString));
            }
            catch
            {
            }
        }
        if (companyString != null && UniqueIDisValid(companyString))
        {
            try
            {
                //sales people don't make comission for giftcards that are for individual companies
                //if it's a valid company ID it'll overwrite the salesID, if it's not valid it won't save the CompanyID
                salesDeal = a.CompanyGiftCardDealRate(companyString);
                CompanyID = companyString;
                GCready.SalesID = "00000000-0000-0000-0000-000000000000";
            }
            catch
            {
            }
        }
        long barcode = a.GiftCard_Create_with_code(-1, 0); // IT IS NOT FORCED
        string barcodeWithChecksum = UTILITIES.appendChecksum(barcode);
        System.Console.WriteLine(barcodeWithChecksum);

        a.GiftCard_AddInfo_EmailType(barcode, GCready.ToEmail, GCready.FromEmail, GCready.ToName, GCready.FromName, GCready.DIR_BACKBMP, GCready.DIR_TXTBMP, GCready.TEXT, GCready.STRVAL, GCready.amount, GCready.paypalID, GCready.DisplayName, GCready.SalesID, salesDeal, CompanyID);
        if (GCready.TYPE == 1)
        {
            a.GiftCard_AddInfo_PrintType(barcode);
        }
        else if (GCready.TYPE == 2)
        {
            a.GiftCard_AddInfo_ShippingType(barcode, "", ""); // if shipping, the address must be applied exactly after the info of the email type
        }

        GCready.barcode = barcode;

        Session["GCready"] = GCready;

        //string input_permanent = "?cmd=_xclick&[email protected]&currency_code=CAD&country=CA&no_shipping=1&shipping=0.001&handling=0.00&image_url=" + WEBSITE_ADDRESS + "/img/paypal150px.png&return=" + WEBSITE_ADDRESS + "/TransactionStatus.aspx&cancel_return=" + WEBSITE_ADDRESS + "/TransactionStatus.aspx";
        string input_permanent = "?cmd=_ext-enter&redirect_cmd=_xclick&[email protected]";//&shipping=0.00&handling=0.00
        input_permanent += "&currency_code=CAD&no_shipping=1&country=CA&image_url=" + HOST_URL + "/img/paypal150px.png";
        input_permanent += "&callback_url=" + HOST_URL + "/About.aspx";

        string input_permanent_sandbox = "?cmd=_ext-enter&redirect_cmd=_xclick&[email protected]";//&shipping=0.00&handling=0.00
        input_permanent_sandbox += "&currency_code=CAD&no_shipping=1&country=CA&image_url=" + HOST_URL + "/img/paypal150px.png";
        input_permanent_sandbox += "&callback_url=" + HOST_URL + "/About.aspx";

        string input_dependent = "&item_name=AroundTown Giftcard, " + AMOUNT.ToString("0.00") + "$ value";
        input_dependent += "&amount=" + AMOUNT.ToString("0.00") + "&email=" + GCready.FromEmail + "&receiver_email=" + GCready.FromEmail;
        input_dependent += "&custom=" + GCready.paypalID + "&first_name=" + GCready.FromName;
        //https://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/howto_checkout-outside

        string resp_redirect;
        if (useSandbox)
        {
            resp_redirect = PAYPAL_ADDRESS_SANDBOX + input_permanent_sandbox + input_dependent + "&return=" + HOST_URL + "/PaymentSuccess.aspx&cancel_return=" + HOST_URL + "/PaymentPending.aspx";
        }
        else {
            resp_redirect = PAYPAL_ADDRESS + input_permanent + input_dependent + "&return=" + HOST_URL + "/PaymentSuccess.aspx&cancel_return=" + HOST_URL + "/PaymentPending.aspx";
        }

        log.Debug("Redirecting to paypal: " + resp_redirect);

        Response.Redirect(resp_redirect);
    }