$(document).ready(function(){  
    $("#id_text_file").change(function () {
    f = $(this).val();
    extension = f.substring(f.length-3, f.length);
    if (extension.toLowerCase() == 'doc') {
        $(this).qtip({
           content: 'The analyzer cannot analyze word documents directly.  Please save the word document as a plain text file.',
           show: { when: '', ready: true },
           hide: {when: 'click'},
        });
        $(this).qtip("api").show();
    } else {
        if (extension.toLowerCase() != 'txt') {
            $(this).qtip({
               content: 'Please be sure to select a plain text file.  The Lexile Analyzer can only process plain text.',
               show: { when: '', ready: true },
               hide: {when: 'click'},
            });
            $(this).qtip("api").show();
        }
    }
    });
    $("#analyzer_instructions_link").click(function () {
        do_instructions();
    });

	$("#show_replacements").click(function() {
		$("#replacements_list").show();
    });
    
    $("#hide_replacements").click(function() {
        $("#replacements_list").hide();
    });
});

function do_instructions() {
    $("#instructions").dialog({title:"Lexile Analyzer quick instructions",
                                width: 600,
				modal: true, 
			      });
}

function show_instructions2() {
    $("#instructions1").hide();
    $("#instructions2").show();
}
function show_instructions3() {
    $("#instructions2").hide();
    $("#instructions3").show();
}
function end_instructions() {
    $("#instructions").dialog('close');
}

