function regenCodeFiche()
{
    window.parent.close();
    regenfiche = open("http://www.alpi.fr/index.php/scr=9044/", "regenfiche", "toolbar = no, location = no, directories = no, status = no, scrollbars = yes, resizable = yes, copyhistory = no, width = 870, height = 759, left = 0, top = 0, alwaysRaised = yes");
}

function regenCodeFicheGenere()
{
    regenfiche = open("http://www.alpi.fr/index.php/scr=9045/", "regenfiche", "toolbar = no, location = no, directories = no, status = no, scrollbars = yes, resizable = yes, copyhistory = no, width = 870, height = 759, left = 0, top = 0, alwaysRaised = yes");
}

function getRef(obj){
      if(typeof obj == "string")
         obj= document.getElementById(obj);
      return obj;
   }

function setClassName(obj, classNameDest){
    getRef(obj).className= classNameDest;
}

/* Functions that swaps images. */
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_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr;
	 for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) {
	 //if (!x.fixer) 
	 x.src=x.oSrc;
	 }
}
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;
}
/* Functions that swaps down images. */
function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])?args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

/* FunctionNs that handle preload. */
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_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();
}
function go(){
if (document.selecter.select1.options[document.selecter.select1.selectedIndex].value != "none") {
location = document.selecter.select1.options[document.selecter.select1.selectedIndex].value
		}
	}

function selectupdate(selectdest,indice,idcf) {
  lg=0;
  idest=0;
  selectdest.disabled=false;
  //alert("idf->"+indice+"   idcf->"+idcf);
  // On vide la liste
  for (i = selectdest.length - 1; i >= 0; i--) {
    selectdest.options[i] = null;
  }
  selectdest.length=1;
  //	selectdest.length= datef[indice].length;
  //alert("->"+datef[indice].length+"<-");

  for (i in datef[indice]) {
  //alert("->"+datef[indice][i]+"<-");
 	 selectdest.length=idest+1;
     selectdest.options[idest].value = i;
     if (i==idcf) {
    selectdest.options[idest].selected=true;
    }
    selectdest.options[idest].text  = datef[indice][i];
    idest++;
  }
  if (idest==0) {
  alert("\n\nAucune date fixée pour cette formation.\nVeuillez contacter Alpi ou entrer une date désirée dans la case commentaires.\n\n\nMerci\n\n");
  selectdest.disabled = true;
  document.frminsformation.remarque.focus();
  }
}

function initformation() {
frminscription.iselFormation.options[0].selected=true;
selectupdate(frminscription.iselDateFormation,datef[0]);
}

function upddateFormation() {
document.frminsformation.dateFormation.value=formationAlpi[document.frminsformation.iselDateFormation.value]["debut"];
}

function bnoir(obj) {
obj.style.backgroundColor = '000000';
//obj.style.background-image = '/images/2.gif';
}
function brouge(obj) {
obj.style.backgroundColor = 'CC0000';

}

function findChildren(el, type, value) {
	var children = el.children;
	var tmp = new Array();
	var j=0;
	
	for (var i=0; i<children.length; i++) {
		if (eval("children[i]." + type + "==\"" + value + "\"")) {
			tmp[tmp.length] = children[i];
		}
		tmp = tmp.concat(findChildren(children[i], type, value));
	}
	
	return tmp;
}

function makeGray(el,b) {
	var filtval;
	
	if (b)
		filtval = "gray()";
	else
		filtval = "";

	var imgs = findChildren(el, "tagName", "IMG");
		
	for (var i=0; i<imgs.length; i++) {
		imgs[i].style.filter = filtval;
	}

}

function atOnMouseOverLight(o) {
    makeGray(o,false)
	o.style.backgroundColor = 'EDE7DA';
	o.classname = 'bexed';
		o.style.cursor = 'hand';
}

function atOnMouseOutLight(o) {
    makeGray(o,true)
	o.style.backgroundColor = 'F7F6F4';
}

function atOnMouseOverDark(o) {
    makeGray(o,true)
	o.style.backgroundColor='BCD6E3';
	o.style.cursor='hand';
}

function atOnMouseOutDark(o) {
	makeGray(o,true);
	o.style.backgroundColor='FFFFFF';
}


function tabLight(o) {
o.style.backgroundColor='';
o.style.cursor = 'hand';  
    makeGray(o,false);
 }

function tabNormal(o) {
	makeGray(o,true);
	o.style.backgroundColor='';
	o.style.cursor = 'hand';
}

