var safetyValve = 0;

runWhatsNewWhenJQueryIsLoaded();	

function runWhatsNewWhenJQueryIsLoaded() {

	console.log("runWhatsNewWhenJQueryIsLoaded Started");
	
	safetyValve++;
	
	// first make sure the theme has loaded fully
	let isWaitForJQ = typeof waitForJQuery === "function";

	// mhvDocumentReady is a global cookie (that will be) set in the MHV Portal Theme
	let mhvDocumentReady = ( isWaitForJQ && getCookie("mhvDocumentReady") );

	if ( mhvDocumentReady || safetyValve > 500 ) {

		if ( safetyValve > 500 ) {
			
			console.log("runWhatsNewWhenJQueryIsLoaded: NOT mhvDocumentReady");
		
		} else {		
			// code goes here	 
		}
	} else {
		setTimeout(runWhatsNewWhenJQueryIsLoaded, 50);
	}
}
 
