var jQueryNL = jQuery.noConflict(true); jQueryNL(document).ready(function(){ var dbNumber = 57; var NLSelectedCompanies = []; var NLLastCompany; if(typeof dbNumber != 'undefined') { appendToDOM(); if (jQueryNL('#newsletterBtn').length) { jQueryNL('#chb_newsCustomize').change(function() { if(jQueryNL(this).is(':checked')) jQueryNL('.newsletter-customize').slideDown(); else jQueryNL('.newsletter-customize').slideUp(); }); // ========== dropdown ========== jQueryNL('#o_newsletter dl.dropdown dt').bind('click', function(event){ var obj = jQueryNL(this); obj.parent('dl').toggleClass('dropdown-active'); jQueryNL('dl.dropdown').not(obj.parent('dl')).removeClass('dropdown-active'); // if there is comboBox inside - focus on it var combo = obj.next('dd').find('.comboBox'); if(combo) { combo.find('input[type="text"]').first().focus(); } // hide dropdown when click anywhere, but no if click on
jQueryNL('body').one('click', function(){ obj.parent('dl').removeClass('dropdown-active'); }); event.stopPropagation(); obj.next('dd').click(function(event){ event.stopPropagation(); }); var hidden = obj.parent('dl').data('field'); if (hidden != undefined) { obj.parent('dl').find('li').unbind('click'); obj.parent('dl').find('li').click(function(){ jQueryNL('#'+hidden).val(jQueryNL(this).data('value')).trigger('change'); obj.parent('dl').removeClass('dropdown-active'); obj.html(jQueryNL(this).text() + ''); return true; }); } }); var newsletterBtn = jQueryNL('#newsletterBtn'); var successMsg = jQueryNL('#successMsg').val(); var errorMsg = jQueryNL('#errorMsg').val(); newsletterBtn.overlay({ top:'7%', mask: { color: '#000', loadSpeed: 200, opacity: 0.5 }, closeOnClick:false, fixed:false, api:true }); newsletterBtn.append(''); newsletterBtn.children('span.mask').hide(); setInterval(function() { newsletterBtn.children('span.mask').css('opacity', '0') .show(100) .fadeTo(500,1) .fadeTo(500,0); }, 7000); jQueryNL('#NLCompany').autocomplete({ appendTo: jQueryNL('#NLCompany').closest('.comboBoxHolder'), minLength: 3, source: 'http://inwestycje.pl/autocomplete/g', select: function( event, ui ) { NLLastCompany = ui.item; return true; } }); jQueryNL('#NLCompanySubmit').click(function(e){ if (NLLastCompany) { for(i in NLSelectedCompanies) { if (NLSelectedCompanies[i].name == NLLastCompany.name) { alert('Wybrana pozycja jest już na Twojej liście.'); e.stopPropagation(); return false; } } NLSelectedCompanies.push(NLLastCompany); NLLastCompany = null; jQueryNL('#NLCompany').val(''); showSelectedCompanies(); } e.stopPropagation(); return false; }); function showSelectedCompanies() { jQueryNL('#NLCompanyItems').html(''); for(i in NLSelectedCompanies) { jQueryNL('#NLCompanyItems').append('
  • '+NLSelectedCompanies[i].name+'
  • '); } } } jQueryNL('#scrollingNL').submit(function() { var preferences = {}; checkboxes = jQueryNL("#scrollingNL input[type=checkbox]"); // Omijam pierwszy CB, bo jest to "Chce dostosowac NL do swoich potrzeb for ( i=1; i< checkboxes.length; i++ ) { if ( checkboxes [i].checked ) { var section_id = checkboxes[i].id.split('-'); preferences [ 'detail_12['+(i-1)+']' ] = section_id[1]; } else continue; } var details = jQueryNL("[name^='detail']"); for ( i=0; i< details.length; i++ ) { if(details[i].type!="radio" || jQueryNL("#"+details[i].id).is(":checked")) { preferences [ details[i].name ] = details[i].value ; } else { if (!preferences [ details[i].name ]) preferences [ details[i].name ] = ""; } } for ( i=0; i< NLSelectedCompanies.length; i++ ) { preferences [ 'detail_14['+i+']' ] = NLSelectedCompanies[i].id; } preferences['form_send_basic'] = '1'; preferences['form_send_optional'] = '1'; jQueryNL( "#scrollingNL fieldset input" ).attr('disabled','disabled'); jQueryNL.getJSON( 'http://mejlonosz.pl/m/sub/'+dbNumber+'/0/1/'+ jQueryNL("#scrollingNLEmail").val() +'/cos?callback=?', preferences, function(json) { if ( json.success ) { jQueryNL( "#scrollingNL" ).fadeOut (); jQueryNL("#o_newsletter div.newsletter-info p").fadeOut(); jQueryNL("#o_newsletter div.newsletter-info").html ( "

    " + successMsg + "

    "); jQueryNL("#o_newsletter div.newsletter-info p").fadeOut(); jQueryNL('#nl-error').remove(); jQueryNL("#o_newsletter div.newsletter-info p").fadeIn(); } else { if(jQueryNL('#nl-error').length == 0) { jQueryNL("#scrollingNL").before ( '

    ' + errorMsg + '

    '); } else jQueryNL('#nl-error').html(errorMsg); jQueryNL( "#scrollingNL fieldset input" ).removeAttr('disabled'); } }); return false; }); } }); function appendToDOM() { var container = jQueryNL('#newsletterContainer'); if (!container.length > 0) { container = jQueryNL('body'); } container.append(jQueryNL.parseJSON('\"\\n \\\"\\\"<\\/span>\\n Newsletter<\\/span>\\n <\\/span>\\n<\\/a>\"')); jQueryNL('body').append(jQueryNL.parseJSON('\"
    \\n <\\/a>\\n
    \\n
    \\n

    Newsletter dopasowany do Twoich potrzeb!<\\/h3>\\n <\\/header>
    \\n

    Zapisz si\\u0119 na nasz darmowy newsletter, kt\\u00f3ry w ka\\u017cdej chwili mo\\u017cesz dopasowa\\u0107 do swoich potrzeb!<\\/p>\\n

    Wybierz interesuj\\u0105ce Ciebie tematy, sp\\u00f3\\u0142ki lub indeksy gie\\u0142dowe i ciesz si\\u0119 naj\\u015bwie\\u017cszymi wiadomo\\u015bciami prosto na Twojego maila.<\\/p>\\n <\\/div>\\n

    \\n \\n \\n
    \\n \\n <\\/div>\\n \\n
    \\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t
    Jakie wiadomo\\u015bci chcia\\u0142by\\u015b\\/chcia\\u0142aby\\u015b otrzymywa\\u0107? \\\"\\\"<\\/h6>\\n\\t\\t\\t\\t\\n
    \\n
    \\n \\n