function initLinkMenu(){
    setTimeout(function() {
    	$("#linkMenu").removeClass("d-none");
    }, 2000);
}

function openUserSubMenuDesktop(event){
	$('#userSubmenu').removeClass("hidden");
}

function closeUserSubMenuDesktop(event){
    event.stopPropagation();
	$('#userSubmenu').addClass("hidden");
}

/**
 * Rounds a number by the specified amount of decimals
 * @param value Number to round
 * @param decimals Amount of decimals to display
 * @returns
 */
function roundDecimals(value, decimals){
	if( decimals==0 ){
		return Math.round(value)
	};
	var amountDecimals = Math.pow(10,decimals);
	return Math.round(value*amountDecimals)/amountDecimals;
}


$(document).ready(function () {

	if(params['busplusUser']){
		if(params['cashPoints'] && document.getElementById("secondarymenu-cashPoints")){
			// Puntos
			var pointsAsEuros = roundDecimals(params['cashPoints'], 2);
			document.getElementById("secondarymenu-cashPoints").innerHTML = '(' + pointsAsEuros + '€)';
		}
		if(params['cardCurrentBalance'] && document.getElementById("secondarymenu-busplusUserInfoBalance")){
			// Monedero
			var balance = roundDecimals(params['cardCurrentBalance'], 2);
			document.getElementById("secondarymenu-busplusUserInfoBalance").innerHTML = balance + '€';
		}
	}

});



