(function ($) {
	AOS.init();
    'use strict';
    $(document).ready(function() {

     //    AOS.init();

        const forbiddenChars = ['@', '!', '#', '$', '%', '^', '&', '*', '(', ')', '.','<','>','`','~','-','_','=','+','?','/','|',';','"','{','}',':',',','[',']','\\',"'"]

						jQuery("textarea").keydown(function(event) {
						  if (forbiddenChars.includes(event.key)) {
							console.log('Key prevented')
							event.preventDefault();
							return false;
						  }
						});
						/* jQuery("input[type=text]").keydown(function(event) {
						  if (forbiddenChars.includes(event.key)) {
							console.log('Key prevented')
							event.preventDefault();
							return false;
						  }
						}); */
						jQuery("#edit-keys").keydown(function(event) {
						  if (forbiddenChars.includes(event.key)) {
							console.log('Key prevented')
							event.preventDefault();
							return false;
						  }
						});
     // Change the label for adding another item and wrap it in a <span>
//$('.shs-addnew-container .add-another').html('<span>Add Location</span>');
// Change the HTML of the button and add a click event
// Initial HTML setup
$('.shs-addnew-container .button.add-another').html('<span>Add Location</span>').on('click', function() {
    // Show an alert
    //alert('Button clicked!');
    // Update the HTML to the new structure after clicking
    $('.shs-addnew-container').html('<a class="button add-another">Add Location</a>');
});

$('.node-location-form .geofield-lat').css('pointer-events', 'none');
$('.node-location-form .geofield-lon').css('pointer-events', 'none');



 $(document).ready(function() {
    // Show the loader before the menu starts loading
    $("#loader").show();

    // Initially hide all submenu items
    $("#superfish-main ul").hide();
    // Show only the top-level menu items
    $("#superfish-main > li").show();

    // Simulating menu loading process for demonstration purposes
    setTimeout(function() {
        // Trigger the load event on the #superfish-main menu
        $("#superfish-main").trigger("load");
    }, 500); // Adjust the time as needed (0.5 second)

    // Hide the loader and show the menu after the menu has loaded
    $("#superfish-main").on("load", function() {
        $("#loader").hide();
        // Show the entire menu after loading
        $("#superfish-main ul").show();
    });

    // Optional: Toggle submenu visibility on parent item click
    $("#superfish-main li.menuparent").click(function() {
        $(this).children("ul").toggle();
    });
});

        $('.banner-slider').slick({

            dots: true,
            arrows: true,
            infinite: false,
            speed: 1200,
            fade: true,
            cssEase: 'linear',
            slidesToShow: 1,
            slidesToScroll: 1,
            autoplay: true,
            autoplaySpeed:2000,
            pauseOnHover: false,
            pauseOnFocus: false
        });
		$('#toggle6').click( function() {
		  if ($(this).html() == 'pause'){
			 $('.banner-slider').slick('slickPause')
			 $(this).html('play') 
		  } else {
			$('.banner-slider').slick('slickPlay')  
			$(this).html('pause') 
		  }  
		});
		
		
        $('.permission-thumb-slider').slick({
            arrows: false,
            infinite: true,
            slidesToShow: 1,
            slidesToScroll: 1,
            lazyLoad: 'ondemand',
            autoplay: true,
            autoplaySpeed: 2200,
            speed: 800,
            dots: true,
            cssEase: 'Ease-in-out',
        });
		$('#toggle5').click( function() {
		  if ($(this).html() == 'pause'){
			 $('.permission-thumb-slider').slick('slickPause')
			 $(this).html('play') 
		  } else {
			$('.permission-thumb-slider').slick('slickPlay')  
			$(this).html('pause') 
		  }  
		});

        $('.filmed-india-slider').slick({
            arrows: true,
            infinite: true,
            slidesToShow: 5,
            slidesToScroll: 1,
            autoplay: true,
            autoplaySpeed: 2000,
            speed: 800,
            dots: false,
            responsive: [
		    {
		      breakpoint: 1024,
		      settings: {
		        slidesToShow: 3,
		        slidesToScroll: 3,
		      }
		    },
		    {
		      breakpoint: 600,
		      settings: {
		        slidesToShow: 2,
		        slidesToScroll: 2
		      }
		    },
		    {
		      breakpoint: 480,
		      settings: {
		        slidesToShow: 2,
		        slidesToScroll: 1
		      }
		    }
		    // You can unslick at a given breakpoint now by adding:
		    // settings: "unslick"
		    // instead of a settings object
		  ]
        });

		$('#toggle4').click( function() {
		  if ($(this).html() == 'pause'){
			 $('.filmed-india-slider').slick('slickPause')
			 $(this).html('play') 
		  } else {
			$('.filmed-india-slider').slick('slickPlay')  
			$(this).html('pause') 
		  }  
		});

        $('.why-film-slider').slick({
            arrows: true,
            infinite: true,
            slidesToShow: 5,
            slidesToScroll: 1,
            autoplay: true,
            autoplaySpeed: 2000,
            speed: 800,
            dots: false,
        });
		$('#toggle3').click( function() {
		  if ($(this).html() == 'pause'){
			 $('.why-film-slider').slick('slickPause')
			 $(this).html('play') 
		  } else {
			$('.why-film-slider').slick('slickPlay')  
			$(this).html('pause') 
		  }  
		});

        $('.testimonial-slider').slick({
            arrows: true,
            infinite: true,
            slidesToShow: 1,
            slidesToScroll: 1,
            autoplay: true,
            autoplaySpeed: 2000,
            speed: 800,
            dots: false,
        });
		$('#toggle2').click( function() {
		  if ($(this).html() == 'pause'){
			 $('.testimonial-slider').slick('slickPause')
			 $(this).html('play') 
		  } else {
			$('.testimonial-slider').slick('slickPlay')  
			$(this).html('pause') 
		  }  
		});
		
		
		$('.testimonial-footer-slider').slick({
            arrows: true,
            infinite: true,
            slidesToShow: 1,
            slidesToScroll: 1,
            autoplay: true,
            autoplaySpeed: 2000,
            speed: 800,
            dots: false,
        });
		$('#toggle7').click( function() {
		  if ($(this).html() == 'pause'){
			 $('.testimonial-footer-slider').slick('slickPause')
			 $(this).html('play') 
		  } else {
			$('.testimonial-footer-slider').slick('slickPlay')  
			$(this).html('pause') 
		  }  
		});
		

        $('.footer-slider-1').slick({
            arrows: true,
            infinite: true,
            slidesToShow: 5,
            slidesToScroll: 1,
            autoplay: true,
            autoplaySpeed: 1800,
            speed: 400,
            dots: false,
            variableWidth: true,
            responsive: [
			    {
			      breakpoint: 600,
			      settings: {
			        slidesToShow: 2,
			        slidesToScroll: 1
			      }
			    },
			    {
			      breakpoint: 480,
			      settings: {
			        slidesToShow: 2,
			        slidesToScroll: 1
			      }
			    }
			    // You can unslick at a given breakpoint now by adding:
			    // settings: "unslick"
			    // instead of a settings object
			  ]
        });
		
		$('.international-domestic-project').slick({
            arrows: true,
            infinite: true,
            slidesToShow: 2,
            slidesToScroll: 1,
            autoplay: true,
            autoplaySpeed: 1800,
            dots: false,
            responsive: [
			    {
			      breakpoint: 600,
			      settings: {
			        slidesToShow: 1,
			        slidesToScroll: 1
			      }
			    },
			    {
			      breakpoint: 480,
			      settings: {
			        slidesToShow: 1,
			        slidesToScroll: 1
			      }
			    }
			   
			  ]
        });
		
		$('.vfx-animation').slick({
            arrows: true,
            infinite: true,
            slidesToShow: 3,
            slidesToScroll: 1,
            autoplay: true,
            autoplaySpeed: 1800,
            dots: false,
            responsive: [
			    {
			      breakpoint: 600,
			      settings: {
			        slidesToShow: 1,
			        slidesToScroll: 1
			      }
			    },
			    {
			      breakpoint: 480,
			      settings: {
			        slidesToShow: 1,
			        slidesToScroll: 1
			      }
			    }
			   
			  ]
        });
        
		$('#toggle1').click( function() {
		  if ($(this).html() == 'pause'){
			 $('.footer-slider-1').slick('slickPause')
			 $(this).html('play') 
		  } else {
			$('.footer-slider-1').slick('slickPlay')  
			$(this).html('pause') 
		  }  
		});
        
		
		$('.sublocation-slider').slick({
					 dots: false,
					  infinite: true,
					  autoplaySpeed: 1400,
					  slidesToShow: 4,
					  slidesToScroll: 1,
					  autoplay: false,
					  lazyLoad:'ondemand',
					  responsive: [
						{
						  breakpoint: 991,
						  settings: {
							slidesToShow: 2,
						  }
						},
						{
						  breakpoint: 767,
						  settings: {
							slidesToShow: 1,
						  }
						}
					  ]
					});
					
					
				 // $('.states-district-slider').slick({
						  // slidesToShow: 1,
						  // slidesToScroll: 1,
						  // arrows: false,
						  // fade: true,
						  // asNavFor: '.slider-nav'
						// });
						// $('.slider-nav').slick({
						  // slidesToShow: 3,
						  // slidesToScroll: 1,
						  // asNavFor: '.states-district-slider',
						  // dots: true,
						  // centerMode: true,
						  // focusOnSelect: true
						// });
					
					
        // $("#modal-toggler").hover(function () {
        //         $('#sidebar-modal').modal('show');
        //     });
		
		
		 });
		//var homepopupModal = new bootstrap.Modal(document.getElementById('homepopupModal'), {})
					//homepopupModal.show()
		$(document).ready(function(){
				
				$("#toggle4").on("click", function() {
				$(this).toggleClass("button-play button-pause");
			});
			   
			   /* anurag testimonial-slider play push class change */
				jQuery("#toggle2").click(function(){
					 $('#toggle2').toggleClass('testimonial-pause testimonial-play');
					 // $(this).removeClass('testimonial-pause');
					 // $(this).toggleClass('testimonial-pause');
					 // e.preventDefault();
					// });
					
				});
				jQuery("#toggle1").click(function(){
					 $('#toggle1').toggleClass('button-pause button-play');
					 // $(this).removeClass('testimonial-pause');
					 // $(this).toggleClass('testimonial-pause');
					 // e.preventDefault();
					// });
				});
					jQuery("#toggle6").click(function(){
						 $('#toggle6').toggleClass('button-pause button-play');
						
					});
					jQuery("#toggle7").click(function(){
						 $('#toggle7').toggleClass('testimonial-footer-pause testimonial-footer-play');
						
					});
				
				});
	
	$('.sidebar-first ul>li.menu-item--expanded').on('click',function(e){
		//e.preventDefault();
		//alert('hh');
		e.stopPropagation();
		if($(this).hasClass('open')){
			$(this).removeClass('open');
		}else{
			$('block-unee-mainnavigation-3-menu>ul.menu>li').removeClass('open');
			$(this).addClass('open');
		}
		
	});
	$('block-unee-mainnavigation-3-menu>ul.menu ul li').on('click',function(e){
		e.stopPropagation();
	});
	$('block-unee-mainnavigation-3 ul li li.menu-item--active-trail').parent().parent('li').addClass('open');
	
 
 
	
	
		$('.page-sidebar-first ul>li.menu-item--expanded').on('click',function(e){
		//e.preventDefault();
		e.stopPropagation();
		if($(this).hasClass('open')){
			$(this).removeClass('open');
		}else{
			$('block-unee-mainnavigation-3>ul.menu>li').removeClass('open');
			$(this).addClass('open');
		}
		
	});
	$('block-unee-mainnavigation-3>ul.menu ul li').on('click',function(e){
		e.stopPropagation();
	});
	$('block-unee-mainnavigation-3 ul li li.menu-item--active-trail').parent().parent('li').addClass('open');
	//$('block-unee-mainnavigation-3 ul li li.menu-item--active-trail').parent().parent().parent('li').addClass('open');
	
	$(document).ready(function(){
    $(".node-amantran-verify-form #edit-submit").prop("value", "Submit");
    $(".user-logged-in .node-location-form .general_information_section .shs-addnew-container a.button").hide();
    $('label[for="edit-body-0-format--2"]').hide();
   
	 // Check if the body has the required classes and the form has the specific class
    if ($('body').hasClass('user-role-filmic-nonfilmic-user') || $('body').hasClass('user-role-state-admin')) {
        if ($('.node-filmic-facilities-edit-form').length) {
            // Hide the buttons
            $('#edit-submit, #edit-delete').hide();
        }
    }
    
});

	//custom path at body
	$(document).ready(function () {
        // Get the current path of the page
        var currentPath = window.location.pathname;

        // Check if the current path matches your custom path
        if (currentPath === '/form/email-verification') {
            // Add a custom class to the body tag
            $('body').addClass('my-custom-body-class');
        }
    });
$('.node-filmic-facilities-form #select-sub-categories-ffo .fieldset-legend').hide();	
	//load more button on body starts
	  $('.ffo-load-more').click(function() {
        // Hide the data under .state-desc
        $('.state-desc').hide();
        
        // Display .ffo-full-data
        $('.ffo-full-data').slideDown(600);
		 // Display Load Less Button
        $('.ffo-load-less').slideDown(600);
        
        // Hide the .ffo-load-more button
        $(this).hide();
    });
	
	//load more button on body ends
	$('.reece-application').closest("body").addClass("recee-webform-custom");
	$('.filmic-nonfilmic-details-page').closest("body").addClass("filmic-nonfilmic-details-page-custom");
	$('.node-states-union-territories-form').closest("body").addClass("node-states-union-territories-form");
	
		//Body Class add on FAQs Page
	$('.faqs-custom').closest("body").addClass("faqs-custom-body-class");
	$('.filmic-nonfilmic-location-page').closest("body").addClass("filmic-nonfilmic-location-page-body-class");
	
	
	 $('.filmic-nonfilmic-location-page-body-class .filmic-nonfilmic-location-page .form-item-field-states-target-id').hide();
	 //$('.node-resource-user-details-form #edit-field-filmic-facilities-0-subform-field-functional-role-wrapper').hide();
	 
	 
  
	
	//changing label name 
	Drupal.behaviors.changeLabelText = {
    attach: function (context, settings) {
      $(document).ready(function () {
        // Change the label for the first file upload
        $('#edit-field-multiple-image-0--label, #edit-field-photos-0--label').text('Upload Image');
        // Change the label for the dynamically generated file upload
        $('label[for^="edit-field-multiple-image-1-upload"]').text('Upload Image');
		//change label of url
		$('label[for^="edit-field-state-website-link-0-uri"]').text('State Website Link');
		//for film facilities link
		if (window.location.pathname === '/node/add/filmic_facilities') {
			// Change the label text
			$('label[for^="edit-field-state-website-link-0-uri"]').text('Website URL');
		}
		//Change the label for geofield map
		$('label[for^="edit-field-location-map-0-value-map-geocode"], ' +
      'label[for^="edit-field-nearest-airport-address-0-value-map-geocode"], ' +
      'label[for^="edit-field-nearest-railway-station-ad-0-value-map-geocode"], ' +
      'label[for^="edit-field-nearest-bus-station-addres-0-value-map-geocode"]').each(function() {
        var forAttr = $(this).attr('for'); // Get the `for` attribute value

        // Change label text based on the specific `for` attribute
			if (forAttr.startsWith('edit-field-nearest-airport-address-0-value-map-geocode')) {
				$(this).text('Nearest Airport');
			} else if (forAttr.startsWith('edit-field-nearest-bus-station-addres-0-value-map-geocode')) {
				$(this).text('Nearest Bus Station');
			} else if (forAttr.startsWith('edit-field-nearest-railway-station-ad-0-value-map-geocode')) {
				$(this).text('Nearest Railway Station');
			} else {
				$(this).text('Address'); // Default label text for other cases
			}
		});
	  
		var formId = 'node-filmic-facilities-form';    
		if ($('#' + formId).length > 0) {
			// Hide the existing Miscellaneous label inside the wrapper
			$('#edit-field-miscellaneous-wrapper h5').hide();

			// Check if the custom label already exists, and only add it if it doesn't
			//if ($('#edit-field-miscellaneous-wrapper .additional-label').length === 0) {
				// Add a new label inside an h5 tag with the desired text
			//	$('#edit-field-miscellaneous-wrapper').prepend('<h5 class="additional-label">Additional Information</h5>');
			//}

			// Update the Google map link label
			$('label[for^="edit-field-google-map-link-0-value-map-geocode"]').text('Address (Please search the location in the address field below or search a nearby location and drag the pin on map to exact location)');
		} else {
			// Apply the simpler text for the Google map link if the form ID doesn't match
			$('label[for^="edit-field-google-map-link-0-value-map-geocode"]').text('Address');
		}

		
      });
    }
  };
	//disable toggle om upload files/image
		Drupal.behaviors.preventToggleClose = {
			attach: function (context, settings) {
			  // Array of toggle selectors
			  var toggles = [
				'summary[aria-controls="edit-field-photos"]',
				'summary[aria-controls="edit-field-multiple-image"]'
			  ];

			  // Loop through each toggle to ensure it's open and prevent closure
			  toggles.forEach(function(selector) {
				var toggle = $(selector);
				toggle.attr('aria-expanded', 'true');
				$('#' + toggle.attr('aria-controls')).show();
				toggle.off('click').on('click', function (e) {
				  e.preventDefault();
				});
			  });
			}
		}; 




	
	//load more button on body starts
	  $('.ffo-load-less').click(function() {
        // Hide the data under .state-desc
        $('.state-desc').slideDown(600);
        
        // Display .ffo-full-data
        $('.ffo-full-data').hide(600);
		 // Display Load Less Button
        $('.ffo-load-more').slideDown(600);
        
        // Hide the .ffo-load-more button
        $(this).hide();
    });
	//load more button on body ends

  //For Header Search
  $("#navbarNav ul li:nth-child(2) >a").click(function(){
    $("#navbarNav ul li:nth-child(2) >div").slideToggle();
  });
  
  //pdf to open in new window
				jQuery("a[target!='_blank'][href$='.pdf']").attr("target", "_blank");
  
  //Get the button
let mybutton = document.getElementById("btn-back-to-top");
window.onscroll = function () {
  scrollFunction();
};
// $(window).on("load",function(){
     //$(".loader").fadeOut("slow");
	 // $(".loader").delay(3000).fadeOut("slow");
	 // $("#overlayer").delay(2000).fadeOut("slow");
//  });
function scrollFunction() {
  if (
    document.body.scrollTop > 100 ||
    document.documentElement.scrollTop > 100
  ) {
    mybutton.style.display = "block";
  } else {
    mybutton.style.display = "none";
  }
}

mybutton.addEventListener("click", backToTop);

function backToTop() {
  document.body.scrollTop = 0;
  document.documentElement.scrollTop = 0;
}

 
  
}(jQuery));
let vid = document.getElementById("myVideo"); 

function playVid() { 
  vid.play(); 
} 

function pauseVid() { 
  vid.pause(); 
} 


