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

	if(!($('body').hasClass( "home" ))){
    	
		$("#primary-menu .anker-menu a").each(function(){

            var current_lang = document.documentElement.lang;
            //console.log(current_lang);

            if(current_lang == 'en-US'){
        		var name = $(this).attr('href');
        		$(this).attr("href", "https://tacverse.com/melatonin/" + name );

            }else{
                var name = $(this).attr('href');
                $(this).attr("href", "https://tacverse.com/melatonin/ar/" + name );
            }
    	
    	})


        $("#mobile-menu .anker-menu a").each(function(){

            var current_lang = document.documentElement.lang;
            //console.log(current_lang);

            if(current_lang == 'en-US'){
                var name = $(this).attr('href');
                $(this).attr("href", "https://tacverse.com/melatonin/" + name );

            }else{
                var name = $(this).attr('href');
                $(this).attr("href", "https://tacverse.com/melatonin/ar/" + name );
            }
        
        })
    	
    }
    
    document.addEventListener("mouseover", function (event) {
        if (event.target.closest(".menu-item")) {
                        console.log("fired")
            setTimeout(() => {
                const closeButton = document.querySelector(".dt-close-mobile-menu-icon");
                if (closeButton) {
                    closeButton.click();
                        console.log("closed")
                }
            }, 500);
        }
    });

    
});