function JSONFeedCallback(obj,callerID){
buildContainer(callerID);
var postCount,itemRSS,itemTitle,itemDate,itemLink,container,caller;
container=document.getElementById(callerID+"feed");
itemRSS = obj.rss.channel;
try{
  postCount = itemRSS.item.length;
}catch(err){
  postCount = "";
}
	itemRSS.RSSfeed = BLOGRSS;
	itemRSS.title = BLOGTITLE;
	itemRSS.description = BLOGDESCRIPTION;
if (!obj.error) {
  var div = "<div><div style=\"float:right\" align=\"center\"><a href=\"http://citylink.seattle.gov\"><img src=\"http://www.seattle.gov/citylink/images/citylink_seattle_sc.jpg\" border=\"0\"></a><br><a class=\"greytext\" href=\"http://citylink.seattle.gov\">citylink.seattle.gov</a></div> <b class=\"blog_titleFont\"><a href=\""+itemRSS.link+"\" style=\"text-decoration:none;\">"+itemRSS.title+"</a></b><br>"
	div += itemRSS.description;
	div += "</div><br>";

//"<a href=\""+itemRSS.RSSfeed+"\"><img style=\"float:right;margin:3px\" src=\"/2004_IMG/rss_icon2.gif\" alt=\"Subscribe to RSS feed\" border=\"0\" /></a>
div +="<ul class=\"blog_entry_ul\" style=\"font-family:Arial;font-size:12px;color:#333333;margin-left:0px;\" >";
  try{

    var containerWidth=document.getElementById('feedContainerDept').style.width;
    containerWidth = containerWidth.replace('px','');
    var truncCharCnt = containerWidth/9.5;

  for (var i = 0; i < postCount && i < BLOGENTRIES_DISPLAYCOUNT; i++) {
    var entry = itemRSS.item[i];
    var altRow="blogPost greytext";
    entry.title = entry.title.replace(/[\u20AC][\u02DC]|[\u20AC][\u2122]/g,"");
    entry.title = entry.title.replace(/[\u20AC]|[\u00E2]|[\u20AC][^a-zA-Z 0-9]/g,"");
    div = div + "<li style=\"\" id=\"blogentry"+i+"\" class=\""+altRow +"\"><em class=\"blog_dateStyle\">"+dateFormat(entry.pubDate)+"</em> - <a style=\"text-decoration:none;\" href=\""+entry.link+"\">"+truncStr(entry.title,truncCharCnt)+"</a></li>";
  }
  }catch(err){
  }
    container.innerHTML = div+"</ul>";
	 	
  }else{
    container.innerHTML="<p align=\"center\">The current information cannot be displayed at this time.</p>";
  }
}

function buildContainer(callerID){
  var mainContainer = document.getElementById(callerID);
  var div = "<div id=\""+callerID+"feed\" class=\"feedDisplay\">Loading...</div>";
  div += "</div>"
  mainContainer.innerHTML = div;
}

function truncStr(str,len){
if(str.length > len){
  str = str.substr(0,len);
  str = str.substr(0,str.lastIndexOf(" "))+"...";
}
  return str;  
}

function dateFormat(dateObj){
var strDate = dateObj.slice(5,dateObj.length-15);
strDate = strDate.split(" ");
switch (strDate[1].toUpperCase()){
case "JAN" :
  strDate[1] = "01";
  break;
case "FEB":
  strDate[1] = "02";
  break;
case "MAR":
  strDate[1] = "03";
  break;
case "APR":
  strDate[1] = "04";
  break;
case "MAY":
  strDate[1] = "05";
  break;
case "JUN":
  strDate[1] = "06";
  break;
case "JUL":
  strDate[1] = "07";
  break;
case "AUG":
  strDate[1] = "08";
  break;
case "SEP":
  strDate[1] = "09";
  break;
case "OCT":
  strDate[1] = "10";
  break;
case "NOV":
  strDate[1] = "11";
  break;
case "DEC":
  strDate[1] = "12";
  break;
default:
}

var newDate = strDate[1]+"/"+strDate[0]+"/"+strDate[2].substring(2,4);
  return newDate;
}

