function note_init(a){summa_all_lastChild_height=0;var c=getElements("STRIKE");startField=document.getElementById("nb_field").offsetTop;coordVersion=(navigator.appName.indexOf("Microsoft")!=-1)?200:0;for(var b=0;b<c.length;b++){note("nb_field",c[b].offsetTop,a[b])}}function note(e,d,a){var c=document.getElementById(e);if(c.hasChildNodes()&&c.lastChild.nodeType!=3){var f=c.lastChild.offsetTop;var b=c.lastChild.offsetHeight;summa_all_lastChild_height+=b;var g=d-summa_all_lastChild_height;if(g<=(f+b-summa_all_lastChild_height)-coordVersion){c.lastChild.innerHTML+="<br><br>"+a;return}}else{g=d}c.appendChild(elem("div",{position:"relative",top:g-startField+"px"},a))}function elem(a,b,d){var c=document.createElement(a);if(b){for(key in b){c.style[key]=b[key]}}if(d){c.innerHTML=d}return c}function getElements(e,d,f){var b;var a=new Array();if(e){b=document.getElementsByTagName(e)}else{b=(document.all)?document.all:document.getElementsByTagName("*")}if(d){for(var c=0;c<b.length;c++){if(b[c].getAttribute(d)){if(f){if(b[c].getAttribute(d)==f){a[a.length]=b[c]}}else{a[a.length]=b[c]}}}}else{a=b}return a}var i;function createXmlHttpRequestObject(){var a;try{a=new XMLHttpRequest()}catch(d){var b=new Array("MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP");for(var c=0;c<b.length&&!a;c++){try{a=new ActiveXObject(b[c])}catch(d){}}}if(!a){alert("Error creating the XMLHttpRequest object.")}else{return a}}function send(){sendRequest=createXmlHttpRequestObject();var a=encodeURIComponent(trim(document.askme.request.value));var c=document.askme.theme==undefined?0:Number(document.askme.theme.value);block(true,"all");if(a!=""){params="theme="+c+"&request="+a;URL="request.php";if(sendRequest){try{if(sendRequest.readyState==4||sendRequest.readyState==0){sendRequest.open("POST",URL,true);sendRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");sendRequest.onreadystatechange=ok;sendRequest.send(params)}else{setTimeout("send();",1000)}}catch(b){alert(b)}}}}function ok(){if(sendRequest.readyState==4){if(sendRequest.status==200){try{var a=sendRequest.responseText;if(a.indexOf("ERRNO")>=0||a.indexOf("error:")>=0||a.length==0){throw (a.length==0?"Void server response.":a)}else{comment(comments[0])}}catch(b){comment(comments[1]);block(false,"all");clearTimeout(autoclose)}}else{comment(comments[1]);block(false,"all");clearTimeout(autoclose)}}}function ask(){opacityProp=getOpacityProperty();if(i==undefined){document.askme.request.value="";document.getElementById("puzir").style.display="block";i=0;block(false,"all");show_puzir();document.askme.request.focus()}else{i=1;block(false,"all");hide_puzir()}}function show_puzir(){if(i<1){i+=0.1;if(opacityProp=="filter"){document.getElementById("puzir").style.filter="alpha(opacity="+i*100+");"}else{document.getElementById("puzir").style.opacity=i}var a=setTimeout("show_puzir ()",1)}else{clearTimeout(a)}}function hide_puzir(){if(i>0){i-=0.1;if(opacityProp=="filter"){document.getElementById("puzir").style.filter="alpha(opacity="+i*100+");"}else{document.getElementById("puzir").style.opacity=i}var a=setTimeout("hide_puzir ()",1)}else{clearTimeout(a);try{clearTimeout(autoclose)}catch(b){}document.getElementById("comment").innerHTML="";document.getElementById("puzir").style.display="none";i=undefined}}function getOpacityProperty(){if(typeof document.body.style.opacity=="string"){return"opacity"}else{if(typeof document.body.style.MozOpacity=="string"){return"MozOpacity"}else{if(typeof document.body.style.KhtmlOpacity=="string"){return"KhtmlOpacity"}else{if(document.body.filters&&navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5){return"filter"}}}}return false}function trim(a){return a.replace(/(^\s+)|(\s+$)/g,"")}function block(f,c){var e=document.forms[0].elements;if(c=="all"){var a=document.getElementsByTagName("label");for(var b=0;b<e.length;b++){e[b].disabled=(!f&&e[b].name=="button"&&!(e[b-1].value.length>0))?true:f}for(var d in a){if(a[d].tagName=="LABEL"){if(opacityProp=="filter"){a[d].disabled=f}else{a[d].style.opacity=f?0.4:1}}}}else{if(c.value.length>0){e[e.length-1].disabled=false}else{e[e.length-1].disabled=true}}}function comment(a){document.getElementById("comment").innerHTML=a;autoclose=setTimeout("ask ()",10000)}on=new Array();var show;function showAnswer(a){answer=document.getElementById("a_"+a);if(on[a]==undefined||on[a]==0){answer.style.display="block";on[a]=1}else{answer.style.display="none";on[a]=0}}function showAllAnswers(){var a=document.getElementById("show").firstChild;if(show==undefined||show=="none"){show="block";var c="Свернуть все";var b=1}else{show="none";var c="Развернуть все";var b=0}for(id in answers_id){document.getElementById("a_"+answers_id[id]).style.display=show;on[answers_id[id]]=b}a.nodeValue=c}function formula(){var f=document.getElementById("rub");var d=document.getElementById("kop");var b=document.getElementById("total");var c=/([^0-9 ]+)/i;var j=e(f);var h=e(d);var k;if(!(isNaN(j)||isNaN(h)||j==0&&h==0)){var a=j+h/100;var g=0;if(a<=20000){g=a*0.04;if(g<400){g=400}}else{if(a>20000&&a<=100000){g=800+((a-20000)*0.03)}else{if(a>100000&&a<=200000){g=3200+((a-100000)*0.02)}else{if(a>200000&&a<=1000000){g=5200+((a-200000)*0.01)}else{if(a>1000000){g=13200+((a-1000000)*0.005);if(g>60000){g=60000}}}}}}splitDuty=String(g.toFixed(2)).split(".");k="<span>"+splitDuty[0]+"</span>&nbsp;руб.";if(splitDuty[1]!="00"){k+="<span>"+splitDuty[1]+"</span> коп. "}}else{k="<span>0</span> руб."}b.innerHTML=k;function e(l){return Number(String(l.value=String(l.value).replace(c,"")).replace(/\s+/ig,""))}};
