function top_menu_display(){
	$.ajax({
        type: "GET",
        url: APPURL+"ajax/html/get_top_menu/",
        processData: false,
        success: function(responseText) {
        	$('#top_menu').html(responseText);
        }
    });
	return;
}


//autocomplete
$(function() {
	$( "#head_search" ).autocomplete({
		source: function( request, response ) {
				$.getJSON( APPURL+"ajax/search/autocomplete/", request, function(data) {
					response( data );
				});
			},
		minLength: 2,
		select: function( event, ui ) {
			showLoading();
			window.location = ui.item.link;
		}
	});
});


$(document).ready(function(){
	$("#head_search").keypress(function (e) {
	    if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
	        do_search();
	    }
	});
});

function do_search(){
	var search_term = $( "#head_search" ).val();
	if(search_term !== ''){
		$.ajax({
        type: "GET",
        url: APPURL+"ajax/search/url/",
        data: "term="+search_term,
        processData: false,
        success: function(responseText) {
        	window.location = responseText;
        }
    });
		
	}else{
		showGeneralMessageDialog('Erorr', tr_e);
	}
}




