// Alert Call
function wAlert(msg,title,oid) {
	
	/** This weird implementation is because jquery ui doesn't support translation for buttons in any other way **/
	var btOk = lng.common.btOk;
	var buttons = {};
	buttons[btOk] = function() {
		$(this).dialog('close');
	}
	
	if (typeof(oid) == 'undefined') oid = 'dialog-alert';
	if (typeof(title) == 'undefined') title = lng.common.alert;

	if ($('#' + oid + '').size() == 0) {
		var el = $('<div id="' + oid + '"></div>');
		$('body').append(el);
	}

	$('#' + oid + '').hide();
	$('#' + oid + '').attr('title',title);
	$('#' + oid + '').html(msg);
	$('#' + oid + '').dialog({
		modal: true,
		buttons: buttons,
		close: function(ev, ui) {$(this).remove();}
	});
}

// Confirm Call
function wConfirm(msg,title,callback,oid) {
	
	/** This weird implementation is because jquery ui doesn't support translation for buttons in any other way **/
	var btOk = lng.common.btOk;
	var btCancel = lng.common.btCancel;
	var buttons = {};
	buttons[btCancel] = function() {
		callback(false);
		$(this).dialog('close');
	}
	buttons[btOk] = function() {
		callback(true);
		$(this).dialog('close');
	}

	if (typeof(oid) == 'undefined') oid = 'dialog-confirm';
	if (typeof(title) == 'undefined') title = lng.common.confirm;
	if (typeof(callback) == 'undefined') callback = function() {};

	if ($('#' + oid + '').size() == 0) {
		var el = $('<div id="' + oid + '"></div>');
		$('body').append(el);
	}

	$('#' + oid + '').hide();
	$('#' + oid + '').attr('title',title);
	$('#' + oid + '').html(msg);
	$('#' + oid + '').dialog({
		modal: true,
		buttons: buttons,
		close: function(ev, ui) {$(this).remove();}
	});
}
