
var mapatimerID;
var mapa_timer_is_on=0;


function prepni(id) {
	el=document.getElementById('open' + id);
    if(el) {
    	if(el.style.display!='block') el.style.display='block'; else el.style.display='none';
    }
    el2=document.getElementById('close' + id);
    if(el2) {
    	if(el2.style.display!='block') el2.style.display='block'; else el2.style.display='none';
    }
}
function rozbal(id) {
	el=document.getElementById('open' + id);
    if(el) {
    	if(el.style.display!='block') el.style.display='block';
    }
    el2=document.getElementById('close' + id);
    if(el2) {
    	if(el2.style.display=='block')  el2.style.display='none';
    }
}

function check_car(carid){
	el=document.getElementById('cislo_car'+carid);
	if (el){
		cislo = el.value;
		el2 = document.getElementById('check_car'+cislo);
		el2.checked = true;
	} 
}
function check_all(poc, checked){
	for(var i=1; i<=poc; i++){ 
		el2=document.getElementById('check_car'+i);
		el2.checked = checked;
	} 
	if (checked){
		document.getElementById('zobraz_vse').style.display='none';
		document.getElementById('zobraz_nic').style.display='list-item';
	} else {
		document.getElementById('zobraz_vse').style.display='list-item';
		document.getElementById('zobraz_nic').style.display='none';
	}
}
function check_all_tree(img_path, lg_oznacit, lg_odznacit){
	i = 1;   
	if (document.getElementById('zobraz').alt == lg_oznacit) { 
		document.getElementById('zobraz').src =   img_path +'/pic/tree/deselect1.gif'  ;
		document.getElementById('zobraz').alt = lg_odznacit;
		document.getElementById('zobraz').title = lg_odznacit;
		checked = true;
	} else {
		document.getElementById('zobraz').src =   img_path +'/pic/tree/select1.gif'; 
		document.getElementById('zobraz').alt = lg_oznacit;
		document.getElementById('zobraz').title = lg_oznacit; 
		checked = false; 
	}
	while (document.getElementById('check_car'+i) ) { 
		el2=document.getElementById('check_car'+i);
		el2.checked = checked;
		i++;
	}  
	
}
function check_all2(ch){
	i = 1; 
	while (document.getElementById('check_car'+i) != null) { 
		el2=document.getElementById('check_car'+i);
		el2.checked = ch; 
		i++;
	} 
}
function check_all3(ch){
	i = 0; 
	while (document.getElementById('check_car'+i) != null) { 
		el2=document.getElementById('check_car'+i);
		el2.checked = ch; 
		i++;
	} 
}
function kniha_prepni(what) {
	a1 = 0;
	muj = what + '_0';
	while (document.getElementById(muj) != null) {
		if (document.getElementById(muj).style.display=='none') {
  				if (navigator.appName == "Microsoft Internet Explorer") {
					document.getElementById(muj).style.display='list-item';
				} else {
					document.getElementById(muj).style.display='table-row';
				}
			}
			else{
				document.getElementById(muj).style.display='none';
			}
		a1++;
		muj = what + '_' + a1;
	}
	
	muj = what + '_0';
	if (document.getElementById(muj) != null) {
		if (document.getElementById(muj).style.display=='none') {
			document.getElementById(what + "_obr").src='./pic/closed.gif';
			document.getElementById(what + "_obr").alt = 'Rozbalit den';
			document.getElementById(what + "_obr").title ='Rozbalit den';
		} else {
			document.getElementById(what + "_obr").src='./pic/open.gif';
			document.getElementById(what + "_obr").alt ='Zabalit den';
			document.getElementById(what + "_obr").title ='Zabalit den';
		}
	}
}
function kniha_show_all() {
	zaklad = "tb_";
	prvni = 0;
	while (document.getElementById(zaklad + prvni + '_0') != null) {
		zaklad1 = zaklad + prvni + '_';
		druha = 0;
		while(document.getElementById(zaklad1 + druha) != null) {
			if (navigator.appName == "Microsoft Internet Explorer") {
				document.getElementById(zaklad1 + druha).style.display = 'list-item';
			} else {
				document.getElementById(zaklad1 + druha).style.display = 'table-row';
			}
			druha++;
		}
		if (document.getElementById(zaklad + prvni + '_obr') != null) {
			document.getElementById(zaklad + prvni + '_obr').src='./pic/open.gif';
		}
		prvni++;
	}
}
function kniha_hide_all() {
	zaklad = "tb_";
	prvni = 0;
	while (document.getElementById(zaklad + prvni + '_0') != null) {
		zaklad1 = zaklad + prvni + '_';
		druha = 0;
		while(document.getElementById(zaklad1 + druha) != null) {
			document.getElementById(zaklad1 + druha).style.display='none';
			druha++;
		}
		if (document.getElementById(zaklad + prvni + '_obr') != null) {
			document.getElementById(zaklad + prvni + '_obr').src='./pic/closed.gif';
		}
		prvni++;
	}
}

function kniha_set_active(poradi, subporadi, routeid) {
	if ( routeid > 0 || routeid < 0){
		//top.frames["mapa"].location.href = './world/world.php?showrouteid=-' + routeid;
		  top.frames["mapa"].window.ShowRoute(routeid); 
	}
	if(poradi >= 0){
		hledane = 'tb_' + poradi + '_' + subporadi;
		if (subporadi == -2){
			hledane = 'tb_' + poradi;
		}
		zaklad = "tb_";
		prvni = 0;
		while (document.getElementById(zaklad + prvni + '_0') != null) {
			zaklad1 = zaklad + prvni + '_';
			druha = 0;
			zaklad2 = zaklad1 + druha;
			while(document.getElementById(zaklad2) != null) {
				el = document.getElementById(zaklad2)
				el_class = el.className;
				if (el_class == 'a_gray'){
					tmp = druha;
					tmp = tmp % 2;
					el.className = 'gray'+tmp; 
				}
				if (zaklad2 == hledane){
					el.className = 'a_gray';
				}
	
				druha++;
				zaklad2 = zaklad1 + druha;
			}
			prvni++;
		}
		
		prvni = 0;
		while (document.getElementById(zaklad + prvni) != null) {
			zaklad2 = zaklad + prvni;
			el = document.getElementById(zaklad2)
			el_class = el.className;
			if (el_class == 'a_gray'){
				tmp = prvni;
				tmp = tmp % 2;
				el.className = 'sum_gray'+tmp; 
			}
			if (zaklad2 == hledane){
				el.className = 'a_gray';
			}
			prvni++;
			
		}
	}
}
function kniha_checked_route(alertstr) {
	zaklad = 'route_';
	prvni = 0;
	str = '';
	while (document.getElementById(zaklad + prvni + '_0') != null) {
		zaklad1 = zaklad + prvni + '_';
		druha = 0;
		while(document.getElementById(zaklad1 + druha) != null) {
			el = document.getElementById(zaklad1 + druha);
			if (el.checked == true) {
				str = str + el.value + '+';
			} 
			druha++;
		}
		prvni++;
	}
	if (str == ''){
		alert(alertstr);
	} else {
		top.frames["mapa"].window.ShowRoute(str);
	//	top.frames["mapa"].location.href = './world/world.php?showrouteid=' + str;
	}
}


