//  Author: Jamie Peloquin <http://jamiepeloquindesign.com>
//

//FastInit.addOnLoad();


//< Hide Home Services Highlights
//  Looks for each dl within #modServicesHighlights
//  and hides DLs
function setServicesHighlights() {
    var exServices  = $$('#modServicesHighlights dl');
    exServices.invoke('hide');    
}
// >

//< Run Home Services Highlights

function runServicesHighlights() {
    var source = adPanels;
    //var thisId = source[thisAd];
    //alert('source.length='+source.length+'  thisId='+thisId+'  thisAd='+thisAd);
    //alert('thisAd='+thisAd+'  thisId='+thisId);
    $(source[thisAd]).hide();
    dotId = 'show'+thisAd;
    $(dotId).removeClassName('active');
    
    thisAd++;
    //alert('thisAd='+thisAd);
    if (thisAd >= source.length) {
        thisAd = 0;
    }
    //alert(source[thisAd]);
    
    //thisId = source[thisAd];
    dotId = 'show'+thisAd;
    $(dotId).addClassName('active');
    $(source[thisAd]).appear();
    
    setTimeout("runServicesHighlights()", 8 * 1000);
}

// >

//< Collapse FAQ Boxes
//  Looks for each class="faqbox" boxes
//  and hides DDs
function setFaqs() {
    var exAnswers   = $$('dl[class~=faqbox] dd');
    exAnswers.invoke('hide');    
}
// >

//< Toggle faqbox dd answers
//  Looks for each a.faqlink within class="faqbox" boxes
//  Toggles the visibility of content
function toggleFaqAnswers() {
    var exLinks   = $$('dl[class~=faqbox] a.faqlink');
    for(var i=0; i< exLinks.length; i++) {
        Event.observe(exLinks[i], 'click', function(event) {
            var exLink      = $(Event.element(event));
            var exAnswer    = $(exLink).up('dt').next('dd');
            exAnswer.toggle();
            exLink.href = 'javascript:void()';
        });
    }    
}
//>

