plus=32;
if (navigator.userAgent.indexOf("MSIE 6")>0) {
	plus=72;
} else {
	if (navigator.userAgent.indexOf("MSIE")>0) plus=98;
	if (navigator.appName=="Opera") plus=56;
	if (navigator.appName=="Netscape") plus=62;
}

function TextToFrame() {
	var F5=top.Frame5.document;
	if (F5.getElementById('Text1').style.display!="none") {
		try {
			F5.getElementById('Text1').contentWindow.focus();
			F5.getElementById('Text1').contentWindow.document.body.innerHTML=F5.getElementById('Text').value;
		} catch(e) {
			setTimeout("TextToFrame()", 0);
		}
	} else {
		F5.getElementById('Text').focus();
	}
}

function FrameToText() {
	var F5=top.Frame5.document;
	if (F5.getElementById('Text1').style.display!="none") {
		F5.getElementById('Text').value=F5.getElementById('Text1').contentWindow.document.body.innerHTML;
		top.Frame5.Text1.focus();
	}
}

function FrameTextToText() {
	var F5=top.Frame5.document;
	if (F5.getElementById('Text1').style.display!="none") {
		F5.getElementById('Text').value=F5.getElementById('Text1').contentWindow.document.body.innerText;
	}
}

function SF5(i,j,k) {
	var F5=top.Frame5.document;
	F5.getElementById('keyNicIn').value=i;
	F5.getElementById('NameNicIn').value=j;
	F5.getElementById('SendPrivate').value=j;
	F5.getElementById('Text').value=j+': ';
	if (k!="") {F5.getElementById('SendPrivate').style.color=k};
	TextToFrame();
}

function SF5N(i,j,k) {
	var F5=top.Frame5.document;
	F5.getElementById('keyNicIn').value=i;
	F5.getElementById('NameNicIn').value=j;
	F5.getElementById('SendPrivate').value=j;
	F5.getElementById('Text').value=j+': ';
	//if (k!="") {F5.getElementById('SendPrivate').style.color=k};
	TextToFrame();
}

function DT(i) {
	FrameToText();
	top.Frame5.document.getElementById('Text').value+=" "+i+" ";
	TextToFrame();
}

function wall(){
	var doc1=top.Frame1.document;
	var doc4=top.Frame4.document;
	var F5=top.Frame5.document;
	try {
		if (F5.getElementById('wall').value=="on") {
			if (doc4.getElementById('d2')) doc4.getElementById('d2').style.background=F5.getElementById('WallPaper').value;
			doc1.getElementById('d2').style.background=F5.getElementById('WallPaper').value;
		} else {
			if (doc4.getElementById('d2')) doc4.getElementById('d2').style.background=F5.getElementById('c4').value;
			doc1.getElementById('d2').style.background=F5.getElementById('c1').value;
		}
		top.Frame3.document.body.style.background=F5.getElementById('c3').value;
	} catch(e) {
		//
	}
}

function focusf5() {
	if (top.Frame5.Text1.document.designMode) {
		top.Frame5.document.getElementById('Text1').contentWindow.focus();
        } else {
		top.Frame5.document.getElementById('Text').focus();
	}
}

function blog() {
	var F5=top.Frame5.document;
	i=F5.getElementById('keyNic').value;
	j=F5.getElementById('Pass1').value;
	myBlog = open("http://blog.vulcan.ru/IN/"+i+"/"+j,"blog");
        if (myBlog.opener == null) myBlog.opener = self;
	myBlog.focus();
}

function checkit() {
	var F5=top.Frame5.document;
	if (F5.getElementById('keyNic').value==0) {
		alert("Гость не может отправлять сообщения!");
		return(false);
	}
	if (F5.getElementById('Text').value=="") {
		alert("Вы не ввели текст сообщения!");
		return(false);
	}		
	return(true);
}

//------------------

function over(id) { 
    if (document.getElementById) document.getElementById(id).src = gif[id].src; 
} 

function out(id) { 
    if (document.getElementById) document.getElementById(id).src = gif[id].src; 
} 

function Pas(url,name){
	myPas=window.open(url,name,'top=122,left=122,width=640,height=600');
	myPas.focus();
}

function Status(url,name){
	myPas=window.open(url,name,'top=122,left=122,width=720,height=632');
	myPas.focus();
}

function Status2(){
	//url="../wl/nph-mgwcgi?MGWAPP=AJAX&Pr=status&keyNic="+top.Frame5.document.getElementById('keyNic').value;
	url="/Ajax/status&keyNic="+top.Frame5.document.getElementById('keyNic').value;
	myPas=window.open(url,'Status','top=122,left=122,width=680,height=600');
	myPas.focus();
}

