').appendTo('body');
$div.attr('id', 'ok-final').html(get_ok);
}
if ($(".err").length) {
get_err="";
$(".err").each(function() {
if (get_err!='') { get_err=get_err+"
"; }
get_err=get_err+$(this).text();
});
var $div = $('
').appendTo('body');
$div.attr('id', 'err-final').html(get_err);
}
$("#ok-final, #err-final").on("click",function() {
$(this).fadeOut(250);
});
$("#mainscreen").show(); $("#mainscreen").hide(); // kvoli oneskorenemu nacitaniu tlacidla nacitaj, tak nech sa inicializuje predcachovanie
$("a:not(a[href^='box_pdf_']) input[type=button]:not(.noload), a:not(a[href^='box_pdf_']) button:not(.noload), a[target!='_blank']:not(a[href^='#']):not(.noload) img[src^='obr/']:not(img[src^='obr/pdf']):not(img[src^='obr/eye']):not(img[src^='obr/map.png']):not(img[src^='obr/man_']):not(.zam_button), a .zam_button, .submenu li a:not(.subexpandable), a[href*='fromzazn=']").on("click",function() {
$("#loading").show();
$("#mainscreen").hide();
});
$("#mainscreen input[type=submit][style^='display: none'], #mainscreen input[type=submit][style^='display:none']").addClass('noload');
$('form:not(.noload)').submit(function () {
$("#loading").show();
$("#mainscreen").hide();
});
$('body').on('click', '.loadclick', function() {
// pod .loadclick je vsetko co sa neda univerzalne podchytit, napriklad nejake odkliky z useruvodu, samostatne cez body kvoli dynamicky generovanym premennym s danym class (napr kontrola neuzavretych ukonov z adminuvod)
$("#loading").show();
$("#mainscreen").hide();
});
$( "#show_menu_mobile" ).on("click",function() {
$('#admin_menu_mobile').slideToggle(500);
//$("#show_menu_mobile").hide();
});
if (isloaded==1) { $("#mainscreen").show(); }
$(".time5min,.time15min,.time30min").attr('placeholder',"HH:MM").attr('pattern',"([01]?[0-9]|2[0-3]):[0-5][0-9]");
// DATEPICKER start
$(".datum,.datum_pon,.datum1d,.datum_oddnes,.datum_odzajtra,.datum_dodnes,#datum_od,#datum_do,.datumuz,#koniec,.datumlim,#datkon").attr('placeholder',"DD.MM.YYYY").attr('pattern',"^((3[01]|[12][0-9]|0?[1-9])\.(1[0-2]|0?[1-9])\.(19|20)[0-9]{2})$");
$(".datum,.datum_pon,.datum1d,.datum_oddnes,.datum_odzajtra,.datum_dodnes,#datum_od,#datum_do,.datumuz,#koniec,.datumlim,#datkon").on("change",function() {
if ($(this).val().substr(0,6)=='30.02.') { $(this).val('28.02.'+$(this).val().substr(6)); }
if ($(this).val().substr(0,5)=='30.2.') { $(this).val('28.2.'+$(this).val().substr(5)); }
if ($(this).val().substr(0,6)=='31.02.') { $(this).val('28.02.'+$(this).val().substr(6)); }
if ($(this).val().substr(0,5)=='31.2.') { $(this).val('28.2.'+$(this).val().substr(5)); }
if ($(this).val().substr(0,6)=='31.04.') { $(this).val('30.04.'+$(this).val().substr(6)); }
if ($(this).val().substr(0,5)=='31.4.') { $(this).val('30.4.'+$(this).val().substr(5)); }
if ($(this).val().substr(0,6)=='31.06.') { $(this).val('30.06.'+$(this).val().substr(6)); }
if ($(this).val().substr(0,5)=='31.6.') { $(this).val('30.6.'+$(this).val().substr(5)); }
if ($(this).val().substr(0,6)=='31.09.') { $(this).val('30.09.'+$(this).val().substr(6)); }
if ($(this).val().substr(0,5)=='31.9.') { $(this).val('30.9.'+$(this).val().substr(5)); }
if ($(this).val().substr(0,6)=='31.11.') { $(this).val('30.11.'+$(this).val().substr(6)); }
});
$(".datum,.datum_pon,.datum1d,.datum_oddnes,.datum_odzajtra,.datum_dodnes,#datum_od,#datum_do").on("keydown",function(event) {
if (event.which === 8 || event.which === 46) {
$(this).val("");
}
//return false;
});
$(".datum_pon").datepicker({changeMonth: true,
changeYear: true,
showOtherMonths: true,
selectOtherMonths: true,
yearRange: "1910:2100",
dateFormat: "dd.mm.yy",
monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec" ],
firstDay: 1,
dayNamesMin: [ "Ne", "Po", "Ut", "St", "Št", "Pi", "So" ],
showButtonPanel: true,
currentText: "Akt. mes.",
closeText: "Zavri",
beforeShowDay: function(date){ return [date.getDay() == 1,""]}
});
$(".datum").datepicker({changeMonth: true,
changeYear: true,
showOtherMonths: true,
selectOtherMonths: true,
yearRange: "1910:2100",
dateFormat: "dd.mm.yy",
monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec" ],
firstDay: 1,
dayNamesMin: [ "Ne", "Po", "Ut", "St", "Št", "Pi", "So" ],
showButtonPanel: true,
currentText: "Akt. mes.",
closeText: "Zavri"});
var d = new Date();
var datumbezdna=d.getFullYear()+'-'+((d.getMonth())+1);
$(".datum_oddnes").datepicker({ /* od dnesneho dna */
changeMonth: true,
changeYear: true,
showOtherMonths: true,
selectOtherMonths: true,
yearRange: "1910:2100",
dateFormat: "dd.mm.yy",
monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec" ],
firstDay: 1,
dayNamesMin: [ "Ne", "Po", "Ut", "St", "Št", "Pi", "So" ],
showButtonPanel: true,
currentText: "Akt. mes.",
closeText: "Zavri",
minDate: 0
});
$(".datum_odzajtra").datepicker({ /* od dnesneho dna */
changeMonth: true,
changeYear: true,
showOtherMonths: true,
selectOtherMonths: true,
yearRange: "1910:2100",
dateFormat: "dd.mm.yy",
monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec" ],
firstDay: 1,
dayNamesMin: [ "Ne", "Po", "Ut", "St", "Št", "Pi", "So" ],
showButtonPanel: true,
currentText: "Akt. mes.",
closeText: "Zavri",
minDate: 1
});
$(".datum_dodnes").datepicker({ /* do dnesneho dna */
changeMonth: true,
changeYear: true,
showOtherMonths: true,
selectOtherMonths: true,
yearRange: "1910:2100",
dateFormat: "dd.mm.yy",
monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec" ],
firstDay: 1,
dayNamesMin: [ "Ne", "Po", "Ut", "St", "Št", "Pi", "So" ],
showButtonPanel: true,
currentText: "Akt. mes.",
closeText: "Zavri",
maxDate: 0
});
$(".datum1d").datepicker({ /* od prveho dna v aktualnom mesiaci */
changeMonth: true,
changeYear: true,
showOtherMonths: true,
selectOtherMonths: true,
yearRange: "1910:2100",
dateFormat: "dd.mm.yy",
monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec" ],
firstDay: 1,
dayNamesMin: [ "Ne", "Po", "Ut", "St", "Št", "Pi", "So" ],
showButtonPanel: true,
currentText: "Akt. mes.",
closeText: "Zavri",
minDate: new Date(datumbezdna+'-01')
});
var dateFormat = "dd.mm.yy",
from = $( "#datum_od" ).datepicker({
changeMonth: true,
changeYear: true,
showOtherMonths: true,
selectOtherMonths: true,
yearRange: "1910:2100",
dateFormat: "dd.mm.yy",
monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec" ],
firstDay: 1,
dayNamesMin: [ "Ne", "Po", "Ut", "St", "Št", "Pi", "So" ],
showButtonPanel: true,
currentText: "Akt. mes.",
closeText: "Zavri" })
.on( "change", function() {
to.datepicker( "option", "minDate", getDate( this ) );
}),
to = $( "#datum_do" ).datepicker({
changeMonth: true,
changeYear: true,
showOtherMonths: true,
selectOtherMonths: true,
yearRange: "1910:2100",
dateFormat: "dd.mm.yy",
monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec" ],
firstDay: 1,
dayNamesMin: [ "Ne", "Po", "Ut", "St", "Št", "Pi", "So" ],
showButtonPanel: true,
currentText: "Akt. mes.",
closeText: "Zavri" })
.on( "change", function() {
from.datepicker( "option", "maxDate", getDate( this ) );
});
function getDate( element ) {
var date;
try {
date = $.datepicker.parseDate( dateFormat, element.value );
} catch( error ) {
date = null;
}
return date;
}
// DATEPICKER end
// CONTACT start
$("#contact_sent1").on("click",function() { // z uvodu
typ_val=$("#contact_typ1 option:selected").text();
typc_val=$("#contact_typ1 option:selected").val();
mail_val=$("#contact_mail1").val();
text_val=$("#contact_text1").val();
konto_val=$("#ddkonto").val();
var form_data = new FormData();
if (typeof document.getElementById("file").files[0] !== 'undefined') {
var name = document.getElementById("file").files[0].name;
form_data.append("file", document.getElementById('file').files[0]);
}
form_data.append("co", 'kontakt');
form_data.append("typ", typ_val);
form_data.append("typc", typc_val);
form_data.append("mail", mail_val);
form_data.append("text", text_val);
form_data.append("ddkonto", konto_val);
$.ajax({
url:"getcontact.php",
method:"POST",
data: form_data,
contentType: false,
cache: false,
processData: false,
beforeSend:function(){
$("#contactnotice").html("
Odosielam...");
},
success:function(data){
if (data=='ok') {
$("#contact_typ1").hide(500);
$("#contact_mail1").hide(500);
$("#contact_text1").val();
$('#mail-ref1').hide(500);
$("#contact_sent1").hide();
$("#file").hide();
$("#contact_sent1").hide();
$("#contactnotice").html("
Správa bola úspešne odoslaná. Ďakujeme.");
} else {
alert(data);
$("#contactnotice").text('');
}
}
});
});
// CONTACT end
});
$(document).tooltip({ track: true });