var myAppId = '/guid/9202a8c04000641f8000000005b7add2';
var urlTestArgs = {};

// TEMPLATE:sample_header.js
// Written by Will Moffat for Metaweb Technologies
mjt.error_reporting.developer = "Will";
mjt.error_reporting.email     = "will_mjt_bugs@hamstersoup.com";
mjt.error_reporting.enabled   = true; // mjt errors will be reported
mjt.error_reporting.app_id = myAppId; // create your own topic on Freebase for your app
mjt.sanitytest.set_query( urlTestArgs ); 
// END:sample_header.js
mjt.sanitytest.verify = function() {
    return (
	$('#msgBox2 h2').text() == "whoops, actually it's 42") &&
	$('#count5').text().replace(/\s/g,'') == "DIV'count5'1234" //compare without whitespace
};

function init() {
   var mjtDefs = mjt.run('top');

   //the target node will be replaced with the expanded template,
   //so we must not use 'top' in the calls below.

   mjt.run('msgBox1',mjtDefs.showMessage,['Calculating the answer...']);
   // do boring evolution stuff for 4 billion years
   mjt.run('msgBox2',mjtDefs.showMessage,['24']); 

   // we can call the template func as many times as we want,
   // each time replacing the target node
   mjt.run('msgBox2',mjtDefs.showMessage,["whoops, actually it's 42"]); 


   mjt.run('count10',mjtDefs.countTo,[10]); 
   mjt.run('count5',mjtDefs.countTo,[5]); 

}

