uaVers=''
if (window.navigator.userAgent.indexOf ("Opera")>0){
	ua = 'Opera';
	uaVers=window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("Opera")+6,4);
}else if(window.navigator.userAgent.indexOf ("Gecko") > 0){
	ua = 'Netscape';
	uaVers=window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("Gecko")+6,8)+ ' ('+ window.navigator.userAgent.substr(8,3) + ')';
}else if(window.navigator.userAgent.indexOf ("MSIE")>0){
   ua = 'Explorer';
   uaVers=window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("MSIE")+5,3);
}else{
	ua = window.navigator.appName;
}

function FormatText(command, option){
	frames.message.focus();			
  	frames.message.document.execCommand(command, false, option);
  	frames.message.focus();
}


function AddImage(){	
	frames.message.focus();			
	imagePath = prompt('Укажите адрес изображения', 'http://');				
	if ((imagePath != null) && (imagePath != "")){					
		frames.message.document.execCommand('InsertImage', false, imagePath);
  		frames.message.focus();
	}
	frames.message.focus();			
}
function AddImage2(imagePath){	
		frames.message.focus();			
		frames.message.document.execCommand('InsertImage', false, 'http://www.fidep.ru/i/smiles/'+imagePath);
  		frames.message.focus();
		frames.message.focus();			
}

function ShowNormal(){
	this.document.getElementById("graf1").style.display = 'none';
	this.document.getElementById("graf2").style.display = 'block';
}

function tcolor1(){
	document.all.Colors.style.display='block';
}
function tcolor2(){
	document.all.Colors.style.display='none';
}
function tsmiles1(){
	document.all.smiles.style.display='block';
}
function tsmiles2(){
	document.all.smiles.style.display='none';
}

function gonext()
{
		if(ua!='Netscape'){
			NewHTML = frames.message.document.body.innerHTML;
			document.Add.textblog.value = NewHTML;	
		}else{
			document.Add.textblog.value = document.getElementById("NMH").value;	
		}
		window.document.Add.submit();
}

function add_bookmark() 
{
	if (typeof(document.all) != 'undefined')
	{
		this.window.external.AddFavorite('http://kinoport.net', 'Kinoport.net - телепрограмма, анонсы фильмов, знаменитости, новости кино.');
	}
return false;
}
function set_homepage(ref)
{
	if (typeof(document.all) != 'undefined')
	{
		ref.style.behavior = 'url(#default#homepage)';
		ref.setHomePage('http://kinoport.net');
	}
return false;
}


var strErr;
var strE;
var strtemp;
function FSubmit()
{
	strtemp = "0";
	strErr = "";
	strE = "0";
	if ((document.regform.login.value.length < 3))
	{
		this.document.getElementById("formlog").style.display='block';
		strE = '1';
	}

	if ((document.regform.password.value.length < 6))
	{
		this.document.getElementById("formpass").style.display='block';
		strE = '1';
	}
	
	if (document.regform.conf.value != document.regform.password.value)
	{
		this.document.getElementById("formconf").style.display='block';
		strE = '1';
	}

	if (document.regform.alt_mail.value.length<3)
	{
		this.document.getElementById("formemail").style.display='block';
		strE = '1';
	}
	
	return strE;
}


function goreg()
{
	this.document.getElementById("formemail").style.display='none';
	this.document.getElementById("formlog").style.display='none';
	this.document.getElementById("formpass").style.display='none';
	this.document.getElementById("formconf").style.display='none';

  if (FSubmit() == '1'){
	strErr = "";
	return;
  }else if(FSubmit() == '0'){
  	return document.regform.submit();
  }
 ;
}

function onmover(id){
	for(i=1;i<=8;i++){
		if(id!=i){
			document.getElementById("menu"+i).className = "men1"; 
			this.document.getElementById("showmenu"+i).style.display='none';
		}else{
			document.getElementById("menu"+i).className = "men2"; 
			this.document.getElementById("showmenu"+i).style.display='block';
		}
	}
}
function onmover2(id,classes){
	id.className = classes; 
}

function showlog(){
	this.document.getElementById("searchform").style.display='none';
	this.document.getElementById("loginform").style.display='block';
}
function showlog2(){
	this.document.getElementById("commloginform").style.display='block';
}
function nick(auth){
	authnew = this.document.getElementById(auth).innerHTML;
	if(ua=='Netscape'){
			oldtext = document.getElementById("NMH").value;
			if(oldtext!=""){
					newtext = oldtext+'[b]'+authnew+'[/b], ';
			}else{
					newtext = '[b]'+authnew+'[/b], ';
			}
			document.getElementById("NMH").value = newtext;
			document.getElementById("NMH").focus();
			
}else{
			if(frames.message.document.body.innerHTML!=""){
				frames.message.document.body.innerHTML = frames.message.document.body.innerHTML+'<p><strong>'+authnew+'</strong>, ';
			}else{
				frames.message.document.body.innerHTML = '<strong>'+authnew+'</strong>, ';
			}
			frames.message.document.body.focus();
	}
			
}

function post(auth,author){
	authnew = this.document.getElementById(auth).innerHTML;
	author =  this.document.getElementById(author).innerHTML;
	if(ua=='Netscape'){
			oldtext = document.getElementById("NMH").value;
			if(oldtext!=""){
					newtext = oldtext+'[cite]'+authnew+'[/cite], ';
			}else{
					newtext = '[cite]'+authnew+'[/cite], ';
			}
			document.getElementById("NMH").value = newtext;
			document.getElementById("NMH").focus();
			
}else{
			if(frames.message.document.body.innerHTML!=""){
				frames.message.document.body.innerHTML = frames.message.document.body.innerHTML+'<fieldset><legend>'+author+'</legend><p>'+authnew+'</fieldset>';
			}else{
				frames.message.document.body.innerHTML = '<fieldset><legend>'+author+'</legend><p>'+authnew+'</fieldset>';
			}
			frames.message.document.body.focus();
	}
			
}

