//var thequerystring = "?ref=jbc"; //JUST FOR TESTING
var wide= 0;
var productmenuaction = 0;
//timerID=null;

var menuclosetime = 5;
var zlevelback = 10;
var zlevelfront = 100;
var currentselectedmenu=null;

// THIS CODE IS CUSTOM WRITTEN BY JONATHAN BRIAN COMMONS. IT IS COPYRIGHT. DO NOT USE IT WITHOUT MY PERMISSION. 

//SETTING MENU DISPLAY DEFAULTS

var defaultmenuformat = 0; //0 = vertical 1 = horizantal
var defaultmenuwidth = "";
var defaultmenucellwidth = "";
var defaultmenucellalign = "left";


var defaultmenubgcolor = "#0000ff";
var defaultmenucellspacing = 2;
var defaultmenucellpadding = 2;

var defaultmenucellbgcolordim = "#ffff00"; //var defaultmenucellbgcolordim = "#a0a0a0";
var defaultmenucellbgcolorlit = "#ff0000";
var defaultmenucellbgcolorhit = "#0000ff"; //var defaultmenucellbgcolorhit = "#ffff00";

var defaultmenucellfgcolordim = "#000000";
var defaultmenucellfgcolorlit = "#000000";
var defaultmenucellfgcolorhit = "#000000";

var defaultmenufontweight = "normal";

// SETTING FONT SIZE & MENU LENGTH FOR SCREEN RES 
if(screen.width > 800){
var showonly = 8;
var defaultmenufontsize="9pt";
}
else
{
var showonly = 8;
var defaultmenufontsize="7pt";
}

var defaultmenufontface ="verdana,arial";


//START OF FUNCTIONS USED BY THE SYSTEM
function swap(thisthearray,elementA,elementB){
elementC = thisthearray[elementA];
thisthearray[elementA] = thisthearray[elementB];
thisthearray[elementB] = elementC; 
return thisthearray;
}

function swapall(thistemparray,elementA,elementB){
for(q=0;q<thistemparray.length;q++){
thistemparray[q] = swap((thistemparray[q].split(";")),elementA,elementB).join(";");
}
return thistemparray;
}


function extractdata(thearray,field,needle){
outputarray = new Array();
for(g=0;g<thearray.length;g++){
temparrayA = thearray[g].split(";");
temparrayC = new Array();
if(needle){
temparrayB = temparrayA[field].split(",");
for(f=0;f<temparrayB.length;f++){
if(temparrayB[f] == needle){
temparrayC[0] = temparrayA[1];
temparrayC[1] = "playground_equipment_"+temparrayA[0].toLowerCase()+".php"+thequerystring;
//temparrayC[1] = temparrayA[0].toLowerCase()+".php";
temparrayC[2] = "";
outputarray[outputarray.length] = temparrayC;
}
}
}
else
{
temparrayC[0] = temparrayA[1];
temparrayC[1] = "playground_equipment_"+temparrayA[0].toLowerCase()+".php"+thequerystring;
temparrayC[2] = "";
outputarray[outputarray.length] = temparrayC;
}
}
return outputarray;
}






// FUNCTONS FOR HILITING AND DIMMING OBJECTS

function hc(thisobj,menuname){
thisobj.style.backgroundColor = menu[menuname.id]["cellbgcolorlit"];
thisobj.style.color = menu[menuname.id]["cellfgcolorlit"];
}
function dc(thisobj,menuname){
thisobj.style.backgroundColor = menu[menuname.id]["cellbgcolordim"];
thisobj.style.color = menu[menuname.id]["cellfgcolordim"];
}



