﻿// JavaScript Document
var strTxtSeparator=" --- ";
var strtxtF="La Commission économique des Nations Unies pour l Europe vous souhaite la bienvenue";
var strtxtE="Welcome to the United Nations Economic Commission for Europe";
var YourMess = "TechXcel.com - provides technical excellence… ";

var strTxt = strtxtF + strTxtSeparator + strtxtE;
var lentxt=strTxt.length;
var width=100;
var pos=1-width;

function scroll() {
  pos++;
  var scroller="";
  if (pos==lentxt) {
    pos=1-width;
  }
  if (pos<0) {
   for (var i=1; i<=Math.abs(pos); i++) {
     scroller=scroller+" ";}
     scroller=scroller+strTxt.substring(0,width-i+1);
   }
   else {
     scroller=scroller+strTxt.substring(pos,width+pos);
   }
   window.status = scroller;
   setTimeout("scroll()",150);
} 

function playRandomSound() {
  IE = (document.all);
	var nbMusic=10;
  var index=Math.floor( Math.random()*nbMusic + 1);
	var sound="sounds/ouverture" + index +  ".mp3";
	//alert (sound)
  if (IE) {
    document.all.music.src=sound;
	}
  else 
	 {//document.NNMusic.play(false);
	 }
}

function initPage() {
  playRandomSound();	
}

var space = "";
var msg = "";
var LeftMsg = "";
function MsgFLY(){

if (msg == "")
{
space = " ";
msg = YourMess;
LeftMsg = "";
}

if (space.length == 1)
{
while (msg.substring(0, 1) == " ")
{
LeftMsg = LeftMsg + space;
space = msg.substring(0, 1);
msg = msg.substring(1, msg.length);
}
LeftMsg = LeftMsg + space;
space = msg.substring(0, 1);
msg = msg.substring(1, msg.length);
for (var ii = 0; ii < 120; ii++)
{
space = " " + space;
}
}
else
space = space.substring(10, space.length);
window.status = LeftMsg + space;
timeout = window.setTimeout('MsgFLY()',100);
}
//MsgFLY();
//timeout = window.setTimeout('MsgFLY()',500);


