TypingText = function(element, interval, cursor, finishedCallback) {
  if((typeof document.getElementById == "undefined") || (typeof element.innerHTML == "undefined")) {
    this.running = true;	// Never run.
    return;
  }
  this.element = element;
  this.finishedCallback = (finishedCallback ? finishedCallback : function() { return; });
  this.interval = (typeof interval == "undefined" ? 100 : interval);
  this.origText = this.element.innerHTML;
  this.unparsedOrigText = this.origText;
  this.cursor = (cursor ? cursor : "");
  this.currentText = "";
  this.currentChar = 0;
  this.element.typingText = this;
  if(this.element.id == "") this.element.id = "typingtext" + TypingText.currentIndex++;
  TypingText.all.push(this);
  this.running = false;
  this.inTag = false;
  this.tagBuffer = "";
  this.inHTMLEntity = false;
  this.HTMLEntityBuffer = "";
}
TypingText.all = new Array();
TypingText.currentIndex = 0;
TypingText.runAll = function() {
  for(var i = 0; i < TypingText.all.length; i++) TypingText.all[i].run();
}
TypingText.prototype.run = function() {
  if(this.running) return;
  if(typeof this.origText == "undefined") {
    setTimeout("document.getElementById('" + this.element.id + "').typingText.run()", this.interval);	// We haven't finished loading yet.  Have patience.
    return;
  }
  if(this.currentText == "") this.element.innerHTML = "";
//  this.origText = this.origText.replace(/<([^<])*>/, "");     // Strip HTML from text.
  if(this.currentChar < this.origText.length) {
    if(this.origText.charAt(this.currentChar) == "<" && !this.inTag) {
      this.tagBuffer = "<";
      this.inTag = true;
      this.currentChar++;
      this.run();
      return;
    } else if(this.origText.charAt(this.currentChar) == ">" && this.inTag) {
      this.tagBuffer += ">";
      this.inTag = false;
      this.currentText += this.tagBuffer;
      this.currentChar++;
      this.run();
      return;
    } else if(this.inTag) {
      this.tagBuffer += this.origText.charAt(this.currentChar);
      this.currentChar++;
      this.run();
      return;
    } else if(this.origText.charAt(this.currentChar) == "&" && !this.inHTMLEntity) {
      this.HTMLEntityBuffer = "&";
      this.inHTMLEntity = true;
      this.currentChar++;
      this.run();
      return;
    } else if(this.origText.charAt(this.currentChar) == ";" && this.inHTMLEntity) {
      this.HTMLEntityBuffer += ";";
      this.inHTMLEntity = false;
      this.currentText += this.HTMLEntityBuffer;
      this.currentChar++;
      this.run();
      return;
    } else if(this.inHTMLEntity) {
      this.HTMLEntityBuffer += this.origText.charAt(this.currentChar);
      this.currentChar++;
      this.run();
      return;
    } else {
      this.currentText += this.origText.charAt(this.currentChar);
    }
    this.element.innerHTML = this.currentText;
    this.element.innerHTML += (this.currentChar < this.origText.length - 1 ? (typeof this.cursor == "function" ? this.cursor(this.currentText) : this.cursor) : "");
    this.currentChar++;
    setTimeout("document.getElementById('" + this.element.id + "').typingText.run()", this.interval);
  } else {
	this.currentText = "";
	this.currentChar = 0;
        this.running = false;
        this.finishedCallback();
  }
}
// -------------------------------------------------------------------
// Advanced RSS Ticker (Ajax invocation) core file
// Author: Dynamic Drive (http://www.dynamicdrive.com)
// -------------------------------------------------------------------

//Relative URL syntax:
var lastrssbridgeurl="lastrss/bridge.php"

//Absolute URL syntax. Uncomment below line if you wish to use an absolute reference:
//var lastrssbridgeurl="http://"+window.location.hostname+"/lastrss/bridge.php"

////////////No need to edit beyond here//////////////

function createAjaxObj(){
var httprequest=false
if (window.XMLHttpRequest){ // if Mozilla, Safari etc
httprequest=new XMLHttpRequest()
if (httprequest.overrideMimeType)
httprequest.overrideMimeType('text/xml')
}
else if (window.ActiveXObject){ // if IE
try {
httprequest=new ActiveXObject("Msxml2.XMLHTTP");
} 
catch (e){
try{
httprequest=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){}
}
}
return httprequest
}

