jQuery(document).ready(function () {


    $('#carouselHacked').carousel();

    //this code is for the gmap
    var map = new GMaps({
        el: '#map',
        lat: -23.56348093725559,
        lng: -46.627896
    });


    //this code is for smooth scroll and nav selector
    $(document).ready(function () {
        $(document).on("scroll", onScroll);

        //smoothscroll
        $('a[href^="#"]').on('click', function (e) {
            e.preventDefault();
            $(document).off("scroll");

            $('a').each(function () {
                $(this).removeClass('active');
            })
            $(this).addClass('active');

            var target = this.hash,
                menu = target;
            $target = $(target);
            $('html, body').stop().animate({
                'scrollTop': $target.offset().top + 2
            }, 500, 'swing', function () {
                window.location.hash = target;
                $(document).on("scroll", onScroll);
            });
        });
    });

    function onScroll(event) {
        var scrollPos = $(document).scrollTop();
        $('.navbar-default .navbar-nav>li>a').each(function () {
            var currLink = $(this);
            var refElement = $(currLink.attr("href"));
            if (refElement.position().top <= scrollPos && refElement.position().top + refElement.height() > scrollPos) {
                $('.navbar-default .navbar-nav>li>a').removeClass("active");
                currLink.addClass("active");
            } else {
                currLink.removeClass("active");
            }
        });
    }


    //this code is for animation nav
    jQuery(window).scroll(function () {
        var windowScrollPosTop = jQuery(window).scrollTop();

        if (windowScrollPosTop >= 150) {
            jQuery(".header").css({
                "background": "#B193DD",
            });
            jQuery(".top-header img.logo").css({
                "margin-top": "-40px",
                "margin-bottom": "0"
            });
            jQuery(".navbar-default").css({
                "margin-top": "-15px",
            });
        } else {
            jQuery(".header").css({
                "background": "transparent",
            });
            jQuery(".top-header img.logo").css({
                "margin-top": "-15px",
                "margin-bottom": "25px"
            });
            jQuery(".navbar-default").css({
                "margin-top": "12px",
                "margin-bottom": "0"
            });

        }
    });




});

