 $.ajax({
		 type: "GET",
		 url: "/news/news.xml",
		 dataType: "xml",
		 success: function(xml) {
			var i=0;
			 $(xml).find('news').find('item').each(function(){
				
				 if ($(this).attr('hpfeatured')=="true" && i<4){
					i++;
					var title = $(this).find('title').text()
					title = truncate(title, 80, '...');
					var imgURL = $(this).find('imgURL').text()
					var date = $(this).find('date').text();
					var url = $(this).attr('href');
					if ($(this).find('date').attr('display')!="false"){
						date = "<b>" + date + "</b><br>";
					}
					else { date=''; }
					var desc = $(this).find('desc').text()
					desc = truncate(desc, 100, '...');
					if (i==3){
						$('#news').append("<br clear='all'>");
					}
					$('#news').append(
					"<div class='news_item' id='news" + i + "'><div class='news_title'><a target='_blank' href='" + url + "'>" + title + "</a></div><div class='news_img'><a target='_blank' href='" + url + "'><img src='" + imgURL + "' border='0'></a></div><div class='news_desc'>" + date + desc + "<br><div class=\"hblue_learn\" style=\"width:105px; \"><span class=\"hblue_link\"><a target='_blank' href='" + url + "'>LEARN MORE</a></div>");
						 
						 
				}
			 }); //close each(
		 }
	 }); //close $.ajax(


function truncate(text, length, ellipsis) {    

    // Set length and ellipsis to defaults if not defined
    if (typeof length == 'undefined') var length = 100;
    if (typeof ellipsis == 'undefined') var ellipsis = '...';

    // Return if the text is already lower than the cutoff
    if (text.length < length) return text;

    // Otherwise, check if the last character is a space.
    // If not, keep counting down from the last character
    // until we find a character that is a space
    for (var i = length-1; text.charAt(i) != ' '; i--) {
        length--;
    }

    // The for() loop ends when it finds a space, and the length var
    // has been updated so it doesn't cut in the middle of a word.
    return text.substr(0, length-1) + ellipsis;
}