<!--

//Copyright Mangolab 2002
//feel free to use this code in your own site but please
//give a link to www.mangolab.com as a credit
//JHEADER2 Version 2
//18.10.02 - added var & more initialisation control over table size & pos

//~~~~~~~~~~~~~~
//Var to change:
//~~~~~~~~~~~~~~

//NB references to the logo mean the 1st button (as in ArrBtn[0])
var DirImages = "";        //Set default image path
var HgtLinkRow=22;         //height of the text links row
var HgtLogo=51;            //height of the logo must be <= (HgtLinkRow+HgtButtons);
var HgtButtons=52;         //height of the other butttons
var LogoVAlign="BOTTOM";   //logo vertical alignment
var ColBar_On="#FF9933";   //Inactive text bar colour 
var ColBar_Off="#C0C0C0";  //Active/lit text bar colour 
var HgtAboveSpace=17;      //the height of the space above the buttons - 
                           //NB this can not be LESS than the Table.Links class font size in s_head.css

//Buttons must be created named as: 
//<btn name>_0.gif for Normal state image
//<btn name>_1.gif for Highlight state image
//<btn name>_2.gif for Active/selected state image
//Create button link arrays using record structure:
//ArrBtn<N> = new Array(
//0 - <btn name>
//1 - HRef link
//2 - Description (Status bar text)
//3 - Sub menu html nb in form "&nbsp;&nbsp;<A HREF='Link 1' TARGET='Main' onClick='clicked(<N>)'>link 1</A>&nbsp;&nbsp...etc..,
//4 - Button width);  

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//Define main menu button arrays:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

// **** IF ERRORS CHECK THIS VALUE! *****
var CntArrBtn = 7; //ie the no. of main button arrays (including any dummy buttons) 

ArrBtn0 = new Array(
"logosm",
"ind_main.htm",
"Mangolab home page",
"&nbsp;&nbsp;<A HREF='ind_main.htm' TARGET='Main' onClick='clicked(0)'>home</A>&nbsp;&nbsp;",
"34");

ArrBtn1 = new Array(
"about",
"mnu_abou.htm",
"general information about Mangolab and our work",
"&nbsp;&nbsp;<A HREF='who.htm' TARGET='Main' onClick='clicked(1)'>who are we?</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='how.htm' TARGET='Main' onClick='clicked(1)'>how we can help</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='exp.htm' TARGET='Main' onClick='clicked(1)'>our track record</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='test.htm' TARGET='Main' onClick='clicked(1)'>customer testimonials</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='jobs.htm' TARGET='Main' onClick='clicked(1)'>jobs</A>",
"101");

ArrBtn2 = new Array(
"serv",
"mnu_serv.htm",
"information about the services supplied by Mangolab",
"&nbsp;&nbsp;<A HREF='who.htm' TARGET='Main' onClick='clicked(2)'>bespoke software</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='web.htm' TARGET='Main' onClick='clicked(2)'>web design</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='ecom.htm' TARGET='Main' onClick='clicked(2)'>e-commerce</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='sec.htm' TARGET='Main' onClick='clicked(2)'>security services</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='test.htm' TARGET='Main' onClick='clicked(2)'>view customer testimonials</A>",
"101");

ArrBtn3 = new Array(
"prod",
"mnu_prod.htm",
"off the shelf products from mangolab",
"&nbsp;&nbsp;<A HREF='mart.htm' TARGET='Main' onClick='clicked(3)'>mangomart</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='mangobot.htm' TARGET='Main' onClick='clicked(3)'>mangobot</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='missing.htm' TARGET='Main'onClick='clicked(3)'>scheduling suite</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='down.htm' TARGET='Main' onClick='clicked(3)'>downloads</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='test.htm' TARGET='Main' onClick='clicked(3)'>view customer testimonials</A>",
"101");

