/*		_______________________________________________
		| 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 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;
	}
}
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 z-index
function FS_czi(id,i){
	if (document.getElementById) {
		document.getElementById(id).style.zIndex=i;
	}
	else if (document.all) {
		document.all[id].style.zIndex=i;
	}
	else if (document.layers) {
			document.layers[id].zIndex=i;
	}
}
// 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;
}
function FS_popImg(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=no, resizable=no, copyhistory=no, directories=no');
	return false;
}
// Plein ecran pour 1024x768
function FS_popPleinEcran(lk) {
	WinPE=window.open(lk, '_blank', 'width=1024, height=768, top=0, left=0, toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, directories=no');
//	WinPE.moveTo(-6,-32);
	WinPE.moveTo(screen.width/2-512-6,screen.height/2-384-32);
	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 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();
}

function test_navigateur() {
	if(navigator.appName=='Microsoft Internet Explorer') return "IE";
	else if(navigator.appName=='Netscape') {
		if (navigator.vendor=="") return "Moz"; // Mozilla
		else return "NS";// NS 4 ou 6
	} 
	else if(navigator.appName=='Opera') return "Ope";// Opera
	else return "NC";// Autre
} 

function infobul(idDiv,idSpan){
	nav=test_navigateur() ;
	if (nav=="Moz") mTop=10;
	else mTop= 28;
	tailB=document.body.clientWidth; // taille Body
	tailP=970; // taille DIV page
	tailM=395; // taille menu
	tailD=60; // decalage négatif
	tailT=588; // decalage bloc texte
	mLeft=mousX-tailM-tailD-((tailB - tailP)/2);
	largSpan=document.getElementById(idSpan).clientWidth;
	hautSpan=document.getElementById(idSpan).clientHeight;
	tailE=mLeft+largSpan // emcombrement du bloc
	if (tailE>tailT) mLeft = mLeft-tailE+tailT;
	if (document.getElementById) {
		document.getElementById(idSpan).style.marginLeft=mLeft+"px";
		document.getElementById(idSpan).style.marginTop=mTop+"px";
		mLeft=mLeft+4; mTop=mTop+3;
		document.getElementById(idDiv).style.marginLeft=mLeft+"px";
		document.getElementById(idDiv).style.marginTop=mTop+"px";
		document.getElementById(idDiv).style.width=largSpan+"px";
		document.getElementById(idDiv).style.height=hautSpan+"px";
	}
	else if (document.all) {
		document.all[idSpan].style.marginLeft=mLeft+"px";
		document.all[idSpan].style.marginTop=mTop+"px";
		mLeft=mLeft+4; mTop=mTop+3;
		document.all[idDiv].style.marginLeft=mLeft+"px";
		document.all[idDiv].style.marginTop=mTop+"px";
		document.all[idDiv].style.width=largSpan+"px";
		document.all[idDiv].style.height=hautSpan+"px";
	}
	else if (document.layers) {
		document.layers[idSpan].marginLeft=mLeft+"px";
		document.layers[idSpan].marginTop=mTop+"px";
		mLeft=mLeft+4; mTop=mTop+3;
		document.layers[idDiv].marginLeft=mLeft+"px";
		document.layers[idDiv].marginTop=mTop+"px";
		document.layers[idDiv].width=largSpan+"px";
		document.layers[idDiv].height=hautSpan+"px";
	}
}

function Aide(t) {
	if (t=='surface') alert ('1a = 100m2 = (10mx10m)\n1ha = 100a = 10000m2 = (100mx100m)\n 1km2 = 100ha = 10000a = 1000000m2 = (1000mx1000m)');
}

function diaporama() {
alert ("debut diapo");

	tbArgu=diaporama.arguments;
	nba=tbArgu.length;
	nom=tbArgu[0];
	for (i=1;i<nba+1;i++) {
		img="images/photos/statique/"+nom+"/"+tbArgu[i];
		setTimeout (alert(nom+img), 1000); 
	}
}


function ejs_aff_photos(num,id)
{
	//alert(num+" "+id);
if(document.getElementById)
	{
	htm_Fin = "";
	if(num!=0)
		htm_Fin += '<a href="#" onClick="ejs_aff_photos('+(num-1)+', '+"'"+id+"'"+'); return(false);">< prec.</A> ';
	if(num!=(tb_photo[id].length-1))
		htm_Fin += '<a href="#" onClick="ejs_aff_photos('+(num+1)+', '+"'"+id+"'"+'); return(false);">suiv. ></A>';
	div = "<CENTER><IMG SRC='"+tb_photo[id][num]+"' BORDER=0><BR>"+htm_Fin+"</CENTER>";
	//alert (div);
	document.getElementById(id).innerHTML  = div;
	}
}


// fonction contact
function contact() {
	var deb ="<a href='mailto:";
	var couriel ="veroni";
	couriel +="que.marafon@";
	couriel +="gmail.com?subject=";
	couriel +="[message%20SamsaraIMMO]";
	var even =">";
	var imag ="";
	var txt ="veronique.marafon@gmail.com";
	document.write(deb+couriel+"' "+even+txt+"</a>");
}