						var dsHMPGListings = new Spry.Data.XMLDataSet("/featuredlistingsxml.asp", "root/listings/listing",{useCache:false});
						dsHMPGListings.setColumnType("listing_image_url", "image");
									
							    function TruncateStrIfNeeded(str, maxChars)
							    {
									  // Decode our string so when we count characters, we aren't counting
									  // the chars in an entity name.

									  str = Spry.Utils.decodeEntities(str);
									  if (str.length > maxChars)
											str = str.substr(0, maxChars - 4) + " ...";
									  return Spry.Utils.encodeEntities(str);
							    }

							    dsHMPGListings.addObserver({ onPostLoad: function() {
									  var numberOfPanelsPerView = 4;
									  var rows = dsHMPGListings.getData();
									  var numRows = rows.length;

									  // Add some custom columns to our data set.

									  for (var i = 0; i < numRows; i++)
									  {
											var row = rows[i];

											// Add a 'teaser' column which is basically the description,
											// but truncated so it can fit within our panel.

											row.teaser = TruncateStrIfNeeded(row.desc, 400);

											// Add a 'viewStartIndex' column that indicates what view this row
											// belongs to.

											row.viewNumber = Math.floor(i / numberOfPanelsPerView) + 1;
											row.viewStartIndex = i - (i % numberOfPanelsPerView);
											row.prevStartIndex = row.viewStartIndex - numberOfPanelsPerView;
											row.nextStartIndex = row.viewStartIndex + numberOfPanelsPerView;
									  }
							    }});			    
							    
							dsHMPGListings.addObserver({
								onPostLoad:function(ds,data){
									var rows = ds.getData();
									function toPrice(v){
										var position = v.length - 3, dollar = v.substr(0,position), cent = v.substr(position);
										return (dollar ? dollar + ',' + cent : cent);
									};
									for(var i = 0, length = rows.length; i < length; i++){
										rows[i]['list_price'] = toPrice(rows[i]['list_price']);
									}
									function toPrice2(v){
										var position2 = v.length - 7, dollar = v.substr(0,position2), cent = v.substr(position2);
										return (dollar ? dollar + ',' + cent : cent);
									};
									for(var lp = 0, length = rows.length; lp < length; lp++){
										rows[lp]['list_price'] = toPrice2(rows[lp]['list_price']);
									}
								}
							}); 
