function replaceURLWithHTMLLinks(text) {
  var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@##\/%?=~_|!:,.;]*[-A-Z0-9+&@##\/%=~_|])/ig;
  return text.replace(exp,"<a target=\"_blank\" href='$1'>$1</a>"); 
}

function parseTwitterDate(text) {
  var newtext = text.replace(/(\+\S+) (.*)/, '$2 $1');
  return newtext;
}

function twitterDateTimeString(twitterDateTime) {
  var createdAt = new Date(twitterDateTime);
  var hours = createdAt.getHours();
  var minutes = createdAt.getMinutes();
  var ampm = ((hours >= 12) ? " PM" : " AM");
  var hoursString = ((hours == 0) ? "12" : (hours > 12) ? hours - 12 : hours);
  var minutesString = ((minutes < 10) ? "0" + minutes : minutes); 
  
  var createdAtString = createdAt.getMonth()+1 + '/' + createdAt.getDate() + ' at ' + hoursString + ':' + minutesString + ' ' + ampm;

  var retString = 'Posted: ' + createdAtString;
  return retString;
}


/* JQUERY */

$(document).ready(function()
{
  
  $("#moredetails").hide();
  
  $("a.moredetails").click(function()
  {
    $("#moredetails").slideToggle(300);
  });
});

/* Sifr replace 
------------------------------------*/
//<![CDATA[
if(typeof sIFR == "function"){
// This is the older, ordered syntax
  sIFR.replaceElement("#bottom-content .gallery h3", named({sFlashSrc: "/flash/gothambold.swf", sColor: "#FFFFFF", sWmode: "transparent",sCase:'upper'}));
  sIFR.replaceElement("#sidebar h5", named({sFlashSrc: "/flash/gothambold.swf", sColor: "#FFFFFF", sWmode: "transparent",sCase:'upper'}));
  sIFR.replaceElement("#content-text h3", named({sFlashSrc: "/flash/gothambold.swf", sColor: "#E01226", sWmode: "transparent",sCase:'upper'}));
  sIFR.replaceElement("#content-text h5", named({sFlashSrc: "/flash/gothambold.swf", sColor: "#193589", sWmode: "transparent",sCase:'upper'}));
  sIFR.replaceElement("table.table-stats th span", named({sFlashSrc: "/flash/gothambold.swf", sColor: "#FFFFFF", sWmode: "transparent",sCase:'upper'}));
  sIFR.replaceElement(".heading h2", named({sFlashSrc: "/flash/gothambold.swf", sColor: "#FFFFFF", sWmode: "transparent",sCase:'upper'}));

  
};
//]]>


