if (!window['google']){window['google'] = {};}if (!window['google']['loader']) {window['google']['loader'] = {};google.loader.ServiceBase = 'http://www.google.com/uds';google.loader.GoogleApisBase = 'http://ajax.googleapis.com/ajax';google.loader.ApiKey = 'notsupplied-wizard';google.loader.KeyVerified = true;google.loader.LoadFailure = false;google.loader.Secure = false;google.loader.ClientLocation = {"latitude":-30.033,"longitude":-51.2,"address":{"city":"Porto Alegre","region":"RS","country":"Brazil","country_code":"BR"}};google.loader.AdditionalParams = '';(function() {var e=false,g=null,h=true,i=encodeURIComponent,j=window,k=google,l=undefined,m=document;function n(a,b){return a.load=b}var o="push",p="length",q="prototype",r="setTimeout",t="replace",u="charAt",v="loader",w="substring",z="ServiceBase",A="name",B="getTime",C="toLowerCase";function D(a){if(a in F)return F[a];return F[a]=navigator.userAgent[C]().indexOf(a)!=-1}var F={};function G(a,b){var c=function(){};c.prototype=b[q];a.M=b[q];a.prototype=new c}function H(a,b){var c=a.B||[];c=c.concat(Array[q].slice.call(arguments,2));if(typeof a.r!="undefined")b=a.r;if(typeof a.q!="undefined")a=a.q;var d=function(){var f=c.concat(Array[q].slice.call(arguments));return a.apply(b,f)};d.B=c;d.r=b;d.q=a;return d}function I(a){var b=new Error(a);b.toString=function(){return this.message};return b}function J(a,b){for(var c=a.split(/\./),d=j,f=0;f<c[p]-1;f++){d[c[f]]||(d[c[f]]={});d=d[c[f]]}d[c[c[p]-1]]=b}function K(a,b,c){a[b]=c}if(!L)var L=J;if(!aa)var aa=K;k[v].s={};L("google.loader.callbacks",k[v].s);var M={},N={};k[v].eval={};L("google.loader.eval",k[v].eval);
n(k,function(a,b,c){var d=M[":"+a];if(d){if(c&&!c.language&&c.locale)c.language=c.locale;if(c&&typeof c.callback=="string"){var f=c.callback;if(f.match(/^[[\]A-Za-z0-9._]+$/)){f=j.eval(f);c.callback=f}}var E=c&&c.callback!=g;if(E&&!d.o())throw I("Module: '"+a+"' must be loaded before DOM onLoad!");else if(E)d.k(b,c)?j[r](c.callback,0):d.load(b,c);else d.k(b,c)||d.load(b,c)}else throw I("Module: '"+a+"' not found!");});L("google.load",k.load);k.K=function(a,b){b?ba(a):O(j,"load",a)};
L("google.setOnLoadCallback",k.K);function O(a,b,c){if(a.addEventListener)a.addEventListener(b,c,e);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var d=a["on"+b];a["on"+b]=d!=g?ca([c,d]):c}}function ca(a){return function(){for(var b=0;b<a[p];b++)a[b]()}}var P=[];
function ba(a){if(P[p]==0){O(j,"load",R);if(!D("msie")&&!(D("safari")||D("konqueror"))&&D("mozilla")||j.opera)j.addEventListener("DOMContentLoaded",R,e);else if(D("msie"))m.write("<script defer onreadystatechange='google.loader.domReady()' src=//:><\/script>");else(D("safari")||D("konqueror"))&&j[r](S,10)}P[o](a)}k[v].G=function(){var a=j.event.srcElement;if(a.readyState=="complete"){a.onreadystatechange=g;a.parentNode.removeChild(a);R()}};L("google.loader.domReady",k[v].G);var da={loaded:h,complete:h};
function S(){if(da[m.readyState])R();else P[p]>0&&j[r](S,10)}function R(){for(var a=0;a<P[p];a++)P[a]();P.length=0}
k[v].d=function(a,b,c){if(c){var d;if(a=="script"){d=m.createElement("script");d.type="text/javascript";d.src=b}else if(a=="css"){d=m.createElement("link");d.type="text/css";d.href=b;d.rel="stylesheet"}var f=m.getElementsByTagName("head")[0];f||(f=m.body.parentNode.appendChild(m.createElement("head")));f.appendChild(d)}else if(a=="script")m.write('<script src="'+b+'" type="text/javascript"><\/script>');else a=="css"&&m.write('<link href="'+b+'" type="text/css" rel="stylesheet"></link>')};
L("google.loader.writeLoadTag",k[v].d);k[v].H=function(a){N=a};L("google.loader.rfm",k[v].H);k[v].J=function(a){for(var b in a)if(typeof b=="string"&&b&&b[u](0)==":"&&!M[b])M[b]=new T(b[w](1),a[b])};L("google.loader.rpl",k[v].J);k[v].I=function(a){if((a=a.specs)&&a[p])for(var b=0;b<a[p];++b){var c=a[b];if(typeof c=="string")M[":"+c]=new U(c);else{var d=new V(c);M[":"+d[A]]=d}}};L("google.loader.rm",k[v].I);k[v].loaded=function(a){M[":"+a.module].i(a)};L("google.loader.loaded",k[v].loaded);
J("google_exportSymbol",J);J("google_exportProperty",K);function U(a){this.a=a;this.m={};this.b={};this.j=h;this.c=-1}
U[q].f=function(a,b){var c="";if(b!=l){if(b.language!=l)c+="&hl="+i(b.language);if(b.nocss!=l)c+="&output="+i("nocss="+b.nocss);if(b.nooldnames!=l)c+="&nooldnames="+i(b.nooldnames);if(b.packages!=l)c+="&packages="+i(b.packages);if(b.callback!=g)c+="&async=2";if(b.other_params!=l)c+="&"+b.other_params}if(!this.j){if(k[this.a]&&k[this.a].JSHash)c+="&sig="+i(k[this.a].JSHash);var d=[];for(var f in this.m)f[u](0)==":"&&d[o](f[w](1));for(f in this.b)f[u](0)==":"&&d[o](f[w](1));c+="&have="+i(d.join(","))}return k[v][z]+
"/?file="+this.a+"&v="+a+k[v].AdditionalParams+c};U[q].u=function(a){var b=g;if(a)b=a.packages;var c=g;if(b)if(typeof b=="string")c=[a.packages];else if(b[p]){c=[];for(var d=0;d<b[p];d++)typeof b[d]=="string"&&c[o](b[d][t](/^\s*|\s*$/,"")[C]())}c||(c=["default"]);var f=[];for(d=0;d<c[p];d++)this.m[":"+c[d]]||f[o](c[d]);return f};
n(U[q],function(a,b){var c=this.u(b),d=b&&b.callback!=g;if(d)var f=new W(b.callback);for(var E=[],s=c[p]-1;s>=0;s--){var x=c[s];d&&f.C(x);if(this.b[":"+x]){c.splice(s,1);d&&this.b[":"+x][o](f)}else E[o](x)}if(c[p]){if(b&&b.packages)b.packages=c.sort().join(",");if(!b&&N[":"+this.a]!=g&&N[":"+this.a].versions[":"+a]!=g&&!k[v].AdditionalParams&&this.j){var y=N[":"+this.a];k[this.a]=k[this.a]||{};for(var Q in y.properties)if(Q&&Q[u](0)==":")k[this.a][Q[w](1)]=y.properties[Q];k[v].d("script",k[v][z]+
y.path+y.js,d);y.css&&k[v].d("css",k[v][z]+y.path+y.css,d)}else if(!b||!b.autoloaded)k[v].d("script",this.f(a,b),d);if(this.j){this.j=e;this.c=(new Date)[B]();if(this.c%100!=1)this.c=-1}for(s=0;s<E[p];s++){x=E[s];this.b[":"+x]=[];d&&this.b[":"+x][o](f)}}});
U[q].i=function(a){if(this.c!=-1){X("al_"+this.a,"jl."+((new Date)[B]()-this.c),h);this.c=-1}for(var b=0;b<a.components[p];b++){this.m[":"+a.components[b]]=h;var c=this.b[":"+a.components[b]];if(c){for(var d=0;d<c[p];d++)c[d].F(a.components[b]);delete this.b[":"+a.components[b]]}}X("hl",this.a)};U[q].k=function(a,b){return this.u(b)[p]==0};U[q].o=function(){return h};function W(a){this.D=a;this.l={};this.n=0}W[q].C=function(a){this.n++;this.l[":"+a]=h};
W[q].F=function(a){if(this.l[":"+a]){this.l[":"+a]=e;this.n--;this.n==0&&j[r](this.D,0)}};function V(a){this.name=a[A];this.p=a.uri;this.z=a.ssl;this.v=a.key;this.A=a.version;this.L=a.deferred;this.w=a.params;this.t=this.g=e;this.h=[];k[v].s[this[A]]=H(this.i,this)}G(V,U);n(V[q],function(a,b){var c=b&&b.callback!=g;if(c){this.h[o](b.callback);b.callback="google.loader.callbacks."+this[A]}else this.g=h;if(!b||!b.autoloaded)k[v].d("script",this.f(a,b),c)});V[q].k=function(a,b){return b&&b.callback!=g?this.t:this.g};
V[q].i=function(){this.t=h;for(var a=0;a<this.h[p];a++)j[r](this.h[a],0);this.h=[]};var Y=function(a,b){return a.string?i(a.string)+"="+i(b):a.regex?b[t](/(^.*$)/,a.regex):""};
V[q].f=function(a,b){var c="";if(this.v)c+="&"+Y(this.v,k[v].ApiKey);if(this.A)c+="&"+Y(this.A,a);var d=k[v].Secure&&this.z?this.z:this.p;if(b!=g)for(var f in b)if(this.w[f])c+="&"+Y(this.w[f],b[f]);else if(f=="other_params")c+="&"+b[f];else if(f=="base_domain")d="http://"+b[f]+this.p[w](this.p.indexOf("/",7));k[this[A]]={};if(d.indexOf("?")==-1&&c)c="?"+c[w](1);X("el",this[A]);return d+c};V[q].o=function(){return this.L};function T(a,b){this.a=a;this.e=b;this.g=e}G(T,U);n(T[q],function(a,b){this.g=h;k[v].d("script",this.f(a,b),e)});T[q].k=function(){return this.g};T[q].i=function(){};T[q].f=function(a,b){if(!this.e.versions[":"+a]){if(this.e.aliases){var c=this.e.aliases[":"+a];if(c)a=c}if(!this.e.versions[":"+a])throw I("Module: '"+this.a+"' with version '"+a+"' not found!");}var d=k[v].GoogleApisBase+"/libs/"+this.a+"/"+a+"/"+this.e.versions[":"+a][b&&b.uncompressed?"uncompressed":"compressed"];X("el",this.a);return d};
T[q].o=function(){return e};var ea=e,Z=[],fa=(new Date)[B](),X=function(a,b,c){if(!ea){O(j,"unload",ga);ea=h}if(c){if(!k[v].Secure&&(!k[v].Options||k[v].Options.csi===e)){a=a[C]()[t](/[^a-z0-9_.]+/g,"_");b=b[C]()[t](/[^a-z0-9_.]+/g,"_");var d="http://csi.gstatic.com/csi?s=uds&v=2&action="+i(a)+"&it="+i(b);j[r](H($,g,d),10000)}}else{Z[o]("r"+Z[p]+"="+i(a+(b?"|"+b:"")));j[r](ga,Z[p]>5?0:15000)}},ga=function(){if(Z[p]){$(k[v][z]+"/stats?"+Z.join("&")+"&nc="+(new Date)[B]()+"_"+((new Date)[B]()-fa));Z.length=0}},$=function(a){var b=
new Image,c=ha++;ia[c]=b;b.onload=b.onerror=function(){delete ia[c]};b.src=a;b=g},ia={},ha=0;J("google.loader.recordStat",X);J("google.loader.createImageForLogging",$);
}) ();google.loader.rm({"specs":["feeds",{"name":"books","uri":"http://books.google.com/books/api.js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"string":"callback"},"language":{"string":"hl"}}},{"name":"friendconnect","uri":"http://www.google.com/friendconnect/script/friendconnect.js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":false,"params":{}},"spreadsheets","gdata","visualization",{"name":"sharing","uri":"http://www.google.com/s2/sharing/js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":false,"params":{"language":{"string":"hl"}}},"search",{"name":"maps","uri":"http://maps.google.com/maps?file\u003dgoogleapi","ssl":"https://maps-api-ssl.google.com/maps?file\u003dgoogleapi","key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"regex":"callback\u003d$1\u0026async\u003d2"},"language":{"string":"hl"}}},"language","earth",{"name":"annotations","uri":"http://www.google.com/reviews/scripts/annotations_bootstrap.js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"string":"callback"},"language":{"string":"hl"},"country":{"string":"gl"}}},"ads","elements"]});
google.loader.rfm({":feeds":{"versions":{":1":"1",":1.0":"1"},"path":"/api/feeds/1.0/d6955a57b581b65b269c5c11faa8a9d7/","js":"default+pt_BR.I.js","css":"default.css","properties":{":JSHash":"d6955a57b581b65b269c5c11faa8a9d7",":Version":"1.0"}},":search":{"versions":{":1":"1",":1.0":"1"},"path":"/api/search/1.0/9ef1cc8f70099f70f3bcc177f9328d10/","js":"default+pt_BR.I.js","css":"default.css","properties":{":JSHash":"9ef1cc8f70099f70f3bcc177f9328d10",":NoOldNames":false,":Version":"1.0"}},":language":{"versions":{":1":"1",":1.0":"1"},"path":"/api/language/1.0/9c8775e33e5fa842945550fd5f62160a/","js":"default+pt_BR.I.js","properties":{":JSHash":"9c8775e33e5fa842945550fd5f62160a",":Version":"1.0"}},":spreadsheets":{"versions":{":0":"1",":0.1":"1"},"path":"/api/spreadsheets/0.1/217f714e2931810693cd980edd44ad05/","js":"default.I.js","properties":{":JSHash":"217f714e2931810693cd980edd44ad05",":Version":"0.1"}},":annotations":{"versions":{":1":"1",":1.0":"1"},"path":"/api/annotations/1.0/2d5c6b4b6d5b6cf5a6eda70dd2f289d9/","js":"default+en.I.js","properties":{":JSHash":"2d5c6b4b6d5b6cf5a6eda70dd2f289d9",":Version":"1.0"}},":earth":{"versions":{":1":"1",":1.0":"1"},"path":"/api/earth/1.0/bd6682f8238442cc68413f5aaa472775/","js":"default.I.js","properties":{":JSHash":"bd6682f8238442cc68413f5aaa472775",":Version":"1.0"}},":ads":{"versions":{":1":"1",":1.0":"1"},"path":"/api/ads/1.0/e7f58d7238e6936cf054f87419e6aae1/","js":"default.I.js","properties":{":JSHash":"e7f58d7238e6936cf054f87419e6aae1",":Version":"1.0"}}});
google.loader.rpl({":scriptaculous":{"versions":{":1.8.2":{"uncompressed":"scriptaculous.js","compressed":"scriptaculous.js"},":1.8.1":{"uncompressed":"scriptaculous.js","compressed":"scriptaculous.js"}},"aliases":{":1.8":"1.8.2",":1":"1.8.2"}},":yui":{"versions":{":2.6.0":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"},":2.7.0":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"}},"aliases":{":2":"2.7.0",":2.7":"2.7.0",":2.6":"2.6.0"}},":swfobject":{"versions":{":2.1":{"uncompressed":"swfobject_src.js","compressed":"swfobject.js"}},"aliases":{":2":"2.1"}},":mootools":{"versions":{":1.2.1":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.2.2":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.11":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"}},"aliases":{":1":"1.11"}},":jqueryui":{"versions":{":1.6.0":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.7.0":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.7.1":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.5.3":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.5.2":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"}},"aliases":{":1.7":"1.7.1",":1.6":"1.6.0",":1":"1.7.1",":1.5":"1.5.3"}},":prototype":{"versions":{":1.6.0.2":{"uncompressed":"prototype.js","compressed":"prototype.js"},":1.6.0.3":{"uncompressed":"prototype.js","compressed":"prototype.js"}},"aliases":{":1":"1.6.0.3",":1.6":"1.6.0.3"}},":jquery":{"versions":{":1.2.3":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.3.1":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.3.0":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.3.2":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.2.6":{"uncompressed":"jquery.js","compressed":"jquery.min.js"}},"aliases":{":1":"1.3.2",":1.3":"1.3.2",":1.2":"1.2.6"}},":dojo":{"versions":{":1.2.3":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.1.1":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.3.0":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.2.0":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"}},"aliases":{":1":"1.3.0",":1.3":"1.3.0",":1.2":"1.2.3",":1.1":"1.1.1"}}});
}

