function phone_include(path) { var ext = path.split('.').pop(); var fe = null; if (ext=='js') { fe = document.createElement("script"); fe.setAttribute("type","text/javascript") fe.setAttribute("src", path); } else if (ext=='css') { fe = document.createElement("link"); fe.setAttribute("rel", "stylesheet"); fe.setAttribute("type", "text/css"); fe.setAttribute("href", path); } if (fe!==null) { document.getElementsByTagName("head")[0].appendChild(fe); } } /* if (undefined===window.jQuery) { phone_include("http://static.pneumatig.eu/js/jquery/jquery.min.js"); } */ if (undefined===window.theme) { theme = 'default'; } if (undefined===window.phone_element) { phone_element = false; } if (undefined===window.phone_theme_path) { phone_theme_path = "http://6224922.pl/phone/themes/"; } phone_include(phone_theme_path+theme+"/phone.css"); if (document.cookie.indexOf('phone_box_hide=1')==-1) { var template = '
'+ ''+ ''+ ''+ ''+ '

'; if (phone_element) { $('#'+phone_element).hide().html(template).fadeIn(2000); } else { document.write(template); } $('#phone_box form').submit(function(e) { e.preventDefault(); $('#pb_ref').val(window.location.href); if ($('#pb_name').val()==pb_locale.name) $('#pb_name').val(""); if ($('#pb_phone').val()==pb_locale.phone) $('#pb_phone').val(""); var ajaxr = { 'url':'http://6224922.pl/phone/phone.php', 'data': $('#phone_box form').serialize(), 'dataType': 'jsonp', 'type': 'get', 'success': function(obj) { //console.log(obj); if (obj.error) { $.each(obj.error, function(k,v) { $('#pb_'+v).addClass('error'); setTimeout(function() { $('#pb_'+v).removeClass('error') }, 3000); }); } else if (obj.message) { $('#phone_box').addClass('sent'); $('#pb_msg').html(obj.message); $('#phone_box form, #phone_box #pb_att').hide(); $('#pb_msg').fadeIn(2000); } }}; $.ajax(ajaxr); return false; }); if (undefined===window.pb_locale) { pb_locale = { 'name': 'Imię', 'phone': 'Telefon' } } $('#pb_name').val(pb_locale.name); $('#pb_phone').val(pb_locale.phone); $('#phone_box form input[type=text]').focus(function() { if ($(this).val()==pb_locale[$(this)[0].name]) $(this).val(""); }).blur(function() { if ($(this).val()=="") $(this).val(pb_locale[$(this)[0].name]); }); $('#pb_close').click(function() { document.cookie = 'phone_box_hide=1'; $('#phone_box').fadeOut(2000); }); }