$(function() {

	var url = $.url();
	var target = url.fparam('target') || "";
	if (target) {
		target = decodeURIComponent(url.fparam('target'));
		//alert('target: '+target);
	}
	var errCode = url.fparam('code');
	if (errCode)
		$('#error-code').text(errCode);
	
	var pos1 = target.indexOf('#');	
	var pos2 = target.indexOf('?');
	if (pos1 < 0)
		pos1 = target.length;
	if (pos2 < 0)
		pos2 = target.length;
	var targetPlain = target.substring(0, Math.min(pos1, pos2));
	$('#target').text(targetPlain);
	
	$('#reload').click(function() {
		if (target)
			window.location = target;
	});
	
	$('#edit-settings').click(function(){
		window.location = 'settings.html';
	});
	
	$('#auto-config').click(function(){
		window.location = 'settings.html#autoCommit=true';
	});	
});