var nam;
var top_;
var left_;
var bg_color='';
var bg_color_id=0;

var left_sd=60;
var vid_width=500;
var rig_=232;
var load_=0;
var mouse_y;

var a_div=1;
var down=1;
var time_out=0;
var chat=0;
var clik=0;
var chat_s_user='<font color="#aa0000">Выберите оппонента в списке пользователей</font>';
var chat_mess_0=new Array();
var chat_mess_key_0=new Array();
var chat_mess_1=new Array();
var chat_mess_key_1=new Array();
var log_in=1;
var _switch_iframe=1;
var _return_func=1;
var h_div=250;
var h_div_t=250;
if(window.screen.width>=1024){h_div=400;h_div_t=400;}

//var _load=1;


function tops(h,w){
	if (navigator.appName == "Netscape") {
		top_=window.innerHeight/2-h/2;
		left_=window.innerWidth/2-w/2;
	}
	else {
		top_=document.body.clientHeight/2-h/2;
		left_=document.body.clientWidth/2-w/2;
	}
	if(top_<=0)top_=30;
	if(left_<=0)left_=30;
}
function ifra(a,s,c){
	if(document.getElementById){
		if(document.getElementById("visov_"+a)){
			document.getElementById("visov_"+a).innerHTML=parseInt(document.getElementById("visov_"+a).innerHTML)+1;
		}
	}
	else if(document.all){
		if(document.all["visov_"+a]){
			document.all["visov_"+a].innerHTML=parseInt(document.all["visov_"+a].innerHTML)+1;
		}
	}
	if(s==1)_ifra('id='+a+'&sort_v=0',1);
	else _ifra('id='+a,1);
	_set_color(c);
	_set_color(a);
}
function ifra_nt(a){_ifra('nt='+a,1);_set_color(a);}
function ifra_at(a){_ifra('at='+a,1);_set_color(a);}
function ifra_view_id(a,b,c,d){_ifra('n1='+b+'&id='+a,1,d);_set_color(c);_set_color(a);}
function ifra_view_nt(a,b,c,d){_ifra('n1='+b+'&nt='+a,1,d);_set_color(a);}
function ifra_view_at(a,b,c,d){_ifra('n1='+b+'&at='+a,1,d);_set_color(a);}
function ifra_view_id_sort(a,b,s){_ifra('n1='+b+'&id='+a+'&sort_v='+s,1);}
function ifra_view_nt_sort(a,b,s){_ifra('n1='+b+'&nt='+a+'&sort_v='+s,1);}
function ifra_view_at_sort(a,b,s){_ifra('n1='+b+'&at='+a+'&sort_v='+s,1);}
function get_chat(a,b){_ifra('chat='+b+'&chat_id='+a,0);_set_color(a);}

function _set_color(a){
	if(document.getElementById){
		if(document.getElementById("tr_color_"+a)){
			if(bg_color_id)sP(document.getElementById("tr_color_"+bg_color_id), bg_color);
			bg_color_id=a;// && bg_color!=''
			bg_color=document.getElementById("tr_color_"+a).style.backgroundColor;
			sP(document.getElementById("tr_color_"+a), "#fafeea");
		}
	}
	else if(document.all){
		if(document.all["tr_color_"+a]){
			if(bg_color_id)sP(document.all["tr_color_"+bg_color_id], bg_color);
			bg_color_id=a;// && bg_color!=''
			bg_color=document.all["tr_color_"+a].style.backgroundColor;
			sP(document.all["tr_color_"+a], "#fafeea");
		}
	}
}

