//Allow IE4 to work with us.
if(!document.getElementById && document.all){
	document.getElementById = function(id) {return document.all[id];}
	}

var theCharacterTimeout = 60;
var theStoryTimeout     = 10000;
var theWidgetOne        = "_";
var theWidgetTwo        = "-";
var theWidgetNone       = "";
var theLeadString       = "Actualité:  ";

var theTips = new Array();

//update or add tips here, single quotes are OK

theTips[0] = "Promotion!  -  BLACK RUSTIC (Dallage en Ardoise)  -  prix à partir de seulement 17.70 € HT par metre carré.   ";
theTips[1] = "Actuellement en stock  - PAVES EN  CALCAIRE bleu  10cm x 10cm…  47.93 € HT par mètre carré.    ";
theTips[2] = "Azur Dallage  - Votre partenaire en construction avec une diverse gamme disponible en stock d'un éventail de plus de 50 types de pierre.   ";
theTips[3] = "Pourquoi prendre du reconstitué quand vous pouvez obtenir la vrai pierre pour le même ordre de prix ?   ";
theTips[4] = "Vérifier et comparez nos tarifs… et surtout n'hésiter pas de nous contacter pour discuter des pièces sur mesure. Presque tout est possible pour des tarifs attractifs et avec respect aux délaies.  ";
theTips[5] = "Dalles en opus naturel de 12/20mm à partir de € 17.00 / m² !    ";
theTips[6] = "Laissez nous partager notre passion pour la pierre - visiter notre exposition de dallage à Opio ou nous vous fournissons gratuitement sur demande un catalogue en couleur, votre guide dans notre monde.";
theTips[7] = "Avec les produits de FILACHIM, vous pouvez protéger facilement et efficacement votre investissement pour les meilleurs résultats au long terme. ";
theTips[8] = "Avec FILAWET il est même possible d'augmenter et faire ressortir la couleur du fond de la pierre au même temps qu'on imperméabilise.  ";
theTips[9] = "Marches de 100cms longeur, 15cms hauteur contremarche et profondeur 35cms aussi bien que bordurettes EN GRES PUR, taillé main à partir  62.88 € HT par mètre.  ";

	
//end tips
	
var theItemCount = theTips.length;

if ((document.getElementById) && (document.body.innerHTML)) {
	//write div for dhtml broswers to display tips
	document.write("<div class='ticker' id='tickerAnchor'></div>");
	}else{
	//write div for non-dynamic browsers and display random tip	
	document.write("<div class='tickerred'>" + theLeadString + "</div>" + "<div class='ticker'>" + theTips[Math.round(Math.random() * (theTips.length -1))] + "</div>");
	}	

	
// Ticker startup
function startTicker()
{
	// Define run time values
	theCurrentStory     = -1;
	theCurrentLength    = 0;
	// Locate base objects
	if (document.getElementById) {	
		    theAnchorObject     = document.getElementById("tickerAnchor");
			runTheTicker();   	
		 }	
}

// Ticker main run loop
function runTheTicker()
{
	var myTimeout;  
	// Go for the next story data block
	if(theCurrentLength == 0)
	{	
		theCurrentStory++;
		theCurrentStory      = theCurrentStory % theItemCount;
		theStorySummary      = theTips[theCurrentStory].replace(/&quot;/g,'"');				
		thePrefix 	     = "<span class=\"tickerred\">" + theLeadString + "</span>";
	}
	// Stuff the current ticker text into the anchor
	theAnchorObject.innerHTML = thePrefix + 
	theStorySummary.substring(0,theCurrentLength) + whatWidget();
	// Modify the length for the substring and define the timer
	if(theCurrentLength != theStorySummary.length)
	{
		theCurrentLength++;
		myTimeout = theCharacterTimeout;
	}
	else
	{
		theCurrentLength = 0;
		myTimeout = theStoryTimeout;
	}
	// Call up the next cycle of the ticker
	setTimeout("runTheTicker()", myTimeout);
}

// Widget generator
function whatWidget()
{
	if(theCurrentLength == theStorySummary.length)
	{
		return theWidgetNone;
	}

	if((theCurrentLength % 2) == 1)
	{
		return theWidgetOne;
	}
	else
	{
		return theWidgetTwo;
	}
}

startTicker();