function Hodiny(s)
{
    var runTime = new Date();
    var hours = runTime.getHours();
    var minutes = runTime.getMinutes();
    var seconds = runTime.getSeconds();
    var mz = "";
    if (hours > 12) {
      mz = "";
    }
    if (hours == 0) {
      hours = 0;
    }
    if (hours <= 9) {
      hours = "0" + hours;
    }
    if (minutes <= 9) {
      minutes = "0" + minutes;
    }
    if (seconds <= 9) {
      seconds = "0" + seconds;
    }
    if (s) seconds = ":" + seconds;
    else seconds = " " + seconds;
    document.getElementById("hodiny").innerHTML = "<font class='cas'>" + hours + ":" + minutes + "</font><font class='sekundy'>" + seconds + "</font>";
    if (s) window.setTimeout("Hodiny(1)", 1000);
    else window.setTimeout("Hodiny(0)", 1000);
}
  
function verify()
{
	document.register.user1.value="";
	document.register.password1.value="";
	document.register.password_verify1.value="";
	document.register.profesia1.value="";
	document.register.tel1.value="";
	if (document.register.user_bp.value == "") 
	{document.register.user1.value="NEZADANÉ";
	document.register.user_bp.focus();
	return false;};
	if (document.register.password_bp.value == "")
	{document.register.password1.value="NEZADANÉ";
	document.register.password_bp.focus();
	return false;};
	if (document.register.password_verify_bp.value != document.register.password_bp.value)
	{document.register.password_verify1.value="NESPRÁVNE";
	document.register.password_verify_bp.focus();
	return false;};
	if (document.register.profesia.value == "")
	{document.register.profesia1.value="NEZADANÉ";
	document.register.profesia.focus();
	return false;};
	if (document.register.tel.value == "")
	{document.register.tel1.value="NEZADANÉ";
	document.register.tel.focus();
	return false;};
	return true;
}

function name_image(full_name)
{
	path_array = full_name.split("/");
	return path_array[path_array.length - 1];
}

function rozbal_menu()
{
	if (document.styleSheets[2].rules[0].style.display=="none")
	{document.styleSheets[2].rules[0].style.display="block";}
	else
	{document.styleSheets[2].rules[0].style.display="none";}
}

function rozbal_menu_historia()
{
	if (document.styleSheets[3].rules[0].style.display=="none")
	{document.styleSheets[3].rules[0].style.display="block";}
	else
	{document.styleSheets[3].rules[0].style.display="none";}
}

function rozbal_menu_kultura()
{
	if (document.styleSheets[4].rules[0].style.display=="none")
	{document.styleSheets[4].rules[0].style.display="block";}
	else
	{document.styleSheets[4].rules[0].style.display="none";}
}

function rozbal_menu_sport()
{
	if (document.styleSheets[5].rules[0].style.display=="none")
	{document.styleSheets[5].rules[0].style.display="block";}
	else
	{document.styleSheets[5].rules[0].style.display="none";}
}

function rozbal_menu_doprava()
{
	if (document.styleSheets[6].rules[0].style.display=="none")
	{document.styleSheets[6].rules[0].style.display="block";}
	else
	{document.styleSheets[6].rules[0].style.display="none";}
}

function verify_inz()
{
	if(document.register.text.value=="")
	{window.alert("Nezadali ste text inzerátu!");
	document.register.text.focus();
	return false;}
	if(document.register.kontakt.value=="")
	{window.alert("Nezadali ste kontakt!");
	document.register.kontakt.focus();
	return false;}
	sumar = "Zadali ste tieto údaje\n\n";
	sumar += "Kategória: " + kaa[document.register.kategoria_inz_for_add.value] + "\n\n";
	sumar += "Predaj: " + paa[document.register.predaj.value-1] + "\n\n";
	sumar += "Text: " + document.register.text.value + "\n\n";
	sumar += "Kontakt: " + document.register.kontakt.value + "\n\n";
	sumar += "Trvanie: " + document.register.do_x.value + " dní\n\n\n";
	sumar += "Sú údaje v poriadku? \n";
	if(window.confirm(sumar))
	{return true;}
	return false;
}

function verify_f()
{
	if(document.getElementById("reg_f").firma.value=="")
	{window.alert("Nezadali ste firmu");
	document.getElementById("reg_f").firma.focus();
	return false;}
	if (document.getElementById("reg_f").password_1.value.length < 4)
	{
		window.alert("Krátke heslo");
		document.getElementById("reg_f").password_1.focus();
		return false;
	}
	if (document.getElementById("reg_f").password_1.value=="")
	{
		window.alert("Nezadali ste heslo");
		document.getElementById("reg_f").password_1.focus();
		return false;
	}
	
	if (document.getElementById("reg_f").password_verify.value != document.getElementById("reg_f").password_1.value)
	{
		window.alert("Zlá verifikácia");
		document.getElementById("reg_f").password_verify.focus();
		return false;
	}
	
	if (document.getElementById("reg_f").adresa.value == "")
	{
		window.alert("Nezadali ste adresu");
		document.getElementById("reg_f").adresa.focus();
		return false;
	}
	
	if (document.getElementById("reg_f").ico.value == "")
	{
		window.alert("Nezadali ste IČO!");
		document.getElementById("reg_f").ico.focus();
		return false;
	}
	return true;
}

