<!--
var cookie_cache = new Object();
var hl_ids = new Array();
var hl_colors = new Array();

var koi2utf={
163:1105,
179:1025,
192:1102,
193:1072,
194:1073,
195:1094,
196:1076,
197:1077,
198:1092,
199:1075,
200:1093,
201:1080,
202:1081,
203:1082,
204:1083,
205:1084,
206:1085,
207:1086,
208:1087,
209:1103,
210:1088,
211:1089,
212:1090,
213:1091,
214:1078,
215:1074,
216:1100,
217:1099,
218:1079,
219:1096,
220:1101,
221:1097,
222:1095,
223:1098
};

function koi2unicode (str){
     if (str == null){ return null;}
     var result = "";
     var o_code = "";
     var i_code = "";
     for (var I=0; I < str.length; I++){
        i_code = str.charCodeAt(I);
	
	if (koi2utf[i_code] != null){
	    o_code = koi2utf[i_code]; 
	} else if (i_code > 223 && koi2utf[i_code-32] != null){
	    o_code = koi2utf[i_code-32]-32;
	} else {	    
	    o_code = i_code;
	}
	result = result + String.fromCharCode(o_code);
     }
     
     return result;  
}



function ParseSubCookie (last_str, forumid) {
     
     var arg = forumid + "-";
     if (arg.indexOf('vsluhforumID') != -1 && arg.length > 13){
	arg = arg.substring(12, arg.length);
     }
     var alen = arg.length;
     var clen = last_str.length;
     var endstr = 0;
     var i = last_str.indexOf ("last=") + 5;

     while (i < clen) {
        var j = i + alen;
        if (last_str.substring(i, j) == arg){
             endstr = last_str.indexOf ("|", j);
             if (endstr == -1){
                  endstr = last_str.length;
             }
             return last_str.substring(j, endstr);
        }
        i = last_str.indexOf("|", i)+1;
        if (i == 0) { break; }
      }
      return '';
}
function GetCookie3 (name) {
     var arg = name + "=";
     var alen = arg.length;
     var clen = document.cookie.length;
     var endstr = 0;  
     var i = 0;
     while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg){
             endstr = document.cookie.indexOf (";", j);
             if (endstr == -1){
	        endstr = document.cookie.length;
	     }
	     return unescape(document.cookie.substring(j, endstr));
	}
	i = document.cookie.indexOf(" ", i) + 1;
	if (i == 0) { break; }
     }
     return null;
}	          

function s_n_raw(msg_time, forumid, outtype, cur_user_name){

    var last_visit_time = 0;
    if (cookie_cache[forumid] == null){
        cookie_cache[forumid] = ParseSubCookie(unescape(document.cookie), forumid);
    }
    last_visit_time = cookie_cache[forumid];
    
    if (cookie_cache['user_name'] == null){
        cookie_cache['user_name'] = koi2unicode(GetCookie3('user_name'));
    }
    var g_user_name = cookie_cache['user_name'];
    var out_data = '';
    if (last_visit_time != '' && msg_time > last_visit_time){
	out_data= '<img src="/openforum/Images/newmark.gif" alt="!*!">';
    }
    if (g_user_name != null && g_user_name != '' && g_user_name != 'Аноним'){
	if (g_user_name == cur_user_name){
	    out_data = out_data + '<img src="/openforum/Images/mymark.gif">';
	    //out_data = out_data + '<!-- '+g_user_name+'/'+cur_user_name+' -->';
	}
	
    }
    if (outtype == 0){
        document.write(out_data);
    } else {
        return out_data;
    }
}

function s_n(msg_time, forumid, cur_user_name){
    s_n_raw(msg_time, forumid, 0, cur_user_name);
}
function s_n_repl(text, msg_time, forumid, cur_user_name){
    return s_n_raw(msg_time, forumid, 1, cur_user_name);
}

function rt(om, forum){

    var def_loc = '/cgi-bin/openforum/vsluhboard.cgi?az=list&forum=' + forum + '#om' + om;
    var ref_loc = document.referrer;
    if (ref_loc.indexOf('az=list') > 0){
	var jump_pos = ref_loc.indexOf('#');
	if (jump_pos > 0){
	    ref_loc = ref_loc.substring(0, jump_pos);
	}
	def_loc = ref_loc + "#om" + om;
    }
    window.location= def_loc;
    return false;
}

function display_id(id){
    var item = document.getElementById(id);
    if (item){
	var st = item.style;
	if (st.display == 'none'){
	    st.display='block';
	} else {
	    st.display='none';
	}
    }
    return false;
}

function o_vote(id, vote){

	var x;
	var res='p>+1';
	if (vote == -1) res='m>-1';
	var item=document.getElementById('vt_' + id);
	if (item){
		item.innerHTML='<span class=vt_'+res+'</span>';
	}
	if(typeof XMLHttpRequest != "undefined"){
	    x = new XMLHttpRequest();
	    x.open("GET", "/cgi-bin/openforum/ajax2.cgi?rs=vote&id=" + escape(id) + "&vote=" + escape(vote), true);
	    x.onreadystatechange = function() {
		if (x.readyState != 4) return;
	    }
	    x.send(null);
	}
	return false;
}
function hl(ids){
    // Восстанавливаем прошлые цвета.
    for (var i = 0; i < hl_ids.length; i++){
	document.getElementById(hl_ids[i]).style.backgroundColor=hl_colors[i];
    }
    hl_ids.length = 0;
    hl_colors.length = 0;
    
    // Включаем подсветку новых элементов.    
    var j = 0;
    for (var i = 0; i < ids.length; i++){
	var id = document.getElementById(ids[i]);
	if (id != null){
	    hl_ids[j] = ids[i];
	    hl_colors[j] = id.style.backgroundColor;
	    id.style.backgroundColor="#F9DAC6";
	    j++;
	}
    }
}
   

// -->
