$(document).ready(function() { $('a[href=#top]').click(function(e){ $('html, body').animate({scrollTop:0}, 'slow'); return false; }); $('.fancybox').fancybox({ closeBtn : true, closeClick : false, autoSize : false, height: 'auto', width:"640px" }); $('.header-form').validate({ errorPlacement: function(error, element) {/*no error label*/}, submitHandler: function(form) { $.post("manager/pages/home.action.php",$('.header-form').serialize()+'&action=connectCompany', function(res){ switch(res){ case 'emptyLogin': showInfo("Erreur, votre compte n\'a pas été trouvé. Contactez Codactiv.","failure"); break; case 'endProAccount': showInfo("Votre compte Pro a expiré et est passé en version gratuite, vous pouvez renouveler votre compte Pro ou continuer avec un compte Gratuit (certaines options seront alors désactivées).","failure"); break; case 'endRetailerAccountForProAccount': showInfo("Votre compte a été temporairement désactivé, contactez l\'administrateur.","failure"); break; case 'endRetailerAccount': showInfo("Votre compte Revendeur a expiré, les comptes de vos clients ont été temporairement désactivés et leurs codes redirigés, vous pouvez renouveler votre compte Revendeur (les comptes de vos clients seront alors réactivés) ou continuer.","failure"); break; case 'offerError': showInfo("Erreur, votre compte n\'a pas été trouvé. Contactez Codactiv.","failure"); break; case 'wrongPassword': showInfo("Les identifiants sont incorrects ou vous n\'avez pas encore activé votre compte, consultez votre boite mail.","failure"); break; case 'userConnectionOk': document.location.href="manager/pages/index.php?p=dashboard"; break; case 'userMobileConnectionOk': document.location.href="manager/mobile/"; break; case 'retailerConnectionOk': document.location.href="manager/pages/index.php?p=dashboard"; break; default: showInfo("Erreur, votre compte n\'a pas été trouvé. Contactez Codactiv.","failure"); } } ) } }); }); function showInfo(txt,status){ $('.info-bar').remove(); $('body').prepend('
'+txt+' (Fermer)
') $('.close-error').click(function(){ $(this).parent().slideUp(); }) $('.info-bar').slideDown(); $('html, body').animate({scrollTop:0}, 'slow'); }