ArrBtn4 = new Array(
"prices",
"mnu_pric.htm",
"details of Mangolab's project pricing structure",
"&nbsp;&nbsp;<A HREF='quot.htm' TARGET='Main' onClick='clicked(4)'>get a free consultation</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='off.htm' TARGET='Main' onClick='clicked(4)'>prices for our off-the-shelf products</A>",
"101");

ArrBtn5 = new Array(
"contac",
"mnu_cont.htm",
"information on how to get in touch with Mangolab",
"&nbsp;&nbsp;<A HREF='feed_fm.htm' TARGET='Main' onClick='clicked(5)'>give your feedback</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='mailto:sales@mangolab.com?SUBJECT=www.mangolab.com sales enquiry' TARGET='Main' onClick='clicked(5)'>e-mail the sales department</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='bug_fm.htm' TARGET='Main' onClick='clicked(5)'>report a bug in a mangolab product</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='contac.htm' TARGET='Main' onClick='clicked(5)'>get our contact details</A>",
"101");

ArrBtn6 = new Array(
"help",
"mnu_help.htm",
"frequently asked questions, online bug reporting and other help support",
"&nbsp;&nbsp;<A HREF='reg_help.htm' TARGET='Main' onClick='clicked(6)'>online help centre</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='bug_fm.htm' TARGET='Main' onClick='clicked(6)'>report a bug in a mangolab product</A>&nbsp;<B>&#183;</B>&nbsp;<A HREF='quot.htm' TARGET='Main' onClick='clicked(6)'>request a free no-obligation consultation</A>",
"101");

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//No need to change from here:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~

// define variable for the arrays. Do not change.
var main_pic = new Array();
var lit_pic = new Array();
var active_pic = new Array();

//Calculated:
var HgtHeaderHeight=HgtLinkRow+HgtButtons+HgtAboveSpace;


//SetSource is called from the page & puts it all together 
//to create the initial state page html source

function SetSource(){
PreloadButtonData();//preload the images
//Set any initial html before the buttons here
var StrHead="<TABLE COLS='"+(CntArrBtn+1)+"' CLASS='links' ALIGN='LEFT' WIDTH='100%' HEIGHT='"+HgtHeaderHeight+"' VSPACE='0' HSPACE='0' CELLPADDING='0' CELLSPACING='0' BORDER='0'><TR><TD HEIGHT='"+HgtAboveSpace+"' COLSPAN='"+CntArrBtn+"'>&nbsp;</TD></TR><TR>";
//add the button layout
StrHead=StrHead+GetSourceButtons();
//set the initial sublink text
StrHead=StrHead+"</TR><TR><TD HEIGHT='"+HgtLinkRow+"' bgcolor='"+ColBar_Off+"' VALIGN='MIDDLE' COLSPAN='"+CntArrBtn+"' ID='sublinks'>&nbsp;&nbsp;www.mangolab.com</TD></TR></TABLE>";//HEIGHT='20' BGCOLOR='#FFFFFF'
document.write(StrHead);
//alert(StrHead);
document.close(); 
}

//Build the contents of the buttons row
function GetSourceButtons(){
var DisplayIt="";
var HgtImage=0;
var StrTD="";
for (var i=0;i<CntArrBtn;i++){    	
    TempArray=eval("ArrBtn" + i);
    if (i==0){
	//ie 1st button (logo)
        StrTD="<TD ROWSPAN='2' WIDTH='"+TempArray[4]+"' ID='choice"+i+"' VALIGN='"+LogoVAlign+"'>";
        HgtImage=HgtLogo;
        }
	else{
	StrTD="<TD VALIGN='BOTTOM' WIDTH='"+TempArray[4]+"' HEIGHT='"+HgtButtons+"' BGCOLOR='#FFFFFF' ID='choice"+i+"'>";
        HgtImage=HgtButtons;
        }
    DisplayIt += StrTD+"<A HREF='"+TempArray[1]+"' TARGET='Main'><IMG SRC='"+DirImages+TempArray[0]+"_0.gif' HEIGHT='"+HgtImage+"' WIDTH='"+TempArray[4]+"' BORDER='0' VSPACE='0' HSPACE='0' NAME='nav"+i+"' onMouseOver='BtnOver("+i+")' onMouseOut='BtnOut("+i+")' onClick='clicked("+i+")'></A></TD>";       
    }   
DisplayIt += "<TD>&nbsp;</TD>";//empty cell to take up slack
//alert(DisplayIt);
return DisplayIt;
}

