jQuery.fn.findParent = function(c) {
	return this.pushStack(jQuery.map(this, function(a) {
		while (a = a.parentNode) {
			if (jQuery.filter(c,[a]).r.length) return a;
		}
	}));
};
		
function disableSection(section) {
	$(section + " input").attr("disabled", "true");
	$(section + " select").attr("disabled", "true");
	$(section + " textarea").attr("disabled", "true");
	$(section).hide();
}
	
function enableSection(section) {
	$(section + " input").removeAttr("disabled");
	$(section + " select").removeAttr("disabled");
	$(section + " textarea").removeAttr("disabled");
	$(section).show();
}


$(function() {
	$(".required").findParent("label").prepend('*');
	$(".submitonce").submit(function() {		
		$(this).find("input.clickonce").attr("disabled", true);
	});	
	$('#page, #actionBox').corner();
})


var progressBar = {
	close: function (dialog) {
		dialog.data.fadeOut(50, function () {
			dialog.container.fadeOut(50, function () {
				dialog.overlay.fadeOut(50, function () {
					$.modal.close();
					try {
						window.stop();
						$('#progressWin').hide();
					 } catch (e) {
						document.execCommand('Stop');
						$('#progressWin').hide();
					 }
				});
			});
		});
	}
};