// -------------------------------------------------------------------
// Main RSS Ticker Object function
// rssticker_ajax(RSS_id, cachetime, divId, divClass, delay, optionallogicswitch)
// -------------------------------------------------------------------

function rssticker_ajax(RSS_id, cachetime, divId, divClass, delay, logicswitch){
this.RSS_id=RSS_id //Array key indicating which RSS feed to display
this.cachetime=cachetime //Time to cache feed, in minutes. 0=no cache.
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.logicswitch=(typeof logicswitch!="undefined")? logicswitch : ""
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over ticker (and pause it if it is)
this.pointer=0
this.opacitysetting=0.2 //Opacity value when reset. Internal use.
this.title=[], this.link=[], this.description=[], this.pubdate=[] //Arrays to hold each component of an RSS item
this.ajaxobj=createAjaxObj()
document.write('<div id="'+divId+'" class="'+divClass+'" >Initializing ticker...</div>')
if (window.getComputedStyle) //detect if moz-opacity is defined in external CSS for specified class
this.mozopacityisdefined=(window.getComputedStyle(document.getElementById(this.tickerid), "").getPropertyValue("-moz-opacity")==1)? 0 : 1
this.getAjaxcontent()
}

// -------------------------------------------------------------------
// getAjaxcontent()- Makes asynchronous GET request to "bridge.php" with the supplied parameters
// -------------------------------------------------------------------

rssticker_ajax.prototype.getAjaxcontent=function(){
if (this.ajaxobj){
var instanceOfTicker=this
var parameters="id="+encodeURIComponent(this.RSS_id)+"&cachetime="+this.cachetime+"&bustcache="+new Date().getTime()
this.ajaxobj.onreadystatechange=function(){instanceOfTicker.initialize()}
this.ajaxobj.open('GET', lastrssbridgeurl+"?"+parameters, true)
this.ajaxobj.send(null)
}
}

// -------------------------------------------------------------------
// initialize()- Initialize ticker method.
// -Gets contents of RSS content and parse it using JavaScript DOM methods 
// -------------------------------------------------------------------

rssticker_ajax.prototype.initialize=function(){ 
if (this.ajaxobj.readyState == 4){ //if request of file completed
if (this.ajaxobj.status==200){ //if request was successful
var xmldata=this.ajaxobj.responseXML
if(xmldata.getElementsByTagName("item").length==0){ //if no <item> elements found in returned content
document.getElementById(this.tickerid).innerHTML="<b>Error</b> fetching remote RSS feed!<br />"+this.ajaxobj.responseText
return
}
var instanceOfTicker=this
this.feeditems=xmldata.getElementsByTagName("item")
//Cycle through RSS XML object and store each peice of an item inside a corresponding array
for (var i=0; i<this.feeditems.length; i++){
this.title[i]=this.feeditems[i].getElementsByTagName("title")[0].firstChild.nodeValue
this.link[i]=this.feeditems[i].getElementsByTagName("link")[0].firstChild.nodeValue
//this.description[i]=this.feeditems[i].getElementsByTagName("description")[0].firstChild.nodeValue
this.pubdate[i]=this.feeditems[i].getElementsByTagName("pubDate")[0].firstChild.nodeValue
}
document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0}
this.rotatemsg()
}
}
}

// -------------------------------------------------------------------
// rotatemsg()- Rotate through RSS messages and displays them
// -------------------------------------------------------------------

rssticker_ajax.prototype.rotatemsg=function(){
var instanceOfTicker=this
if (this.mouseoverBol==1) //if mouse is currently over ticker, do nothing (pause it)
setTimeout(function(){instanceOfTicker.rotatemsg()}, 100)
else{ //else, construct item, show and rotate it!
var tickerDiv=document.getElementById(this.tickerid)
var linktitle='<div class="rsstitle"><a href="'+this.link[this.pointer]+'">'+this.title[this.pointer]+'</a></div>'
var description='<div class="rssdescription">'+this.description[this.pointer]+'</div>'
var feeddate='<div class="rssdate">'+this.pubdate[this.pointer]+'</div>'
if (this.logicswitch.indexOf("description")==-1) description=""
if (this.logicswitch.indexOf("date")==-1) feeddate=""
var tickercontent=linktitle+feeddate+description //STRING FOR FEED CONTENTS 
this.fadetransition("reset") //FADE EFFECT- RESET OPACITY
tickerDiv.innerHTML=tickercontent
this.fadetimer1=setInterval(function(){instanceOfTicker.fadetransition('up', 'fadetimer1')}, 100) //FADE EFFECT- PLAY IT
this.pointer=(this.pointer<this.feeditems.length-1)? this.pointer+1 : 0
setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay) //update container every second
}
}