//preloads each sub-menu button state image

function PreloadButtonData(){
for (var i=0;i<CntArrBtn;i++){    	
    TempArray=eval("ArrBtn" + i);
    //preload the images & alt text & html sublinks string
    preloadImages(i,DirImages+TempArray[0]+"_0.gif",DirImages+TempArray[0]+"_1.gif",DirImages+TempArray[0]+"_2.gif");
    }
}

// This function builds the arrays for the image swapping
// and status bar text. Do not change.

function preloadImages(idx,main,lit,active) {
 main_pic[idx] = new Image();
 main_pic[idx].src = main;
 lit_pic[idx] = new Image();
 lit_pic[idx].src = lit;
 active_pic[idx] = new Image();
 active_pic[idx].src = active;
}

// some variables for the functions below. Leave as is.

//var timer1
var isActive = 0
var isLit = 0

function BtnOver(Idx){
//highlight image
lighten(Idx);
//set status bar
statusDisplay(Idx);
//set sublinks cell html
TempArray=eval("ArrBtn" + Idx);
if (document.getElementById){
   document.getElementById("sublinks").innerHTML=TempArray[3];
   document.getElementById("sublinks").style.backgroundColor=ColBar_On;
   }
   else {
   sublinks.innerHTML=TempArray[3];
   sublinks.style.backgroundColor=ColBar_On;
   }
return false;
}

function BtnOut(Idx){
if (document.getElementById)
   document.getElementById("sublinks").style.backgroundColor=ColBar_Off
   else 
   sublinks.style.backgroundColor=ColBar_Off;
//de-highlight but leave html
return darken(Idx);
}

// This function controls the status bar display.

function statusDisplay() {
 TempArray=eval("ArrBtn" + isLit);
 window.status = TempArray[2];
 //timer1 = 0;
 //timer1 = setTimeout("statusDisplay()", 50)
}

// This function is for the mouseover image swap.

function lighten(num) {
 isLit = num;
 if (num != isActive) {
  eval("document.nav"+num+".src = lit_pic["+num+"].src;");
 }
 return false;
}

// This function is for the mouseout image swap.

function darken(num) {
 if (isLit != isActive)
  isLit = isActive;
 if (num != isActive)
  eval("document.nav"+num+".src = main_pic["+num+"].src;");
 return false;
}

// This function is for the clicked image swap

function clicked(num) {
 wasActive = isActive
 isActive = num
 isLit = num
 darken(wasActive);
 if (document.images) {
  eval("document.nav"+num+".src = active_pic["+num+"].src;");
 }
 return true;
}

// This function determines the active link and lights it.

function reLight(num) {
 for (i=0; i<=CntArrBtn; i++) {
  eval("document.nav"+i+".src = main_pic["+i+"].src;");
 }
 isActive = num
 isLit = num
 if (document.images) {
  eval("document.nav"+num+".src = active_pic["+num+"].src;");
 }
}

function reset() {
 clearTimeout(timer1)
}

// This function can be used to whip off an index from
// a string eg index?4 etc (not used at mo!) 

function searchStr() {
 if (document.location.search) {
  var sstring = document.location.search
  var extractStr = sstring.substring(sstring.indexOf("?") + 1, sstring.length)
 y = eval(extractStr)
 reLight(y)
 }
}

// This function is triggered by the onload event handler of each
// page (except index.htm) to determine and set the default text
// for the status bar and the active link for the currently loaded page.

function startIt() {
 searchStr();
 statusDisplay();
}


//-->
