<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">// размер окна браузера
function get_browser_size() {
 var int_h = 0;
 var int_w = 0;
 if ( typeof window.innerWidth == 'number' ) {
  int_h = window.innerHeight;
  int_w = window.innerWidth;
 } else if ( document.documentElement &amp;&amp; ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
  int_h = document.documentElement.clientHeight;
  int_w = document.documentElement.clientWidth;
 } else if ( document.body &amp;&amp; ( document.body.clientWidth || document.body.clientHeight ) ) {
  int_h = document.body.clientHeight;
  int_w = document.body.clientWidth;
 }
 return { width: parseInt(int_w), height: parseInt(int_h) };
}

// координата по оси y
function get_scroll_y() {
 var scroll_y = 0;
 if ( document.documentElement &amp;&amp; document.documentElement.scrollTop ) {
  scroll_y = document.documentElement.scrollTop;
 } else if ( document.body &amp;&amp; document.body.scrollTop ) {
  scroll_y = document.body.scrollTop;
 } else if ( window.pageYOffset ) {
  scroll_y = window.pageYOffset;
 } else if ( window.scrollY ) {
  scroll_y = window.scrollY;
 }
 return scroll_y;
}

// координаты элемента
function get_element_pos(element) {
 var pos = new Object();
 if ( !element ) { return null; }
 var it;
 it = element;
 pos.x = 0;
 if ( it.offsetParent ) {
  while ( it.offsetParent ) {
   pos.x += it.offsetLeft;
   it = it.offsetParent;
  }
 } else if ( it.x ) {
  pos.x += it.x;
 }
 it = element;
 pos.y = 0;
 if ( it.offsetParent ) {
  while ( it.offsetParent ) {
   pos.y += it.offsetTop;
   it = it.offsetParent;
  }
 } else if ( it.y ) {
  pos.y += it.y;
 }
 return pos;
}

// подтверждение перехода по url
function url_action_confirm(message,url) {
 if ( confirm(message) ) {
  location.href = url;
 }
}

// смена src изображения
function change_img(id_name,src_url) {
 var elm = document.getElementById(id_name);
 elm.src = src_url;
}

// отображать / скрыть элемент
function elm_view_switch(elm_id) {
 var elm = document.getElementById(elm_id);
 if ( elm.style.display == 'none' ) {
  elm.style.display = 'block';
 } else {
  elm.style.display = 'none';
 }
}

// checkbox - изменение значения
function checkbox_elm_switch(elm_id) {
 var elm = document.getElementById(elm_id);
 elm.checked = ( elm.checked ? false : true );
}

// окошко выбора цвета, div
function dbox_color_select_on() {
 var pos = get_element_pos(document.getElementById('dbox_color_select_on_element'));
 document.getElementById('dbox_color_select').style.left = pos.x+'px';
 document.getElementById('dbox_color_select').style.top = ( pos.y - 218 )+'px';
 document.getElementById('dbox_color_select').style.display = 'block';
}
function dbox_color_select_off(tag,elm_id,tag_atr_val) {
 document.getElementById('dbox_color_select').style.display = 'none';
 if ( tag &amp;&amp; elm_id ) {
  ptag(tag,elm_id,tag_atr_val);
 }
}

// окошко выбора смайликов, div
function dbox_smile_select_on() {
 var pos = get_element_pos(document.getElementById('dbox_smile_select_on_element'));
 document.getElementById('dbox_smile_select').style.left = pos.x+'px';
 document.getElementById('dbox_smile_select').style.top = ( pos.y - 215 )+'px';
 document.getElementById('dbox_smile_select').style.display = 'block';
}
function dbox_smile_select_off(smile,elm_id) {
 document.getElementById('dbox_smile_select').style.display = 'none';
 if ( smile &amp;&amp; elm_id ) {
  psmile(smile,elm_id);
 }
}

