/* BOSTIK 2008 */
/* COMMON JAVASCRIPT FUNCTIONS */

/* FAQ ACCORDION */
function faqAccordion(elt) {
	jQuery('#faqBlock').prepend('<p id="linkToggleAllFaq"><span class="openLink">Show All Answers</span> | <span class="closeLink">Hide All Answers</span></p>');
	jQuery(elt).addClass('accordionEnabled');
	jQuery(elt).children('dd').hide();
	jQuery(elt).children('dt').attr('title','Open Answer');
	jQuery(elt).children('dt.active').attr('title','Close Answer').next('dd').show();
	jQuery(elt).children('dt').click(function() {
		jQuery(this).toggleClass('active');
		jQuery(this).next('dd').slideToggle();
		if (jQuery(this).attr('class')=="active") {
        	jQuery(this).attr('title','Close Answer');
		} else {
        	jQuery(this).attr('title','Open Answer');
		}
	});
	jQuery('#linkToggleAllFaq .openLink').click(function() {
		jQuery(elt).children('dd').slideDown();
		jQuery(elt).children('dt').addClass('active').attr('title','Close Answer');
	});
	jQuery('#linkToggleAllFaq .closeLink').click(function() {
		jQuery(elt).children('dd').slideUp();
		jQuery(elt).children('dt').removeClass('active').attr('title','Open Answer');
	});
}

/* FAQ HIDE/SHOW IN TDS PRODUCT */
function hideShowTDS(elt) {
	if (elt == '.questionLink') {
		jQuery(elt).attr('title','Show answer to this question');
	} else if (elt == '.dictLink') {
		jQuery(elt).attr('title','Show definition of this keyword');
	}
	jQuery(elt).next('span').addClass('offLeft');
	jQuery(elt).each(function() {
		jQuery(this).hover(
			function() {
				jQuery(this).addClass('active');
			},
			function() {
				jQuery(this).removeClass('active');
			}
		);
		jQuery(this).click(function() {
			jQuery(this).next('span').toggleClass('offLeft');
			if (!jQuery(this).next('span').hasClass('offLeft')) {
                if (elt == '.questionLink') {
					jQuery(elt).attr('title','Hide answer to this question');
				} else if (elt == '.dictLink') {
					jQuery(elt).attr('title','Hide definition of this keyword');
				}
			} else if (jQuery(this).next('span').hasClass('offLeft')) {
                if (elt == '.questionLink') {
					jQuery(elt).attr('title','Show answer to this question');
				} else if (elt == '.dictLink') {
					jQuery(elt).attr('title','Show definition of this keyword');
				}
			}
		});
	});
}

jQuery(document).ready(function() {                                                                         

	/* FAQ HIDE/SHOW IN TDS PRODUCT */
	if (jQuery('.questionLink').size() > 0) { initHideShowTDS = hideShowTDS('.questionLink'); }
	if (jQuery('.dictLink').size() > 0) { initHideShowTDS = hideShowTDS('.dictLink'); }

	/* FAQ ACCORDION */
	if (jQuery('.faqBlock').size() > 0) { initFaqAccordion = faqAccordion('.faqBlock'); }

});























/* END */