var arr_interval = new Array();function handle_intervals(type, id, func, time){if(type == 'set' && func != ''){arr_interval[id] = setInterval(func, time);}else if(type == 'timeout' && func != ''){arr_interval[id] = setTimeout(func, time);}else if(type == 'clear'){clearInterval(arr_interval[id]);}}function hide_parent(id, type){if(type == 'tr'){$(id).parent('td').parent('tr').hide();}else if(type == 'div'){$(id).parent('div').hide().parent('div').hide();}else if(type == 'opacity'){$(id).parents('.opacity').hide();}}var ajax_q = new Array();$.fn.runAjax = function(o){var op = $.extend({file: 'ajax',field: '',type: '',xtra: '',id: '',load_bar: false,flash: false}, o);var ajax_id = this, load_div = $('#load_div'), url, post_data = '', file = op.file, field = op.field, type = op.type, xtra = op.xtra, id = op.id, load_bar = op.load_bar, flash = op.flash, do_run = true;if(field == ''){field = ajax_id.attr('id');}if(type == ''){type = field;}if(file == 'ajax_form'){url = 'ajax_form.php?field=' + field + '&name=' + xtra;post_data = 'value=' + escape(id);}else if(file == 'ajax_form2'){url = 'ajax_form.php?name=' + type + '&value=' + xtra;}else if(file == 'ajax' || file == 'ajax_box'){url = file + '.php?field=' + type + (xtra ? '&xtra=' + xtra : '') + (id ? '&id=' + id : '');}else if(file == 'ajax_db' || file == 'ajax_public'){url = file + '.php?field=' + field;post_data = 'value=' + escape(xtra) + '&id=' + id;}else if(file == 'ajax_list'){url = 'ajax_list.php?field=' + field + (xtra ? '&xtra=' + xtra : '') + (id ? '&id=' + id : '');}else if(file == 'ajax_edit'){url = 'ajax_editable.php?type=' + (type == 'editable1' ? 1 : 2) + '&field=' + field + '&xtra=' + xtra;}else{do_run = false;}if(idle_time != ''){var d = new Date(),d_diff = d.getTime() - idle_time;if(d_diff > 300000){do_run = false;}if(d_diff > 1000000){idle_time = d.getTime();}}if(do_run == true && ajax_q[url + post_data] != true){if(load_bar == true){ajax_id.html("<img src='/images/loading_small.gif' alt='Laddar...'/>");}load_div.show();$.ajax({url: '/include/' + url,type: post_data == '' ? 'GET' : 'POST',processData: false,data: post_data,dataType: 'json',beforeSend: function(){ajax_q[url + post_data] = true;},success: function(data){if(data.success && data.success.length > 0){if(ajax_id){if(ajax_id.attr('type') == 'text'){ajax_id.val(data.success);}else{ajax_id.html(data.success).show();if(data.success.length < 25000){$('a, img, span').tooltip();if(flash == true){$('div.flash_content').flash({allowfullscreen: true, wmode: 'opaque'}, {version: 8}, function(htmlOptions){var info = $(this).attr('rel').split(':');htmlOptions.src = 'http://' + info[0];htmlOptions.width = $(this).css('width');htmlOptions.height = $(this).css('height');if(info[1] != ''){htmlOptions.flashvars.file = 'http://' + info[1];}$(this).html($.fn.flash.transform(htmlOptions));});}if($.browser.msie){if($.browser.version < 7){$('img.spr_16').css({'background-image': 'url(/images/spr_16.gif)'});$('img.spr_40').css({'background-image': 'url(/images/spr_40.gif)'});}$('img.hide_in_ie').hide();}}}}}else{ajax_id.html('');}if(data.jquery){eval(data.jquery);}load_div.hide();delete ajax_q[url + post_data];}});}};