function fieldvalue(field){
    return eval(vdocform + "." + field + ".options[" + vdocform + "." + field + ".selectedIndex].value");
}

function hiddenvalue(hiddenfield){
    return eval(vdocform + "." + hiddenfield + ".value");
}

function fieldfocus(field){
    return eval(vdocform + "." + field + ".focus()");
}

function addRosaryBox(formno){
    vformname = "rosarybox" + formno;
    vdocform = "document." + vformname;
    vsubject = hiddenvalue("subject");
    vitemno = hiddenvalue("itemno");
    vprice = hiddenvalue("price");
    vbox = fieldvalue("box");
    if (vbox == ""){
      window.alert('With or without a gift box?');
      fieldfocus("box");
      return;
    }
    var price = parseFloat(vprice);
    if (vbox == "with") {
        price += 1.95;
        price = Math.round(price * 100) / 100;
        vprice = price.toString();
        if (vprice.lastIndexOf(".") == -1) {
            vprice += ".00"
        }
        else if (vprice.lastIndexOf(".") == vprice.length - 2) {
            vprice += "0"
        }
    }
    itemURL = "https://www.paypal.com/cgi-bin/webscr?add=1&cmd=_cart&business=gifts%40sistersofcarmel.com&item_name=" + vsubject + ",+" + vbox + "+gift+box&item_number=" + vitemno + "&amount=" + vprice + "&return=http%3A//www.sistersofcarmel.com/subscriberp.php&cancel_return=http%3A//www.sistersofcarmel.com/subscriber.php&no_shipping=2&cbt=Continue&currency_code=USD&bn=PP-ShopCartBF";
    window.open(itemURL,'paypal','');
}
