String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'');};Array.prototype.contains=function(A){for(var i=this.length-1;i>=0;--i)if(this[i]===A)return i;return-1;};if (typeof(Array.prototype.indexOf)=='undefined'){Array.prototype.indexOf=function(A){var B=this.length;var C=Number(arguments[1])||0;C=(C<0)?Math.ceil(C):Math.floor(C);if (C<0) C+=B;for (;C<B;++C){if (C in this&&this[C]===A) return C;};return-1;};};var Cons={isIE:/*@cc_on!@*/false,isGecko:navigator.userAgent.toLowerCase().indexOf('gecko')!=-1,gel:function(a){return document.getElementById?document.getElementById(a):(document.all?document.all[a]:null);},gelByName:function(A,B){var C=[];var D=document.getElementsByTagName(A);var	E=D.length;for (var i=0,attr;i<E;i++){attr=D[i].getAttribute('name');if (attr==B) C.push(D[i]);};return C;},appl:function(a,b){return function(){return a[b].apply(a,arguments);}},isAlpha:function(A){ return (A>255)||(A>=65&&A<=122)||(A>=192&&A<=255)||(A>=48&&A<=57);},_escapeOrig:window.escape,_escape_trans:[],escape:function(A){if (this._escape_trans.length==0){for (var i=0x410;i<=0x44F;i++) this._escape_trans[i]=i-0x350;this._escape_trans[0x401]=0xA8;this._escape_trans[0x451]=0xB8;};var B=[];var n;for (var i=0;i<A.length;i++){n=A.charCodeAt(i);if (typeof(this._escape_trans[n])!='undefined') n=this._escape_trans[n];if (n<=0xFF) B.push(n);};return this._escapeOrig(String.fromCharCode.apply(null,B));},ver:'0.1'};Cons.Event={add:function(A,B,C,D){if (typeof(D)=='undefined') D=false;if (A.addEventListener) A.addEventListener(B,C,D);else if (A.attachEvent){A['e'+B+C]=C;A[B+C]=function(){A['e'+B+C](window.event);};A.attachEvent('on'+B,A[B+C]);window.attachEvent('onunload',function() { A.detachEvent('on'+B,C);});}else A['on'+B]=C;},remove:function(A,B,C){if (A.removeEventListener) A.removeEventListener(B,C,false);else if (A.detachEvent){A.detachEvent('on'+B,A[B+C]);A[B+C]=null;A['e'+B+C]=null;}else A['on'+B]=null;},format:function(A){if (Cons.isIE){A.charCode=(A.type=='keypress')?A.keyCode:0;A.eventPhase=2;A.isChar=(A.charCode>0);A.pageX=A.clientX+document.body.scrollLeft;A.pageY=A.clientY+document.body.scrollTop;A.preventDefault=function(){this.returnValue=false;};if (A.type=='mouseout') A.relatedTarget=A.toElement;else if (A.type=='mouseover') A.relatedTarget=A.fromElement;A.stopPropagation=function(){this.cancelBubble=true;};A.target=A.srcElement;A.time=(new Date).getTime();};return A;}};Cons.DOM={hide:function(A){if(A) A.style.display='none';},show:function(A,m){if (!A) return;if (typeof(m)=='undefined') m='block';if (m=='table-row'&&Cons.isIE) m='block';A.style.display=m;},hasClass:function(A,B){return typeof(A.className)!='undefined'&&(' '+A.className+' ').indexOf(' '+B+' ')!=-1;},addClass:function(A,B){if (A&&B){var a=B.split(/\s+/);for (var i=a.length-1;i>=0;--i) if (!this.hasClass(A,a[i])) A.className+=(A.className?' ':'')+a[i];}},delClass:function(A,B){if (A&&B){var a=B.split(/\s+/);var b=A.className.split(/\s+/);for (var i=b.length-1;i>=0;--i) if (a.contains(b[i])!=-1) b[i]='';A.className=b.join(' ');}},view:document.defaultView||null,xpath:function(A,B){if (A){if (typeof(XPathEvaluator)!='undefined'){var C=new XPathEvaluator();var D=C.createNSResolver(A.ownerDocument==null?A.documentElement:A.ownerDocument.documentElement);var E=C.evaluate(B,A,D,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);var F=[];if (E){var G;while (G=E.iterateNext()) F.push(G);};return F;}else if (typeof(A.selectNodes)!='undefined') return A.selectNodes(B);};return null;},getRect:function(a){var c={top:0,left:0,bottom:0,right:0};if (typeof(getBoundingClientRect)!='undefined') c=a.getBoundingClientRect();else{c.right=a['offsetWidth'];c.bottom=a['offsetHeight'];while (a!=null){c.left+=a['offsetLeft'];c.top+=a['offsetTop'];a=a.offsetParent;};c.right+=c.left;c.bottom+=c.top;};if (typeof(c.width)=='undefined') c.width=c.right-c.left;if (typeof(c.height)=='undefined') c.height=c.bottom-c.top;return c;},getStyle:function(A,B){return this.view&&this.view.getComputedStyle?this.view.getComputedStyle(A,B):A.currentStyle;},getText:function(A){return A.textContent||A.innerText||A.text||'';},addScript:function(A,B,C){var D=document.getElementsByTagName("head")[0];var E=document.createElement("script");E.id=B;E.type="text/javascript";D.appendChild(E);E.src=A;if (typeof(C)=="function"){E.onload=E.onreadystatechange=function(){if(!this.readyState||this.readyState=="loaded"||this.readyState=="complete") C();}}},disableSelection:function(A){if(typeof A.onselectstart!="undefined")A.onselectstart=function(){return false;};else if (typeof A.style.MozUserSelect!="undefined")A.style.MozUserSelect="none";else A.onmousedown=function(){return false;};A.style.cursor="default";}};Cons.Flash={write:function(){},test:function(A,B){if (typeof(A)=='undefined'||A<1) A=1;if (typeof(B)=='undefined'||B<1) B=15;var C=0;if (navigator.mimeTypes&&navigator.mimeTypes['application/x-shockwave-flash']){var D=navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin;if (D) C=parseInt(D.description.substring(D.description.lastIndexOf(' ',D.description.indexOf('.'))));}else if (((navigator.appName.indexOf('Microsoft')!=1)&&(navigator.appVersion.indexOf('MSIE')!=1)&&(parseFloat(navigator.appVersion)>=4))){var f=null;for (var i=B;!f&&i>=A;--i){try{f=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.'+i);}catch (e){f=null;}};if (f){var t=f.GetVariable('$version').split(' ');if (t.length>1){var s=t[1].split(',');C=parseInt(s[0]);};f=null;}};return (C>=A&&C<=B)?C:0;}};Cons.Banner={has_flash:-1,getCode:function(){},write:function(){},add:function(A){if (this.has_flash==-1) this.has_flash=Cons.Flash.test(7);if (typeof(A.zone)=='undefined') return;if (typeof(A.from)=='undefined') A.from=location.href;A.use_flash=(A.use_flash&&this.has_flash)?1:0;A.place=A.place||('ban__'+A.zone);Cons.DOM.addScript('http://banner.consultant.ru/ban/?init=1;flash='+A.use_flash+';zone='+A.zone+';obj='+A.place+';from='+escape(A.from));}};Cons.Event.add(window,'load',function(){for (var i=0;i<_banners.length;++i) Cons.Banner.add(_banners[i]);});function checkContactForm(A){if(!A.doc_name.value){alert('Не заполнено поле: Название документа!');return false;};if(!A.doc_date.value){alert('Не заполнено поле: Дата принятия!');return false;};if(!A.doc_num.value){alert('Не заполнено поле: Номер документа!');return false;};if(!A.FromName.value){alert('Не заполнено поле: Фамилия, имя и отчество!');return false;};if(A.cat.value=='-'){alert('Не выбрана категория пользователя!');return false;};if(!A.FromAddr.value||!isEmail(A.FromAddr.value)){alert('E-mail некорректен');return false;};return true;};function isEmail(A){Str=new String(A);if(!((Str.search(/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/)==-1)&&(Str.search(/^.+\@\[?(\w|[-.])+\.[a-zA-Z]{2,3}|[0-9]{1,3}\]?$/)!=-1))) return false;var i=A.indexOf("@");if(i<1||i>(A.length-3)) return false;else{if(A.indexOf(".",i)<i||A.indexOf(".")>(A.length-3)) return false;for (i+1;i<A.length-1;i++){if (A.charAt(i)>"z") return false;};return true;}};
