$.urlParam = function(name){ var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); if (results==null) { return null; } return decodeURI(results[1]) || 0; } $( function() { var url = window.location.href; var url_parts = url.replace(/\/\s*$/,'').split('/'); url_parts.shift(); var url_tmp = url_parts[3]; if ( typeof value !== "undefined" && url_tmp.indexOf( 'create_account' ) >= 0 ) { $( 'input[name="phone"]' ).closest( '.row' ).find( '.form-control-comment' ).hide(); $( 'input[name="phone"]' ).attr( 'required', 'required' ); } if ( typeof value !== "undefined" && url_tmp.indexOf( 'zam%C3%B3wienie' ) >= 0 ) { $( 'input[name="phone"]' ).closest( '.row' ).find( '.form-control-comment' ).hide(); $( 'input[name="phone"]' ).attr( 'required', 'required' ); } if ( $.urlParam('type') == 'b2b' ) { var url = window.location.href; var url_parts = url.replace(/\/\s*$/,'').split('/'); url_parts.shift(); var url_tmp = url_parts[3]; if ( url_tmp.indexOf( 'create_account' ) >= 0 ) { $( '.footer-top' ).hide(); if ( url_parts[2] == 'pl' ) { $( '#main .page-header h1' ).html( 'Stwórz konto B2B' ); $( 'input[name="company"]' ).closest( '.row' ).find( '.form-control-comment' ).hide(); $( 'input[name="company"]' ).attr( 'required', 'required' ).closest('.row').find('label').addClass( 'required' ); $( 'input[name="siret"]' ).closest( '.row' ).find( '.form-control-comment' ).hide(); $( 'input[name="siret"]' ).attr( 'required', 'required' ).closest('.row').find('label').addClass( 'required' ); $( 'input[name="phone"]' ).closest( '.row' ).find( '.form-control-comment' ).hide(); $( 'input[name="phone"]' ).attr( 'required', 'required' ).closest('.row').find('label').addClass( 'required' ); $( 'input[name="birthday"]' ).closest( '.row' ).hide(); $( 'input[name="newsletter"]' ).closest( '.row' ).hide(); } if ( url_parts[2] == 'gb' ) { $( '#main .page-header h1' ).html( 'Create account B2B' ); $( 'input[name="company"]' ).closest( '.row' ).find( '.form-control-comment' ).hide(); $( 'input[name="company"]' ).attr( 'required', 'required' ).closest('.row').find('label').addClass( 'required' ); $( 'input[name="siret"]' ).closest( '.row' ).find( '.form-control-comment' ).hide(); $( 'input[name="siret"]' ).attr( 'required', 'required' ).closest('.row').find('label').addClass( 'required' ); $( 'input[name="phone"]' ).closest( '.row' ).find( '.form-control-comment' ).hide(); $( 'input[name="phone"]' ).attr( 'required', 'required' ).closest('.row').find('label').addClass( 'required' ); $( 'input[name="birthday"]' ).closest( '.row' ).hide(); $( 'input[name="newsletter"]' ).closest( '.row' ).hide(); } return false; } if ( url_tmp.indexOf( 'logowanie' ) >= 0 ) { $( '.footer-top' ).hide(); if ( url_parts[2] == 'pl' ) { $( '#main .page-header h1' ).html( 'Zaloguj się do swojego konta B2B' ); $( '#main .no-account a' ).attr( 'href', '/pl/logowanie?create_account=1&type=b2b' ); document.title = 'B2B'; } } if ( url_tmp.indexOf( 'login' ) >= 0 ) { $( '.footer-top' ).hide(); if ( url_parts[2] == 'gb' ) { $( '#main .page-header h1' ).html( 'Log in to your account B2B' ); $( '#main .no-account a' ).attr( 'href', '/gb/login?create_account=1&type=b2b' ); document.title = 'B2B'; } } } })