/* Hot Deal Object Container * Used to encapsulate and render a series of HotDeal * objects */ HotDealContainer = function() { this.contents = new Array(); this.add = function(oHotDeal) { this.contents[this.contents.length] = oHotDeal; } this.render = function() { var container = document.getElementById('HotDeals_Loader').parentNode; var list = document.createElement('ul'); for(var i=0; i block. All constructor arguments are optional but * should be in this order: * @param str id - Car ID (PaID) * @param str year - Year * @param str make - Make * @param str model - Model * @param str dealer - Dealer * @param str price - Price * @param str photoURL - Photo URL */ HotDeal = function (id,year,make,model,dealer,price,photoURL) { this.id = (id==null) ? '' : id; this.year = (year==null) ? '' : year; this.make = (make==null) ? '' : make; this.model = (model==null) ? '' : model; this.dealer = (dealer==null)? '' : dealer; this.price = (price==null) ? '' : price; this.photo = (photoURL==null) ? '' : photoURL; this.getNode = function(node) { var li,img,makeModel,price,dealer; li = document.createElement('li'); li.id = 'HD_' + this.id; li.onclick = goToURL; li.onmouseover = rollOver; li.onmouseout = rollOut; li.title = 'View details...'; img = document.createElement('img'); img.src = this.photo; img.width = 85; img.height = 63; img.alt = this.year + ' ' + this.make + ' ' + this.model; li.appendChild(img); makeModel = document.createElement('span'); makeModel.className = 'make-model'; makeModel.innerHTML = this.year + ' '+ this.make + ' ' + this.model; li.appendChild(makeModel); price = document.createElement('span'); price.className = 'price'; price.innerHTML = this.price; li.appendChild(price); dealer = document.createElement('span'); dealer.className = 'dealer'; dealer.innerHTML = this.dealer; li.appendChild(dealer); return li; } } function goToURL() { window.location='http://www.cars.com/go/search/detail.jsp?aff=triangle&paId=' + this.id.replace('HD_',''); } function rollOver() { this.className += ' HD_over'; } function rollOut() { this.className = ''; } var cars = new HotDealContainer(); cars.add(new HotDeal('133063971','2005','Ford','Explorer Sport Trac','Westgate Imports','$16,900','http://newsobserver.com/images/hotdeals/133063971/Hot_Deals.jpg')); cars.add(new HotDeal('211143264','2003','Mini','Cooper','Lotus of Durham','$18,950','http://newsobserver.com/images/hotdeals/211143264/Hot_Deals.jpg')); cars.add(new HotDeal('212156368','2004','Mazda','Miata MX-5','Lotus of Durham',' ','http://newsobserver.com/images/hotdeals/212156368/Hot_Deals.jpg')); cars.add(new HotDeal('133478881','2006','Toyota','Camry','Triangle Rent A Car Sales Center','$15,990','http://newsobserver.com/images/hotdeals/133478881/Hot_Deals.jpg')); cars.add(new HotDeal('212156372','2004','Mazda','Miata MX-5','Lotus of Durham',' ','http://newsobserver.com/images/hotdeals/212156372/Hot_Deals.jpg')); // Generate HTML cars.render();