
/* Merged Plone Javascript file
 * This file is dynamically assembled from separate parts.
 * Some of these parts have 3rd party licenses or copyright information attached
 * Such information is valid for that section,
 * not for the entire composite file
 * originating files are separated by - filename.js -
 */

/* - thickbox.js - */
/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
		  
var tb_pathToImage = "loadingAnimation.gif";

/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/

//on page load call tb_init
jq(document).ready(function(){   
	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
	jq(domChunk).click(function(){
	var t = this.title || this.name || null;
	var a = this.href || this.alt;
	var g = this.rel || false;
	tb_show(t,a,g);
	this.blur();
	return false;
	});
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link

	try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			jq("body","html").css({height: "100%", width: "100%"});
			jq("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				jq("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				jq("#TB_overlay").click(tb_remove);
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
				jq("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
				jq("#TB_overlay").click(tb_remove);
			}
		}
		
		if(tb_detectMacXFF()){
			jq("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			jq("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}
		
		if(caption===null){caption="";}
		jq("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
		jq('#TB_load').show();//show loader
		
		var baseURL;
	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
			baseURL = url.substr(0, url.indexOf("?"));
	   }else{ 
	   		baseURL = url;
	   }
	   
	   var urlString = /\.jpg|\.jpeg|\.png|\.gif|\.bmp/;
	   var urlType = baseURL.toLowerCase().match(urlString);

		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
				
			TB_PrevCaption = "";
			TB_PrevURL = "";
			TB_PrevHTML = "";
			TB_NextCaption = "";
			TB_NextURL = "";
			TB_NextHTML = "";
			TB_imageCount = "";
			TB_FoundURL = false;
			if(imageGroup){
				TB_TempArray = jq("a[@rel="+imageGroup+"]").get();
				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
						if (!(TB_TempArray[TB_Counter].href == url)) {						
							if (TB_FoundURL) {
								TB_NextCaption = TB_TempArray[TB_Counter].title;
								TB_NextURL = TB_TempArray[TB_Counter].href;
								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
							} else {
								TB_PrevCaption = TB_TempArray[TB_Counter].title;
								TB_PrevURL = TB_TempArray[TB_Counter].href;
								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
							}
						} else {
							TB_FoundURL = true;
							TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);											
						}
				}
			}

			imgPreloader = new Image();
			imgPreloader.onload = function(){		
			imgPreloader.onload = null;
				
			// Resizing large images - orginal by Christian Montoya edited by me.
			var pagesize = tb_getPageSize();
			var x = pagesize[0] - 150;
			var y = pagesize[1] - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			jq("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div>"); 		
			
			jq("#TB_closeWindowButton").click(tb_remove);
			
			if (!(TB_PrevHTML === "")) {
				function goPrev(){
					if(jq(document).unbind("click",goPrev)){jq(document).unbind("click",goPrev);}
					jq("#TB_window").remove();
					jq("body").append("<div id='TB_window'></div>");
					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
					return false;	
				}
				jq("#TB_prev").click(goPrev);
			}
			
			if (!(TB_NextHTML === "")) {		
				function goNext(){
					jq("#TB_window").remove();
					jq("body").append("<div id='TB_window'></div>");
					tb_show(TB_NextCaption, TB_NextURL, imageGroup);				
					return false;	
				}
				jq("#TB_next").click(goNext);
				
			}

			document.onkeydown = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				} else if(keycode == 190){ // display previous image
					if(!(TB_NextHTML == "")){
						document.onkeydown = "";
						goNext();
					}
				} else if(keycode == 188){ // display next image
					if(!(TB_PrevHTML == "")){
						document.onkeydown = "";
						goPrev();
					}
				}	
			};
			
			tb_position();
			jq("#TB_load").remove();
			jq("#TB_ImageOff").click(tb_remove);
			jq("#TB_window").css({display:"block"}); //for safari using css instead of show
			};
			
			imgPreloader.src = url;
		}else{//code to show html
			
			var queryString = url.replace(/^[^\?]+\??/,'');
			var params = tb_parseQuery( queryString );

			TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
			TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
			ajaxContentW = TB_WIDTH - 30;
			ajaxContentH = TB_HEIGHT - 45;
			
      var eclass = ''
      if (url.indexOf('employee_popup') != -1 )
          eclass = 'employeePopup'
          
      if (url.indexOf('service_popup') != -1 )
          eclass = 'servicePopup'
          
      if (url.indexOf('joinus_popup') != -1 )
          eclass = 'joinusPopup' 
          
      if (url.indexOf('client_popup') != -1 )
          eclass = 'clientPopup' 
          
			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window		
					urlNoQuery = url.split('TB_');
					jq("#TB_iframeContent").remove();
					if(params['modal'] != "true"){//iframe no modal
						jq("#TB_window").append("<div id='TB_title' class='"+eclass+"'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> | <a href='' id='TB_printVersionButton' title='Print'>print</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
					}else{//iframe modal
					jq("#TB_overlay").unbind();
						jq("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
					}
			}else{// not an iframe, ajax
					if(jq("#TB_window").css("display") != "block"){
						if(params['modal'] != "true"){//ajax no modal
						jq("#TB_window").append("<div id='TB_title' class='"+eclass+"'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> | <a href='"+url+"' id='TB_printVersionButton' title='Print'>print</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
						}else{//ajax modal
						jq("#TB_overlay").unbind();
						jq("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	
						}
					}else{//this means the window is already up, we are just loading new content via ajax
						jq("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
						jq("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
						jq("#TB_ajaxContent")[0].scrollTop = 0;
						jq("#TB_ajaxWindowTitle").html(caption);
					}
			}
					
			jq("#TB_closeWindowButton").click(tb_remove);
			
				if(url.indexOf('TB_inline') != -1){	
					jq("#TB_ajaxContent").append(jq('#' + params['inlineId']).children());
					jq("#TB_window").unload(function () {
						jq('#' + params['inlineId']).append( jq("#TB_ajaxContent").children() ); // move elements back when you're finished
					});
					tb_position();
					jq("#TB_load").remove();
					jq("#TB_window").css({display:"block"}); 
				}else if(url.indexOf('TB_iframe') != -1){
					tb_position();
					if(jq.browser.safari){//safari needs help because it will not fire iframe onload
						jq("#TB_load").remove();
						jq("#TB_window").css({display:"block"});
					}
				}else{
					jq("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
						tb_position();
						jq("#TB_load").remove();
						tb_init("#TB_ajaxContent a.thickbox");
						jq("#TB_window").css({display:"block"});
					});
				}
			
		}

		if(!params['modal']){
			document.onkeyup = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				}	
			};
		}
		
	} catch(e) {
		//nothing here
	}
}