function GFdynamicFeedControl(feedUrls, container, options) {
  this.nodes = {};
  this.collapseElements = [];
  this.feeds = [];
  this.results = [];
  if (typeof feedUrls == 'string') {
    this.feeds.push({url:feedUrls});
  } else if (typeof feedUrls == 'object') {
    for (var i=0; i<feedUrls.length; i++) {
      var entry = feedUrls[i];
      var o = {};
      var feedUrl;
      if (typeof entry == 'string') {
        o.url = feedUrls[i];
      } else if (typeof entry == 'object') {
        o = feedUrls[i];
	if (o && o.title) {
	  var s = o.title;
	  o.title = s.replace(/</g,'&lt;').replace(/>/g, '&gt;');
	}
      }
      this.feeds.push(o);
    }
  }
  if (typeof container == "string") {
    container = document.getElementById(container);
  }
  this.parseOptions_(options);
  this.setup_(container);
}
GFdynamicFeedControl.DEFAULT_NUM_RESULTS = 5;             /* ----> qtde de notícias/url <---- */
GFdynamicFeedControl.DEFAULT_FEED_CYCLE_TIME = 1800000;
GFdynamicFeedControl.DEFAULT_DISPLAY_TIME = 5000;
GFdynamicFeedControl.DEFAULT_FADEOUT_TIME = 1000;
GFdynamicFeedControl.DEFAULT_TRANSISTION_STEP = 40;
GFdynamicFeedControl.DEFAULT_HOVER_TIME = 100;
GFdynamicFeedControl.prototype.parseOptions_ = function(options) {
  this.options = {
    numResults : GFdynamicFeedControl.DEFAULT_NUM_RESULTS,
    feedCycleTime : GFdynamicFeedControl.DEFAULT_FEED_CYCLE_TIME,
    //linkTarget : google.feeds.LINK,                              /* ----> Abre notícia na mesma janela <---- */
    linkTarget : google.feeds.LINK_TARGET_BLANK,                   /* ----> Abre notícia em uma nova janela <---- */
    displayTime : GFdynamicFeedControl.DEFAULT_DISPLAY_TIME,
    transitionTime : GFdynamicFeedControl.DEFAULT_TRANSISTION_TIME,
    transitionStep : GFdynamicFeedControl.DEFAULT_TRANSISTION_STEP,
    fadeOutTime: GFdynamicFeedControl.DEFAULT_FADEOUT_TIME,
    scrollOnFadeOut : true,
    pauseOnHover : true,
    hoverTime : GFdynamicFeedControl.DEFAULT_HOVER_TIME,
    autoCleanup : true,
    transitionCallback : null,
    feedTransitionCallback : null,
    feedLoadCallback : null,
    collapseable : false,
    sortByDate : false,
    horizontal : false,
    stacked : false,
    title : null
  };
  if (options) {
    for (var o in this.options) {
      if (typeof options[o] != 'undefined') {
        this.options[o] = options[o];
      }
    }
  }
  if(!this.options.stacked) {
    this.options.collapseable = false;
  }
  this.options.displayTime = Math.max(200, this.options.displayTime);
  this.options.fadeOutTime = Math.max(0, this.options.fadeOutTime);
  var ts = this.options.fadeOutTime / this.options.transitionStep;
  this.fadeOutDelta = Math.min(1, (1.0/ts));
  this.started = false;
};
GFdynamicFeedControl.prototype.setup_ = function(container) {
  if (container == null) return;
  this.nodes.container = container;
  if (window.ActiveXObject) {
    this.ie = this[window.XMLHttpRequest ? 'ie7' : 'ie6'] = true;
  } else if (document.childNodes && !document.all && !navigator.taintEnabled) {
    this.safari = true;
  } else if (document.getBoxObjectFor != null) {
    this.gecko = true;
  }
  this.feedControl = new google.feeds.FeedControl();
  this.feedControl.setLinkTarget(this.options.linkTarget);
  this.expected = this.feeds.length;
  this.errors = 0;
  for (var i = 0; i < this.feeds.length; i++) {
    var feed = new google.feeds.Feed(this.feeds[i].url);
    feed.setResultFormat(google.feeds.Feed.JSON_FORMAT);
    feed.setNumEntries(this.options.numResults);
    feed.load(this.bind_(this.feedLoaded_, i));
  }
};
GFdynamicFeedControl.prototype.bind_ = function(method) {
  var self = this;
  var opt_args = [].slice.call(arguments, 1);
  return function() {
    var args = opt_args.concat([].slice.call(arguments));
    return method.apply(self, args);
  }
};
GFdynamicFeedControl.prototype.feedLoaded_ = function(index, result) {
  if (this.options.feedLoadCallback) {
    this.options.feedLoadCallback(result);
  }
  if (result.error) {
    if (++this.errors >= this.expected) {
      this.nodes.container.innerHTML = 'Feed' + ((this.expected > 1)?'s ':' ') + 'não pode ser carregado.';
    }
    return;
  }
  if (this.feeds[index].title) {
    result.feed.title = this.feeds[index].title;
  }
  this.results.push(result);
  if (!this.started) {
    this.createSubContainers_();
    this.displayResult_(0);
  } else if (!this.options.horizontal && this.options.stacked) {
    this.addResult_(this.results.length-1);
  }
};
GFdynamicFeedControl.prototype.sortByDate_ = function(resultIndex, newTitle, newList) {
  var newEntryDate = this.results[resultIndex].feed.entries[0].publishedDate;
  var newEntryDateMS = Date.parse(newEntryDate);
  var insertIndex = null;
  for (var i = 0; i < this.results.length; i++) {
    var mostRecentPost = this.results[i].feed.entries[0].publishedDate;
    var mostRecentPostMS = Date.parse(mostRecentPost);
    if(newEntryDateMS > mostRecentPostMS) {
      insertIndex = i;
      break;
    }
  }
  if(insertIndex == null) {
    this.nodes.root.appendChild(newTitle);
    this.nodes.root.appendChild(newList);
    this.createListEntries_(resultIndex, newList);
    return;
  }
  var insertBeforeIndex = 2 + (insertIndex * 2);
  var swapToIndex = insertBeforeIndex + 2;
  var tempSwap = null;
  var myResultIndex = resultIndex + 1;
  var sectionsToChange = this.nodes.root.childNodes;
  var nodeToInsertBefore = sectionsToChange[insertBeforeIndex];
  this.nodes.root.insertBefore(newTitle, nodeToInsertBefore);
  this.nodes.root.insertBefore(newList, nodeToInsertBefore);
  this.results.splice(insertIndex, 0, this.results[resultIndex]);
  this.results.splice(myResultIndex, 1);
  var nodesToChangeClick = sectionsToChange[swapToIndex].nextSibling.childNodes;
  this.createListEntries_(insertIndex, newList);
  if(insertIndex == 0) {
    this.displayResult_(0);
  }
  insertIndex += 1;
  for (var i = swapToIndex; i < sectionsToChange.length; i += 2) {
    var nodesToChangeClick = sectionsToChange[i].nextSibling.childNodes;
    for (var j=0; j < nodesToChangeClick.length; j++) {
      nodesToChangeClick[j].onmouseover = this.bind_(this.listMouseOver_, insertIndex, j);
      nodesToChangeClick[j].onmouseout = this.bind_(this.listMouseOut_, insertIndex, j);
    }
    insertIndex++;
  }
};
GFdynamicFeedControl.prototype.addResult_ = function(resultIndex) {
  var result = this.results[resultIndex];
  var newTitle = this.createDiv_('gfg-subtitle');
  this.setTitle_(result.feed, newTitle);
  var newList = this.createDiv_('gfg-list');
  if(this.options.collapseable) {
    var collapseLink = document.createElement('div');
    newList.style.display = 'none';
    collapseLink.className = 'gfg-collapse-closed';
    newTitle.appendChild(collapseLink);
    collapseLink.onclick = this.toggleCollapse(this, newList, collapseLink);
    this.collapseElements.push({
      list : newList,
      collapse : collapseLink
    });
  }
  var clearFloat = document.createElement('div');
  clearFloat.className = 'clearFloat';
  newTitle.appendChild(clearFloat);
  if(!this.options.sortByDate) {
    this.nodes.root.appendChild(newTitle);
    this.nodes.root.appendChild(newList);
    this.createListEntries_(resultIndex, newList);
  } else {
    this.sortByDate_(resultIndex, newTitle, newList);
  }

};
GFdynamicFeedControl.prototype.displayResult_ = function(resultIndex) {
  this.resultIndex = resultIndex;
  var result = this.results[resultIndex];
  if (this.options.feedTransitionCallback) {
    this.options.feedTransitionCallback(result);
  }
  if (this.options.title) {
    this.setPlainTitle_(this.options.title);
  } else {
    this.setTitle_(result.feed);
  }
  this.clearNode_(this.nodes.entry);

  if (this.started && !this.options.horizontal && this.options.stacked) {
    this.entries = result.feed.entries;
  } else {
    this.createListEntries_(resultIndex, this.nodes.list);
  }
  this.displayEntries_();
}
GFdynamicFeedControl.prototype.setPlainTitle_ = function(title, opt_element) {
  var el = opt_element || this.nodes.title;
  el.innerHTML = title;
}
GFdynamicFeedControl.prototype.setTitle_ = function(resultFeed, opt_element) {
  var el = opt_element || this.nodes.title;
  this.clearNode_(el);
  var link = document.createElement('a');
  link.target = google.feeds.LINK_TARGET_BLANK;
  link.href = resultFeed.link;
  link.className = 'gfg-collapse-href';
  link.innerHTML = resultFeed.title;
  el.appendChild(link);
}
GFdynamicFeedControl.prototype.toggleCollapse = function(feedControl, listReference, collapseLink) {
  return function() {
    var els = feedControl.collapseElements;
    for (var i=0; i < els.length; i++) {
      var el = els[i];
      el.list.style.display = 'none';
      el.collapse.className = 'gfg-collapse-closed';
    }
    listReference.style.display = 'block';
    collapseLink.className = 'gfg-collapse-open';
  }
}
GFdynamicFeedControl.prototype.createListEntries_ = function(resultIndex, node) {
  var entries = this.results[resultIndex].feed.entries;
  this.clearNode_(node);
  for (var i = 0; i < entries.length; i++) {
    this.feedControl.createHtml(entries[i]);
    var className = 'gfg-listentry ';
    className += (i%2)?'gfg-listentry-even':'gfg-listentry-odd';
    var listEntry = this.createDiv_(className);
    var link = this.createLink_(entries[i].link, entries[i].title, this.options.linkTarget);
    listEntry.appendChild(link);
    if (this.options.pauseOnHover) {
      listEntry.onmouseover = this.bind_(this.listMouseOver_, resultIndex, i);
      listEntry.onmouseout = this.bind_(this.listMouseOut_, resultIndex, i);
    }
    entries[i].listEntry = listEntry;
    node.appendChild(listEntry);
  }
  if (node == this.nodes.list) {
    this.entries = entries;
  }
}
GFdynamicFeedControl.prototype.displayEntries_ = function() {
  this.entryIndex = 0;
  this.displayCurrentEntry_();
  this.setDisplayTimer_();
  this.started = true;
}
GFdynamicFeedControl.prototype.displayNextEntry_ = function() {
  if (this.options.autoCleanup && this.isOrphaned_()) {
      this.cleanup_();
      return;
  }
  if (++this.entryIndex >= this.entries.length) {
    if (this.results.length > 1) {
      if (++this.resultIndex >= this.results.length) {
        this.resultIndex = 0;
      }
      this.displayResult_(this.resultIndex);
      return;
    } else {
      this.entryIndex = 0;
    }
  }
  if (this.options.transitionCallback) {
    this.options.transitionCallback(this.entries[this.entryIndex]);
  }
  this.displayCurrentEntry_();
  this.setDisplayTimer_();
}
GFdynamicFeedControl.prototype.displayCurrentEntry_ = function() {
  this.clearNode_(this.nodes.entry);
  this.current = this.entries[this.entryIndex].html;
  this.current.style.top = '0px';
  this.nodes.entry.appendChild(this.current);
  this.createOverlay_();
  if(this.options.collapseable) {
    var feedTitle = null;

    for (var i=0; i < this.results.length; i++) {
      if(this.results[i].feed.entries == this.entries) {
        feedTitle = this.results[i].feed.title;
      }
    }
    var els = this.collapseElements;

    for (var i=0; i < els.length; i++) {
      var el = els[i];
      var divfeedTitle = el.collapse.previousSibling.innerHTML;
      var expandClicker = el.collapse;
      if(feedTitle == divfeedTitle) {
        if(this.ie) {
          expandClicker.click();
        } else {
          expandClicker.onclick();
        }

      }
    }
  }
  if (this.currentList) {
    var className = 'gfg-listentry ';
    className += (this.currentListIndex%2)? 'gfg-listentry-even':'gfg-listentry-odd';
    this.currentList.className = className;
  }
  this.currentList = this.entries[this.entryIndex].listEntry;
  this.currentListIndex = this.entryIndex;
  var className = 'gfg-listentry gfg-listentry-highlight ';
  className += (this.currentListIndex%2)? 'gfg-listentry-even':'gfg-listentry-odd';
  this.currentList.className = className;
}
GFdynamicFeedControl.prototype.listMouseHover_ = function(resultIndex,
                                                          listIndex) {
  var result = this.results[resultIndex];
  var listEntry = result.feed.entries[listIndex].listEntry;
  listEntry.selectTimer = null;
  this.clearTransitionTimer_();
  this.clearDisplayTimer_();
  this.resultIndex = resultIndex;
  this.entries = result.feed.entries;
  this.entryIndex = listIndex;
  this.displayCurrentEntry_();
}
GFdynamicFeedControl.prototype.listMouseOver_ = function(resultIndex, listIndex) {
  var result = this.results[resultIndex];
  var listEntry = result.feed.entries[listIndex].listEntry;
  var cb = this.bind_(this.listMouseHover_, resultIndex, listIndex);
  listEntry.selectTimer = setTimeout(cb, this.options.hoverTime);
}
GFdynamicFeedControl.prototype.listMouseOut_ = function(resultIndex, listIndex) {
  var result = this.results[resultIndex];
  var listEntry = result.feed.entries[listIndex].listEntry;
  if (listEntry.selectTimer) {
    clearTimeout(listEntry.selectTimer);
    listEntry.selectTimer = null;
  } else {
    this.setDisplayTimer_();
  }
}
GFdynamicFeedControl.prototype.entryMouseOver_ = function(e) {
  this.clearDisplayTimer_();
  if (this.transitionTimer) {
    this.clearTransitionTimer_();
    this.displayCurrentEntry_();
  }
}
GFdynamicFeedControl.prototype.entryMouseOut_ = function(e) {
  this.setDisplayTimer_();
}
GFdynamicFeedControl.prototype.createOverlay_ = function() {
  if (this.current == null) return;
  if (this.overlay == null) {
    var overlay = this.createDiv_('gfg-entry');
    overlay.style.position = 'absolute';
    overlay.style.top = '0px';
    overlay.style.left = '0px';
    this.overlay = overlay;
  }
  this.setOpacity_(this.overlay, 0);
  this.nodes.entry.appendChild(this.overlay);
}
GFdynamicFeedControl.prototype.setDisplayTimer_ = function() {
  if (this.displayTimer) {
    this.clearDisplayTimer_();
  }
  var cb = this.bind_(this.setFadeOutTimer_);
  this.displayTimer = setTimeout(cb, this.options.displayTime);
};
GFdynamicFeedControl.timeNow = function() {
  var d = new Date();
  return d.getTime();
};
GFdynamicFeedControl.prototype.fadeOutEntry_ = function() {
  if (this.overlay) {
    var delta = this.fadeOutDelta;
    var ts = this.options.transitionStep;
    var now = GFdynamicFeedControl.timeNow();
    var tick = now - this.lastTick;
    this.lastTick = now;
    delta *= (tick/ts);

    var op = this.overlay.opacity + delta;
    this.setOpacity_(this.overlay, op);
    if (this.options.scrollOnFadeOut && (op > .5)) {
      var r = (op-.5)*2;
      var newTop = Math.round(this.current.offsetHeight * r);
      this.current.style.top = newTop + 'px';
    }
    if (op < 1) return;
  }
  this.clearTransitionTimer_();
  this.displayNextEntry_();
};
GFdynamicFeedControl.prototype.setFadeOutTimer_ = function() {
  this.clearTransitionTimer_();
  this.lastTick = GFdynamicFeedControl.timeNow();
  var cb = this.bind_(this.fadeOutEntry_);
  this.transitionTimer = setInterval(cb, this.options.transitionStep);
};
GFdynamicFeedControl.prototype.clearTransitionTimer_ = function() {
  if (this.transitionTimer) {
    clearInterval(this.transitionTimer);
    this.transitionTimer = null;
  }
};
GFdynamicFeedControl.prototype.clearDisplayTimer_ = function() {
  if (this.displayTimer) {
    clearTimeout(this.displayTimer);
    this.displayTimer = null;
  }
};
GFdynamicFeedControl.prototype.createSubContainers_ = function() {
  var nodes = this.nodes;
  var container = this.nodes.container;

  this.clearNode_(container);
  if (this.options.horizontal) {
    container = this.createDiv_('gfg-horizontal-container');
    nodes.root = this.createDiv_('gfg-horizontal-root');
    this.nodes.container.appendChild(container);
  } else {
    nodes.root = this.createDiv_('gfg-root');
  }
  nodes.title = this.createDiv_('gfg-title');
  nodes.entry = this.createDiv_('gfg-entry');
  nodes.list = this.createDiv_('gfg-list');
  nodes.root.appendChild(nodes.title);
  nodes.root.appendChild(nodes.entry);
  if (!this.options.horizontal && this.options.stacked) {
    var newTitle = this.createDiv_('gfg-subtitle');
    nodes.root.appendChild(newTitle);
    this.setTitle_(this.results[0].feed, newTitle);
    if(this.options.collapseable) {
      var collapseLink = document.createElement('div');
      collapseLink.className = 'gfg-collapse-open';
      newTitle.appendChild(collapseLink);
      collapseLink.onclick = this.toggleCollapse(this, nodes.list, collapseLink);
      this.collapseElements.push({
        list : nodes.list,
        collapse : collapseLink
      });
      nodes.list.style.display = 'block';
    }
    var clearFloat = document.createElement('div');
    clearFloat.className = 'clearFloat';
    newTitle.appendChild(clearFloat);
  }
  nodes.root.appendChild(nodes.list);
  container.appendChild(nodes.root);
  if (this.options.pauseOnHover) {
    nodes.entry.onmouseover = this.bind_(this.entryMouseOver_);
    nodes.entry.onmouseout = this.bind_(this.entryMouseOut_);
  }
  if (this.options.horizontal) {
    nodes.branding = this.createDiv_('gfg-branding');
    google.feeds.getBranding(nodes.branding, google.feeds.VERTICAL_BRANDING);
    container.appendChild(nodes.branding);
  }
};