//FUNCTION FOR CLOSING A MENU
function closemenu(menuname){
menunamestring = menuname.id;

if(menuname != currentselectedmenu){
closeanychildren(menuname); 


if(menu[menunamestring]["autohide"]==1){
eval("document.all."+menunamestring+".style.visibility='hidden';");
eval("document.all."+menunamestring+".style.zIndex="+zlevelback);
}


if((menu[menunamestring]["parent"]!="")&&(menu[(menu[menunamestring]["parent"])]["autohide"]==1)){
eval('timerID'+menu[menunamestring]["parent"]+' = setTimeout("closemenu('+menu[menunamestring]["parent"]+')",menuclosetime);');
}


// this is test to dim no hiding menus
if((menu[menunamestring]["parent"]!="")&&(menu[(menu[menunamestring]["parent"])]["autohide"]==0)){
hiliteparentindex(menuname,0);
}
}
}


//FUNCTION FOR MOUSEOVERS OF MENU ***THIS IS THE MENU NOT THE CELL SO IT IS ACTIONED ONLY ONCE EACH TIME MENU IS FIRST MOUSED OVER OR MOUSEOUT
function menumouseover(menuname){
menunamestring = menuname.id;
if(menu[menunamestring]["parent"]!=""){
hiliteparentindex(menuname,1);
}
}

function menumouseout(menuname){
return; // temp test to check validity of this function
menunamestring = menuname.id;
//eval('menu.'+menunamestring+'.action=0'); //temp off for testing action valididity

if(menu[menunamestring]["parent"]!=""){
//eval('menu.'+menu[menunamestring]["parent"]+'.action=0');   //temp off for testing action valididity

}
}


function closeanychildren(menuname){
menunamestring = menuname.id;
lastindex = menu[menunamestring]["currentindex"];
if(menu[menunamestring]["menuitems"][lastindex][2]!=""){
thechild = menu[menunamestring]["menuitems"][lastindex][2];
eval(thechild+".style.visibility = 'hidden';");
eval(thechild+".style.zIndex="+zlevelback);
//eval(thechild+".style.display = 'none';");
}
}



//FUNCTION TO MAKE THE MENUS *****CURRENTLY ONLY STANDARD HARDCODED SETTINGS FOR BUILDING MENU CAN BE SET TO FORMAT MENUS

//*************************************************
var menulist = new Array();
var menushowlist = new Array();
toggle=0;

function illuminate(){
if(toggle){
togaction = "show";
toggle = 0;
}
else
{
togaction = "hidden";
toggle = 1;
}

for(u=0;u<menulist.length;u++){
eval("visval = "+menulist[u]+".style.visibility");
if(visval == "hidden"){
eval(menulist[u]+".style.visibility = ''");
eval(menulist[u]+".style.backgroundColor = 'pink'");
}
}


}
//******************************************

