mDate = new Date();
mTableBackGround = "#B5D7FF";
mStandardBackgroundColor = "#B5D7FF";
zalNeaktPozadi ="#d9ebff";
zalBorder ="#536c9c";
zalAktPozadi ="#b5d7ff";

var prev_active;
var prev_el;
var ie;
var ua = navigator.userAgent;

if (ua.indexOf('MSIE',0) == -1) ie = false
else ie = true;

/*
if (ie) {
  window.attachEvent("onload", function () {
		document.getElementById('z1').style.background='#b5d7ff';
  		document.getElementById('z1').style.borderBottom='2px solid #b5d7ff';
  		prev_el = 'z1';
  		prev_active = 'hlavni';
		alert('A');
	});
}
*/

function udalost(e){
if (ie) var t = window.event.srcElement.id
else var t = e.target.id;
  if ((t == 'ico_kalendar') || (t.indexOf('Cell') != -1) || (t == 'selMonth')){
    kalendar_ukaz();
  //  nastav('p_od','Datum článku:');
  }else {
    kalendar_skryj();
  }
}

function nastav(co,nazev){
  parametr = co;
  v_den = parseFloat(document.getElementById(parametr).value.substring(0,2));
  v_mesic = parseFloat(document.getElementById(parametr).value.substring(3,5));
  v_rok = parseFloat(document.getElementById(parametr).value.substring(6,10));
  InitCalendar(isNaN(v_mesic-1) ? mDate.getMonth(): (v_mesic-1),isNaN(v_den) ? mDate.getDate(): v_den,isNaN(v_rok) ? mDate.getFullYear(): v_rok,parametr);
  document.getElementById('nadpis').innerHTML = nazev;
}


function kalendar_skryj() {
  document.getElementById('tabulka1').style.display='none';
}


function kalendar_ukaz() {
  document.getElementById('tabulka1').style.display='block';
}

function okno(img,title){
  var n = window.open("","mapawin","width=10,height=10,fullscreen=no,toolbar=no,location=no, directories=no,status=no,scrollbars=no,copyhistory=no,resizable=no");
  	n.document.close();
  	n.document.write('<HTML>');
	  n.document.write('<HEAD>');
	  n.document.write('<title>'+title+'</title>');
	  n.document.write('</HEAD>');
	  n.document.write('<BODY leftmargin="0" topmargin="0" onLoad="self.focus()" bgcolor = "#ffffff">');
	  n.document.write('<img src="'+img+'" alt="Klikni pro zavření" border="0" id="obr" onclick="self.close()" style="cursor:hand;">');
	  n.document.write('<script>resizeTo(document.all.obr.width+10,document.all.obr.height+30);');
	  n.document.write('moveTo(((opener.document.body.clientWidth/2)-(document.all.obr.width/2)),200);');
	  n.document.write('</'+'script>');
	  n.document.write('</BODY>');
	  n.document.write('</HTML>');
}

function navigace(x) {
  str = x + '.html';
  location = str;
}

function overeni(x)
{
  id = x;
  if (document.all.item(id).value =='') document.all.item(id).style.backgroundColor = '#fdf5e6'
  else document.all.item(id).style.backgroundColor = '#ffffff'   
  
  if (document.all.p_rdatum.value !='') document.all.p_jdatum.style.backgroundColor = '#ffffff'
  if (document.all.p_jdatum.value !='') document.all.p_rdatum.style.backgroundColor = '#ffffff'
  if ((document.all.p_rdatum.value =='') && (document.all.p_jdatum.value =='')) {
    document.all.p_jdatum.style.backgroundColor = '#fdf5e6';
    document.all.p_rdatum.style.backgroundColor = '#fdf5e6';
  }
 
  if (document.all.p_text_id.value !='') document.all.p_ozn_t.style.backgroundColor = '#ffffff'
  if (document.all.p_ozn_t.value !='') document.all.p_text_id.style.backgroundColor = '#ffffff'
  if ((document.all.p_ozn_t.value =='') && (document.all.p_text_id.value =='')) {
    document.all.p_text_id.style.backgroundColor = '#fdf5e6';
    document.all.p_ozn_t.style.backgroundColor = '#fdf5e6';
  }  
}

function help(x,i){
  document.all.item(i).title = x;
  document.all.item(i).style.cursor = 'help';
}


function init_tag(x){
  x.style.background='#b5d7ff';
  x.style.borderBottom='2px solid #b5d7ff';
  prev_el = 'z1';
  prev_active = 'hlavni';
}

function htmlNahled(){
  sirkaO = (window.screen.width/2) - (310 + 10);
  vyskaO = (window.screen.height/2) - (275 + 25);
  var n = window.open("","okno","left=" + sirkaO + ",top=" + vyskaO + ",screenX=" + sirkaO + ",screenY=" + vyskaO + ",width=620,height=550,fullscreen=no,toolbar=0,location=0, directories=0,status=yes,scrollbars=yes,copyhistory=no,resizable=yes");
  n.focus();
  }
