var version = 1; function jsloader(arr, cb) { var head = document.getelementsbytagname('head')[0]; var _load_index = 0; function onscriptload(node, e, url) { var readyregexp = navigator.platform === 'playstation 3' ? /^complete$/ : /^(complete|loaded)$/ if (e.type === 'load' || (readyregexp.test((e.currenttarget || e.srcelement).readystate))) { head.removechild(node); oncallback(); } } function oncallback() { _load_index++; if (_load_index == arr.length) { cb(); } else { load(arr[_load_index]); } } var isopera = typeof opera !== 'undefined' && opera.tostring() === '[object opera]'; function load(url) { var node = document.createelement('script'); node.async = true; node.charset = 'utf-8'; node.src = url + '?v=' + version; head.appendchild(node); if (node.attachevent && !(node.attachevent.tostring && node.attachevent.tostring().indexof('[native code') < 0) && !isopera) { node.attachevent('onreadystatechange', function (e) { onscriptload(node, e, url); }); } else { node.addeventlistener('load', function (e) { onscriptload(node, e, url); }, false); } } load(arr[_load_index]); } function loadcss( url ){ var link = document.createelement('link'); link.rel = 'stylesheet'; link.href = url; document.getelementsbytagname('head')[0].appendchild(link); } //define function