window.addEvent('domready', function() {
	
	//-vertical

	var contact_panel = new Fx.Slide('contact_panel', {duration: 150}).hide();
	var	subnav_work = new Fx.Slide('subnav_work', {duration: 150}).hide();
	var	subnav_capabilities = new Fx.Slide('subnav_capabilities', {duration: 150}).hide();
	var	subnav_us = new Fx.Slide('subnav_us', {duration: 150}).hide();
	
	// Function to hide all elements after inactivity
	
	// Contact Panel

	$('v_toggle_contact').addEvent('click', function(e){
		e.stop();
		contact_panel.toggle();
	});
	
	$('v_toggle_contact').addEvent('mouseenter', function(e){
		e.stop();
		subnav_us.slideOut();
		subnav_work.slideOut();
		subnav_capabilities.slideOut();
	});
	
	$('contact_panel').addEvent('mouseenter', function(e){
		e.stop();
		subnav_us.slideOut();
		subnav_work.slideOut();
		subnav_capabilities.slideOut();
	});
	
	$('nav_top_divider').addEvent('mouseenter', function(e){
		e.stop();
		subnav_us.slideOut();
		subnav_work.slideOut();
		subnav_capabilities.slideOut();
	});

	// Work Subnav
	
	$('v_slideout_work').addEvent('mouseenter', function(e){
		e.stop();
		subnav_work.slideIn();
		subnav_capabilities.hide();
		subnav_us.hide();
	});
	
	$('subnav_work').addEvent('mouseleave', function(e){
		e.stop();
		subnav_work.slideOut();
	});
	
	// Capabilities Subnav
	
	$('v_slideout_capabilities').addEvent('mouseenter', function(e){
		e.stop();
		subnav_capabilities.slideIn();
		subnav_work.hide();
		subnav_us.hide();
	});
	
	$('subnav_capabilities').addEvent('mouseleave', function(e){
		e.stop();
		subnav_capabilities.slideOut();
	});
	
	// Us Subnav
	
	$('v_slideout_us').addEvent('mouseenter', function(e){
		e.stop();
		subnav_us.slideIn();
		subnav_work.hide();
		subnav_capabilities.hide();
	});
	
	$('subnav_us').addEvent('mouseleave', function(e){
		e.stop();
		subnav_us.slideOut();
	});
	
	// For other nav elements to hide the sbnavs
	
	$('v_slideout_home').addEvent('mouseenter', function(e){
		e.stop();
		subnav_us.slideOut();
		subnav_work.slideOut();
		subnav_capabilities.slideOut();
	});
	
	$('v_slideout_contact').addEvent('mouseenter', function(e){
		e.stop();
		subnav_us.slideOut();
		subnav_work.slideOut();
		subnav_capabilities.slideOut();
	});
	
	$('v_slideout_blog').addEvent('mouseenter', function(e){
		e.stop();
		subnav_us.slideOut();
		subnav_work.slideOut();
		subnav_capabilities.slideOut();
	});
	
	$('content_wrap').addEvent('mouseenter', function(e){
		e.stop();
		subnav_us.slideOut();
		subnav_work.slideOut();
		subnav_capabilities.slideOut();
	});
	
	
	$('work_other_projects').addEvent('mouseleave', function(e){
		e.stop();
		work_other_projects.slideOut();
	});
	
	// When Vertical Slide ends its transition, we check for its status
	// note that complete will not affect 'hide' and 'show' methods
	/*
	contact_panel.addEvent('complete', function() {
		$('vertical_status').set('html', status[contact_panel.open]);
		
	});
	
	subnav_work.addEvent('complete', function() {
		$('vertical_status').set('html', status[subnav_work.open]);
		
	});
	
	subnav_capabilities.addEvent('complete', function() {
		$('vertical_status').set('html', status[subnav_capabilities.open]);
		
	});
	
	subnav_us.addEvent('complete', function() {
		$('vertical_status').set('html', status[subnav_us.open]);
		
	});
	*/
});