var ikony = 0;

function redirect(pulldown) 
{
  newlocation = pulldown[pulldown.selectedIndex].value;
  if (newlocation != "")
    self.location = newlocation;
  return false;
}
function day(d) 
{
  self.location = "#" + d;
  return false;
}
function find_htm()
{
  new_window = window.open("/find.htm", 'findview');
  if (window.focus) new_window.focus();

  //self.location = '/find.htm';
  return false;
}
function propovedi(url)
{
  propurl = 'http://www.omolenko.com/audio/'  + url + '.htm';
  new_window = window.open(propurl, 'propview');
  if (window.focus) new_window.focus();

  //self.location = '/audio/'  + url + '.htm';
  return false;
}
function bible(url)
{
  self.location = '/chapters/' + url + '.htm';
  return false;
}
function bible1(url)
{
  self.location = '/chapters/' + url + '.htm';
  return false;
}
function bible2(url)
{
  self.location = '/bible/bible_quote.php?quote='+url+'#qt';
  return false;
}
function bible3(url)
{
  url = '/bible/bible_quote.php?quote='+url+'#qt';
  new_window = window.open(url, 'bibleview');
  if (window.focus) new_window.focus();
  return false;
}

var upurl,  backurl,  frwdurl;
var uptext, backtext, frwdtext;
function go(dir)
{
  var url;
  url = "";
  if( dir == "back" )
  {
    if( backurl != "" )
      url = "/" + backurl + "#Nav";
  }
  else if( dir == "frwd" )
  {
    if( frwdurl != "" )
      url = "/" + frwdurl + "#Nav";
  }
  else if( dir == "up" )
  { 
    if( upurl != "" ) 
    {
      url = "/" + upurl;
      if( url.indexOf('#') == -1 && upurl != "index.html")
        url = url + "#Nav";
    }
    else
      url = "/index.html";
  }
  else if( dir == "head" )
    url = "#Top";
  else if( dir == "top" )
    url = "#Nav";
  else if( dir == "bot" )
    url = "#Bottom";
  else if( dir == "reserv" )
    ;
  if( url != "" )
    self.location = url;
 return false;
}
function texton(dir)
{ 
  var text = "";
  var t    = "";
  if( dir == "back" )
  {
    if (backurl != "")
      text = backtext;
  }
  else if( dir == "frwd" )
  {
    if (frwdurl != "")
      text = frwdtext;
  }
  else if( dir == "up" )
  {
    if (upurl != "")
    {
      if( upurl != "#" )
        text = uptext;
    }
    else
      text = 'на страницу "Церковь Иоанна Богослова - проповедь всемирного покаяния"';
  }

  if( text != "" )
    t = "Перейти " + text;
  else if( dir == "head" )
    t = 'Перейти к меню - списку рубрик и разделов сайта "Проповедь всемирного покаяния"';
  else if( dir == "top" )
    t = "Перейти в начало текущей страницы";
  else if( dir == "bot" )
    t = "Перейти в конец текущей страницы";
  else if( dir == "print" )
    t = "Печатать текущую страницу";
  else if( dir == "answer" )
    t = 'Положитесь на Промысл Божий и нажмите кнопку "Ответ"';
  else if( dir == "trans" )
    t = "Translate the current web page using Google translate element";
  else if( dir == "find" )
    t = "Поиск по сайту с помощью поисковиков Google, Yandex и локального поисковика";

  dynamic("nav_top", t);
  dynamic("nav_bot", t);
  return false;
}
function texton_m(text)
{ 
  dynamic("nav_top", text);
  dynamic("nav_bot", text);
  return false;
}
function texton_m1(text1)
{ 
  text = "<img src=\"/images/check15.gif\" border=0><img src=\"/images/new.gif\" border=0>&nbsp;&nbsp;&nbsp;" + text1;
  dynamic("nav_top", text);
  dynamic("nav_bot", text);
  return false;
}
function textoff()
{
  dynamic("nav_top", "");
  dynamic("nav_bot", "");
  if(ikony == 1)
    startClock();
  return false;
}
function printview()
{
  var sUrl = document.location.href;
  var nHash = sUrl.indexOf("#");
  var prn = "printview=yes";
	if(sUrl.indexOf("?") == -1)
	  prn = "?" + prn;
	else
	  prn = "&" + prn;
  if(nHash > 0)
    sUrl = sUrl.slice(0,nHash) + prn + sUrl.slice(nHash);
  else
    sUrl += prn;
  window.open(sUrl, 'printview');
//  self.location = sUrl;
  return false;
}
function english()
{
  self.location = "http://www.omolenko.org/index.html";
  return false;
}
function answer()
{
  self.location = "/scripts/GoRandomArticle.php";
  return false;
}
function dynamic(id, text)
{
  if( text != "")
    document.getElementById(id).innerHTML = "<table class=navbox><td align=center valign=middle width=640 height=80>&nbsp;<i>" + text + "</i>&nbsp;</td></table>";
  else
    document.getElementById(id).innerHTML = "<table class=navbox><td align=center valign=middle width=640 height=80><i>" + nav_line + "</i></td></table>";
  return false;
}
var d=window,e=document;
function f(b){
	var a=e.getElementsByTagName("head")[0];
	a||(a=e.body.parentNode.appendChild(e.createElement("head")));
	a.appendChild(b);
}
function loadJs(b){
	var a=e.createElement("script");
	a.type="text/javascript";
	a.charset="UTF-8";
	a.src=b;
	f(a);
}	
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: 'ru',
    includedLanguages: 'be,bg,en,fr,de,el,it,pl,ro,sr,sk,es,uk'
  }, 'google_translate_element');
}
function perevod() {
	document.getElementById("google_t").innerHTML = 
		"<table align=center border=1 cellpadding=0 cellspacing=0 width=200>" +
		"<tr height=80><td align=center><span class=ital8pt>Translator</span>" +
		"<div id=\"google_translate_element\" align=center></div>" +		
		"</td></tr>" +
		"</table>";
		loadJs("http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit");
	self.location = "#Nav";
}

function domRollover() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var imgarr=document.getElementsByTagName('img');
	var imgPreload=new Array();
	var imgSrc=new Array();
	var imgClass=new Array();
	for (i=0;i<imgarr.length;i++){
		if (imgarr[i].className.indexOf('domroll')!=-1){
			imgSrc[i]=imgarr[i].getAttribute('src');
			imgClass[i]=imgarr[i].className;
			imgPreload[i]=new Image();
			if (imgClass[i].match(/domroll (\S+)/)) {
				imgPreload[i].src = imgClass[i].match(/domroll (\S+)/)[1]
			}
			imgarr[i].setAttribute('xsrc', imgSrc[i]);
			imgarr[i].onmouseover=function(){
				this.setAttribute('src',this.className.match(/domroll (\S+)/)[1])
			}
			imgarr[i].onmouseout=function(){
				this.setAttribute('src',this.getAttribute('xsrc'))
			}
		}
	}
}
domRollover();