
$(document).ready(function(){
    $('#coin-slider').coinslider({ width: 950, height: 230, navigation: true, delay: 8000, opacity: 0.5, titleSpeed: 3000, effect: 'straight', hoverPause: true});
    $('#laser').coinslider({ width: 950, height: 120, navigation: true, delay: 8000, opacity: 0.5, titleSpeed: 3000, hoverPause: true});
});

$(document).ready(function(){

});

$(document).ready(function(){
        $(function() {
          $( "#accordion" ).accordion({
              collapsible: true, 
              active: false,
              autoHeight: false
          });
        });
});

$(document).ready(function(){
        $(function() {

            $("#laser-tabs").organicTabs();

            $("#laser-tabs-two").organicTabs({
              "speed": 200
              });

            });
});

$(document).ready(function(){
        $(function(){
          $('#contact').validate({
            submitHandler: function(form) {
              $(form).ajaxSubmit({
                url: 'process.php',
                success: function() {
                  $('#contact').hide();
                  $('#contact-form').append("<p class='thanks'>Hvala! Vaše sporočilo je poslano.</p>")
                }
              });
            }
          });
        });
    
});

$(document).ready(function(){

        $(function() {

            $("#laser-tabs").organicTabs();

            $("#laser-tabs-two").organicTabs({
              "speed": 200
              });

            });
});

$(document).ready(function(){
                $.validator.addMethod("regex",function(value,element,regexp){
                    var re= new RegExp(regexp);
                    return this.optional(element) || re.test(value);
                },"Vnesite vaše ime brez strešic.");
                $("#contact_form").validate({
                    rules:{
                        name:{
                            required:true,
                            regex:"^[a-zA-Z0-9_]+$" //Only Apha-Numeric
                        },
                        email:{
                            email:true,
                            required:true
                        }
                    },
                    messages:{
                        name:{
                            required:"Ime je obvezno."
                        },
                        email:{
                            email:"Vsebovati mora veljaven email naslov!",
                            required:"Email je obvezen."
                        }
                    },
                    submitHandler:function(){
                        alert("Vsa polja so pravilna. Pošljem sporočilo.");
                        form.submit();
                    }
                })
})

$(document).ready(function(){

    $.organicTabs = function(el, options) {

        var base = this;
        base.$el = $(el);
        base.$nav = base.$el.find(".nav");

        base.init = function() {

            base.options = $.extend({},$.organicTabs.defaultOptions, options);

            // Accessible hiding fix
            $(".hide").css({
                "position": "relative",
                "top": 0,
                "left": 0,
                "display": "none"
            }); 

            base.$nav.delegate("li > a", "click", function() {

                // Figure out current list via CSS class
                var curList = base.$el.find("a.current").attr("href").substring(1),

                // List moving to
                $newList = $(this),

                // Figure out ID of new list
                listID = $newList.attr("href").substring(1),

                // Set outer wrapper height to (static) height of current inner list
                $allListWrap = base.$el.find(".list-wrap"),
                curListHeight = $allListWrap.height();
            $allListWrap.height(curListHeight);

            if ((listID != curList) && ( base.$el.find(":animated").length == 0)) {

                // Fade out current list
                base.$el.find("#"+curList).fadeOut(base.options.speed, function() {

                    // Fade in new list on callback
                    base.$el.find("#"+listID).fadeIn(base.options.speed);

                    // Adjust outer wrapper to fit new list snuggly
                    var newHeight = base.$el.find("#"+listID).height();
                    $allListWrap.animate({
                        height: newHeight
                    });

                    // Remove highlighting - Add to just-clicked tab
                    base.$el.find(".nav li a").removeClass("current");
                    $newList.addClass("current");

                });

            }   

            // Don't behave like a regular link
            // Stop propegation and bubbling
            return false;
            });

        };
        base.init();
    };

    $.organicTabs.defaultOptions = {
        "speed": 300
    };

    $.fn.organicTabs = function(options) {
        return this.each(function() {
            (new $.organicTabs(this, options));
        });
    };

})(jQuery);