// окошко мини-редактора медиа-объектов, window
function window_media_editor_open(width,height,table_name,id) {
 var window_settings = 'left=224,top=224,width=' + width + ',height=' + height + ',toolbar=0,location=0,directories=0,menubar=0,scrollbars=1,resizable=1,status=0,fullscreen=0';
 var media_editor_window = window.open('/media_editor/' + table_name + '/' + id + '/','media_editor_window',window_settings);
 media_editor_window.focus();
}
function window_media_editor_vals_to_text(num,preview,url,elm_id) {
 if ( num == 0 &amp;&amp; url &amp;&amp; elm_id ) { ptag('IMG',elm_id,'',url); }
 if ( num &gt; 0 &amp;&amp; elm_id ) { pmedia(num,preview,url,elm_id); }
}

// http-запросы без перезагрузки страницы
function create_http_request() {
 var http_request;
 var browser = navigator.appName;
 if ( browser == "Microsoft Internet Explorer" ) {
  http_request = new ActiveXObject("Microsoft.XMLHTTP");
 } else {
  http_request = new XMLHttpRequest();
 }
 return http_request;
}

// запрос
var http = create_http_request();

// сервер
var http_server_url = 'http://florapedia.ru/';

// проверка ника
var prev_nick_value = '';
function check_nick() {
 var nick = document.getElementById('nick').value;
 if ( nick != '' ) {
  if ( prev_nick_value != nick ) {
   document.getElementById('nick_input_div').style.margin = '0px 0px 3px 0px';
   document.getElementById('nick_message_div').style.display = 'block';
   document.getElementById('nick_message_div').className = 'alarm_color';
   document.getElementById('nick_message_div').innerHTML = 'проверка введённого ника ...';
   http.open('get',http_server_url + 'index.php?nick=' + encodeURIComponent(nick) + '&amp;rand=' + Math.random());
   http.onreadystatechange = check_nick_answer;
   http.send(null);
  }
 } else {
  document.getElementById('nick_message_div').style.display = 'none';
  document.getElementById('nick_input_div').style.margin = '0px 0px 10px 0px';
 }
}
function check_nick_answer() {
 if ( http.readyState == 4 ) {
  var answer = http.responseText;
  if ( answer == '1' ) {
   document.getElementById('nick_message_div').className = 'ok_color';
   document.getElementById('nick_message_div').innerHTML = 'выбранный ник свободен';
  } else if ( answer == '2' ) {
   document.getElementById('nick_message_div').className = 'error_color';
   document.getElementById('nick_message_div').innerHTML = 'выбранный ник, к сожалению, занят';
  } else if ( answer == '3' ) {
   document.getElementById('nick_message_div').className = 'error_color';
   document.getElementById('nick_message_div').innerHTML = 'некорректный ник';
  } else {
   document.getElementById('nick_message_div').style.display = 'none';
   document.getElementById('nick_input_div').style.margin = '0px 0px 10px 0px';
  }
 }
}

// список меток
var prev_tags_txt_value = '';
function get_tags_txt_list() {
 var tags_txt = document.getElementById('tags_txt').value;
 if ( tags_txt != '' ) {
  if ( prev_tags_txt_value != tags_txt ) {
   http.open('get',http_server_url + 'index.php?tags_txt=' + encodeURIComponent(tags_txt) + '&amp;rand=' + Math.random());
   http.onreadystatechange = check_tags_txt_answer;
   http.send(null);
  }
 } else {
  document.getElementById('tags_txt_message_div').style.display = 'none';
  document.getElementById('tags_txt_input_div').style.margin = '0px 0px 10px 0px';
 }
}
function check_tags_txt_answer() {
 if ( http.readyState == 4 ) {
  var answer = http.responseText;
  if ( answer != '' ) {
   document.getElementById('tags_txt_input_div').style.margin = '0px 0px 3px 0px';
   document.getElementById('tags_txt_message_div').style.display = 'block';
   document.getElementById('tags_txt_message_div').innerHTML = answer;
  } else {
   document.getElementById('tags_txt_message_div').style.display = 'none';
   document.getElementById('tags_txt_input_div').style.margin = '0px 0px 10px 0px';
  }
 }
}
// добавление метки
String.prototype.trim = function () { return this.replace(/^\s*/, "").replace(/\s*$/, ""); }
function add_tag(tag) {
 tags_txt = document.getElementById('tags_txt').value;
 tags_array = tags_txt.split(",");
 for ( i = 0; i &lt; ( tags_array.length - 1 ); i++ ) { tags_array[i] = tags_array[i].trim(); }
 tags_array[tags_array.length-1] = tag.trim();
 document.getElementById('tags_txt').value = tags_array.join(', ');
}