function _ifra(s,a,d){	
	if(a==1 && chat==1)window.iframe_chata.location.href='/forum/class/c_reset.php?'+clik;
	chat=0;	
	var a_='';
	var b_='docs_top';
	time_out=setTimeout("window.scroll(0,0)",100);
	if(!d){
		dhtml_objects['docs_top'].set_height('');
		a_='<table><tr><td height=20 valign=middle><font color="#008000">Data loading...</font></td></tr></table>';
		a_='<div id=docs_topin style="overflow:auto;padding-right:3px;">'+a_+'</div>';
	}
	else {
		a_='<table width="100%" border=0 cellspacing=0 cellpadding=0><tr><td height=1></td></tr><tr><td height=1 bgcolor=#000000><img src=/forum/image/0.gif width=1 height=1 border=0></td></tr><tr><td height=100 valign=middle align=center><font color="#008000">Data loading...</font></td></tr></table>';
		b_='docs_topin';
	}
	if(document.getElementById)document.getElementById(b_).innerHTML=a_;
	else document[b_].innerHTML=a_;
	window.name_iframe.location.href='/forum/class/s.php?'+s;
}
function _clear_ifr(){
	dhtml_objects['docs_top'].set_height('');
	var a='<div id=docs_topin style="overflow:auto;padding-right:3px;"></div>';
	//var a='';
	if(document.getElementById)document.getElementById("docs_top").innerHTML=a;
	else docs_top.innerHTML=a;
	dhtml_objects['docs_top'].set_height('');
	//dhtml_objects['docs_topin'].set_height('');
	resize_();
}
function _open_ifr(){
	dhtml_objects['docs_topin'].set_height('');
	set_cookie('d_div',0,30);
	d_div=0;
	resize_();
}
function _set_ifr(){
	dhtml_objects['docs_topin'].set_height(h_div_t);
	set_cookie('d_div',1,30);
	d_div=1;
	resize_();
}
function _get_ifr(a){
	//
	if(a==1)h_div_t=150;//'';
	else if(a==2){
		if(h_div==400)h_div_t=300;//'';
	}
	else h_div_t=h_div;
	//document.getElementById("_test").innerHTML=h_div_t;
}
function _ifr_top(a){
	//if(d_div)
	//document.getElementById("docs_topin").scrollTo(0,0);
	if(!d_div || a)window.scrollTo(0,0);
	else if(document.getElementById("span_top_view"))document.getElementById("span_top_view").scrollIntoView(false);
	//else window.scrollTo(0,0);
}
function ifr(current_event,a){
	left_sd=60;
	show_tooltip(current_event,a);
	window.name_iframe.location.href='/forum/class/t.php?id_content='+a;
}
function ifr_post_vloat(current_event,tip_text){
	hide_tooltip_notime();
	mouse_y = get_mouse_y(current_event);
	left_sd=get_client_width()-380;
	vid_width=300;
	show_tooltip_text(tip_text,5,8,0,'body_text');
}
function ifr_post(a){
	left_sd=220;
	//show_tooltip(current_event,a);
	if(dhtml_objects["load_tip_"+a])dhtml_objects["load_tip_"+a].set_html('<font color="#008000">Load...</font>');
	window.name_iframe.location.href='/forum/class/t.php?id_post_content='+a;
}
function ifr_pages(current_event,tip_text,w,padd,minu){
	hide_tooltip_notime();
	mouse_y = get_mouse_y(current_event);
	left_sd = get_mouse_x(current_event)-minu;
	vid_width=w;
	show_tooltip_text(tip_text,padd,5,1,'body_text');
}
function ifr_stat(current_event,a,d){
	mouse_y = get_mouse_y(current_event);
	//left_sd = get_mouse_x(current_event)-10;
	left_sd = 40;
	vid_width=500;
	if(dhtml_objects["sta_"+a])dhtml_objects["sta_"+a].set_html('<font color="#008000">Load...</font>');
	window.name_iframe.location.href='/forum/class/t.php?id_stat='+a+'&cat='+d;
}
function ifr_user(current_event,a){//,d
	mouse_y = get_mouse_y(current_event);
	window.name_iframe.location.href='/forum/class/t.php?id_user='+a;//+'&cat='+d;
}
function ifr_parent(current_event,a){
	mouse_y = get_mouse_y(current_event);
	//if(dhtml_objects["load_tip_parent_"+a])dhtml_objects["load_tip_parent_"+a].set_html('<font color="#008000">Load...</font>');
	window.name_iframe.location.href='/forum/class/t.php?id_parent='+a;
}
function ifr_chat_ignor(current_event,a){
	mouse_y = get_mouse_y(current_event);
	left_sd = get_mouse_x(current_event)-10;
	vid_width=100;
	window.name_iframe.location.href='/forum/class/t.php?chat_user_ignor='+a;
}
function ifr_chatmessage(current_event,tip_text){
	hide_tooltip_notime();
	mouse_y = get_mouse_y(current_event);
	left_sd = get_mouse_x(current_event)-8;
	vid_width=300;
	show_tooltip_text(tip_text,3,5,0,'body_text');
}
function _ifra_chat(s){	
	window.iframe_chata.location.href='/forum/class/c_action.php?'+s;
}
function get_tree(a){
	if(its_ie55plus && !its_opera){
		if(dhtml_objects["load_tip_"+a])dhtml_objects["load_tip_"+a].set_html('<font color="#008000">Load...</font>');
		window.name_iframe.location.href='/forum/class/z.php?s='+a;
	}
	else
		window.location.href='/forum.html?s='+a;
}

