/* ========================================================================
    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, closingb;
docimg = "document.images.";
showh = "'hidden'";
showv = "'visible'";
closingb = "";


// 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 fnIconChange(imgname,state,type,lyrid)
{
 args = fnIconChange.arguments;
 var strState = ((state == 1) ? "_on" : "_off");
 pic = imgname + ".src=" + type + strState + ".src";
 if (args.length == 4 && (ns)) {nslyr = "document.layers." + args[3] + ".";}
 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;}
 var strVis = ((state == 1) ? showv : showh);
 eval(structure + lyrid + viseq + strVis)
}

function showPolicies(strAnchor)
{
 PoliciesWindow = window.open("Policies.htm#" + strAnchor,"PoliciesWindow","width=390,height=410,resizable=no,scrollbars=yes,status=no,location=no,menubar=no");
 PoliciesWindow.opener = self;
 PoliciesWindow.focus();
}

function showTerms(strAnchor)
{
 TermsWindow = window.open("TermsConditions.htm#" + strAnchor,"TermsWindow","width=800,height=410,resizable=no,scrollbars=yes,status=no,location=no,menubar=no");
 TermsWindow.opener = self;
 TermsWindow.focus();
}

function showHelp(strAnchor)
{
 HelpWindow = window.open("help.html#" + strAnchor,"HelpWindow","width=390,height=410,resizable=no,scrollbars=yes,status=no,location=no,menubar=no");
 HelpWindow.opener = self;
 HelpWindow.focus();
}