function automakemenu(menuname){

menulist[menulist.length] = menuname;

//setup display variables

menuprops = new Array("format","width","cellwidth","cellalign","bgcolor","cellspacing","cellpadding","cellbgcolordim","cellbgcolorlit","cellbgcolorhit","cellfgcolordim","cellfgcolorlit","cellfgcolorhit","fontsize","fontface","fontweight");

for(h=0;h<menuprops.length;h++){
if((menu[menuname][menuprops[h]] == undefined)||(menu[menuname][menuprops[h]] == "")){
//test="fontweight";
menu[menuname][menuprops[h]] = eval("defaultmenu"+menuprops[h]);
}
}

menu[menuname]["scrollindex"] = 0;
menu[menuname]["currentindex"] = 0;



document.writeln('<div id='+menuname+' width="'+((menu[menuname]["format"]==0) ? "":"")+'" style="position:absolute; visibility:'+((menu[menuname]["autohide"] == 1) ? "hidden":"show")+'; left:'+menu[menuname]["x"]+'px; top:'+menu[menuname]["y"]+'px; z-index:'+(zlevelback)+'" onmouseover="currentselectedmenu='+menuname+';menumouseover('+menuname+');if(timerID'+menuname+'){clearTimeout(timerID'+menuname+')};if(timerID'+menu[menuname]["parent"]+'){clearTimeout(timerID'+menu[menuname]["parent"]+')};" onmouseout="currentselectedmenu=null;menumouseout('+menuname+');timerID'+menuname+" = setTimeout('closemenu("+menuname+")',menuclosetime)"+'" >');
document.writeln('<table width="'+((menu[menuname]["format"]==0) ? "":"100%")+'" bgcolor='+menu[menuname]["bgcolor"]+' cellspacing='+menu[menuname]["cellspacing"]+' cellpadding='+menu[menuname]["cellpadding"]+'>');
thisarray = menu[menuname]["menuitems"];


if(menu[menuname]["format"]==0){

if(thisarray.length > showonly){
document.writeln('<tr id='+menuname+'uparrow style="display:none"><td style="cursor:hand;font-family:'+menu[menuname]["fontface"]+';font-weight:'+menu[menuname]["fontweight"]+';font-size:'+menu[menuname]["fontsize"]+';color:'+menu[menuname]["cellfgcolordim"]+';background-color:'+menu[menuname]["cellbgcolordim"]+'" align=center onmouseOver="hc(this,'+menuname+');scrollUP'+menuname+'=setInterval('+"'scrollmenu(-1,"+menuname+")'"+',50);return true;" onmouseOut="dc(this,'+menuname+');if(scrollUP'+menuname+'){clearInterval(scrollUP'+menuname+')};"><font face='+menu[menuname]["fontface"]+'>UP</td></tr>');
}
for(i=0;i<thisarray.length;i++){
thisitem = thisarray[i];
//document.writeln('<div><tr id='+menuname+i+' style="display:'+((i<showonly) ? "":"none")+'"><a href="'+thisitem[1].toLowerCase()+'"><td id='+menuname+'_item'+i+' style="cursor:hand;font-family:'+menu[menuname]["fontface"]+';font-weight:'+menu[menuname]["fontweight"]+';font-size:'+menu[menuname]["fontsize"]+';color:'+menu[menuname]["cellfgcolordim"]+';background-color:'+menu[menuname]["cellbgcolordim"]+'" align="'+menu[menuname]["cellalign"]+'" onmouseOver="if(timerID'+menu[menuname]["menuitems"][i][2]+'){clearTimeout(timerID'+menu[menuname]["menuitems"][i][2]+');closeanychildren('+menu[menuname]["menuitems"][i][2]+')};hc(this,'+menuname+');openchild('+menuname+','+i+');" onmouseOut="dc(this,'+menuname+');"><font face='+menu[menuname]["fontface"]+'>'+thisitem[0]+' '+zlevel+'</td></tr></div>');


document.writeln('<div><tr id='+menuname+i+' style="display:'+((i<showonly) ? "":"none")+'">');
if(thisitem[1]){
document.writeln('<a href="'+thisitem[1].toLowerCase()+'">');
}
document.writeln('<td id='+menuname+'_item'+i+' style="cursor:hand;font-family:'+menu[menuname]["fontface"]+';font-weight:'+menu[menuname]["fontweight"]+';font-size:'+menu[menuname]["fontsize"]+';color:'+menu[menuname]["cellfgcolordim"]+';background-color:'+menu[menuname]["cellbgcolordim"]+'" align="'+menu[menuname]["cellalign"]+'" onmouseOver="if(timerID'+menu[menuname]["menuitems"][i][2]+'){clearTimeout(timerID'+menu[menuname]["menuitems"][i][2]+');closeanychildren('+menu[menuname]["menuitems"][i][2]+')};hc(this,'+menuname+');openchild('+menuname+','+i+');" onmouseOut="dc(this,'+menuname+');"><font face='+menu[menuname]["fontface"]+'>'+thisitem[0]);
if(thisitem[1]){
document.writeln('</a>');
}
document.writeln('</td></tr></div>');
document.writeln('</a>');


//document.writeln('<div><tr id='+menuname+i+' style="display:'+((i<showonly) ? "":"none")+'"><a href="'+thisitem[1].toLowerCase()+'"><td id='+menuname+'_item'+i+' style="cursor:hand;font-family:'+menu[menuname]["fontface"]+';font-weight:'+menu[menuname]["fontweight"]+';font-size:'+menu[menuname]["fontsize"]+';color:'+menu[menuname]["cellfgcolordim"]+';background-color:'+menu[menuname]["cellbgcolordim"]+'" align="'+menu[menuname]["cellalign"]+'" onmouseOver="if(this.style.visibility != '+"'"+'hidden'+"'){"+'if(timerID'+menu[menuname]["menuitems"][i][2]+'){clearTimeout(timerID'+menu[menuname]["menuitems"][i][2]+');closeanychildren('+menu[menuname]["menuitems"][i][2]+')};hc(this,'+menuname+');openchild('+menuname+','+i+');}" onmouseOut="dc(this,'+menuname+');"><font face='+menu[menuname]["fontface"]+'>'+thisitem[0]+'</td></tr></div>');
}
if(thisarray.length > showonly){
document.writeln('<tr><td id='+menuname+'dnarrow style="display:;cursor:hand;font-family:'+menu[menuname]["fontface"]+';font-weight:'+menu[menuname]["fontWeight"]+';font-size:'+menu[menuname]["fontsize"]+';color:'+menu[menuname]["cellfgcolordim"]+';background-color:'+menu[menuname]["cellbgcolordim"]+'" align="center" onmouseOver="hc(this,'+menuname+');scrollDN'+menuname+'=setInterval('+"'scrollmenu(+1,"+menuname+")'"+',50);return true;" onmouseOut="dc(this,'+menuname+');if(scrollDN'+menuname+'){clearInterval(scrollDN'+menuname+')};"><font face='+menu[menuname]["fontface"]+'>MORE</td></tr>');
}


}
else
{
//THIS IS FOR HORIZONTAL MENU

document.writeln('<tr>');

if(thisarray.length > showonly){
document.writeln('<td id='+menuname+'uparrow style="display:none;cursor:hand;font-family:'+menu[menuname]["fontface"]+';font-weight:'+menu[menuname]["fontWeight"]+';font-size:'+menu[menuname]["fontsize"]+';color:'+menu[menuname]["cellfgcolordim"]+';background-color:'+menu[menuname]["cellbgcolordim"]+'"  align="'+menu[menuname]["cellalign"]+'" onmouseOver="hc(this,'+menuname+');scrollUP'+menuname+'=setInterval('+"'scrollmenu(-1,"+menuname+")'"+',50);return true;" onmouseOut="dc(this,'+menuname+');if(scrollUP'+menuname+'){clearInterval(scrollUP'+menuname+')};">UP</td>');
}
for(i=0;i<thisarray.length;i++){
thisitem = thisarray[i];
document.writeln('<div id='+menuname+i+'><a href="'+thisitem[1].toLowerCase()+'"><td id='+menuname+'_item'+i+' width='+(100/thisarray.length)+'% align='+menu[menuname]["cellalign"]+' style="display:'+((i<showonly) ? "":"none")+';cursor:hand;font-family:'+menu[menuname]["fontface"]+';font-weight:'+menu[menuname]["fontWeight"]+';font-size:'+menu[menuname]["fontsize"]+';color:'+menu[menuname]["cellfgcolordim"]+';background-color:'+menu[menuname]["cellbgcolordim"]+'" onmouseOver="if(timerID'+menu[menuname]["menuitems"][i][2]+'){clearTimeout(timerID'+menu[menuname]["menuitems"][i][2]+');closeanychildren('+menu[menuname]["menuitems"][i][2]+')};hc(this,'+menuname+');openchild('+menuname+','+i+');" onmouseOut="if(timerID'+menu[menuname]["menuitems"][i][2]+'){clearTimeout(timerID'+menu[menuname]["menuitems"][i][2]+')};dc(this,'+menuname+');">'+thisitem[0]+'</td></a></div>');
}
if(thisarray.length > showonly){
document.writeln('<td id='+menuname+'dnarrow style="display:;cursor:hand;font-family:'+menu[menuname]["fontface"]+';font-weight:'+menu[menuname]["fontWeight"]+';font-size:'+menu[menuname]["fontsize"]+';color:'+menu[menuname]["cellfgcolordim"]+';background-color:'+menu[menuname]["cellbgcolordim"]+'" align='+menu[menuname]["cellalign"]+' onmouseOver="hc(this,'+menuname+');scrollDN'+menuname+'=setInterval('+"'scrollmenu(+1,"+menuname+")'"+',50);return true;" onmouseOut="dc(this,'+menuname+');if(scrollDN'+menuname+'){clearInterval(scrollDN'+menuname+')};">MORE</td>');
}


document.writeln('</tr>');
}


document.writeln('</table></div>');

}



