function ajaxLoading(elem) {
	t = findDOM(elem, 0);
	if (t == null) t = findDOM_parent(elem, 0);
	if (t != null) t.innerHTML = '<div align="center" style="padding:10px"><img src="images/ajax_indicator.gif"><div>';
}

function ajaxLoadingFP(elem) {
	t = findDOM(elem, 0);
	if (t == null) t = findDOM_parent(elem, 0);
	if (t != null) t.innerHTML = '<div class="bd_mm_4 fd1" style="padding:15px; width:200px" align="center"><img src="images/ajax_indicator.gif"><div>';
}

// custom loading in a variable width layer
function ajaxLoadingC(elem, width) {
	t = findDOM(elem, 0);
	if (t == null) t = findDOM_parent(elem, 0);
	if (t != null) t.innerHTML = '<div style="padding:15px; width:' + (width - 32) + 'px; border:1px solid" align="center"><img src="images/ajax_indicator.gif"><div>';
}

function ajaxStatus(elem, text) {
	t = findDOM(elem, 0);
	if (t == null) t = findDOM_parent(elem, 0);
	if (t != null) t.innerHTML = '<div align="center" style="padding:10px" class="cl12 bold">' + text + '<div>';
}

// KF specifics
function get_new_messages() {
	var opt = {
		asynchronous: true,
		onSuccess: function(t) {
			result = t.responseText;
			if (parseInt(curr_new_mess) != parseInt(result)) {
				if (parseInt(result) > 0) {
					applyStyle('new_mess', 'innerHTML', new_mess_menu.replace(/\[x\]/, result), 0); 
					applyStyle('new_mess', 'className', 'cl12', 0); 
					
					if (typeof(iNewMess) != 'undefined')
						clearInterval(iNewMess);
					iNewMess = setInterval('blinkMessages()', 1000);
				}
				else {
					applyStyle('new_mess', 'innerHTML', my_account_menu, 0); 
					applyStyle('new_mess', 'className', 'cl4', 0); 
					if (typeof(iNewMess) != 'undefined')
						clearInterval(iNewMess);
				}
				curr_new_mess = result;
			}
		}
	}
	new Ajax.Request('index.php?obj=member&action=get_mess&init_min=1', opt);
}

toggle = true;
function blinkMessages() {
	if (toggle) 
		applyStyle('new_mess', 'className', 'cl4', 0); 
	else
		applyStyle('new_mess', 'className', 'cl12', 0); 
	toggle = !toggle;
}