/* ========================================================================
    common.js written by Simon Holmes, Design Motive
    Copyright 2002 Design Motive Ltd
	http://www.designmotive.co.uk/
   ======================================================================== */ 


// DEFINE GLOBAL VARIABLES AND SET UP SOME STANDARD DOM VAR'S
var showh, showv, structure, viseq, lyr, busy, doit, closingb, active;
plat = ((navigator.platform.indexOf('Win') > -1) ? "win" : "mac");
browse = navigator.appName;
docimg = "document.images.";
showh = "'hidden'";
showv = "'visible'";
busy = 0;
closingb = "";
active = null;


// SELECT THE DOM OF THE BROWSER AND DEFINE VARIABLES
var g3 = (document.getElementById);         // will be true if it's IE5+, Netscape6+
var ns = (document.layers);                 // will be true if it's Netscape 4
var ie = (document.all);                    // will be true if it's IE
if (g3)
{
 structure = "document.getElementById('";
 viseq = "').style.visibility = ";
 nslyr = ""
 ns = false;                                // set these to false so that it uses the W3C standard DOM
 ie = false;                                // in case the browser can handle two type of dhtml
 closingb = "')";
}
if (ie)
{
 structure = "document.all.";
 viseq = ".style.visibility=";
 nslyr = "";
}
if (ns)
{
 structure = "document.layers.";
 viseq = ".visibility=";
}

function fnPicChange(imgname,state,lyrid)
{
 args = fnPicChange.arguments;
 var strState = ((state == 1) ? "_on" : "_off");
 pic = imgname + ".src=" + imgname + strState + ".src";
 if (args.length == 3 && (ns)) {nslyr = "document.layers." + args[2] + ".";}
 else {nslyr = ""}
 eval(nslyr + docimg + pic);
}

function testLayer(id)
{
 test = eval(structure +id + closingb);
 if (!test) {return false;}
 return true;
}

function showHideLayer(lyrid,state)
{
 if (!testLayer(lyrid)) {return false;}
 var strVis = showv
 if (state == 0){strVis = showh;}
 eval(structure + lyrid + viseq + strVis)
}

