/*		_______________________________________________
		| JavaScript Document | FS_ fonction standard |
		¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*/
winx = screen.availWidth - 12;
winy = screen.availHeight - 35;
// navifgateur
var ns4=document.layers?1:0
var ie4=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0
function testNav(){
	if (ns4) {
		info = "test = ns4<br>";
	} else if (ie4) {
		info = "test = ns4<br>";
	} else if (ns6) {
		info = "test = ns6<br>";
	} else {
		info = "test = autre<br>";
	}
	info += "Name : "+navigator.appName+"<br>";
	info += "CodeName : "+navigator.appCodeName+"<br>";
	info += "Version : "+navigator.appVersion+"<br>";
	info += "language : "+navigator.language+"<br>";
	info += "nb Types : "+navigator.mimeTypes.length+"<br>";
	for (i=0;i<navigator.mimeTypes.length; i++) {
	info += "mimeTypes"+i+" : "+navigator.mimeTypes[i].name+"<br>";// a voir
	}
	info += "platform : "+navigator.platform+"<br>";
	info += "nb plugins : "+navigator.plugins.length+"<br>";
	for (i=0;i<navigator.plugins.length; i++) {
	info += "plugins"+i+" : "+navigator.plugins[i].name+"<br>";
	}
	info += "userAgent : "+navigator.userAgent+"<br>";
	document.write(info);
}
// 
if(navigator.appName.substring(0,3) == "Net")
	document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = get_mouse;                                            // Capture de la position de la souris

function get_mouse(e){                                                       // Transfert de la position de la souris
	x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
	y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
	mousX = x;
	mousY= y;
}

	mousX = 50;
	mousY= 100;