function dok(url,name_,h,w){
if (nam!=null && !nam.closed)nam.close();
tops(h,w);
nam=window.open(url,name_,"height="+h+",width="+w+",status=yes,toolbar=no,menubar=no,location=no,top="+top_+",left="+left_+",scrollbars=yes,resizable=yes");
nam.focus();
}

function ifr_print(current_event,d){
	hide_tooltip_notime();
	mouse_y = get_mouse_y(current_event);
	if(its_opera)left_sd=get_client_width()-278;
	else left_sd=get_client_width()-328;//-140;
	var text_='<div align="right" class=small><a href="#" onclick="doks(1,500,600,0,'+d+');return false" class=under>сообщения на экране&nbsp;&raquo;</a><br><a href="#" onclick="doks(0,500,600,0,'+d+');return false" class=under>все сообщения&nbsp;&raquo;</a></div>';
	vid_width=135;
	show_tooltip_text(text_,3,8,0,'body_text');
	vid_width=500;
}
function ifr_save(current_event,d){
	hide_tooltip_notime();
	mouse_y = get_mouse_y(current_event);
	if(its_opera)left_sd=get_client_width()-290;
	else left_sd=get_client_width()-340;//-152;
	var text_='<div align="right" class=small>сообщения на экране&nbsp;&raquo;<br>'+
	'<a href="#" onclick="_save(1,1,'+d+');return false" class=under title="Сохранить в формате HTML">HTML</a>, '+
	'<a href="#" onclick="_save(1,2,'+d+');return false" class=under title="Сохранить в формате DOC">DOC</a>, '+
	'<a href="#" onclick="_save(1,3,'+d+');return false" class=under title="Сохранить в формате TXT">TXT</a>&nbsp;<br>'+
	'все сообщения&nbsp;&raquo;<br>'+
	'<a href="#" onclick="_save(0,1,'+d+');return false" class=under title="Сохранить в формате HTML">HTML</a>, '+
	'<a href="#" onclick="_save(0,2,'+d+');return false" class=under title="Сохранить в формате DOC">DOC</a>, '+
	'<a href="#" onclick="_save(0,3,'+d+');return false" class=under title="Сохранить в формате TXT">TXT</a>&nbsp;'+	
	'</div>';
	vid_width=135;
	show_tooltip_text(text_,3,8,0,'body_text');
	vid_width=500;
}
function doks(a,h,w,s,d){
if (nam!=null && !nam.closed)nam.close();
tops(h,w);
nam=window.open('/forum/class/p.php?a='+a+'&s_view='+s+'&cat='+d,'Print',"height="+h+",width="+w+",status=yes,toolbar=yes,menubar=yes,location=no,top="+top_+",left="+left_+",scrollbars=yes,resizable=yes");
nam.focus();
}
function _save(a,b,d){
	//if(!its_ie6plus){
		window.location.href='/forum/class/p.php?a='+a+'&s_view='+b+'&cat='+d;
		return;
	//}
	//if (nam!=null && !nam.closed)nam.close();
	//nam=window.open('/forum/class/p.php?a='+a+'&s_view='+b+'&cat='+d,'Save',"height=500,width=700,status=yes,toolbar=yes,menubar=yes,location=yes,top=50,left=50,scrollbars=yes,resizable=yes");
	//nam.focus();
}