// голосование за | против
var vote = '';
var item = '';
var id = 0;
function vote_add(u_vote,u_item,u_id) {
 vote = u_vote;
 item = u_item;
 id = u_id;
 if ( vote != '' ) {
  document.getElementById(item + '_' + id + '_vote_yes').className = 'vote_yes_box_off';
  document.getElementById(item + '_' + id + '_vote_no').className = 'vote_no_box_off';
  if ( item == 'topic' ) {
   document.getElementById(item + '_' + id + '_vote_yes').innerHTML = '&lt;IMG SRC="/images/topic-vote-yes.gif" WIDTH="24" HEIGHT="24" BORDER="0" /&gt;';
   document.getElementById(item + '_' + id + '_vote_no').innerHTML = '&lt;IMG SRC="/images/topic-vote-no.gif" WIDTH="24" HEIGHT="12" BORDER="0" /&gt;';
   document.getElementById(item + '_' + id + '_vote_wait').innerHTML = '&lt;IMG SRC="/images/topic-vote-wait.gif" WIDTH="94" HEIGHT="4" BORDER="0" /&gt;';
  }
  if ( item == 'comment' ) {
   document.getElementById(item + '_' + id + '_vote_yes').innerHTML = '&lt;IMG SRC="/images/comment-vote-yes.gif" WIDTH="36" HEIGHT="14" BORDER="0" /&gt;';
   document.getElementById(item + '_' + id + '_vote_no').innerHTML = '&lt;IMG SRC="/images/comment-vote-no.gif" WIDTH="36" HEIGHT="14" BORDER="0" /&gt;';
   document.getElementById(item + '_' + id + '_vote_wait').innerHTML = '&lt;IMG SRC="/images/comment-vote-wait.gif" WIDTH="72" HEIGHT="2" BORDER="0" /&gt;';
  }
  http.open('get',http_server_url + 'index.php?vote=' + encodeURIComponent(vote) + '&amp;item=' + encodeURIComponent(item) + '&amp;id=' + encodeURIComponent(id) + '&amp;rand=' + Math.random());
  http.onreadystatechange = check_vote_answer;
  http.send(null);
 }
}
function check_vote_answer() {
 if ( http.readyState == 4 ) {
  var answer = http.responseText;
  if ( answer != '' ) {
   document.getElementById(item + '_' + id + '_rating').innerHTML = '&lt;NOBR&gt;' + answer + '&lt;/NOBR&gt;';
  } else {
   document.getElementById(item + '_' + id + '_rating').innerHTML = '&lt;NOBR&gt;&lt;SPAN CLASS="error_color"&gt;:(&lt;/SPAN&gt;&lt;/NOBR&gt;';
  }
  if ( item == 'topic' ) { document.getElementById(item + '_' + id + '_vote_wait').innerHTML = '&lt;IMG SRC="/images/1x1.gif" WIDTH="94" HEIGHT="4" BORDER="0" /&gt;'; }
  if ( item == 'comment' ) { document.getElementById(item + '_' + id + '_vote_wait').innerHTML = '&lt;IMG SRC="/images/1x1.gif" WIDTH="72" HEIGHT="2" BORDER="0" /&gt;'; }
 }
}

// выделение текста в поле формы
function select_this_text(field) { field.focus(); field.select(); }</pre></body></html>