// FUNCTION TO OPEN A MENUS CHILD IF ONE EXISTS CALLED ON CELL LEVEL
function openchild(menuname,theindex){
menunamestring = menuname.id;

//this dims the last cell
lastindex = menu[menunamestring]["currentindex"];

//hide the sibling that is open
if(menu[menunamestring]["menuitems"][lastindex][2]!=""){
thechild = menu[menunamestring]["menuitems"][lastindex][2];
eval(thechild+".style.visibility = 'hidden';");
eval(thechild+".style.zIndex="+zlevelback);
//eval(thechild+".style.display = 'none';");
}


eval(menunamestring+'_item'+lastindex+".style.backgroundColor = '"+menu[menunamestring]["cellbgcolordim"]+"';"); //this new

// this hilites the current cell
eval(menunamestring+'_item'+theindex+".style.backgroundColor = '"+menu[menunamestring]["cellbgcolorlit"]+"';"); //this new

// open show the current link menu
if(menu[menunamestring]["menuitems"][theindex][2]!=""){
thechild = menu[menunamestring]["menuitems"][theindex][2];
eval(thechild+".style.visibility = '';");
eval(thechild+".style.zIndex="+zlevelfront);
//eval(thechild+".style.display = '';");

//NEW TEST TO DIM CELL ON CHILD WHEN OPENING
eval(thechild+'_item'+menu[thechild]["currentindex"]+".style.backgroundColor = '"+menu[thechild]["cellbgcolordim"]+"';"); //this new



}
//store current index position on the calling menu
menu[menunamestring]["currentindex"]=theindex;

}