function imgCLC(pic){
	var ts=document.smil.message_form.value;
	ts+='%'+pic+'%';
	document.smil.message_form.value=ts;
	document.smil.message_form.focus();
	if(document.all){
		var tr=document.smil.message_form.createTextRange();
		//tr.moveEnd("textedit");
		tr.move("textedit");
	}
}

function sP(theRow, thePointerColor)
{
	if(theRow){
	    if (typeof(theRow.style) == 'undefined') {
	        return false;
	    }
		if(thePointerColor=='')thePointerColor='#fdfff7';
		//var a=theRow.style.backgroundColor.toLowerCase();
		//if(a.indexOf("fafeea")==-1 && a.indexOf("rgb(250, 254, 234)")==-1)
		theRow.style.backgroundColor=thePointerColor;
	    return true;
	}
	return false;
}
function sP_(theRow, thePointerColor)
{
	if(theRow){
	    if (typeof(theRow.style) == 'undefined') {
	        return false;
	    }
		
		if(thePointerColor=='')thePointerColor='#fdfff7';
		theRow.style.backgroundColor=thePointerColor;
	    return true;
	}
	return false;
}

function set_focus(name_form,name_field,a){
	if(document.forms[name_form]){
		for (var i=0; i<document.forms[name_form].length; i++){
			if(document.forms[name_form].elements[i].type=="text"){
				document.forms[name_form].elements[i].focus();
				return;
			}
		}
	}
}
var ins_warnning=1;
function len(a,le){
	var b=a.value.length;
	var ff=a.form.name;
	document.forms[ff].form_count.value=b;
	if(b>le){
		if(dhtml_objects["span_warnning"]){
			if(ins_warnning)dhtml_objects["span_warnning"].set_html('<img src="/forum/image/blink1.gif" width="116" height="17" alt="" align="absmiddle">');
			ins_warnning=0;
		}
		else a.value=a.value.substring(0,le);
	}
	else{
		if(dhtml_objects["span_warnning"]){
			if(!ins_warnning)dhtml_objects["span_warnning"].set_html('');
			ins_warnning=1;
		}
	}
	
}

function wrapTag(txtarea, lft, rgt) {
	lft = unescape(lft);
	rgt = unescape(rgt);
	if (document.all) {
		WrapIE(lft, rgt);
	}
	else if (document.getElementById) {
		wrapMoz(txtarea, lft, rgt);
	}
	/*txtarea.select(false);
	txtarea.blur();
	txtarea.focus();*/
	
}
// IE only - wraps selected text with lft and rgt
function WrapIE(lft, rgt) {
	strSelection = document.selection.createRange().text;
	if (strSelection!="") {
		document.selection.createRange().text = lft + strSelection + rgt;
	}
}

// Moz only - wraps selected text with lft and rgt
function wrapMoz(txtarea, lft, rgt) {
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	if (selEnd==1 || selEnd==2) selEnd=selLength;
	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength);
	txtarea.value = s1 + lft + s2 + rgt + s3;
}

//////////////////////////////////////////////


if (document.all) {
}
else if (document.getElementById) { 
    document.captureEvents(Event.MOUSEDOWN);
}
else if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
}

document.onmousedown = mousedown_handler;
function mousedown_handler(){
	if(!load_)return;
	if(dhtml_objects["body_text"]){
		var a=dhtml_objects["body_text"].get_visibility();
		if((a=='visible' || a=='inherit'))
		setTimeout("hide_tooltip()",200);
	}
	down=1;
	clik++;
}

function mousedown_handler_body(){
	if(!load_)return;
	if(dhtml_objects["body_text_activ"]){
		dhtml_objects["body_text_activ"].set_visibility("hidden");
		dhtml_objects["body_text_activ"].set_top(0);
	}
}
function hide_tooltip_notime(){
	//if(dhtml_objects["body_text"]){
		//var a=dhtml_objects["body_text"].get_visibility();
		//if((a=='visible' || a=='inherit'))
		hide_tooltip();
		down=0;
	//}
}

