var isIE4, isNS4, isNS6;
isIE4Plus = document.all;
isNS4 = document.layers;
isNS6 = ( document.getElementById && !document.all );

var rollover = new Array();

var popup;

function preloadImages() {
	if (document.images) {
		var dirPrefix = "";
		var i = 0;
		var updir = preloadImages.arguments[0];
		var imgFiles = preloadImages.arguments;
	
		var dirPrefix = "";
		for ( i=0; i<updir; i++ ) {
			dirPrefix = dirPrefix + "../../";
		}
	
		var names = new Array();
		with (document) for (var j=1; j<imgFiles.length; j++) {
			up = imgFiles[j] + "_up";
			over = imgFiles[j] + "_over";

			rollover[up] = new Image();
			rollover[up].src = dirPrefix + "/images/" + up + ".gif";

			rollover[over] = new Image();
			rollover[over].src = dirPrefix + "/images/" + over + ".gif";
							
		}  //end for		
	}  // end if
}  // end preloadImages


function select(imgName,lyrName) {
	if (isNS4 && select.arguments[1] && document.images) {
		imgSelect = imgName + "_over";
		document.layers[lyrName].document[imgName].src = rollover[imgSelect].src;
	} else if (document.images) {
		imgSelect = imgName + "_over";
		document[imgName].src = rollover[imgSelect].src;
	}
}


function deselect(imgName,lyrName) {
	if (isNS4 && deselect.arguments[1] && document.images) {
		imgDeselect = imgName + "_up";
		document.layers[lyrName].document[imgName].src = rollover[imgDeselect].src;
	} else if (document.images) {
		imgDeselect = imgName + "_up";
		document[imgName].src = rollover[imgDeselect].src;
	}
}


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_showHideLayers() { //v3.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; }
}

// Alec added these, check if modifying

function popClose() {
	// close popup if it already exists
	if (window.opener) {
		self.close();
		} else if (window['pop_up']) {
			if (!window['pop_up'].closed) window['pop_up'].close();
		}
	}

function popUp(URL) {
	popClose();
	var opts = "width=640,height=470,scrollbars=1,location=0,menubar=0,resizable=1,dependent=1";
	popup = window.open(URL,"pop_up",opts,"1");
	}

function popSend(URL) {
	if (window.opener) {
		// we are in the popup, send opener where we want to, then close
		opener.location = URL;
		popClose();
		} else {
		// we are in the main window, close popup then go to URL
		popClose();
		self.location = URL;
		}
	}
	
//défilement texte dans <div>
	
var Timer;
var Pas = 8; // vitesse défilement texte

function moveLayer(Sens) {
   if(document.getElementById)
       Objet = document.getElementById("Contenu");
   else
      Objet = document.all["Contenu"];
   if(parseInt(Objet.style.top) + (Pas*Sens) > 0)
      Objet.style.top = "0px";
   else
      Objet.style.top = (parseInt(Objet.style.top) + (Pas*Sens)) + "px";
   Timer = setTimeout("moveLayer(" + Sens + ");", 50);
}


function toggleDIV(submenu) {
	if (document.getElementById(submenu).style.display == 'none') {
		document.getElementById(submenu).style.display = 'block'
	} else {
		document.getElementById(submenu).style.display = 'none'
	}
}

function cleanInput( baliseId ){
	if (document.getElementById(baliseId) && document.getElementById(baliseId) != null){
		val = document.getElementById(baliseId).value ="";
		return val;
	}
}
//par AP
function bodyEvent() {
	//return false;
   //alert ("The body got an event of type: " + window.event.target);
   //alert('test');
  allGuideLinks =  $$('a.RfsocDIDocLien');
  // allGuideLinks = getElementsByClassName(document, "a", "RfsocDIDocLien");
   for(i = 0; i < allGuideLinks.length; i++){
		alert( allGuideLinks[ i ]);

	}
}

/*calculettets*/
function popupform(myform,windowname,hauteur,largeur,bars)
{

if (! window.focus)return true;
window.open('', windowname, 'height='+hauteur+',width='+largeur+',scrollbars='+bars);
myform.target=windowname;
myform.submit();
return true;
}

//en utilisant un lien <a> pour submit
function popupformByLink(myform,windowname,hauteur,largeur,bars)
{

if (! window.focus)return true;
window.open('', windowname, 'height='+hauteur+',width='+largeur+',scrollbars='+bars);
myform.target=windowname;
myform.submit();
}

/* plier/deplier*/

/* */