function tabnoir(o) {
o.style.backgroundColor='#000000';

}

function taborange(o) {
	o.style.backgroundColor='#ff9900';
	o.style.cursor = 'hand';
}

function ShowHide(id, visibility) {
divs = document.getElementsByTagName("div");
divs[id].style.visibility = visibility;
} 

function SwapShowHide(id) {
divs = document.getElementsByTagName("div");
divs[id].style.position="absolute";
if (divs[id].style.visibility=='hidden') {
		divs[id].style.position="absolute";
//		divs[id].offsetTop=divs[id].offsetTop+divs[id].offsetHeight;
		divs[id].style.top=divs[id].style.top+divs[id].style.height;
		divs[id].style.visibility='visible';
	} else {
		divs[id].style.position="absolute";
//		divs[id].offsetTop=divs[id].offsetTop-divs[id].offsetHeight;
		divs[id].style.top=divs[id].style.top-divs[id].style.height;
		divs[id].style.visibility='hidden';
		}

alert(" styletop:"+divs.r2.style.top+" styleheight:"+divs.r2.style.height+"\nstyleoffsettop:"+divs.r2.offsetTop+"offsetheight:"+divs.r2.offsetHeight);


} 
function SwapShowHide2(id,id2) {
divs = document.getElementsByTagName("div");
divs[id].style.position="absolute";
divs[id2].style.position="absolute";
if (divs[id].style.visibility=='hidden') {
		divs[id].style.visibility='visible';
		//divs[id2].style.position="relative";
		divs[id2].style.top=divs[id].style.top+divs[id].style.height;
	} else {
		divs[id].style.visibility='hidden';
		divs[id].style.top=divs[id2].style.top;
	}
} 
function SwapDisplay(id) {
divs = document.getElementsByTagName("div");
imgs = document.getElementsByTagName("img");
if (divs[id].style.display!='') {
		divs[id].style.display='' ;
		imgs[id].src='/images/minus.gif';

	} else {
		divs[id].style.display='none';
		imgs[id].src='/images/plus.gif';
		}
} 

function ApplyXPOutStyle(obj) {
	obj.style.backgroundColor = '';
	if (navigator.appName == 'Netscape') { obj.style.borderColor = 'EBEBEB'; } else { 
	obj.style.borderColor = ''; }
	obj.style.borderStyle = '';
}

function ApplyXPOverStyle(obj,color,color2,addborder) { 
	 obj.style.backgroundColor = color;
	 obj.style.borderColor = color2;
    if (addborder=='true') {obj.style.borderStyle='solid';obj.style.borderWidth='1px'}
}

function PostListFormation2(obj) { 
	 document.clickf.selform.value=obj.id;
	 document.clickf.submit();
}

function PostListFormation(obj) { 
if (document.listef.selform.options.selectedIndex != obj.id) {
	 document.listef.selform.options.selectedIndex=obj.id-1;
	 document.listef.submit(); }
}

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]+"'");
}

function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x; this.css.top=this.y}

/****************************************************************************   
DHTML library from DHTMLCentral.com
*   Copyright (C) 2001 Thomas Brattli 2001
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by Thomas Brattli 2001
***************************************************************************/

//Browsercheck (needed) ***************
function lib_bwcheck(){ 
  this.ver=navigator.appVersion
  this.agent=navigator.userAgent
  this.dom=document.getElementById?1:0
  this.opera5=this.agent.indexOf("Opera 5")>-1
  this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
  this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
  this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
  this.ie=this.ie4||this.ie5||this.ie6
  this.mac=this.agent.indexOf("Mac")>-1
  this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
  this.ns4=(document.layers && !this.dom)?1:0;
  this.bw=(this.ie6||this.ie5||this.ie4||this.ns4||this.ns6||this.opera5)
  return this
}
bw=new lib_bwcheck() //Browsercheck object

//Debug function ******************
function lib_message(txt){alert(txt); return false}

