/////////////////////////////////////////////////////////////////////////
/// Copyright Eric Zavesky @ zavesky.org (c) 2008
/// 
/// This software was created exclusively by Eric Zavesky and not
/// for public release in any form.
/// 
/// Any commercial use of the materials, without the written permission 
/// of Eric Zavesky, is strictly prohibited. For permission to use 
/// specific materials, please contact Eric Zavesky (eric@zavesky.org).
/// 
/// Eric Zavesky is not, under any circumstances, responsible for 
/// the unauthorized use or redistribution of digital collections 
/// found on this Web site.
/// 
/////////////////////////////////////////////////////////////////////////

$(function()
{
$('#query_form').submit(function () {
   $.getJSON('/tools/njt-demo/demo.php',  //demo url
      { query: $('#query_input').val() },      //demo data
      function(jData){  //process result
         var resText = 'Sorry, there was a server error.  Please check back later!';
         if (jData.name && jData.name=='njt') {
            resText = jData.output;   //grab the output
            resText = resText.replace(/\n/g, "<br />\n");
            resText += "<br />";
			resText += "(Retrieved " + jData.birthday + ")";
         }
         //console.debug(jData);
         $('#query_result').html(resText);
       });
   });
});