if (!dhtml_ok) { 
    event = null;
}
function show_tooltip(current_event,a) {
	if (!dhtml_ok) { return; }
	mouse_y = get_mouse_y(current_event);
	if(dhtml_objects["load_tip_"+a])dhtml_objects["load_tip_"+a].set_html('<font color="#008000">Load...</font>');
}
function show_tooltip_text(tip_text,padd,sd,alig,div_name) {
    if (!dhtml_ok) { return; }
    var html_text = "<div style='width:"+vid_width+"px;" +
                    "'><table width=\"100%\" border=0 cellpadding=1 cellspacing=0 bgcolor=\"#000000\"><tr><td><table width=\"100%\" border=0 cellpadding="+padd+" cellspacing=0 bgcolor=\"#FDFFF5\"><tr><td>" + 
                     tip_text + "</td></tr></table></td></tr></table></div>";
    dhtml_objects[div_name].set_html(html_text);
    dhtml_objects[div_name].set_left(left_sd);
	var _scrol=get_client_scroll_top();
	var _body=dhtml_objects[div_name].get_height();
	if(alig==1){
    	dhtml_objects[div_name].set_top(mouse_y - sd + _scrol-_body);
	}
	else{
		dhtml_objects[div_name].set_top(mouse_y + sd + _scrol);
		if(dhtml_objects["div_menu"]){
			if(_scrol+_body+190>dhtml_objects["div_menu"].get_height()){
				dhtml_objects["div_menu"].set_height(_scrol+_body+205);
			}
		}
	}
    dhtml_objects[div_name].set_visibility("visible"); 
}
function hide_tooltip() {
    if (!dhtml_ok || !down) { down=1;return; }
    if(dhtml_objects["body_text"]){
		dhtml_objects["body_text"].set_visibility("hidden");
		dhtml_objects["body_text"].set_top(0);
	}
}
function confirmLink(text_conf ,theSqlQuery)
{
    var is_confirmed = confirm(text_conf + ' :\n' + theSqlQuery);
    if (is_confirmed) {
        return true;
    }
    return false;
}

function set_float_top(){
	var sc=get_client_scroll_top_n();
	if(sc+10<150 || dhtml_objects["float_div"].get_top()<150)dhtml_objects["float_div"].set_top(150);
	else if((sc+10>150)) _set_float_top(sc+10);
	setTimeout("set_float_top()",100);
}
function _set_float_top(a){
	var b=dhtml_objects["float_div"].get_top();
	if(b<a)_sdvig_plus(a-b);
	else _sdvig_min(b-a);
}
function _sdvig_plus(a){
	var g=get_client_scroll_top_n()+10;
	var gt=dhtml_objects["float_div"].get_top();
	var t=g<=gt;
	if(a<=0 || t){
		if(t)dhtml_objects["float_div"].set_top(g);
		return;
	}
	dhtml_objects["float_div"].set_top(gt+(Math.round(a/80)));
	a--;
	setTimeout("_sdvig_plus("+a+")",10);
}
function _sdvig_min(a){
	var g=get_client_scroll_top_n()+10;
	var gt=dhtml_objects["float_div"].get_top();
	var t=g>=gt;
	var t_=dhtml_objects["float_div"].get_top()<=150;
	if(a<=0 || t || t_){
		if(t)dhtml_objects["float_div"].set_top(g);
		else if(t_)dhtml_objects["float_div"].set_top(150);
		return;
	}
	dhtml_objects["float_div"].set_top(gt-(Math.round(a/80)));
	a--;
	setTimeout("_sdvig_min("+a+")",10);
}

function reset_float_news(d){
	if(dhtml_ok && !its_opera){
		window.name_iframe.location.href='/forum/class/t.php?set_max=1&cat='+d;
		dhtml_objects['float_div_news'].set_visibility('hidden');
		var i=0;
		while(1){
			if(dhtml_objects["new_span_"+i])dhtml_objects["new_span_"+i].set_html('');
			else break;
			i++;
		}
	}
	else window.location.href='/forum.html?set_max=1&cat='+d;
}
function get_dok(a,i){
	if(a==1)dok('/forum/adm_quest.html?edit=1&id='+i,'Edit',400,700);
	else dok('/forum/adm_quest.html?edit=0&id='+i,'Delete',100,700);
}
function refresh_func(d,a){
	if((d_ref || a) && window.refresh_iframe)window.refresh_iframe.location.href='/forum/class/r.php?cat='+d;
	setTimeout("refresh_func("+d+")",30000);
}