// -------------------------------------------------------------------
// fadetransition()- cross browser fade method for IE5.5+ and Mozilla/Firefox
// -------------------------------------------------------------------

rssticker_ajax.prototype.fadetransition=function(fadetype, timerid){
var tickerDiv=document.getElementById(this.tickerid)
if (fadetype=="reset")
this.opacitysetting=0.2
if (tickerDiv.filters && tickerDiv.filters[0]){
if (typeof tickerDiv.filters[0].opacity=="number") //IE6+
tickerDiv.filters[0].opacity=this.opacitysetting*100
else //IE 5.5
tickerDiv.style.filter="alpha(opacity="+this.opacitysetting*100+")"
}
else if (typeof tickerDiv.style.MozOpacity!="undefined" && this.mozopacityisdefined){
tickerDiv.style.MozOpacity=this.opacitysetting
}
if (fadetype=="up")
this.opacitysetting+=0.2
if (fadetype=="up" && this.opacitysetting>=1)
clearInterval(this[timerid])
}
//IFRAME TICKER- By Dynamic Drive (http://www.dynamicdrive.com)

//configure delay between changing messages (3000=3 seconds)
var delay=5000
var ie4=document.all
var curindex=0
var totalcontent=0
function get_total()
{
 if (ie4)
 {
  while (eval("document.all.content"+totalcontent))
	{
   totalcontent++;
  }
 }
 else
 {
  while (document.getElementById("content"+totalcontent))
	{
   totalcontent++;
	}
 }
}

function contract_all()
{
 for (y=0;y<totalcontent;y++)
 {
  if (ie4)
	{
   eval("document.all.content"+y).style.display="none";
	}
  else
	{
   document.getElementById("content"+y).style.display="none";
	}
 }
}

function expand_one(which)
{
 contract_all();
 if (ie4)
 {
  eval("document.all.content"+which).style.display="";
 }
 else
 {
  document.getElementById("content"+which).style.display="";
 }
}


function rotate_content()
{
 get_total();
 contract_all();
 expand_one(curindex);
 curindex=(curindex<totalcontent-1)? curindex+1: 0;
 setTimeout("rotate_content()",delay);
}