//FUNCTION TO SET AND UNSET THE CELLS IN PARENT MENU
function hiliteparentindex(menuname,status){
menunamestring=menuname.id;

if(menu[menunamestring]["parent"]!=""){
parentmenunamestring = menu[menunamestring]["parent"];

bgsc = menu[parentmenunamestring]["cellbgcolordim"];
bghc = menu[parentmenunamestring]["cellbgcolorlit"];


if(status){
thecolor = bghc;
}
else
{
thecolor = bgsc;
}

theindex = menu[parentmenunamestring]["currentindex"];
eval(parentmenunamestring+"_item"+theindex+".style.backgroundColor = '"+thecolor+"'");
}
}



// THIS FUNCTION IS FOR SCROLL CONTROL
function scrollmenu(scrolldir,menuname){
var menuname = menuname.id;
var thisarray = menu[menuname]["menuitems"];

if((scrolldir==-1)&&(menu[menuname]["scrollindex"]>0)){
menu[menuname]["scrollindex"] += scrolldir;
}
if((scrolldir==1)&&(menu[menuname]["scrollindex"]<thisarray.length-showonly)){
menu[menuname]["scrollindex"] += scrolldir;
}
var themax = menu[menuname]["scrollindex"] + showonly;



if(menu[menuname]["scrollindex"] > 0){
eval(menuname+"uparrow.style.display='';");
}
else
{
eval(menuname+"uparrow.style.display='none';");
eval(menuname+"_item0.style.backgroundColor='"+menu[menuname]['cellbgcolorlit']+"';");
}

for(k=0;k<thisarray.length;k++){
if((k<menu[menuname]["scrollindex"])||(k>themax)){
eval(menuname+((menu[menuname]["format"]==0)? "":"_item")+k+".style.display='none';");
}
else
{
eval(menuname+((menu[menuname]["format"]==0)? "":"_item")+k+".style.display='';");
}
}
}

//END OF FUNCTIONS



