// JavaScript Document
function show_contenue (id)
{
if (document.getElementById(id).style.display == 'none')
	{
	document.getElementById(id).style.display = "inline";
    }
}

function cache (id)
{

if (document.getElementById(id).style.display == 'inline')
	{
	document.getElementById(id).style.display = "none";
    }
}
function show_details (id)
{
if (document.getElementById(id).style.display == 'none')
document.getElementById(id).style.display = "block";
else
document.getElementById(id).style.display = "none";
	//document.getElementById('img_presention').src='img/produit4.jpg';

}

function show_cache(id,num_id,nbr_id)
{
if(document.getElementById(id+'-'+num_id).style.display == 'none')
{var i=0;

for(i=1;i<=nbr_id;i++)
	if(i!=num_id)
		cache (id+'-'+i);

show_contenue(id+'-'+num_id);}
else
{
document.getElementById(id+'-'+num_id).style.display = 'none';

}
}


function change_coul(id,col)
{
Titre=document.getElementById(id).style.color=col;

//document.write(id.fontcolor(col));
//Titre.style.color=col;
}

function Lien(url) {
	/*i = document.Choix.Liste.selectedIndex;
	if (i == 0) return;
	url = document.Choix.Liste.options[i].value;*/
	parent.location.href = url;
//parent.location.href='lien.php?id='S1'';
}



function recherche(id){
var type_secteur= new Array[12];
var type_mission=new Array[10];
var mission=new Array[142];


}

function PopupImage(formation,action) {

	w=open("../fr/contact_formation.php?idformation="+formation+"&idaction="+action,'popup','top=100,left=300,width=450,height=350,toolbar=yes,scrollbars=no,resizable=yes');	

	w.document.close();
}




function swap_bottom(id,id_num,img){
if(document.getElementById('formation-'+id_num).style.display == 'block'){
var i=0;
for(i=1;i<=6;i++)
	if(i!=id_num)
document.getElementById(id+'-'+i).src='../image/'+img+'.gif';

document.getElementById(id+'-'+id_num).src='../image/'+img+'_2.gif';}
else
document.getElementById(id+'-'+id_num).src='../image/icone_formation.gif';
}

function changer(id,img) {
	document.getElementById(id).style.backgroundImage= 'url('+img+')';
document.getElementById(id).getStyle('texte').color="#00FF00";

//document.getElementById(id).setAttribute("style","background:url(img);");
//document.getElementById("td_id").style.backgroundImage = 'url("over.gif")';
} 

function changer_img(id,img){
document.getElementById(id).src='img/'+img;
}



function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function toolTip(msg, fg, bg)
{
  if(toolTip.arguments.length < 1) // hide
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";
  }
  else // show
  {
    if(!fg) fg = "#6E7588";
    if(!bg) bg = "#FFFFFF";
    var content =
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + fg + '"><td>' +
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + bg + 
    '"><td align="center"><font face="sans-serif" color="' + fg +
    '" size="-2">&nbsp\;' + msg +
    '&nbsp\;</font></td></table></td></table>';
    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
  }
}



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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' doit contenir une adrsse Email valide.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' est obligatoire.\n'; }
  } if (errors) alert(errors);
  document.MM_returnValue = (errors == '');
}