// NOTE:http://www.jquery4u.com/javascript/dynamically-load-jquery-library-javascript/ // TODO: Заменить скрипты на min версии (function () { function loadScript(url, callback) { var script = document.createElement("script") script.type = "text/javascript"; if (script.readyState) { //IE script.onreadystatechange = function () { if (script.readyState == "loaded" || script.readyState == "complete") { script.onreadystatechange = null; callback(); } }; } else { //Others script.onload = function () { callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); } function loadScripts(urls, callback) { var counter = urls.length; next_load(urls[0]) function next_load(url) { if(counter > 0){ var script = document.createElement("script"); script.type = "text/javascript"; if(script.readyState) { //IE script.onreadystatechange = function(){ if(script.readyState == "loaded" || script.readyState == "complete"){ script.onreadystatechange = null; urls.shift(0); next_load(urls[0]); } }; } else { //other script.onload = function (){ urls.shift(0); next_load(urls[0]); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); counter--; }else{ callback(); } } } window.onload = function(){ if(!window.jQuery){ loadScripts(Array( "/bitrix/components/aspro/creditcalc/js/jquery-1.8.3.js", "/bitrix/components/aspro/creditcalc/js/jquery-ui-1.9.2.js", "/bitrix/components/aspro/creditcalc/js/customInput.js" ), function(){ $(document).ready(function(){ onReady(); }); }); }else{ var scripts = Array("/bitrix/components/aspro/creditcalc/js/customInput.js"); if(!window.jQuery.ui){ scripts.push("/bitrix/components/aspro/creditcalc/js/jquery-ui-1.9.2.js"); } if($().jquery.split(".")[1] < '8'){ scripts.unshift("/bitrix/components/aspro/creditcalc/js/jquery-ui-1.9.2.js"); scripts.unshift("/bitrix/components/aspro/creditcalc/js/jquery-1.8.3.js"); } loadScripts(scripts, function(){ $(document).ready(function(){ onReady(); }); }); } } function onReady(){ credit_calc.init(banks); credit_calc.form_init(); } })();