﻿
$(window).ready(function() {
    init();
});

function init() {
    $('#txtQuery').autocomplete({
        source: function( req, res ) {
			var term = req.term;
            jQTubeUtil.suggest(term, function(responseS){
		        var html = [];
		        for(s in responseS.suggestions){
			        var sug = responseS.suggestions[s];
			        html.push(sug);
		        }
                res(html);
	        });
		},
		minLength: 2
    });
}

function checkNotEmpty() {
    var query = $('#txtQuery');
    return (query.length > 0 && query.text().trim() != '');
}