function chat_user_select(a,name,u){
	if(dhtml_objects["chat_select"] && document.send_chat){
		dhtml_objects["chat_select"].set_html(name);
		var z=document.send_chat;
		z.form_to_users.value=a;
		z.chat_form_message.disabled=false;
		z.chat_form_message.focus();
		z.send_chat_button.disabled=false;
		
		if(u==0){
			var col='#669966';
			var col_='#F9FeF9';
		}else{
			var col='#999966';
			var col_='#FeFeF9';
		}
		z.chat_form_reset.style.backgroundColor=col;
		z.chat_form_message.style.backgroundColor=col_;
		z.send_chat_button.style.backgroundColor=col;
	}
}
function chat_sender(a){
	//document.send_chat.send_chat_button.disabled=true;
	setTimeout('document.send_chat.send_chat_button.disabled=false',2000);
	a.chat_form_message.value='';
	a.chat_form_message.focus();
}
function chat_message(a,b,c){
	if(document.getElementById){
		if(document.getElementById(a)){
			if(c)document.getElementById(a).outerHTML=b;
			else document.getElementById(a).innerHTML=b;
		}
	}else{
		if(a){
			if(c)a.outerHTML=b;
			else a.innerHTML=b;
		}
	}
}
function add_chat_0(t,a){
	var test_in=0;
	if(typeof(chat_mess_key_0[t])!='undefined'){return;}
	else{
		if(test_in){
			setTimeout("add_chat_0("+t+",'"+a+"')",10);
			return;
		}
		test_in=1;
		chat_mess_key_0[t]=1;

		if(its_ns){
			chat_mess_0.unshift(a);
			if(chat_mess_0.length>100)chat_mess_0.pop();					
			chat_message('div_chat_privat',chat_mess_0.join(""),0);
		}
		else{
			chat_mess_0[chat_mess_0.length]=a;
			if(chat_mess_0.length>20){
				var total=chat_mess_0.length;
				for(var i=1;i<total;i++){
					chat_mess_0[i-1]=chat_mess_0[i];
				}
				--chat_mess_0.length;
			}
			chat_message('div_chat_privat_in',chat_mess_0.slice(chat_mess_0.length-1,chat_mess_0.length),1);
		}
		test_in=0;
	}
}
function add_chat_1(t,a){
	var test_in=0;
	if(typeof(chat_mess_key_1[t])!='undefined'){return;}
	else{
		if(test_in){
			setTimeout("add_chat_1("+t+",'"+a+"')",10);
			return;
		}
		test_in=1;
		chat_mess_key_1[t]=1;

		if(its_ns){
			chat_mess_1.unshift(a);
			if(chat_mess_1.length>100)chat_mess_1.pop();					
			chat_message('div_chat_forums',chat_mess_1.join(""),0);
		}
		else{
			chat_mess_1[chat_mess_1.length]=a;
			if(chat_mess_1.length>20){
				var total=chat_mess_1.length;
				for(var i=1;i<total;i++){
					chat_mess_1[i-1]=chat_mess_1[i];
				}
				--chat_mess_1.length;
			}
			//chat_message('div_chat_forums_in','<div id="div_chat_forums_in"></div>++++',1);	
			chat_message('div_chat_forums_in',chat_mess_1.slice(chat_mess_1.length-1,chat_mess_1.length),1);
		}
		test_in=0;
	}
}
function reset_chat_0(){
	chat_mess_0=new Array();
	chat_mess_key_0=new Array();
	if(dhtml_objects['div_chat_privat'])dhtml_objects['div_chat_privat'].set_html('<div id="div_chat_privat_in"></div>');
	create_object_array();	
}
function reset_chat_1(){
	chat_mess_1=new Array();
	chat_mess_key_1=new Array();
	if(dhtml_objects['div_chat_forums'])dhtml_objects['div_chat_forums'].set_html('<div id="div_chat_forums_in"></div>');
	create_object_array();	
}
function refresh_chat(a,b){
	if(_return_func!=b)return;
	clik++;
	if(clik>9999)clik=0;
	if(chat){
		if(_switch_iframe && window.if_chatr1){
			window.if_chatr1.location.href='/forum/class/c.php?chat='+a+'&demon='+clik+'&load='+log_in;
			_switch_iframe=0;
		}
		else if(window.if_chatr0){
			window.if_chatr0.location.href='/forum/class/c.php?chat='+a+'&demon='+clik+'&load='+log_in;
			_switch_iframe=1;
		}
		/*if(log_in==1){
			reset_chat_0();
			reset_chat_1();
		}*/
		log_in=0;
	}
	setTimeout("refresh_chat("+a+","+b+")",30000);//8
}
var ch=true;
function check_field(f){
	for(i=0;i<f.elements.length;i++){
		if(f.elements[i].type=='checkbox' && typeof(f.elements[i].checked)!='undefined')f.elements[i].checked=ch;
	}
	ch=!ch;
}
function set_vid_button(a){
	document.getElementById('div_post_'+a).style.visibility='visible';
}
function valid_form(f,f_value,f_text,f_desc){
	var arr_value=f.elements[f_value].value.split(';');
	var arr_text=f.elements[f_text].value.split(';');
	var arr_desc=f.elements[f_desc].value.split(';');
	if(arr_value.length!=arr_text.length || arr_value.length!=arr_desc.length)return;
	
	var test=1;
	for(var i=0;i<arr_value.length;i++){
		if(i==0 && f.elements['form_post_hidden_submit'] && f.elements['form_post_hidden_submit'].value=='preview'){
			test=0;
			continue;
		}
		if(parseInt(arr_value[i])<=0){
			f.elements[arr_text[i]].focus();
			alert('Ошибка заполнения формы:\n\n--------------------\n'+arr_desc[i]+'\n--------------------');//.replace("'","\'")
			return false;
		}
	}
	if(test)_buttons(f,1);
	return true;
}
function _valid_field_update(f,f_str,num){//поле, поле где содержание через ; , какой по счету номер в стринге
	var arr_str=f_str.value.split(';');
	var test=f.value;
	if(!its_empty(test) && !its_whitespace(test))arr_str[num-1]++;
	else arr_str[num-1]--;
	if(arr_str[num-1]<0)arr_str[num-1]=0;
	f_str.value=arr_str.join(';');
}
function its_empty(a) {
    if (a=="" || a==null)return true;
    return false;
}
function its_whitespace(a) {
    var w = " \n\r\t";
    for (var c = 0; c < a.length; c++) {
        var h = a.charAt(c);
        if (w.indexOf(h) == -1) {
            return false;
        }
    }
    return true;
}
function _buttons(f,a){
	var b=false;
	if(a)b=true;
	f.elements['form_post_submit_send'].disabled=b;
	f.elements['form_post_submit_prew'].disabled=b;
	f.elements['form_post_submit_save'].disabled=b;	
}
function _del_from_form(f){
	var st='';
	for(i=0;i<f.elements.length;i++){
		if(f.elements[i].type=='checkbox' && typeof(f.elements[i].checked)!='undefined' && f.elements[i].checked==true){
			st+='&post_c[]='+f.elements[i].value;
		}
	}
	//document.write('/forum/class/post_get_list.php?post_del_test=1'+st);
	if(st!='')top.name_iframe.location.href='/forum/class/post_get_list.php?post_del_test=1'+st;
}
function div_close_post(a){
	if(document.getElementById)top.document.getElementById("div_post_nav_"+a).innerHTML='';
	else eval("top.div_post_nav_"+a+".innerHTML='';");
	if(document.getElementById)top.document.getElementById("div_post_view_"+a).innerHTML='';
	else eval("top.div_post_view_"+a+".innerHTML='';");
	top.name_iframe.location.href='/forum/class/post_get_list.php?post_close_id='+a;
}