//Lib objects  ********************
function lib_obj(obj,nest){ 
  if(!bw.bw) return lib_message('Old browser')
  nest=(!nest) ? "":'document.'+nest+'.'
  this.evnt=bw.dom? document.getElementById(obj):
    bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj):0;	
  if(!this.evnt) return lib_message('The layer does not exist ('+obj+')' 
    +'- \nIf your using Netscape please check the nesting of your tags!')
  this.css=bw.dom||bw.ie4?this.evnt.style:this.evnt; 
  this.ref=bw.dom||bw.ie4?document:this.css.document;
  this.x=parseInt(this.css.left)||this.css.pixelLeft||this.evnt.offsetLeft||0;
  this.y=parseInt(this.css.top)||this.css.pixelTop||this.evnt.offsetTop||0
  this.w=this.evnt.offsetWidth||this.css.clip.width||
    this.ref.width||this.css.pixelWidth||0; 
  this.h=this.evnt.offsetHeight||this.css.clip.height||
    this.ref.height||this.css.pixelHeight||0
  this.c=0 //Clip values
  if((bw.dom || bw.ie4) && this.css.clip) {
  this.c=this.css.clip; this.c=this.c.slice(5,this.c.length-1); 
  this.c=this.c.split(' ');
  for(var i=0;i<4;i++){this.c[i]=parseInt(this.c[i])}
  }
  this.ct=this.css.clip.top||this.c[0]||0; 
  this.cr=this.css.clip.right||this.c[1]||this.w||0
  this.cb=this.css.clip.bottom||this.c[2]||this.h||0; 
  this.cl=this.css.clip.left||this.c[3]||0
  this.obj = obj + "Object"; eval(this.obj + "=this")
  return this
}

//Moving object to **************
lib_obj.prototype.moveIt = function(x,y){
  this.x=x;this.y=y; this.css.left=x;this.css.top=y
}

//Moving object by ***************
lib_obj.prototype.moveBy = function(x,y){
  this.css.left=this.x+=x; this.css.top=this.y+=y
}

//Showing object ************
lib_obj.prototype.showIt = function(){this.css.visibility="visible"}

//Hiding object **********
lib_obj.prototype.hideIt = function(){this.css.visibility="hidden"}

//Changing backgroundcolor ***************
lib_obj.prototype.bg = function(color){ 
	if(bw.opera) this.css.background=color
	else if(bw.dom || bw.ie4) this.css.backgroundColor=color
	else if(bw.ns4) this.css.bgColor=color  
}

//Writing content to object ***
lib_obj.prototype.writeIt = function(text,startHTML,endHTML){
	if(bw.ns4){
    if(!startHTML){startHTML=""; endHTML=""}
	  this.ref.open("text/html"); 
    this.ref.write(startHTML+text+endHTML); 
    this.ref.close()
	}else this.evnt.innerHTML=text
}

//Clipping object to ******
lib_obj.prototype.clipTo = function(t,r,b,l,setwidth){ 
  this.ct=t; this.cr=r; this.cb=b; this.cl=l
  if(bw.ns4){
    this.css.clip.top=t;this.css.clip.right=r
    this.css.clip.bottom=b;this.css.clip.left=l
  }else{
    if(t<0)t=0;if(r<0)r=0;if(b<0)b=0;if(b<0)b=0
    this.css.clip="rect("+t+","+r+","+b+","+l+")";
    if(setwidth){this.css.pixelWidth=this.css.width=r; 
    this.css.pixelHeight=this.css.height=b}
  }
}

//Clipping object by ******
lib_obj.prototype.clipBy = function(t,r,b,l,setwidth){ 
  this.clipTo(this.ct+t,this.cr+r,this.cb+b,this.cl+l,setwidth)
}

//Clip animation ************
lib_obj.prototype.clipIt = function(t,r,b,l,step,fn,wh){
  tstep=Math.max(Math.max(Math.abs((t-this.ct)/step),Math.abs((r-this.cr)/step)),
    Math.max(Math.abs((b-this.cb)/step),Math.abs((l-this.cl)/step)))
  if(!this.clipactive){
    this.clipactive=true; if(!wh) wh=0; if(!fn) fn=0
    this.clip(t,r,b,l,(t-this.ct)/tstep,(r-this.cr)/tstep,
      (b-this.cb)/tstep,(l-this.cl)/tstep,tstep,0, fn,wh)
  }
}
lib_obj.prototype.clip = function(t,r,b,l,ts,rs,bs,ls,tstep,astep,fn,wh){
  if(astep<tstep){
    if(wh) eval(wh); 
    astep++
    this.clipBy(ts,rs,bs,ls,1);
    setTimeout(this.obj+".clip("+t+","+r+","+b+","+l+","+ts+","+rs+","
      +bs+","+ls+","+tstep+","+astep+",'"+fn+"','"+wh+"')",50)
  }else{
    this.clipactive=false; this.clipTo(t,r,b,l,1);
    if(fn) eval(fn)
  }
}

