/*	--	Author: Robin Nicholl
	--	Date: 2009-11-25
	--	jQuery functions enabling:
		- 'expandulike' expanding divs, with + and - signs applied to prependeded <span>&nbsp;</span>
		*/
$(document).ready(function () {
	$(".expandulike-hidden").hide();
	//	$(".expandulike .e-clicker").prepend("<span>&nbsp;</span>");
	$(".expandulike .e-clicker").click(function () {
		$(this).toggleClass("open");
		$(this).next().toggle();
	});
	//	$("#menu_column li").prepend("<span>&nbsp;</span>");
	$(".addspan").prepend("<span>&nbsp;</span>");

	$("a.tooltip").tooltip({ showURL: false });
	$("span.tooltip").tooltip({ showURL: false });

	/*	$('.glossary').click(function() {
	$('#glossary').animate({
	top: '+=282'
	}, 200, 'linear', function() {
	// Animation complete.
	});
	});
	$('.glossary_close').click(function() {
	$('#glossary').animate({
	top: '-=282'
	}, 200, 'linear', function() {
	// Animation complete.
	});
	});	*/


	$('.glossary').click(function () {
		var glos = $('#glossary');
		var position = glos.position();
		var end_y;

		var sGlossaryTitle = $(this).text();

		if (sGlossaryTitle != "Close Glossary") {
			loadGlossary(sGlossaryTitle);
		}

		(position.top < 0) ? (end_y = 16) : (end_y = -282);
		$(glos).animate({
			top: end_y
		}, 200, 'linear', function () {

		});
	});

});

	function loadGlossary(glossaryTitle) {
		ADLAJAX.post(
			{
				"url": "/scripts/XML/GetGlossary.asp",
				"parameters": { "g": glossaryTitle },
				"onSuccess": function (req) { getGlossary(req.responseXML.documentElement); },
				"timeout": 30000,
				"onTimeout": function (req) { /*alert("getNews() : There seems to be some network congestion.\n\nPlease wait a few seconds and try again.");*/ }
			}
		);
	}

	function getGlossary(xmlDoc) {
		var sTitle = xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue;
		var sArticle = xmlDoc.getElementsByTagName("article")[0].childNodes[0].nodeValue;
		e("glossary_title").innerHTML = sTitle;
		e("glossary_text").innerHTML = sArticle;

		xmlRoot = null;
	}
