﻿// Category tree
$(document).ready(function() {
    $("#navigation").treeview({
        persist: "location",
        prerendered: true,
        collapsed: true,
        unique: true
    });
});

// Slider
$(document).ready(function() {
    $("#featured").tabs({ fx: { opacity: "toggle"} }).tabs("rotate", 5000, true);
});

// Contact accordion
$(document).ready(function () {
    $("#contact-accordion").accordion({
        autoHeight: false,
        navigation: true,
        header: 'h5'
    });
});

// Navigation tooltip
$(document).ready(function () {
    $(".nav-root").tooltip({
        effect: 'fade',
        position: 'bottom center',
        offset: [5, 100],
        opacity: 0.95,
        tipClass: 'nav-tooltip'
    });
});

// Validator regex constraint
$.validator.addMethod(
        "regex",
        function (value, element, regexp) {
            var check = false;
            var re = new RegExp(regexp);
            return this.optional(element) || re.test(value);
        },
        "Please check your input."
);

// Dateinput config
$.tools.dateinput.localize("hr", {
    months: 'Siječanj,Veljača,Ožujak,Travanj,Svibanj,Lipanj,Srpanj,Kolovoz,Rujan,Listopad,Studeni,Prosinac',
    shortMonths: 'Sij,Velj,Ožu,Tra,Svi,Lip,Srp,Kol,Ruj,Lis,Stud,Pros',
    days: 'Nedjelja,Ponedjeljak,Utorak,Srijeda,Četvrtak,Petak,Subota',
    shortDays: 'Ned,Pon,Uto,Sri,Čet,Pet,Sub'
});
$.tools.dateinput.conf.firstDay = 1;
$.tools.dateinput.conf.format = "dd.mm.yyyy";
$.tools.dateinput.conf.selectors = true;
$.tools.dateinput.conf.yearRange = [-100, 10];
$.tools.dateinput.conf.lang = "hr";

