$(function() { /* Switch */ var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch')); elems.forEach(function(html) { var switchery = new Switchery(html, { size: 'small', color: '#504d8b' }); }); }); function changeLang(field, fieldsString, id_language_new, iso_code, display) { var fields = fieldsString.split('ยค'); for (var i = 0; i < fields.length; ++i) { getE(fields[i] + '_' + id_language).style.display = 'none'; getE(fields[i] + '_' + id_language_new).style.display = display; getE('language_current_' + fields[i]).src = '../img/l/' + id_language_new + '.jpg'; } getE('languages_' + field).style.display = 'none'; id_language = id_language_new; }