

//pour IE :
	var firstfocus=null;
    var inMenu = false;

    var clearMap=null;
    
	function $(id) {
		  return document.getElementById(id);
		 }
	 
	var nbImages = 5;
	var imagesLoaded =0;
	var tempsMini = 0;
	function Chargement(){
	   imagesLoaded++;
	   if (imagesLoaded>nbImages) return;
	   var Pourcentage=Math.round((100/nbImages)*imagesLoaded);
	   var PourcentageBarre=Math.round((200/100)*Pourcentage);

	   $('loadbar').style.width=PourcentageBarre +"px";
	   $('loadvelo').style.marginLeft=PourcentageBarre +"px";
	   $('loadtxt').innerHTML="Chargement de la page : "+Pourcentage +"%";
       
	   if(Pourcentage>=100){
		if (tempsMini>0)   
	     setTimeout('loaded()',tempsMini);
		else
			loaded();		  
	   }
	}
	  
	    

 
 function showCopyright() {
  var txt="--\n";
  txt += "Bike Motion\n";
  txt += "S.A.R.L. au capital de 7000\u20AC\n";
  txt += "23, rue St-Sébastien 13006 Marseille\n";
  txt += "SIREN : R.C.S. MARSEILLE 522 083 534\n";
  txt += "-- \n";
  txt += "L'usage professionnel de tout type de contenu disponible sur ce site est strictement interdit, sauf accord préalable.\n";
  txt += "--";
	 
	alert(txt);
 }	 

 function showCredit() {
	  var txt="--\n";
	  txt += "Graphisme : Antoine GUENOT\n";
	  txt += "-- \n";
	  txt += "Développement : Thomas THIBAUDIER\n";
	  txt += "--";
		 
		alert(txt);
	 }
 

 function menuOn (obj,sousmenu) {
	if (sousmenu) 
	 obj.className = "ssmenuon";
	else
	 obj.className = "menuon";
	obj.firstChild.className = "menulinkon";  
 }	 

 function menuOut (obj,sousmenu) {
	 if (sousmenu) 
	  obj.className = "ssmenu";
	 else
	  obj.className = "menu";
	obj.firstChild.className = "menulink";
 }
 
 function menuDown() {
	 $('sousmenu').style.display='';
	 $('titressmenu').className='menuon';
	 $('flmenu').src='images/flechebason.png';
 }	
 function menuUp() {
	 if (inMenu) return; 
	 $('sousmenu').style.display='none'; 
	 $('titressmenu').className='menu';
	 $('flmenu').src='images/flechebas.png';
 } 	 
 var sideWidthTrace = 0;
 
 function bandesWidth() {
	 var pageWidth = document.body.clientWidth;
	 if (!pageWidth) pageWidth = document.documentElement.clientWidth;
	 var sideWidth = (pageWidth - 800)/2;
	 var bg = $('bg');
	 bg.style.width = sideWidth +"px";
	 bg.style.marginLeft = "-"+sideWidth +"px";
	 var bd = $('bd');
	 bd.style.width = sideWidth +"px";	 

	 if (clearMap && sideWidthTrace != sideWidth) clearMap();

	 sideWidthTrace =sideWidth;
 }

 function findPos(el) {

		var x = y = 0;

		if(el.offsetParent) {

			x = el.offsetLeft;

			y = el.offsetTop;

			while(el = el.offsetParent) {

				x += el.offsetLeft;

				y += el.offsetTop;

			}

		}

		return {'x':x, 'y':y};

	}

  function loaded() {
    $('page').style.display = "";
    $('loader').style.display = "none";  
    for (var i=0;i<lastIMG.length;i++) 
    	$(lastIMG[i].id).src = lastIMG[i].src;  
    bandesWidth();
    if (firstfocus)
    	firstfocus.focus();
   }	

  var lastIMG = new Array(); // images Ã  charger en dernier


  function setOpacity(id,value) {
     /*IE*/
	  $(id).style.filter="alpha(opacity="+(value*10)+")";
	/*autres nav*/
	  $(id).style.opacity= (value/10);
  }   
  
  function trim (myString) // fonction trim (enlÃ¨ve les espaces et sauts de ligne au dÃ©but et Ã  la fin d'un chaine)
  { 
   var res = myString.replace(new RegExp("&nbsp;","gi"),' ').replace(/^\s+/g,'').replace(/\s+$/g,'');
   if (res==" ") res="";
   return res; 
  }

  // String prototype:

  String.prototype.replaceStr = function (oldPattern,newPattern,notall) {
   var flag = "gi";
   if (notall) flag = "i";
   return this.replace(new RegExp(oldPattern,flag),newPattern);
  }; 

  String.prototype.replacePosStr = function (pos1,pos2,newPattern) {
   var avant = this.substring(0,pos1);
   var apres = this.substring(pos2,this.length-1);
   
   return avant + newPattern + apres;
  }; 

  String.prototype.toXML = function () {
   return this.replaceStr("&","&amp;").replaceStr("'","&apos;").replaceStr("<","&lt;").replaceStr(">","&gt;");
  };
  String.prototype.toSTR = function () {
   return this.replaceStr("&amp;","&").replaceStr("&apos;","'").replaceStr("&lt;","<").replaceStr("&gt;",">");
  };
   



  String.prototype.split = function (splitChar) {
   var tab = new Array();
   var str = this;
   if (str.indexOf(splitChar)>-1) {
    
    while (str.indexOf(splitChar)>-1) {
     tab.push(str.substring(0,str.indexOf(splitChar)));
     //tab.push();
     str = str.substring(str.indexOf(splitChar)+ splitChar.length,str.length);
     
    } tab.push(str.substring(str.indexOf(splitChar)+ splitChar.length,str.length));
   } else tab.push(str);
   return tab;
  }


  // Date proto
  Date.prototype.fromString = function(str,heure) {
    if (!heure) {
    var arr = str.split('/');
    if (arr[0].charAt(0)=="0")
     var d = parseInt(arr[0].charAt(1));
    else 
     var d = parseInt(arr[0]);
    this.setDate(d);
    if (arr[1].charAt(0)=="0")
     var m = parseInt(arr[1].charAt(1));
    else 
     var m = parseInt(arr[1]);
    m = m - 1;
    this.setMonth(m);
    if (arr[2].indexOf(':')==-1)
     this.setFullYear(parseInt(arr[2]));
    else {
     var arr2 = arr[2].split(" ");
     this.setFullYear(parseInt(arr2[0]));
     heure = true;
     str = arr2[1];
    }
      
   }
   if (heure) {
    var arr = str.split(':');
    if (arr[0].charAt(0)=="0")
     var h = parseInt(arr[0].charAt(1));
    else 
     var h = parseInt(arr[0]);
    this.setHours(h);
    this.setMinutes(parseInt(arr[1]));
   }
  };

  Date.prototype.getDayFr = function(court) {
   if (!court)
    var tab_jour=new Array("Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi");
   else
    var tab_jour=new Array("Dim", "Lun", "Mar", "Mer", "Jeu", "Vend", "Sam");
   return tab_jour[this.getDay()];
  };

  function formatDate(format,date) {
   var jour = date.getDate(); //dd
   if (jour<10)
    jour = "0" + jour; 
   var mois = date.getMonth()+1; //mm
   if (mois<10)
    mois = "0" + mois;
   var annee = date.getFullYear();//yyyy
   var an = date.getYear(); //yy
   if (an<10)
    an = "0" + an;
   var heures = date.getHours();//hh
   if (heures<10)
    heures = "0" + heures;
   var minutes = date.getMinutes();//ii
   if (minutes<10)
    minutes = "0" + minutes;
   var secondes = date.getSeconds();//ss
   if (secondes<10)
    secondes = "0" + secondes;
   var res=format.replaceStr("dd",jour).replaceStr("mm",mois).replaceStr("yyyy",annee).replaceStr("yy",an);
   res = res.replaceStr("hh",heures).replaceStr("ii",minutes).replaceStr("ss",heures);
   return res;
  }

var tableau = null;  
  
function hideScroll() {
	document.body.style.overflow='hidden';
	if (document.body.parentElement)
		document.body.parentElement.style.overflow='hidden';
	else if (document.body.parentNode)
		document.body.parentNode.style.overflow='hidden';
		
}
function showScroll() {
	document.body.style.overflow='';
	if (document.body.parentElement)
		document.body.parentElement.style.overflow='';
	else if (document.body.parentNode)
		document.body.parentNode.style.overflow='';
	
}
