
jQuery(document).ready(function(){
	// Hide the tooglebox when page loads
	jQuery(".togglebox").hide();
	
	// Use this code if the phonebook is being overlapped by site elements
	// It is likely because the content box that it's in is under other
	//	parts of the website template
	// jQuery(".togglebox").remove().appendTo("body");
	
	// Slide up and down when click over heading 2
	jQuery(".toggle").click(function(){
	// Slide toggle effect set to slow, speed can be modified
		jQuery(".togglebox").slideToggle("slow");
		var url = CMSURL + "/admin/plugins/phonebook/actions/history/click-log.php";
		if (window.XMLHttpRequest){
			xmlhttp = new XMLHttpRequest();
		} else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.open("GET",url,true);
		xmlhttp.send();
		return true;
	});
	
	// Hide the accordion panels holding the numbers
	jQuery(".accordion p").hide();
	
	// Reveal appropriate panel when accordion heading is clicked
	jQuery(".accordion h3").click(function(){
	
	  jQuery(this).next("p").slideToggle("slow").siblings("p:visible").slideUp("slow");
	  jQuery(this).toggleClass("active");
	  jQuery(this).siblings("h3").removeClass("active");
	
	});
});

function closeToggle(){
	jQuery(".togglebox").slideToggle("slow");
	return true;
}
