// Verifie si c'est Netscape ou IE
var ns = (navigator.appName=="Netscape" && parseInt(navigator.appVersion)>=4)?true:false
var ie = (navigator.appName=="Microsoft Internet Explorer" && parseInt(navigator.appVersion)>=4)?true:false
var ns6 = (document.getElementById&&!document.all)

var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 &&
                parseFloat(navigator.appVersion) >= 4 &&  parseFloat(navigator.appVersion) < 5) ? 1 : 0;
var isMinIE4 = (document.all) ? 1 : 0;
var isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0;


//-----------------------------------------------------------------------------
// Layer visibility.
//-----------------------------------------------------------------------------

function refresh(name){

	avancee = location.search.substr(6);
	path=location.href + "?path=1;";
	if (avancee==1){
		document.write("<a href='javascript:Path(0);' class='lien-gris-small'>Recherche avanc&eacute;e <<<</a>");
	}
	else{
		document.write("<a href='javascript:Path(1);' class='lien-gris-small'>Recherche avanc&eacute;e >>></a>");
	}
}

function Path(avancee){
	path="";
	path="?path="+avancee;
	location.href =location.pathname+path;
	
}

function lienavance(name){
	
	namelayer=getLayer(name);
	namelayer2=getLayer("hiderecherche");
	namelayer3=getLayer("showrecherche");
	visible = getVisibility(namelayer);
	if (visible=="visible") {
		hideLayer(namelayer2);
		showLayer(namelayer3);
		hide(name);
	}
	else{
		hideLayer(namelayer3);
		showLayer(namelayer2);
		display(name);
	}

}


function getTop(layer) {

  if (isMinNS4)
    return layer.top;
  if (isMinIE4)
    return layer.style.pixelTop;
	if (ns6)
		return layer.top;
  return -1;
}

function getLeft(layer) {

  if (isMinNS4)
    return layer.left;
  if (isMinIE4)
    return layer.style.pixelLeft;
	if (ns6)
		return layer.left;
  return -1;
}

function hide(name){
	namelayer=getLayer(name);
	hideLayer(namelayer);
	changePosition(name,"absolute");
}

function display(name){
	namelayer=getLayer(name);
	changePosition(name,"relative");
	showLayer(namelayer);
}

function changePosition(name,position){
	namelayer=getLayer(name);
	if (isMinNS4)
    namelayer.position = position;
  if (isMinIE4)
    namelayer.style.position = position;
	if (ns6)
		namelayer.position=position;
}

/************************************/
function hideLayer(layer) {

  if (isMinNS4)
    layer.visibility = "hide";
  if (isMinIE4)
    layer.style.visibility = "hidden";
	if (ns6)
		layer.visibility="hidden";
}

function showLayer(layer) {

  if (isMinNS4)
    layer.visibility = "show";
  if (isMinIE4)
    layer.style.visibility = "visible";
	if (ns6)
		layer.visibility="visible";
}

function getVisibility(layer) {

  if (isMinNS4) {
    if (layer.visibility == "show")
      return "visible";
    if (layer.visibility == "hide")
      return "hidden";
    return layer.visibility;
  }
  if (isMinIE4)
    return layer.style.visibility;
	if (ns6)
		return layer.visibility;
  return "";
}

function getLayer(name) {

  if (isMinNS4)
    return findLayer(name, document);
  if (isMinIE4)
    return eval('document.all.' + name);
	if (ns6)
		return document.getElementById(name).style;
  return null;
}

function findLayer(name, doc) {

  var i, layer;

  for (i = 0; i < doc.layers.length; i++) {
	alert(layer.name);
    layer = doc.layers[i];
    if (layer.name == name)
      return layer;
    if (layer.document.layers.length > 0)
      if ((layer = findLayer(name, layer.document)) != null)
        return layer;
  }
  return null;
}

function moveLayerTo(layer, x, y) {

  if (isMinNS4)
    layer.moveTo(x, y);
  if (isMinIE4) {
    layer.style.left = x;
    layer.style.top  = y;
  }
	if (ns6){
		layer.left = x + "px";
  	layer.top = y + "px";
	}
}

/**********/

function Popup(name,urlstr,w,h) {
	popup=window.open(urlstr,name,"focus=yes,toolbar=yes,directories=yes,status=no,menubar=yes,scrollbars=yes,history=no,resizable=no,width="+w+",height="+h+"");
	popup.focus();
}

function Popupimp(name,urlstr,w,h) {
	popup=window.open(urlstr,name,"focus=yes,toolbar=no,directories=no,status=no,menubar=yes,scrollbars=yes,history=no,resizable=no,width="+w+",height="+h+"");
	popup.focus();
}

// Fonction pour ecrire dans la barre du bas du navigateur
function dm(msgStr){
	document.returnValue = false;
	if (document.images) {
		window.status = msgStr;
		document.returnValue = true;
	}
}

// Fonction pour les rollover
function di(quel_b,bouton){
	if (document.images) {
	  document.images[quel_b].src=eval(bouton+".src");
	}
}

// Fonction qui permet de controler la longeur dun input
function input(grandeurie,grandeurns){
	if(ns && !ns6){	document.write("<INPUT TYPE=text NAME=search SIZE="+grandeurns+" CLASS='text-noir-reg'>");}
	else{document.write("<INPUT TYPE=text NAME=search CLASS='text-noir-reg' STYLE=\"width: "+grandeurie+";\">")}
}

// Fonction qui permet la navigation
function verif(){
	document.location.href = document.frmRech.sphere.options[document.frmRech.sphere.selectedIndex].value;
}

