<!--//---------------------------------+
//  Developed by Roshan Bhattarai 
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use
//
// The code below has been altered from the original.
// visit Rohan's website to see the original code.
// --------------------------------->

$(document).ready(function()
{
	////set variables for counters
	var $tab1=0;
	var $tab2=0;
	var $tab3=0;


//////////////////////////TAB 1//////////////////////////////////////////
//slides the element with class "menu_body" when paragraph with class "menu_head1" is clicked 
	$("#firstpane div.menu_head1").click(function()
    {
		$tab1=$tab1 + 1; //when tab is click increase it's counter by 1
		$tab2=0; //reset all the other tabs counters
		$tab3=0;
		
		//change this image to open, and animate body open
		$(this).css({backgroundImage:"url(images/arrow-s.jpg)"}).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
		
		//change all other siblings back to closed image
       	$(this).siblings("div.menu_tab").css({backgroundImage:"url(images/arrow.jpg)"});


		if($tab1==2){ //if the same tab is clicked twice - when the counter hits '2'
		$(this).css({backgroundImage:"url(images/arrow.jpg)"}); //switch back to original image
		$tab1=0; //reset counter for this tab
		}; //end if

	}); //end menu_head1 click funtion
	
	
//////////////////////////TAB 2//////////////////////////////////////////
//slides the element with class "menu_body" when paragraph with class "menu_head2" is clicked 
	$("#firstpane div.menu_head2").click(function()
    {
		$tab2=$tab2 + 1; //when tab is click increase it's counter by 1
		$tab1=0; //reset all the other tabs counters
		$tab3=0;
		
		//change this image to open, and animate body open
		$(this).css({backgroundImage:"url(images/arrow-s.jpg)"}).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
		
		//change all other siblings back to closed image
       	$(this).siblings("div.menu_tab").css({backgroundImage:"url(images/arrow.jpg)"});


		if($tab2==2){ //if the same tab is clicked twice - when the counter hits '2'
		$(this).css({backgroundImage:"url(images/arrow.jpg)"}); //switch back to original image
		$tab2=0; //reset counter for this tab
		}; //end if

	}); //end menu_head2 click funtion	
	

//////////////////////////TAB 3//////////////////////////////////////////
//slides the element with class "menu_body" when paragraph with class "menu_head3" is clicked 
	$("#firstpane div.menu_head3").click(function()
    {
		$tab3=$tab3 + 1; //when tab is click increase it's counter by 1
		$tab1=0; //reset all the other tabs counters
		$tab2=0;
		
		//change this image to open, and animate body open
		$(this).css({backgroundImage:"url(images/arrow-s.jpg)"}).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
		
		//change all other siblings back to closed image
       	$(this).siblings("div.menu_tab").css({backgroundImage:"url(images/arrow.jpg)"});


		if($tab3==2){ //if the same tab is clicked twice - when the counter hits '2'
		$(this).css({backgroundImage:"url(images/arrow.jpg)"}); //switch back to original image
		$tab3=0; //reset counter for this tab
		}; //end if

	}); //end menu_head3 click funtion




	
}); //end document.ready
