<!--//---------------------------------+
//  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;
	var $tab4=0;
	var $tab5=0;
	var $tab6=0;
	var $tab7=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;
		$tab4=0;
		$tab5=0;
		$tab6=0;
		$tab7=0;
		
		//change this image to open, and animate body open
		$(this).css({backgroundImage:"url(images/accordian-sel.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_head").css({backgroundImage:"url(images/accordian.jpg)"});


		if($tab1==2){ //if the same tab is clicked twice - when the counter hits '2'
		$(this).css({backgroundImage:"url(images/accordian.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;
		$tab4=0;
		$tab5=0;
		$tab6=0;
		$tab7=0;		
		
		//change this image to open, and animate body open
		$(this).css({backgroundImage:"url(images/accordian-sel.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_head").css({backgroundImage:"url(images/accordian.jpg)"});


		if($tab2==2){ //if the same tab is clicked twice - when the counter hits '2'
		$(this).css({backgroundImage:"url(images/accordian.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;
		$tab4=0;
		$tab5=0;
		$tab6=0;
		$tab7=0;		
		
		//change this image to open, and animate body open
		$(this).css({backgroundImage:"url(images/accordian-sel.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_head").css({backgroundImage:"url(images/accordian.jpg)"});


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

	}); //end menu_head3 click funtion



//////////////////////////TAB 4//////////////////////////////////////////
//slides the element with class "menu_body" when paragraph with class "menu_head2" is clicked 
	$("#firstpane div.menu_head4").click(function()
    {
		$tab4=$tab4 + 1; //when tab is click increase it's counter by 1
		$tab1=0; //reset all the other tabs counters
		$tab2=0;
		$tab3=0;
		$tab5=0;
		$tab6=0;
		$tab7=0;		
		
		//change this image to open, and animate body open
		$(this).css({backgroundImage:"url(images/accordian-sel.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_head").css({backgroundImage:"url(images/accordian.jpg)"});


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

	}); //end menu_head4 click funtion

//////////////////////////TAB 5//////////////////////////////////////////
//slides the element with class "menu_body" when paragraph with class "menu_head2" is clicked 
	$("#firstpane div.menu_head5").click(function()
    {
		$tab5=$tab5 + 1; //when tab is click increase it's counter by 1
		$tab1=0; //reset all the other tabs counters
		$tab2=0;
		$tab3=0;
		$tab4=0;
		$tab6=0;
		$tab7=0;
		
		//change this image to open, and animate body open
		$(this).css({backgroundImage:"url(images/accordian-sel.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_head").css({backgroundImage:"url(images/accordian.jpg)"});


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

	}); //end menu_head5 click funtion
	
//////////////////////////TAB 6//////////////////////////////////////////
//slides the element with class "menu_body" when paragraph with class "menu_head2" is clicked 
	$("#firstpane div.menu_head6").click(function()
    {
		$tab6=$tab6 + 1; //when tab is click increase it's counter by 1
		$tab1=0; //reset all the other tabs counters
		$tab2=0;
		$tab3=0;
		$tab4=0;
		$tab5=0;
		$tab7=0;
		
		//change this image to open, and animate body open
		$(this).css({backgroundImage:"url(images/accordian-sel.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_head").css({backgroundImage:"url(images/accordian.jpg)"});


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

	}); //end menu_head6 click funtion	
	
//////////////////////////TAB 7//////////////////////////////////////////
//slides the element with class "menu_body" when paragraph with class "menu_head2" is clicked 
	$("#firstpane div.menu_head7").click(function()
    {
		$tab7=$tab7 + 1; //when tab is click increase it's counter by 1
		$tab1=0; //reset all the other tabs counters
		$tab2=0;
		$tab3=0;
		$tab4=0;
		$tab5=0;
		$tab6=0;
		
		//change this image to open, and animate body open
		$(this).css({backgroundImage:"url(images/accordian-sel.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_head").css({backgroundImage:"url(images/accordian.jpg)"});


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

	}); //end menu_head5 click funtion	
	
}); //end document.ready