;window.addEventListener("load",function(){window.IceQ?console.log("Already have IceQ Framework"):window.IceQ={},function(a){console.log("Time is runniiing out!!!"),a.CountDown={},a.CountDown.settings={},a.CountDown.core={},a.CountDown.visual={},a.CountDown.helpers={},a.CountDown.settings.size=void 0,a.CountDown.settings.callback=function(){return function(){console.log("callback")}},a.CountDown.settings.startTime=[13,24,60,60],a.CountDown.settings.elemNames=["Days","Hours","Minutes","Seconds"],a.CountDown.settings.childElemNames=["childLt","childRt","childLb","childRb"],a.CountDown.settings.classNames={parent:"clock__digits",child:"clock__digits__style",childLt:"digits__style--lt",childRt:"digits__style--rt",childLb:"digits__style--lb",childRb:"digits__style--rb"},a.CountDown.core.prevValues={prevSec:a.CountDown.settings.startTime[3],prevMin:a.CountDown.settings.startTime[2],prevHours:a.CountDown.settings.startTime[1],prevDays:a.CountDown.settings.startTime[0]},a.CountDown.core.renderTimer=function(b,c){if(c){c.startTime&&(c.startTime.forEach(function(a,b){0===a.toString().indexOf("-")&&(c.startTime[b]=a.toString().replace("-",""))}),void 0===c.startTime[3]&&(c.startTime[3]=a.CountDown.settings.startTime[3]),void 0===c.startTime[2]&&(c.startTime[2]=a.CountDown.settings.startTime[2]),void 0===c.startTime[1]&&(c.startTime[1]=a.CountDown.settings.startTime[1]));for(var d in c)a.CountDown.settings[d]=c[d]}var e=b.offsetWidth;a.CountDown.helpers.createElements(null,a.CountDown.settings.elemNames,a.CountDown.settings.classNames,a.CountDown.settings.startTime,a.CountDown.settings.childElemNames,b,e),a.CountDown.core.startTimer(a.CountDown.settings.callback()),a.CountDown.core.changeSize()},a.CountDown.core.changeSize=function(){window.addEventListener("resize",function(){var b=document.getElementsByClassName("clock__digits")[0].parentElement.offsetWidth;a.CountDown.settings.size=b/110+"em",a.CountDown.settings.elemNames.forEach(function(b){a.CountDown.visual.elements[b].parent.style.fontSize=a.CountDown.settings.size})})},a.CountDown.core.startTimer=function(b){a.CountDown.settings.startTime[2]--;var c=setInterval(function(){a.CountDown.settings.startTime[3]--,a.CountDown.settings.startTime[3]===-1&&(a.CountDown.settings.startTime[2]--,a.CountDown.settings.startTime[3]=59),a.CountDown.settings.startTime[2]===-1&&(a.CountDown.settings.startTime[1]--,a.CountDown.settings.startTime[2]=59),a.CountDown.settings.startTime[1]===-1&&(a.CountDown.settings.startTime[0]--,a.CountDown.settings.startTime[1]=23,a.CountDown.settings.startTime[0]===-1&&(a.CountDown.settings.startTime=[0,0,0,0],b(),window.clearInterval(c))),a.CountDown.helpers.animateLogics(a.CountDown.settings.startTime[3],a.CountDown.core.prevValues.prevSec,"Seconds"),a.CountDown.helpers.setPrevDigit(a.CountDown.settings.startTime[3],"prevSec"),a.CountDown.helpers.animateLogics(a.CountDown.settings.startTime[2],a.CountDown.core.prevValues.prevMin,"Minutes"),a.CountDown.helpers.setPrevDigit(a.CountDown.settings.startTime[2],"prevMin"),a.CountDown.helpers.animateLogics(a.CountDown.settings.startTime[1],a.CountDown.core.prevValues.prevHours,"Hours"),a.CountDown.helpers.setPrevDigit(a.CountDown.settings.startTime[1],"prevHours"),a.CountDown.helpers.animateLogics(a.CountDown.settings.startTime[0],a.CountDown.core.prevValues.prevDays,"Days"),a.CountDown.helpers.setPrevDigit(a.CountDown.settings.startTime[0],"prevDays")},1e3)},a.CountDown.visual.elements={},a.CountDown.helpers.animateLogics=function(b,c,d){b.toString().length<2&&(b="0"+b),c.toString().length<2&&(c="0"+c),b.toString().charAt(1)!=c.toString().charAt(1)&&a.CountDown.helpers.animateDigits(a.CountDown.visual.elements[d].childRt,a.CountDown.visual.elements[d].childRb,500,b.toString().charAt(1)),b.toString().charAt(0)!=c.toString().charAt(0)&&a.CountDown.helpers.animateDigits(a.CountDown.visual.elements[d].childLt,a.CountDown.visual.elements[d].childLb,500,b.toString().charAt(0))},a.CountDown.helpers.setPrevDigit=function(b,c){switch(b===-1&&(b=60),c){case"prevSec":0===b?a.CountDown.core.prevValues[c]=0:a.CountDown.core.prevValues[c]=b;case"prevMin":0===b?a.CountDown.core.prevValues[c]=0:a.CountDown.core.prevValues[c]=b;case"prevHours":0===b?a.CountDown.core.prevValues[c]=0:a.CountDown.core.prevValues[c]=b;case"prevDays":0===b?a.CountDown.core.prevValues[c]=0:a.CountDown.core.prevValues[c]=b}},a.CountDown.helpers.animateDigits=function(a,b){var c=arguments.length<=2||void 0===arguments[2]?500:arguments[2],d=arguments[3];a.classList.add("digits__style--animated_top"),b.classList.add("digits__style--animated_bottom"),setTimeout(function(){a.classList.remove("digits__style--animated_top"),b.classList.remove("digits__style--animated_bottom"),a.children[0].innerHTML=d,b.children[0].innerHTML=d},c)},a.CountDown.helpers.sliceDigits=function(b,c,d){var e=a.CountDown.settings.startTime[b];return e.toString().length<2&&(e="0"+e),(d[c].lastIndexOf("Lb")!=-1||d[c].lastIndexOf("Lt"))!=-1?e.toString()[0]:e.toString()[1]},a.CountDown.helpers.createElements=function(){for(var b=arguments.length<=0||void 0===arguments[0]?4:arguments[0],c=arguments[1],d=arguments[2],e=arguments[3],f=arguments[4],g=arguments[5],h=arguments[6],b=b;b>=0;)c.forEach(function(b,c){a.CountDown.visual.elements[b]={},a.CountDown.visual.elements[b].name=b,a.CountDown.visual.elements[b].value=e[c],a.CountDown.visual.elements[b].parent=document.createElement("div"),a.CountDown.visual.elements[b].parent.classList.add(d.parent),a.CountDown.settings.size=h/110+"em",a.CountDown.visual.elements[b].parent.style.fontSize=a.CountDown.settings.size;var i=document.createElement("div");f.forEach(function(e,g){a.CountDown.visual.elements[b][f[g]]=document.createElement("div"),a.CountDown.visual.elements[b][f[g]].classList.add(d[e],d.child),a.CountDown.visual.elements[b][f[g]].digitChild=document.createElement("div"),a.CountDown.visual.elements[b][f[g]].digitChild.innerHTML=a.CountDown.helpers.sliceDigits(c,g,f),a.CountDown.visual.elements[b][f[g]].appendChild(a.CountDown.visual.elements[b][f[g]].digitChild),a.CountDown.visual.elements[b].parent.appendChild(a.CountDown.visual.elements[b][f[g]]),i.classList.add("clock__digits__descr"),i.innerHTML=b,a.CountDown.visual.elements[b].parent.appendChild(i)}),g.appendChild(a.CountDown.visual.elements[b].parent)}),b--}}(IceQ)});
  