//Slide animation ***********
lib_obj.prototype.slideIt = function(endx,endy,inc,speed,fn,wh){
  if(!this.slideactive){
    var distx = endx - this.x;
    var disty = endy - this.y
    var num = Math.sqrt(Math.pow(distx,2)+Math.pow(disty,2))/inc
    var dx = distx/num; var dy = disty/num
    this.slideactive = 1;
    if(!wh) wh=0; if(!fn) fn=0
    this.slide(dx,dy,endx,endy,speed,fn,wh)
    }
}
lib_obj.prototype.slide = function(dx,dy,endx,endy,speed,fn,wh) {
  if(this.slideactive&&
  (Math.floor(Math.abs(dx))<Math.floor(Math.abs(endx-this.x))|| 
    Math.floor(Math.abs(dy))<Math.floor(Math.abs(endy-this.y)))){
    this.moveBy(dx,dy); 
    if(wh) eval(wh)
    setTimeout(this.obj+".slide("+dx+","+dy+","+endx+","+endy+","+speed+",'"
    +fn+"','"+wh+"')",speed)
  }else{
    this.slideactive = 0; 
    this.moveIt(endx,endy);
    if(fn) eval(fn)
  }
}

//Circle animation ****************
lib_obj.prototype.circleIt = function(rad,ainc,a,enda,xc,yc,speed,fn) {
  if((Math.abs(ainc)<Math.abs(enda-a))) {
    a += ainc
    var x = xc + rad*Math.cos(a*Math.PI/180)
    var y = yc - rad*Math.sin(a*Math.PI/180)
    this.moveIt(x,y)
    setTimeout(this.obj+".circleIt("+rad+","+ainc+","+a+","+enda+","
      +xc+","+yc+","+speed+",'"+fn+"')",speed)
  }else if(fn&&fn!="undefined") eval(fn)
}

//Document size object ********
function lib_doc_size(){ 
  this.x=0;this.x2=bw.ie && document.body.offsetWidth-20||innerWidth||0;
  this.y=0;this.y2=bw.ie && document.body.offsetHeight-5||innerHeight||0;
  if(!this.x2||!this.y2) return message('Document has no width or height') 
  this.x50=this.x2/2;this.y50=this.y2/2;
  return this;
}

//Drag drop functions start *******************
dd_is_active=0; dd_obj=0; dd_mobj=0
function lib_dd(){
  dd_is_active=1
  if(bw.ns4){
    document.captureEvents(Event.MOUSEMOVE|Event.MOUSEDOWN|Event.MOUSEUP)
  }
  document.onmousemove=lib_dd_move;
  document.onmousedown=lib_dd_down
  document.onmouseup=lib_dd_up
}
lib_obj.prototype.dragdrop = function(obj){
  if(!dd_is_active) lib_dd()
  this.evnt.onmouseover=new Function("lib_dd_over("+this.obj+")")
  this.evnt.onmouseout=new Function("dd_mobj=0")
  if(obj) this.ddobj=obj
}
lib_obj.prototype.nodragdrop = function(){
  this.evnt.onmouseover=""; this.evnt.onmouseout=""
  dd_obj=0; dd_mobj=0
}
//Drag drop event functions
function lib_dd_over(obj){dd_mobj=obj}
function lib_dd_up(e){dd_obj=0}
function lib_dd_down(e){ //Mousedown
  if(dd_mobj){
    x=(bw.ns4 || bw.ns6)?e.pageX:event.x||event.clientX
    y=(bw.ns4 || bw.ns6)?e.pageY:event.y||event.clientY
    dd_obj=dd_mobj
    dd_obj.clX=x-dd_obj.x; 
    dd_obj.clY=y-dd_obj.y
  }
}
function lib_dd_move(e,y,rresize){ //Mousemove
  x=(bw.ns4 || bw.ns6)?e.pageX:event.x||event.clientX
  y=(bw.ns4 || bw.ns6)?e.pageY:event.y||event.clientY
  if(dd_obj){
    nx=x-dd_obj.clX; ny=y-dd_obj.clY
    if(dd_obj.ddobj) dd_obj.ddobj.moveIt(nx,ny)
    else dd_obj.moveIt(nx,ny)
  }
  if(!bw.ns4) return false
}
//Drag drop functions end *************






