window.loadTmpl = (function () {
var templates = {}, temps, buildObj, getTemplate;
$.get('templates/templates.html', function(html) {
buildObj( html );
});
buildObj = function (html) {
temps = $( html ).children('script');
$.each( temps, function (index, template) {
templates[template.id] = template.innerHTML.trim();
});
};
getTemplate = function (temp) {
return ( temp in templates ) ? templates[temp] : null;
};
return getTemplate;
}());