NavbarItems = Array(3);
NavbarItems[0] = Array(
 Array('38',1, Array(
   Array('42',1, null,'<B><SPAN style=\"FONT-SIZE: 8pt; color: blue; FONT-FAMILY: Arial\">news</B></SPAN></FONT>','/news/categoryfront.php/id/42/news.html','','',0),
   Array('136',1, null,'Product News','/news/categoryfront.php/id/136/Product_News.html','','',0),
   Array('127',1, null,'<B><SPAN style=\"FONT-SIZE: 8pt; color: blue; FONT-FAMILY: Arial\">Forthcoming Events</B></SPAN></FONT>','/news/categoryfront.php/id/127/Forthcoming_Events.html','','',0),
   Array('132',1, null,'<B><SPAN style=\"FONT-SIZE: 8pt; color: green; FONT-FAMILY: Arial\">Product Review 2011</B></SPAN></FONT>','/news/categoryfront.php/id/132/Product_Review_2011.html','','',0),
   Array('133',1, null,'<B><SPAN style=\"FONT-SIZE: 8pt; color: green; FONT-FAMILY: Arial\">Viewpoints 2011</B></SPAN></FONT>','/news/categoryfront.php/id/133/Viewpoints_2011.html','','',0),
   Array('84',1, null,'<B><SPAN style=\"FONT-SIZE: 8pt; color: red; FONT-FAMILY: Arial\">Garden Centres & Nurseries For Sale</B></SPAN></FONT>','/news/categoryfront.php/id/84/Garden_Centres___Nurseries_For_Sale.html','','',0),
   Array('81',1, null,'<B><SPAN style=\"FONT-SIZE: 8pt; color: red; FONT-FAMILY: Arial\">Company Profile</B></SPAN></FONT>','/news/categoryfront.php/id/81/Company_Profile.html','','',0),
   Array('45',1, null,'<B><SPAN style=\"FONT-SIZE: 8pt; color: red; FONT-FAMILY: Arial\">New Appointments</B></SPAN></FONT>','/news/categoryfront.php/id/45/New_Appointments.html','','',0),
   Array('80',1, null,'<B><SPAN style=\"FONT-SIZE: 8pt; color: red; FONT-FAMILY: Arial\">GIMA Voice</B></SPAN></FONT>','/news/categoryfront.php/id/80/GIMA_Voice.html','','',0),
   Array('43',1, Array(
     Array('79',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">Features</SPAN></FONT>','/news/categoryfront.php/id/79/Features.html','','',0),
     Array('60',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">Interviews</SPAN></FONT>','/news/categoryfront.php/id/60/Interviews.html','','',0),
     Array('47',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">Garden Care</SPAN></FONT>','/news/categoryfront.php/id/47/Garden_Care.html','','',0),
     Array('48',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">Landscaping</SPAN></FONT>','/news/categoryfront.php/id/48/Landscaping.html','','',0)),'<B><SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Arial\">Features/Interviews</B></SPAN></FONT>','/news/categoryfront.php/id/43/Features_Interviews.html','','',0)),'<B><SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Arial\">Contents</B></SPAN></FONT>','/news/categoryfront.php/id/38/Contents.html','','',0),
 Array('92',1, Array(
   Array('137',1, Array(
     Array('138',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">January</SPAN></FONT>','http://content.yudu.com/A1v9zu/GCUJan2012','','',0)),'<B><SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Arial\">2012</B></SPAN></FONT>','','','',0),
   Array('119',1, Array(
     Array('135',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">December</SPAN></FONT>','http://content.yudu.com/A1uxz8/GCUDec11','','',0),
     Array('131',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">November</SPAN></FONT>','http://content.yudu.com/A1uo4e/GCUNov2011','','',0),
     Array('130',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">October</SPAN></FONT>','http://content.yudu.com/A1u8f3/GCUOct2011','','',0),
     Array('129',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">Aug/Sep</SPAN></FONT>','http://content.yudu.com/A1tpzj/GCUAugSep2011','','',0),
     Array('128',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">July</SPAN></FONT>','http://content.yudu.com/A1t0qj/GCUJuly2011','','',0),
     Array('126',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">June</SPAN></FONT>','http://content.yudu.com/A1sfz2/GardenCentreJune11/','','',0),
     Array('125',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">May</SPAN></FONT>','http://content.yudu.com/A1s35y/GCUMay11','','',0),
     Array('123',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">April</SPAN></FONT>','http://content.yudu.com/A1rmk9/GardenCentreMar2011','','',0),
     Array('122',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">March</SPAN></FONT>','http://content.yudu.com/A1r94m/GCUMarch2011/','','',0),
     Array('121',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">February</SPAN></FONT>','http://content.yudu.com/A1qwjd/GCUFebruary2011','','',0),
     Array('120',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">January</SPAN></FONT>','http://content.yudu.com/A1qme7/GCUJanuary2011','','',0)),'<B><SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Arial\">2011</B></SPAN></FONT>','','','',0),
   Array('102',1, Array(
     Array('118',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">December</SPAN></FONT>','http://content.yudu.com/A1q8gf/GCUDec10','','',0),
     Array('117',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">November</SPAN></FONT>','http://content.yudu.com/A1py46/GCUNovember2010','','',0),
     Array('116',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">October</SPAN></FONT>','http://content.yudu.com/A1phc7/GardenCentreOct2010','','',0),
     Array('115',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">September</SPAN></FONT>','http://content.yudu.com/A1p17r/GCUSept10','','',0),
     Array('113',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">July</SPAN></FONT>','http://content.yudu.com/A1oe4o/GCUJuly2010','','',0),
     Array('111',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">June</SPAN></FONT>','http://content.yudu.com/A1nyem/GCUjune2010','','',0),
     Array('110',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">May</SPAN></FONT>','http://content.yudu.com/A1nl9i/GCUmay2010','','',0),
     Array('109',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">April</SPAN></FONT>','http://content.yudu.com/A1nd2n/GCUApril2010/','','',0),
     Array('108',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">March</SPAN></FONT>','http://content.yudu.com/A1n3il/GCUmar2010/resources/index.htm?referrerUrl=','','',0),
     Array('106',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">February</SPAN></FONT>','http://content.yudu.com/A1lt9p/gardencentrefeb10/resources/index.htm?referrerUrl=','','',0),
     Array('105',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">January</SPAN></FONT>','http://content.yudu.com/A1ke8q/GCUJan2010/resources/index.htm?referrerUrl=','','',0)),'<B><SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Arial\">2010</B></SPAN></FONT>','','','',0),
   Array('93',1, Array(
     Array('100',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">December</SPAN></FONT>','http://content.yudu.com/A1j8l1/GCUDec09/resources/index.htm?referrerUrl=','','',0),
     Array('98',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">November</SPAN></FONT>','http://content.yudu.com/A1i5zz/GCUNov09/resources/index.htm?referrerUrl=','','',0),
     Array('97',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">October</SPAN></FONT>','http://content.yudu.com/A1h5rx/GCUOct09/resources/index.htm?referrerUrl=','','',0),
     Array('94',1, null,'<SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana\">Aug/Sep</SPAN></FONT>','http://content.yudu.com/A1fn4k/GCUAugSept09/resources/index.htm?referrerUrl=','','',0)),'<B><SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Arial\">2009</B></SPAN></FONT>','','','',0)),'<B><SPAN style=\"FONT-SIZE: 8pt; FONT-FAMILY: Arial\">Digitised Issues</B></SPAN></FONT>','','','',0));
NavbarItems[1] = Array(
 Array('6',1, Array(
   Array('30',1, null,'Home','http://www.gardencentreupdate.com/','','',0),
   Array('53',1, null,'Registration','http://www.connectingindustry.com/datateamcirculation.html','','',0),
   Array('54',1, null,'Media Info','http://www.gardencentreupdate.com/files/gcumedia.pdf','','',0),
   Array('10',1, null,'Directory','/company_index/','','',0),
   Array('8',1, null,'Contact Us','/info/contact_us.php','','',0)),'','','','',0));
NavbarItems[2] = Array(
);
function getPageItem(itemid) {
    if (document.getElementById) {
    	return document.getElementById(itemid);
    } else if (document.all) {
        return document.all[itemid];
    } else if (document.layers) {
    	return eval('document.'+itemid);
    }
    return null;
}

function writePageItem(itemid,html) {
    var lyr = null;
    if (document.getElementById) {
    	lyr = document.getElementById(itemid);
	lyr.innerHTML = html;
    } else if (document.all) {
        lyr = document.all[itemid];
	lyr.innerHTML = html;
    } else if (document.layers) {
    	// FIXME: ns4 compat
    }
}

function renderNavbarItem(container, level, item) {
    var html = "" + NavbarTemplates[container][level][1];

    var ihtm = NavbarTemplates[container][level][4];
    if (item[3] == '') { 
       // is empty
       ihtm = NavbarTemplates[container][level][2]; 
    } else if (item[5] != '') {  
       // has image
       ihtm = NavbarTemplates[container][level][3]; 
    }
    if (item[2] && (NavbarTemplates[container][level].length > 5)) { 
        // has children
    	if (item[1]) {  
	    // is open
      	    ihtm = NavbarTemplates[container][level][5];
    	} else {  
	    // is closed
      	    ihtm = NavbarTemplates[container][level][6];
    	}
    }

    html = html.replace(/%%ITEM%%/g, ihtm);

    html = html.replace(/%%ID%%/g, item[0]);
    html = html.replace(/%%TEXT%%/g, item[3]);
    html = html.replace(/%%LINK%%/g, item[4]);
    html = html.replace(/%%IMG_URL%%/g, item[5]);
    if (item[7] && PadlockTemplate) {
      html = html.replace(/%%PADLOCK%%/g, PadlockTemplate);
    } else {
      html = html.replace(/%%PADLOCK%%/g, '');
    }
    if (item[2] && item[1]) {  
	html = html.replace(/%%SUB%%/g, renderNavbarLevel(container, level+1, item[2]));
    } else {
	html = html.replace(/%%SUB%%/g, '');
    }
    return html;
} 

function renderNavbarLevel(container, level, items) {
    var html = NavbarTemplates[container][level][0];
    var buf = '';
    for(var i=0;i< items.length; i++) {
    	buf += renderNavbarItem(container, level, items[i]);
    }
    html = html.replace(/%%ITEMS%%/g, buf);
    return html;
}

function renderLeftNavbar() {
    return renderNavbarLevel(0,0,NavbarItems[0]);
}

function renderTopNavbar() {
    return renderNavbarLevel(1,0,NavbarItems[1]);
}

function renderRightNavbar() {
    return renderNavbarLevel(2,0,NavbarItems[2]);
}

// behavior specific

function getCategoryId() {
    var loc = "";
    loc += document.location; 
    loc = loc.replace(/^.*\/categoryfront\.php\/id\//,'');
    loc = loc.replace(/[^0-9].*$/,'');
    return loc;
}

function initNavbar() {
    var id = getCategoryId();
    for(var c=0; c< NavbarItems.length; c++) {
      for(var i=0;i< NavbarItems[c].length; i++) {
    	var items = NavbarItems[c][i][2];
    	if (items) {
    	    for(var j=0;j< items.length; j++) {
	      NavbarItems[c][i][2][j][1] = 0;
	      var jtems = items[j][2];
	      if (jtems && id!="") {
	        if (items[j][0] == id) { NavbarItems[c][i][2][j][1] = 1; }
	        else for (var k=0; k< jtems.length; k++) {
		  if (jtems[k][0] == id) { NavbarItems[c][i][2][j][1] = 1; }
		}
	      }
	    }
	}
      }
    }
}

function toggleNavbarItem(id) {
    for(var c=0; c< NavbarItems.length; c++) {
      for(var i=0;i< NavbarItems[c].length; i++) {
    	var items = NavbarItems[c][i][2];
    	if (items) {
    	    for(var j=0;j< items.length; j++) {
    	      if (items[j][0]==id) {
	    	NavbarItems[c][i][2][j][1] = 1 - items[j][1];
		var navdiv = getPageItem('navbar_'+c);
		if (navdiv) {
		    writePageItem('navbar_'+c,renderNavbarLevel(c,0,NavbarItems[c]));
		}
	      }
	    }
	}
      }
    }
    return 0;
}

function displaySWF(url,ver,w,h) {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ver+'" width="'+w+'" height="'+h+'"><param name="movie" value="'+url+'"><param name="quality" value="high"><embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed></object>');
}

var toid;
function toggleDiv(id) { var d = getPageItem(id); if (d) { if (d.style.visibility == 'hidden') d.style.visibility = 'visible'; else d.style.visibility = 'hidden'; } }
function showDiv(id) { var d=getPageItem(id); if (d) { d.style.visibility='visible'; } }
function hideDiv(id) { var d=getPageItem(id); if (d) { d.style.visibility='hidden'; } }

// template specific
// Array( 'main', 'item_main', 'empty_item', 'imgonly_item', 'nosub_item', 'sub_open_item', 'sub_close_item')
NavbarTemplates = Array(
 Array( 
   Array('%%ITEMS%%', 
   '%%ITEM%%%%SUB%%',
   '',
   '<div class="header navbar visual"><a href="%%LINK%%"><img src="%%IMG_URL%%" alt="" border="0"/></a></div>',
   '<div class="header navbar">%%TEXT%%</div>'),

   Array('<ul class="navbar">%%ITEMS%%</ul>', 
   '<li class="navbar item%%PADLOCK%%">%%ITEM%%</li>%%SUB%%',
   '',
   '<a class="button" href="%%LINK%%"><img src="%%IMG_URL%%" alt="" border="0"/></a>',
   '<a class="button" href="%%LINK%%">%%TEXT%%</a>',
   '<a class="button" href="javascript:void(0);" onclick="toggleNavbarItem(\'%%ID%%\');return false;">%%TEXT%%<img src="http://www.gardencentreupdate.com/pixmaps/up.gif" hspace="0" vspace="1" border="0"/></a>',
   '<a class="button" href="javascript:void(0);" onclick="toggleNavbarItem(\'%%ID%%\');return false;">%%TEXT%%<img src="http://www.gardencentreupdate.com/pixmaps/down.gif" hspace="0" vspace="1" border="0"/></a>'),

   Array('%%ITEMS%%', 
   '<li class="navbar item sub%%PADLOCK%%">%%ITEM%%</li>',
   '',
   '<a class="button" href="%%LINK%%"><img src="%%IMG_URL%%" alt="" border="0"/></a>',   
   '<a class="button" href="%%LINK%%">%%TEXT%%</a>')
 ),
 Array(),
 Array( 
    Array('%%ITEMS%%', 
   '%%ITEM%%%%SUB%%',
   '',
   '<div class="header navbar visual"><a href="%%LINK%%"><img src="%%IMG_URL%%" alt="" border="0"/></a></div>',
   '<div class="header navbar">%%TEXT%%</div>'),

   Array('<ul class="navbar">%%ITEMS%%</ul>', 
   '<li class="navbar item%%PADLOCK%%">%%ITEM%%</li>%%SUB%%',
   '',
   '<a class="button" href="%%LINK%%"><img src="%%IMG_URL%%" alt="" border="0"/></a>',
   '<a class="button" href="%%LINK%%">%%TEXT%%</a>',
   '<a class="button" href="javascript:void(0);" onclick="toggleNavbarItem(\'%%ID%%\');return false;">%%TEXT%%<img src="http://www.gardencentreupdate.com/pixmaps/up.gif" hspace="0" vspace="1" border="0"/></a>',
   '<a class="button" href="javascript:void(0);" onclick="toggleNavbarItem(\'%%ID%%\');return false;">%%TEXT%%<img src="http://www.gardencentreupdate.com/pixmaps/down.gif" hspace="0" vspace="1" border="0"/></a>'),

   Array('%%ITEMS%%', 
   '<li class="navbar item sub%%PADLOCK%%">%%ITEM%%</li>',
   '',
   '<a class="button" href="%%LINK%%"><img src="%%IMG_URL%%" alt="" border="0"/></a>',   
   '<a class="button" href="%%LINK%%">%%TEXT%%</a>')
 )
);

PadlockTemplate=' padlock';

