function buildKeyboardInputs(){function d(n,t){if(document.createEvent){var i=document.createEvent("HTMLEvents");i.initEvent(t,!1,!1),n.dispatchEvent(i)}else document.createEventObject&&n.fireEvent("on"+t)}var n=this,i,t,g,r,c,w,f,b,p,e;this.VKI_target=this.VKI_visible="",this.VKI_shift=this.VKI_capslock=this.VKI_alternate=!1,this.VKI_kt="Russian",this.VKI_range=!1,this.VKI_keyCenter=3,this.VKI_layout={};var s="Ñòåðåòü",y="Ââîä",o="Shift",v="Ïîìîùü",a="Î÷èñòèòü",h="Blank";for(this.VKI_layout.Russian=[[["1","!"],["2",'"'],["3","¹"],["4",";"],["5","%"],["6",":"],["7","?"],["8","*"],["9","("],["0",")"],["-","_"],["=","+"],["'","'"],['"','"'],[s,s]],[["¸","¨"],["é","É"],["ö","Ö"],["ó","Ó"],["ê","Ê"],["å","Å"],["í","Í"],["ã","Ã"],["ø","Ø"],["ù","Ù"],["ç","Ç"],["õ","Õ"],["ú","Ú"],[y,y]],[["ô","Ô"],["û","Û"],["â","Â"],["à","À"],["ï","Ï"],["ð","Ð"],["î","Î"],["ë","Ë"],["ä","Ä"],["æ","Æ"],["ý","Ý"],["/","\\"],["\\","/"],[a,a]],[[o,o],["ÿ","ß"],["÷","×"],["ñ","Ñ"],["ì","Ì"],["è","È"],["ò","Ò"],["ü","Ü"],["á","Á"],["þ","Þ"],[".",","],[",","."],[v,v]],[[h,h]]],i=[document.getElementsByTagName("input"),document.getElementsByTagName("textarea"),],t=0,g=0;t<i.length;t++)if(i[t])for(r=0;r<i[t].length;r++)if((i[t][r].nodeName=="TEXTAREA"||i[t][r].type=="text"||i[t][r].type=="password")&&i[t][r].className.indexOf("keyboardInput")>-1){c="";if(i[t][r].id)c=i[t][r].id;else do c="keyboardInputInitiator"+g++;while(document.getElementById(c));i[t][r].id=c,i[t][r].onclick=i[t][r].onkeyup=i[t][r].onselect=function(){n.VKI_target.createTextRange&&(n.VKI_range=document.selection.createRange())}}this.VKI_keyboard=document.createElement("table"),this.VKI_keyboard.id="keyboardInputMaster",this.VKI_keyboard.cellSpacing=this.VKI_keyboard.cellPadding=this.VKI_keyboard.border="0";var k=document.createElement("thead"),l=document.createElement("tr"),u=document.createElement("td");u.className="header",w="Âèðòóàëüíàÿ ",w+="êëàâèàòóðà",u.appendChild(document.createTextNode(w)),l.appendChild(u),u=document.createElement("td"),u.className="rightCorner",f=document.createElement("span"),f.id="keyboardInputClose",b=document.createElement("img"),b.src="http://static.ozone.ru/graphics/ozon/keybord/icon_close.gif",f.appendChild(b),f.title="Çàêðûòü îêíî",f.onmousedown=function(){this.className="pressed"},f.onmouseup=function(){this.className=""},f.onclick=function(){n.VKI_close()},u.appendChild(f),l.appendChild(u),k.appendChild(l),this.VKI_keyboard.appendChild(k);var nt=document.createElement("tbody"),l=document.createElement("tr"),u=document.createElement("td");u.className="background",u.colSpan="2",p=document.createElement("div"),p.id="keyboardInputLayout",u.appendChild(p),l.appendChild(u),nt.appendChild(l),this.VKI_keyboard.appendChild(nt),this.VKI_buildKeys=function(){var f,i,u,e,c,r,t;this.VKI_shift=this.VKI_capslock=this.VKI_alternate=!1,f=this.VKI_keyboard.tBodies[0].getElementsByTagName("div")[0];while(f.firstChild)f.removeChild(f.firstChild);for(i=0;i<this.VKI_layout[this.VKI_kt].length;i++){for(u=document.createElement("table"),u.cellSpacing=u.cellPadding=u.border="0",e=document.createElement("tbody"),c=document.createElement("tr"),r=0;r<this.VKI_layout[this.VKI_kt][i].length;r++){t=document.createElement("td"),t.appendChild(document.createTextNode(this.VKI_layout[this.VKI_kt][i][r][0])),this.VKI_layout[this.VKI_kt][i].length>this.VKI_keyCenter&&r==this.VKI_layout[this.VKI_kt][i].length-1&&(t.className+=this.VKI_layout[this.VKI_kt][i][r][1]==s?" lastNotLong":" last"),this.VKI_layout[this.VKI_kt][i][r][1]==h&&(t.style.color="#ffffff",t.style.width="220px"),t.onmouseover=function(){this.className!="dead"&&this.firstChild.nodeValue!=" "&&(this.className+=" hover"),this.firstChild.nodeValue==h&&(this.style.color="#cccccc")},t.onmouseout=function(){this.className!="dead"&&(this.className=this.className.replace(/ ?(hover|pressed)/g,"")),this.firstChild.nodeValue==h&&(this.style.color="#ffffff")},t.onmousedown=function(){this.className!="dead"&&this.firstChild.nodeValue!=" "&&(this.className+=" pressed")},t.onmouseup=function(){this.className!="dead"&&(this.className=this.className.replace(/ ?pressed/g,""))},t.ondblclick=function(){return!1};switch(this.VKI_layout[this.VKI_kt][i][r][1]){case o:t.className+=" CapsLong";case"Shift":case"Alt":case"AltGr":t.onclick=function(t){return function(){return n.VKI_modify(t),!1}}(this.VKI_layout[this.VKI_kt][i][r][1]);break;case"Tab":t.onclick=function(){return n.VKI_insert("\t"),!1};break;case s:t.onclick=function(){n.VKI_target.focus();if(n.VKI_target.setSelectionRange){var t=n.VKI_target.selectionStart,i=n.VKI_target.selectionEnd;t<i&&t++,n.VKI_target.value=n.VKI_target.value.substr(0,t-1)+n.VKI_target.value.substr(i),n.VKI_target.setSelectionRange(t-1,t-1)}else if(n.VKI_target.createTextRange){try{n.VKI_range.select()}catch(r){}n.VKI_range=document.selection.createRange(),n.VKI_range.text.length||n.VKI_range.moveStart("character",-1),n.VKI_range.text=""}else n.VKI_target.value=n.VKI_target.value.substr(0,n.VKI_target.value.length-1);return n.VKI_shift&&n.VKI_modify("Shift"),n.VKI_alternate&&n.VKI_modify("AltGr"),!0};break;case y:t.onclick=function(){return n.VKI_target.nodeName=="TEXTAREA"?n.VKI_insert("\n"):n.VKI_close(),!0};break;case a:t.onclick=function(){return n.VKI_target.value="",n.VKI_target.focus(),!1};break;case v:t.onclick=function(){return showInfo(3671576),!1};break;case h:t.onclick=function(){return n.VKI_insert(" "),!1};break;default:t.onclick=function(){return this.firstChild.nodeValue!=" "&&n.VKI_insert(this.firstChild.nodeValue),n.VKI_modify(""),!1}}c.appendChild(t),e.appendChild(c),u.appendChild(e)}f.appendChild(u)}},this.VKI_buildKeys(),window.sidebar||window.opera?(this.VKI_keyboard.onmousedown=function(){return!1},this.VKI_keyboard.onclick=function(){return!0}):this.VKI_keyboard.onselectstart=function(){return!1},this.VKI_modify=function(n){var e,f,r,i,t,u;switch(n){case"Alt":case"AltGr":this.VKI_alternate=!this.VKI_alternate;break;case o:this.VKI_capslock=!this.VKI_capslock;break;case"Shift":this.VKI_shift=!this.VKI_shift}for(e=0,!this.VKI_shift!=!this.VKI_capslock&&(e+=1),f=this.VKI_keyboard.getElementsByTagName("table"),r=0;r<f.length;r++)for(i=f[r].getElementsByTagName("td"),t=0;t<i.length;t++){u=alive=target=!1;switch(this.VKI_layout[this.VKI_kt][r][t][1]){case"Alt":case"AltGr":this.VKI_alternate&&(u=!0);break;case"Shift":this.VKI_shift&&(u=!0);break;case o:this.VKI_capslock&&(u=!0);break;case"Tab":case y:case s:case a:case v:break;default:n&&(i[t].firstChild.nodeValue=this.VKI_layout[this.VKI_kt][r][t][e+(this.VKI_alternate&&this.VKI_layout[this.VKI_kt][r][t].length==4?2:0)])}i[t].className=u?"dead":target?"target":alive?"alive":"",this.VKI_layout[this.VKI_kt][r][t][1]==o&&(i[t].className+=" CapsLong "),t==i.length-1&&i.length>this.VKI_keyCenter&&(i[t].className+=this.VKI_layout[this.VKI_kt][r][t][1]==s?" lastNotLong":" last")}this.VKI_target.focus()},this.VKI_insert=function(n){this.VKI_target.focus();if(this.VKI_target.setSelectionRange){var t=this.VKI_target.selectionStart,i=this.VKI_target.selectionEnd;this.VKI_target.value=this.VKI_target.value.substr(0,t)+n+this.VKI_target.value.substr(i),n=="\n"&&window.opera&&t++,this.VKI_target.setSelectionRange(t+n.length,t+n.length)}else if(this.VKI_target.createTextRange){try{this.VKI_range.select()}catch(r){}this.VKI_range=document.selection.createRange(),this.VKI_range.text=n,this.VKI_range.collapse(!0),this.VKI_range.select()}else this.VKI_target.value+=n;this.VKI_shift&&this.VKI_modify("Shift"),this.VKI_alternate&&this.VKI_modify("AltGr"),this.VKI_target.focus(),d(VKI_target,"keydown")},this.fireVKIonchange=function(){e!=null&&(VKI_target.onchange=e,d(VKI_target,"change"))},e=null,this.VKI_show=function(n){if(this.VKI_target=document.getElementById(n))if(this.VKI_visible!=n){e=VKI_target.onchange,VKI_target.onchange="checkOnchangeVKI();",this.VKI_range="";try{this.VKI_keyboard.parentNode.removeChild(this.VKI_keyboard)}catch(i){}var t=this.VKI_target;this.VKI_target.keyboardPosition="absolute";do if(VKI_getStyle(t,"position")=="fixed"){this.VKI_target.keyboardPosition="fixed";break}while(t=t.offsetParent);document.body.appendChild(this.VKI_keyboard),this.VKI_visible=this.VKI_target.id,this.VKI_target.focus()}else this.VKI_close()},this.VKI_close=function(){try{this.VKI_keyboard.parentNode.removeChild(this.VKI_keyboard)}catch(n){}this.VKI_visible="",this.VKI_target.focus(),this.VKI_target="",VKI_target.onchange=e}}function VKI_findPos(n){var t=curtop=0;do t+=n.offsetLeft,curtop+=n.offsetTop;while(n=n.offsetParent);return[t,curtop]}function VKI_innerDimensions(){return self.innerHeight?[self.innerWidth,self.innerHeight]:document.documentElement&&document.documentElement.clientHeight?[document.documentElement.clientWidth,document.documentElement.clientHeight]:document.body?[document.body.clientWidth,document.body.clientHeight]:[0,0]}function VKI_getStyle(n,t){var i;return n.currentStyle?i=n.currentStyle[t]:window.getComputedStyle&&(i=window.getComputedStyle(n,null)[t]),i}
