	
if (!document.FIN)
{ 	
	var aShowHideItems;
	
	window.addEvent('domready', function()
	{		
			showHideCommonItems();
			if (this.aShowHideItems[0].btn) 				this.aShowHideItems[0].btn.fireEvent('click');
			initOverLabels();
			
			// set up google logo thing on search box
			var tbxSearch = $('frm_search');
			if(tbxSearch)
			{
				tbxSearch.addEvent('focus', function(){ this.addClass('active'); });
				tbxSearch.addEvent('blur', function(){ if(this.value == ''){ this.removeClass('active'); } });				
			}
			// and onto publications
			var tbxNewsSearch = $('frm_in_search');
			if(tbxNewsSearch)
			{
				tbxNewsSearch.addEvent('focus', function(){ this.addClass('active'); });
				tbxNewsSearch.addEvent('blur', function(){ if(this.value == ''){ this.removeClass('active'); } });				
			}
			
			// get the slimbox charts
			var arrSlimboxLinks = $$('img.slimboxchart');			
			arrSlimboxLinks.each(function(el){ el.getParent().setAttribute('rel', 'lightbox'); });
			
			// get the panel charts
			var arrSlimboxLinks = $$('#site.chart img.slimboxchart');			
			arrSlimboxLinks.each(function(el)
								{
									// setup new click event
									var strLink = el.getParent().getAttribute('href');
									el.getParent().addEvent('click', function()
																	  {
																		  var divHolder = $$('#chart_holder img');
																		  
																		  if(divHolder[0])
																		  {
																				var imgNew = divHolder[0];
																				imgNew.setProperty('src', strLink);
																				imgNew.removeClass('hidden');
																		  }
																	  });
									
									// clear other actions
									el.getParent().setAttribute('rel', '');									
									el.getParent().setAttribute('href', 'javascript:void(0);');
								});			
	});
		
	function showHideCommonItems()
	{	
		
		// find the btns and the content we want
		aShowHideItems										= [{btn: $('dyn_ln'),			container:	$('news-updates')},
															   {btn: $('dyn_pc'), 			container:	$('popular-content')}];		
		// cycle through our items
		for (var i = 0; i < aShowHideItems.length; i++)
		{
			// if both the btn and container exist 
			if (aShowHideItems[i].btn && aShowHideItems[i].container)
			{
				aShowHideItems[i].btn.set('inx', i);				
				aShowHideItems[i].btn.addEvent('click', function(event)
				{
					// hide everything else in the menu except the current btn
					hideAll(this.get('inx'));
					// define our content
					var objLanContainer							= aShowHideItems[this.get('inx')].container;	
					var objLanBtn								= aShowHideItems[this.get('inx')].btn;					
					
					// set the relevent classes 
					if (objLanBtn.hasClass('inactive'))			objLanBtn.removeClass('inactive').addClass('active');			
					//else 										objLanBtn.removeClass('active').addClass('inactive');
					if (objLanContainer.hasClass('inactive'))	objLanContainer.removeClass('inactive').addClass('active');			
					//else 										objLanContainer.removeClass('active').addClass('inactive');					
					
					return false;
				});		
			}
		}
	}
	
	function hideAll(param_execption)
	{
		// cycle through our common items
		for (var x = 0; x < aShowHideItems.length; x++)
		{
			// as long as it isn't the caller/execption & both the btn and container exist 
			if (x != param_execption && aShowHideItems[x].container && aShowHideItems[x].btn)
			{
				// hide it
				aShowHideItems[x].container.removeClass('active').addClass('inactive');
				aShowHideItems[x].btn.removeClass('active').addClass('inactive');		
			}
		}
	}
}
		