function kniha_export(carid, datumod, datumdo)
{   
	loc_info = "./inc/export_knihy_jizd.php?idcar=" + carid + "&datumod=" + datumod + "&datumdo=" + datumdo;	
 	window.open(loc_info, '_blank','');	
}

function okno_import_karet(carid, w, h)
{   
	left_vzd = (screen.width - w) / 2;
	top_vzd  = (screen.height - h) / 2;
 	loc_info = "./import_karet.php?book_car_id=" + carid;	
 	vlastnosti = 'width=' + w + ',height=' + h + ', scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left_vzd + ', top='+top_vzd;
	window.open(loc_info,'_blank',vlastnosti);	
}
function okno_udalosti(){
	w = 800;
	h = 300;
	left_vzd = (screen.width - w) / 2;
	top_vzd  = (screen.height - h) / 2;
 	loc_info = "./nastroje.php?zalozka=udalosti&volani=okno";	
 	vlastnosti = 'width=' + w + ',height=' + h + ', scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left_vzd + ', top='+top_vzd;
	window.open(loc_info,'_blank',vlastnosti);	
}
function okno_info_firma(){
	w = 300;
	h = 300;
	left_vzd = (screen.width - w) / 2;
	top_vzd  = (screen.height - h) / 2; 
 	loc_info = "./nastroje.php?zalozka=info_firma";	
 	vlastnosti = 'width=' + w + ',height=' + h + ', scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left_vzd + ', top='+top_vzd;
	strWindow = 'dialogHeight:' + w + 'px;dialogWidth:' + h + 'px;dialogLeft=' +  left_vzd + 'px;dialogtop=' + top_vzd + 'px;status:no;edge:sunken';
	if (navigator.appName == "Microsoft Internet Explorer") {
		retVal = showModalDialog(loc_info, 'infofirma', strWindow);
	} else { 
		if (navigator.userAgent.search('Chrome/2')<0 ) { 
			retVal = showModalDialog(loc_info, 'infofirma', strWindow);
		} else {  
			hand = window.open(loc_info,'infofirma',vlastnosti );  
			if (hand != null){
				hand.focus();
			}
		}
	}
	//return hand;
}
function okno_kniha(url, w, h) {   
	left_vzd = (screen.width - w) / 2;
	top_vzd  = (screen.height - h) / 2;
 	vlastnosti = 'width=' + w + ',height=' + h + ', scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left_vzd + ',top='+top_vzd;
	hand = window.open(url,'_blank',vlastnosti);	
	if (hand != null){
		hand.focus();
	}
	return hand;
}
function okno_sms(url, w, h) {   
	left_vzd = (screen.width - w) / 2;
	top_vzd = (screen.height - h) / 2;
 	vlastnosti = 'width=' + w + ',height=' + h + ', scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left_vzd + ',top='+top_vzd;
	hand = window.open(url,'oknosms',vlastnosti);	
	if (hand != null){
		hand.focus();
	}
	return hand;
}
function okno_sms2(url, w, h) {   
	left_vzd =  screen.width - w - 20;
	top_vzd = 20;
 	vlastnosti = 'width=' + w + ',height=' + h + ', scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left_vzd + ',top='+top_vzd;
	hand = window.open(url,'oknosms2',vlastnosti);	
	if (hand != null){
		hand.focus();
	}
	return hand;
} 
function okno_sms3(url, w, h) {   
	left_vzd = (screen.width - w) / 2;
	top_vzd = (screen.height - h) / 2;
 	vlastnosti = 'width=' + w + ',height=' + h + ', scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left_vzd + ',top='+top_vzd;
	hand = window.open(url,'oknosms3',vlastnosti);	
	if (hand != null){
		hand.focus();
	}
	return hand;
} 
function okno_parent(url, w, h) {   
	left_vzd = (screen.width - w) / 2;
	top_vzd  = (screen.height - h) / 2;
 	vlastnosti = 'width=' + w + ',height=' + h + ', scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left_vzd + ',top='+top_vzd;
	hand = window.parent.open(url,'_blank',vlastnosti);	
	if (hand != null){
		hand.focus();
	}
}

function okno_calendar(typ, mesic)
{   
	w = 200;
	h = 150;
	left_vzd = (screen.width - w) / 2;
	top_vzd  = (screen.height - h) / 2;
 	loc_info = './calendar.php?typ='+ typ + '&mesic=' + mesic;	
 	vlastnosti = 'width=' + w + ',height=' + h + ', scrollbars=0,resizable=no, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left_vzd + ', top='+top_vzd;
	hand = window.open(loc_info,'calendar',vlastnosti);	
	if (hand != null){
		hand.focus();
	}
}
function okno_zapomenute_heslo()
{   
	w = 250;
	h = 200;
	left_vzd = (screen.width - w) / 2;
	top_vzd  = (screen.height - h) / 2;
 	loc_info = './zaslat_heslo.php';	
 	vlastnosti = 'width=' + w + ',height=' + h + ', scrollbars=0,resizable=no, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left_vzd + ', top='+top_vzd;
	hand = window.open(loc_info,'calendar',vlastnosti);	
	if (hand != null){
		hand.focus();
	}
}

