$('ul.nav li.dropdown').hover(function() {
	$(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(500);
	}, function() {
  	$(this).find('.dropdown-menu').stop(true, true).delay(200).fadeOut(500);
});

$(document).ready(function(){
	//#22877
	if($(".ce21_Footer_TenatInfoDiv .ce21_Footer_Privacy").length > 0){
		$( "<span class=\"ce21_Footer_VerticalBarSpan_Terms\"> | </span><a href=\"https://www.pesi.com/home/terms\" class=\"ce21_Footer_Terms\" target=\"_blank\">Terms</a>").insertAfter( ".ce21_Footer_Privacy" );
	}
});

//17805: CSS Inquiry: Hide Text Above Overall Classroom Certificate Button
$(document).ajaxComplete(function( event, request, settings ) {
  hideOverallCertificate();
}); 

function hideOverallCertificate(){
  if($('.clsClassroomOverallCertificate .CE21_overall_classroom_certificate_text') && $('.clsClassroomOverallCertificate .CE21_overall_classroom_certificate_text').length > 0){
    $('.clsClassroomOverallCertificate .CE21_overall_classroom_certificate_text').hide()
  }
}
hideOverallCertificate();

//login submit form
window.addEventListener('load', function() {

    var loginForm = document.querySelector("form[action='/account/login']");
    if (loginForm !== null) {
        loginForm.onsubmit = function(){ 
            var email = document.getElementById("Email").value;  
            console.log("login by " + email);  
            if (email !== null && email.length > 0) {
                var _hsq = window._hsq = window._hsq || [];
                _hsq.push(["identify",{
                    email: email
                }]);
                _hsq.push(["trackEvent", {
                    id: "000009277954"
                }]);
            }
            return true;
        }
    }
    var registerForm = document.querySelector("form[action='/account/register']");
    if (registerForm !== null) {
        registerForm.onsubmit = function(){ 
            var email = document.getElementById("Email").value;  
            console.log("registration by " + email);  
            if (email !== null && email.length > 0) {
                var _hsq = window._hsq = window._hsq || [];
                _hsq.push(["identify",{
                    email: email
                }]);
                _hsq.push(["trackEvent", {
                    id: "000010579102"
                }]);
                //if ("fbq" in window) { fbq('track', 'CompleteRegistration'); }
            }
            return true;
        }
    }  
});

//$(".CE21_MyAccount_ButtonsDiv_SignOutBtn").attr("href", "/saml/slo");