// fonction pour initialiser le déclenchement de Juitter
// @nb int - le nb de tweets à afficher
function initTwitter(nb, twitter_selector, twitter_placeholder)
{
	var srchType;
	var srchObj;
	var elem = $('#' + twitter_selector + ' .on');
	//type de recherche...
	srchType = retrieveType(elem);
	//objet de recherche
	srchObj = elem.attr('rel');
	//initialiseation par defaut
	$.Juitter.start({
		searchType: srchType, // needed, you can use "searchWord", "fromUser", "toUser"
		searchObject: srchObj, // needed, you can insert a username here or a word to be searched for, if you wish multiple search, separate the words by comma.
		lang:"fr", // restricts the search by the given language
		live:"live-30", // the number after "live-" indicates the time in seconds to wait before request the Twitter API for updates.
		placeHolder:twitter_placeholder, // Set a place holder DIV which will receive the list of tweets example <div id="juitterContainer"></div>
		loadMSG: "Chargement des messages...", // Loading message, if you want to show an image, fill it with "image/gif" and go to the next variable to set which image you want to use on 
		imgName: "loader.gif", // Loading image, to enable it, go to the loadMSG var above and change it to "image/gif"
		total: nb, // number of tweets to be show - max 100
		readMore: "&raquo;", // read more message to be show after the tweet content
		nameUser:"image" // insert "image" to show avatar of "text" to show the name of the user that sent the tweet 
	});		
	$('#' + twitter_selector + ' .ctrls').click(function(){		
		//element
		elem = $(this);
		//tous les mettre à OFF
		$('#' + twitter_selector + ' .ctrls').removeClass("on");
		//mettre le current à ON
		elem.addClass("on");	
		//type de recherche...
		srchType = retrieveType(elem);
		//objet de recherche
		srchObj = elem.attr('rel');
		//juitter...
		$.Juitter.start({
			searchType: srchType,
			searchObject: srchObj
		});
	
	});

}
	
function retrieveType(elem)
{
	var s;
	if(elem.hasClass('to'))
		s = 'toUser';
	else if(elem.hasClass('from'))
		s = 'fromUser';
	else
		s = 'searchWord';	
	return s;
}
