function submitForm(action, patchId) {
	document.getElementById('autoupdateAction').value = action;
	document.getElementById('patchId').value = patchId;
	document.getElementById('form1').submit();
}

function installPatch(id) {
	submitForm('install', id);
}

function uninstallPatch(id) {
	submitForm('uninstall', id);
}

function refreshList() {
	submitForm('refresh', 0);
}

function revert() {
	submitForm('revert');
}

function toggleDescription(self, containerId) {
	var details = $(containerId);
	var link = $(self);
	
	if (details.visible()) {
		details.hide();
		link.update(SbGetLocaleByKey('SHOW-DETAILS'));
	} else {
		details.show();
		link.update(SbGetLocaleByKey('HIDE-DETAILS'));
	}
}

function runProgressController() {
	new Ajax.PeriodicalUpdater('progressController', baseUrl + '/Ajax/Admin/Autoupdate/Progress', {
		method: 'get',
		frequency: '30',
		evalScripts: true
	});
}

function reloadAutoupdatePage() {
	document.location.href = baseUrl + '/Admin/Autoupdate';
}