function eClubDiscountList() { // this.discounts = ["literacy"]; this.discounts = ["teacher resources"]; if(typeof eClubDiscountList._initialized == "undefined") { eClubDiscountList.prototype.isDiscounted = function(str) { str = (str.replace(/[\s\W]/gi,"")).toLowerCase(); for(var i=0; i < this.discounts.length; i++) { var discItems = (this.discounts[i].toLowerCase()).split('>'); var isDiscounted = true; for(var n=0; n < discItems.length; n++) { if(str.indexOf(discItems[n].replace(/[\s\W]/gi,"")) == -1) { isDiscounted = false; } } if(isDiscounted==true) return true; } return false; }; } eClubDiscountList._initialized = true; } eClub = new eClubDiscountList();