function postCardDesign(id,type){$("#type").attr("value",type);$("#designId").attr("value",id);$("#card-cmd").attr("value","design");$("#personalize").submit();}function pickCard(id){$("#"+id).click();}function changeCardDesign(id,previewUrl,showSendTo,showEmail,showAddress,showQuantity,type){$(".card").removeClass("selected");
$("#card_"+id).addClass("selected");$("#previewImage").attr("src",previewUrl);$("#type").attr("value",type);if(showEmail){$("#sendDate_container").show();$("#title").attr("value","eGift Card");}else{$("#sendDate_container").hide();$("#title").attr("value","Gift Card");}if(showSendTo){$("#sendTo").show();
$("#printAtHomeAlso").show();}else{$("#sendTo").hide();$("#printAtHomeAlso").hide();}if(showAddress){$("#address").show();$("#expeditedPhone").show();}else{$("#address").hide();$("#expeditedPhone").hide();}if(showQuantity){$("#quantity_secondaryLabel").attr("innerHTML","(between 1 and 1,000)");$("#quantity").show();
$("#quantity").removeAttr("disabled");}else{$("#quantity").hide();$("#quantity").attr("value","1");$("#quantity").attr("disabled","disabled");$("#quantity_secondaryLabel").attr("innerHTML","1");}if(type=="giftCard"||type=="giftCardCustom"){$("#giftto_container").show();$("#giftto").removeAttr("disabled");
$("#giftfrom_container").show();$("#giftfrom").removeAttr("disabled");}else{$("#giftto_container").show();$("#giftto").removeAttr("disabled");$("#giftfrom_container").show();$("#giftfrom").removeAttr("disabled");}}function toggleShowOther(id){var value=$("#"+id).find("option:selected").attr("value");
if(value=="other"){$("#other_"+id+"_span").show();}else{$("#other_"+id+"_span").hide();}}function quantityChanged(id){var quantity=$("#"+id).attr("value");var isGiftCertificate=$("#isGiftCertificate").attr("value");if(quantity=="1"){$("#personalizationMessage").hide();}else{$("#personalizationMessage").show();
}ajaxCalculateShippingAndHandling(quantity,isGiftCertificate);}function ajaxCalculateShippingAndHandling(quantity,isGiftCertificate){$.post("/dy/gifts/ajax/gg.html",{cmd:"calculateShippingAndHandling",quantity:quantity,isGiftCertificate:isGiftCertificate},function(data){updateShippingAndHandling(data);
},"json");}function updateShippingAndHandling(results){updateShippingAndHandlingOption("usps_firstclass",results.usps_firstclass);updateShippingAndHandlingOption("fedex_twoday",results.fedex_twoday);updateShippingAndHandlingOption("fedex_nextday",results.fedex_nextday);}function updateShippingAndHandlingOption(id,cost){var text=$("#"+id).text();
if(cost!=null&&cost!="0.00"&&text!=null&&text.indexOf("$")>0){text=text.substr(0,text.indexOf("$")+1)+cost;$("#"+id).text(text);}}function previewGiftCard(){var args="";var isGiftCertificate=$("#isGiftCertificate").attr("value");var type=$("#type").attr("value");var media=$("#media").attr("value");var design=$("input[@name='design']:checked").val();
args+="design="+escape(design);var gcartitemid=$("#gcartitemid").attr("value");args+="&gcartitemid="+escape(gcartitemid);var rcptitemid=$("#rcptitemid").attr("value");args+="&rcptitemid="+escape(rcptitemid);var cctranid=$("#cctranid").attr("value");args+="&cctranid="+escape(cctranid);var amount=$("#amount").attr("value");
args+="&amount="+escape(amount);if(document.getElementById("giftto")){var giftto=$("#giftto").attr("value");args+="&giftto="+escape(giftto);}var giftfrom=$("#giftfrom").attr("value");args+="&giftfrom="+escape(removeMSWordChars(giftfrom));var message=$("#message").attr("value");args+="&message="+escape(removeMSWordChars(message));
var tributeType=$("input[name='tributeType']:checked").val();args+="&tributeType="+escape(tributeType);var recipientFirstName=$("#recva_fname").val();args+="&recipientFirstName="+escape(removeMSWordChars(recipientFirstName));var recipientLastName=$("#recva_lname").val();args+="&recipientLastName="+escape(removeMSWordChars(recipientLastName));
var showAmount=$("input[name='showAmount']:checked").val();args+="&showAmount="+escape(showAmount);var recipientEmail=$("#recva_email").val();args+="&recipientEmail="+escape(recipientEmail);var url="/dy/email/giftCard/gg.html";if(isGiftCertificate=="false"){url="/dy/email/tributeCard/gg.html";}if(type=="pdfGiftCard"||type=="pdfTributeCard"){url="/dy/gifts/printpreview/gg.pdf";
}var width=650;var height=600;if(type=="giftCard"){width=900;height=725;}popup(url+"?"+args+"&forcePreview=1","GiftPreview",width,height);}function checkIfPhoneNumberRequired(selectObject,phoneNumberField){var selectBox=selectObject;var selectedText=$("#"+selectObject+" :selected").text();if(selectedText.indexOf("Priority")!=-1||selectedText.indexOf("Expedited")!=-1){$("#"+phoneNumberField).show("fast");
}else{$("#"+phoneNumberField).hide("fast");}}function updateTributeWording(type){if(type=="memory"){$("#memoryMailing").show();$("#tributeMailing").hide();$("#giftto_label").text("In Memory Of");}else{$("#tributeMailing").show();$("#memoryMailing").hide();$("#giftto_label").text("Gift To");}}