var itemtypearray = new Array();
itemtypearray[0] = new Array("JUNGLE GYMS","","");
itemtypearray[1] = new Array("SWINGS","","");
itemtypearray[2] = new Array("SLIDES","","");
itemtypearray[3] = new Array("BALANCE APPARATUS","","");
itemtypearray[4] = new Array("CRAWLING APPARATUS","","");
itemtypearray[5] = new Array("SEE-SAWS","","");
itemtypearray[6] = new Array("CLIMBING FRAMES","","");
itemtypearray[7] = new Array("MONKEY ARCHES","","");
itemtypearray[8] = new Array("ROUNDABOUTS","","");

var activityarray = new Array();
activityarray[0] = new Array("CLIMBING","","");
activityarray[1] = new Array("SWINGING","","");
activityarray[2] = new Array("SLIDING","","");
activityarray[3] = new Array("BALANCING","","");
activityarray[4] = new Array("CRAWLING","","");
activityarray[5] = new Array("ROCKING","","");
activityarray[6] = new Array("HANGING","","");
activityarray[7] = new Array("SPINNING","","");


var infoarray = new Array();
infoarray[0] = new Array("ABOUT US","http://www.safeplay.co.za/playground_equipment_info.php"+thequerystring+'"',"");
infoarray[1] = new Array("NEWS","http://www.safeplay.co.za/playground_equipment_news.php"+thequerystring+'"',"");
infoarray[2] = new Array("FAQS","http://www.safeplay.co.za/playground_equipment_faqs.php"+thequerystring+'"',"");










var menu = new Array();


menu["lightdutymenu"] = new Array();
menu["lightdutymenu"]["id"] = "lightdutymenu";
menu["lightdutymenu"]["parent"] = "productmenu";
menu["lightdutymenu"]["x"] = (screen.width>800)? 380:303;
menu["lightdutymenu"]["y"] = (screen.width>800)? 170:165;
menu["lightdutymenu"]["autohide"] = 1; 
menu["lightdutymenu"]["format"] = 0; 
menu["lightdutymenu"]["menuitems"] = extractdata(pda,3,"LD");


menu["timberattachmentsmenu"] = new Array();
menu["timberattachmentsmenu"]["id"] = "timberattachmentsmenu";
menu["timberattachmentsmenu"]["parent"] = "productmenu";
menu["timberattachmentsmenu"]["x"] = (screen.width>800)? 380:303;
menu["timberattachmentsmenu"]["y"] = (screen.width>800)? 190:183;
menu["timberattachmentsmenu"]["autohide"] = 1; 
menu["timberattachmentsmenu"]["menuitems"] = extractdata(pda,3,"TC");


menu["activitymenu"] = new Array();
menu["activitymenu"]["id"] = "activitymenu";
menu["activitymenu"]["parent"] = "productmenu";
menu["activitymenu"]["x"] = (screen.width>800)? 380:303;
menu["activitymenu"]["y"] = (screen.width>800)? 210:201;
menu["activitymenu"]["autohide"] = 1; 
menu["activitymenu"]["menuitems"] = activityarray;


menu["itemtypemenu"] = new Array();
menu["itemtypemenu"]["id"] = "itemtypemenu";
menu["itemtypemenu"]["parent"] = "productmenu";
menu["itemtypemenu"]["x"] = (screen.width>800)? 380:303;
menu["itemtypemenu"]["y"] = (screen.width>800)? 230:219;
menu["itemtypemenu"]["autohide"] = 1; 
menu["itemtypemenu"]["menuitems"] = itemtypearray;



menu["itemcodesmenu"] = new Array();
menu["itemcodesmenu"]["id"] = "itemcodesmenu";
menu["itemcodesmenu"]["parent"] = "productmenu";
menu["itemcodesmenu"]["x"] = (screen.width>800)? 380:303;
menu["itemcodesmenu"]["y"] = (screen.width>800)? 250:237;
menu["itemcodesmenu"]["autohide"] = 1; 
arraytoswap = pda;
//swappedarray = swapall(arraytoswap,0,1);
menu["itemcodesmenu"]["menuitems"] = extractdata(swapall(arraytoswap,0,1),"","");
swapall(arraytoswap,0,1); // must redo swap for later use
//this is fix
for(k=0;k<menu["itemcodesmenu"]["menuitems"].length;k++){
menu["itemcodesmenu"]["menuitems"][k][1] = 'playground_equipment_'+menu["itemcodesmenu"]["menuitems"][k][0]+'.php'+thequerystring;
}





