if(!document.getElementById){document.getElementById=function(n){return document.all[n]}}

var browser=navigator.userAgent.toLowerCase();
var isFF=((browser.indexOf('mozilla')!=-1) && (browser.indexOf('spoofer')==-1) && (browser.indexOf('compatible')==-1) && (browser.indexOf('opera')==-1) && (browser.indexOf('webtv')==-1) && (browser.indexOf('hotjava')==-1));
var isIE=((browser.indexOf("msie")!=-1) && (browser.indexOf("opera")==-1));
var isOP=(browser.indexOf("opera")!=-1);

function set_comment(id, name){
	document.getElementById('p_id').value=id;
	document.getElementById('reply').innerHTML="Ответ для: "+name;
	document.getElementById('reply').style.display="";
	document.getElementById('txt').focus();
}

tmenu_1_off=new Image();tmenu_1_off.src="/file/tmenu/home_0.gif";
tmenu_1_on=new Image();tmenu_1_on.src="/file/tmenu/home_1.gif";

tmenu_2_off=new Image();tmenu_2_off.src="/file/tmenu/forum_0.gif";
tmenu_2_on=new Image();tmenu_2_on.src="/file/tmenu/forum_1.gif";

tmenu_3_off=new Image();tmenu_3_off.src="/file/tmenu/map_0.gif";
tmenu_3_on=new Image();tmenu_3_on.src="/file/tmenu/map_1.gif";

tmenu_4_off=new Image();tmenu_4_off.src="/file/tmenu/about_0.gif";
tmenu_4_on=new Image();tmenu_4_on.src="/file/tmenu/about_1.gif";

tmenu_5_off=new Image();tmenu_5_off.src="/file/tmenu/reklama_0.gif";
tmenu_5_on=new Image();tmenu_5_on.src="/file/tmenu/reklama_1.gif";

function bb(n,insert,mess){
	ok=true;
	if(isIE){
		document.getElementById(n).focus();
		if(document.selection.createRange()!=""){
			document.selection.createRange().text='['+insert+']'+document.selection.createRange().text+'[/'+insert+']';
		}
		else{
			ok=false;
		}
	}
	else{
		var text=document.getElementById(n);
		document.getElementById(n).focus();
		if(text.value.substring(text.selectionStart, text.selectionEnd)!=""){
			text=text.value.substring(0, text.selectionStart)+'['+insert+']'+text.value.substring(text.selectionStart, text.selectionEnd)+'[/'+insert+']'+text.value.substring(text.selectionEnd, text.value.length);
			document.getElementById(n).value=text;
		}
		else{
			ok=false;
		}
	}
    if(!ok){
		var text=prompt(mess,"");
		document.getElementById(n).value+=' ['+insert+']'+text+'[/'+insert+'] ';
		document.getElementById(n).focus();
    }
}

function bb_b(n){
	bb(n,'b','Вставте текст, который должен быть жирным:');
}

function bb_i(n){
	bb(n,'i','Вставте текст, который должен быть наклонным:');
}

function bb_u(n){
	bb(n,'u','Вставте текст, который должен быть подчеркнутым:');
}

function bb_http(n){
	var url=prompt("URL вдрес:","http://");
	if(url.substring(0,7)=='http://' || url.substring(0,6)=='ftp://' || url.substring(0,7)=='ed2k://' || url.substring(0,8)=='https://'){
		var name=prompt("Название ссылки:",url);
		if(name==null){name=url;}
		if(isIE){
			document.getElementById(n).focus();
			document.selection.createRange().text='[url='+url+']'+name+'[/url]'+document.selection.createRange().text;
		}
		else{
			var text=document.getElementById(n);
			document.getElementById(n).focus();
			text=text.value.substring(0, text.selectionStart)+'[url='+url+']'+name+'[/url]'+text.value.substring(text.selectionStart, text.value.length);
			document.getElementById(n).value=text;
		}
	}
}

function bb_email(n){
	var url=prompt("E-mail адрес:","");
	if(url!=null){
		var name=prompt("Название E-mail:",url);
		if(isIE){
			document.getElementById(n).focus();
			document.selection.createRange().text='[email='+url+']'+name+'[/email]'+document.selection.createRange().text;
		}
		else{
			var text=document.getElementById(n);
			document.getElementById(n).focus();
			text=text.value.substring(0, text.selectionStart)+'[email='+url+']'+name+'[/email]'+text.value.substring(text.selectionStart, text.value.length);
			document.getElementById(n).value=text;
		}
	}
}
function add_image(id){
	width=300;
	height=30;
	var iLeft = (screen.width-width )/2;
	var iTop  = (screen.height-height )/2 ;
	
	var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ;
	sOptions += ",width=" + width ;
	sOptions += ",height=" + height ;
	sOptions += ",left=" + iLeft ;
	sOptions += ",top=" + iTop ;

	return window.open('/add/image/?id='+id,'add_image',sOptions ) ;
}

function add_swf(id){
	width=300;
	height=30;
	var iLeft = (screen.width-width )/2;
	var iTop  = (screen.height-height )/2 ;
	
	var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ;
	sOptions += ",width=" + width ;
	sOptions += ",height=" + height ;
	sOptions += ",left=" + iLeft ;
	sOptions += ",top=" + iTop ;

	return window.open('/add/swf/?id='+id,'add_swf',sOptions ) ;
}

function add_ytb(id){
	width=300;
	height=30;
	var iLeft = (screen.width-width )/2;
	var iTop  = (screen.height-height )/2 ;
	
	var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ;
	sOptions += ",width=" + width ;
	sOptions += ",height=" + height ;
	sOptions += ",left=" + iLeft ;
	sOptions += ",top=" + iTop ;

	return window.open('/add/ytb/?id='+id,'add_swf',sOptions ) ;
}

function view_mail(login){
	if(lgn_id==false) return false;
	width=560;
	height=400;
	var iLeft = (screen.width-width )/2;
	var iTop  = (screen.height-height )/2 ;
	
	var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ;
	sOptions += ",width=" + width ;
	sOptions += ",height=" + height ;
	sOptions += ",left=" + iLeft ;
	sOptions += ",top=" + iTop ;

	return window.open('/mail/'+login+'/','mail_'+login,sOptions ) ;
}