/* * Wersja deweloperska akcji dla bitcomu * *@author: Mensfeld Maciej *@version: 0.74 */ var loading = '
\n\ Ładowanie strony\n\

Trwa ładowanie strony, proszę czekać ...\n\
'; var error = '
\n\ Błąd ładowania strony\n\

Wystąpił błąd. Prosimy spróbować załadować stronę ponownie.\n\
'; var regulamin_soft = ''; var regulamin_avast = ''; var regulamin_tonery = ''; var added = 0; function check_nip(nip){ /** * Sprawdzanie NIPu na podstawie sumy kontrolnej */ if (count_digits(nip) != 10) return false; if (!only_digits(nip)) return false; var sum = 0; var checksum = 0; // reszta z dzielenia bedaca jednoczesnie suma kontrolna var weights = [6, 5, 7, 2, 3, 4, 5, 6, 7]; var i = 0; for (i =0; i < 9; i++){ sum += (weights[i] * nip[i]); } checksum = sum % 11; if (checksum != nip[9]){ return false; } return true; }; function count_digits(string){ /** * Zlicza ilość cyfr */ var i = 0; var ilosc = 0; var cyfra=/([0-9])/; for (i =0; i < string.length; i++){ if (cyfra.test(string[i])) ilosc++; } return ilosc; }; function only_digits(string){ /** * Sprawdzanie czy podany string zawiera tylko cyfry */ if (count_digits(string) != string.length) return false; return true; }; function check_email(mail) { /** * Sprawdza poprawność adresu e-mail */ if (mail.length < 4) return false; var dobryEmail=/^[^@]+@([a-z0-9\-]+\.)+[a-z]{2,4}$/i; if (dobryEmail.test(mail)) return true; else return false; }; function remove_id_from_cookie(cookie, id){ /** * po rozwinięciu danego elementu - jego ID nie powinno być w cookie. * Funkcja ta usuwa to ID */ if (cookie != null) var sliced = cookie.split('7mu5n4by'); else return '7mu5n4by'; var i = 0; var id_2_del = -1; var new_cookie = ''; for (i = 0; i < sliced.length; i++) { if (sliced[i].indexOf(id) != -1) id_2_del = i; } if (id_2_del == -1) return false; for (i = 0; i < sliced.length; i++) { if (i == id_2_del) continue; if (sliced[i] == 'false' || sliced[i] == 'null' || sliced[i] == '') continue; if (i==0) new_cookie = sliced[0]; else if (i==sliced.length-1) new_cookie += '7mu5n4by'+sliced[sliced.length-1]; else new_cookie += '7mu5n4by'+sliced[i]+'7mu5n4by'; } if (new_cookie != null) return new_cookie; else return 'false'; }; function slide_site_map() { /** * Pokazuje / ukrywa dolną mapę strony */ $('.delete').click(function() { $(this).parent().slideUp(350); $('#show_map').slideDown(350); $.cookie('hidden', $.cookie('hidden')+'7mu5n4bysite_map'); }); $('#show_map').click(function() { $('#site_map').slideDown(350); $('#show_map').slideUp(350); $.cookie('hidden', remove_id_from_cookie($.cookie('hidden'), 'site_map')); }) }; function company_info(){ /** * Wyświetla infomację o firmie (ta w czarnym kwadracie) */ $('#foot_bitcom').click(function(){ if ($('#drag').css('display') == 'block'){ $('#drag').fadeOut(1500); $('#drag_text').fadeOut(1500); } else { $('#drag').fadeIn(1500); $('#drag_text').fadeIn(1500); } }) }; function ajax_menu() { /* * Obsługa ajaxowa menu (nie animacji - sam ajax) + zmiana koloru mapy strony * na dole przy wejsciu w jakies menu glowne */ $('#menu a').click(function() { // jesli jest to przekierowanie (bo sam base jest inny) to przekieruj // i nie probuj ajaxowac :) if ($(this).attr('href').indexOf($('base').attr('href'))==-1){ window.location = $(this).attr('href'); return false; } if ($('#this_one').html() == null) return false; if ($('#this_one').html().indexOf($(this).html()) != -1){ if ($(this).html().indexOf($('#title_name').html()) != -1) return false; } var adres = $(this).attr('href'); // sprawdz czy to nadmenu ktore juz było załadowane i w nim jestesmy // jesli tak to przy jego zwijaniu niech go nie laduje ponownie if ($(this).attr('class') == 'menu_upper') $('#title_name').html(($(this).html())); else{ var cont_html = $(this).html(); var cand = 0; var stop = false; if ($(this).html().indexOf('img') == -1) $('#title_name').html($('#this_one').html()+' --> '+($(this).html())); else { var ktory = $(this).attr('href'); var licznik = 0; var ktoryto = -1; cand = 0; $('#menu a').each(function(){ if ($(this).html().indexOf('img') == -1) if (ktoryto == -1) cand = $(this).html(); if ($(this).attr('href').indexOf(ktory) != -1){ ktoryto = licznik; } licznik++; }); $('#title_name').html($('#this_one').html()+' --> '+cand+' -->'+$(this).text()); } } $('#site_map').find('a').each(function() { if(adres.indexOf($(this).attr('href'))!= -1) { $('.this_map').attr('class', ''); $(this).attr('class', 'this_map'); } }); $('#content').html(loading); var options = $(this).attr('href').split('/'); if ($(this).attr('href').indexOf('mapka') != -1) { $('#content').html('
'); loadMapScript(); } else $.ajax( { url: "textes.php?menu="+options[options.length-2], type: "GET", dataType: "xhtml", error: function () { $('#content').html(error); }, success : function (json) { setTimeout(function(){ $('#content').html(json);document.title = 'bit.com - '+$('#head_title').html(); }, 100); try { pageTracker._trackPageview('/ajax/'+options[options.length-2]); }catch(err) {} } }); return false; } )}; function ajax_content_links() { /* * Obsługa linkow znajdujacych sie w contencie strony */ // jesli to ma byc otwarte w nowym oknie to zatrzymaj ladowanie ajaxem i // pozwol sie mu obsluzyc samemu :) if ($(this).attr('rel').indexOf('prettyPhoto')!=-1) return false; if ($(this).attr('rel').indexOf('regulamin_soft')!=-1){ $('#dialog_soft').html(regulamin_soft); $.ajax( { url: $(this).attr('href'), type: "GET", dateType: 'html', error: function () { $('#dialog_soft').html(error); }, success : function (msg) { $('#dialog_soft').html(msg); regulamin_soft = msg; } }); $("#dialog_soft").dialog({ resizable: 'se', draggable: true, autoOpen:true, width:800, height:500, modal: true, buttons: { "Zamknij": function() { $(this).dialog("destroy");} } }); return false; } if ($(this).attr('rel').indexOf('regulamin_avast')!=-1){ $('#dialog_avast').html(regulamin_avast); $.ajax( { url: $(this).attr('href'), type: "GET", dateType: 'html', error: function () { $('#dialog_avast').html(error); }, success : function (msg) { $('#dialog_avast').html(msg); regulamin_avast = msg; } }); $("#dialog_avast").dialog({ resizable: 'se', draggable: true, autoOpen:true, width:800, height:500, modal: true, buttons: { "Zamknij": function() { $(this).dialog("destroy");} } }); return false; } if ($(this).attr('rel').indexOf('regulamin_tonery')!=-1){ $('#dialog_tonery').html(regulamin_tonery); $.ajax( { url: $(this).attr('href'), type: "GET", dateType: 'html', error: function () { $('#dialog_tonery').html(error); }, success : function (msg) { $('#dialog_tonery').html(msg); regulamin_tonery = msg; } }); $("#dialog_tonery").dialog({ resizable: 'se', draggable: true, autoOpen:true, width:800, height:500, modal: true, buttons: { "Zamknij": function() { $(this).dialog("destroy");} } }); return false; } if ($(this).attr('target').indexOf('_blank') != -1){ return true; } // jesli to jest link do 'strony do druku' to nie ładuj ajaxem if ($(this).attr('href').indexOf('print')!=-1) return true; // jesli to link 'pusty' to nic nie rob if ($(this).attr('href').indexOf('#')!=-1) return false; // jezeli ten link prowadzi do innej strony to otworz nowe okno/zakladke i // tam zaladuj ten link if ($(this).attr('href').indexOf($('base').attr('href'))==-1){ window.location = $(this).attr('href'); return false; } var te = $(this).attr('href').toString(); if ($('#content').css('display') != 'none') $('#content').html(loading); var options = te.split('/'); // musimy sprawdzią‡ czy to cennik więc jesli liczac od 'tyłu' ;) // ostatni ciag znakow to strLICZbA to ejst to cennik var url = "textes.php?menu="+options[options.length-2]+'&strona='+options[options.length-1]; if (options[options.length-3].indexOf('step') != -1){ var step = options[options.length-3]; url = "textes.php?menu="+options[options.length-4]+'&step='+step.slice(4, 5)+'&przed='+options[options.length-2]; } if ($(this).attr('href').indexOf($('base').attr('href')+'zamowienia')!=-1){ url = "zamowienia.php"; } $.ajax( { url: url, type: "GET", dataType: "xhtml", error: function () { $('#content').html(error); }, success : function (json) { setTimeout(function(){ $('#content').html(json);}, 100) } }); return false; }; function menu_actions() { /* * Odpowiada za zainicjowanie menu po załadowaniu strony oraz za jego animacje * w czasie działania (te wsuwania rozsuwania) */ $('#this_one').css("background", "url('./images/bg_this_menu.png')"); $('#menu ul').hide(); var i = 0; var stop = false; var pod = false; // $('#menu li a').each( function(){if (this.href.indexOf('sklep') != -1 ) { // $(this).css('background', '#5D0200'); // } }); if (document.URL.length != $('base').attr('href').length) $('#menu li a').each( function(){ if (this.href.indexOf(document.URL) != -1 ){ stop = true; if (this.className == "menu_upper"){ var checkElement = $(this).next(); checkElement.slideToggle(0); } else{ pod = true; } }; if (!stop) i++; }); var j = 0; var kand = -1; stop = false; var kan_pod = 0; if (pod){ $('#menu li a').each( function(){ if (this.className == "menu_upper"){ if (!stop) kand = j; }; if (this.className != "menu_upper" && this.className != "menu_under"){ if (!stop) kan_pod = j; }; if (!stop) j++; if (j > i) stop = true; }); var k =0; $('#menu li a').each( function(){ if (k == kand){ var checkElement = $(this).next(); checkElement.slideToggle(0); $(this).attr('id', 'this_one'); $(this).css("background", "#292828 url('./images/bg_this_menu.png')"); $($('#title_name').html($(this).html()+' --> ')); }; if (k == kan_pod && kan_pod != i){ $($('#title_name').html($('#title_name').html()+$(this).html()+' -->')); }; if (k == i){ $(this).attr('id', 'this'); $(this).css('padding-left', '10px'); $(this).css('color', 'black'); // jesli jestesmy w mapce to ją załadujmy if ($(this).attr('href').indexOf('mapka') != -1) { $('#content').html('
'); loadMapScript(); } if ($(this).html().indexOf('img') != -1) $(this).children().attr('src', './images/arrow_enter_black.gif'); $($('#title_name').html($('#title_name').html()+$(this).text())); }; k++; }); }; $('.menu_upper').hover( function() { if($(this).attr("id") != "this_one") $(this).css("background", "#292828 url('./images/bg_this_menu.png')") }, function() { if($(this).attr("id") != "this_one") $(this).css("background", "#292828 url('./images/bg_menu.png')") } ); $('#menu a').click(function() { if ($(this).html().indexOf('img') != -1) $(this).children().attr('src', './images/arrow_enter_black.gif'); if ($('#this').html() != null) if ($('#this').html().indexOf('img') != -1) $('#this').children().attr('src', './images/arrow_enter.gif'); if ($(this).attr('class') != 'menu_upper') { $('#this').css('color', '#5C5C5C'); $('#this').css('padding-left', ''); $('#this').attr("id", ""); $(this).attr("id", "this"); $(this).css('color', 'black'); $(this).css('padding-left', '10px'); } }); $('.menu_upper').click( function() { $('#this').css('padding-left', ''); $('#this').css('color', '#5C5C5C'); $('#this').attr("id", ""); var checkElement = $(this).next(); if($(this).attr("id") == "this_one") { checkElement.slideToggle(150); return false; } $('#this_one').css("background", " url('./images/bg_menu.png')"); $('#this_one').attr("id", ""); $(this).attr("id", "this_one"); $(this).css("background", " url('./images/bg_this_menu.png')"); $('#menu ul:visible').slideUp(200); checkElement.slideToggle(200); return false; } ); }; function static_icons_animations(){ /** * odpowiada za zamianę niebieskich i na szare i na odwrot po najechaniu na * ikonki, za zwiniecie po nacisnieciu i za zamiane minusa na plusa po zwinieciu * * Tutaj trzymane sa ogolnie wszystkie akcje zwiazane z ikonkami ktore nie musza * byc bindowane bo sa statyczne dlatego nie ma ich w 'bindowniku' */ $('.hide_arrow').mousedown( function() { $(this).parent().next().slideToggle(350); if ($(this).attr("src").indexOf("uparrow") != -1) { $(this).attr("src","./images/downarrow_hover.gif"); $.cookie('hidden', $.cookie('hidden')+'7mu5n4by'+$(this).parent().next().attr('id')) } else { $(this).attr("src","./images/uparrow_hover.gif"); $.cookie('hidden', remove_id_from_cookie($.cookie('hidden'), $(this).parent().next().attr('id'))) } } ); $('.hide_arrow').hover( // over function() { if ($(this).attr("src").indexOf("uparrow") != -1) $(this).attr("src","./images/uparrow_hover.gif"); else $(this).attr("src","./images/downarrow_hover.gif"); }, //out function() { if ($(this).attr("src").indexOf("uparrow") != -1) $(this).attr("src","./images/uparrow.gif"); else $(this).attr("src","./images/downarrow.gif"); } ); $('#show_map').hover( // over function() { $(this).attr("src","./images/show_map_hover.gif"); }, //out function() { $(this).attr("src","./images/show_map.gif"); } ); $('.delete').hover( // over function() { $(this).attr("src","./images/delete_hover.gif"); }, // out function() { $(this).attr("src","./images/delete.gif"); } ); }; function dynamic_icons_animations() { /** * Animacje ikonek, czyli zmiana z szarej na niebieską… po najechaniu itp * ale tych które trzeba bindowaą‡ */ $('.print img').hover( // over function() { $(this).attr("src","./images/printer_icon.gif"); }, //out function() { $(this).attr("src","./images/blprinter_icon.gif"); } ) }; function ajax_site_map(){ /* * Obsluga ładowania stron klikajac na sitemap */ $('#site_map a').click(function() { // jesli jest to przekierowanie (bo sam base jest inny) to przekieruj // i nie probuj ajaxowac :) if ($(this).attr('href').indexOf($('.this_map').attr('href'))!=-1) return false; if ($(this).attr('href').indexOf('http://')!=-1){ window.location = $(this).attr('href'); return false; }; // czy ma załadowac ajaxem - jesli jest to nadmenu ktore juz było // załadowane to ustawi sie na false var ajax_load = true; var adres = $(this).attr('href'); // var checkElement = $('#this_one').next(); // checkElement.slideToggle(150); // jesli klikamy na strone ktora jest juz zaladowana to niech jej nie ładuje if ($('#this_one').attr('href').indexOf(adres)!= -1) ajax_load = false; $('#menu ul').hide(); var i = 0; var stop = false; $('#menu').find('a').each(function() { if($(this).attr('href').indexOf(adres)!= -1) { $('#this_one').css("background", "#292828 url('./images/bg_menu.png')"); $('#this_one').attr("id", ""); $(this).attr("id", "this_one"); $(this).css("background", "#292828 url('./images/bg_this_menu.png')"); stop = true; }; if (!stop) i++; }); // style dla podmenu $('.this_map').attr('class', ''); $(this).attr('class', 'this_map'); var j = 0; $('#menu li a').each( function(){ j++; }); if (ajax_load) { if ($('#content').css('display') != 'none') $('#content').html(loading); var options = $(this).attr('href').split('/'); $('#title_name').html(($(this).html())); $.ajax( { url: "textes.php?menu="+options[options.length-2], type: "GET", dataType: "xhtml", error: function () { $('#content').html(error); }, success : function (json) { setTimeout(function(){ $('#content').html(json);}, 100); } }); }; return false; }); }; function print_new_window_open(){ $('.print a ').click(function(){ window.open($(this).attr('href'),'wersja do druku'); return false; }); }; function show_order_info() { /** * Pokazuje informacje o zamowieniu */ $('#order_info').click(function(){ var dane = 'send=1&key='+$('#nr_ref').val(); $('#content').html(loading); $.ajax( { url: "zamowienia.php", type: "POST", data: dane, dataType: "xhtml", error: function () { $('#content').html(error); }, success : function (json) { setTimeout(function(){ $('#content').html(json);}, 100); } }); return false; }); }; function init_hiddens(){ /** * Inicjuje to co ma byc ukryte jako ukryte ;) */ $('.menu_under').css("padding-top", "2px"); $('.menu_under').css("padding-bottom", "2px"); $('.menu_under').css("background-color", "#F0F0F0"); if ($.cookie('hidden')==null) return false; var sliced = $.cookie('hidden').split('7mu5n4by'); var i = 0; $('#show_map').hide(); for (i = 0; i < sliced.length; i++) { if (sliced[i] == 'false' || sliced[i] == 'null' || sliced[i] == '') continue; $('#'+sliced[i]).hide(); if (sliced[i] != 'site_map') $('#'+sliced[i]).prev().children().attr("src","./images/downarrow.gif"); else $('#show_map').show(); }; return true; }; function show_company(){ /** * Pokazuje w formularzu nazwa firmy i nip zamiast imie i nazwisko */ $('#firma').click(function(){ $('#firma_td').html('Nazwa firmy :'); $('#nip_td').html('NIP :'); }); }; function show_person(){ /** * Pokazuje w formularzu imie i nazwisko zamiast nazwa firmy i nip */ $('#osoba').click(function(){ $('#firma_td').html('Nazwisko :'); $('#nip_td').html('Imi\u0119 :'); }); }; function select_years() { // oblicza cene przy wyborze 1, 2, 3 lat var ile = 1; if ($("#slider").slider("value") == null) ile = 1; else ile = $("#slider").slider("value"); $('#rok_s1').click(function() { if ($("#slider").slider("value") == null) ile = 1; else ile = $("#slider").slider("value"); $("#cena").val($('#rok1').val()); var liczba = (parseFloat($("#cena").val()) + parseFloat(+$("#cena").val()*0.22) )* 100 ; var wart = String(Math.round(liczba)/100); $("#cena_vat").val(wart); $("#cena_all").val(ile*$("#cena").val()); var zvatem = ile*wart *100; $("#cena_laczna_vat").val(Math.round(zvatem)/100); }); $('#rok_s2').click(function() { if ($("#slider").slider("value") == null) ile = 1; else ile = $("#slider").slider("value"); $("#cena").val($('#rok2').val()); var liczba = (parseFloat($("#cena").val()) + parseFloat(+$("#cena").val()*0.22) )* 100 ; var wart = String(Math.round(liczba)/100); $("#cena_vat").val(wart); $("#cena_all").val(ile*$("#cena").val()); var zvatem = ile*wart *100; $("#cena_laczna_vat").val(Math.round(zvatem)/100); }); $('#rok_s3').click(function(){ if ($("#slider").slider("value") == null) ile = 1; else ile = $("#slider").slider("value"); $("#cena").val($('#rok3').val()); var liczba = (parseFloat($("#cena").val()) + parseFloat(+$("#cena").val()*0.22) )* 100 ; var wart = String(Math.round(liczba)/100); $("#cena_vat").val(wart); $("#cena_all").val(ile*$("#cena").val()); var zvatem = ile*wart *100; $("#cena_laczna_vat").val(Math.round(zvatem)/100); }); }; function submit_form(){ /** * Akcja wykonywana po wyslaniu formularza zgloszenia zamowienia */ $('#submit_button').click(function(){ if (check_form() == false) return false; var czyfirma = true; if ($('#firma_td').html().indexOf('Nazwa firmy :') == -1) czyfirma = false; var data; if (czyfirma) data='czyfirma=true&nazwa_firmy='+$('#nazwa_firmy').val()+"&nip="+$('#nip').val(); else data='czyfirma=false&nazwa_firmy='+$('#nazwa_firmy').val()+"&nip="+$('#nip').val(); data+='&miasto='+$('#miasto').val()+'&kod_pocztowy='+$('#kod_pocztowy_p1').val()+'-'+$('#kod_pocztowy_p2').val(); data+='&ulica='+$('#ulica').val()+"&nrdomu="+$('#nrdomu').val(); data+='&telefon='+$('#telefon').val()+"&email="+$('#email').val(); data+='&produkt_id='+$('#produkt_id').val()+'&ilosc='+$('#ilosc').val(); data+='&send=ajax&skad='+$('#skad').val()+"¬atki="+$('#notatki').val(); data+='&men_adress='+$('#men_adress').val(); if ($('#rok_s2').attr('checked')) data+='&lata=2'; else if ($('#rok_s3').attr('checked')) data+='&lata=3'; else data+='&lata=1'; data+='&wysylka='+$('#wysylka').val(); $('#content').html(loading); $.ajax( { url: "zamowienia.php", type: "POST", data: data, dataType: "xhtml", error: function () { $('#content').html(error); }, success : function (json) { setTimeout(function(){ $('#content').html(json);}, 100); } }); return false; }) }; function check_form(){ /** * Weryfikuje poprawnosc wprowadzanych danychdo formularza zgloszeniowego */ if ($('#nazwa_firmy').val().length < 3){ if ($('#firma_td').html().indexOf('Nazwa firmy :') != -1){ alert('Wpisana nazwa firmy jest za krótka.'); } else{ alert('Podane nazwisko jest za krótkie.'); } $('#nazwa_firmy').focus(); $('#nazwa_firmy').select(); return false; } if ($('#firma_td').html().indexOf('Nazwa firmy :') != -1){ if (check_nip($('#nip').val()) == false){ alert('Podany NIP jest niepoprawny.\nWprowadź NIP bez żadnych znaków specjalnych. \nNp: 3452356723 zamiast 345-235-67-3.'); $('#nip').focus(); $('#nip').select(); return false; } } else{ if ($('#nip').val().length < 1){ alert('Podane imi\u0119 jest za krótkie.'); $('#nip').focus(); $('#nip').select(); return false; } } if ($('#miasto').val().length < 1){ alert('Wprowad\u017a nazwą miasta.'); $('#miasto').focus(); $('#miasto').select(); return false; } if (count_digits($('#kod_pocztowy_p1').val()) != 2 || only_digits($('#kod_pocztowy_p1').val()) != true){ alert('Niepoprawny kod pocztowy.'); $('#kod_pocztowy_p1').focus(); $('#kod_pocztowy_p1').select(); return false; } if (count_digits($('#kod_pocztowy_p2').val()) != 3 || only_digits($('#kod_pocztowy_p2').val()) != true){ alert('Niepoprawny kod pocztowy.'); $('#kod_pocztowy_p2').focus(); $('#kod_pocztowy_p2').select(); return false; } if ($('#ulica').val().length < 1){ alert('Wprowad\u017a nazwę ulicy.'); $('#ulica').focus(); $('#ulica').select(); return false; } if ($('#nrdomu').val().length < 1){ alert('Wprowad\u017a numer domu/mieszkania.'); $('#nrdomu').focus(); $('#nrdomu').select(); return false; } if ($('#telefon').val().length < 6){ alert('Wprowad\u017a numer telefonu.'); $('#telefon').focus(); $('#telefon').select(); return false; } if (check_email($('#email').val()) == false){ alert('Niepoprawny adres e-mail.'); $('#email').focus(); $('#email').select(); return false; } if (!only_digits($('#ilosc').attr('value'))){ alert('Podano niepoprawn\u0105 wartość!\nPodane ceny dotyczą ilości od '+$('#ilosc_min').attr('value')+' do '+$('#ilosc_max').attr('value')+' sztuk.\nWpisz poprawną wartość lub wybierz "wstecz" aby wybrać inny przedział.'); $('#ilosc').focus(); $('#ilosc').select(); return false; } if (parseInt($('#ilosc').attr('value'))>parseInt($('#ilosc_max').attr('value')) || parseInt($('#ilosc').attr('value'))= 0) var p1 = val.substr(0, i); if (i < val.length) var p2 = val.substr(i+1, val.length); $('#ilosc').attr('value',p1+p2); return; } } $('#ilosc').attr('value', ''); $('#ilosc').attr('value', val.substr(0, val.length-1)); } var liczba; var liczba_vat; if ( $('#ilosc').attr('value') > parseInt($('#ilosc_max').attr('value'))){ $('#ilosc').attr('value',$('#ilosc_max').attr('value')); $('#slider').slider('option', 'value', $('#ilosc_max').attr('value')); liczba = $('#ilosc').attr('value')*parseFloat($("#cena").val()) * 100; $("#cena_all").val(String(Math.round(liczba)/100)); liczba_vat = $('#ilosc').attr('value')*parseFloat($("#cena_vat").val()) * 100; $("#cena_laczna_vat").val(String(Math.round(liczba_vat)/100)); }else{ if( $('#ilosc').attr('value') < 1){ $('#ilosc').attr('value',$('#ilosc_min').attr('value')); $('#slider').slider('option', 'value', $('#ilosc_min').attr('value')); liczba = $('#ilosc').attr('value')*parseFloat($("#cena").val()) * 100; $("#cena_all").val(String(Math.round(liczba)/100)); liczba_vat = $('#ilosc').attr('value')*parseFloat($("#cena_vat").val()) * 100; $("#cena_laczna_vat").val(String(Math.round(liczba_vat)/100)); } }; liczba = $('#ilosc').attr('value')*parseFloat($("#cena").val()) * 100; $('#slider').slider('option', 'value', $('#ilosc').attr('value')); $("#cena_all").val(String(Math.round(liczba)/100)); liczba_vat = $('#ilosc').attr('value')*parseFloat($("#cena_vat").val()) * 100; $("#cena_laczna_vat").val(String(Math.round(liczba_vat)/100)); }); $('#ilosc').blur(function(){ var val = $('#ilosc').attr('value'); if ( val < parseInt($('#ilosc_min').attr('value'))){ $('#ilosc').attr('value',$('#ilosc_min').attr('value')); $('#slider').slider('option', 'value', $('#ilosc_min').attr('value')); var liczba = $('#ilosc').attr('value')*parseFloat($("#cena").val()) * 100; $("#cena_all").val(String(Math.round(liczba)/100)); var liczba_vat = $('#ilosc').attr('value')*parseFloat($("#cena_vat").val()) * 100; $("#cena_laczna_vat").val(String(Math.round(liczba_vat)/100)); } if ( $('#ilosc').attr('value') > parseInt($('#ilosc_max').attr('value'))){ $('#ilosc').attr('value',$('#ilosc_max').attr('value')); $('#slider').slider('option', 'value', $('#ilosc_max').attr('value')); liczba = $('#ilosc').attr('value')*parseFloat($("#cena").val()) * 100; $("#cena_all").val(String(Math.round(liczba)/100)); liczba_vat = $('#ilosc').attr('value')*parseFloat($("#cena_vat").val()) * 100; $("#cena_laczna_vat").val(String(Math.round(liczba_vat)/100)); } }); }; function loadMapScript() { /** * Ładowanie skryptu mapy z googli */ var script = document.createElement("script"); script.type = "text/javascript"; //local - ABQIAAAAZjPLonMuG47BTjDBEWkR2hQ7BLocpry9X9aJ2XpUSkrEICCO9hQ1C7eeK0eyjyyi7a5DLi-ME6d5Sw //mensfeld - ABQIAAAAZjPLonMuG47BTjDBEWkR2hS0Y0Rl5b_rDwOo81W0XMVvjty_OxRRZ1kWoDDd__hZWvQAmiyLF7ITNA // bitcom.com.pl - ABQIAAAAZjPLonMuG47BTjDBEWkR2hR5ex8lwgQpVyc-iaZYC4SKrGPk8BTqjnArY9jqlMtq4fCdfZzdQsJ_Iw var klucz = ''; if ($('base').attr('href').indexOf('localhost') != -1) klucz = 'ABQIAAAAZjPLonMuG47BTjDBEWkR2hQ7BLocpry9X9aJ2XpUSkrEICCO9hQ1C7eeK0eyjyyi7a5DLi-ME6d5Sw'; else{ if ($('base').attr('href').indexOf('mensfeld') != -1) klucz = 'ABQIAAAAZjPLonMuG47BTjDBEWkR2hS0Y0Rl5b_rDwOo81W0XMVvjty_OxRRZ1kWoDDd__hZWvQAmiyLF7ITNA'; else klucz = 'ABQIAAAAZjPLonMuG47BTjDBEWkR2hR5ex8lwgQpVyc-iaZYC4SKrGPk8BTqjnArY9jqlMtq4fCdfZzdQsJ_Iw'; } script.src = "http://maps.google.com/maps?file=api&v=2.x&key="+klucz+"&async=2&callback=loadMap"; document.body.appendChild(script); } function loadMap() { /** * Ładowanie samej mapy z googli */ var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.setCenter(new GLatLng(50.093756,19.9563867), 13); var marker = new GMarker(new GLatLng(50.093756,19.956386)); GEvent.addListener(marker, "click", function () { marker.openInfoWindowHtml('


