//  JavaScript Document
//  added by peter attfield on january 13 2010
//  this works in conjunction with the jquery library and the institution CSS for the foodsafety.gc.ca site.
//  Each function below operates a unique class in the stylesheet which is called below the introductory
//  paragraph of every respective h2 subheading on each of the main asp pages on the portal.
//  The content within the span tags is hidden
//  until the user clicks the "more..." link and then the content expands  
//  please note:  without the unique classes, the program will not function properly.  If your
//  page requires more than 10 subheadings, you will need to create more unique subTriggers in this script & in
//  the institution CSS

function toggle(subTrigger){
	$(document).ready(function(){
	    // hides the menu when the page loads	
			$("div." + subTrigger).hide();		
	    // toggles the menu up and down when the div tag is clicked
		$("p." + subTrigger).click(function () {
		//	Opens / closes the menu slowly	
			$("div." + subTrigger).slideToggle("slow");
	    });    
	  });    
}

// get the current page URL
var current_url = window.location.href;

// Call the toogle function, if you need more than 6 subheadings, you need to add more toggle functions to  the call below
$.get(current_url, function(){
  toggle("subTrigger");
  toggle("subTrigger2");
  toggle("subTrigger3");
  toggle("subTrigger4");
  toggle("subTrigger5");
  toggle("subTrigger6");
});

