// JavaScript Document

// efface les alertes d'erreurs javascript
function NoError()
	{
	return true;
	}
window.onerror=NoError;

// recommander le site
url = window.location;
titre = document.title;
sujet = "e-doceo : l'e-learning facile";
function sendUrl(){ 
window.location = "mailto:"+prompt('Entrez l\'adresse email de la personne a qui vous désirez recommander ce site','')+"?subject="+sujet+"&body=Je te recommande cette page : "+titre+" "+url;
   } 

// Mettre en favoris
function favoris() {
      if ( navigator.appName != 'Microsoft Internet Explorer' ){
           window.sidebar.addPanel("e-doceo e-learning software and concept","http://www.e-doceo.net","");
       }
       else {
          window.external.AddFavorite("http://www.e-doceo.net","e-doceo e-learning software and concept");
       }
 }


// getElementById
if(!document.getElementById){
  if(document.all){
    document.getElementById=function(){
if(typeof document.all[arguments[0]]!="undefined"){return document.all[arguments[0]]}else{return null}
    }
  }else if(document.layers){
    document.getElementById=function(){
if(typeof document[arguments[0]]!="undefined"){return document[arguments[0]]}else{return null}
    }
  }
}


// photos aleatoire top
function makeArray(n) {
this.length = n;
for (var i=1; i<=n; i++) {
this[i] = ""; 
}
return this;
}
var i;
function imagealeatoire() {
i = Math.floor(4 * Math.random() + 1);
return image[i];
}
image = new makeArray(4);
image[1]="http://www.e-doceo.net/home/img/design/a.jpg";
image[2]="http://www.e-doceo.net/home/img/design/b.jpg";
image[3]="http://www.e-doceo.net/home/img/design/c.jpg";
image[4]="http://www.e-doceo.net/home/img/design/d.jpg";

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// recherche google
function cherch(form) {
var adres = "http://www.google.com/search?hl=fr&ie=UTF-8&oe=UTF-8&q="+form.q.value +"+site%3Ae-doceo.net&btnG=Recherche+Google&lr="
window.open(adres,'','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

// lien pour plus de detail
function show()
  {
  if(document.getElementById)
    {
    t = document.getElementById('table');
    if(table.style.display=="none")
      {
      document.getElementById('plus').innerHTML = '<img src="../img/design/ferme.gif" width="15" height="15" border="0">';
      table.style.display="";
      }
    else
      {
      document.getElementById('plus').innerHTML = '<img src="../img/design/plus.gif" width="15" height="15" border="0">';
      table.style.display="none";
      }
    } 
  }

function show2()
  {
  if(document.getElementById)
    {
    t = document.getElementById('table2');
    if(table2.style.display=="none")
      {
      document.getElementById('plus2').innerHTML = '<img src="../img/design/ferme.gif" width="15" height="15" border="0">';
      table2.style.display="";
      }
    else
      {
      document.getElementById('plus2').innerHTML = '<img src="../img/design/plus.gif" width="15" height="15" border="0">';
      table2.style.display="none";
      }
    } 
  }
  
function show3()
  {
  if(document.getElementById)
    {
    t = document.getElementById('table3');
    if(table3.style.display=="none")
      {
      document.getElementById('plus3').innerHTML = '<img src="../img/design/ferme.gif" width="15" height="15" border="0">';
      table3.style.display="";
      }
    else
      {
      document.getElementById('plus3').innerHTML = '<img src="../img/design/plus.gif" width="15" height="15" border="0">';
      table3.style.display="none";
      }
    } 
  }  

// retour
function Retour()
{
history.go(-1);
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

//Agrandissement images (elm)
var ie=document.all
var ns6=document.getElementById&&!document.all

function ietruebody(){
return (document.compatMode!="BackCompat")? document.documentElement : document.body
}

function enlarge(which, e, position, imgwidth, imgheight){
if (ie||ns6){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (position=="center"){
pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
horzpos=ns6? pageXOffset+window.innerWidth/2-imgwidth/2 : ietruebody().scrollLeft+ietruebody().clientWidth/2-imgwidth/2
vertpos=ns6? pgyoffset+window.innerHeight/2-imgheight/2 : pgyoffset+ietruebody().clientHeight/2-imgheight/2
if (window.opera && window.innerHeight) //compensate for Opera toolbar
vertpos=pgyoffset+window.innerHeight/2-imgheight/2
vertpos=Math.max(pgyoffset, vertpos)
}
else{
var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY
}
crossobj.style.left=horzpos+"px"
crossobj.style.top=vertpos+"px"

crossobj.innerHTML='<div align="right" id="dragbar"><span id="closetext" onClick="closepreview()">Fermer</span> </div><img src="'+which+'">'
crossobj.style.visibility="visible"
return false
}
else //if NOT IE 4+ or NS 6+, simply display image in full browser window
return true
}

function closepreview(){
crossobj.style.visibility="hidden"
}

function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx+"px"
crossobj.style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")


//Plus de details2
function ChangeMessage(message,champ)
  {
  if(document.getElementById)
    document.getElementById(champ).innerHTML = message;
  }

// contournement bug ie flash
//--------------------------------------------------------------------------------------------------------------------------

function placerFlashmenu(page) {
	
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="750" height="40">\n');
  document.write('<param name="movie" value="http://www.e-doceo.net/home/fr/menu-site2006.swf?active=' + page + '" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<param name="wmode" value="transparent" />\n');
  document.write('<embed src="http://www.e-doceo.net/home/fr/menu-site2006.swf?active=' + page + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="750" height="40"></embed>\n');
  
  document.write('</object>\n');
  }
  
  

function placerFlashaccueil() {
	
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="400">\n');
  document.write('<param name="movie" value="../img/design/accueil.swf" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<param name="wmode" value="transparent" />\n');
  document.write('<embed src="../img/design/accueil.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="550" height="400"></embed>\n');
  
  document.write('</object>\n');
  }

function placerFlashpubaccueil() {
	
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="522" height="94">\n');
  document.write('<param name="movie" value="../img/design/pub-accueil.swf" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<param name="wmode" value="transparent" />\n');
  document.write('<embed src="../img/design/pub-accueil.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="522" height="94"></embed>\n');
  
  document.write('</object>\n');
  }

function placerFlashgamme() {
	
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="250" height="600">\n');
  document.write('<param name="movie" value="../img/design/gamme2006.swf" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<param name="wmode" value="transparent" />\n');
  document.write('<embed src="../img/design/gamme2006.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="250" height="600"></embed>\n');
  
  document.write('</object>\n');
  }
  
  function placerFlashmondial() {
	
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="716" height="519">\n');
  document.write('<param name="movie" value="../img/mondial/debut3.swf" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<param name="wmode" value="transparent" />\n');
  document.write('<embed src="../img/mondial/debut3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="716" height="519"></embed>\n');
  
  document.write('</object>\n');
  }


