///////////////////////////////////////////////////
//name: _scripts/client/layers.js
//
//purpose: Client functions for manipulating layers
//author: Tim Needham 27/06/2000
///////////////////////////////////////////////////

///////////////////////////////////////////////////
//flip_layer()
//Takes a browser hint (br), the root name of the
//layer group (name), the layer id (id) and the
//number of layers in the group (max) and hides all
//layers in the group, leaving the selected one
//visible.										TPN
///////////////////////////////////////////////////

function flip_layer(br, name, id, max)
{
		var viewlayer, layer, image, link;

		if (br == 'IE') {
			viewlayer = eval('document.all.'+name+id+'.style');
			for(i=1;i<max+1;i++) {
				layer = eval('document.all.'+name+i+'.style');
				layer.visibility = 'hidden';
				image = eval("document.im"+i);
				image.src = '/_imgs/ui/pxl_blue.gif';
				link = eval('document.all.l'+i);
				link.style.color = '#3366cc';
			}

			image = eval("document.im"+id);
			image.src = '/_imgs/ui/r_arrow.gif';
			link = eval('document.all.l'+id);
			link.style.color = '#000000';
			viewlayer.visibility = 'visible';
		
		} else if (br == 'NN') {
			viewlayer = eval('document.layers["'+name+id+'"]');
			for(i=1;i<max+1;i++) {
				layer = eval('document.layers["'+name+i+'"]');
				layer.visibility = 'hide';
				image = eval("document.im"+i);
				image.src = '/_imgs/ui/pxl_blue.gif';
			}

			image = eval("document.im"+id);
			image.src = '/_imgs/ui/r_arrow.gif';
			viewlayer.visibility = 'show';
		
		} else if (br == 'OT') {
			viewlayer = eval('document.all.'+name+id+'.style');
			for(i=1;i<max+1;i++) {
				layer = eval('document.all.'+name+i+'.style');
				layer.visibility = 'hidden';
				image = eval("document.im"+i);
				image.src = '/_imgs/ui/pxl_blue.gif';
			}

			image = eval("document.im"+id);
			image.src = '/_imgs/ui/r_arrow.gif';
			viewlayer.visibility = 'visible';
		}		
}
