<!-- hide script from old browsers
//USAGE SYNTAX: new rssdisplayer("divid", "rssurl", numberofitems, "displayoptions")
//new rssdisplayer("adiv", "http://www.cssdrive.com/index.php/news/rss_2.0/", 5, "date, description, today")
google.load("feeds", "1"); //Load Google Ajax Feed API (version 1)

function rssdisplayer(divid, url, feedlimit, showoptions){
this.showoptions=showoptions || "" //get string of options to show ("date" and/or "description" and/or "today")
var todaydate=/today/i.test(this.showoptions)? this.formatcurrdate() : ""
var feedpointer=new google.feeds.Feed(url+todaydate); //create new instance of Google Ajax Feed API
feedpointer.setNumEntries(feedlimit); //set number of items to display
feedpointer.setResultFormat(google.feeds.Feed.MIXED_FORMAT); //sets results to mixed
document.write('<div id="'+divid+'">Loading feed...</div>'); //temp notice that feed is loading
this.feedcontainer=document.getElementById(divid);
var displayer=this;
feedpointer.load(function(r){displayer.formatoutput(r)}); //call Feed.load() to retrieve and output RSS feed
}

rssdisplayer.prototype.formatcurrdate=function(){
edt = new Date();
            var ecurr_month = edt.getMonth();
                ecurr_month++;
            var edt = ecurr_month + "-" + edt.getDate() + "-" + edt.getFullYear();
return "&firstofmonth=" + edt;
} 

rssdisplayer.prototype.formatdate=function(esdate, estime){
            var sdrs = esdate.split(" ");
                   fday = (sdrs[1]);
                   fmo = (sdrs[2]);
                   fyear = (sdrs[3]);
            var estime = estime + ":00";
            var fdate = new Date();
            fdate.setTime(Date.parse(fmo + " " + fday + "," + " " + fyear + " " + estime));
            var curr_date = fdate.getDate();
            var curr_month = fdate.getMonth();
                curr_month++;
            var curr_year = fdate.getFullYear();
            var fdatemm = curr_month + "/" + curr_date + "/" + curr_year;
              var strs = estime.split(":");
                  fdate.setHours(strs[0]);
                  fdate.setMinutes(strs[1]);
                  fdate.setSeconds(strs[2]);
              var hour   = fdate.getHours();
              var minute = fdate.getMinutes();
              var second = fdate.getSeconds();
              var ap = "am";
                 if (hour   > 11) { ap = "pm";             }
                 if (hour   > 12) { hour = hour - 12;      }
                 if (hour   == 0) { hour = 12;             }
                 if (hour   < 10) { hour   = "0" + hour;   }
                 if (minute < 10) { minute = "0" + minute; }
                 if (second < 10) { second = "0" + second; }
              var itemtime= hour + ':' + minute + ap;
return "<div class='entrydatetime' style='color:gray;'>"+fdatemm+" - "+itemtime+"</div>"
}

rssdisplayer.prototype.formatdate2=function(esdate){
	var sdrs = esdate.split(" ");
	fday = (sdrs[1]);
	fmo = (sdrs[2]);
	fyear = (sdrs[3]);
	var fdate = new Date();
	fdate.setTime(Date.parse(fmo + " " + fday + "," + " " + fyear));
	var fdatemm = fdate.getMonth() + "/" + fdate.getDate() + "/" + fdate.getFullYear();
	//var fdatemm = " "; //this blanks the line
	return "<div class='entrydatetime' style='color:gray;'>"+fdatemm+"</div>"
}

rssdisplayer.prototype.formatoutput=function(result){
	if (!result.error){ //if RSS feed successfully fetched
		var thefeeds=result.xmlDocument.getElementsByTagName('item'); //get all feed entries as a JSON array
		var rssoutput="<div>" //open div
		for (var i=0; i<thefeeds.length; i++){ //loop through entries
			thefeed = thefeeds[i]; //itterate each of the entries in thefeed
			var itemtitle="<a href=\"" + thefeed.getElementsByTagName('link')[0].firstChild.nodeValue + "\">" + thefeed.getElementsByTagName('title')[0].firstChild.nodeValue + "</a><br />" //format link and title
			if (thefeed.getElementsByTagName('eventStartDate')[0] != undefined) { //if eventstartdate is not defined use pubDate
				var itemdate=/date/i.test(this.showoptions)? this.formatdate(thefeed.getElementsByTagName('eventStartDate')[0].firstChild.nodeValue, thefeed.getElementsByTagName('eventStartTime')[0].firstChild.nodeValue ) : ""
			} else {
				var itemdate=/date/i.test(this.showoptions)? this.formatdate2(thefeed.getElementsByTagName('pubDate')[0].firstChild.nodeValue) : "" //special syntax - if "date" is in showoptions, insert date
				var itemdescription=/description/i.test(this.showoptions)? "<br />"+thefeed.getElementsByTagName('description')[0].firstChild.nodeValue : "" //special syntax - if "description" is in showoptions, insert date
			}
			if (itemdescription != undefined) {
				rssoutput+="<div class='entry'>" + itemtitle + " " + itemdate + " " + itemdescription + "</div>"
			} else {
				rssoutput+="<div class='entry'>" + itemtitle + " " + itemdate + "</div>"
			}

		}
		rssoutput+="</div>" // close div
		this.feedcontainer.innerHTML=rssoutput
	}
	else //else, output error
	alert("Error fetching feeds: "+result.error.message)
}

//USAGE SYNTAX: new rssdisplayer("divid", "rssurl", numberofitems, "displayoptions")
//new rssdisplayer("adiv", "http://www.cssdrive.com/index.php/news/rss_2.0/", 5, "date, description, today")
<!-- hide script from old browsers