/**



*/

//only hide the paragraphs if javascript is working
document.write('<style type="text/css">#faq-block div {display: none}</style>\n');

//show the next paragraph when a heading link is clicked
function initFAQ(){

    if (!initFAQ.runOnce){
        initFAQ.runOnce = true;            
        
        $("#faq-block .faq-question").click(function(){
        
            //find the corresponding paragraph for this item
            var siblings = this.parentNode.childNodes;
            
            var nextNodeIsAnswer = false;
            for (var i=0; i<siblings.length; i++){
                var node = siblings[i];
                
                if (node == this){
                    nextNodeIsAnswer = true;
                    continue;
                }
                
                if (node.className && node.className == "faq-answer"){
                    if (nextNodeIsAnswer){
                        $(node).slideToggle();    
                        node.isOpen = true;
                        nextNodeIsAnswer = false;
                    }
                    else if ($(node).height() > 0){
                        $(node).hide();
                    }
                }
            }
        })
    }
}

$(initFAQ);

//fix email addresses
$(function(){
    
    $(".email-address").each(function(){
        var text = $(this).text();
        var email = text.replace(/\s*AT\s*/, '@').replace(/\s*DOT\s*/g, '.');
        var html = '<a href="mailto:'+ email +'" >'+ email +'</a>';
        $(this).html(html);
    })
});