/**
 * @author jacobsmith
 */
function revealFaq(qHREF) {
	var qid = qHREF.substring(qHREF.indexOf('#')+1);
	if (document.getElementById(qid).style.display=='none') {
		document.getElementById(qid).className += ' shown';
		if (typeof(Effect) == 'object') {
    		new Effect.BlindDown(qid);
    		new Effect.Highlight(qid, { queue: 'end'});
		}
		else {
			document.getElementById(qid).style.display = 'block';
		}
  	}
  	else {
	  	if (typeof(Effect) == 'object') {
    		new Effect.BlindUp(qid);
		}
		else {
			document.getElementById(qid).style.display='none';
		}
    	
  	}
  	return false;
}

function prepFAQ(containerID){
	if (document.getElementById) {
		if(document.getElementById (containerID)) {
			container = document.getElementById(containerID);
			var items = container.getElementsByClassName('faq-item');
				for (var i=0; i<items.length; i++) {
      			var links = items[i].getElementsByClassName('question');
      			var full = items[i].getElementsByClassName('answer');
				
				var questionNo = i + 1;
			
				if (links[0]) {
					links[0].href = "#" + containerID + '_ques_' + questionNo;
					links[0].title = containerID + '_ques_' + questionNo;
        			links[0].onclick = function(){return revealFaq(this.href);}
				}
				if (full[0]) {
					full[0].id = containerID + '_ques_' + questionNo;
					if (window.location.hash.substring(1) != full[0].id) {
						full[0].style.display = 'none';
					}
				}
    			}
		}
	}
}