ul. Bociana 4C / 33
31-231 Kraków
'); }); map.addOverlay(marker); marker.openInfoWindowHtml('


ul. Bociana 4C / 33
31-231 Kraków
'); map.addOverlay(marker); }; function check_contact(){ if ($('#nazwisko').val().length < 4){ alert('Podane imi\u0119 / lub nazwisko jest za krótkie.'); $('#nazwisko').focus(); $('#nazwisko').select(); return false; } if (check_email($('#email').val()) == false){ alert('Niepoprawny adres e-mail.'); $('#email').focus(); $('#email').select(); return false; } if ($('#tresc').val().length < 1){ alert('Wpisz tre\u015bć wiadomości.'); $('#tresc').focus(); $('#tresc').select(); return false; } return true; } function submit_contact(){ /** * Akcja po nacisnieciu 'wyslij wiadomosc' w formularzu kontaktowym. */ $('#submit_contact').click(function(){ if (check_contact()){ var data = 'nazwisko='+$('#nazwisko').val()+'&email='+$('#email').val()+'&tresc='; data+=$('#tresc').val()+'&send=1&telefon='+$('#telefon').val()+'&dodatkowe='+$('#dodatkowe').val(); $('#content').html(loading); $.ajax( { url: "contact.php", type: "POST", data: data, dataType: "xhtml", error: function () { $('#content').html(error); }, success : function (json) { setTimeout(function(){ $('#content').html(json);}, 100); } }); } return false; }); } function gallery_actions(){ $('#gallery a').bind("mouseenter",function(){ var chil = $(this).children(); $(this).next().slideDown(300, function(){chil.css('background-color', '#5BA2B7');}); $(this).children().css('background-color', '#5BA2B7'); }); $('#gallery a').bind("mouseleave", function(){ $('.gallery_img').each(function(){ $(this).css('background-color', '#D1D1D1'); }); $(this).next().slideUp('300', function(){$(this).prev().children().css('background-color', '#D1D1D1');}); }) } function prettyPhotoShow(){ $(this).prettyPhoto({animationSpeed: 'fast'}); } function wysylka_change(){ if (!added && $('#wysylka').val().indexOf('undefined')==-1){ added = $('#wysylka').val(); } $('#wysylka').change(function(){ var liczba = 0; if (!added && $('#wysylka').val() != 0){ liczba = (parseFloat($("#cena_all").val())*100+parseFloat($('#wysylka').val())*100); $("#cena_all").val(String(Math.round(liczba)/100)); $("#cena_laczna_vat").val(parseFloat($("#cena_laczna_vat").val())+parseFloat($('#wysylka').val())+parseFloat($('#wysylka').val())*0.22); added = $('#wysylka').val(); }else{ if (added && $('#wysylka').val() == 0){ liczba = (parseFloat($("#cena_all").val())-parseFloat(added))*100; $("#cena_all").val(Math.round(liczba)/100); var brutto = (parseFloat($("#cena_laczna_vat").val())-parseFloat(added)-parseFloat(added)*0.22)*100; $("#cena_laczna_vat").val(Math.round(brutto)/100); added = 0; } }}) } function enova_window(){ $("#dialog_enova").dialog("open"); $("#dialog_enova").dialog({ resizable: 'se', draggable: true, autoOpen:true, width:410, title:'Wersja demonstracyjna', modal: true, buttons: { "Zamknij": function() { $(this).dialog("destroy");} } }); return false; } function enova_order(){ $('#enova_order').click(function(){ enova_window(); }); } function enova_ajax(){ $('#enova_send').click(function(){ if ($('#name').val().length < 4){alert('Wprowad\u017a imię i nazwisko.'); return false;} if ($('#adress').val().length < 4){alert('Wprowad\u017a adres.'); return false;} if ($('#city').val().length < 4){alert('Wprowad\u017a miasto zamieszkania.'); return false;} if (!check_email($('#email').val())){alert('Wprowad\u017a poprawny adres e-mail.'); return false;} var dane = 'send=1&name='+$('#name').val()+'&firma='+$('#company').val(); dane = dane+'&adress='+$('#adress').val()+'&city='+$('#city').val(); dane = dane + '&email='+$('#email').val()+'&telefon='+$('#telefon').val()+'&uwagi='+$('#uwagi').val(); $("#dialog_enova").html(loading); $.ajax( { url: "enova.php", type: "POST", data: dane, dataType: "xhtml", error: function () { $('#dialog_enova').html(error); }, success : function (json) { setTimeout(function(){ $('#dialog_enova').html(json);}, 100); } }); return false; }); } function enova_action(){ enova_window(); } function actions_binding(){ /** * Elementy które wymagaja bindowania */ $('.print img').livequery(dynamic_icons_animations); $('#content a').livequery('click',ajax_content_links); $('.print').livequery(print_new_window_open); $('#submit_button').livequery(submit_form); $('#firma').livequery(show_company); $('#osoba').livequery(show_person); $('#order_info').livequery(show_order_info); $('.input_radio').livequery(select_years); $('#wysylka').livequery(wysylka_change); $('#ilosc').livequery(validate_ilosc); $('#submit_contact').livequery(submit_contact); $('.gallery_img').livequery(gallery_actions); $("a[rel^='prettyPhoto']").livequery(prettyPhotoShow); $("#enova_order").livequery(enova_order); }; $(document).ready(function() {enova_ajax();}); $(document).ready(function() {enova_order();}); $(document).ready(function() {init_hiddens();}); $(document).ready(function() {ajax_menu();}); $(document).ready(function() {ajax_site_map();}); $(document).ready(function() {menu_actions();}); $(document).ready(function() {slide_site_map();}); $(document).ready(function() {actions_binding();}); $(document).ready(function() {static_icons_animations();}); $(document).ready(function() {company_info();});