$(function()
{
	// hide if clicked outside arrow
	$('body').bind('click', function(e) {
		if($(e.target).closest('#popup').length == 0) {
			$("#popup").hide();
		}
	});

	// toggle popup advanced search
	$("#advanced_search_button").click(function(){
		$("#popup").toggle();
		return false;
	});

    // Then pager link cliked
    $('.pagination a:not(.active)').click(function()
    {
        var link = $(this).attr('href');
        // Replace the form path with that and submit the form
        $('#' + form_submit).attr('action', link).submit();
        return false;
    });
    $('.pagination a.active').click(function()
    {
       return false; 
    });
});

window.onload = function() 
{
	for(var i = 0, l = document.getElementsByTagName('input').length; i < l; i++) {
		if(document.getElementsByTagName('input').item(i).type == 'text') {
			document.getElementsByTagName('input').item(i).setAttribute('autocomplete', 'off');
		};
	};
};
