/***********************************************************************************************************************
DOCUMENT: includes/javascript.js
DEVELOPED BY: Ryan Stemkoski
COMPANY: Zipline Interactive
EMAIL: ryan@gozipline.com
PHONE: 509-321-2849
DATE: 3/26/2009
UPDATED: 3/25/2010
DESCRIPTION: This is the JavaScript required to create the accordion style menu.  Requires jQuery library
NOTE: Because of a bug in jQuery with IE8 we had to add an IE stylesheet hack to get the system to work in all browsers. I hate hacks but had no choice :(.
************************************************************************************************************************/
$(document).ready(function() {
	$('.accordionContent').hide();
	var file = location.href.substr(location.href.lastIndexOf('/')+1,location.href.lastIndexOf('.')-location.href.lastIndexOf('/')-1);
	$('.accordionContent li a').each(function() {
		if(file==$(this).attr('id')){
			$(this).addClass('current');
			$(this).parent().parent().parent().addClass('current');
			}
	});
	$('.accordionButton a').each(function() {
		if(file==$(this).attr('id')){
			$(this).parent().addClass('current');
			}
		});
	$('.accordionContent.current').show();
	$('.accordionButton.current').next().show();
	//ACCORDION BUTTON ACTION (ON CLICK DO THE FOLLOWING)
	$('.accordionButton').click(function() {
		/*my stuff*/
		$('.accordionContent').hide();
		$('.accordionContent.current').show();
		$(this).next().show();
/*
	//REMOVE THE ON CLASS FROM ALL BUTTONS
		$('.accordionButton').removeClass('on');
		  
		//NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
	 	$('.accordionContent').slideUp('normal');
   
		//IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
		if($(this).next().is(':hidden') == true) {
			//ADD THE ON CLASS TO THE BUTTON
			$(this).addClass('on');
			//OPEN THE SLIDE
			$(this).next().slideDown('normal');
		 } */
	 });
	$('.accodionContent').mouseleave(function() {
		$(this).hide();
		});
	  
	/*** REMOVE IF MOUSEOVER IS NOT REQUIRcurED ***/
	/*
	//ADDS THE .OVER CLASS FROM THE STYLESHEET ON MOUSEOVER 
	$('.accordionButton').mouseenter(function() {
		$(this).addClass('over');
		
	//ON MOUSEOUT REMOVE THE OVER CLASS
	}).mouseout(function() {
		$(this).removeClass('over');										
	});
	*/
	
	/*** END REMOVE IF MOUSEOVER IS NOT REQUIRED ***/
	
	/********************************************************************************************************************
	CLOSES ALL S ON PAGE LOAD
	********************************************************************************************************************/	
});