//window.onload=rotate_content;
//window.onload=startClock;
/*

function startClock() {
timeRemaining();
}

function string(number) {
var tempnum;
tempnum= Math.round(number)+" ";
tempnum= tempnum.substring(0,tempnum.length-1);
if (tempnum.length >3) {
tempnum = tempnum.substring(0,tempnum.length-3) + "," + tempnum.substring(tempnum.length-3, 99);
}
if (tempnum.length >7) {
tempnum = tempnum.substring(0,tempnum.length-7) + "," + tempnum.substring(tempnum.length-7, 99);
}
if (tempnum.length >11) {
tempnum = tempnum.substring(0,tempnum.length-11) + "," + tempnum.substring(tempnum.length-11, 99);
}
if (tempnum.length == 11) {
tempnum = " " + tempnum;
}
if (tempnum.length == 10) {
tempnum = " " + tempnum;
}
if (tempnum.length == 9) {
tempnum = " " + tempnum;
}
if (tempnum.length == 7) {
tempnum = " " + tempnum;
}
if (tempnum.length == 6) {
tempnum = " " + tempnum;
}
if (tempnum.length == 5) {
tempnum = " " + tempnum;
}
if (tempnum.length == 3) {
tempnum = " " + tempnum;
}
if (tempnum.length == 2) {
tempnum = " " + tempnum;
}
if (tempnum.length == 1) {
tempnum = " " + tempnum;
}
return tempnum;
}

function timeRemaining() {
var now = new Date(); 
var newyears = new Date("January 1, 2007");
var newyears2000 = new Date("January 1, 2000");
var todaysdate = new Date("January 1, 2007");
var may4 = new Date("May 4, 1999");
var currentPop;
var BirthsInYear;
newyears.setFullYear(now.getFullYear());
secsSince = Math.round(now.getTime() - newyears.getTime())/1000;
secsSince2000 = Math.round(now.getTime() - newyears2000.getTime())/1000;
secsSincePop = Math.round(now.getTime() - may4.getTime())/1000;
todaysdate.setMonth(now.getMonth());
todaysdate.setDate(now.getDate());
todaysdate.setFullYear(now.getFullYear());
secsToday = (now.getTime()-todaysdate.getTime())/1000;
// population
current_population = string(secsSincePop * 2.69 + 5965370016);
births_this_year = string((secsSince) * 4.11);
births_today = string((secsToday) * 4.11);
deaths_this_year = string((secsSince) * 1.69);
deaths_today = string((secsToday) * 1.69);
document.stats.elements["current_population"].value = current_population;
document.stats.elements["births_this_year"].value = births_this_year;
document.stats.elements["births_today"].value = births_today;
document.stats.elements["deaths_this_year"].value = deaths_this_year;
document.stats.elements["deaths_today"].value = deaths_today;

// economie
automobile_produced_this_year = string((secsSince) * 1.14);
bicycle_produced_this_year = string((secsSince) * 3.46);
computers_sold_this_year = string((secsSince) * 2.67);
document.stats.elements["automobile_produced_this_year"].value = automobile_produced_this_year;
document.stats.elements["bicycle_produced_this_year"].value = bicycle_produced_this_year;


// education
books_published = string((secsSince) * .03);
newspapers_circulated = string((secsSince) * 16.6);
movie_attendance = string((secsSince) * 403);
internet_download = string((secsSince) * 963);
document.stats.elements["books_published"].value = books_published;
document.stats.elements["newspapers_circulated"].value = newspapers_circulated;
document.stats.elements["movie_attendance"].value = movie_attendance;


// environnement
forest_loss = string((secsSince) * .36);
soil_erosion = string((secsSince) * .2);
topsoil_erosion = string((secsSince) * 747.5);
co2_emissions = string((secsSince) * 708);
earth_travel = string((secsSince) * 18.5);
weight_of_earth = string(6575000+ (secsSince2000 * .0012));
age_of_earth = string((secsSince2000 * .000000031)+4500642531);
lightning_strikes = string((secsSince) * 100);
fish_caught = string((secsSince) * 2.9);
document.stats.elements["forest_loss"].value = forest_loss;
document.stats.elements["soil_erosion"].value = soil_erosion;
document.stats.elements["topsoil_erosion"].value = topsoil_erosion;
document.stats.elements["co2_emissions"].value = co2_emissions;
document.stats.elements["earth_travel"].value = earth_travel;
document.stats.elements["weight_of_earth"].value = weight_of_earth;
document.stats.elements["age_of_earth"].value = age_of_earth;
document.stats.elements["lightning_strikes"].value = lightning_strikes;


// alimentation
food_production = string((secsSince) * .08);
calories_consumed = string((secsSince) * 197.12037);
protein_consumed = string((secsSince) * 5.28808);
document.stats.elements["calories_consumed"].value = calories_consumed;
document.stats.elements["protein_consumed"].value = protein_consumed;

// sante
deaths_communicable_diseases = string((secsSince) * .55);
deaths_children = string((secsSince) * .35);
infections_hiv = string((secsSince * .093));
deaths_aids = string((secsSince * .05));
deaths_cancer = string((secsSince) * .2);
deaths_malarial = string((secsSince) * .032);
deaths_cigarettes = string((secsSince) * .1);
deaths_pesticide = string((secsSince) * .0006);
teenage_moms = string((secsSince) * .5);
healthcare_spending = string((secsSince) * .037835);
drug_spending = string((secsSince) * .031710);
document.stats.elements["deaths_communicable_diseases"].value = deaths_communicable_diseases;
document.stats.elements["deaths_children"].value = deaths_children;
document.stats.elements["infections_hiv"].value = infections_hiv;
document.stats.elements["deaths_aids"].value = deaths_aids;
document.stats.elements["deaths_cancer"].value = deaths_cancer;
document.stats.elements["deaths_cigarettes"].value = deaths_cigarettes;
document.stats.elements["teenage_moms"].value = teenage_moms;

timerID = setTimeout("timeRemaining()", 1);
timerRunning = true;
}
*/