
// popupify all elements "a.popup"
$(function(){
    $.getScript("media/js/popup.js", function(){
        $(Popup.onload);
    });
});

// any element of class "hover" will have "_over" 
// appended to it's filename on mouseover
$(function(){
    HOVER_SUFFIX = '_over';
    $(".hover").hover(function(){
        dot = this.src.lastIndexOf('.');
        file_base = this.src.substring(0,dot);
        file_ext = this.src.substring(dot);
        if(file_base.lastIndexOf(HOVER_SUFFIX) < 0)
            this.src = file_base + HOVER_SUFFIX + file_ext;
    },function(){
       over = this.src.lastIndexOf(HOVER_SUFFIX);
       if(over >= 0)
            this.src = this.src.substring(0,over) + this.src.substring(over+HOVER_SUFFIX.length);
    });
});

// populate the "crumbs" element with breadcrumbs,
// if current body@id is in the list.
$(function(){
    $("#crumbs").each(function(){
        current = $("body").attr("id"); 
        pages = new Array(
            new Array("perform","perform","Perform ID Verification"),
            new Array("verification","verification","Verification Questions"),
            new Array("results","results","Results of Interview"),
            //new Array("extension","extension","Extension Options"),
            new Array("print","print","Print Certificate"));

        found = false;
        output = "<ul>";
        for(i=0; i<pages.length; i++){
            if(found){
                suffix = "before";
            }else if(current == pages[i][0]){
                found = true;
                suffix = "on";
            }else
                suffix = "complete";
            if(i > 0) 
                output += "<li><img src=\"media/img/grayarrow2.gif\" /></li>";
            output += "<li><img src=\"media/img/crumbs/" + pages[i][1] + "_" + suffix + ".gif\" /></li>";
        }
        if(!found)
            return;
        output += "</ul><div class=\"hr\" />";
            
        $(this).html(output);
    });
});