function russian(){
	FrameTextToText();
	var mess=top.Frame5.document.getElementById('Text').value;
	lit_rus = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя,\"?;:?."; 
	lit_eng = "F<DULT~:PBQRKVYJGHCNEA{WXIO}SM\">Zf,dult`;pbqrkvyjghcnea[wxio]sm'.z?@#$^&/"; 
	var message = new String(mess);
	var st = new String();  
	for(var i=0; i < 17 ; i++) {if(mess.charAt(i) == ":") {var j = i+1}}
	for(var i = 0; i < mess.length; i++) {
		if (i < j) {
			st += mess.charAt(i);
		} else {
			if((t = lit_eng.indexOf(message.charAt(i))) == -1) {
				st += message.charAt(i);
			} else {
				st += lit_rus.charAt(t);
			}
		}
	}
	top.Frame5.document.getElementById('Text').value=st;
	TextToFrame();
}

function Smile(i) {
	if (i==5) {
		top.Frame5.document.getElementById('Pr').value="LoveSmile";
		openWinS("../Ajax-Win.shtml","smail");
	} else {
		var F5=self.document;
		if (F5.getElementById('MsgSmile').value!="") {
			if (i==0) {
				myWinS.close();
			} else {
				openWinS("smiles"+i+".html","smail");
			}
		} else {
			if (i==0) {
				F5.getElementById('SS').style.display = "";
				F5.getElementById('ifSmail').style.display = "none";
			} else {
				F5.getElementById('ifSmail').style.display = "";
				F5.getElementById('ifSmail').src="smiles"+i+".html";
				F5.getElementById('SS').style.display = "none";
			}
		}
	}
}

function openWinS(url,p){
	myWinS = open(url,p,"width="+(screen.width-424)+",height="+(screen.height-376)+",top=60,left=380,scrollbars,toolbar,resizable");
	if (myWinS.opener == null) myWinS.opener = self;
	myWinS.focus();
}

function openPopup(txt,time,he) {
	try {
		var myPopup = '';
		var w = screen.width;
		var h = screen.height;
		myPopup = window.open('','popupWindow','height='+he+',top='+((h-he)/2)+',left='+((w-400)/2)+',width=520');
		myPopup.document.writeln("<html><head><title>... "+txt+"</title>");
		myPopup.document.writeln("<meta http-equiv='Content-Type' content='text/html; charset=windows-1251'>");
		myPopup.document.writeln("<SCRIPT language=JavaScript><!--");
		myPopup.document.writeln("setTimeout('self.close();',"+time+");");
		myPopup.document.writeln("//--></SCRIPT>");
		myPopup.document.writeln("</head><body style='background:#e3e3e3; text-align:right; margin:4;'>");
		myPopup.document.writeln("<img src=../vulcan2.gif align=left><span style='font:12px/12px arial;'>"+(time/1000)+" секунды &#8213; и окно само закроется...</span>");
		myPopup.document.writeln("<p style='text-align:center; color:maroon; font:bold 11pt arial; margin:18 0 0 0;'>"+txt);
		myPopup.document.writeln("</body></html>");
		myPopup.document.close();
		myPopup.focus();
	} catch(e) {
		//
	}
}

function openWin(url,p){
	myWin = open(url,p,"width="+(screen.width-120)+",height="+(screen.height-120)+",top=0,left=0,scrollbars,toolbar,resizable,location,status");
	myWin.focus();
}

function counts() {
	var f5=top.Frame5.f5;
	f5.Pr.value="counts";
	f5.target="Frame1";
}

function openWin0(url){
	myWin0=open(url,"_parent");
}

function openWinPic(url, title){
	nw=window.open('','foto','top=34,left=0,width=640px,height=480px,resizable');
	nw.document.writeln("<html><head><title>" + title + "</title>");
	nw.document.writeln("</head>");
	nw.document.writeln("<body style='padding:0; margin:0;' onLoad='resizeTo(kart.width+10,kart.height+"+plus+");'>");
	nw.document.writeln("<img src='"+url+"' name='kart' id='kart'>");
	nw.document.writeln("</body></html>");
	nw.document.close();
	nw.focus();
}

function notOpen(){
	alert("Извините, просмотр фотографий полного размера доступен только после входа в чат...");
}

function show12() {
	var ShowStat = top.Frame5.document.getElementById('ShowStat').value;
	if (ShowStat == 1) {
		document.getElementById('show12img').src = "uparrow.png";
		document.getElementById('show1').style.display = "none";
		document.getElementById('show2').style.display = "none";
		top.Frame5.document.getElementById('ShowStat').value = 0;
          } else {
		document.getElementById('show12img').src = "downarrow.png";
		document.getElementById('show1').style.display = "inline";
		document.getElementById('show2').style.display = "inline";
		top.Frame5.document.getElementById('ShowStat').value = 1;
          }
}

