
	// Flooble.com's Animated Text script. Will animate a specified 
	// bit of text (determined by the ID of containing tag) by 
	// highlighting it with specified color one character at a time 
	// in a moving pattern.
	//
	// Summary of use: 
	//     call animate(tagID, color); where "tagID" is the ID 
	//     of the tag that contains text to be animated,
	//     and "color" is the color to use to highlight the text with.
	//
	// For more information, and detailed instructions, see 
	//     http://www.flooble.com/scripts/animate.php
	//
	// Copyright (c) 2002 by Animus Pactum Consulting Inc.
	// This script comes with no warranties whatsoever. 
	// Animus Pactum Consulting will not be responsible
	// for any damages resulting from its use.

		
		
		var ie4 = false;
		var first = 0;

        if(document.all) {
                ie4 = true; 
        }
        function setContent(texte_highlight, value) {
                var d;  
                if (ie4) { 
                        d = document.all[texte_highlight];
                } else {
                        d = document.getElementById(texte_highlight);
                }       
                d.innerHTML = value;    
    }       

	function getContent(texte_highlight) {
		var d;
                if (ie4) {
                        d = document.all[texte_highlight];
                } else {
                        d = document.getElementById(texte_highlight);
                }
                return d.innerHTML;
	}

        function setColor(texte_highlight, value) {
                var d;  
                if (ie4) { 
                        d = document.all[texte_highlight];
                } else {
                        d = document.getElementById(texte_highlight);
                }
                d.style.color = value;  
        }

	function getColor(texte_highlight) {
                var d;
                if (ie4) {
                        d = document.all[texte_highlight];
                } else {
                        d = document.getElementById(texte_highlight);
                }
                return d.style.color;
        }

        function animate(texte_highlight, col) {
			var value = getContent(texte_highlight);
			if (value.indexOf('<span') >= 0) { return; }
			var length = 0;
			var str = '';
			var ch;
			var token = '';
			var htmltag = false;	
			for (i = 0; i < value.length; i++) {
				ch = value.substring(i, i+1);
				if (i < value.length - 1) { nextch = value.substring(i+1, i+2); } else { nextch = ' '; }
				token += ch;
				if (ch == '<' && '/aAbBpPhHiIoOuUlLtT'.indexOf(nextch) >= 0) { htmltag = true; }
				if (ch == '>' && htmltag) { htmltag = false; }
				if (!htmltag && ch.charCodeAt(0) > 30 && ch != ' ' && ch != '\n') {		
					str += '<span id="' + texte_highlight + '_' + length + '">' + token + '</span>';
					token = '';
					length++;
				}
			}
			setContent(texte_highlight, str);
			if(first == 0){
				first=1;
				command = 'animateloop(\'' + texte_highlight + '\', ' + length + ', 0, 1, \'' + col + '\')';
				setTimeout(command , 100);
			}
        }

        function animateloop(texte_highlight, length, ind, delta, col) {
			var next = ind + delta;
			if (next >= length) { delta = delta * -1; next = ind + delta; }
			if (next < 0) { delta = delta * -1; next = ind + delta; }
			setColor(texte_highlight + '_' + ind, getColor(texte_highlight + '_' + next));
			setColor(texte_highlight + '_' + next, col);
			command = 'animateloop(\'' + texte_highlight + '\', ' + length + ', ' + next + ', ' + delta + ', \'' + col + '\')';
			setTimeout(command , 100);
        }

		function initSlogan(t,id){
			document.getElementById(id).innerHTML = t;
			col = "#9ABB55";
			texte_highlight = id;
			animate(texte_highlight, col);
		}
		
		
		function initSlogan_highlight(t,id){
			document.getElementById(id).innerHTML = t;
			col = "#9ABB55";
			texte_highlight = id;
			animate(texte_highlight, col);
		}