function alpha(e) { var k; document.all ? k = e.keyCode : k = e.which; return ((k > 64 && k < 91) || (k > 47 && k < 58) || (k > 96 && k < 123) || k == 8 || k == 45 || k == 95); } //pre admimenu ddaccordion.init({ headerclass: "headerbar", //Shared CSS class name of headers group contentclass: "submenu", //Shared CSS class name of contents group revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover" mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover collapseprev: true, //Collapse previous content (so only one open at any time)? true/false defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc] [] denotes no content onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed) animatedefault: true, //Should contents open by default be animated into view? persiststate: true, //persist state of opened contents within browser session? toggleclass: ["", "selected"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"] togglehtml: ["", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs) animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow" oninit:function(headers, expandedindices){ //custom code to run when headers have initalized //do nothing }, onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed //do nothing } }) ddaccordion.init({ //2nd level headers initialization headerclass: "subexpandable", //Shared CSS class name of sub headers group that are expandable contentclass: "subcategoryitems", //Shared CSS class name of sub contents group revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover collapseprev: true, //Collapse previous content (so only one open at any time)? true/false defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed) animatedefault: false, //Should contents open by default be animated into view? persiststate: true, //persist state of opened contents within browser session? toggleclass: ["opensubheader", "closedsubheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"] togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs) animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow" oninit:function(headers, expandedindices){ //custom code to run when headers have initalized //do nothing }, onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed //do nothing } }) // deaktivovanie F1 pre Chrome function disableFunctionKeys(e) { var functionKeys = new Array(112, 113); // F1 if (functionKeys.indexOf(e.keyCode) > -1 || functionKeys.indexOf(e.which) > -1) { e.preventDefault(); } }; //deaktivovanie F1 pre IE if ("onhelp" in window) window.onhelp = function () { //showMyHelpInsteadOfTheUsualDefaultHelpWindow(true); return false; } // Others else { document.onkeydown = function(evt) { cancelKeypress = (evt.keyCode == 112); if (cancelKeypress) { // F1 was pressed //showMyHelpInsteadOfTheUsualDefaultHelpWindow(true); return false; } } // Additional step required for Opera document.onkeypress = function(evt) { if (cancelKeypress) return false; } } function convertNumToTime(number) { // Check sign of given number var sign = (number >= 0) ? 1 : -1; // Set positive value of number of sign negative number = number * sign; // Separate the int from the decimal part var hour = Math.floor(number); var decpart = number - hour; var min = 1 / 60; // Round to nearest minute decpart = min * Math.round(decpart / min); var minute = Math.floor(decpart * 60) + ''; // Add padding if need if (minute.length < 2) { minute = '0' + minute; } // Add Sign in final result sign = sign == 1 ? '' : '-'; // Concate hours and minutes time = sign + hour + ':' + minute; return time; } function parseDate(str) { var mdy = str.split('.'); return new Date(mdy[2], mdy[1], mdy[0]-1); } function daydiff(first, second) { return Math.floor((second-first)/(1000*60*60*24*365.25)); } function zeroPad(num, numZeros) { var n = Math.abs(num); var zeros = Math.max(0, numZeros - Math.floor(n).toString().length ); var zeroString = Math.pow(10,zeros).toString().substr(1); if( num < 0 ) { zeroString = '-' + zeroString; } return zeroString+n; } function datafromrodcislo(rodcislo) { setdatnar=''; if (rodcislo.length<9) { return "0||"; } dd=parseInt(rodcislo.substr(4,2)); mm=parseInt(rodcislo.substr(2,2)); yy=parseInt(rodcislo.substr(0,2)); if (mm>50) { poh=0; mm=mm-50; } else { poh=1; } if (((rodcislo.indexOf("/")!='-1' && rodcislo.length==10) || (rodcislo.indexOf("/")=='-1' && rodcislo.length==9)) || yy>53) { setdatnar=zeroPad(dd,2)+"."+zeroPad(mm,2)+".19"+rodcislo.substr(0,2); } else { setdatnar=zeroPad(dd,2)+"."+zeroPad(mm,2)+".20"+rodcislo.substr(0,2); } return poh+"|"+setdatnar+"|"+daydiff(parseDate(setdatnar),parseDate("27.04.2024")); // pohlavie (0-zena,1-muz) | datum narodenia DD.MM.YYYY | pocet rokov } function centerintro_adminheight() { // hlavna farebna plocha v admine + loginobrazovka uvodu na stred var biely_blok = ($(window).height() - $(".vrch").height() - $(".spodok").height()); $('.admin-content').css("min-height",biely_blok-46); var centro = (((biely_blok)/2) - $("#center-block").height()/2 - 15); if (0>centro) { centro=0; } $('#center-block').css("top",centro); } var def_thheight,def_tdheight,def_width; function height_fixsizetable() { // fixna vyska isfixed=1; if (typeof def_tdheight === 'undefined') { def_thheight=0; def_tdheight=0; $(".fix_size tr th").each(function() { if ($(this).height()>def_thheight) { def_thheight=$(this).height(); } }); $(".fix_size tr td").each(function() { if ($(this).height()>def_tdheight) { def_tdheight=$(this).height(); } }); } if (typeof def_width === 'undefined') { def_width=0; $(".fix_size tr th").each(function() { if ($(this).width()>def_width) { def_width=$(this).width(); } }); $(".fix_size tr td").each(function() { if ($(this).width()>def_width) { def_width=$(this).width(); } }); } $(".fix_size tr th, .fix_size tr td").css("width","100%"); $(".fix_size tr th").css("height",def_thheight); $(".fix_size tr td").css("height",def_tdheight); } function width_fixsizetable() { // max sirka isfixed=1; if (typeof def_tdheight === 'undefined') { def_thheight=0; def_tdheight=0; $(".fix_size tr th").each(function() { if ($(this).height()>def_thheight) { def_thheight=$(this).height(); } }); $(".fix_size tr td").each(function() { if ($(this).height()>def_tdheight) { def_tdheight=$(this).height(); } }); } if (typeof def_width === 'undefined') { def_width=0; $(".fix_size tr th").each(function() { if ($(this).width()>def_width) { def_width=$(this).width(); } }); $(".fix_size tr td").each(function() { if ($(this).width()>def_width) { def_width=$(this).width(); } }); } $(".fix_size tr th").css("height","1"); $(".fix_size tr td").css("height","1"); $(".fix_size tr th, .fix_size tr td").css("width",def_width); } function height_fixsizetable2() { // kvoli oneskorenemu nacitavaniu input type image if (typeof isfixed !== 'undefined' && isfixed==1 && $(window).width()>800) { set_heighttd=0; $(".fix_size tr td").each(function() { if ($(this).height()>set_heighttd) { set_heighttd=$(this).height(); } if ($(this).height()>def_tdheight) { def_tdheight=$(this).height(); } }); $(".fix_size tr td").css("height",def_tdheight); } } function patchtables() { if ($(window).width()<801) { $(".fix_size").css('display','table'); width_fixsizetable(); $(".fix_size tr th").each(function() { $(this).has('img').hide(); }); } else { $(".fix_size").css('display','inline-block'); height_fixsizetable(); $(".fix_size tr th").each(function() { $(this).has('img').show(); }); } if (typeof resethidden == 'function') { // funkcia na predvolene hide po nacitani mainscreen v jednotlivych moduloch, ak existuje resethidden(); } } $(window).on("load", function(){ //pre chosen $("select").each(function(){ // kvoli cervenemu background musime mat class='required' spolus parametrom required pri selectoch if($(this).prop('required')){ $(this).addClass("required"); } }); $("select").not(".nochosen").not(".chosen8").not(".chosen14").not(".chosen20").not(".chosen50").not(".chosen30").addClass("chosen-select"); $('.chosen-select').on("change",function() { centerintro_adminheight(); }); var config = { '.chosen-select' : {width:"100%",search_contains: true,inherit_select_classes: true}, '.chosen8' : {width:"100%",search_contains: true,inherit_select_classes: true,max_selected_options:8}, '.chosen14' : {width:"100%",search_contains: true,inherit_select_classes: true,max_selected_options:14}, '.chosen20' : {width:"100%",search_contains: true,inherit_select_classes: true,max_selected_options:20}, '.chosen30' : {width:"100%",search_contains: true,inherit_select_classes: true,max_selected_options:30}, '.chosen50' : {width:"100%",search_contains: true,inherit_select_classes: true,max_selected_options:50}, '.chosen-select-deselect' : {allow_single_deselect:true}, '.chosen-select-no-single' : {disable_search_threshold:10}, '.chosen-select-width' : {width:"100%"} } for (var selector in config) { $(selector).chosen(config[selector]); } $('.chosen-drop').css({"minWidth": "100%", "width": "auto", "white-space": "nowrap"}); // kalendar v tyzdni/dni skok na cas od 8:00 setTimeout("$('.scolltimeevent').scrollTop(330)", 1000); // zobrazenie obsahu po kompletnom nacitani $("#loading").hide(); $("#mainscreen").show(); autosize(document.querySelectorAll('textarea')); //uprava tabuliek centerintro_adminheight(); patchtables(); if (document.body.scrollHeight > document.body.clientHeight) { $(".scrollbutton2").show(); } isloaded=1; }); reloadedcal=0; isloaded=0; if (document.getElementById('mainscreen')) { document.getElementById('mainscreen').insertAdjacentHTML('beforebegin',"
Načítavam obsah
"); } $(window).on("resize", function() { centerintro_adminheight(); if (typeof loadcal == 'function') { loadcal(); } patchtables(); $(document).scroll(); }); $(function() { //autosize(document.querySelectorAll('textarea')); $(".inline").colorbox({inline:true, width:"50%"}); $(document).on("keypress", ":input:not(textarea):not(.loginfield)", function(event) { return event.keyCode != 13; }); $('.loginfield').on("keyup", function(e) { if (e.keyCode == 13) { $("#loginbox").click(); } }); $('form :input').attr('autocomplete', 'off'); // reset autofill na post pri navrate sipkou cez prehliadac $(document).on('keydown', disableFunctionKeys); $(document).on('scroll',function(e) { if ($(document).scrollLeft()==0 && $(document).scrollTop()==0) { $(".scrollbutton").hide(); if (document.body.scrollHeight > document.body.clientHeight) { $(".scrollbutton2").show(); } else { $(".scrollbutton2").hide(); } } else { $(".scrollbutton").show(); $(".scrollbutton2").hide(); } }); $(".scrollbutton").on('click', function() { $("html, body").animate({scrollTop:0}, { duration: 333, queue: false }); $("html, body").animate({scrollLeft:0}, { duration: 333, queue: false }); $(".scrollbutton").hide(); }); $(".scrollbutton2").on('click', function() { var n = $(document).height(); $("html, body").animate({scrollTop:n}, { duration: 333, queue: false }); $("html, body").animate({scrollLeft:0}, { duration: 333, queue: false }); $(".scrollbutton").show(); $(".scrollbutton2").hide(); }); $(".time30min").timepicker({ showPeriodLabels: false, hourText: 'Hodina', minuteText: 'Min', hours: { starts: 0, ends: 23 }, minutes: { starts: 0, ends: 30, interval: 30 } }); $(".time15min").timepicker({ showPeriodLabels: false, hourText: 'Hodina', minuteText: 'Min', hours: { starts: 0, ends: 23 }, minutes: { starts: 0, ends: 45, interval: 15 } }); $(".time5min").timepicker({ showPeriodLabels: false, hourText: 'Hodina', minuteText: 'Min', hours: { starts: 0, ends: 23 }, minutes: { starts: 0, ends: 55, interval: 5 } }); centerintro_adminheight(); $(".ok, .err").attr('title','Kliknutí­m zavri túto informáciu'); $(".ok, .err").on("click",function() { $(this).slideUp(500); }); var isfixed=0; $("#mainscreen").show(); $("#mainscreen").hide(); // kvoli oneskorenemu nacitaniu tlacidla nacitaj, tak nech sa inicializuje predcachovanie $("#mainscreen input[type=image][src^='button.php']").width(150).height(62).attr('onload','height_fixsizetable2()'); // lebo input type image sa oneskorene nacita, tak dorovnat vysky buniek $("a:not(a[href^='box_pdf_']) img[src^='button.php'], a img[src^='getimg.php?obr2=obr/'], 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_']), .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').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').show(500); $("#show_menu_mobile").hide(); }); if (isloaded==1) { $("#mainscreen").show(); } // DATEPICKER start $(".datum,.datum_pon,.datum1d,.datum_oddnes,.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: "1920: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: d.getFullYear()+":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_dodnes").datepicker({ /* do dnesneho dna */ changeMonth: true, changeYear: true, showOtherMonths: true, selectOtherMonths: true, yearRange: d.getFullYear()+":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: d.getFullYear()+":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: "1920: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: "1920: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 });