function News(data, config) { this.c = config; this.d = data; this.page = 1; this.container = null; this.init = function(mode, results, override) {//console.log('inside init'); this.container = $(this.c.container); this.setPref(override); this.show = results; this.mode = mode; var str = ""; switch(mode) { case "side": str += this.createHeader(mode); str += this.sidebar(results); break; case "sidemenu": str += this.createHeader(mode); this.createMenu(); break; case "content": default: this.container.style.marginTop = "1px"; this.container.style.marginLeft = "1px"; str += this.createHeader(); str += this.content(); break; } this.container.innerHTML = str + this.container.innerHTML; var td = this.container.parentNode; var main = td.firstChild; }; this.setPref = function(ov) { for(key in ov) { this.c[key] = ov[key]; } }; this.createHeader = function(mode) { var str; switch(mode) { case "side": str = "
News
"; break; case "sidemenu": str = "
News
"; break; case "content": default: str = this.pagingHeader(); break; } return str; }; this.sidebar = function(limit) { var str = "\"Send"; //var imageP = new Image; //imageP.src = "/resources/images/img-send-postcard.gif"; return str; }; this.pagingHeader = function() { var c = null; var str = "
"; str += "
"; for(var i=0; i<(this.d.length/this.show); i++) { c = ((i+1)==this.page)?"class=\"selected\" ":""; str += (i != (Math.round(this.d.length/this.show)))?""+(i+1)+" | ":""+(i+1)+""; } str += "
"; str += "
Page "+this.page+" of "+Math.ceil(this.d.length/this.show)+"
"; str += "
Show all
"; return str; }; this.createMenu = function() { var d = [ ["Archive", "news_archive.html", "1"] ]; var nm = new snm(d, { style:[ { li:{"border-bottom":"none;", margin:"0px;", "padding-left":"0px;"}, a:{ "padding-left":"40px;"}}, ], //width:"200px", indent:"23px", container:"nN", prefix:"news_", iconPosition:"left", bg:["rgb(188, 190, 182)", "", "rgb(201, 203, 197)"]} ); nm.init({}, this.show); }; this.content = function() { var str = "
"; return str; }; this.buildRow = function(ni) { var str = "
  • "+ni.title+"
    "+ni.date.formatDate("m.d.Y")+" - "+ni.desc+"
  • "; return str; }; this.getIcon = function(type) { var img; switch(type) { case "news": img = (this.mode=="side")?"news_icons.gif":"content_news.gif"; break; case "event": img = (this.mode=="side")?"event_icons.gif":"content_event.gif"; break; case "press": default: img = (this.mode=="side")?"press_icons.gif":"content_press.gif"; break; } return img; }; this.goToPage = function(p) { /* clear off all class info */ var ps = $("pages").getElementsByTagName("a"); for(var i=0; iShow pages"; var str = "