function verify_mail()
{
	if(linka.text.value=="")
	{
		window.alert("Nenapísali ste text správy");
		return false;
	}
	return true;
}

function openfoto(theURL,winName,features)
{ //v2.0
	window.open(theURL,winName,features);
}

function verify_reg()
{
	if((!document.getElementById("register").oznamy.checked)&&(!document.getElementById("register").majetok.checked)&&(!document.getElementById("register").noviny.checked)&&(!document.getElementById("register").invest.checked)&&(!document.getElementById("register").kultura.checked))
	{
		window.alert("Neoznačili ste žiadnu oblasť !");
		return false;
	}
	if(document.getElementById("register").adresa.value=="" || document.getElementById("register").adresa.value.indexOf("@")== -1 || document.getElementById("register").adresa.value.length < 7 || document.getElementById("register").adresa.value.indexOf(".")== -1)
	{
		window.alert("Nie je mailová adresa");
		return false;
	}
	return true;
}

function verify_del()
{
	if(document.register.adresa.value=="")
	{
		window.alert("Nezadali ste adresu !");
		return false;
	}
	return true;
}

function verify_find()
{
	if(document.uznes.uznesenie.value=="")
	{
		if(document.uznes.text.value=="")
		{
			window.alert("Nezadali ste text");
			return false;
		}
	}
	return true;
}

function finder_verify()
{
	if(document.sucher.text.value=="")
	{
		window.alert("Nezadali ste text!");
		document.sucher.text.focus();
		return false;
	}
	return true;
}

function verify_uprav_prace()
{
	document.register.profesia1.value="";
	document.register.tel1.value="";
	if (document.register.profesia.value == "")
	{document.register.profesia1.value="NEZADANÉ";
	document.register.profesia.focus();
	return false;};
	if (document.register.tel.value == "")
	{document.register.tel1.value="NEZADANÉ";
	document.register.tel.focus();
	return false;};
	return true;
}

function show_alert() {
	window.alert('Nepodarilo sa otvoriť nové okno. Akcia nemôže pokračovať.\nSkúste zmeniť nastavenie prehliadača.');
}

function noviny()
{
	var nove_okno;
	if (nove_okno = window.open('','NOVINY','scrollbars=no,resizable=no,toolbar=no,width=560,height=420')){
		nove_okno.document.write("<html>");
		nove_okno.document.write("<head>");
		nove_okno.document.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1250\">");
		nove_okno.document.write("<LINK rel=\"StyleSheet\" type=\"text/css\" href=\"_main.css\">");
		nove_okno.document.write("<title>Zvolenské noviny</title>");
		nove_okno.document.write("</head>");
		nove_okno.document.write("<body align=\"center\">");
		nove_okno.document.write("<table width=\"550\" cellspacing=\"0\" cellpadding=\"0\" height=\"380\">");
		nove_okno.document.write("<tr>");
		nove_okno.document.write("<td class=\"table_body\" style=\"border:0\" width=\"100%\">");
		nove_okno.document.write("<p align=\"center\"><img border=\"0\" src=\"images/noviny_big.gif\" width=\"550\" height=\"107\"><br>");
		nove_okno.document.write("<br><b>Týždenník mesta Zvolen</b><br><br>");
		nove_okno.document.write("• vychádza každý utorok v týždni • cena 8,50 Sk<br><br>");
		nove_okno.document.write("Adresa redakcie: Nám. slobody 22, 960 01 Zvolen (budova Mestského úradu, 3. poschodie)</p>");
		nove_okno.document.write("<p style=\"margin-left: 15; margin-right: 15\"><b>KONTAKTY:<br></b><br>");
		nove_okno.document.write("<b>");
		nove_okno.document.write("Andrea Bačová, šéfredaktorka,&nbsp;</b><br>");
		nove_okno.document.write("-	tel.: 045/5479 891, 5321 266, kl. 221, fax: 045/5479 891, 5335 992<br>");
		nove_okno.document.write("<b>Ľuba Mojžišová, zástupkyňa šéfredaktorky,&nbsp;</b><br>");
		nove_okno.document.write("-	tel.: 045/5479 891, 5321 266, kl. 285&nbsp;<br>");
		nove_okno.document.write("<b>Martin Mázor, redaktor</b><br>");
		nove_okno.document.write("-	tel.: 045/5479 891, 5321 266, kl. 285<br>");
		nove_okno.document.write("<b>Iveta Mituchovičová, inzercia, administratíva</b><br>");
		nove_okno.document.write("-	tel.: 045/5479 891, 5321 266, kl. 285, fax: 045/5479 891, 5335 992&nbsp;<br><br>");
		nove_okno.document.write("E-mail: <a href=\"mailto:spravca@zv.psg.sk\">spravca@zv.psg.sk<br></a>");
		nove_okno.document.write("");
		nove_okno.document.write("</td>");
		nove_okno.document.write("</tr>");
		nove_okno.document.write("</table>");
		nove_okno.document.write("</body>");
		nove_okno.document.write("</html>");
	}
	else show_alert();
}

