function hvr(el) {
    el.className='hover';
}

function uhvr(el) {
    el.className='';
}

function ShowHideBottomText(el)
{
  document.getElementById('bottom_text_'+el).style.display = document.getElementById('bottom_text_'+el).style.display != 'none' ? 'none' : 'block';
  document.getElementById('arrow_left_'+el).src = document.getElementById('bottom_text_'+el).style.display != 'none' ? '/images_new/icons/double-arrow-top-gray.gif' : '/images_new/icons/double-arrow-down-gray.gif';
  document.getElementById('bg_'+el).style.background = document.getElementById('bottom_text_'+el).style.display != 'none' ? 'url(/images_new/icons/double-arrow-top-gray.gif) no-repeat 627px 7px' : 'url(/images_new/icons/double-arrow-down-gray.gif) no-repeat 627px 7px';
}

//---------------------------------------
function resizeWindowToFit( elementName) 
{
	var pc = document.getElementById(elementName);	
	if (window.innerWidth)
    {
		iWidth = window.innerWidth;		
		iHeight = window.innerHeight;		
	}
        else
    {
		iWidth = document.body.clientWidth;
		iHeight =document.body.clientHeight;
	}
	window.resizeBy(pc.offsetWidth-iWidth,pc.offsetHeight-iHeight);
}

function showMore(url, width, height, scroll, name, noreturn) {
  var winName = (typeof(name)!='undefined' ? name : "PopUpWin");
  var leftScreen=50;
  var topScreen=10;
  winStats='toolbar=no,location=no,directories=no,menubar=no,';
  if(scroll) winStats+='scrollbars=yes,resizable=yes,'
    else winStats+='scrollbars=no,resizable=no,';
  winStats+='width='+width+',height='+height;
  winStats+=',left='+leftScreen+',top='+topScreen;
  PopUpWin=window.open(url, winName, winStats);
  PopUpWin.focus();                                         
  if (!noreturn)
  	return (typeof(PopUpWin) != 'object');
} 

//--- field hints

function formHints(frm, activeColor, hintColor) {
	this.frm = frm;
	this.activeColor = activeColor;
	this.hintColor = hintColor;
	this.add = formHints_add;	
	this.init = formHints_show;      
	if (this.frm.onsubmit) {
		frmonsub = this.frm.onsubmit;
		this.frm.onsubmit = function() {frmonsub(); formHints_clear(frm);}
	} else {                
		this.frm.onsubmit = function() {formHints_clear(frm);}
	}
}       

function formHints_add(el, msg, activeColor, hintColor) {
	hcol = hintColor?hintColor:this.hintColor;
	acol = activeColor?activeColor:this.activeColor;
	if (typeof(el)!='object') {               
		var elm = this.frm.elements[el]?this.frm.elements[el]:document.getElementById(el);
		if (elm) {
			elm.onfocus = function() { formHints_clearHint(elm, msg, acol); }
			elm.onblur = function() { formHints_showHint(elm, msg, hcol); }
		}
	} else {
		var elm = el;
		elm.onfocus = function() { formHints_clearHint(elm, msg, acol); }
		elm.onblur = function() { formHints_showHint(elm, msg, hcol); }
	}                  
	formHints_showHint(elm, msg, hcol);
}

function formHints_showHint(h_el, h_val, h_col) {
	if (h_el.value == '') {
		h_el.value = h_val;     
		h_el.style.color = h_col;
	}
}

function formHints_clearHint(h_el, h_val, h_col) {
	if (h_el.value == h_val) {
		h_el.value = '';      
		h_el.style.color = h_col;
	}
}  

function formHints_show(frm) {
	for (i=0; i<frm.elements.length; i++) {
		if (frm.elements[i].onblur) {
			frm.elements[i].onblur();
		}
	}
}

function formHints_clear(frm) {
	for (i=0; i<frm.elements.length; i++) {
		if (frm.elements[i].onfocus) {      
			frm.elements[i].onfocus();
		}
	}
}

// Inkaso z uctu
function kodBankyChange(kod, banka)
{
  var banky = new Array(
    new Array('0200', 'Všeobecná úverová banka, a.s.'),
    new Array('0900', 'Slovenská sporiteľňa, a.s.'),
    new Array('0720', 'Národná banka Slovenska'),
    new Array('1100', 'Tatra banka, a.s.'),
    new Array('1111', 'UniCredit Bank, a.s.'),
    new Array('3000', 'Slovenská Záručná a Rozvojová Banka, a.s.'),
    new Array('3100', 'Volksbank Slovensko, a.s.'),
    new Array('5200', 'OTP Banka Slovensko, a.s.'),
    new Array('5600', 'Dexia banka Slovensko a. s.'),
    new Array('5900', 'Prvá stavebná sporiteľňa, a. s.'),
    new Array('6500',	'Poštová banka, a.s.'),
    new Array('7300', 'ING bank n.v.'),
    new Array('7500', 'ČSOB'),
    new Array('7930',	'Wüstenrot stavebná sporitelňa, a.s.'),
    new Array('8020',	'Calyon Bank Slovakia a.s.'),
    new Array('8050', 'Commerzbank AG.'),
    new Array('8100', 'Komerční banka Bratislava, a.s.'),
    new Array('8120', 'Privatbanka, a.s.'),
    new Array('8130', 'Citibank'),
    new Array('8160', 'Eximbanka SR'),
    new Array('8170', 'ČSOB stavebná sporiteľňa, a.s.'),
    new Array('8180', 'Štátna pokladnica'),
    new Array('8300', 'HSBC Bank plc'),
    new Array('8320', 'J&T Banka, a.s'),
    new Array('8330', 'Fio, sporiteľné družstvo, organizačná zložka zahr. osoby'),
    new Array('8350', 'The Royal Bank od Scotland N.V., pobočka zahraničnej banky'),
    new Array('8360', 'BRE Bank S.A., pobočka zahraničnej banky v Slovenskej republike'),
    new Array('8370', 'Oberbank AG, pobočka zahraničnej banky'),
    new Array('8410', 'Zuno Bank AG, pobočka zahraničnej banky')
    );
  
  var foundBank = false;
  for (i = 0; i < banky.length; i++)
  {
    if (banky[i][0] == kod.value)
    {
      document.getElementById(banka).value = banky[i][1];
      document.getElementById(banka).style.color = '#000';
      var foundBank = true;
    }
  }
  if (!foundBank)
  {
    document.getElementById(banka).value = '';
    if (kod.value != '')
    {
      domTT_activate(null, null, 'type', 'sticky', 'caption', 'Chyba', 'content', 'Zadajte správny kód banky.', 'southwest', 'width', 300, 'height', 0);
    }
  }
}

