/*
 * JavaScript Feed Parser
 * Copyright (c) 2009 Ask Toolbar
 * Date: 2009-12-07 20:42:16 -0500 (Mon, 7 DEC 2009)
 * Revision: 1
 */

function Truncate(str, len) {
try{
	var trunc = str;
	  if (trunc.length> len) {
		if(trunc.charAt(len-3)==' ')
		{
			var trunc= trunc.substring(0, len-3)+"...";
			return trunc;
		}

		else{
			if(trunc.substring(0,(len-3)).lastIndexOf(' ') != -1)
			var trunc = trunc.substring(0,trunc.substring(0,(len-3)).lastIndexOf(' '))+"...";
			else
			var trunc = trunc.substring(0,len-3)+"...";
			return trunc;                                
		}
  	}

	else
	return trunc;
}catch(e){}

}


function Redirect(o, f){
try{
		
        if(f != null || f!= ""){
            return function(){
                return o[f].apply(o, arguments);
            }
        } else {
            return function(){
                return f.apply(o, arguments);
            }
        }
}catch(e){}
    }

function getFeeds(feedUrl,elementId,feedCount,callback){
try{

$.jGFeed(feedUrl,

			  function(feeds){
			  
				// Check for errors								
				if(feeds != null){
					feeds = feeds.feed;				
				}			

				callback(elementId,feeds);

		  }, feedCount);
}catch(e){}
}