// • fonction lien simple
function FS_go(lien) {
	document.location=lien;
}
// • fonction precharger des images
function FS_prIm() {
	tbArgu=FS_prIm.arguments;
	var tbImg = new Array();
	for (i=0;i<tbArgu.length;i++) {
		tbImg[i] = new Image();
		tbImg[i].src ="images/"+tbArgu[i];
	}
}
// • fonction intervertir image
function FS_ii(nom,lien) {
	document.getElementById(nom).src = lien;
}
// • fonction masquer une div : peu contenir un nombre indefini d'arguments conrespondants aux id sauf le dernier etant le type d'affichage block ou none, facultatif pour block
function FS_dispDiv(){
	tbArgu=FS_dispDiv.arguments;
	nba=tbArgu.length-1;
	aff=tbArgu[nba];
	if ((aff!="block")&&(aff!="none")) {
		aff="block";
		nba++;
	}
	for (i=0;i<nba;i++) {
		id=tbArgu[i];
		if (document.getElementById) {
			document.getElementById(id).style.display=aff;
		}
		else if (document.all) {
			document.all[id].style.display=aff;
		}
		else if (document.layers) {
			document.layers[id].display=aff;
		}
	}
}
// fonction change ClassName : peu contenir un nombre indefini d'arguments conrespondants aux id sauf le dernier etant la class
function FS_ccn(){
	tbArgu=FS_ccn.arguments;
	nba=tbArgu.length-1;
	cl=tbArgu[nba];
	for (i=0;i<nba;i++) {
		id=tbArgu[i];
		if (document.getElementById) {
			document.getElementById(id).className=cl;
		}
		else if (document.all) {
			document.all[id].className=cl;
		}
		else if (document.layers) {
				document.layers[id].className=cl;
		}
	}
}
// • fonction affiche div alternativement none et block
function FS_iDispDiv(){
	tbArgu=FS_iDispDiv.arguments;
	nba=tbArgu.length;
	for (i=0;i<nba;i++) {
		id=tbArgu[i];
		if (document.getElementById) {
			if (document.getElementById(id).style.display=="none") document.getElementById(id).style.display="block";
			else document.getElementById(id).style.display="none";
		}
		else if (document.all) {
			if (document.all[id].style.display=="none") document.all[id].style.display="block";
			else document.all[id].style.display="none";
		}
		else if (document.layers) {
			if (document.layers[id].display=="none") document.layers[id].display="block";
			else document.layers[id].display="none";
		}
	}
}
// fonction Intervertir className alternativement
function FS_icn(id,class_on, class_off) {
		if (id.className==class_on) {
			id.className=class_off;
		} else {
			id.className=class_on;
		}
}
// fonction intervertir background color
function FS_ibg(id,couleur){
	if (document.getElementById) {
		document.getElementById(id).style.background=couleur;
	}
	else if (document.all) {
		document.all[id].style.background=couleur;
	}
	else if (document.layers) {
			document.layers[id].background=couleur;
	}
}
// fonction intervertir color
function FS_ic(id,couleur){
	if (document.getElementById) {
		document.getElementById(id).style.color=couleur;
	}
	else if (document.all) {
		document.all[id].style.color=couleur;
	}
	else if (document.layers) {
			document.layers[id].color=couleur;
	}
}
// fonction intervertir fontFamily
function FS_iff(id,font){
	if (document.getElementById) {
		document.getElementById(id).style.fontFamily=font;
	}
	else if (document.all) {
		document.all[id].style.fontFamily=font;
	}
	else if (document.layers) {
			document.layers[id].fontFamily=font;
	}
}
// fonction intervertir fontSize
function FS_ifs(id,size){
	if (document.getElementById) {
		document.getElementById(id).style.fontSize=size;
	}
	else if (document.all) {
		document.all[id].style.fontSize=size;
	}
	else if (document.layers) {
			document.layers[id].fontSize=size;
	}
}
// fonction intervertir font height
function FS_ih(id,h){
	if (document.getElementById) {
		document.getElementById(id).style.height=h;
	}
	else if (document.all) {
		document.all[id].style.height=h;
	}
	else if (document.layers) {
			document.layers[id].height=h;
	}
}
function FS_mousPos(id, decalX, decalY){
	mX=mousX-decalX+"px";
	mY=mousY-decalY+"px";
	if (document.getElementById) {
		document.getElementById(id).style.left=mX;
		document.getElementById(id).style.top=mY;
	}
	else if (document.all) {
		document.all[id].style.left=mX;
		document.all[id].style.top=mY;
	}
	else if (document.layers) {
			document.layers[id].left=mX;
			document.layers[id].top=mY;
	}
}
// fonction popup
function FS_pop(lk,x,y) {
	if (x=='max') x=winx;
	if (y=='max') y=winy;
	window.open(lk, '_blank', 'width='+x+', height='+y+', top=0, left=0, toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, directories=no');
	return false;
}
// sawp page
function FS_sp(choix){
  eval("this.location='"+choix.options[choix.selectedIndex].value+"'");
}
//
//
// --> fonctions dedier
//
//
function addFav() {
	tbArgu=addFav.arguments;
	nba=tbArgu.length;
	if (nba>0) {
		lk=tbArgu[0];
		if (nba>1) {
			lib=tbArgu[1];
		} else {
			lib=lk;
		}
	} else {
		lk="55.219.0.1";
		lib="Intranet";
	}
	lk="http://"+lk;
	window.external.AddFavorite(lk, lib);
}
// fonction contact
function contact(lib) {
	var deb ="<a href='mailto:";
	var couriel ="olivier.";
	couriel +="leon@";
	couriel +="ersm-bretagne.cnamts.fr?subject=";
	couriel +="[message&nbsp;Intranet]";
	var even =">";
	var imag ="";
	var txt = lib;
	document.write(deb+couriel+"' "+even+txt+"</a>");
}
// fonction affiche table création à la volé
function aff_cr_vol(tableau, valeur) {
	if (valeur == '0') FS_dispDiv(tableau);
	else FS_dispDiv(tableau, 'none');
}
// fonction du Menu gauche
var affiche=new Array();
var compteur=new Array();
function afficheMenu(id) {
	affiche[id]=true;
	compteur[id]=0;
	tempo(id);
}
function effaceMenu(id) {
	affiche[id]=false;
	compteur[id]=0;
	tempo(id);
}

function tempo(id) {
	compteur[id]++;
	if (compteur[id]<2) {
		window.setTimeout("tempo('"+id+"')",800);
	} else {
		if (affiche[id]) {
			FS_dispDiv(id);
		} else {
			FS_dispDiv(id, 'none');
		}
	}
}
/*
// fonction notes (nostalgie)
function submitNotes(form, champ, valeur) {
	f=form;
	f.elements[champ].value=valeur; 
	f.gopage.value=1;
	critere=new Array('numero','date_evenement','rubrique', 'nom');
	ordre=1;
	if (f.elements['prio_'+champ].value!="1") {
		f.elements['prio_'+champ].value=ordre;
		exclu=champ;
		trouver=true;
		while(trouver==true) {
			trouver=false;
			for(Val in critere) {
				if (f.elements['prio_'+critere[Val]].value==ordre && exclu != critere[Val]) {
					ordre++;
					f.elements['prio_'+critere[Val]].value=ordre;
					exclu=critere[Val];
					trouver=true;
				}
			}
		}
	}
	champ.value=valeur; 
	f.submit();
}
*/
// fonction envoi formulaire avec parametre de trie
function submitTri(form, champ, valeur) {
	f=form;
	f.elements[champ].value=valeur; 
	f.gopage.value=1;
	f.elements['prio_'+champ].value=0;
	f.submit();
}

