#{extends 'bhave-main.html' /}
#{set title:'Bhave: ' + bhaviourId + '. ' + bhaviourName /}

#{globalVars /}	
#{waitFunctions /}	
#{knockoutHandlers /}	
#{dictionary /}	
#{translate /}	
#{supportingFunctions /}	
#{bhaviour /}
#{keyboardShortcuts /}
	
<script>
	$(document).ready(function() {
		
		myDictionary = new Dictionary();
	    $.getJSON("@{Bhave.getDictionary()}", function(dictionary) {
	    	ko.mapping.fromJS(dictionary, {}, myDictionary);
	    }); 

	    bhaviour = new Bhaviour();
	    $.getJSON("@{Bhaviours.get(bhaviourId)}", function(bhaviourData) {
	    	ko.mapping.fromJS(bhaviourData, {}, bhaviour);
	    	bhaviour.syntax().forEach(function(term, count) {
	    		term.count = count;
	    	});
		    $.getJSON("@{Bhave.getEnv()}", function(envData) {
		    	ko.mapping.fromJS(envData, {}, bhaviour);
				ko.applyBindings(bhaviour);
				applyTranslation();
		    });
	    }); 
	});
</script>

#{envView /}
#{screenshotView /}
#{resultView /}
#{bhaviourView /}