menu["mainmenu"] = new Array();
menu["mainmenu"]["id"] = "mainmenu";
menu["mainmenu"]["parent"] = "";
menu["mainmenu"]["x"] = 0;
menu["mainmenu"]["y"] = 126;
menu["mainmenu"]["autohide"] = 0; 

menu["mainmenu"]["format"] = 1;
menu["mainmenu"]["fontsize"] = (screen.width>800)? "12pt":"9pt";
menu["mainmenu"]["fontface"] = "arial";
menu["mainmenu"]["fontweight"] = "bold";
//menu["mainmenu"]["cellfgcolordim"] = "yellow";
//menu["mainmenu"]["cellfgcolorlit"] = "yellow";
menu["mainmenu"]["cellalign"] = "center";
menu["mainmenu"]["width"] = (screen.width>800)? "1000px":"770px"

menu["mainmenu"]["menuitems"] = new Array();
menu["mainmenu"]["menuitems"][0] = new Array("HOME","http://www.safeplay.co.za/index.php"+thequerystring+'"',"");
menu["mainmenu"]["menuitems"][1] = new Array("PRODUCTS","http://www.safeplay.co.za/playground_equipment_all_products.php"+thequerystring+'"',"productmenu");
menu["mainmenu"]["menuitems"][2] = new Array("INFO","http://www.safeplay.co.za/playground_equipment_info.php"+thequerystring+'"',"infomenu");
menu["mainmenu"]["menuitems"][3] = new Array("ORDER","","ordermenu");
menu["mainmenu"]["menuitems"][4] = new Array("EMAIL","http://www.safeplay.co.za/contactform.php"+thequerystring+'"',"");



menu["ordermenu"] = new Array();
menu["ordermenu"]["id"] = "ordermenu";
menu["ordermenu"]["parent"] = "mainmenu";
menu["ordermenu"]["x"] = (screen.width>800)? 635:490;
menu["ordermenu"]["y"] = (screen.width>800)? 150:147;
menu["ordermenu"]["autohide"] = 1; 

menu["ordermenu"]["menuitems"] = new Array();
menu["ordermenu"]["menuitems"][0] = new Array("Our order form will<br>be operational soon<br>Please use the<br>email form to<br>contact us.","","");






menu["productmenu"] = new Array();
menu["productmenu"]["id"] = "productmenu";
menu["productmenu"]["parent"] = "mainmenu";
menu["productmenu"]["x"] = (screen.width>800)? 218:159;
menu["productmenu"]["y"] = (screen.width>800)? 150:147;
menu["productmenu"]["autohide"] = 1; 

menu["productmenu"]["menuitems"] = new Array();
menu["productmenu"]["menuitems"][0] = new Array("OVERVIEW","http://www.safeplay.co.za/playground_equipment_all_products.php"+thequerystring+'"',"");
menu["productmenu"]["menuitems"][1] = new Array("LIGHT DUTY RANGE","http://www.safeplay.co.za/playground_equipment_light_duty.php"+thequerystring+'"',"lightdutymenu");
menu["productmenu"]["menuitems"][2] = new Array("WOOD PLAYSET ADDONS","http://www.safeplay.co.za/playground_equipment_timber_attachments.php"+thequerystring+'"',"timberattachmentsmenu");
//menu["productmenu"]["menuitems"][3] = new Array("BY ACTIVITY","http://www.safeplay.co.za/playground_equipment_by_activity.php"+thequerystring+'"',"activitymenu");
//menu["productmenu"]["menuitems"][4] = new Array("BY ITEM TYPE","http://www.safeplay.co.za/playground_equipment_item_type.php"+thequerystring+'"',"itemtypemenu");
menu["productmenu"]["menuitems"][3] = new Array("BY ACTIVITY","","activitymenu");
menu["productmenu"]["menuitems"][4] = new Array("BY ITEM TYPE","","itemtypemenu");
menu["productmenu"]["menuitems"][5] = new Array("BY ITEM CODE","","itemcodesmenu");