download_flag = 0;

function collapse_menu(x,flag_obr)
{
	var menu = document.getElementById("Out" + x + "d");
	if (menu.style.display == "none")
	menu.style.display = "block";
	else menu.style.display = "none";
	if (flag_obr)
	{
		var obr = document.getElementById("Out" + x);
		if (name_image(obr.src) == "grayplus.gif")
		obr.src = document.location.pathname.substr(0,document.location.pathname.indexOf('admin')) + "images/grayminus.gif";
		else obr.src = document.location.pathname.substr(0,document.location.pathname.indexOf('admin')) + "images/grayplus.gif";
	}
}

function collapse_kat(x,flag_obr) {
	var menu = document.getElementById("Kat_" + x + "d");
	if (menu.style.display == "none") {
		var all_kategories = document.getElementsByTagName("table");
		for (x=0;x<all_kategories.length;x++) {
			if (all_kategories[x].id.substr(0,4) == "Kat_") {
				all_kategories[x].style.display = "none";
			}
		}
		menu.style.display = "block";
	}
	else menu.style.display = "none";
	if (flag_obr) {
		var obr = document.getElementById("Kat_" + x);
		if (name_image(obr.src) == "grayplus.gif")
		obr.src = "images/grayminus.gif";
		else obr.src = "images/grayplus.gif";
	}
}

function is_regular_mail(mail_adresa)
{
	if(mail_adresa=="" || mail_adresa.indexOf("@")== -1 || mail_adresa.length < 7 || mail_adresa.indexOf(".")== -1)
	{
		return false;
	}
	return true;
}

function resize_window(x,y) {
	if (x + 30 > screen.availWidth) x = screen.availWidth - 30;
	if (y + 70 > screen.availHeight) y = screen.availHeight - 70;
	window.resizeTo(x,y);
}

function update_bottom_special_position() {
	var bsp = document.getElementById('special_bottom');
	var top_position;
	if (_mozilla) {
		top_position = window_height() - bsp.offsetHeight + window.scrollY;
	}
	else {
		if (_ie6) {
			top_position = document.documentElement.clientHeight - bsp.offsetHeight + document.documentElement.scrollTop;
		}
		else if (_ie55 || _ie50) {
			top_position = document.body.clientHeight - bsp.offsetHeight + document.body.scrollTop;
		}
	}
	bsp.style.top = top_position + 'px';
}
var _password_verify_error;
var _login_verify_error;
permitted_chars = new Array("+","*","/",",",":",".","'",";","&","\"","\\"," ");
function in_array(string,array) {
	if (array.toString().indexOf(string) == -1) return false;
	else return true;
}
function has_permitted_chars(text) {
	var navrat = false;
	for (var x=0;x<text.length;x++) {
		if (in_array(text.substr(x,1),permitted_chars)) navrat = true;
	}
	return navrat;
}
function password_verify_insert(password,password_verify,min_length) {
	var navrat = false;
	if (!has_permitted_chars(password)) {
		if (password.length >= min_length) {
			if (password == password_verify) navrat = true; else _password_verify_error = 'Heslo a jeho potvrdenie sa nezhodujú';
		}
		else _password_verify_error = 'Heslo je kratšie ako minimálna povolená dĺžka';
	}
	else _password_verify_error = 'Heslo obsahuje zakázané znaky';
	return navrat;
}
function verify_login(login,min_length) {
	navrat = false;
	if (!has_permitted_chars(login)) {
		if (login.length >= min_length) navrat = true; else _login_verify_error = 'Meno je kratšie ako minimálna povolená dĺžka';
	}
	else _login_verify_error = 'Meno obsahuje nepovolené znaky';
	return navrat;
}
var kurz = 30.126;
function count_eur(value) {
	var navrat = '';
	value = value.replace(/,/,'.');
	if (!isNaN(value))  navrat = (value/kurz).toFixed(2);
	document.getElementById('price_eur').value = navrat;
}
function count_sk(value) {
	var navrat = '';
	value = value.replace(/,/,'.');
	if (!isNaN(value))  navrat = (value*kurz).toFixed(2);
	document.getElementById('price_sk').value = navrat;
}