window.addEvent("domready", function(){

//**** anim menu starts here ***/
	var subOfficediv =  new Element('div',{html:'<br><div class="feature-icon">&nbsp;</div><div class="btn_first_title">Office Chairs</div><div class="btn_second_title">Desks and Workstations</div><div class="btn_third_title">Bookcases</div><div class="btn_fourth_title">Partition Screens</div><div class="btn_fifth_title">OFFICE FURNITURE</div>'});
	var subShelvingdiv =  new Element('div',{html:'<br><div class="feature-icon">&nbsp;</div><div class="btn_first_title">Metal Storage</div><div class="btn_second_title">Pallet Racking</div><div class="btn_third_title">Rivet Racking</div><div class="btn_fourth_title">Trolleys</div><div class="btn_fifth_title">SHELVING AND RACKING</div>'});
	var subShopdiv =  new Element('div',{html:'<br><div class="feature-icon">&nbsp;</div><div class="btn_first_title">Merchant Shelving</div><div class="btn_second_title">Plankwall Grooved Panels</div><div class="btn_third_title">Gondolas</div><div class="btn_fourth_title">Glass Showcases</div><div class="btn_fifth_title">SHOP FITTINGS</div>'});
	var subComputersdiv =  new Element('div',{html:'<br><div class="feature-icon">&nbsp;</div><div class="btn_first_title">Business Equipment</div><div class="btn_second_title">Computers</div><div class="btn_third_title">Laptops</div><div class="btn_fourth_title">Screens</div><div class="btn_fifth_title">COMPUTERS IT</div>'});	
	var subSationerydiv =  new Element('div',{html:'<br><div class="feature-icon">&nbsp;</div><div class="btn_first_title">Whiteboards & Pinboards</div><div class="btn_second_title">Shredders</div><div class="btn_third_title">Chair Mats</div><div class="btn_fourth_title">Record Storage</div><div class="btn_fifth_title">STATIONERY</div>'});	
	var thediv =  $("sub_index_btn_office");
	var theElementsDiv = subOfficediv;
	$$("#index_menu > div").each(function(item){
		if(item.get('id') == "index_btn_office")
		{
			thediv = $("sub_index_btn_office");
			theElementsDiv = subOfficediv;
		}
		else if(item.get('id') == "index_btn_shelving")
		{
			thediv = $("sub_index_btn_shelving");
			theElementsDiv = subShelvingdiv;
		}
		else if(item.get('id') == "index_btn_shop")
		{
			thediv = $("sub_index_btn_shop");
			theElementsDiv = subShopdiv;
		}
		else if(item.get('id') == "index_btn_computers")
		{
			thediv = $("sub_index_btn_computers");
			theElementsDiv = subComputersdiv;
		}
		else if(item.get('id') == "index_btn_stationery")
		{
			thediv = $("sub_index_btn_stationery");
			theElementsDiv = subSationerydiv;
		}
		thediv.set('opacity', 0);		
		var fxClones = theElementsDiv.getElements("div").reverse();
		fxClones.each(function(c) {
			c.set('tween', { duration: 500, transition: Fx.Transitions.Expo.easeInOut });
			c.inject(item, "bottom");
			c.store('top', c.getStyle('top').toInt());		
			c.setStyles({
				'top': c.getStyle('top').toInt() - 421,
				'background-position' : "50% 100%"
			});
		});		
		item.store('fxClones', fxClones);
		item.set('tween', { duration: 1000, transition: Fx.Transitions.Expo.easeInOut });
		thediv.set('tween', { duration: 1000, transition: Fx.Transitions.Expo.easeInOut });
		item.store('thediv', thediv);	
		item.addEvent('mouseenter', function(){
		var currentdiv = this.retrieve('thediv');
		currentdiv.tween('opacity', 0,1);
		clearInterval(this.retrieve('delayInterval'));
		var delayInterval = (function(){
			item.retrieve('fxClones').reverse().each(function(child, index){
					(function(){ child.tween('top', child.retrieve('top')); }).delay(index * 50);
				});
			}).delay(300);
		this.store('delayInterval', delayInterval);								
		}).addEvent('mouseleave', function(){
		item.retrieve('fxClones').reverse().each(function(child, index){
				(function(){ child.tween('top', child.retrieve('top') -421); }).delay(index * 100);
			});		
			clearInterval(this.retrieve('delayInterval'));	
			var currentdiv = this.retrieve('thediv');			
			var delayInterval = (function(){ currentdiv.tween('opacity', 1,0); }).delay(300);
			this.store('delayInterval', delayInterval);
		});
	});	
//**** end anim menu ***/
$("index_btn_office").addEvent("click", function(){
		document.location.href = "http://www.mclernons.com.au/cgi-bin/office-furniture.cgi?onlineStore_main_category=office_furniture";
	});
$("index_btn_shelving").addEvent("click", function(){
		document.location.href = "http://www.mclernons.com.au/cgi-bin/office-furniture.cgi?onlineStore_main_category=shelving_storage";
	});
$("index_btn_shop").addEvent("click", function(){
		document.location.href = "http://www.mclernons.com.au/cgi-bin/office-furniture.cgi?onlineStore_main_category=shop_fittings";
	});
$("index_btn_computers").addEvent("click", function(){
		document.location.href = "http://www.mclernons.com.au/cgi-bin/office-furniture.cgi?onlineStore_main_category=computers_IT";
	});
$("index_btn_stationery").addEvent("click", function(){
		document.location.href = "http://www.mclernons.com.au/cgi-bin/office-furniture.cgi?onlineStore_main_category=stationery";
	});	
//toggle code for paragraph
var myVerticalSlide = new Fx.Slide('office_furniture_content');
 myVerticalSlide.hide();
$('more_info').addEvent('click', function(event){
    event.stop();
    myVerticalSlide.toggle();
  });
//toggle code for second paragraph
var myVerticalSlide2 = new Fx.Slide('office_furniture_content2');
 myVerticalSlide2.hide();
$('more_info2').addEvent('click', function(event){
    event.stop();
    myVerticalSlide2.toggle();
  });

//********* end toggle code for paragraph **********/		
});
