
aButtons = new Array(6);
iButtons = new Array(6);

for (i = 0; i < aButtons.length; i++) {
	aButtons[i] = new Image();
	iButtons[i] = new Image();
	aButtons[i].src = "pict/b" + i + "_do.gif";
	iButtons[i].src = "pict/b" + i + "_up.gif";
}

endDemo = false;

latText = new Array(
	"Programma perevodit translit v kirillicu",
	"Tekst perevoditsya neposredstvenno v lyubom okne lyuboj drugoj programmy",
	"Kopirovat' perevod iz translyatora ne trebuetsya",
	"Nuzhno prosto nabrat' tekst i nazhat' kombinaciyu klavish dlya perevoda",
	"Programma sama reshaet, kakie chasti teksta perevodit' ne nuzhno",
	"Primer: \"Na software-forumah chasto sporyat lyubiteli Windows i Linux-a\"",
	"Spisok neperevodimyh slov mozhno rasshiryat' i nastraivat'",
	"Pravila transliteracii tozhe nastraivayutsya na lyuboj vkus",
	"Prosto kachajte i probujte. Udachi."

);

cyrTextWin = new Array(
	"Ïðîãðàììà ïåðåâîäèò òðàíñëèò â êèðèëëèöó",
	"Òåêñò ïåðåâîäèòñÿ íåïîñðåäñòâåííî â ëþáîì îêíå ëþáîé äðóãîé ïðîãðàììû",
	"Êîïèðîâàòü ïåðåâîä èç òðàíñëÿòîðà íå òðåáóåòñÿ",
	"Íóæíî ïðîñòî íàáðàòü òåêñò è íàæàòü êîìáèíàöèþ êëàâèø äëÿ ïåðåâîäà",
	"Ïðîãðàììà ñàìà ðåøàåò, êàêèå ÷àñòè òåêñòà ïåðåâîäèòü íå íóæíî",
	"Ïðèìåð: \"Íà software-ôîðóìàõ ÷àñòî ñïîðÿò ëþáèòåëè Windows è Linux-à\"",
	"Ñïèñîê íåïåðåâîäèìûõ ñëîâ ìîæíî ðàñøèðÿòü è íàñòðàèâàòü",
	"Ïðàâèëà òðàíñëèòåðàöèè òîæå íàñòðàèâàþòñÿ íà ëþáîé âêóñ",
	"Ïðîñòî êà÷àéòå è ïðîáóéòå. Óäà÷è."
);

cyrTextKoi = new Array(
	"ðÒÏÇÒÁÍÍÁ ÐÅÒÅ×ÏÄÉÔ ÔÒÁÎÓÌÉÔ × ËÉÒÉÌÌÉÃÕ",
	"ôÅËÓÔ ÐÅÒÅ×ÏÄÉÔÓÑ ÎÅÐÏÓÒÅÄÓÔ×ÅÎÎÏ × ÌÀÂÏÍ ÏËÎÅ ÌÀÂÏÊ ÄÒÕÇÏÊ ÐÒÏÇÒÁÍÍÙ",
	"ëÏÐÉÒÏ×ÁÔØ ÐÅÒÅ×ÏÄ ÉÚ ÔÒÁÎÓÌÑÔÏÒÁ ÎÅ ÔÒÅÂÕÅÔÓÑ",
	"îÕÖÎÏ ÐÒÏÓÔÏ ÎÁÂÒÁÔØ ÔÅËÓÔ É ÎÁÖÁÔØ ËÏÍÂÉÎÁÃÉÀ ËÌÁ×ÉÛ ÄÌÑ ÐÅÒÅ×ÏÄÁ",
	"ðÒÏÇÒÁÍÍÁ ÓÁÍÁ ÒÅÛÁÅÔ, ËÁËÉÅ ÞÁÓÔÉ ÔÅËÓÔÁ ÐÅÒÅ×ÏÄÉÔØ ÎÅ ÎÕÖÎÏ",
	"ðÒÉÍÅÒ: \"îÁ software-ÆÏÒÕÍÁÈ ÞÁÓÔÏ ÓÐÏÒÑÔ ÌÀÂÉÔÅÌÉ Windows É Linux-Á\"",
	"óÐÉÓÏË ÎÅÐÅÒÅ×ÏÄÉÍÙÈ ÓÌÏ× ÍÏÖÎÏ ÒÁÓÛÉÒÑÔØ É ÎÁÓÔÒÁÉ×ÁÔØ",
	"ðÒÁ×ÉÌÁ ÔÒÁÎÓÌÉÔÅÒÁÃÉÉ ÔÏÖÅ ÎÁÓÔÒÁÉ×ÁÀÔÓÑ ÎÁ ÌÀÂÏÊ ×ËÕÓ",
	"ðÒÏÓÔÏ ËÁÞÁÊÔÅ É ÐÒÏÂÕÊÔÅ. õÄÁÞÉ."
);

