$(document).ready(function(){
  
  $(".eventClass_startSpinner").click(function(){
  	$(".event_class_spinerHolder").spinner();
  });
    // custom easing called "custom"
    $.easing.custom = function (x, t, b, c, d) {
        var s = 1.70158;
        if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
        return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
    }
                                                                                                                                
    $("div.scrollable").scrollable({
        circular: true,
        delay: 2000
    }).autoscroll(4000);

    //var api = $('div.scrollable').scrollable();

//api=jQuery("div.scrollable").scrollable({api:true});   
//api.onBeforeSeek(function(){ jQuery("div.scrollable img").fadeOut(40); });
//api.onSeek(function(){ jQuery("div.scrollable img").fadeIn(400); });

 if($(".lightboxy").size()){
        $('.lightboxy a').lightBox();
    }
    
    
    
    if(typeof currentLanguageId != 'undefined' && currentLanguageId == 1){

        $.tools.dateinput.localize("hr",  {
            months:        'Siječanj,Veljača,Ožujak,Travanj,Svibanj,Liupanj,Srpanj,Kolovoz,' +
            'Rujan,Listopad,Studeni,Prosinac',
            shortMonths:   'Sij,Velj,Ožu,Tra,Svi,Lip,Srp,Kol,Ruj,Lis,Stu,Pro',
            days:          'ponedjeljak,utorak,srijeda,četvrtal,petak,subota,nedjelja',
            shortDays:     'pon,uto,sri,čet,pet,sub,ned'
        });

        $(":date").dateinput({
            trigger: true,
            lang: 'hr',
            format: 'dd.mm.yyyy',
            min: -1
        });
    }
    else
    {
        $(":date").dateinput({
            trigger: true,
            format: 'dd.mm.yyyy',
            min: -1
        })
    }
    // use the same callback for two different events. possible with bind
    $(":date").bind("onShow onHide", function()  {
        $(this).parent().toggleClass("active");
    });

    // when first date input is changed
    if($(":date:first").size()){
        $(":date:first").data("dateinput").change(function() {
		
            // we use it's value for the seconds input min option
            $(":date:last").data("dateinput").setMin(this.getValue(), true);
        });
    }
    $.tools.validator.fn("[name=pickupdate]", "", function(input, value) {
        if(value != $("#clicktoselect").val() && value.length>0){
            return true;
        }else{
            return false;
        }

    });
    $.tools.validator.fn("[name=dropoffdate]", "", function(input, value) {
        if(value != $("#clicktoselect").val() && value.length>0){
            return true;
        }else{
            return false;
        }

    });

    $("#eventId_validateForm").validator();
    $("#eventId_validateForm").bind("onFail",function(){
    	$(".event_class_spinerHolder").spinner('remove');
    });

});
