var gcs=[4,5,6];var mcns=[0,1,1,2,3];var muo=[3,2,1,0,1];var crbm=["0-1","0-14","10-21","23-55","23-55"];var timi1d=[1.2,1.2,1,1.7,2.5,5.6,6.5,6.5];var timi1i=[2.3,2.3,2.1,3.7,5,8.5,15.8,15.8];var timi1r=[1.2,1.2,6,9.5,12.2,14.3,20.9,20.9];var timi0d=[0.8,1.6,2.2,4.4,7.3,12.4,16.1,23.4,26.8,35.9,35.9,35.9,35.9,35.9,35.9];var kalY,kalA;var kalF=5;var kalD,kalS,kalN;var kalManad=["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aug","Sep","Okt","Nov","Dec"];var kalDag=["sö","må","ti","on","to","fr","lö"];var euroB0=-4.789594;var hicb;var hici;var ctz;var labAnalysis="";var ogonD=["Keratit","Konjunktivit","Irit","Glaskroppsavlossning","Näthinneavlossning","Maculadegeneration","Glaucom"];var ogonF=["Rodnad","Skav","Skygg","Sveda","Pus","Vark","Flack","Blixt","Skugga","Krok","Ring"];var ogonP=[[1,1,1,0,0,0,0,0,0,0,0],[1,0,0,1,1,0,0,0,0,0,0],[1,0,1,0,0,1,1,0,0,0,0],[0,0,0,0,0,0,1,1,0,0,0],[0,0,0,0,0,0,1,1,1,0,0],[0,0,0,0,0,0,0,0,0,1,0],[1,0,0,0,0,1,0,0,0,0,1]];var kardD=[4,5,6,7,9,9,10,12,14,17,12,14,16,19,22,22,26,30,35,40,3,4,4,5,6,6,7,8,10,12,8,9,11,13,16,16,19,22,26,30,2,2,3,3,4,4,5,6,7,8,6,7,8,10,11,11,13,16,19,22,1,2,2,2,3,3,3,4,5,6,4,5,6,7,8,8,9,11,13,16,2,3,3,4,5,5,6,7,8,10,7,8,10,11,13,14,16,19,22,26,2,2,2,3,3,3,4,5,6,7,5,6,7,8,9,10,11,13,16,18,1,1,2,2,2,2,3,3,4,5,3,4,5,6,7,7,8,9,11,13,1,1,1,1,2,2,2,2,3,3,2,3,3,4,5,5,6,7,8,9,1,2,2,2,3,3,3,4,5,5,4,5,6,7,8,8,10,11,13,16,1,1,1,2,2,2,2,3,3,4,3,3,4,5,6,6,7,8,9,11,1,1,1,1,1,1,2,2,2,3,2,2,3,3,4,4,5,6,7,8,0,1,1,1,1,1,1,1,2,2,1,2,2,2,3,3,3,4,5,5,1,1,1,1,1,1,2,2,2,3,2,3,3,4,5,5,5,7,8,9,0,1,1,1,1,1,1,1,2,2,2,2,2,3,3,3,4,5,5,6,0,0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,3,3,4,4,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,3,3,0,0,0,0,1,1,1,1,1,1,1,1,1,1,2,2,2,2,3,3,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,2,2,2,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1];var euroLC={a:0.0666354,s:0.3304052,c:0.4931341,e:0.6558917,n:0.841626,t:1.002625,k:0.6521653,i:1.101265,p:0.9058132,g:0.5677075,f:[0.4191643,1.094443],h:0.7676924,x:0.5460218,u:0.7127953,z:0.5420364,v:1.159787,y:1.462009};var phCurb65A="Hembehandling lämplig";var phCurb65B="Sjukhusvård eller öppenvård med uppföljning";var phCurb65C="Sjukhusvård som regel";var phCurb65D="Sjukhusvård, överväg IVA";var phABCD2A="2-dagars strokerisk 1%";var phABCD2B="2-dagars strokerisk 4%";var phABCD2C="2-dagars strokerisk 8%";var phOttawaA="R&ouml;ntgen av fotleden ej nödvändig";var phOttawaB="R&ouml;ntgen av fotleden rekommenderas";var phOttawaC="R&ouml;ntgen av mellanfoten ej nödvändig";var phOttawaD="R&ouml;ntgen av mellanfoten rekommenderas";var phKard="Fyll i för att beräkna";var phChild="Fyll i för att räkna ut Child-Pugh-klass";var phMELD="Fyll i för att räkna ut MELD-poäng";var phTIMI="Fyll i för att räkna ut TIMI-poäng";var phQTc="Fyll i för att beräkna";var phABCD2="Fyll i för att räkna ut poäng";var phEuro="Fyll i f&ouml;r att r&auml;kna ut EuroSCORE";var phOsm="Fyll i f&ouml;r att r&auml;kna ut osmolalitetsgap";var phGUCI="Fyll i f&ouml;r att r&auml;kna ut GUCI";var tabRow=-1;var tabRowsZ=0;var shTIMI=["iBSyst","iHR","iVikt","iRokAkt","iHyperKol","iCADSlakt","iAngina","iKillip1G","iSTEAnt","iLBBB","iTIMITid","iTIMIKand","iASA7dGE","iTIMIAtt","iTIMIFor","iHjenz","iTIMIKand"];var xt=[];xt.krea="kreaKeyUp";xt.met="metKeyup";xt.bmi="bmiKeyup";xt.crb65="crbChange";xt.ag="agKeyup";xt.pe="peChange";xt.mews="mewsUpdate";xt.ottawa="ottawaChange";xt.pro="proTypeChange";xt.apgar="apgarChange";xt.nihss="nssUpdate";xt.dvt="dvtChange";xt.gcs="gcsChange";xt.yta="ytaKeyUp";xt.child="childUpdate";xt.timi="timiChange";xt.euro="euroUpdate";xt.osm="osmUpdate";xt.calcium="calciumUpdate";xt.ogon="ogonChange";var CC={cname:"",ft:["Alder","Langd","Vikt","HR","RF","Temp","ASAT","Kreatinin","PKINR","Calcium","Natrium","Kalium","Klorid","Bikarb","Bilirubin","Albumin","BSyst","BDiast","TIALangd","Trc","Etanol","QTtid","Urea","OsmMatt","Glukos","KalI","Kolesterol","GUCIRef","LabValue1","LabValue2"],fc:["Diab","ABCD2Svag","Talsvar","KonfNy","Andn30GE","CRB65B","Alder65GE","PeDVT","HR100G","Hemoptys","DVTPEImmob","TidLEDVT","PeMalign","PeLE","OttawaStodjaA","OttawaStodjaB","OttawaOmhetA","OttawaOmhetB","OttawaOmhetC","NIHSSManad","NIHSSAlder","NIHSSOgon","NIHSSHand","DVTCancer","DVTBenpares","DVTOmhet","DVTSvull","DVTOmfang","DVTPitting","DVTKoll","DVTTidigare","DVTAnnat","PBC","MELDDialys","Hyper","Angina","Killip1G","LBBB","STEAnt","TIMITid","TIMIKand","TIMIRisk","ASA7dGE","TIMIAtt","TIMIFor","Hjenz","QtcType","KronLsjd","EuroArt","EuroNeur","EkitAktiv","AnginaInstab","HTPulm","EuroHI","EuroJour","EuroKir","EuroThor","SeprupHI","TidHjKir","EuroKrit","OgonRodnad","OgonSkav","OgonSkygg","OgonSveda","OgonPus","OgonVark","OgonFlack","OgonBlixt","OgonSkygga","OgonKrok","OgonRing","KonMan","RokAkt"],fr:[["calc_mews",["c","u"]],["calc_ottawa",["t"]],["calc_apgar",["p","a","f","t","r"]],["calc_nihss",["r","e","s","f","a","c","b","i","x","k","l","d","n"]],["calc_gcs",["e","v","m"]],["calc_child",["s","e"]],["calc_euro",["s","f"]]],fs:["Provtyp","KalP","KalR","LabProv"],vt:[],vc:[],vr:[],vs:[]};function rc(D,C){if(typeof C=="undefined"){C=1}C=Math.pow(10,C);var B=D*C;var A=Math.round(B);return A/C}function fl(A){return parseFloat(A.value.replace(",","."))}function calcRows(B){if(typeof B!="object"||typeof B.length!="number"){return[]}var A=[];var C;for(var D=0;D<B.length;D++){if(!(C=document.getElementById(B[D]))){return[]}while(C.tagName.toLowerCase()!="tr"){C=C.parentNode}A[B[D]]=C}return A}function calcStart(){if(typeof cp=="string"){CC.cname=cp}calcTabStart();calcPrepare();calcConnect();calcFocus(cp)}function calcPrepare(){var A;if(A=document.getElementById("divICV")){A.parentNode.removeChild(A)}if(A=document.getElementsByTagName("tr")){for(var B=0;B<A.length;B++){if(A[B].className=="trResult"){A[B].style.display="none"}}}if(A=document.getElementById("aRef")){A.removeAttribute("href");Event.addListener(A,"click",refClick)}}function calcFocus(A){if(A=="calc_krea"){if(o=document.getElementById("iLangd")){o.parentNode.parentNode.style.display="none"}if(!(o=document.getElementById("iAlder"))){return }}else{if(A=="calc_yta"){if(!(o=document.getElementById("iLangd"))){return }}else{if(A=="calc_bmi"){if(!(o=document.getElementById("iLangd"))){return }}else{if(A=="calc_met"){if(!(o=document.getElementById("iLangd"))){return }}else{if(A=="calc_ag"||A=="calc_osm"){if(!(o=document.getElementById("iNatrium"))){return }}else{if(A=="calc_mews"){if(!(o=document.getElementById("iRF"))){return }}else{if(A=="calc_abcd2"){if(!(o=document.getElementById("iAlder"))){return }}else{if(A=="calc_calcium"){if(!(o=document.getElementById("iCalcium"))){return }}else{if(A=="calc_child"){if(!(o=document.getElementById("iBilirubin"))){return }}else{if(A=="calc_meld"){if(!(o=document.getElementById("iKreatinin"))){return }}else{if(A=="calc_ottawa"){ottawaType(0);return }else{if(A=="calc_timi"){timiType(0);if(!(o=document.getElementById("iAlder"))){return }return }else{if(A=="calc_pro"){if(!(o=document.getElementById("iEtanol"))){return }}else{if(A=="calc_qtc"){if(!(o=document.getElementById("iQTtid"))){return }}else{if(A=="calc_euro"){if(!(o=document.getElementById("iAlder"))){return }}else{if(A=="calc_kal"){kalPrepare();if(!(o=document.getElementById("iKalI"))){return }}else{if(A=="calc_ogon"){return }else{if(A=="calc_kard"){if(!(o=document.getElementById("iAlder"))){return }}else{if(A=="calc_guci"){if(!(o=document.getElementById("iASAT"))){return }}else{if(A=="calc_lab"){labStart();return }else{return }}}}}}}}}}}}}}}}}}}}o.focus()}function calcTabRow(A,B){var C=document.createElement("div");C.className="calc-tab-row";C.style.left=A+px;C.style.zIndex=5+B;C.id="divCR_"+B;document.body.appendChild(C);return C}function calcTabStart(){if(BrowserDetect.browser=="Konqueror"){return }var R,O;if(!(R=document.getElementById("divCalcTabs"))){return }var I=document.createElement("div");I.id="divCalcTabContainer";R.parentNode.replaceChild(I,R);var G=document.getElementById("divCalcSp");O=Y.util.Dom.getRegion(G);var U=O.bottom;var K=O.left;var Q=[];var N=[];var Z;for(var b=0;b<R.childNodes.length;b++){if(R.childNodes[b].nodeType==3){continue}Q.push(R.childNodes[b].innerHTML)}ctz=Q.length-1;var a=0;var X,W;O=Y.util.Dom.getRegion(I);X=O.left;W=O.top;var j,i,E;N.push(calcTabRow(K,N.length));var P;var J,F;var S=0;while(Z=Q.shift()){J=document.createElement("span");J.className="calc-tab";J.innerHTML=Z;J.id="sCT_"+S;Event.addListener(J,"click",calcTabClick);if(N[N.length-1].childNodes.length>0){F=document.createElement("span");F.className="calc-tab-space";F.innerHTML="&nbsp;";N[N.length-1].appendChild(F)}O=Y.util.Dom.getRegion(N[N.length-1]);N[N.length-1].appendChild(J);var M=O.right-O.left;if(M>690){var f=N[N.length-1].lastChild;N[N.length-1].removeChild(N[N.length-1].lastChild);N[N.length-1].removeChild(N[N.length-1].lastChild);O=Y.util.Dom.getRegion(N[N.length-1]);j=O.left;i=O.top;E=O.bottom-O.top;N.push(calcTabRow(K,N.length));N[N.length-1].style.top=i+E+px;if(isie6){j-=1}j=K;N[N.length-1].style.left=j+px;N[N.length-1].appendChild(f)}S++}tabRowsZ=N.length;O=Y.util.Dom.getRegion(N[N.length-1]);var V=O.bottom-O.top;var L=[];O=Y.util.Dom.getRegion(N[N.length-1].firstChild);V=2;var C=[];for(b=N.length-1;b>-1;b--){for(g=0;g<N[b].childNodes.length;g++){N[b].childNodes[g].style.paddingBottom=V+px}O=Y.util.Dom.getRegion(N[b].firstChild);C[b]=O.top;N[b].style.height=V+30+px;V=(O.bottom-O.top-((isie6)?-1:2))}var B=C[0];for(b=0;b<C.length;b++){N[b].style.top=U+C[b]-B+px}if(typeof cg=="number"){calcTabSet(cg)}O=Y.util.Dom.getRegion(N[N.length-1]);R=document.getElementById("divCalc");R.style.paddingTop=O.bottom-U+15+px}function hicq(A){if(A==""){calcTabClick(ctz,false)}else{calcTabClick(parseInt(A))}}function calcTabClick(A,B){var D;if(typeof B!="boolean"){B=true}if(typeof A=="number"){D=A}else{A=EventUtil.getEvent();var C=A.target;D=parseInt(A.target.id.split("_")[1])}if(D==cg){return }calcTabSet(D);calcGet(D,B)}function calcGet(B,A){(new CR("cc",{id:B,g:A},"cc.php")).send()}function calcReply(A){var C=JSON.parse(decodeURIComponent(A));var B;if(!(B=document.getElementById("divCalc"))){return }B.innerHTML=C.xhtml;cg=C.cid;CC.cname=C.cname;if(hi&&C.g){Y.util.History.navigate("t",""+C.cid)}calcPrepare();calcConnect();calcFocus(C.cname);prePop()}function calcConnect(){var o,c,d,e;for(c=0;c<CC.ft.length;c++){if(!(o=document.getElementById("i"+CC.ft[c]))){continue}Event.addListener(o,"keyup",calcCTSet);if(typeof CC.vt[o.id.substr(1)]!="undefined"){o.value=CC.vt[o.id.substr(1)]}}for(c=0;c<CC.fc.length;c++){if(!(o=document.getElementById("i"+CC.fc[c]))){continue}Event.addListener(o,"click",calcCCSet);if(typeof CC.vc[o.id.substr(1)]!="undefined"){o.checked=CC.vc[o.id.substr(1)]}}for(c=0;c<CC.fr.length;c++){if(CC.fr[c][0]==CC.cname){for(d=0;d<CC.fr[c][1].length;d++){o=document.getElementsByName(CC.fr[c][1][d]);for(e=0;e<o.length;e++){Event.addListener(o[e],"click",calcCRSet)}if(typeof CC.vr[CC.cname]=="object"){if(typeof CC.vr[CC.cname][CC.fr[c][1][d]]=="string"){o=document.getElementById(CC.vr[CC.cname][CC.fr[c][1][d]])}}if(typeof o.id=="undefined"){continue}o.checked=true}break}}for(c=0;c<CC.fs.length;c++){if(!(o=document.getElementById("sel"+CC.fs[c]))){continue}Event.addListener(o,"change",calcCSSet);if(typeof CC.vs[CC.fs[c]]=="number"){o.selectedIndex=CC.vs[CC.fs[c]]}}var s=CC.cname.replace(/^calc\_/,"");if(typeof xt[s]=="string"){eval(xt[s]+"();")}}function calcCTSet(A){A=EventUtil.getEvent();CC.vt[A.target.id.substr(1)]=A.target.value}function calcCCSet(A){A=EventUtil.getEvent();CC.vc[A.target.id.substr(1)]=A.target.checked}function calcCRSet(A){A=EventUtil.getEvent();if(typeof CC.vr[CC.cname]=="undefined"){CC.vr[CC.cname]=[]}CC.vr[CC.cname][A.target.name]=A.target.id}function calcCSSet(A){A=EventUtil.getEvent();CC.vs[A.target.id.substr(3)]=A.target.selectedIndex}function calcFlipRows(E){var C;if(!(C=document.getElementById("sCT_"+E))){return }var H,G,F,D,M,L,B,A,K,J;o1=C.parentNode;o2=document.getElementById("divCR_"+(tabRowsZ-1));H=o1.id;G=o2.id;F=Y.util.Dom.getRegion(o1.firstChild);D=Y.util.Dom.getRegion(o2.firstChild);h1=parseInt(getStyle(o1.firstChild,"paddingBottom"));h2=parseInt(getStyle(o2.firstChild,"paddingBottom"));K=o1.style.zIndex;J=o2.style.zIndex;B=o1.innerHTML;A=o2.innerHTML;var I=(isie6)?-2:1;o1.style.top=D.top+I+px;o2.style.top=F.top+I+px;o1.id="_X";o2.id=H;o1.id=G;for(c=0;c<o1.childNodes.length;c++){o1.childNodes[c].style.paddingBottom=2+px}for(c=0;c<o2.childNodes.length;c++){o2.childNodes[c].style.paddingBottom=h1+px}o1.style.zIndex=J;o2.style.zIndex=K;F=Y.util.Dom.getRegion(o1.firstChild);D=Y.util.Dom.getRegion(o2.firstChild);o1.style.height=F.bottom-F.top+px;o2.style.height=D.bottom-D.top+px}function calcTabSet(F){var D,E,C,B,A;if(!(D=document.getElementById("sCT_"+F))){return }B=parseInt(D.parentNode.id.split("_")[1]);if((B+1)<tabRowsZ){calcFlipRows(F)}C=document.getElementsByTagName("span");for(E=0;E<C.length;E++){if(C[E].id.match(/^sCT/)){C[E].className="calc-tab"}}D.className="calc-tab-selected"}function numberKeyPress(A,B){A=EventUtil.getEvent();B=(typeof B=="boolean"&&B==true);var C=keypressCode(A);if(B&&(C==44||C==46)){if(!A.target.value.match(/[\.\,]/)){return }}if((C>47&&C<58)||C<32||(C>33&&C<47)){return }A.preventDefault()}function numberKeyDown(A,B){A=EventUtil.getEvent();B=(typeof B=="boolean"&&B==true);var C=A.keyCode;if(B&&(C==44||C==46||C==188||C==190)){if(!A.target.value.match(/[\.\,]/)){return }}if((C>47&&C<58)||C<32||(C>32&&C<47)||(C>95&&C<106)){return }A.preventDefault()}function calcKeyUp(oEvent){eval(cp+"KeyUp(oEvent);")}function kreaKeyUp(C){C=EventUtil.getEvent();var E;if(!(E=document.getElementById("iAlder"))){return }document.getElementById("trCL").style.display=parseInt(E.value)<20?"":"none";var F=clearance();var B=document.getElementById("sCM");var D=document.getElementById("sCF");var A=document.getElementById("sCC");if(F===false||F.length<2){B.parentNode.parentNode.style.display="none";D.parentNode.parentNode.style.display="none";A.parentNode.parentNode.style.display="none";return }if(F[1]===false){B.parentNode.parentNode.style.display="none";D.parentNode.parentNode.style.display="none";A.innerHTML=rc(F[0]);A.parentNode.parentNode.style.display="";return }A.parentNode.parentNode.style.display="none";B.innerHTML=rc(F[0]);D.innerHTML=rc(F[1]);B.parentNode.parentNode.style.display="";D.parentNode.parentNode.style.display=""}function ytaKeyUp(B){B=EventUtil.getEvent();var C=yta();var A=document.getElementById("sCY");if(C===false){A.parentNode.parentNode.style.display="none";return }A.innerHTML=rc(C,3);A.parentNode.parentNode.style.display=""}function bmiKeyup(B){B=EventUtil.getEvent();var C=bmi();var A=document.getElementById("sCY");if(C===false){A.parentNode.parentNode.style.display="none";return }A.innerHTML=rc(C,1);A.parentNode.parentNode.style.display=""}function calcium(C,A){var B;return C+0.02*(40-A)}function calciumUpdate(C){C=EventUtil.getEvent();var E;if(!(E=document.getElementById("iCalcium"))){return }var F=fl(E);if(isNaN(F)){return }if(!(E=document.getElementById("iAlbumin"))){return }var B=fl(E);if(isNaN(B)){return }var D=calcium(F,B);var A=document.getElementById("sCY");if(F===false){A.parentNode.parentNode.style.display="none";return }A.innerHTML=rc(D,1);A.parentNode.parentNode.style.display=""}function yta(){var C;if(!(C=document.getElementById("iLangd"))){return false}var B=parseInt(C.value);if(isNaN(B)){return false}if(!(C=document.getElementById("iVikt"))){return false}var A=parseInt(C.value);if(isNaN(A)){return false}return(Math.pow(A,0.425)*Math.pow(B,0.725)*0.007184)}function clearance(){var F;if(!(F=document.getElementById("iKreatinin"))){return false}var C=parseInt(F.value);if(isNaN(C)){return false}if(!(F=document.getElementById("iVikt"))){return false}var B=parseInt(F.value);if(isNaN(B)){return false}if(!(F=document.getElementById("iLangd"))){return false}var D=parseInt(F.value);if(!(F=document.getElementById("iAlder"))){return false}var A=parseInt(F.value);if(isNaN(A)){return false}if(A<20){if(isNaN(D)){return false}var E=(((42.5*D)/C)*Math.pow(B/70,0.7));return Array(E,false)}return Array(1.23*((140-A)*B)/C,1.04*((140-A)*B)/C)}function bmi(){var C;if(!(C=document.getElementById("iLangd"))){return false}var B=parseInt(C.value);if(B<1){return false}if(isNaN(B)){return false}if(!(C=document.getElementById("iVikt"))){return false}var A=parseInt(C.value);if(isNaN(A)){return false}return(A/Math.pow(B/100,2))}function met(){var D;if(!(D=document.getElementById("iLangd"))){return Array(false,false)}var C=parseInt(D.value);if(C<1){return Array(false,false)}if(isNaN(C)){return Array(false,false)}if(!(D=document.getElementById("iVikt"))){return Array(false,false)}var B=parseInt(D.value);if(isNaN(B)){return Array(false,false)}if(!(D=document.getElementById("iAlder"))){return Array(false,false)}var A=parseInt(D.value);if(isNaN(A)){return Array(false,false)}return Array(66.473+B*13.7516+C*5.0033-A*6.755,655.0955+B*9.5634+C*1.8496-A*4.6756)}function dvtChange(D){var A=0;var F=["Cancer","Benpares","PEImmob","Omhet","Svull","Omfang","Pitting","Koll","Tidigare","Annat"];for(var E=0;E<F.length;E++){if(!(o=document.getElementById("iDVT"+F[E]))){continue}if(o.checked){A+=parseInt(o.value.split("_")[1])}}var C;if(!(C=document.getElementById("tdS"))){return }var B;if(A>1){B="H&ouml;g sannolikhet ("+A+" po&auml;ng)"}else{B="L&aring;g sannolikhet ("+A+" po&auml;ng)"}C.innerHTML=B}function peChange(D){var E;var A=0;if((E=document.getElementById("iPeDVT"))&&E.checked){A+=parseInt(E.value.split("_")[1])}if((E=document.getElementById("iHR100G"))&&E.checked){A+=parseInt(E.value.split("_")[1])}if((E=document.getElementById("iHemoptys"))&&E.checked){A+=parseInt(E.value.split("_")[1])}if((E=document.getElementById("iDVTPEImmob"))&&E.checked){A+=parseInt(E.value.split("_")[1])}if((E=document.getElementById("iTidLEDVT"))&&E.checked){A+=parseInt(E.value.split("_")[1])}if((E=document.getElementById("iPeMalign"))&&E.checked){A+=parseInt(E.value.split("_")[1])}if((E=document.getElementById("iPeLE"))&&E.checked){A+=parseInt(E.value.split("_")[1])}var C;if(!(C=document.getElementById("tdS"))){return }var B;if(A>5){B="H&ouml;g sannolikhet"}else{B="L&aring;g sannolikhet"}B+=" ("+(rc(A/2,1))+" po&auml;ng)";C.innerHTML=B}function ogonChange(G){var B,I,H;var A=[0,0,0,0,0,0,0];var F;if(!(F=document.getElementById("tdS"))){return }for(I=0;I<ogonF.length;I++){if(!(B=document.getElementById("iOgon"+ogonF[I]))){return }if(B.checked){for(H=0;H<A.length;H++){if(ogonP[H][I]==1){A[H]+=1}}}}var E=[];var C=A.max();for(I=C;I>-1;I--){var D=[];for(H=0;H<A.length;H++){if(A[H]==I){D.push(ogonD[H])}}if(D.length>0){E.push(D.join(", "))}}for(I=0;I<E.length;I++){E[I]=(I+1)+". "+E[I]}F.innerHTML=(E.length>1)?"<h3>Diagnoser efter sannolikhet</h3>"+E.join("<br />"):""}function gcsChange(B,D){gcs[B-1]=D;var A=gcs[0]+gcs[1]+gcs[2];var C;if(!(C=document.getElementById("sS"))){return }C.innerHTML=A}function metKeyup(F){oEvent=EventUtil.getEvent();var A=met();var B=document.getElementById("sCM");var E=document.getElementById("sCF");if(A[0]===false){B.parentNode.parentNode.style.display="none";E.parentNode.parentNode.style.display="none";return }var D=rc(A[0],0);var C=rc(A[1],0);B.innerHTML=D;E.innerHTML=C;B.parentNode.parentNode.style.display="";E.parentNode.parentNode.style.display=""}function agKeyup(G){oEvent=EventUtil.getEvent();var K,B,E,F;if(!(K=document.getElementById("iNatrium"))){return }if(!(B=document.getElementById("iKalium"))){return }if(!(E=document.getElementById("iKlorid"))){return }if(!(F=document.getElementById("iBikarb"))){return }var C,D,H,I;C=fl(K);D=fl(B);H=fl(E);I=fl(F);var J;if(!(J=document.getElementById("sCR"))){return }if(isNaN(C)||isNaN(D)||isNaN(H)||isNaN(I)){J.parentNode.parentNode.style.display="none";return }var A=rc(ag(C,D,H,I),2);J.innerHTML=A;J.parentNode.parentNode.style.display=""}function ag(D,B,C,A){return D+B-C-A}function guciUpdate(J){J=EventUtil.getEvent();var E,C,I,F;if(!(E=document.getElementById("iASAT"))){return }if(!(C=document.getElementById("iGUCIRef"))){return }if(!(I=document.getElementById("iPKINR"))){return }if(!(F=document.getElementById("iTrc"))){return }var G,D,B,K;G=fl(E);D=fl(C);B=fl(I);K=fl(F);var H;if(!(H=document.getElementById("tdS"))){return }var A=guci(G,D,B,K);H.innerHTML=A;H.parentNode.parentNode.style.display=""}function guci(A,C,D,B){if(isNaN(A)||isNaN(C)||isNaN(D)||isNaN(B)){return phGUCI}if(A<=0||C<=0||D<=0||B<=0){return phGUCI}return"GUCI: "+rc(A/C*D*100/B,3)}function proTypeChange(B){var D,A;if(!(A=document.getElementById("tdTyp"))){return }if(!(D=document.getElementById("selProvtyp"))){return }var C=["S-etanol","P-etanol","B-etanol"];A.innerHTML=C[D.options.selectedIndex];proChange()}function proChange(H){var C,G,F;if(!(C=document.getElementById("iEtanol"))){return }if(!(oR1=document.getElementById("sCR1"))){return }if(!(oR2=document.getElementById("sCR2"))){return }if(!(F=document.getElementById("selProvtyp"))){return }var I=F.selectedIndex;var E=fl(C);if(isNaN(E)){oR1.parentNode.parentNode.style.display="none";var B;if(!(B=document.getElementById("trL"))){return }var D;if(!(D=document.getElementById("trI"))){return }B.style.display="none";D.style.display="none";return }oR1.innerHTML=rc(pro(E,I,1.16),3);oR2.innerHTML=rc(pro(E,I),3);var A;if(!(A=oR1.parentNode.parentNode)){return }A.style.display="";var B;if(!(B=document.getElementById("trL"))){return }var D;if(!(D=document.getElementById("trI"))){return }B.style.display="";D.style.display=""}function pro(D,C,B){if(typeof B=="undefined"){B=1.2}if(C==0||C==1){var A=D/B}else{if(C==2){var A=D}}return A*0.0436019}function crbChange(H){var C,A,I,J;var B,K,E,G;if(!(B=document.getElementById("iKonfNy"))){return }C=(B.checked)?1:0;if(!(K=document.getElementById("iAndn30GE"))){return }A=(K.checked)?1:0;if(!(E=document.getElementById("iCRB65B"))){return }I=(E.checked)?1:0;if(!(G=document.getElementById("iAlder65GE"))){return }J=(G.checked)?1:0;var D=C+A+I+J;var F;if(!(F=document.getElementById("tdS"))){return }var L;if(D==0){L=phCurb65A}else{if(D==1){L=phCurb65B}else{if(D==2){L=phCurb65C}else{L=phCurb65D}}}L+="<br />Mortalitet "+crbm[D]+"%";F.innerHTML=D+" po&auml;ng<br />"+L}function mewsKeyUp(){mewsUpdate()}function mewsUpdate(){oEvent=EventUtil.getEvent();var A,C,B,R,J,O;var H,L,I,F,N,K;var D,M,G,Q;var P=0,E=0;if(!(A=document.getElementById("iRF"))){return }if(!(C=document.getElementById("iHR"))){return }if(!(B=document.getElementById("iBSyst"))){return }if(!(R=document.getElementById("iTemp"))){return }if(A.value.length&&C.value.length&&B.value.length&&R.value.length){D=fl(A);M=fl(C);G=fl(B);Q=fl(R);J=document.getElementsByName("c");for(N=0;N<J.length;N++){if(J[N].checked){P=mcns[N];break}}J=document.getElementsByName("u");for(N=0;N<J.length;N++){if(J[N].checked){E=muo[N];break}}if(D<9){H=2}else{if(D<15){H=0}else{if(D<21){H=1}else{if(D<30){H=2}else{H=3}}}}if(M<41){L=2}else{if(M<51){L=1}else{if(M<101){L=0}else{if(M<111){L=1}else{if(M<130){L=2}else{L=3}}}}}if(G<71){I=3}else{if(G<81){I=2}else{if(G<101){I=1}else{if(G<200){I=0}else{I=2}}}}if(Q<35.1){F=2}else{if(Q<36.1){F=1}else{if(Q<38.1){F=0}else{if(Q>38.5){F=2}else{F=1}}}}K=H+L+I+F+P+E}else{K="Fyll i för att räkna ut"}if(!(O=document.getElementById("tdS"))){return }O.innerHTML=K+" MEWS-poäng"}function nssUpdate(){var B,J,F,D,H,C;var E,M,I,G,L,K,A=0;o=["r","e","s","f","a","c","b","i","x","k","l","d","n"];if(!(B=document.getElementById("iNIHSSManad"))){return }if(!(J=document.getElementById("iNIHSSAlder"))){return }if(!(F=document.getElementById("iNIHSSOgon"))){return }if(!(D=document.getElementById("iNIHSSHand"))){return }if(!B.checked&&!J.checked){A+=2}else{if(B.checked^J.checked){A+=1}}if(!F.checked&&!D.checked){A+=2}else{if(F.checked^D.checked){A+=1}}for(L=0;L<o.length;L++){C=document.getElementsByName(o[L]);for(K=0;K<C.length;K++){if(C[K].checked){A+=parseInt(C[K].value);break}}}if(!(oTd=document.getElementById("tdS"))){return }oTd.innerHTML=A+" poäng (max 42)"}function abcd2Change(L){var K=document.getElementsByTagName("input");var E,B,F,R,Q,A,D,N;var P,O,C,H,G,I,M,J;if(!(E=document.getElementById("iAlder"))){return }P=parseInt(E.value);if(isNaN(P)||P<=0){resReset(phABCD2);return }if(!(B=document.getElementById("iBSyst"))){return }O=parseInt(B.value);if(isNaN(O)||O<=0){resReset(phABCD2);return }if(!(F=document.getElementById("iBDiast"))){return }C=parseInt(F.value);if(isNaN(C)||C<=0){resReset(phABCD2);return }if(!(R=document.getElementById("iTIALangd"))){return }H=parseInt(R.value);if(isNaN(H)||H<=0){resReset(phABCD2);return }if(!(Q=document.getElementById("iABCD2Svag"))){return }G=Q.checked;if(!(D=document.getElementById("iDiab"))){return }M=D.checked;if(!(A=document.getElementById("iTalsvar"))){return }I=A.checked;J=0;if(P>=60){J++}if(O>=140||C>=90){J++}if(H>=60){J+=2}else{if(H>=10){J++}}if(G){J+=2}else{if(I){J++}}if(M){J++}if(J<4){ph=phABCD2A}else{if(J<6){ph=phABCD2B}else{ph=phABCD2C}}if(!(N=document.getElementById("tdS"))){return }N.innerHTML=J+" poäng<br />"+ph}function apgarChange(C){var D=document.getElementsByTagName("input");var A=0;var B;for(var E=0;E<D.length;E++){if(D[E].type=="radio"&&D[E].checked){A+=parseInt(D[E].value)}}if(!(B=document.getElementById("tdS"))){return }B.innerHTML=""+(10-A)+" poäng<br />"}function ottawaChange(F){var H,I,K,G,A,I,N,L,B,J,D,M,C,E;if(!(H=document.getElementById("iOttawaTyp1"))){return }L=(H.checked);if(!(K=document.getElementById("iOttawaStodjaA"))){return }B=(K.checked);if(!(G=document.getElementById("iOttawaStodjaB"))){return }J=(G.checked);if(L){if(!(A=document.getElementById("iOttawaOmhetA"))){return }D=(A.checked);if((B&&J)||D){E=phOttawaB}else{E=phOttawaA}}else{if(!(I=document.getElementById("iOttawaOmhetB"))){return }M=(I.checked);if(!(N=document.getElementById("iOttawaOmhetC"))){return }C=(N.checked);if((B&&J)||M||C){E=phOttawaD}else{E=phOttawaC}}if(!(I=document.getElementById("tdS"))){return }I.innerHTML=E}function ottawaType(F){var C,E,B,A,D,F;if(!(C=document.getElementById("trM"))){return }if(!(E=document.getElementById("trS"))){return }if(!(B=document.getElementById("trN"))){return }if(F==0){C.style.display="";E.style.display="none";B.style.display="none"}else{if(F==1){C.style.display="none";E.style.display="";B.style.display=""}}ottawaChange()}function childUpdate(K){var C,J,H,I,B,L,E,G,F,A,D;if(!(J=document.getElementById("tdS"))){return }if(!(C=document.getElementById("iBilirubin"))){return }H=fl(C);if(isNaN(H)){childReset();return }if(!(C=document.getElementById("iAlbumin"))){return }I=fl(C);if(isNaN(I)){childReset();return }if(!(C=document.getElementById("iPKINR"))){return }B=fl(C);if(isNaN(B)){childReset();return }C=document.getElementsByName("s");for(F=0;F<C.length;F++){if(C[F].checked){L=parseInt(C[F].value);break}}if(typeof L=="undefined"){return }C=document.getElementsByName("e");for(F=0;F<C.length;F++){if(C[F].checked){E=parseInt(C[F].value);break}}if(typeof E=="undefined"){return }if(!(C=document.getElementById("iPBC"))){return }G=C.checked;A=E+L;if(I<28){A+=3}else{if(I<=35){A+=2}else{A++}}if(B<1.7){A++}else{if(B<=2.3){A+=2}else{A+=3}}if(G){if(H<68){A++}else{if(H<=171){A+=2}else{A+=3}}}else{if(H<35){A++}else{if(H<=51){A+=2}else{A+=3}}}if(A<7){D="A"}else{if(A<10){D="B"}else{D="C"}}J.innerHTML="Child-Pugh klass "+D+" ("+A+" poäng)"}function childReset(){var A;if(!(A=document.getElementById("tdS"))){return }A.innerHTML=phChild}function meldChange(I){var D,H,C,F,E,G,B,A;if(!(H=document.getElementById("tdS"))){return }if(!(C=document.getElementById("trKrea"))){return }if(!(D=document.getElementById("iMELDDialys"))){return }F=D.checked;C.style.display=(F)?"none":"";if(!F){if(!(D=document.getElementById("iKreatinin"))){return }E=parseInt(D.value);if(isNaN(E)){meldReset();return }if(E>353.6){E=353.6}else{if(E<88.4){E=88.4}}}else{E=353.6}if(!(D=document.getElementById("iBilirubin"))){return }G=fl(D);if(isNaN(G)){meldReset();return }if(G<17.1){G=17.1}if(!(D=document.getElementById("iPKINR"))){return }B=fl(D);if(isNaN(B)){meldReset();return }if(B<1){B=1}A=Math.round(9.57*Math.log(E*0.0113122171945701)+3.78*Math.log(G*0.0584795321637427)+11.2*Math.log(B)+6.43);if(A<1){A=1}else{if(A>40){A=40}}H.innerHTML=A+" MELD-poäng"}function meldReset(){var A;if(!(A=document.getElementById("tdS"))){return }A.innerHTML=phMELD}function timiChange(K){var L,A,p,H,V,E,X,T,M,Q,P,R,G,B,D,F,J,Z,U,O,W,C,b;var I,N;if(!(L=document.getElementById("iTIMITyp0"))){return }C=L.checked;if(!(A=document.getElementById("tdS"))){return }if(!(L=document.getElementById("iAlder"))){return }p=parseInt(L.value);if(isNaN(p)){resReset(phTIMI);return }if(!(L=document.getElementById("iBSyst"))){return }H=parseInt(L.value);if(C&&isNaN(H)){resReset(phTIMI);return }if(!(L=document.getElementById("iHR"))){return }V=parseInt(L.value);if(C&&isNaN(V)){resReset(phTIMI);return }if(!(L=document.getElementById("iVikt"))){return }E=parseInt(L.value);if(C&&isNaN(E)){resReset(phTIMI);return }if(!(L=document.getElementById("iDiab"))){return }X=L.checked;if(!(L=document.getElementById("iHyper"))){return }T=L.checked;if(!(L=document.getElementById("iAngina"))){return }M=L.checked;if(!(L=document.getElementById("iKillip1G"))){return }Q=L.checked;if(!(L=document.getElementById("iLBBB"))){return }P=L.checked;if(!(L=document.getElementById("iSTEAnt"))){return }R=L.checked;if(!(L=document.getElementById("iTIMITid"))){return }G=L.checked;if(!(L=document.getElementById("iHyperKol"))){return }B=L.checked;if(!(L=document.getElementById("iCADSlakt"))){return }D=L.checked;if(!(L=document.getElementById("iRokAkt"))){return }F=L.checked;if(!(L=document.getElementById("iTIMIKand"))){return }J=L.checked;if(!(L=document.getElementById("iASA7dGE"))){return }Z=L.checked;if(!(L=document.getElementById("iTIMIAtt"))){return }U=L.checked;if(!(L=document.getElementById("iTIMIFor"))){return }O=L.checked;if(!(L=document.getElementById("iHjenz"))){return }W=L.checked;if(C){I=((p>=75)?3:((p>=65)?2:0))+((X|T|M)?1:0)+((H<100)?3:0)+((V>100)?2:0)+(Q?2:0)+((E<67)?1:0)+((R|P)?1:0)+(G?1:0);b='<table class="prot-b"><tbody><tr><td class="l">TIMI-po&auml;ng</td><td>'+I+'</td></tr><td class="l">Mortalitet 30 dagar</td><td>'+timi0d[I]+"%</td></tr></tbody></table>"}else{var S=0;if(F){S++}if(T){S++}if(X){S++}if(D){S++}if(B){S++}I=((p>=65)?1:0)+((S>2)?1:0)+(J?1:0)+(Z?1:0)+(U?1:0)+(O?1:0)+(W?1:0);b='<table class="prot-b"><tbody><tr><td class="l">TIMI-po&auml;ng</td><td>'+I+'</td></tr><tr><th colspan="2">Inom 14 dagar</th></tr><tr><td class="l">Mortalitet</td><td>'+timi1d[I]+'%</td></tr><tr><td class="l">Hj&auml;rtinfarkt</td><td>'+timi1i[I]+'%</td></tr><tr><td>Akut revaskulering</td><td class="l">'+timi1r[I]+"%</td></tr></tbody></table>"}A.innerHTML=b}function timiType(G){var C,E,B,A,D,G;var F=calcRows(shTIMI);if(G==0){F.iTIMIKand.style.display="none";F.iASA7dGE.style.display="none";F.iTIMIAtt.style.display="none";F.iTIMIFor.style.display="none";F.iHjenz.style.display="none";F.iRokAkt.style.display="none";F.iHyperKol.style.display="none";F.iCADSlakt.style.display="none";F.iBSyst.style.display="";F.iHR.style.display="";F.iVikt.style.display="";F.iAngina.style.display="";F.iKillip1G.style.display="";F.iSTEAnt.style.display="";F.iLBBB.style.display="";F.iTIMITid.style.display=""}else{F.iTIMIKand.style.display="";F.iASA7dGE.style.display="";F.iTIMIAtt.style.display="";F.iTIMIFor.style.display="";F.iHjenz.style.display="";F.iRokAkt.style.display="";F.iHyperKol.style.display="";F.iCADSlakt.style.display="";F.iBSyst.style.display="none";F.iHR.style.display="none";F.iVikt.style.display="none";F.iAngina.style.display="none";F.iKillip1G.style.display="none";F.iSTEAnt.style.display="none";F.iLBBB.style.display="none";F.iTIMITid.style.display="none"}timiChange()}function resReset(B){var A;if(!(A=document.getElementById("tdS"))){return }A.innerHTML=B}function qtcChange(G){oEvent=EventUtil.getEvent();var H=met();var D,J,C,F,L;if(!(D=document.getElementById("iQTtid"))){}C=parseInt(D.value);if(isNaN(C)||C<=0){resReset(phQTc);return }if(!(D=document.getElementById("iHR"))){}F=parseInt(D.value);if(isNaN(F)||F<=0){resReset(phQTc);return }if(!(D=document.getElementById("iQtcType"))){return }L=(D.checked);if(!(J=document.getElementById("tdS"))){return }var A=60/F;var K=Math.round(C+(1-A)*154,0);var B=Math.round(C/Math.sqrt(A),0);var I=Math.round(C+1.75*(60/A-60),0);var E=Math.round(C/Math.pow(A,1/3),0);if(L){s='<table class="prot-b"><tbody><tr><td class="l">Bazett</td><td>'+B+' ms</td></tr><tr><td class="l">Fridericia</td><td>'+E+' ms</td></tr><tr><td class="l">Framingham</td><td>'+K+' ms</td></tr><tr><td class="l">Hodges</td><td>'+I+" ms</td></tr></tbody></table>"}else{s="QTc: "+B+" ms"}J.innerHTML=s}function euroUpdate(R){var K,I,A,U,M,H,Q,S,R,L,G,N,J,P,O,D,F,B,E,C,T;if(!(A=document.getElementById("tdS"))){return }if(!(K=document.getElementById("iAlder"))){return }var U=parseInt(K.value);if(isNaN(U)){resReset(phEuro);return }if(!(K=document.getElementById("iKreatinin"))){return }var M=parseInt(K.value);if(isNaN(M)){resReset(phEuro);return }K=document.getElementsByName("s");for(d=0;d<K.length;d++){if(K[d].checked){H=parseInt(K[d].value);break}}K=document.getElementsByName("f");for(d=0;d<K.length;d++){if(K[d].checked){Q=parseInt(K[d].value);break}}if(!(K=document.getElementById("iKronLsjd"))){return }S=K.checked;if(!(K=document.getElementById("iEuroArt"))){return }R=K.checked;if(!(K=document.getElementById("iEuroNeur"))){return }L=K.checked;if(!(K=document.getElementById("iTidHjKir"))){return }G=K.checked;if(!(K=document.getElementById("iEkitAktiv"))){return }N=K.checked;if(!(K=document.getElementById("iEuroKrit"))){return }J=K.checked;if(!(K=document.getElementById("iAnginaInstab"))){return }P=K.checked;if(!(K=document.getElementById("iHTPulm"))){return }O=K.checked;if(!(K=document.getElementById("iEuroHI"))){return }D=K.checked;if(!(K=document.getElementById("iEuroJour"))){return }F=K.checked;if(!(K=document.getElementById("iEuroKir"))){return }B=K.checked;if(!(K=document.getElementById("iEuroThor"))){return }E=K.checked;if(!(K=document.getElementById("iSeprupHI"))){return }C=K.checked;I=euro(U,M,H,Q,S,R,L,G,N,J,P,O,D,F,B,E,C);A.innerHTML="Mortalitet "+I+"%"}function euro(T,L,H,Q,S,R,K,G,M,J,P,O,D,F,B,E,C){var I=0;var N=0;var A;if(T<60){A=1}else{A=T-58}N+=euroLC.a*A;if(H==2){N+=euroLC.s}if(L>200){N+=euroLC.k}if(Q==2){N+=euroLC.f[0]}else{if(Q==3){N+=euroLC.f[1]}}if(S){N+=euroLC.c}if(R){N+=euroLC.e}if(K){N+=euroLC.n}if(G){N+=euroLC.t}if(M){N+=euroLC.i}if(J){N+=euroLC.p}if(P){N+=euroLC.g}if(O){N+=euroLC.h}if(D){N+=euroLC.x}if(F){N+=euroLC.u}if(B){N+=euroLC.z}if(E){N+=euroLC.v}if(C){N+=euroLC.y}I=Math.pow(Math.E,euroB0+N)/(1+Math.pow(Math.E,euroB0+N));return rc(100*I,2)}function osmUpdate(H){var A,G,K,J,B,D,L,F,I,C,E;if(!(J=document.getElementById("tdS"))){return }if(!(A=document.getElementById("iNatrium"))){return }B=parseInt(A.value);if(isNaN(B)){resReset(phOsm);return }if(!(A=document.getElementById("iUrea"))){return }L=fl(A);if(isNaN(L)){resReset(phOsm);return }if(!(A=document.getElementById("iGlukos"))){return }F=fl(A);if(isNaN(F)){resReset(phOsm);return }if(!(A=document.getElementById("iOsmMatt"))){return }C=parseInt(A.value);G=Math.round(B*1.86+L+F+9,1);if(isNaN(G)){resReset(phOsm);return }if(isNaN(C)){E="Beräknad osmolaritet:&nbsp;"+G+"&nbsp;mosmol/L<br />Fyll i osmolalitet för osmolalitetsgap"}else{K=C-G;E="Osmolalitetsgap:&nbsp;"+K+"&nbsp;mosmol/L"}J.innerHTML=E}function kalPrepare(){kalD=new Date();var C;if(!(C=document.getElementById("tKal"))){return }kalN=Math.floor(C.firstChild.childNodes.length/2);var B=Y.util.Dom.getRegion(C);if(!(C=document.getElementById("divKal"))){return }kalS=parseInt(C.firstChild.nodeValue);var A=document.createElement("div");A.id="divICV";A.style.top=B.top+px;A.style.left=B.left+px;A.style.width=B.right-B.left+px;A.style.height=B.bottom-B.top+px;Event.addListener(A,"mousedown",kalDragStart);Event.addListener(A,"mouseup",kalDragStop);Event.addListener(A,"mousemove",kalDragMove);document.body.appendChild(A)}function kalDragStart(A){A=EventUtil.getEvent();kalA=true;kalY=A.screenY;A.preventDefault()}function kalDragStop(A){kalA=false}function kalDragMove(A){if(!kalA){return }var C=A.screenY;var B=C;if((C%kalF)==0){kalMove(C)}}function kalTr(B,J){var L=document.createElement("tr");var H=document.createElement("td");var G=document.createElement("td");var F=document.createElement("td");var E=document.createElement("td");var C=document.createElement("td");var A=new Date();A.setTime(B*1000);var K=A.getWeek();L.className=(K%2==0)?"kalVJ":"kalVU";var I=A.getDate();if(I==1){H.innerHTML=kalManad[A.getMonth(1)]}G.innerHTML=I;F.innerHTML=kalDag[A.getDay()];if(typeof J!="undefined"){E.innerHTML='<span class="highlight">'+J+"</span>"}if(A.getDay()==1){C.innerHTML="v "+K}L.id="trKal_"+B;L.appendChild(H);L.appendChild(G);L.appendChild(F);L.appendChild(E);L.appendChild(C);return L}function kalMove(E){var D=document.getElementById("tKal").firstChild;var A;if(E<kalY){var C=parseInt(D.lastChild.id.split("_")[1])+86400;var B=kalTr(C);D.removeChild(D.firstChild);D.appendChild(B)}else{var C=parseInt(D.firstChild.id.split("_")[1])-86400;var B=kalTr(C);D.insertBefore(B,D.firstChild);D.removeChild(D.lastChild)}kalY=E}Date.prototype.getWeek=function(){var C=new Date();C.setFullYear(this.getFullYear(),this.getMonth(),this.getDate());var F=C.getDay();if(F==0){F=7}C.setDate(C.getDate()+(4-F));var A=C.getFullYear();var B=Math.floor((C.getTime()-new Date(A,0,1,-6))/86400000);var E=1+Math.floor(B/7);return E};function kalIUpdate(H){var C;if(!(C=document.getElementById("iKalI"))){return }var D=parseInt(C.value);if(isNaN(D)){D=0}if(!(C=document.getElementById("selKalR"))){return }var A=(C.value==0)?1:-1;if(!(C=document.getElementById("selKalP"))){return }var B=C.childNodes[C.selectedIndex].value;var G=document.getElementById("tKal").firstChild;while(G.childNodes.length){G.removeChild(G.lastChild)}for(var F=0;F<(kalN*2+1);F++){if(F==kalN){var E="";if(D==0){E="Idag"}else{if(A==1){E="Om "}E+=D;if(B==7){E+=" v"}else{E+=" d"}if(A==-1){E+=" sedan"}}var I=kalTr(kalS+86400*(A*(B*D)-kalN+F),E)}else{var I=kalTr(kalS+86400*(A*(B*D)-kalN+F))}G.appendChild(I)}}function refClick(A){var C;if(C=document.getElementById("divRef")){C.parentNode.removeChild(C);return }var B=CC.cname.split("_")[1];(new CR("rf",{p:B},"cr.php")).send()}function refReply(B){var C;if(!(C=document.getElementById("aRef"))){return }var D=document.createElement("div");D.innerHTML="<hr />"+JSON.parse(decodeURIComponent(B));D.id="divRef";var A;if(!(A=document.getElementById("divCalc"))){return }A.appendChild(D)}function kardChange(G){var C,B,D,E,A,H,F;if(!(F=document.getElementById("tdS"))){return }if(!(H=document.getElementById("iAlder"))){return }C=parseInt(H.value);if(isNaN(C)||C<=0){resReset(phKard);return }if(C>=62.5){C=0}else{if(C>=57.5){C=1}else{if(C>=52.5){C=2}else{if(C>=45){C=3}else{C=4}}}}if(!(H=document.getElementById("iBSyst"))){return }B=parseInt(H.value);if(isNaN(B)||B<=0){resReset(phKard);return }if(B>=170){B=0}else{if(B>=150){B=1}else{if(B>=130){B=2}else{B=3}}}if(!(H=document.getElementById("iKolesterol"))){return }D=fl(H);if(isNaN(D)||D<=0){resReset(phKard);return }if(D<4.5){D=0}else{if(D<5.5){D=1}else{if(D<6.5){D=2}else{if(D<7.5){D=3}else{D=4}}}}if(!(H=document.getElementById("iRokAkt"))){return }E=(H.checked)?1:0;if(!(H=document.getElementById("iKonMan"))){return }A=(H.checked)?1:0;F.innerHTML=kardD[C*80+B*20+A*10+E*5+D]+"% risk att dö i hjärtkärlsjukdom inom 10 år"}function labUpdate(K){var C,I,F,D,A,G;if(lab.cv.length<2){var E=lab.cv[0]}else{var J;if(!(J=document.getElementById("selEnhet1"))){return }var B=J.selectedIndex;if(B<0){B=0}var E=lab.cv[B]}if(typeof K=="number"){if(K=1){if(!(F=document.getElementById("yLabValue2"))){return }var I=F.nextSibling;if(!(F=document.getElementById("yLabValue1"))){return }var C=F.nextSibling;G=E.cv_factor}else{if(!(F=document.getElementById("yLabValue2"))){return }var I=F.nextSibling;if(!(F=document.getElementById("yLabValue1"))){return }var C=F.nextSibling;G=1/E.cv_factor}}else{K=EventUtil.getEvent();if(K.target.name=="a"){C=K.target;if(!(F=document.getElementById("yLabValue2"))){return }I=F.nextSibling;G=1/E.cv_factor}else{C=K.target;if(!(F=document.getElementById("yLabValue1"))){return }I=F.nextSibling;G=E.cv_factor}}if(labAnalysis.length>0){if(!(lab=Data.object("lab."+labAnalysis))){return }}D=C.value.replace(",",".");if(D.length<1||!parseFloat(D)){I.value="";return }if(D.indexOf(".")<0){var H=(E.cv_exact>0)?vsmax(E.cv_factor,D):vsmin(E.cv_factor,D)}else{var H=(E.cv_exact>0)?vsmax(E.cv_factor,D):vsmin(E.cv_factor,D)}if(H<1){H=1}I.value=rcs(D/G,H)}function rcs(A,F){if(A==0){return 0}var E=Math.ceil(Math.log(A<0?-A:A)/Math.LN10);var B=F-Math.round(E);var D=Math.pow(10,B);var C=Math.round(A*D);return C/D}function vsmin(){var B=100;var A=0;for(var C=0;C<arguments.length;C++){A=vsz(arguments[C]);if(A<B){B=A}}return B}function vsmax(){var B=1;var A=0;for(var C=0;C<arguments.length;C++){A=vsz(arguments[C]);if(A>B){B=A}}return B}function vsz(A){A=""+A;if(A.length<1||A.match(/^[0]{1,}$/)||A.match(/^[\.]{1,}$/)){return 1}if(A.substr(0,1)=="."){A="0"+A}A=A.replace(/[\.]{1,}$/,"");if(A.indexOf(".")<0){var C=0;A=A.replace(/^[0]{1,}/,"");A=A.replace(/[0]{1,}$/,"");return A.length}var C=0;var B=A.split(".");B[0]=B[0].replace(/^[0]{1,}/,"");C+=B[0].length;C+=B[1].length;return C}function labStart(){labAnalysisChange()}function labAnalysisChange(D){var E,A,C,B;if(!(E=document.getElementById("selLabProv"))){return }if(!(A=document.getElementById("yLabValue1"))){return }C=A.nextSibling;if(!(A=document.getElementById("yLabValue2"))){return }B=A.nextSibling;C.value="";B.value="";labAnalysis=E.childNodes[E.selectedIndex].value;labLoad(labAnalysis)}function labLoad(H){if(typeof H=="undefined"){return }if(!(lab=Data.object("lab."+H))){return }var B,A,I,F,D,E,C;if(!(B=document.getElementById("sEnhet1"))){return }if(!(A=document.getElementById("sEnhet2"))){return }if(!(I=document.getElementById("selEnhet1"))){return }if(!(F=document.getElementById("selEnhet2"))){return }if(!(D=document.getElementById("yLabValue1"))){return }E=D.nextSibling;if(!(D=document.getElementById("yLabValue2"))){return }C=D.nextSibling;if(lab.cv.length<2){I.style.display="none";F.style.display="none";while(I.childNodes&&I.childNodes.length){I.removeChild(I.firstChild)}while(F.childNodes&&F.childNodes.length){F.removeChild(F.firstChild)}B.innerHTML=lab.cv[0].units_cv_se;A.innerHTML=lab.cv[0].units_si_se;B.style.display="";A.style.display=""}else{B.style.display="none";A.style.display="none";var J;while(I.childNodes&&I.childNodes.length){I.removeChild(I.firstChild)}while(F.childNodes&&F.childNodes.length){F.removeChild(F.firstChild)}for(var G=0;G<lab.cv.length;G++){J=document.createElement("option");J.appendChild(document.createTextNode(lab.cv[G].units_cv_se));I.appendChild(J);J=document.createElement("option");J.appendChild(document.createTextNode(lab.cv[G].units_si_se));F.appendChild(J)}I.style.display="";F.style.display=""}E.focus()}function labClear(D){var A,C,B;if(!(A=document.getElementById("yLabValue1"))){return }C=A.nextSibling;if(!(A=document.getElementById("yLabValue2"))){return }B=A.nextSibling;C.value="";B.value=""}function labUnits(A){var B,C;A=EventUtil.getEvent();if(A.target.id=="selEnhet1"){B=A.target;if(!(C=document.getElementById("selEnhet2"))){return }labCN=B.selectedIndex;C.childNodes[labCN].selected=true}else{B=A.target;if(!(C=document.getElementById("selEnhet1"))){return }labCN=B.selectedIndex;C.childNodes[labCN].selected=true}labClear()};