function recherche(){

document.write ("<div id='recherche'>");
//bande rouge
document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td class='fond-rouge'><img src='"+NbRep+"img/recherche/recherche_avancee.gif' width='104' height='16' border='0'></td></tr></table>");
document.write("<form action='"+NbRep+"Recherche/process.asp' method='get'>");
document.write("<table width='100%' border='0' cellspacing='0' cellpadding='5'><tr><td rowspan='2' width='30' class='fond-gris4'><img src='"+NbRep+"img/scaler.gif' width='30' height='1'></td>");
document.write("<td width='53' class='fond-gris4'><img src='"+NbRep+"img/recherche/nom.gif' width='53' height='14'></td><td width='190'><input type='text' name='Nom' style='width: 190px;'></td><td width='60' rowspan='2'><img src='"+NbRep+"img/scaler.gif' width='60' height='1'></td>");
document.write("<td width='53'><img src='"+NbRep+"img/recherche/cnp.gif' width='53' height='14'></td><td width='190'><input type='text' name='CNP' style='width: 190px;'></td><td width='100%' rowspan='3'><img src='"+NbRep+"img/scaler.gif' width='1' height='1'></td></tr>");
document.write("<tr><td><img src='"+NbRep+"img/recherche/riasec.gif' width='53' height='14'></td>");
document.write("<td><select name='RIASEC1'><option> </option><option>R</option><option>I</option><option>A</option><option>S</option><option>E</option><option>C</option></select>&nbsp;");
document.write("<select name='RIASEC2'><option> </option><option>R</option><option>I</option><option>A</option><option>S</option><option>E</option><option>C</option></select>&nbsp;");
document.write("<select name='RIASEC3'><option> </option><option>R</option><option>I</option><option>A</option><option>S</option><option>E</option><option>C</option></select></td>");
document.write("<td><img src='"+NbRep+"img/recherche/dpc.gif' width='53' height='14'></td>");
document.write("<td><select name='D'><option> </option><option>0</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option></select>&nbsp;");
document.write("<select name='P'><option> </option><option>0</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option></select>&nbsp;");
document.write("<select name='C'><option> </option><option>0</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option></select></td></tr>");
document.write("<tr><td colspan='6' align='right'><br><input type='image' name='submit' src='"+NbRep+"img/recherche/rechercher.gif' width='98' height='15' border='0' value='Recherche'></td>");
document.write("</tr></table>");
document.write("</form>");
document.write("</div>");
}

function recherche2(){
	path = location.search.substr(6);
	if (path==1){
	document.write("<form action='"+NbRep+"Recherche/process.asp' method='get'>");
		document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td class='fond-rouge'><img src='"+NbRep+"img/recherche/recherche_avancee.gif' width='104' height='16' border='0'></td></tr></table>");
		//bande rouge
		document.write("<table width='100%' border='0' cellspacing='0' cellpadding='5'>");
		document.write("<tr>");
		document.write("<td rowspan='2' width='30' class='fond-gris4'><img src='"+NbRep+"img/scaler.gif' width='30' height='1'></td>");
		document.write("<td width='53' class='fond-gris4'><img src='"+NbRep+"img/recherche/nom.gif' width='53' height='14'></td>");
		document.write("<td width='190' class='fond-gris4'><input type='text' name='Nom' size='15'></td>");
		document.write("<td width='60' rowspan='2' class='fond-gris4'><img src='"+NbRep+"img/scaler.gif' width='60' height='1'></td>");
		document.write("<td width='53' class='fond-gris4'><img src='"+NbRep+"img/recherche/cnp.gif' width='53' height='14'></td>");
		document.write("<td width='190' class='fond-gris4'><input type='text' name='CNP' size='15'></td>");
		document.write("<td width='100%' rowspan='3' class='fond-gris4'><img src='"+NbRep+"img/scaler.gif' width='1' height='1'></td>");
		document.write("</tr>");
		document.write("<tr>");
		document.write("<td class='fond-gris4'><img src='"+NbRep+"img/recherche/riasec.gif' width='53' height='14'></td>");
		document.write("<td class='fond-gris4'><select name'RIASEC1'><option> </option><option>R</option><option>I</option><option>A</option><option>S</option><option>E</option><option>C</option></select>&nbsp;<select name='RIASEC2'><option> </option><option>R</option><option>I</option><option>A</option><option>S</option><option>E</option><option>C</option></select>&nbsp;<select name='RIASEC3'><option> </option><option>R</option><option>I</option><option>A</option><option>S</option><option>E</option><option>C</option></select></td>");
		document.write("<td class='fond-gris4'><img src='"+NbRep+"img/recherche/dpc.gif' width='53' height='14'></td>");
		document.write("<td class='fond-gris4'><select name='D'><option> </option><option>0</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option></select>&nbsp;<select name='C'><option> </option><option>0</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option></select>&nbsp;<select name='P'><option> </option><option>0</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option></select></td>");
		document.write("</tr>");
		document.write("<tr>");
		document.write("<td class='fond-gris4' colspan='6' align='right'><br><input type='image' name='submit' src='"+NbRep+"img/recherche/rechercher.gif' width='98' height='15' border='0' value='Recherche'></td>");
		document.write("</tr>");
		document.write("</table>");
		document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0'>");
		document.write("<tr>");
		document.write("<td class='fond-noir'><img src='"+NbRep+"img/scaler.gif' width='1' height='1'></td>");
		document.write("</tr>");
		document.write("</table>");
		document.write("</form>");
	}
}