function zobraz_auta(err_hlaska) {
	prvni = 1;
	zaklad = 'check_car';
	str = '';
	while (document.getElementById(zaklad + prvni) != null) {
		if (document.getElementById(zaklad + prvni).checked) {
			str = str + '+' + document.getElementById(zaklad + prvni).value;
		}
		prvni++;
	}
	if (str == ''){
		//alert(err_hlaska);	
		sleduj(0,'' );
		return false;
	} else {
		//top.frames["mapa"].location.href = './world/world.php?lastpositioncarid=' + str;
		top.frames["mapa"].window.ShowCars(str);
		document.getElementById('exec_executor').src = './dnes.php?zalozka=save_checked_tree.js&str=' + str;
		sleduj(1,'' );
	}
}

function zobraz_auta_nesleduj(err_hlaska) {
	prvni = 1;
	zaklad = 'check_car';
	str = '';
	while (document.getElementById(zaklad + prvni) != null) {
		if (document.getElementById(zaklad + prvni).checked) {
			str = str + '+' + document.getElementById(zaklad + prvni).value;
		}
		prvni++;
	}
	if (str == ''){
		alert(err_hlaska);	
		sleduj(0,'' );
		return false;
	} else {
		//top.frames["mapa"].location.href = './world/world.php?lastpositioncarid=' + str;
		top.frames["mapa"].window.ShowCars(str);
		document.getElementById('exec_executor').src = './dnes.php?zalozka=save_checked_tree.js&str=' + str; 
	}
}
 
function zobraz_mista() {
	prvni = 0;
	zaklad = 'check_misto_';
	str = '';
	while (document.getElementById(zaklad + prvni) != null) {
		if (document.getElementById(zaklad + prvni).checked) {
			str = str + '+' + document.getElementById(zaklad + prvni).value;
		}
		prvni++;
	} 
	//top.frames["mapa"].location.href = './world/world.php?vlastnimista=' + str;
	top.frames["mapa"].window.ShowUserPoints(str);
}
function mapa_misto(cislo) {  
 	//top.frames["mapa"].location.href = './world/world.php?vlastnimista=' + cislo;
	top.frames["mapa"].window.ShowUserPoints(cislo);
}
function zobraz_historii() {
	prvni = 1;
	zaklad = 'check_car';
	str = '';
	while (document.getElementById(zaklad + prvni) != null) {
		if (document.getElementById(zaklad + prvni).checked) {
			str = str + '+' + document.getElementById(zaklad + prvni).value;
		}
		prvni++;
	}
	sizeX = 350;
	sizeY = 150;
	left = (screen.width - sizeX) / 2;
	topp  = (screen.height - sizeY) / 2; 
	//strWindow = 'modal=1,dependent=1,z-lock=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0,width=' + sizeX + ',height=' + sizeY + ',left=' + left +',top=' + topp;
	strWindow = 'dialogHeight:' + sizeY + 'px;dialogWidth:' + sizeX + 'px;dialogLeft=' +  left + 'px;dialogtop=' + topp + 'px;status:no;edge:sunken';
	// ukoncit sledovani
	sleduj(0, '');
	if (navigator.appName == "Microsoft Internet Explorer") {
		retVal = showModalDialog('./okno_historie.php', 'editace', strWindow);
	} else { 
		 if (navigator.userAgent.search('Chrome')<0 ) {  
			retVal = showModalDialog('./okno_historie.php', 'editace', strWindow);
		 } else {  
			strWindow = 'width='+sizeX+',height='+sizeY+',scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left + ',top='+topp;
			hand = window.open('./okno_historie.php?nav=chrome&str='+str,'editace',strWindow );  
			if (hand != null){
				hand.focus();
			}
		} 
	}
	if (retVal == ''){
	} else { 
	//	top.frames["mapa"].location.href = './world/world.php?lastpositioncarid=' + str + retVal; 
		top.frames["mapa"].window.ShowCars(str + retVal);
	}
}
function dotaz_SMS(text, err_hlaska) {
	pokracovat = confirm(text);
	if (pokracovat){
		prvni = 1;
		zaklad = 'check_car';
		str = '';
		while (document.getElementById(zaklad + prvni) != null) {
			if (document.getElementById(zaklad + prvni).checked) {
				str = str + '_' + document.getElementById(zaklad + prvni).value;
			}
			prvni++;
		}
		if (str == ''){
			alert(err_hlaska);	
			return false;
		} else {
			mlink = './dotaz_sms.php?carlist=' + str;
			win_op_sms(mlink, 150,250);
		}
	}
}

function car_mapa(carid) { 
	//top.frames["mapa"].location.href = './world/world.php?lastpositioncarid=' + carid; 
	carid = eval(carid);
	if (carid > 0){
		top.frames["mapa"].window.ShowCars( carid);
		//top.frames["info"].location.href = './info.php?idcar=' + carid;  
		top.frames["info"].showCarInfo(carid); 
		top.frames["kniha"].location.href = './knihajizd.php?zalozka=knihajizd&book_car_id=' + carid;
		
	}
}

