var g_speed_brake = 14; var g_step_on_finish = 2; var g_left_section_interval_id; var g_delay_move = 1; var g_move_left_section = true; var g_orig_move_left_section = g_move_left_section; var g_left_section; var g_destination_top = 0; var g_left_section_offset_top = 0; window.addEventListener("load", init_admin_login); window.addEventListener("load", init_move_left_section); window.addEventListener("scroll", js_set_move_left_section); window.addEventListener("resize", init_move_left_section); function init_admin_login() { var elem = document.getElementById("id_txt_admin_login"); if (elem) { elem.select(); elem.focus(); } } function my_prevent_scrolling(event, input_elem) { document.onkeydown = function(event){ var evt = event ? event : window.event ? window.event : ""; if(evt && evt.keyCode == 32){ evt.preventDefault(); } }; } function toggle_layer(layer_id, this_elem, new_text, old_text, display_style) { if (!layer_id) { alert("Error 4"); return; } var my_layer = document.getElementById(layer_id); if (!my_layer) { alert("Error 11"); return; } var is_set_to_be_visible = true; var current_display_style = my_layer.style.display; if (!current_display_style || current_display_style == "none") { is_set_to_be_visible = false; } if (!is_set_to_be_visible) { my_layer.style.display = display_style; if (this_elem) { if (new_text) { this_elem.innerHTML = new_text; } } } else { my_layer.style.display = "none"; if (this_elem) { if (old_text) { this_elem.innerHTML = old_text; } } } } function toggle_submenu(this_submenu_id, this_icon_div_id) { var display_style = "block"; var old_class_name = "dropdown_icon"; var new_class_name = "dropdown_icon dropdown_icon_selected"; if (!this_submenu_id) { alert("Error 48"); return; } var this_submenu = document.getElementById(this_submenu_id); if (!this_submenu) { alert("Error 55"); return; } var this_icon_div = document.getElementById(this_icon_div_id); if (!this_icon_div) { alert("Error 66"); return; } var last_opened_submenu_id = toggle_submenu.last_opened_submenu_id; var last_opened_icon_div_id = toggle_submenu.last_opened_icon_div_id; if (typeof last_opened_submenu_id != "undefined") { var last_opened_submenu = document.getElementById(last_opened_submenu_id); if (last_opened_submenu.id != this_submenu.id) { last_opened_submenu.style.display = "none"; } } toggle_submenu.last_opened_submenu_id = this_submenu_id; if (typeof last_opened_icon_div_id != "undefined") { var last_opened_icon_div = document.getElementById(last_opened_icon_div_id); if (last_opened_icon_div.id != this_icon_div.id) { last_opened_icon_div.className = old_class_name; } } toggle_submenu.last_opened_icon_div_id = this_icon_div_id; var is_set_to_be_visible = true; var current_display_style = this_submenu.style.display; if (!current_display_style || current_display_style == "none") { is_set_to_be_visible = false; } if (!is_set_to_be_visible) { this_submenu.style.display = display_style; this_icon_div.className = new_class_name; toggle_submenu.last_opened_submenu_id = this_submenu_id; } else { this_submenu.style.display = "none"; this_icon_div.className = old_class_name; toggle_submenu.last_opened_submenu_id = undefined; } } function toggle_top_submenu(column_offset, show) { var column_id = "id_top_submenu_column_" + column_offset; var content_wrapper_id = "id_top_submenu_column_content_wrapper_" + column_offset; var column_separator_left_id = "id_top_submenu_column_separator_" + (column_offset - 1); var column_separator_right_id = "id_top_submenu_column_separator_" + column_offset; var display_style = "none"; var visibility_style = "hidden"; if (show) { display_style = "block"; visibility_style = "visible"; } var column_div = document.getElementById(column_id); var content_wrapper_div = document.getElementById(content_wrapper_id); var column_separator_left_div = document.getElementById(column_separator_left_id); var column_separator_right_div = document.getElementById(column_separator_right_id); if (column_div) { column_div.style.visibility = visibility_style; } if (content_wrapper_div) { content_wrapper_div.style.display = display_style; } if (column_separator_left_div) { column_separator_left_div.style.visibility = visibility_style; } if (column_separator_right_div) { column_separator_right_div.style.visibility = visibility_style; } } function make_rand(bottom, top) { bottom = parseInt(bottom); top = parseInt(top); if (bottom > top) { tmp_top = top; top = bottom; bottom = tmp_top; } with (Math) { return floor(random() * (top - bottom + 1)) + bottom; } } function make_another_captcha(img) { var img_src = window.location.href; var pos_qmark = img_src.indexOf("?"); if (pos_qmark != -1) { img_src = img_src.substring(0, pos_qmark); } img.src = img_src + "?captcha=" + make_rand(1, 999999); return false; } function js_htmlspecialchars(text) { var map = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }; return text.replace(/[&<>"']/gi, function(t) { return map[t]; }); } function js_special_to_br(text) { return text .replace(/<br>/gi, "
") .replace(/<br \/>/gi, "
"); } function get_offset_top(elem) { var my_tagname = ""; var top_off = 0; while ((typeof(elem) == "object") && (typeof(elem.tagName) != "undefined")) { top_off += elem.offsetTop; my_tagname = elem.tagName.toLowerCase(); if (my_tagname == "body") { break; } if (typeof(elem) == "object") { if (typeof(elem.offsetParent )== "object") { elem = elem.offsetParent; } } } return top_off; } function get_scroll_top() { return Math.max(document.documentElement.scrollTop, document.body.scrollTop); } function init_move_left_section() { g_left_section = document.getElementById("id_left_boxes_wrapper"); if (!g_left_section) { return; } g_left_section.style.top = "0px"; g_left_section_offset_top = get_offset_top(g_left_section); if (window.innerWidth > 500) { if (g_orig_move_left_section) { g_move_left_section = true; } js_set_move_left_section(); } else { if (g_left_section_interval_id) { clearInterval(g_left_section_interval_id); g_left_section_interval_id = null; } g_left_section.style.top = "0px"; g_move_left_section = false; } } function js_move_left_section(elem, dest_top, direction) { var curr_top = parseInt(elem.style.top); if (direction == "down") { if (curr_top < dest_top) { var step = parseInt((dest_top - curr_top) / g_speed_brake); if (step < g_step_on_finish) { step = 1; } elem.style.top = (curr_top + step) + "px"; } else { clearInterval(g_left_section_interval_id); g_left_section_interval_id = null; setTimeout("js_set_move_left_section()", g_delay_move); } } else { if (curr_top > dest_top) { var step = parseInt((curr_top - dest_top) / g_speed_brake); if (step < g_step_on_finish) { step = 1; } elem.style.top = (curr_top - step) + "px"; } else { clearInterval(g_left_section_interval_id); g_left_section_interval_id = null; setTimeout("js_set_move_left_section()", g_delay_move); } } } function js_set_move_left_section() { var scroll_top = get_scroll_top(); if (g_move_left_section && g_left_section && !g_left_section_interval_id) { var left_orig_top = parseInt(g_left_section.style.top); g_destination_top = scroll_top - g_left_section_offset_top; if (g_destination_top < 0) { g_destination_top = 0; } if (left_orig_top < g_destination_top) { g_left_section_interval_id = setInterval("js_move_left_section(g_left_section, g_destination_top, 'down')", 10); } else { g_left_section_interval_id = setInterval("js_move_left_section(g_left_section, g_destination_top, 'up')", 10); } } }