Subversion Repositories Sites.tela-botanica.org

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 david 1
var vis = new Array();
2
 
3
 
4
	var memo_obj = new Array();
5
 
6
	function findObj(n) {
7
		var p,i,x;
8
 
9
		// Voir si on n'a pas deja memoriser cet element
10
		if (memo_obj[n]) {
11
			return memo_obj[n];
12
		}
13
 
14
		d = document;
15
		if((p = n.indexOf("?"))>0 && parent.frames.length) {
16
			d = parent.frames[n.substring(p+1)].document;
17
			n = n.substring(0,p);
18
		}
19
		if(!(x = d[n]) && d.all) {
20
			x = d.all[n];
21
		}
22
		for (i = 0; !x && i<d.forms.length; i++) {
23
			x = d.forms[i][n];
24
		}
25
		for(i=0; !x && d.layers && i<d.layers.length; i++) x = findObj(n,d.layers[i].document);
26
		if(!x && document.getElementById) x = document.getElementById(n);
27
 
28
		// Memoriser l'element
29
		memo_obj[n] = x;
30
 
31
		return x;
32
	}
33
 
34
	function hide_obj(obj) {
35
		element = findObj(obj);
36
		if(element) {
37
			if (element.style.visibility != "hidden") element.style.visibility = "hidden";
38
		}
39
	}
40
 
41
function swap_couche(couche, rtl, dir, no_swap) {
42
	triangle = findObj('triangle' + couche);
43
	if (!(layer = findObj('Layer' + couche))) return;
44
	if (vis[couche] == 'hide'){
45
		if (!no_swap && triangle) triangle.src = dir + 'deplierbas.gif';
46
		layer.style.display = 'block';
47
		vis[couche] = 'show';
48
	} else {
49
		if (!no_swap && triangle) triangle.src = dir + 'deplierhaut' + rtl + '.gif';
50
		layer.style.display = 'none';
51
		vis[couche] = 'hide';
52
	}
53
}
54
function ouvrir_couche(couche, rtl,dir) {
55
	triangle = findObj('triangle' + couche);
56
	if (!(layer = findObj('Layer' + couche))) return;
57
	if (triangle) triangle.src = dir + 'deplierbas.gif';
58
	layer.style.display = 'block';
59
	vis[couche] = 'show';
60
}
61
function fermer_couche(couche, rtl, dir) {
62
	triangle = findObj('triangle' + couche);
63
	if (!(layer = findObj('Layer' + couche))) return;
64
	if (triangle) triangle.src = dir + 'deplierhaut' + rtl + '.gif';
65
	layer.style.display = 'none';
66
	vis[couche] = 'hide';
67
}
68
function manipuler_couches(action,rtl,first,last, dir) {
69
	if (action=='ouvrir') {
70
		for (j=first; j<=last; j+=1) {
71
			ouvrir_couche(j,rtl, dir);
72
		}
73
	} else {
74
		for (j=first; j<=last; j+=1) {
75
			fermer_couche(j,rtl, dir);
76
		}
77
	}
78
}
79
 
80
function acceder_couche(couches, n, dir, icone, texte, sens) {
81
	  javasc = ''
82
	  for (j=0; j<couches.length; j+=1)
83
	  	javasc += 'swap_couche(' + couches[j][0] + ", '" + sens + "','" + dir + "', " + couches[j][1] + ");";
84
 
85
	document.write('<a class="triangle_block" href="javascript:' +
86
	    javasc +
87
	    '"><img name="triangle' + n + '" src="' +
88
	    dir + icone + '" alt="' + texte + '" title="' + texte +
89
	    '" width="10" height="10" border="0"></a>');
90
}