1 function ajax_request(funcname, params, callback, error_callback)
4 params = 'func='+funcname;
5 else if (typeof params == 'object')
6 params['func'] = funcname
7 else if (typeof params == 'string')
8 params = 'func='+funcname+'&'+params
12 $.post('/ajax.php', params,
15 if (typeof data.error == 'string')
16 var error = data.error;
18 var error = 'An error occurred'
20 if (typeof error_callback == 'function')
24 if (typeof callback == 'function')
29 function show_message(text, timeout)
31 if (typeof timeout == 'undefined') timeout = 3;
33 var div = $('#message_div');
36 div.attr('id', 'message_div').css('z-index','1000');
38 $(document.body).append(div);
45 window.setTimeout(hide_message,timeout*1000);
48 function hide_message(text)
50 $('#message_div').hide();
53 function show_error(text, timeout)
55 var div = $('#error_div');
58 div.attr('id', 'error_div').css('z-index','1000');
60 div.append($('<p ><img src="/pix/close.gif" title="close" onclick="return hide_error()"/></p>'));
61 div.append($('<div />'));
62 $(document.body).append(div);
65 div.find('div').html(text);
69 if (typeof timeout != 'undefined')
70 window.setTimeout(hide_error,timeout*1000);
73 function hide_error(text)
75 $('#error_div').hide();