$(document).ready(function() {
	
	$('#pager_records_per_page select').change(function(){
		$.cookie("pager_records_per_page", null);
		records = $(this).find('option:selected').val();
		$.cookie("pager_records_per_page", records);
		var location = window.location.href.replace(/page\/\d+/, 'page/1');
		location = location.replace(/#/, '');
		window.location.href = location;
	});
	
	ctrl = false;	
	$(document).keydown(function(e) {
			if(e.keyCode == 17) {
			  ctrl = true;
			}
			if(ctrl && e.keyCode == 37) {
			  var link = $('#pager_previous a').attr("href");
			} 
			if (ctrl && e.keyCode == 39) {
			  var link = $('#pager_next a').attr("href");
			}
			if (link) document.location = link; 
		});
	$(document).keyup(function(e) {
		ctrl = false;
	  });
} );
