portfolio = new Portfolio(); function Portfolio() { this.categories = new Object(); this.activeCats = ""; this.projects = new Array(); this.contentID = ""; } Portfolio.prototype.addCategory = function(obj, isActiveCat) { this.categories[obj["id"]] = obj["name"]; if (isActiveCat && (this.activeCats.indexOf(obj.id) < 0)) { var a = this.activeCats.split(","); a.push(obj.id); this.activeCats = a.join(","); } } Portfolio.prototype.addProject = function(obj) { this.projects.push(obj); } Portfolio.prototype.init = function (containerID, contentID, barBGDivID, barBtnDivID) { dsb.init(containerID, contentID, barBGDivID, barBtnDivID); this.contentID = contentID; this.createIcons(); } Portfolio.prototype.toggleCategory = function (catID) { if (this.activeCats.indexOf(catID) < 0) { var a = this.activeCats.split(","); a.push(catID); this.activeCats = a.join(","); } else { this.activeCats = this.activeCats.split(catID).join("").split(",,").join(""); } this.createIcons(); } Portfolio.prototype.createIcons = function() { var out ="", num = 0; for (var i=0; i < this.projects.length; i++) { if (this.activeCats.indexOf(this.projects[i]["catID"]) >= 0) { num++; out += '' + this.projects[i][' + this.projects[i]["name"] + '
'; } } dsb.bilh.setContent(this.contentID, out); //dsb.setContentWidth(num*122); } portfolio.addCategory({id: 1, name: "Interactive%20Media"}, true); portfolio.addCategory({id: 2, name: "Web%20Design%20%2b%20Development"}, true); portfolio.addCategory({id: 3, name: "Identity%20Design"}, true); portfolio.addCategory({id: 4, name: "Print%20Design"}, true); portfolio.addProject({id: 1, catID: 2, name: "The Rashi School Website", thumbpath: "thumb_rashi.png"}); portfolio.addProject({id: 3, catID: 2, name: "Solomon Schechter Day School Website", thumbpath: "thumb_ssds.png"}); portfolio.addProject({id: 5, catID: 2, name: "Maimonides School Website", thumbpath: "thumb_maimo.png"}); portfolio.addProject({id: 7, catID: 3, name: "Boxford Bakehouse Identity", thumbpath: "thumb_boxfordID.png"}); portfolio.addProject({id: 8, catID: 4, name: "Boxford Bakehouse Packaging Design", thumbpath: "thumb_boxford.png"}); portfolio.addProject({id: 11, catID: 1, name: "Saab 9-2X Microsite", thumbpath: "thumb_saab.png"}); portfolio.addProject({id: 12, catID: 1, name: "XM Radio Homepage", thumbpath: "thumb_xmradio.png"}); portfolio.addProject({id: 14, catID: 4, name: "IBM Lotus Live", thumbpath: "thumb_ibm.png"}); portfolio.addProject({id: 17, catID: 1, name: "Forrester Research Green IT Calculator Widget", thumbpath: "thumb_greenIT.png"});