/*
 * Eliminates "Order By" Button and submit automatically on selecting a list item
 */
 /*
function paginatorIni()
{
	subby = document.getElementById('submit_orderby-head');
	if(subby) {
		subby.style.display = 'none';
	}
	subby = document.getElementById('submit_orderby-foot');
	if(subby) {
		subby.style.display = 'none';
	}
	
	select  = document.getElementById('sort-select-head');
	select2 = document.getElementById('sort-select-foot');
	if(select && select2 && document.getElementById('submit_orderby-head')) {
		select.onchange  = function(){
			document.getElementById('submit_orderby-head').click();
		};
		select2.onchange = function(){
			document.getElementById('submit_orderby-head').click();
		};
	}
}*/

$(document).ready(function(){
	$("#submit_orderby-head").hide();
	$("#submit_orderby-foot").hide();
	
	$("#sort-select-head").change(function(){
		$("#submit_orderby-head").trigger("click");
	});
	$("#sort-select-foot").change(function(){
		$("#submit_orderby-foot").trigger("click");
	});
	var string = '<a class="autoselect" onclick="select_all();" name="select">Select all </a><a class="autoselect" onclick="deselect_all();" name="unselect">| Deselect all </a>';
	$("#select_checkbox").append(string);
	
	// jump to begin of paginator
	loc = location.href;
	if(loc.match(/\/[a-z0-9]{5}\//) != null) {
		off = $(".pagination:first").offset();
		scrollTo(0,off["top"]);
	}
});
function select_all() {
	var checkbox = $(".check_briefcase");
	for(var i = 0;i < checkbox.length;i++) {
		if(checkbox[i].type == "checkbox") {
			checkbox[i].checked = true;
		}
	}
}
function deselect_all()
{
	var checkbox = $(".check_briefcase");
	for(var i = 0;i < checkbox.length;i++) {
		if(checkbox[i].type == "checkbox") {
			checkbox[i].checked = false;
		}
	}
}