menu["infomenu"] = new Array();
menu["infomenu"]["id"] = "infomenu";
menu["infomenu"]["parent"] = "mainmenu";
menu["infomenu"]["x"] = (screen.width>800)? 460:355;
menu["infomenu"]["y"] = (screen.width>800)? 150:147;
menu["infomenu"]["autohide"] = 1; 
menu["infomenu"]["menuitems"] = infoarray;
menu["infomenu"]["format"] = 0; 


// INITIALISE TIMERS

var timerID = null
var timerIDmainmenu = null;
var timerIDlightdutymenu = null;
var timerIDtimberattachmentsmenu = null;
var timerIDproductmenu = null;
var timerIDactivitymenu = null;
var timerIDitemtypemenu = null;
var timerIDinfomenu = null;
var timerIDitemcodesmenu = null;
var timerIDordermenu = null;

// THIS IS THE MENU BUILDING

var yoffset = (screen.width > 800)? 20:18;

automakemenu("mainmenu");

automakemenu("productmenu");
automakemenu("infomenu");

automakemenu("lightdutymenu");
automakemenu("timberattachmentsmenu");
automakemenu("activitymenu");

automakemenu("itemtypemenu");

automakemenu("itemcodesmenu");

automakemenu("ordermenu");



for(v=0;v<menu["itemtypemenu"]["menuitems"].length;v++){
//for(c=0;c<menu["itemtypemenu"]["menuitems"].length;c++){
//v = menu["itemtypemenu"]["menuitems"].length - c - 1;
//alert(v);
themenuname = menu["itemtypemenu"]["id"]+"sub"+v;
//alert(themenuname);
menu[themenuname] = new Array();
menu[themenuname]["id"] = themenuname;
menu[themenuname]["parent"] = "itemtypemenu";
//alert(menu[themenuname]["parent"]);
menu[themenuname]["x"] = (screen.width>800)? 530:438;
menu[themenuname]["y"] = (screen.width>800)? (230+(yoffset*v)):(219+(yoffset*v));
menu[themenuname]["autohide"] = 1; 
menu[themenuname]["menuitems"] = extractdata(pda,4,(v+1));
//alert(menu[themenuname]["menuitems"]);
menu["itemtypemenu"]["menuitems"][v][2] = themenuname;
eval("var timerID"+themenuname+" = null;");
automakemenu(themenuname);
}



for(v=0;v<menu["activitymenu"]["menuitems"].length;v++){
//for(c=0;c<menu["activitymenu"]["menuitems"].length;c++){
//v = menu["activitymenu"]["menuitems"].length - c - 1;
//alert(v);
themenuname = menu["activitymenu"]["id"]+"sub"+v;
//alert(themenuname);
menu[themenuname] = new Array();
menu[themenuname]["id"] = themenuname;
menu[themenuname]["parent"] = "activitymenu";
//alert(menu[themenuname]["parent"]);
menu[themenuname]["x"] = (screen.width>800)? 458:375;
//menu[themenuname]["y"] = (screen.width>800)? ((210+(yoffset*menu["activitymenu"]["menuitems"].length))-210+(yoffset*v)):(96+(yoffset*v));
menu[themenuname]["y"] = (screen.width>800)? (210+(yoffset*v)):(201+(yoffset*v));
menu[themenuname]["autohide"] = 1; 
menu[themenuname]["menuitems"] = extractdata(pda,5,(v+1));
//alert(menu[themenuname]["menuitems"]);
menu["activitymenu"]["menuitems"][v][2] = themenuname;
eval("var timerID"+themenuname+" = null;");
automakemenu(themenuname);
}







