var boolNS4 = navigator.appVersion.indexOf("Nav") > 0 && parseInt(navigator.appVersion) == 4; function GetElement(strElement){ if (document.getElementById) { return (document.getElementById(strElement)); } else if (document.all) { return (eval("document.all." + strElement)); } else if (document.layers) { return (eval("document." + strElement)); } else { return (null); } } function IsNull( val ) { var isValid = false; if (val+"" == "null") isValid = true; return isValid; } function IsUndef( val ) { var isValid = false; if (val+"" == "undefined") isValid = true; return isValid; } function IsAlpha( str ) { if (str+"" == "undefined" || str+"" == "null" || str+"" == "") return false; var isValid = true; str += ""; for (i = 0; i < str.length; i++) { if ( !( ((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) || ((str.charAt(i) >= "A") && (str.charAt(i) <= "Z")) ) ) { isValid = false; break; } } return isValid; } function IsBlank( str ) { var isValid = false; if ( IsNull(str) || IsUndef(str) || (str+"" == "") ) isValid = true; return isValid; } // ----------------- CALC ----------------------- // function checkdate(field) { valid_date(field); return true; } function tousa (str) { bs=str+""; c = bs.lastIndexOf(","); if ((c>-1) && (c>=bs.length-3)) { p = bs.length-c-1; while (bs.indexOf(".")>0) bs=bs.substring(0,bs.indexOf("."))+bs.substring(bs.indexOf(".")+1); while (bs.indexOf(",")>0) bs=bs.substring(0,bs.indexOf(","))+bs.substring(bs.indexOf(",")+1); bs = bs.substring(0,bs.length-p)+"."+bs.substring(bs.length-p); } else if (c>-1) while (bs.indexOf(",")>0) bs=bs.substring(0,bs.indexOf(","))+"."+bs.substring(bs.indexOf(",")+1); if (bs=="") bs="0"; return (bs); } function tonum (field) { t1 = field.value; p1 = tousa(t1); r1 = parseFloat(p1); r1 = r1.fix(); res = 0; if ((isNaN(r1)) || (r1==0)) res = 0; else res = r1; return res; } function _fix(dig) { if ((dig>0) || (dig==null) || (isNaN(dig))) dig=0 return Math.round(this.valueOf()*100)/100;//*power)/power; } Number.prototype.fix = _fix; function formatdots (blbstr) { res = blbstr; if (res.indexOf(",")>=0) onlyblb = res.substring(0,res.indexOf(",")); else onlyblb = res; if (onlyblb.length>3) { res = ""; p=0; for (i = onlyblb.length; i>=0 ; i--) { if ((p%3==1) && (p!=1)) res="."+res; res=onlyblb.charAt(i)+res; p++; } } else res = onlyblb; return (res); } function todk (blbp) { str = blbp+""; if (str.indexOf(".")>0) { s1 = str.substring(0,str.indexOf("."))+","+str.substring(str.indexOf(".")+1); dec = s1.substring(s1.indexOf(",")); if (dec.length==1) dec=dec+"0"; b = formatdots(s1); return (b+dec); } else { str = formatdots(str)+",00"; return (str); } } var pingAttr = 'scrollbars=no,resizable=no,status=no,width=10,height=10' function wping(strUrl){ window.open(strUrl,'',pingAttr); } function isint(field){ var checkOK = "0123456789"; var checkStr = field; var allValid = true; for (ih = 0; ih < checkStr.length; ih++){ ch = checkStr.charAt(ih); for (jh = 0; jh< checkOK.length; jh++){ if (ch == checkOK.charAt(jh)){ break; } if (jh == checkOK.length){ allValid = false; break; } } } if (!allValid) return (false); return (true); } function valid_date(datein) { var indate=datein.value; d = ""; m = ""; y = ""; if ((indate!="d") && (indate!="D")) { if (isint(indate)) { if (indate.length>1) d = indate.substring(0,2); if (indate.length>3) m = indate.substring(2,4); if (indate.length>5) y = indate.substring(4); } else { ts = indate; dl = 0; for (hjh = 0; hjh < ts.length; hjh++) { ch = ts.charAt(hjh); if (isint(ch)) { if (dl==0) d += ch+""; else { if (dl==1) m += ch+""; else y += ch+""; } } else { if (dl>2) break; else dl++; } } } } dd = new Date(); if (d=="") d = dd.getDate()+""; if (m=="") m = (dd.getMonth()+1)+""; if (y=="") y = dd.getYear()+""; if (d.length==1) d="0"+d; if (m.length==1) m="0"+m; if (y.length==4) { y++; y--; if (y<2000) y=y-1900; y+""; } var chkDate=new Date(Math.abs(y),Math.abs(m)-1,Math.abs(d)); var cmpDate=(chkDate.getMonth()+1)+"/"+(chkDate.getDate())+"/"+(chkDate.getYear()); var indate2=(Math.abs(m))+"/"+(Math.abs(d))+"/"+(Math.abs(y)); if (indate2!=cmpDate) { alert("Du har indtastet en forkert dato. Indtast som DD/MM-YY format."); datein.focus(); } else { if (cmpDate=="NaN/NaN/NaN") { alert("Opdater "); datein.focus(); } else { yy = y+""; if (yy.length<4) { if (yy.length==3) yy=yy.substring(1); yy++; yy--; if (yy<70) yy=yy+2000; else yy=yy+1900; yy+""; } datein.value = d+"/"+m+"-"+yy; } } } function DoCal(elTarget) { var scRtn; scRtn = showModalDialog("Calendar.htm","","center=yes;dialogWidth=350px;dialogHeight=150px;help:no;status:no;resizeable:no;"); if (scRtn!="") {elTarget.value = scRtn;} } function startadvancedsearch() { document.location.href = "catalog.asp?startquery=1&group=all"; } function openPrint(strURL){ var qweqwe = document.location.href; window.open(strURL); //,'','scrollbars=yes,resizable=yes,status=yes,width=800,height=600'); document.location.href = qweqwe; } function openPicklist(strURL){ window.open(strURL,'','scrollbars=yes,resizable=yes,status=no,width=428,height=250'); } function openPicklistSmall(strURL){ // showModalDialog(strURL,"","center=yes;dialogWidth=222px;dialogHeight=50px;help:no;status:no;resizeable:no;"); window.open(strURL,'','scrollbars=no,resizable=no,status=no,width=222,height=50'); } function openPicklistMed(strURL){ window.open(strURL,'','scrollbars=yes,resizable=yes,status=no,width=322,height=220'); } function openMaillist(strURL){ window.open(strURL,'','scrollbars=no,resizable=no,status=no,width=300,height=370'); } function turnOne(stritemID) { if(boolNS4) return false; objCurrentShort = GetElement("Show"+stritemID); objCurrentShort.style.display = "block"; } function toggleShow(stritemID) { if(boolNS4) return false; objCurrentShort = GetElement("Show"+stritemID+"Short"); objCurrentShort.style.display = (objCurrentShort.style.display=="none" ? "block" : "none"); objCurrentLong = GetElement("Show"+stritemID+"Long"); objCurrentLong.style.display = (objCurrentLong.style.display=="none" ? "block" : "none"); } function toggleOne(stritemID) { if(boolNS4) return false; objCurrentShort = GetElement("Show"+stritemID); objCurrentShort.style.display = (objCurrentShort.style.display=="none" ? "block" : "none"); } function toggleGoDart(stritemID) { if(boolNS4) return false; objCurrentShort = GetElement("Show"+stritemID); objCurrentShort.style.display = (objCurrentShort.style.display=="none" ? "block" : "none"); /* goright = new Image(); goright.src = "img/go.gif"; godown = new Image(); godown.src = "img/godown.gif"; if (eval("document.Go"+stritemID+".src==goright.src")){ eval("document.Go"+stritemID+".src=godown.src"); }else if(eval("document.Go"+stritemID+".src==godown.src")){ eval("document.Go"+stritemID+".src=goright.src"); } */ } function openGo(stritemID) { if(boolNS4) return false; objCurrentShort = GetElement("Show"+stritemID); objCurrentShort.style.display = "block"; /* godown = new Image(); godown.src = "img/godown.gif"; eval("document.Go"+stritemID+".src=godown.src"); */ } function closeGo(stritemID) { if(boolNS4) return false; objCurrentShort = GetElement("Show"+stritemID); objCurrentShort.style.display = "none"; /* goright = new Image(); goright.src = "img/go.gif"; eval("document.Go"+stritemID+".src=goright.src"); */ }