function AdvertHelper(ShowAd,kind,callBack) { this.link = "/redirect/?id="; this.items = new Object(); this.setTxt = function (idName, onefunc) { var json = this.items; if (!!json[idName] && json[idName].length > 0) { setHtml(idName, onefunc(json[idName][0])); } } this.getItem=function(name,defaultValue) { if (typeof (defaultValue) == "undefined") defaultValue = []; var arr = this.items[name]; if (!arr) return defaultValue; else return arr; } this.setEachTxt = function (idName, onefunc) { var json = this.items; if (!!json[idName]) { var tempObj = json[idName]; for (var i = 0; i < tempObj.length; i++) { var oneTemp = tempObj[i]; setHtml(idName + "[" + i + "]", onefunc(oneTemp,i)); } } } this.setEachImg = function (idName, onefunc, dividedStr) { var html = this.getEachImg(idName, onefunc, dividedStr); if(!!html) setHtml(idName, html); } this.setSpecialImg = function (idName, imageName, onefunc, dividedStr) { var html = this.getEachImg(imageName, onefunc, dividedStr); if (!!html) setHtml(idName, html); } this.getEachImg = function (idName, onefunc, dividedStr) { var json = this.items; if (typeof (dividedStr) == "undefined") dividedStr = ""; if (!!json[idName]) { var tempObj = json[idName]; var htmlArr = new Array(); for (var i = 0; i < tempObj.length; i++) { var oneTemp = tempObj[i]; htmlArr.push('