function obec_mapa(zs, zd) {
	top.frames["mapa"].location.href = './world/world.php?centruj_zs=' + zs + '&centruj_zd='+zd;
}
function car_kniha(carid) {
	carid = eval(carid);
	if (carid > 0){
	//top.frames["mapa"].location.href = './world/world.php?lastpositioncarid=' + carid;
		top.frames["mapa"].window.ShowCars( carid);  
		top.frames["kniha"].location.href = './knihajizd.php?zalozka=knihajizd&book_car_id=' + carid;  
		top.frames["info"].window.showCarInfo(carid); 
		vadna_jednotka(carid);
	}
}
function vadna_jednotka(idcar){
	urls='./dnes.php?zalozka=stav_jednotek_overit.js&idcar='+idcar; 
	// alert(urls);
	// odmazeme stary skript, pokud existoval
     var hlavicka = document.getElementsByTagName('head')[0];
     var dataLoader = document.getElementById('scriptLoader');
    if(dataLoader) hlavicka.removeChild(dataLoader);

    // vytvorime novy element script
    script = document.createElement('script');
    script.id = 'scriptLoader';
    script.src = urls;

    // POZOR, DULEZITE!! Skript musime vlozit do stranky 
    // pomoci DOM - appendChild()
    // Ihned po vlozeni prohlizec stahne skript a spusti jej
    x = document.getElementsByTagName('head')[0];
    x.appendChild(script); 
    return false; 
} 
function nacti_auta(od, do2, zadne_auto, url, w, h) {
	prvni = 0; 
	zaklad = 'check_car';
	str = '';
	while (document.getElementById(zaklad + prvni) != null) {
		if (document.getElementById(zaklad + prvni).checked) {
			str = str + '_' + document.getElementById(zaklad + prvni).value;
		}
		prvni++;
	}
	if (str==''){
		alert(zadne_auto);
		return false;
	}
	left_vzd = eval((screen.width - w) / 2);
	top_vzd  = eval((screen.height - h) / 2);
	hand = window.parent.open(url+'?&od='+od+'&do='+do2+'&vyber_auta='+str, 'nove', 'width='+w+',height='+h+',scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left_vzd + ',top='+top_vzd);
	if (hand != null){
		hand.focus();
	}
	return false;
}
function okno_parent(url, w, h) { 
	left_vzd = eval((screen.width - w) / 2);
	top_vzd  = eval((screen.height - h) / 2);
	hand = window.parent.open(url, 'nove', 'width='+w+',height='+h+',scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left_vzd + ',top='+top_vzd);
	if (hand != null){
		hand.focus();
	}
	return false;
}

function boddosazeni_mapa(bodid) {
//	top.frames["mapa"].location.href = './world/world.php?boddosazeniid=' + bodid;
	top.frames["mapa"].window.ShowReceivedPoints(bodid);
}

function dosazenyboddosazeni_mapa(bodid) {
	//top.frames["mapa"].location.href = './world/world.php?dosazenyboddosazeniid=' + bodid;
	top.frames["mapa"].window.ShowReceivedPoints2(bodid);
}
function naklady_mapa(idcar, postime) {
	//top.frames["mapa"].location.href = './world/world.php?dosazenyboddosazeniid=' + bodid;
	top.frames["mapa"].window.ShowCarTime('idcar='+idcar+'&postime='+postime);
}

function vsechnyboddosazeni_mapa(carid) {
	top.frames["mapa"].location.href = './world/world.php?boddosazeniidcar=' + carid;
}

function win_op(m_link, sizeY, sizeX){
	left = (screen.width - sizeX) / 2;
	topp  = (screen.height - sizeY) / 2; 
	//strWindow = 'modal=1,dependent=1,z-lock=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0,width=' + sizeX + ',height=' + sizeY + ',left=' + left +',top=' + topp;
	if (navigator.userAgent.search('Chrome/2')<0 ) { 
		strWindow = 'dialogHeight:' + sizeY + 'px;dialogWidth:' + sizeX + 'px;dialogLeft=' +  left + 'px;dialogtop=' + topp + 'px;status:no;edge:sunken';
		retVal = showModalDialog(m_link, 'editace', strWindow);
	} else { 
		strWindow = 'width='+sizeX+',height='+sizeY+',scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left + ',top='+topp;
		hand = window.open(m_link,'editace',strWindow ); 
		if (hand != null){
			hand.focus();
		}
	}
	window.location.reload();
}
function win_op2(m_link, sizeX, sizeY){
	left = (screen.width - sizeX) / 2;
	topp  = (screen.height - sizeY) / 2; 
	//strWindow = 'modal=1,dependent=1,z-lock=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0,width=' + sizeX + ',height=' + sizeY + ',left=' + left +',top=' + topp;
	if (navigator.userAgent.search('Chrome/2')<0 ) { 
		strWindow = 'dialogHeight:' + sizeY + 'px;dialogWidth:' + sizeX + 'px;dialogLeft=' +  left + 'px;dialogtop=' + topp + 'px;status:no;edge:sunken';
		retVal = showModalDialog(m_link, 'editace', strWindow);
	} else { 
		strWindow = 'width='+sizeX+',height='+sizeY+',scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left + ',top='+topp;
		hand = window.open(m_link,'editace',strWindow ); 
		if (hand != null){
			hand.focus();
		}
	}
	window.location.reload();
}
function win_op_no_reload(m_link, sizeX, sizeY){
	left = (screen.width - sizeX) / 2;
	topp  = (screen.height - sizeY) / 2;
	//strWindow = 'modal=1,dependent=1,z-lock=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0,width=' + sizeX + ',height=' + sizeY + ',left=' + left +',top=' + topp;
	if (navigator.userAgent.search('Chrome/2')<0 ) { 
		strWindow = 'dialogHeight:' + sizeY + 'px;dialogWidth:' + sizeX + 'px;dialogLeft=' +  left + 'px;dialogtop=' + topp + 'px;status:no;edge:sunken';
		retVal = showModalDialog(m_link, 'editace', strWindow);
	} else { 
		strWindow = 'width='+sizeX+',height='+sizeY+',scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left + ',top='+topp;
		hand = window.open(m_link,'editace',strWindow ); 
		if (hand != null){
			hand.focus();
		}
	}
}

function win_op_kj(m_link, sizeX, sizeY){
	left = (screen.width - sizeY) / 2;
	topp  = (screen.height - sizeX) / 2;
	//strWindow = 'modal=1,dependent=1,z-lock=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0,width=' + sizeX + ',height=' + sizeY + ',left=' + left +',top=' + topp;
	if (navigator.userAgent.search('Chrome/2')<0 ) { 
		strWindow = 'dialogHeight:' + sizeX + 'px;dialogWidth:' + sizeY + 'px;dialogLeft=' +  left + 'px;dialogtop=' + topp + 'px;status:no;edge:sunken';
		retVal = showModalDialog(m_link, 'editace', strWindow);
	} else { 
		strWindow = 'width='+sizeX+',height='+sizeY+',scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left + ',top='+topp;
		hand = window.open(m_link,'editace',strWindow ); 
		if (hand != null){
			hand.focus();
		}
	}
	window.document.form_cas.submit();
}
function win_op_kj2(m_link, sizeX, sizeY){
	left = (screen.width - sizeX) / 2;
	topp  = (screen.height - sizeY) / 2;
	//strWindow = 'modal=1,dependent=1,z-lock=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0,width=' + sizeX + ',height=' + sizeY + ',left=' + left +',top=' + topp;
	if (navigator.userAgent.search('Chrome/2')<0 ) { 
		strWindow = 'dialogHeight:' + sizeY + 'px;dialogWidth:' + sizeX + 'px;dialogLeft=' +  left + 'px;dialogtop=' + topp + 'px;status:no;edge:sunken';
		retVal = showModalDialog(m_link, 'editace', strWindow);
	} else { 
		strWindow = 'width='+sizeX+',height='+sizeY+',scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left + ',top='+topp;
		hand = window.open(m_link,'editace',strWindow ); 
		if (hand != null){
			hand.focus();
		}
	}
	window.document.form_cas.submit();
}
function win_op_sms(m_link, sizeX, sizeY){
	left = (screen.width - sizeX) / 2;
	topp  = (screen.height - sizeY) / 2; 
	//strWindow = 'modal=1,dependent=1,z-lock=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0,width=' + sizeX + ',height=' + sizeY + ',left=' + left +',top=' + topp;
	if (navigator.userAgent.search('Chrome/2')<0 ) { 
		strWindow = 'dialogHeight:' + sizeX + 'px;dialogWidth:' + sizeY + 'px;dialogLeft=' +  left + 'px;dialogtop=' + topp + 'px;status:no;edge:sunken';
		retVal = showModalDialog(m_link, 'sms', strWindow);
	} else { 
		strWindow = 'width='+sizeX+',height='+sizeY+',scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left + ',top='+topp;
		hand = window.open(m_link,'sms',strWindow ); 
		if (hand != null){
			hand.focus();
		}
	}
}

function working(){
	document.getElementById('main').style.display = "none";
	document.getElementById('work').style.display = "block";
}
function getkey(e){ 
  var code; 
  if (!e)
    var e = window.event; // nastaveni pro IE 
  if (e.keyCode)
    code = e.keyCode; // ie and mozilla/gecko 
  else
   if (e.which)
     code = e.which; // nn4
  return code; 
} 

function numeric(eX){
  test=getkey(eX); 
  ret = true;
  if (test > 57){ 
    ret = false;
  }
  if (test < 48 && (test != 8) &&  (test != 46)){ // divne znaky 
    ret = false;
  }		
  if (test == 44 || test == 43 || test == 45 || test==59 || test==8 || test==46 || test==36 || test==35 || test==37 || test==39){ // tecka, carka, plus, minus, strednik, backspace, del, home, end, left sipka, right sipka
  	ret = true;//0x47, End 0x4F, Left 0x4B, Right 0x4D
  }
  if (test > 47 && test < 58){
  	ret = true;
  }	
  return ret;
}

function is_date(eX){
  test=getkey(eX); 
  if (test > 57){ 
    ret = false;
  }
  if (test < 48){
    ret = false;
  }		
  if (test == 46  || test == 58 || test == 32 || test==8 || test==46 || test==36 || test==35 || test==37 || test==39){ // tecka, dvojtecka, mezera - prepiseme false na true
  	ret = true;
  }
  if (test > 47 && test < 58){
  	ret = true;
  }	
  return ret;
}


function alfanumeric(eX,diacritic){
  test=getkey(eX);
  set1=(test>32 && test<48 && test!=36 && test!=35 && test!=37 && test!=39);
  set2=(test>57 && test<65);
  set3=(test>90 && test<97);
  if (diacritic == 1){
    set4=(test>122 && test<127);
  } else {
    set4=(test>122);
  }
  if (set1 || set2 || set3 || set4)
    return false;
  else 
	  return true;
}

function safechars(eX){
  test=getkey(eX);
  if (test==34 || test==39)
    return false;
  else 
	  return true;

}
function prekresli_mapu() {
	prvni = 1;
	zaklad = 'check_car';
	str = '';
	while (document.getElementById(zaklad + prvni) != null) {
		if (document.getElementById(zaklad + prvni).checked) {
			str = str + '+' + document.getElementById(zaklad + prvni).value;
		}
		prvni++;
	} 
	if (str != ''){
		top.frames["mapa"].window.ShowCars( str + '&sledovani=1 ' ); 
		 top.frames["info"].document.forms['info_car'].submit();  
		//top.frames["info"].showCarInfo(carid); 
		interval = eval(document.getElementById('interval').value); 
	 	mapatimerID = setTimeout('prekresli_mapu()', interval); 
	}
} /*
function prekresli_info() {
	
	interval = eval(top.frames["info"].document.getElementById('infointerval').value); 
 	timerInfoID = setTimeout('prekresli_info()', interval); 
}

function prepni_sledovani(faze){
	if (faze == 'start') {
		document.getElementById('sledovani_start').style.display='none';
		document.getElementById('sledovani_end').style.display='list-item';
		
	} else {
		document.getElementById('sledovani_start').style.display='list-item';
		document.getElementById('sledovani_end').style.display='none';
	}

}
function start_sledovani(){ 
	interval = 30 * 1000; 
	mapatimerID = setTimeout('prekresli_mapu()', interval);
	prepni_sledovani('start');
} */
function get_zaskrtnuta_auta(){
	prvni = 1;
	zaklad = 'check_car';
	str = '';
	while (document.getElementById(zaklad + prvni) != null) {
		if (document.getElementById(zaklad + prvni).checked) {
			str = str + '+' + document.getElementById(zaklad + prvni).value;
		}
		prvni++;
	}
	return str;
}
function sleduj(sledujeme,  err_hlaska){  
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	//prekresli_mapu();

	document.getElementById('sledujeme').value = sledujeme;
	if (sledujeme == 1){  // zapnout 
		prvni = 1;
		zaklad = 'check_car';
		str = '';
		while (document.getElementById(zaklad + prvni) != null) {
			if (document.getElementById(zaklad + prvni).checked) {
				str = str + '+' + document.getElementById(zaklad + prvni).value;
			}
			prvni++;
		}
		if (str == ''){		
			alert(err_hlaska);	  
			sledujeme = 0;
		} else {  
			if (mapa_timer_is_on)
				clearTimeout(mapatimerID);  
			mapatimerID = setTimeout('prekresli_mapu()', 1000);  
			mapa_timer_is_on = 1;
			//timerInfoID = setTimeout('prekresli_info()', 1);  
		} 
	}
	if (sledujeme == 1){  // zapnout 
		document.getElementById('sleduj0').style.display = 'none';
		document.getElementById('sleduj1').style.display = 'inline';
	} else {
		document.getElementById('sledujeme').value = 0;
		document.getElementById('sleduj0').style.display = 'inline';
		document.getElementById('sleduj1').style.display = 'none'; 
		if (mapa_timer_is_on){
			clearTimeout(mapatimerID);
			mapa_timer_is_on = 0;
		}
		//if (timerInfoID != null)	
		//	clearTimeout(timerInfoID);  
	}
}
function zaokrouhli2(cislo){
	cislo = eval(100 * cislo);
	cislo = Math.round(cislo);
	cislo = eval(cislo / 100);
	return cislo;
}
function dopocitej_naklady(){
	cenamj =  document.getElementById('cenamj').value ;
	if (cenamj.indexOf(',') > 0 ){
		arr_s = cenamj.split(',');
		cenamj = arr_s[0] + '.' + arr_s[1];
		document.getElementById('cenamj').value = cenamj;
	}
	mnozstvi = document.getElementById('MN').value ;
	sdph = document.getElementById('s_dph').checked;
	if (mnozstvi.indexOf(',') > 0 ){
		arr_s = mnozstvi.split(',');
		mnozstvi = arr_s[0] + '.' + arr_s[1];
		document.getElementById('MN').value = mnozstvi;
	}
	pdph =  document.getElementById('pdph').value ;
	
	if (sdph == true){
		cenacelkem = eval(cenamj * mnozstvi);
		stocenacelkem = eval (cenacelkem * 100);
		deleno = eval(100 + eval(pdph) );
		cenabezdph = eval( stocenacelkem/ deleno) ;
		dph = eval(cenacelkem - cenabezdph ) ;
		document.getElementById('cenabezdph').value = zaokrouhli2(cenabezdph);
		document.getElementById('dph').value = zaokrouhli2(dph);
		document.getElementById('cenacelkem').value = zaokrouhli2(cenacelkem);
	} else {
		cenabezdph = cenamj * mnozstvi;
		dph = Math.round(cenabezdph * pdph);
		dph = dph / 100;
		cenacelkem = eval(cenabezdph + dph);
		document.getElementById('cenabezdph').value = zaokrouhli2(cenabezdph);
		document.getElementById('dph').value = zaokrouhli2(dph);
		document.getElementById('cenacelkem').value = zaokrouhli2(cenacelkem);
	}
}


function Next_Car_Icon()
{
if (document.form_vzhled.caricon.value == "17") 
  {
   document.iconaauta.src='./pic/auto.gif';	
   document.form_vzhled.caricon.value = "0";
   return;
  } 
	
if (document.form_vzhled.caricon.value == "16") 
  {
   document.iconaauta.src='./pic/sipka_1.gif';	
   document.form_vzhled.caricon.value = "17";
   return;
  } 
  	
if (document.form_vzhled.caricon.value == "15") 
  {
   document.iconaauta.src='./pic/auto17.gif';	
   document.form_vzhled.caricon.value = "16";
   return;
  } 
  	
if (document.form_vzhled.caricon.value == "14") 
  {
   document.iconaauta.src='./pic/auto16.gif';	
   document.form_vzhled.caricon.value = "15";
   return;
  } 	
 if (document.form_vzhled.caricon.value == "13") 
  {
   document.iconaauta.src='./pic/auto15.gif';	
   document.form_vzhled.caricon.value = "14";
   return;
  } 
	
 if (document.form_vzhled.caricon.value == "12") 
  {
   document.iconaauta.src='./pic/auto14.gif';	
   document.form_vzhled.caricon.value = "13";
   return;
  } 

 if (document.form_vzhled.caricon.value == "11") 
  {
   document.iconaauta.src='./pic/auto13.gif';	
   document.form_vzhled.caricon.value = "12";
   return;
  } 

 if (document.form_vzhled.caricon.value == "10") 
  {
   document.iconaauta.src='./pic/auto12.gif';	
   document.form_vzhled.caricon.value = "11";
   return;
  } 

 if (document.form_vzhled.caricon.value == "9") 
  {
   document.iconaauta.src='./pic/auto11.gif';	
   document.form_vzhled.caricon.value = "10";
   return;
  } 

 if (document.form_vzhled.caricon.value == "8") 
  {
   document.iconaauta.src='./pic/auto10.gif';	
   document.form_vzhled.caricon.value = "9";
   return;
  } 

 if (document.form_vzhled.caricon.value == "7") 
  {
   document.iconaauta.src='./pic/auto9.gif';	
   document.form_vzhled.caricon.value = "8";
   return;
  } 
 
 if (document.form_vzhled.caricon.value == "6") 
  {
   document.iconaauta.src='./pic/auto8.gif';	
   document.form_vzhled.caricon.value = "7";
  } 

 if (document.form_vzhled.caricon.value == "5") 
  {
   document.iconaauta.src='./pic/auto7.gif';	
   document.form_vzhled.caricon.value = "6";
  } 

 if (document.form_vzhled.caricon.value == "4") 
  {
   document.iconaauta.src='./pic/auto6.gif';	
   document.form_vzhled.caricon.value = "5";
  } 


 if (document.form_vzhled.caricon.value == "3") 
  {
   document.iconaauta.src='./pic/auto5.gif';	
   document.form_vzhled.caricon.value = "4";
  } 
 
 if (document.form_vzhled.caricon.value == "2") 
  {
   document.iconaauta.src='./pic/auto4.gif';	
   document.form_vzhled.caricon.value = "3";
  } 
  
 if (document.form_vzhled.caricon.value == "1") 
  {
   document.iconaauta.src='./pic/auto3.gif';	
   document.form_vzhled.caricon.value = "2";
  } 
  
 if (document.form_vzhled.caricon.value == "0") 
  {
   document.iconaauta.src='./pic/auto2.gif';	
   document.form_vzhled.caricon.value = "1";
  } 
}

function Next_Start_Icon()
{	
	
 if (document.form_vzhled.starticon.value == "5") 
  {
   document.iconastart.src='./pic/start_icon.gif';	
   document.form_vzhled.starticon.value = "0";
   return;
  } 
 
 if (document.form_vzhled.starticon.value == "4") 
  {
   document.iconastart.src='./pic/start_icon6.gif';	
   document.form_vzhled.starticon.value = "5";
  } 

 if (document.form_vzhled.starticon.value == "3") 
  {
   document.iconastart.src='./pic/start_icon5.gif';	
   document.form_vzhled.starticon.value = "4";
  } 
 
 if (document.form_vzhled.starticon.value == "2") 
  {
   document.iconastart.src='./pic/start_icon4.gif';	
   document.form_vzhled.starticon.value = "3";
  } 
  
 if (document.form_vzhled.starticon.value == "1") 
  {
   document.iconastart.src='./pic/start_icon3.gif';	
   document.form_vzhled.starticon.value = "2";
  } 
  
 if (document.form_vzhled.starticon.value == "0") 
  {
   document.iconastart.src='./pic/start_icon2.gif';	
   document.form_vzhled.starticon.value = "1";
  } 	
}
	
function Next_Konec_Icon()
{	
 if (document.form_vzhled.konecicon.value == "7") 
  {
   document.iconakonec.src='./pic/konec_icon.gif';	
   document.form_vzhled.konecicon.value = "0";
   return;
  } 
	
 if (document.form_vzhled.konecicon.value == "6") 
  {
   document.iconakonec.src='./pic/konec_icon8.gif';	
   document.form_vzhled.konecicon.value = "7";
   return;
  } 

 if (document.form_vzhled.konecicon.value == "5") 
  {
   document.iconakonec.src='./pic/konec_icon7.gif';	
   document.form_vzhled.konecicon.value = "6";
   return;
  } 
 
 if (document.form_vzhled.konecicon.value == "4") 
  {
   document.iconakonec.src='./pic/konec_icon6.gif';	
   document.form_vzhled.konecicon.value = "5";
  } 

 if (document.form_vzhled.konecicon.value == "3") 
  {
   document.iconakonec.src='./pic/konec_icon5.gif';	
   document.form_vzhled.konecicon.value = "4";
  } 
 
 if (document.form_vzhled.konecicon.value == "2") 
  {
   document.iconakonec.src='./pic/konec_icon4.gif';	
   document.form_vzhled.konecicon.value = "3";
  } 
  
 if (document.form_vzhled.konecicon.value == "1") 
  {
   document.iconakonec.src='./pic/konec_icon3.gif';	
   document.form_vzhled.konecicon.value = "2";
  } 
  
 if (document.form_vzhled.konecicon.value == "0") 
  {
   document.iconakonec.src='./pic/konec_icon2.gif';	
   document.form_vzhled.konecicon.value = "1";
  } 	
}

function Next_Konec_Icon2()
{	 
 if (document.form_vzhled.konecicon.value == "1") 
  {
   document.iconakonec.src='./pic/konec_icon7.gif';	
   document.form_vzhled.konecicon.value = "0";
   return;
  } 
	
 if (document.form_vzhled.konecicon.value == "0") 
  {
   document.iconakonec.src='./pic/konec_icon8.gif';	
   document.form_vzhled.konecicon.value = "1";
   return;
  } 
}

function Next_Prujezd_Icon()
{	
	
 if (document.form_vzhled.prujezdicon.value == "5") 
  {
   document.iconaprujezd.src='./pic/prujezd_icon.gif';	
   document.form_vzhled.prujezdicon.value = "0";
   return;
  } 
 
 if (document.form_vzhled.prujezdicon.value == "4") 
  {
   document.iconaprujezd.src='./pic/prujezd_icon6.gif';	
   document.form_vzhled.prujezdicon.value = "5";
  } 

 if (document.form_vzhled.prujezdicon.value == "3") 
  {
   document.iconaprujezd.src='./pic/prujezd_icon5.gif';	
   document.form_vzhled.prujezdicon.value = "4";
  } 
 
 if (document.form_vzhled.prujezdicon.value == "2") 
  {
   document.iconaprujezd.src='./pic/prujezd_icon4.gif';	
   document.form_vzhled.prujezdicon.value = "3";
  } 
  
 if (document.form_vzhled.prujezdicon.value == "1") 
  {
   document.iconaprujezd.src='./pic/prujezd_icon3.gif';	
   document.form_vzhled.prujezdicon.value = "2";
  } 
  
 if (document.form_vzhled.prujezdicon.value == "0") 
  {
   document.iconaprujezd.src='./pic/prujezd_icon2.gif';	
   document.form_vzhled.prujezdicon.value = "1";
  } 	
}

function Next_Prujezd_Icon2()
{	
	
 if (document.form_vzhled.prujezdicon.value == "1") 
  {
   document.iconaprujezd.src='./pic/prujezd_icon.gif';	
   document.form_vzhled.prujezdicon.value = "0";
   return;
  } 
   
 if (document.form_vzhled.prujezdicon.value == "0") 
  {
   document.iconaprujezd.src='./pic/smer_prujezd.gif';	
   document.form_vzhled.prujezdicon.value = "1";
  } 	
}


function Next_Trasa_Icon()
{	
	
 if (document.form_vzhled.trasaicon.value == "5") 
  {
   document.iconatrasa.src='./pic/trasa0.gif';	
   document.form_vzhled.trasaicon.value = "0";
   return;
  } 
 
 if (document.form_vzhled.trasaicon.value == "4") 
  {
   document.iconatrasa.src='./pic/trasa5.gif';	
   document.form_vzhled.trasaicon.value = "5";
  } 

 if (document.form_vzhled.trasaicon.value == "3") 
  {
   document.iconatrasa.src='./pic/trasa4.gif';	
   document.form_vzhled.trasaicon.value = "4";
  } 
 
 if (document.form_vzhled.trasaicon.value == "2") 
  {
   document.iconatrasa.src='./pic/trasa3.gif';	
   document.form_vzhled.trasaicon.value = "3";
  } 
  
 if (document.form_vzhled.trasaicon.value == "1") 
  {
   document.iconatrasa.src='./pic/trasa2.gif';	
   document.form_vzhled.trasaicon.value = "2";
  } 
  
 if (document.form_vzhled.trasaicon.value == "0") 
  {
   document.iconatrasa.src='./pic/trasa1.gif';	
   document.form_vzhled.trasaicon.value = "1";
  } 	
}

function Load_Car_Icon()
{
 if (document.form_vzhled.caricon.value == "12") 
  {
   document.iconaauta.src='./pic/auto.gif';	
  } 

 if (document.form_vzhled.caricon.value == "11") 
  {
   document.iconaauta.src='./pic/auto13.gif';	
  } 

 if (document.form_vzhled.caricon.value == "10") 
  {
   document.iconaauta.src='./pic/auto12.gif';	
  } 
  
 if (document.form_vzhled.caricon.value == "9") 
  {
   document.iconaauta.src='./pic/auto11.gif';	
  } 
 
 if (document.form_vzhled.caricon.value == "8") 
  {
   document.iconaauta.src='./pic/auto10.gif';	
  } 

 if (document.form_vzhled.caricon.value == "7") 
  {
   document.iconaauta.src='./pic/auto9.gif';	
  } 
 
 if (document.form_vzhled.caricon.value == "6") 
  {
   document.iconaauta.src='./pic/auto8.gif';	
  } 

 if (document.form_vzhled.caricon.value == "5") 
  {
   document.iconaauta.src='./pic/auto7.gif';	
  } 

 if (document.form_vzhled.caricon.value == "4") 
  {
   document.iconaauta.src='./pic/auto6.gif';	
  } 


 if (document.form_vzhled.caricon.value == "3") 
  {
   document.iconaauta.src='./pic/auto5.gif';	
  } 
 
 if (document.form_vzhled.caricon.value == "2") 
  {
   document.iconaauta.src='./pic/auto4.gif';	
  } 
  
 if (document.form_vzhled.caricon.value == "1") 
  {
   document.iconaauta.src='./pic/auto3.gif';	
  } 
  
 if (document.form_vzhled.caricon.value == "0") 
  {
   document.iconaauta.src='./pic/auto2.gif';	
  } 
}

function zmenHelp(i, obsah){ 
	if (el = document.getElementById(i)){
		if (el.style.display == 'none'){
			el.style.display='block';
			el.innerHTML = obsah; 
		} else {
			el.style.display='none';
		}
	}
}
function help_in(i){ 
	if (el = document.getElementById('help_'+i)){ 
		if (el.style.display == 'none'){
			el.style.display = 'block';
		} else {
			el.style.display = 'none';
		}
	}
	tmp = 'dnes.php?zalozka=hide_help&id='+i;
	if (el = document.getElementById('exec_send')){
		el.src = tmp;
	}
}
function skryjHelp(i){
	if (el = document.getElementById(i)){ 
			el.style.display='none'; 
	}
}
function zobrazHelp(i){
	if (el = document.getElementById(i)){ 
			el.style.display='block'; 
	}
}

function zobrazHelp2(i){
	if (el = document.getElementById(i)){
		new Boxy(el.innerHTML,{title: "Nápovìda", modal: true}); 
		//new Boxy('<div style="width:300px;height:300px;">ahgoj, test</div>',{title: "Nápovìda", modal: true}); 
			//alert(el.innerHTML);
	}
}
function help(i){ 
// funkce na dotazeni napovedy 
	urls='./dnes.php?zalozka=help&id='+i; 
	//  alert(urls);
	// odmazeme stary skript, pokud existoval
    var hlavicka = document.getElementsByTagName('head')[0];
    var dataLoader = document.getElementById('scriptLoader');
    if(dataLoader) hlavicka.removeChild(dataLoader);

    // vytvorime novy element script
    script = document.createElement('script');
    script.id = 'scriptLoader';
    script.src = urls;

    // POZOR, DULEZITE!! Skript musime vlozit do stranky 
    // pomoci DOM - appendChild()
    // Ihned po vlozeni prohlizec stahne skript a spusti jej
    x = document.getElementsByTagName('head')[0];
    x.appendChild(script); 
    return false; 
} 

function kontrola_prohlizec(hlaskaFF, hlaskaCookie, hlaskaIE){
 	if ((navigator.appName=="Microsoft Internet Explorer") && (navigator.appVersion>="3.0")) {
	 	typ='IE3'; 
		if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
		 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
		  if (ieversion < 7)
		  	document.write(hlaskaIE ); 
		}
	 } else {
	 	 prohl= navigator.userAgent; 
		 if (prohl.search("Firefox")<0  && prohl.search("Chrome")<0  ) {
	 		document.write(hlaskaFF );
		 }  
	 }
	 if ( navigator.cookieEnabled == false){
	 	document.write(hlaskaCookie);
	 }
}

function kontrola_prohlizec2(hlaskaFF, hlaskaIE ){
 	 if ((navigator.appName=="Microsoft Internet Explorer") && (navigator.appVersion>="3.0")) {
	 	typ='IE3'; 
		if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
		 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
		  if (ieversion < 7)
		  	alert(hlaskaIE ); 
		}
	 } else {
	 	 prohl= navigator.userAgent;
		 if (prohl.search("Firefox")<0 && prohl.search("Chrome")<0 ) {
	 		alert(hlaskaFF);
		 }  
	 }
}
function win_op_agenda(m_link, sizeX, sizeY){ 
	left = (screen.width - sizeX) / 2;
	topp  = (screen.height - sizeY) / 2; 
	//strWindow = 'modal=1,dependent=1,z-lock=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0,width=' + sizeX + ',height=' + sizeY + ',left=' + left +',top=' + topp;
	if (navigator.userAgent.search('Chrome/2')<0 ) { 
		strWindow = 'dialogHeight:' + sizeY + 'px;dialogWidth:' + sizeX + 'px;dialogLeft=' +  left + 'px;dialogtop=' + topp + 'px;status:no;edge:sunken';
		retVal = showModalDialog(m_link, 'editace', strWindow);
	} else { 
		strWindow = 'width='+sizeX+',height='+sizeY+',scrollbars=1,resizable=yes, toolbar=no,location=no,directories=no,status=no,menubar=no,left=' + left + ',top='+topp;
		hand = window.open(m_link,'editace',strWindow ); 
		if (hand != null){
			hand.focus();
		}
	} 
	document.location.reload(); 
	top.frames["menu"].location.reload(); 
}
function zobraz_nova_SMS(c){     
	if (el = document.getElementById('imgnovasms')){
		if (c == 0){
			el.style.display= 'none'; 
		} else {
			el.style.display= 'block';  
		}   
	}
}   
	function sms_setfilter(proc){
		if (proc == 0){
			document.getElementById('novasms').style.display = 'none';
		} else {
			if (el = document.getElementById('novasms')){
				el.className = 'oknosms'+ proc ; 
			}
		}
	}  
	function zapnisms(){
		this.document.getElementById('novasms').style.display = 'block'; 
		setTimeout('sms_setfilter(75)', 12000); 
		setTimeout('sms_setfilter(50)', 12500); 
		setTimeout('sms_setfilter(0)', 13000); 
	}
	
		function odesli_uloz_plochu(){
			a = window.top.frames["mapa"].document.mapserv.vyskaframemapy.value ;
			document.form_cas.u_vyskamapa.value = a; 
			b = window.top.frames["tree"].document.list_car.vyskastrom.value ;
			document.form_cas.u_vyskastrom.value = b;
			c = window.top.frames["tree"].document.list_car.sirkastrom.value ;
			document.form_cas.u_sirkastrom.value = c;
			document.form_cas.submit(); 
		}   
		function zahraj(){
			playSound(); 
		}