var cyrText;

allowedHosts = new Array(
	"snapshot.strana.germany.ru",
	"snapshot.strana.de",
	"localhost",
	"vega"
);

if (top != self) {
	allowed = false;
	for (i = 0; i < allowedHosts.length; i++) 
		if (top.location.host == allowedHosts[i]) allowed = true;
	if (!allowed) top.location = self.location;
}

function btn_press(n) {
	window.document.images[n + 1].src = aButtons[n].src;
}

function btn_release(n) {
	window.document.images[n + 1].src = iButtons[n].src;
}

navLinks = new Array(
	"index.html",
	"settings.html",
	"translation.html",
	"changelog.html",
	"download.html",
	"&#109;&#97;&#105;&#108;&#116;&#111;&#58;" + 
		"&#109;&#95;&#101;&#95;&#112;&#95;&#104;" + 
		"&#95;&#105;&#95;&#115;&#95;&#116;&#95;&#111;" + 
		"&#64;&#103;&#109;&#120;&#46;&#110;&#101;&#116;"
);

function create_navbar(n) {
	infoIndex = aButtons.length + 1;
	document.write("<div class=\"navigation\">");
	document.write("<div class=\"logopnl\">");
	document.write("<img src=\"pict/title.jpg\" width=180 height=85>");
	document.write("</div>");
	for (i = 0; i < aButtons.length; i++) {	
		document.write("<div class=\"navbtn\">");
		if (n != i) document.write("<a href=\"" + navLinks[i] + 
			"\" OnMouseOver=\"btn_press(" + i + 
			")\" OnMouseOut=\"btn_release(" + i + ")\">");
		if (n != i) str = "up";
			else str = "do";
		document.write("<img src=\"pict/b" + i + "_" + str + ".gif\"" +  
			"width=180 height=43 border=0>");
		if (n != i) document.write("</a>");
		document.write("</div>");
	}
	document.write("<div class=\"infopnl\">");
	document.write("<img src=\"pict/pnl_error.jpg\" width=180 height=160>");
	document.write("<img src=\"http://snapshot.strana.germany.ru" + 
		"/translator/pict/pnl_info.jpg\""); 
	document.write("width=1 height=1 onLoad=\"document.images[" + 
		infoIndex + "].src=this.src\">");
	document.write("</div></div>");
}

function startDemo() {
	// if (navigator.platform == "Win32") cyrText = cyrTextWin;
    cyrText = cyrTextKoi;
	setTimeout("printLatText(0)", 1500);
}

function printLatText(w) {
	if (!endDemo) {
		if (w >= latText.length) w = 0;
		document.frmDemo.txtDemo.value = "";
		printLetter(w, 0);
	}
}

function printLetter(w, i) {
	word = latText[w];
	if (i < word.length) {
		document.frmDemo.txtDemo.value =
			document.frmDemo.txtDemo.value + word.charAt(i);
		i++;
		setTimeout("printLetter(" + w + "," + i + ")", 100);
	}
		else setTimeout("selectText(" + w + ")", 600);
}

function printCyrText(w) {
	document.frmDemo.txtDemo.value = cyrText[w];
	w++;
	setTimeout("printLatText(" + w + ")", 5000);
}

function selectText(word) {
	document.frmDemo.txtDemo.select();
	setTimeout("printCyrText(" + word + ")", 150);
}

function stopDemo() {
	document.frmDemo.style.visibility = "hidden";
	endDemo = true;
}

