<!--

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
};

var last_visit_time = 0;
var first_time = 0;
var first_time_epoch = 0;
var d = new Date();
var nowtime=parseInt(d.getTime()/1000);
if (typeof raw_nowtime != "undefined"){
    nowtime=raw_nowtime;
}

var lv0 = GetCookie2('lastvisit');
var lv = new Array();
if (lv0 != null){
    lv = lv0.split('.');
}
if (lv.length != 2 || isNaN(parseInt(lv[0])) || isNaN(parseInt(lv[1])) ){
    lv[0]=nowtime;
    lv[1]=nowtime;
}else{
    lv[0]=parseInt(lv[0]);
    lv[1]=parseInt(lv[1]);
}

if (nowtime - lv[1] > 1800){
    lv[0] = lv[1];
}



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 GetCookie2 (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 setup_nick(){
	document.charset='koi8-r';
	var name = koi2unicode(GetCookie2("user_name"));
	var email = GetCookie2("from_email");
	if (name == null || name.length == 0){
	    name = "αΞΟΞΙΝ";
	}
	document.comment.name.value=name;
	if (email != null && email.length > 3){ 
	    document.comment.email.value=email;
	}
	return 0;
}   

function TxtResize(fr){
    fr.form.body.cols=80;
    fr.form.body.rows=15;
}

function s_n_raw(msg_time, forumid, outtype){

    var last_visit_epoch=lv[0]-3600*2;
    var day = new Date((last_visit_epoch + 3 * 3600 )* 1000);
    last_visit_time = ((day.getUTCFullYear() - 1997) * 372 * 86400) + ((day.getUTCMonth() + 1) * 31 * 86400) + (day.getUTCDate() * 86400) + (day.getUTCHours() * 3600) + (day.getUTCMinutes() * 60) + day.getUTCSeconds(); 

    if ((outtype != 2 && msg_time > last_visit_time && first_time < last_visit_time) || (outtype == 2 && msg_time > last_visit_epoch && first_time_epoch < last_visit_epoch)){
	var out_data= '<img src="/openforum/Images/newmark.gif" alt="!*!">';
//document.write(msg_time +':'+ last_visit_epoch +':'+ first_time_epoch);
	if (outtype != 1){
	    document.write(out_data);
	} else {
	    return out_data;
	}
    }
    return '';
}

function s_n_repl(text, msg_time, forumid){
    if (first_time == 0){
	first_time = msg_time;
    }
    return s_n_raw(msg_time, forumid, 1);
}
function s_n_epoch(msg_time){
    if (first_time_epoch == 0){
	first_time_epoch = msg_time;
    }
    return s_n_raw(msg_time, 'vsluhforumID3', 2);
}
function s_n(msg_time, forumid){
    s_n_raw(msg_time, forumid, 0);
}

 
function set_lastload(path){
    document.cookie='lastvisit='+ lv[0] + '.' + nowtime + '; path=' + path + '; expires=Thu, 19-May-2011 10:38:47 GMT';
}

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;
}
   
// -->