GFdynamicFeedControl.prototype.clearNode_ = function(node) {
  if (node == null) return;
  var child;
  while ((child = node.firstChild)) {
    node.removeChild(child);
  }
};
GFdynamicFeedControl.prototype.createDiv_ = function(opt_className, opt_text) {
  var el = document.createElement("div");
  if (opt_text) {
    el.innerHTML = opt_text;
  }
  if (opt_className) { el.className = opt_className; }
  return el;
};
GFdynamicFeedControl.prototype.createLink_ = function(href, text, opt_target) {
  var link = document.createElement('a');
  link.href = href;
  link.innerHTML = text;
  if (opt_target) {
    link.target = opt_target;
  }
  return link;
};
GFdynamicFeedControl.prototype.clearResults_ = function() {
  for (var i=0; i < this.results.length; i++) {
    var result = this.results[i];
    var entries = result.feed.entries;
    for (var i = 0; i < entries.length; i++) {
      var entry = entries[i];
      entry.html = null;
      entry.listEntry.onmouseover = null;
      entry.listEntry.onmouseout = null;
      if (entry.listEntry.selectTimer) {
        clearTimeout(entry.listEntry.selectTimer);
        entry.listEntry.selectTimer = null;
      }
      entry.listEntry = null;
    }
  }
}
GFdynamicFeedControl.prototype.isOrphaned_ = function() {
  var root = this.nodes.root;
  var orphaned = false;
  if (!root || !root.parentNode) {
    orphaned = true;
  } else if (this.options.horizontal && !root.parentNode.parentNode) {
    orphaned = true;
  }
  return orphaned;
}
GFdynamicFeedControl.prototype.cleanup_ = function() {
  this.started = false;
  this.clearDisplayTimer_();
  this.clearTransitionTimer_();
  this.clearResults_();
  this.clearNode_(this.nodes.root);
  this.nodes.container = null;
}
GFdynamicFeedControl.prototype.setOpacity_ = function(node, opacity) {
  if (node == null) return;
  opacity = Math.max(0, Math.min(1, opacity));
  if (opacity == 0) {
    if (node.style.visibility != 'hidden') {
      node.style.visibility = 'hidden';
    }
  } else {
    if (node.style.visibility != 'visible') {
      node.style.visibility = 'visible';
    }
  }
  if (this.ie) {
    var normalized = Math.round(opacity*100);
    node.style.filter = 'alpha(opacity=' + normalized + ')';
  }
  node.style.opacity = node.opacity = opacity;
};
GFgadget = GFdynamicFeedControl;
