var userLogged = 0; var urlContact = ''; var Libero = { 'HF': { 'writeLoginBar': function(event){ var info = event.data; //window.console&&console.log(info); if (info.logged == true) { userLogged = 1; urlContact = 'http://aiuto.libero.it/contattaci/'; var name_el = jQuery('div#name_user'); //window.console&&console.log(name_el); if (info.name) { var name_user = info.name; } else { var name_user = info.email.split('@')[0]; } name_el.append(name_user); var email = jQuery('div#mail_user'); //window.console&&console.log(email); email.append(info.email); var esci = jQuery('div#libsso_esci'); //window.console&&console.log(esci); esci.click(function() { window.location.assign('http://login.libero.it/logout.php?service_id=aiuto&ret_url=http://aiuto.libero.it/'); }); //window.console&&console.log('in HF logged'); var box_login_logg = jQuery('#box_login.login_logg'); //window.console&&console.log(box_login_logg); box_login_logg.show(); } else { userLogged = 0; urlContact = 'https://login.libero.it?service_id=aiuto&ret_url=http://aiuto.libero.it/contattaci/'; //window.console&&console.log('in HF NOT logged'); var box_login = jQuery('#box_login.login'); //window.console&&console.log(box_login); var entra = jQuery('input.login_entra'); //window.console&&console.log(entra); entra.click(function() { window.location = 'https://login.libero.it?service_id=aiuto&ret_url=' + window.location.href; }); box_login.show(); } } } }; function goContact() { location.href = urlContact; return false; } jQuery(window).on('load', {'logged': false, 'email': 'unknow@unknow', name: ''}, Libero.HF.writeLoginBar);