isDOM=document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+) isMSIE=document.all && document.all.item //Microsoft Internet Explorer 4+ isNetscape4=document.layers //Netscape 4.* isOpera=window.opera //Opera isOpera5=isOpera && isDOM //Opera 5+ isMSIE5=isDOM && isMSIE && !isOpera //MSIE 5+ isMozilla=isNetscape6=isDOM && !isMSIE && !isOpera var crlf = unescape("%0D%0A"); var Password_mismatch="The passwords you entered did not match."; var Your="Your"; var ttt_short="must be more than"; var charecters="characters"; var ttt_invalid="Sorry, but this"; var ttt_invalid2="is invalid"; var badchar="contains an invalid character such as \" ' < >"; var obj; function getLayer(layerName, parentLayerName){ if(isDOM){ return document.getElementById(layerName) || document.getElementsByName(layerName)[0]; } if(isMSIE){ return document.all[layerName]; } if(isNetscape4){ return eval('document.layers[layerName]'); } return false; } function fireOnchange(layerName) { var obj = getLayer(layerName); if (obj && obj.onchange) obj.onchange(1); } function ts(e,what,text){ mousex = e.clientX; mousey = e.clientY; pagexoff = 0; pageyoff = 0; if(isMSIE5){ pagexoff = document.body.scrollLeft; pageyoff = document.body.scrollTop; } else{ pagexoff = window.pageXOffset; pageyoff = window.pageYOffset; } if(getLayer(what)){ if(isNetscape4) obj = getLayer(what); else obj = getLayer(what).style; if(obj){ leftoff = mousex-pagexoff; getLayer(what).innerHTML=text; obj.left = (mousex+pagexoff)+20; topoff = mousey-pageyoff; if(isOpera && topoff <= 30) obj.top = mousey + 20; else if( mousey <= 30) obj.top = (mousey+pageyoff) + 20; else if (isOpera) obj.top = mousey + 20; else obj.top = (mousey+pageyoff) + 20; if(isNetscape4) obj.visibility = 'show'; else obj.visibility = 'visible'; } } return true; } function tc(){ if(obj){ if(isNetscape4) obj.visibility = 'hide'; else obj.visibility='hidden'; } return true } function p(x, y, z) { for (a = 0; a < arguments.length; a++) { arguments[a] = arguments[a].split(''); arguments[a] = arguments[a].reverse(); arguments[a] = arguments[a].join(''); } document.location.href = "mailto:" + x + "@" + y + "." + z; } function p_u(x, y, z) { c = arguments; for (b = 0; b < c.length; b++) { if (b == 3) continue; c[b] = c[b].split(','); c[b] = c[b].reverse(); for (a = 0; a < c[b].length; a++) c[b][a] = String.fromCharCode(c[b][a] - 10); c[b] = c[b].join(''); } document.location.href = "mailto:" + c[0] + "@" + c[1] + "." + c[2] + "?subject=" + c[3] + ""; } function checkedit(what,minlength,type,title){ var obj=getLayer(what); if (obj.value.length< minlength && minlength>0){ obj.style.border="solid 1pt red"; return title+" "+ttt_short+" "+(minlength-1)+" "+charecters; } if (type==1 && parseInt(obj.value)==obj.value){ obj.style.border="solid 1pt red"; return ttt_invalid+" "+title+" "+ttt_invalid2; } if (type==2 && (parseInt(obj.value)!=obj.value)){ obj.style.border="solid 1pt red"; return ttt_invalid+" "+title+" "+ttt_invalid2; } if (obj.value.lastIndexOf("<")+obj.value.lastIndexOf(">")+obj.value.lastIndexOf('"')+obj.value.lastIndexOf("'")!=-4) { obj.style.border="solid 1pt red"; return title+" "+badchar; } obj.style.border="solid 1pt silver"; return ""; } function checkall(what){ var obj=getLayer(what); var pass=""; var tres; var tres2=true; var res = true; var k = obj.length; var errors=""; for (var i=k-1; i>=0; i--) { var item = obj[i]; if (item.type=="select-one" && item.onchange!=null){ tres=item.onchange(); if (tres!=""){ res=false; errors+=" "+tres+crlf; } } if (item.type=="textarea" && item.onkeyup!=null) { tres=item.onkeyup(); if (tres!=""){ res=false; errors+=" "+tres+crlf; } } if (item.type=="text" || item.type=="password") if (item.onchange!=null) { tres = item.onchange(); res=res && (tres.length==0); if (tres.length>0) errors+=" "+tres+crlf; if (tres.length>0) item.focus(); } } for (i=0;i< k;i++){ if (pass=="" && item.type=="password") pass=item.value; if (item.type=="password" && item.value!=pass){ if (res) item.focus(); errors+=" "+Password_mismatch+crlf; res=false; item.style.border="solid 1pt red"; } } if (!res) { alert(errors); } return res; } var win = null; function nwin(mypage,myname,w,h,scroll){LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;TopPosition = (screen.height) ? (screen.height-h)/2 : 0;settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable' win = window.open(mypage,myname,settings) } function writeselect(what,a,parentid,parent2id, hidempty){ var obj=getLayer(what); var i; var oldvalue=obj.value; var noldvalue=false; var oOption while (obj.options.length>0) obj.options.remove(0); var k=0; oOption = document.createElement("OPTION"); oOption.value="-1"; oOption.text="select one..."; obj.options.add(oOption); obj.value="-1"; for (i=0;i< a.length-1;i++){ oOption = document.createElement("OPTION"); oOption.value=a[i][0]; oOption.text=a[i][1]; var v=""; var v2=""; if (parentid!="") v=getLayer(parentid).value; if (parent2id!="") v2=getLayer(parent2id).value; if ((a[i][2].lastIndexOf("|"+v+"|")!=-1 || v=="" || a[i][2]=="")&& (a[i][3].lastIndexOf("|"+v2+"|")!=-1 || v2=="" || a[i][3]=="")){ obj.options.add(oOption); k++; if (oOption.value==oldvalue) { obj.value=oldvalue; noldvalue=true; } } } // if (noldvalue || k==1) { if (noldvalue) { obj.options.remove(0); } if (obj.onchange!=null) obj.onchange(); if (k!=0 && hidempty=='1') { obj.style.display='block'; } else if (hidempty=='1'){ obj.style.display='none'; } } function checkselect(what,star,othername,title){ var obj=getLayer(what); var ff=true; if (getLayer(othername)){ if (getLayer(othername).value.length>0) obj.value="0"; if (getLayer(othername).value.length==0) ff=false; } if (obj.value!="0") ff=true; if (star){ if (obj.value=="-1" || !ff){ if (!ff) getLayer(othername).style.border="solid 1pt red"; else { obj.style.color="red"; if (getLayer(othername)) getLayer(othername).style.border="solid 1pt silver"; } return "You must fill in the field: "+title; } } obj.style.color="black"; if (getLayer(othername)) getLayer(othername).style.border="solid 1pt silver"; return ""; } function checktextarea(what,title,maxlength,star,showHTML,controlHTML){ var obj=getLayer(what); var obj2=getLayer(what+"_dText") if (maxlength>0){ //obj.value=obj.value.substr(0,maxlength); obj2.innerText="Remain "+(maxlength-obj.value.length)+" characters"; if (maxlength< obj.value.length){ obj.style.border="solid 1pt red"; return title+" must be no more than"+ maxlength+" characters" } } if (star){ if (obj.value.length==0){ obj.style.border="solid 1pt red"; if (showHTML) getLayer(what+"_showHTML").innerHTML="Error"; return "You must fill in the field: "+title; } } if (!showHTML && controlHTML && obj.value.lastIndexOf("<")+obj.value.lastIndexOf(">")+obj.value.lastIndexOf('"')+obj.value.lastIndexOf("'")!=-4) { obj.style.border="solid 1pt red"; if (showHTML) getLayer(what+"_showHTML").innerHTML="Error"; return title+" "+badchar; } obj.style.border="solid 1pt silver"; if (showHTML) getLayer(what+"_showHTML").innerHTML=obj.value; return ""; } function checkdate(name,time,star){ var obj1=getLayer(name+"day"); var obj2=getLayer(name+"month"); var obj3=getLayer(name+"year"); var obj4=getLayer(name+"hour"); var obj5=getLayer(name+"minute"); var obj6=getLayer(name+"second"); var error="You must fill in the required fields"; if (star){ if (obj1.value.length==0) return error; if (!(parseInt(obj2.value)>=0)) return error; if (obj3.value.length==0) return error; if (time){ if (obj4.value.length==0) return error; if (obj5.value.length==0) return error; if (obj6.value.length==0) return error; } } return ""; } function passw_compl(name) { //Взято с tut.by //Некоторая часть переделана var obj=getLayer(name); var pass=obj.value; var objImg=getLayer(name+"_imagemark"); var mark = 0; var flag = 0; var pass_len = pass.length; for (i = 1; i <= pass_len - 1; i++) if (pass.substr(i, 1) == pass.substr(i - 1, 1)) flag++; if (flag/(pass_len - 1) >= 0.9) return "images/pc1.gif"; if (pass_len >= 3) { // proverka dliny mark += 1; var str1 = "`1234567890-=qwertyuiop[]asdfghjkl;'zxcvbnm,./"; // proverka na posledovatel'nost' simvolov kak na klaviature var str2 = "~!@#$%^&*()-=QWERTYUIOP[]ASDFGHJKL;'ZXCVBNM<>?"; flag = 0; for (i = 0; i <= str1.length - pass_len; i++) if (pass == str1.substr(i, pass_len) || pass == str2.substr(i, pass_len)) { flag = 1; break; } if (!flag) mark += 1; flag = 0; for (i = 0; i < pass_len; i++) // proverka na prisutstvie tol'ko cifr if ("0123456789".indexOf(pass.substr(i, 1)) != -1) flag++; if (flag != pass_len && pass_len >= 3) mark += 1; for (i = 0; i < pass_len; i++) // proverka na prisutstvie osobyh simvolov i bukv+cifri if ("1234567890`~!@#$%^&*()_-+={}[]:;'?/|\"\\<>".indexOf(pass.substr(i, 1)) != -1) { mark += 1; break; } flag = 0; // proverka na prisutstvie raznix registrov for (i = 0; i < pass_len; i++) if ("QWERTYUIOPASDFGHJKLZXCVBNM".indexOf(pass.substr(i, 1)) != -1) flag++; if (flag * 100 / pass_len < 100 && flag * 100 / pass_len > 0 || pass_len >= 12) mark += 1; flag = 0; // proverka na posledovatel'nost' odinakovih simvolov for (i = 0; i <= pass_len - 3; i++) if (pass.substr(i, 1) == pass.substr(i + 1, 1) && pass.substr(i, 1) == pass.substr(i + 2, 1) && pass_len <= 8) { mark -= 1; break; } if (pass_len == 8){ var k1=parseInt(pass.substr(0,2)); if (pass.substr(0,1)=='0') k1=parseInt(pass.substr(1,1)); var k2=parseInt(pass.substr(2,2)); if (pass.substr(2,1)=='0') k3=parseInt(pass.substr(3,1)); var k3=parseInt(pass.substr(4,4)); if (k1>0 && k1<=31 && k2>0 && k2<=12 && k3>=1900 && k3<2020) mark-=2; } if (pass_len >= 8) mark += 1; } else if (pass_len > 0) mark = 1; if (mark<0) mark=0; objImg.src="\\art/mark/m" + mark + ".gif"; } function newImage(arg) { if (document.images) { rslt = new Image(); rslt.src = arg; return rslt; } } function preloadImages() { if (document.images) { id0 = newImage("\\art/mark/m0.gif"); id1 = newImage("\\art/mark/m1.gif"); id2 = newImage("\\art/mark/m2.gif"); id3 = newImage("\\art/mark/m3.gif"); id4 = newImage("\\art/mark/m4.gif"); id5 = newImage("\\art/mark/m5.gif"); id6 = newImage("\\art/mark/m6.gif"); } } // https://stackoverflow.com/questions/28194786/how-to-make-document-queryselector-work-in-ie6 // https://github.com/inexorabletash/polyfill/blob/master/polyfill.js#L4804 (function querySelectorPolyfillInstaller() { // Document.querySelectorAll method // http://ajaxian.com/archives/creating-a-queryselector-for-ie-that-runs-at-native-speed // Needed for: IE7- if (!document.querySelectorAll) { document.querySelectorAll = function(selectors) { var style = document.createElement('style'), elements = [], element; document.documentElement.firstChild.appendChild(style); document._qsa = []; style.styleSheet.cssText = selectors + '{x-qsa:expression(document._qsa && document._qsa.push(this))}'; window.scrollBy(0, 0); style.parentNode.removeChild(style); while (document._qsa.length) { element = document._qsa.shift(); element.style.removeAttribute('x-qsa'); elements.push(element); } document._qsa = null; return elements; }; } // Document.querySelector method // Needed for: IE7- if (!document.querySelector) { document.querySelector = function(selectors) { var elements = document.querySelectorAll(selectors); return (elements.length) ? elements[0] : null; }; } })/*()*/; // misbehaves in IE 6 // https://stackoverflow.com/questions/7410949/javascript-document-getelementsbyclassname-compatibility-with-ie // https://stackoverflow.com/questions/18944659/polyfill-for-getelementsbyclassname-for-particular-uses // https://gist.github.com/eikes/2299607 (function getElementsByClassNamePolyfillInstaller() { if (!document.getElementsByClassName) { document.getElementsByClassName = function(search) { var d = document, elements, pattern, i, results = []; if (d.querySelectorAll) { // IE8 return d.querySelectorAll("." + search); } if (d.evaluate) { // IE6, IE7 pattern = ".//*[contains(concat(' ', @class, ' '), ' " + search + " ')]"; elements = d.evaluate(pattern, d, null, 0, null); while ((i = elements.iterateNext())) { results.push(i); } } else { elements = d.getElementsByTagName("*"); pattern = new RegExp("(^|\\s)" + search + "(\\s|$)"); for (i = 0; i < elements.length; i++) { if (pattern.test(elements[i].className)) { results.push(elements[i]); } } } return results; } } })(); function getElementsByClassName(className) { if (document.getElementsByClassName) return document.getElementsByClassName(className); var found = []; var elements = document.getElementsByTagName("*"); for (var i = 0; i < elements.length; i++) { var names = elements[i].className.split(' '); for (var j = 0; j < names.length; j++) { if (names[j] == className) found.push(elements[i]); } } return found; } function showHide(selector) { var e = document.querySelector ? document.querySelector(selector) : getElementsByClassName(selector.substring(1))[0]; e.style.display = (e.style.display === 'none') ? '' : 'none'; }