function getLang(){
try {
var args = Array.prototype.slice.call(arguments);
var key = args.shift();
if (!key) return '...';
var val = (window.lang && window.lang[key]) || (window.langpack && window.langpack[key]) || window[key];
if (!val) {
return key.replace(/_/g, ' ');
}
if (isFunction(val)) {
return val.apply(null, args);
} else if (isArray(val)) {
return langNumeric(args[0], val);
} else {
return val;
}
} catch(e) {
debugLog('lang error:' + e.message + '(' + Array.prototype.slice.call(arguments).join(', ') + ')');
}
}
/**
* DOM
**/
function ge() {
var ea;
for (var i = 0; i < arguments.length; i++) {
var e = arguments[i];
if (typeof e == 'string')
e = document.getElementById(e);
if (arguments.length == 1)
return e;
if (!ea)
ea = new Array();
ea.push(e);
}
return ea;
}
var _logTimer = (new Date()).getTime();
function debugLog(msg){
try {
var _time = (new Date()).getTime();
var t = '['+((_time - _logTimer)/1000)+'] ';
if (ge('debuglog')) {
if (msg===null) msg = '[NULL]'; else if (msg===undefined) msg = '[UNDEFINED]';
ge('debuglog').innerHTML += t + msg.toString().replace('<', '<').replace('>', '>')+'<br/>';
}
if(window.console && console.log){console.log(t + msg);}
return _time;
} catch (e) {return 0;}
}
function geByClass(searchClass, node, tag) {
var classElements = new Array();
if (node == null)
node = document;
if (tag == null)
tag = '*';
if (node.getElementsByClassName) {
classElements = node.getElementsByClassName(searchClass);
if (tag != '*') {
for (i = 0; i < classElements.length; i++) {
if (classElements.nodeName == tag)
classElements.splice(i, 1);
}
}
return classElements;
}
var els = node.getElementsByTagName(tag);
var elsLen = els.length;
var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
for (i = 0, j = 0; i < elsLen; i++) {
if ( pattern.test(els[i].className) ) {
classElements[j] = els[i];
j++;
}
}
return classElements;
}
function show(elem) {
if (arguments.length > 1) {
for (var i = 0; i < arguments.length; i++) {
show(arguments[i]);
кусок)