//helper functions below
function tb_showIframe(){
	jq("#TB_load").remove();
	jq("#TB_window").css({display:"block"});
}

function tb_remove() {
 	jq("#TB_imageOff").unbind("click");
	jq("#TB_closeWindowButton").unbind("click");
	jq("#TB_window").fadeOut("fast",function(){jq('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
	jq("#TB_load").remove();
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		jq("body","html").css({height: "auto", width: "auto"});
		jq("html").css("overflow","");
	}
	document.onkeydown = "";
	document.onkeyup = "";
	return false;
}

function tb_position() {
jq("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
		jq("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
}

function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

function tb_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}




/* - jquery_cyclelite.js - */
/*
 * jQuery Cycle Lite Plugin
 * http://malsup.com/jquery/cycle/lite/
 * Copyright (c) 2008 M. Alsup
 * Version: 1.0 (06/08/2008)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jQuery v1.2.3 or later
 */
;(function(D){var A="Lite-1.0";D.fn.cycle=function(E){return this.each(function(){E=E||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var I=D(this);var J=E.slideExpr?D(E.slideExpr,this):I.children();var G=J.get();if(G.length<2){if(window.console&&window.console.log){window.console.log("terminating; too few slides: "+G.length)}return }var H=D.extend({},D.fn.cycle.defaults,E||{},D.metadata?I.metadata():D.meta?I.data():{});H.before=H.before?[H.before]:[];H.after=H.after?[H.after]:[];H.after.unshift(function(){H.busy=0});var F=this.className;H.width=parseInt((F.match(/w:(\d+)/)||[])[1])||H.width;H.height=parseInt((F.match(/h:(\d+)/)||[])[1])||H.height;H.timeout=parseInt((F.match(/t:(\d+)/)||[])[1])||H.timeout;if(I.css("position")=="static"){I.css("position","relative")}if(H.width){I.width(H.width)}if(H.height&&H.height!="auto"){I.height(H.height)}var K=0;J.css({position:"absolute",top:0,left:0}).hide().each(function(M){D(this).css("z-index",G.length-M)});D(G[K]).css("opacity",1).show();if(D.browser.msie){G[K].style.removeAttribute("filter")}if(H.fit&&H.width){J.width(H.width)}if(H.fit&&H.height&&H.height!="auto"){J.height(H.height)}if(H.pause){I.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}D.fn.cycle.transitions.fade(I,J,H);J.each(function(){var M=D(this);this.cycleH=(H.fit&&H.height)?H.height:M.height();this.cycleW=(H.fit&&H.width)?H.width:M.width()});J.not(":eq("+K+")").css({opacity:0});if(H.cssFirst){D(J[K]).css(H.cssFirst)}if(H.timeout){if(H.speed.constructor==String){H.speed={slow:600,fast:200}[H.speed]||400}if(!H.sync){H.speed=H.speed/2}while((H.timeout-H.speed)<250){H.timeout+=H.speed}}H.speedIn=H.speed;H.speedOut=H.speed;H.slideCount=G.length;H.currSlide=K;H.nextSlide=1;var L=J[K];if(H.before.length){H.before[0].apply(L,[L,L,H,true])}if(H.after.length>1){H.after[1].apply(L,[L,L,H,true])}if(H.click&&!H.next){H.next=H.click}if(H.next){D(H.next).bind("click",function(){return C(G,H,H.rev?-1:1)})}if(H.prev){D(H.prev).bind("click",function(){return C(G,H,H.rev?1:-1)})}if(H.timeout){this.cycleTimeout=setTimeout(function(){B(G,H,0,!H.rev)},H.timeout+(H.delay||0))}})};function B(J,E,I,K){if(E.busy){return }var H=J[0].parentNode,M=J[E.currSlide],L=J[E.nextSlide];if(H.cycleTimeout===0&&!I){return }if(I||!H.cyclePause){if(E.before.length){D.each(E.before,function(N,O){O.apply(L,[M,L,E,K])})}var F=function(){if(D.browser.msie){this.style.removeAttribute("filter")}D.each(E.after,function(N,O){O.apply(L,[M,L,E,K])})};if(E.nextSlide!=E.currSlide){E.busy=1;D.fn.cycle.custom(M,L,E,F)}var G=(E.nextSlide+1)==J.length;E.nextSlide=G?0:E.nextSlide+1;E.currSlide=G?J.length-1:E.nextSlide-1}if(E.timeout){H.cycleTimeout=setTimeout(function(){B(J,E,0,!E.rev)},E.timeout)}}function C(E,F,I){var H=E[0].parentNode,G=H.cycleTimeout;if(G){clearTimeout(G);H.cycleTimeout=0}F.nextSlide=F.currSlide+I;if(F.nextSlide<0){F.nextSlide=E.length-1}else{if(F.nextSlide>=E.length){F.nextSlide=0}}B(E,F,1,I>=0);return false}D.fn.cycle.custom=function(K,H,I,E){var J=D(K),G=D(H);G.css({opacity:0});var F=function(){G.animate({opacity:1},I.speedIn,I.easeIn,E)};J.animate({opacity:0},I.speedOut,I.easeOut,function(){J.css({display:"none"});if(!I.sync){F()}});if(I.sync){F()}};D.fn.cycle.transitions={fade:function(F,G,E){G.not(":eq(0)").css("opacity",0);E.before.push(function(){D(this).show()})}};D.fn.cycle.ver=function(){return A};D.fn.cycle.defaults={timeout:4000,speed:1000,next:null,prev:null,before:null,after:null,height:"auto",sync:1,fit:0,pause:0,delay:0,slideExpr:null}})(jQuery);


/* - jquery_juitter.js - */
/*
JUITTER 0.9.1
08/02/2009
BY RODRIGO FANTE
http://rodrigofante.com

** jQuery 1.2.* or higher required
==> if you for any reason don't have it, download at http://jquery.com


Juitter is distributed under the MIT License
Read more about the MIT License --> http://www.opensource.org/licenses/mit-license.php

This script is just a beta test version, download and use it at your own risk.
The Juitter developer shall have no responsability for data loss or damage of any kind by using this script.

*/
(function(jq) {
	var conf = {},
		// JUITTER CONFIG ========================
		username = "DigitalPublic", // will be used user if you don't give it when you start juitter and you are looking for tweets from or to a specific user
		word = "juitter" // will be user if you don't give it when you start juitter searching for a specific word
		contDiv = "juitterContainer", // Container div that will receive the list of tweets
		loadMSG = "Loading messages..."; // Loading message, if you want to show an image, fill it with "image/gif" and go to the next variable to set witch image want to use 
		gifName = "loader.gif"; // Loading image, to enable it go to the loadMSG var and change to "image/gif"
		numMSG = 3; // number of tweets to be shown - max 100
		readMore = "Read it on Twitter"; // read more message to be shown after the tweet content
		fromID = "image"; // insert "image" to show avatar of "text" to show the name of the user that sent the tweet 
		
		// END OF CONFIG
		// ======================================
		
		
		// DO NOT TOUCH BELOW HERE ==============
		
		// Twiiter API Urls
		apifUSER = "http://search.twitter.com/search.json?q=from%3A";
		apitUSER = "http://search.twitter.com/search.json?q=to%3A";
		apiSEARCH = "http://search.twitter.com/search.json?q=";
		
		// some global vars
		aURL="";
		ultID=0;
		msgNb = 1;
		
		mode = "",
		param = "",
		time = ""
		
	jq.Juitter = {
		registerVar: function(localMode,localParam,localTimer) {
			mode = localMode;
			param = localParam;
			timer = localTimer;
		},
		start: function(localMode,localParam,localTimer) {
			if(jq("#"+contDiv)){	
				this.registerVar(localMode,localParam,localTimer);
				// show the load message
				this.loading();
				// create the URL  to be request at the Twitter API
				aURL = this.createURL(mode,param);
				// query the twitter API and create the tweets list
				this.conectaTwitter(1);		
				// if live mode is enabled, schedule the next twitter API query
				if(timer!=undefined) this.temporizador();
			}   
		},
		update: function(){
			this.conectaTwitter(2);		
			if(timer!=undefined) this.temporizador();
		},
		changeRequest: function(localMode,localParam,localTimer,id){
			// create the URL  to be request at the Twitter API
			jq(".jLinks").removeClass("on");
			jq("#"+id).addClass("on");
			// show the load message
			this.loading();
			this.registerVar(localMode,localParam,localTimer);
			aURL = this.createURL(mode,param);
			// query the twitter API and create the tweets list
			this.conectaTwitter(1);		
		},
		loading: function(){
			if(loadMSG=="image/gif"){
				jq("<img></img>")
					.attr('src', gifName)
					.appendTo("#"+contDiv); 
			} else {
				jq("#"+contDiv).html(loadMSG);
			}		
		},
		createURL: function(mode,param){
			var url = "";
			if(mode=="fromUser"){
				if(param!=undefined) username = param;
				url = apifUSER+username;
			} else if(mode=="toUser"){
				if(param!=undefined) username = param;
				url = apitUSER+username;
			}else if(mode=="searchWord"){
				if(param!=undefined) word = param;
				url = apiSEARCH+word;
			}	
			url += "&rpp="+numMSG;
			return url;
		},
		delRegister: function(){
			// remove the oldest entry on the tweets list
			if(msgNb>=numMSG){
				jq(".twittLI").each(
					function(o,elemLI){
						if(o>=numMSG){
							jq(this).hide("slow");
						}							  
					}
				);
			}	
		},
		conectaTwitter: function(opt){
			// query the twitter api and create the tweets list
			jq.ajax({
				url: aURL,
				type: 'GET',
				dataType: 'jsonp',
				timeout: 1000,
				error: function(){
					jq("#"+contDiv).html("fail#");
				},
				success: function(json){
					if(opt==1){
						// first request
						jq("#"+contDiv).html("");
						jq("<ul></ul>")
							.attr('id', 'twittList')
							.appendTo("#"+contDiv);  
						jq.each(json.results,function(i,item) {
							if(i==0) ultID = item.id;												 
							if(i<numMSG){
								if (item.text != "undefined") {
									var link =  "http://twitter.com/"+item.from_user+"/status/"+item.id;  
									if(fromID=="image"){
										jq("<li></li>") 
											.html("<a href='http://www.twitter.com/"+item.from_user+"'><img src='"+item.profile_image_url+"' alt='"+item.from_user+"' class='juitterAvatar' /></a> "+jq.Juitter.textFormat(item.text)+ " <a href='" + link + "' class='JRM'>"+readMore+"</a>")  
											.attr('id', 'twittLI'+msgNb)
											.attr('class', 'twittLI')
											.appendTo("#twittList"); 	
									} else {
										jq("<li></li>") 
											.html("<a href='http://www.twitter.com/"+item.from_user+"'>@"+item.from_user+":</a> "+jq.Juitter.textFormat(item.text)+ " <a href='" + link + "'>"+readMore+"</a>")  
											.attr('id', 'twittLI'+msgNb)
											.attr('class', 'twittLI')
											.appendTo("#twittList"); 
									}
									msgNb++;
								}
							}
						});
					} else {
						// live mode
						jq.each(json.results,function(i,item) {
							if(i<numMSG && item.id>ultID){
								if(i==0) ultID=item.id;
								if (item.text != "undefined") {
									var link =  "http://twitter.com/"+item.from_user+"/status/"+item.id;  
									
									if(fromID=="image"){
										jq("<li></li>") 
											.html("<a href='http://www.twitter.com/"+item.from_user+"'><img src='"+item.profile_image_url+"' alt='"+item.from_user+"' class='juitterAvatar' /></a> "+jq.Juitter.textFormat(item.text)+ " <a href='" + link + "' class='JRM'>"+readMore+"</a>")  
											.attr('id', 'twittLI'+msgNb)
											.attr('class', 'twittLI')
											.prependTo("#twittList");
										jq('#twittLI'+msgNb).hide();
										jq('#twittLI'+msgNb).show("slow");
									} else {
										jq("<li></li>") 
											.html("<a href='http://www.twitter.com/"+item.from_user+"'>@"+item.from_user+":</a> "+jq.Juitter.textFormat(item.text)+ " <a href='" + link + "'>"+readMore+"</a>")  
											.attr('id', 'twittLI'+msgNb)
											.attr('class', 'twittLI')
											.prependTo("#twittList");
										jq('#twittLI'+msgNb).hide();
										jq('#twittLI'+msgNb).show("slow");
									}
									// remove old entries
									jq.Juitter.delRegister();
									msgNb++;
								}
							}
						});
					}
				}
			});
		},		
		textFormat: function(texto){
			//make links
			var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
			texto = texto.replace(exp,"<a href='$1' class='extLink'>$1</a>"); 
			var exp = /[\@]+([A-Za-z0-9-_]+)/ig;
			texto = texto.replace(exp,"<a href='http://twitter.com/$1' class='profileLink'>@$1</a>"); 
			var exp = /[\#]+([A-Za-z0-9-_]+)/ig;
			texto = texto.replace(exp,"<a href='http://juitter.com/#$1' onclick='jq.Juitter.changeRequest(\"searchWord\",\"$1\");return false;' class='hashLink'>#$1</a>"); 
			// make it bold
			if(mode=="searchWord"){
				regExp=eval('/ '+param+'/ig');
				newString = new String(' <b>'+param+'</b> ');
				texto = texto.replace(regExp, newString);
			}
			return texto;
		},
		temporizador: function(){
			// live mode timer
			
			aTim = timer.split("-");
			if(aTim[0]=="live" && aTim[1].length>0){
				tempo = aTim[1]*60000;
				setTimeout("jq.Juitter.update()",tempo);
			}
		}
	};	
})(jQuery);