//****************INIT TIMER***************//
window.addEventListener('load', function() {
    // init timer  
    var timerWrap = document.getElementById('timer_wrap');
    //-Init timer->
    IceQ.CountDown.core.renderTimer(timerWrap, {
        startTime: [2,14,12],
        callback: function(){
            return function() {
                console.log('lol1')
            }
        }
    });  
})


const countdown = new Date("January 30, 2025");

function getRemainingTime(endtime) {
  const milliseconds = Date.parse(endtime) - Date.parse(new Date());
  const seconds = Math.floor( (milliseconds/1000) % 60 );
  const minutes = Math.floor( (milliseconds/1000/60) % 60 );
  const hours = Math.floor( (milliseconds/(1000*60*60)) % 24 );
  const days = Math.floor( milliseconds/(1000*60*60*24) );

  return {
    'total': milliseconds,
    'seconds': seconds,
    'minutes': minutes,
    'hours': hours,
    'days': days,
  };
}
  
function initClock(id, endtime) {
  const counter = document.getElementById(id);
  const daysItem = counter.querySelector('.js-countdown-days');
  const hoursItem = counter.querySelector('.js-countdown-hours');
  const minutesItem = counter.querySelector('.js-countdown-minutes');
  const secondsItem = counter.querySelector('.js-countdown-seconds');

  function updateClock() {
    const time = getRemainingTime(endtime);

    daysItem.innerHTML = time.days;
    hoursItem.innerHTML = ('0' + time.hours).slice(-2);
    minutesItem.innerHTML = ('0' + time.minutes).slice(-2);
    secondsItem.innerHTML = ('0' + time.seconds).slice(-2);

    if (time.total <= 0) {
      clearInterval(timeinterval);
    }
  }

  updateClock();
  const timeinterval = setInterval(updateClock, 1000);
}

initClock('js-countdown', countdown);

$(function(){
    
   var  usr   = $('#usr'),
        psw   = $('#psw'),
        userLabel   = $('#user label'),
        passLabel   = $('#Pass label');
        
    // Username Input  Move When Mouse Focus..    
   usr.on('focus', function(){
       userLabel.addClass('userLabel'); 
   });
   usr.on('blur', function(){
        if(usr.val().length > 0 ){
            userLabel.addClass('userLabel');
        }else{
          userLabel.removeClass('userLabel');  
        }
         
   });
   
   // Password Input  Move When Mouse Blur..    
   psw.on('focus', function(){
       passLabel.addClass('passLabel'); 
   });
   psw.on('blur', function(){
        if(psw.val().length > 0 ){
            passLabel.addClass('passLabel');
        }else{
          passLabel.removeClass('passLabel');  
        }
   });
});