/* ========================================================================

    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 preloadNavImages(strSection,imgName)

{

 eval(imgName+"_off = new Image(20,18); " + imgName + "_off.src=\"/DuboisWeb/images/nav/" + strSection + "/" + imgName + "_off.gif\";");

 eval(imgName+"_on = new Image(20,18); " + imgName + "_on.src=\"/DuboisWeb/images/nav/" + strSection + "/" + imgName + "_on.gif\";");

}



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 false;}

 var strVis = ((state == 1) ? showv : showh);

 eval(structure + lyrid + viseq + strVis)

}



var my_w = 800;

var my_h = 600;

if (screen.width) {my_w = screen.width;}

if (screen.height) {my_h = screen.height;}





function showPopup(theURL,winwidth,winheight)

{

 if ((winheight > 540) && (my_h <= 600)) {winheight = 540;}

 if ((winwidth > 770) && (my_w <= 800)) {winwidth = 770;}

 var resizeHeight = winheight;

 var resizeWidth = winwidth+6;

 if (plat=="win")

 {

  resizeHeight+=56;

  if (document.all){resizeWidth = winwidth+26;}

  else {resizeWidth = winwidth+20;}

 }

 var intWinTop = parseInt((my_h-winheight) / 2);

 var intWinLeft = parseInt((my_w-winwidth) / 2);

 intWinTop -= 35;

 if (intWinTop<0) {intWinTop = 0;}

 intWinLeft -= 10;

 if (intWinLeft<0) {intWinLeft = 0;}

 SaharaSoundPopup = window.open(theURL,"SaharaSoundPopup","width="+winwidth+",height="+winheight+",top="+intWinTop+",left="+intWinLeft+",resizable=no,scrollbars=yes,status=no,location=no,menubar=yes");

 if (g3)

 {

  SaharaSoundPopup.resizeTo(resizeWidth,resizeHeight);

  SaharaSoundPopup.moveTo(intWinLeft,intWinTop);

 }

 SaharaSoundPopup.opener = self;

 SaharaSoundPopup.focus();

}



function showNews()

{

 NewsWindow = window.open("/News/NewsPopup.htm","SaharaNews","width=730,height=416,resizable=no,scrollbars=yes,status=no,location=no,menubar=no");

 NewsWindow.opener = self;

 NewsWindow.focus();

}



function showGalleryPic(strPath)

{

 SaharaGalleryWin = window.open("/Studio/Gallery/"+strPath+".htm","SaharaGalleryWin","width=490,height=374,resizable=no,scrollbars=no,status=no,location=no,menubar=no");

 SaharaGalleryWin.opener = self;

 SaharaGalleryWin.focus();

}





