function setInsideDivSize() { document.getElementById('insideDiv').style.width = (document.body.clientWidth - 414) + 'px'; } function setInsideDivSizeAdmin() { document.getElementById('insideDivAdmin').style.width = (document.body.clientWidth - 209) + 'px'; } function ShowCell(ATemplate, ADiv, AIndex, AData) { var LHTML = ''; if (AIndex < AData.length) { var LInfo = AData[AIndex]; LHTML = ATemplate .replace(/###URL###/g, LInfo[0]) .replace(/###Image###/g, LInfo[1]) .replace(/###Title###/g, LInfo[2]); // TODO: Title should be encoded as it can include tags like } ADiv.innerHTML = LHTML; } function ShowCells(APosition, ATemplate, ADivs, AData) { if (AData.length <= ADivs.length) { APosition = 0; } else if (APosition < 0) { APosition = 0; } else if (APosition >= AData.length - ADivs.length) { APosition = AData.length - ADivs.length; } for (var i = 0; i < ADivs.length; i++) ShowCell(ATemplate, document.getElementById(ADivs[i]), APosition + i, AData); return APosition; } function CountNameGet(ACount, ASingle, AFew, AMany) { if ((ACount % 100) / 10 == 1) { return AMany; } else if ((ACount % 10) == 0) { return AMany; } else if ((ACount % 10) == 1) { return ASingle; } else if ((ACount % 10) < 5) { return AFew; } return AMany; } function SwitchLanguage(ALanguage) { var url = document.location.href; var urlNew = url .replace(/L=Ukr/g, '###Lang###') .replace(/L=Rus/g, '###Lang###') .replace(/L=Eng/g, '###Lang###'); if (url == urlNew) { urlNew = url + ((url == url.replace('?', '')) ? '?' : '&') + '###Lang###'; } urlNew = urlNew.replace(/###Lang###/g, 'L=' + ALanguage); //alert(url + '=>' + urlNew); document.location.href = urlNew; } function isPDF(AFileName) { var S = AFileName + '!'; return (S.slice(-5).toLowerCase() == '.pdf!'); } function SelectOptionSet(ASelectObj, AOptionValue) { var options = ASelectObj.options; for (var i = 0; i < options.length; i++) { if (options[i].value == AOptionValue) { ASelectObj.selectedIndex = i; return; } } ASelectObj.selectedIndex = -1; } function SelectValueGet(ASelectObj) { if (ASelectObj.selectedIndex == -1) { return ''; } else { return ASelectObj.options[ASelectObj.selectedIndex].value; } }