var year;

$(document).ready(function(){
  year = $('.resp-tab-active').children().text();
  //loadExhibitionData(year);

  $('.slider').slick({
    slidesToShow: 5,
    slidesToScroll: 1,
    arrows: false,
    dots:false,
  
    responsive: [
      {
        breakpoint: 1024,
        settings: {
          slidesToShow: 5,
        }
      },
      {
        breakpoint: 600,
        settings: {
          slidesToShow: 3,
          slidesToScroll: 1
        }
      },
      {
        breakpoint: 400,
        settings: {
          slidesToShow: 2,
          slidesToScroll: 1
        }
      },
      {
        breakpoint: 320,
        settings: {
          slidesToShow: 1,
          slidesToScroll: 1
        }
      }
    ]
  });

  $('.next').click(function(){
    $('.slider').slick('slickPrev');
  })
  
  $('.previous').click(function(){
    $('.slider').slick('slickNext');
  })

  $('.slider li').click(function(){
		$('.slider li').removeClass('resp-tab-active');
    $(this).addClass('resp-tab-active');
    year = $(this).children().text();
  //  loadExhibitionData(year);
  });
  
  $('.radioBtn').click(function(){
    $('.radioBtn').removeClass('whiteColor');
    $(this).addClass('whiteColor');
  });


$("#advertisementformid").on("submit",function(e){
    e.preventDefault();
   // alert(1)
    $(".error").html("");
    $(".error").css("display", "none");
    
    var t = new FormData(this);
      $.ajax({
          type: "POST",
          data: t,
          url: CI_ROOT+"advertisement/createInvoice",
          dataType: "json",
          mimeType: "multipart/form-data",
          processData: false,
          contentType: false,
          success: function(result){
            if(result.status == "success"){
                window.location.href = CI_ROOT + "advertisement/sendtopaymentgateway/"+result.data;
            }
          }
      });
  });
  
  $("#areasqmt").on("change",function(){
        var areavalue =   $(this).val();
        var baseamount    =   $('#InvoiceBaseAmount').val();
        if(areavalue >0 && areavalue > '')
        {
            var totalamount   =   parseFloat(areavalue) * parseFloat(baseamount);
            $('#InvoiceTotalAmount').val(totalamount);
            $('#advertisementformsubmit').css('display','block');
        }
        else
        {
            alert("Please select banner !")
            $('#InvoiceTotalAmount').val('0');
            $('#advertisementformsubmit').css('display','none');
        }
  });
  
});