jQuery(document).ready( function ($){
								  
	/** ******************************************************************************************** 
	*	Jquery Vertical Slide Navigation
	*	marinda.sephton@pod1.com
	*	July 23 2009 - @ London, UK
	**/
	var _hmax = 180; //@ default max height in pixel
    var _hmin = 0;  //@ min height in pixel
	var _active = null; // current active element
	
	//on page load animation
	initAnimation();
	
	// add arrow
	$('.pathlink').append('<span class="subnav_arrow_open">&gt;</span><span class="divider">/</span>');

	$('.show_hide').hover(showSubNav, hideSubNav);
	
	function showSubNav() {
		//calculate dynamic height
		var items = $(".subnav").children("li").length;
		_hmax = (items * 26) + 10;
		
		$(this).removeClass('up');
		$(this).addClass('down');
		$(this).find('.pathfont').css({'color':'#FFFFFF'});
		$(this).find('.divider').css({'display':'none'});
		$(this).find('.subnav_arrow_open').css({'display':'block'});
		$(this).find('.subnav').animate({height: _hmax+"px", opacity:1}, {queue:false, duration:900, easing:'easeInSine'});
		_active = $(this);
	}
	
	function hideSubNav() {
		$(this).removeClass('down');
		$(this).addClass('up');
		$(this).find('.pathfont').css({'color':'#000000'});
		$(this).find('.subnav_arrow_open').css({'display':'none'});
		$(this).find('.divider').css({'display':'block'});
		$(_active).find('.subnav').animate({height: _hmin+"px", opacity:0}, {queue:false, duration:900, easing:'easeInBack'});
	}
	
	function initAnimation() {
		$('.show_hide').each(function(){
			$(this).removeClass('down');
			$(this).addClass('up');
			$(this).find('.pathfont').css({'color':'#000000'});
			$(this).find('.subnav_arrow_open').css({'display':'none'});
			$(this).find('.divider').css({'display':'block'});
			$(_active).find('.subnav').animate({height: _hmin+"px", opacity:0}, {queue:false, duration:3000, easing:'easeInBack'});
		});
	}
	
	
	/** ********************************************************************************************
	*	Overlay - hides on hover
	*	marinda.sephton@pod1.com
	*	Aug 03 2009 - @ London, UK
	**/
	var contextOverlay = '.table_rollover'; //add context to speed up and target
	var test = IsThisBrowserIE6();
	
	if (!test) { //only run overlay if not IE6
		initOverlay(); 	//start
	}

	$('.overlay_rollover').hover(hideOverlay, showOverlay);
	
	function initOverlay() {
		//find each image thats inside an anchor tag
		$('a',contextOverlay).find('img').each(function(){							 
			$(this).parent().addClass('overlay_rollover');
			$(this).parent().prepend("<span class='overlay'></span>");
		});
	}
	
	function hideOverlay() {
		$(this).find('.overlay').css({'display':'none'});
	}
	
	function showOverlay() {
		$(this).find('.overlay').css({'display':'block'});
	}
	
	function IsThisBrowserIE6() {
    	return ((window.XMLHttpRequest == undefined) && (ActiveXObject != undefined))
	}
	
	
});