Refactored common javascript code in shopping cart and drop down prompts