﻿(function ($) {
	$.fn.jalert = function (msg, title, url) {

		return this.each(function () {
			var b = $("<div title='" + title + "'></div>");
			$(b).dialog({
				modal: true,
				width: '500px',
				open: function () {
					$(this).append(msg);
				},
				close: function () {
					$(this).remove();
					if (url != undefined & url != "")
						window.location = url;
				},
				buttons: { 'OK': function () { $(this).dialog('close'); } }
			});
		});
	};
})(jQuery);

$(function () {
	$('.fieldMandatory').each(function () {
		if ($(this).html() != "mandatory")
			$(this).css('cursor', 'help').attr('title', $(this).text() + ' is a mandatory field');
		else
			$(this).css('cursor', 'help').attr('title', 'label with dotted underline denotes mandatory field');
	});

	$('[iscluetip=true]')
			.css('cursor', 'help')
			.cluetip({
				activation: 'click',
				local: true,
				arrows: true,
				sticky: true,
				mouseOutClose: true,
				width: 400,
				showTitle: false,
				closePosition: 'title'
			});

	$('.buttonBox').addClass('ui-widget-content');
	$('.buttonBox').css('border-radius', '4px');

});

function selectTab(i) {
	$('#memberMenu .tab[tabno=' + i + ']').addClass('selected');
}
