var portfolioNavigation = {
		
		categoryOver: function(catId) {
			var szNormal = 30, szSmall  = 30, szFull   = 250;
			
			//not to be confused with the object ul
			
			
			
			var kwicks = $$(".kwicker .kwick");
			//getElements('dt.stretchtoggle');
			
			
			var fx = new Fx.Elements(kwicks, {wait: false, duration: 600, transition: Fx.Transitions.linear});
			
			kwicks.each(function(kwick, i) {
				kwick.addEvent("mouseenter", function(event) {
					
					
					tmr = function() {
						strongEl = kwick.getElement('strong');
						strongEl.setStyle('display', 'inline');	
					};		  
					
					tSet=setTimeout("tmr()",1500);
					
					var o = {};
					o[i] = {height: [kwick.getStyle("height").toInt(), szFull]}
					kwicks.each(function(other, j) {
						var h = other.getStyle("height").toInt();
						if (other.parentNode.id != kwick.parentNode.id) {
							if(w != szNormal) o[j] = {height: [h, szNormal]};
							
						}
						else if (other.parentNode.id == kwick.parentNode.id) {
							if(i != j) {
								var w = other.getStyle("height").toInt();
								if(w != szSmall) o[j] = {height: [h, szSmall]};
							};
						};
					
					});
					
					kwick.addEvent("mouseleave", function(event) {
						clearTimeout(tSet);
						strongEl = kwick.getElement('strong');
						strongEl.setStyle('display', 'none');
					});
					
					kwick.addEvent("click", function(event) {
						clearTimeout(tSet);
						strongEl = kwick.getElement('strong');
						strongEl.setStyle('display', 'none');
					});
					
					//kwick.fireEvent('mouseenter', console.log('event'), 5000);

					
					fx.start(o);
				});
			});
			
			var categoryUls = $$(".kwicks_containers ul.kwicker");
			
			categoryUls.each(function(ul, i) {
				ul.addEvent("mouseleave", function(event) {
					
					var o = {};
					kwicks.each(function(other, j) {
						
							//if(i != j) {
								var h = other.getStyle("height").toInt();
								if(h != szNormal) o[j] = {height: [h, szNormal]};
							//}	
						
					
					});
					fx.start(o);
				});			
			});
		},
		
		categoryNav: function(){
			this.sliders = $$('#portfolio ul ul').map(function(ul){
			/*	Here we make the Fx.Slide object and return it.*/
			var firefox = document.getElementById && !document.all;
			//if (firefox == true) {
				return new Fx.Slide(ul, {
					mode: 'vertical',
					wait: false
				}).hide();
			/*} else {
				return new Fx.Slide(ul, {
					mode: 'horizontal',
					duration: 800,
					wait: false
				}).hide();
			}*/
			});
			$$('#portfolio .slideOpener').each(function(lnk, index){
				
				lnk.addEvent('click', function(){
				
				/*	When the user clicks on of my menu items, we loop through all the sub-menus
						to hide any others that are open and to toggle the one they clicked
						
						here we refer to this.sliders - the array we created above. the "this"
						here is the "guide" object, but we're inside a function declared in the
						line above, so we have to use .bind() to pass the "this" along.
					*/
					this.sliders.each(function(slider, sliderIndex){
						
						/*	If the index of the slider we're on is the index of the menu item
								the user clicked, toggle the slider	*/
						if (sliderIndex == index) {
								this.sliders[sliderIndex].toggle();
						}
						/*	otherwise, let's hide the slider that they didn't click	*/
						else { this.sliders[sliderIndex].slideOut();}
					}, this); /*	Here's the bind "this" for .each	*/
				}.bind(this)); /*	and here's the explicit .bind(this) for .addEvent's function	*/
				
				
				
				lnk.addEvent('mouseleave', function(){
					
					this.sliders.each(function(slider, sliderIndex){
						
						if (sliderIndex == index) this.sliders[sliderIndex].slideOut();
					}, this);
					
				}.bind(this)); /*	and here's the explicit .bind(this) for .addEvent's function	*/
				
			}, this); /* and this is the last .each, so it has a "this" too	*/
			
			
			
			
		
		},
		
		init: function(){
			this.categoryOver();
			this.categoryNav();
		}
		
	};
	
window.onDomReady(portfolioNavigation.init.bind(portfolioNavigation));