jQuery.extend({ // generate random number random: function(X) { return Math.floor(X * (Math.random() % 1)); }, // generate random number between 2 numbers randomBetween: function(MinV, MaxV) { return MinV + jQuery.random(MaxV - MinV + 1); }, // this function puts an error message into a an error into a container if the ajax call fails errorRetrievingAjaxData: function(container) { $(container).html('
Error: Unable to retrieve information from the database. Please try again.
'); }, // this function is callen on AjaxSucceeded and binds data to a template bindDataToTemplate: function(data, pContainer, sTemplateURL) { var iTotalRecords = data.Records.length; if (iTotalRecords == 0) { $(pContainer).html(''); } else { $(pContainer).setTemplateURL(sTemplateURL, null, { filter_data: false }); $(pContainer).processTemplate(data); }; } });