var useCalendar = false if (top.is) { if (top.is.ie4up && top.is.opsys != "mac") useCalendar = true } else { useCalendar = true } var defaulticonpath = ""; function getcalendarlayers() { if (top.indhold) targetframe = top.indhold else if (top.appcontent) targetframe = top.appcontent if (top.framesetpath && top.brand) defaulticonpath = top.framesetpath + "images/" + top.brand; if (top.gsBrand) defaulticonpath = top.framesetpath + "images/" + top.gsBrand; if (top.logo.getBrand) defaulticonpath = "/online/images/" + top.logo.getBrand(); ret = "" if (useCalendar == true) { ret+="
"; ret+="
"; } return ret; } function getCalendarIcon(sFieldName,sLanguage,sDateFormat,iLeft,iTop,bShowWeekNumbers,bSelectBeforeToday) { if (!bSelectBeforeToday) bSelectBeforeToday = "null" if (useCalendar == true) return "" else return "" } bgCol="#999999";tabelBgCol="#999999";rowBgCol="#003366";grayCol="#CCCCCC" var ppcMN = new Array(12); var ppcWN = new Array("Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag","Søndag"); var ppcER = new Array(4); ppcER[0] = "Required DHTML functions are not supported in this browser."; ppcER[1] = "Target form field is not assigned or not accessible."; ppcER[2] = "Sorry, the chosen date is not acceptable. Please read instructions on the page."; ppcER[3] = "Unknown error occured while executing this script."; var ppcUC = false; var ppcUX = 4; var ppcUY = 4; var showweeks = true var calendarvisible = false var ppcIE=(navigator.appName == "Microsoft Internet Explorer"); var ppcNN=((navigator.appName == "Netscape")&&(document.layers)); var ppcTT="\n"; var ppcCD=ppcTT;var ppcFT="";var ppcFC=true; var ppcTI=false;var ppcSV=null;var ppcRL=null;var ppcXC=null;var ppcYC=null; var ppcML=new Array(31,28,31,30,31,30,31,31,30,31,30,31); var ppcNow=new Date();var ppcPtr=new Date(); var x; var hollidayArr = new Array(); var blockHollidays = true; var blockholman = null; var ImagePath = null function showCalendar(sFieldName,sLanguage,sDateFormat,iLeft,iTop,bShowWeekNumbers,aMonths,aDays,sBlockedDays,sImagePath,bSelectBeforeToday) { ppcDF = sDateFormat.replace("YYYY", "Y").replace("YY", "y").replace("DD", "d").replace("MM", "m") if (aMonths == null) monthArr=targetframe.kalmaaneder else monthArr=aMonths if (aDays == null) dayArr=targetframe.kaldage else dayArr=aDays if (sBlockedDays == null) setHollidays(targetframe.kalejbankdage) else setHollidays(sBlockedDays) if (sFieldName.indexOf(".") > -1) //Formnavn er med target = eval("targetframe.document." + sFieldName) else target = eval("targetframe.document.Form1." + sFieldName) if (bSelectBeforeToday == null) SelectBeforeToday = false else SelectBeforeToday = bSelectBeforeToday ImagePath = sImagePath curcell = null targetyear = null targetmonth = null targetday = null var tv = target.value if (tv.length == sDateFormat.length) { yix = sDateFormat.indexOf("YYYY") if(yix > -1) { targetyear = tv.substring(yix, yix+4) } else { yix = sDateFormat.indexOf("YY") if (yix > -1) { targetyear = "20" + tv.substring(yix, yix+2) } } mix = sDateFormat.indexOf("MM") if(mix > -1) { targetmonth = tv.substring(mix, mix+2) if (targetmonth.substring(0,1) == "0") targetmonth = parseInt(targetmonth.substring(1,2))-1 else targetmonth = parseInt(targetmonth)-1 } dix = sDateFormat.indexOf("DD") if(dix > -1) { targetday = tv.substring(dix, dix+2) } } if(isNaN(targetyear) || isNaN(targetmonth) || isNaN(targetday)) { targetyear = null targetmonth = null targetday = null } getCalendarFor(target,iLeft,iTop,true,bShowWeekNumbers) if (targetday != null) { if (targetday.substring(0,1) == "0") targetday = targetday.substring(1,2) setBorder(targetframe.document.all(eval("datecell"+targetday))) } else setBorder(targetframe.document.all(eval("datecell"+ppcNow.getDate()))) } function getCalendarFor(target,left,topxy,blockholman,bshowweeks) { targetframe.document.onkeydown = top.logo.kdown calendarvisible = true showweeks = bshowweeks if(blockholman==true) blockHollidays = true; if(blockholman==false) blockHollidays = false; ppcSV = target; if (left == null) {leftpl = 0;} else {leftpl = left} if (topxy == null) { toppl = 0;} else {toppl= topxy} if (ppcFC) {setCalendar(targetyear, targetmonth);ppcFC = true;} if ((ppcSV != null)&&(ppcSV)) { if (ppcIE) { var obj = targetframe.document.all['PopUpCalendar']; obj.style.left = document.body.scrollLeft + getOffsetLeft(target) + leftpl - getOffsetLeft(obj.offsetParent) obj.style.top = document.body.scrollTop + getOffsetTop(target) + toppl - getOffsetTop(obj.offsetParent) obj.style.visibility = "visible";} else {showError(ppcER[0]);}} else {showError(ppcER[1]);}} function switchMonth(param) { var tmp = param.split("|"); setCalendar(tmp[0],tmp[1]);} function moveMonth(dir) { var obj = null; var limit = false; var tmp,dptrYear,dptrMonth; if (ppcIE) {obj = targetframe.document.ppcMonthList.sItem;} else {showError(ppcER[0]);} if (obj != null) { if ((dir.toLowerCase() == "back")&&(obj.selectedIndex > 0)) {obj.selectedIndex--;} else if ((dir.toLowerCase() == "forward")&&(obj.selectedIndex < 12)) {obj.selectedIndex++;} else {limit = true;}} if (!limit) { tmp = obj.options[obj.selectedIndex].value.split("|"); dptrYear = tmp[0]; dptrMonth = tmp[1]; setCalendar(dptrYear,dptrMonth);} else { if (ppcIE) { obj.style.backgroundColor = "#FF0000"; window.setTimeout("document.ppcMonthList.sItem.style.backgroundColor = '#FFFFFF'",50);}}} function selectDate(param) { var arr = param.split("|"); var year = arr[0]; var month = arr[1]; var date = arr[2]; var ptr = parseInt(date); ppcPtr.setDate(ptr); if ((ppcSV != null)&&(ppcSV)) { if (validDate(date)) {ppcSV.value = dateFormat(year,month,date);hideCalendar();} else {showError(ppcER[2]);if (ppcTI) {clearTimeout(ppcTI);ppcTI = false;}}} else { showError(ppcER[1]); hideCalendar();}} function setCalendar(year,month) { if (year == null) {year = getFullYear(ppcNow);} if (month == null) {month = ppcNow.getMonth();} if (month == 1) {ppcML[1] = (isLeap(year)) ? 29 : 28;} ppcPtr.setYear(year); ppcPtr.setMonth(month); ppcPtr.setDate(1); updateContent();} function updateContent() { generateContent(); if (ppcIE) {targetframe.document.all['monthDays'].innerHTML = ppcCD;} else {showError(ppcER[0]);} ppcCD = ppcTT;} function generateContent() { var year = getFullYear(ppcPtr); var month = ppcPtr.getMonth(); var date = 1; var day = ppcPtr.getDay(); ppcCD = generateMonth(year,month) ppcCD += generateWeekdays() if (day == 0) {day = 6} else (day = day-1); var len = ppcML[month]; var bgr,cnt,tmp = ""; var j,i,d = 0; for (j = 0; j < 7; ++j) { if (date > len) {lastj = j-1; break;} if (showweeks) tmp += "" for (i = 0; i < 7; ++i) { realdate = date; realmonth = month realyear = year if ((j == 0)&&(i < day)) { if (month>0) realmonth = month-1 if (month == 0) { realmonth = 11 realyear = year - 1 } realdate = ppcML[lmonth] - (day-i-1) } if (date > len) { if (month<11) realmonth = month+1 if (month == 11) { realmonth = 0 realyear = year + 1 } realdate = date-ppcML[month] } if ((i==5) || (i==6) ||(holliday(realdate,realmonth,realyear))||(!SelectBeforeToday && ((date < ppcNow.getDate() && month <= ppcNow.getMonth() && year <= ppcNow.getYear()) || (month < ppcNow.getMonth() && year <= ppcNow.getYear()) || year < ppcNow.getYear()))) { bgr = "#E1E1E1"; } else bgr = "#FFFFFF"; bolded=false if ((j == 0)&&(i < day)) { if (month>0) { lyear = year lmonth = month-1 } if (month == 0) { lyear = year-1 lmonth = 11 } ldate = ppcML[lmonth] - (day-i-1) tmp += makeCell(bgr,lyear,lmonth,ldate,i,j,bolded, "#999999"); } else if (date > len) { if (month<11) { nyear = year nmonth = month+1 } if (month == 11) { nyear = year+1 nmonth = 0 } ndate = date-ppcML[month] tmp += makeCell(bgr,nyear,nmonth,ndate,i,j,bolded, "#999999");++date } else { if ((ppcNow.getDate() == date)&&(ppcNow.getMonth() == month)&&(getFullYear(ppcNow) == year)) bolded = true tmp += makeCell(bgr,year,month,date,i,j,bolded);++date; } } ppcCD += "\n" + tmp + "\n";tmp = ""; } ppcCD += "
" + getWeek(year,month,date) + "
\n" } function makeCell(bgr,year,month,date,i,j,bolded,txtcolor) { var param = "\'"+year+"|"+month+"|"+date+"\'"; lb = "" bstart="";bend=""; if (bolded) {bstart="";bend="";} txtc = "#000000" if (txtcolor) txtc = txtcolor if (i==0) lb = "border-left:1px solid #999999;" if (date>9 || j<3) eval("datecell"+date+"='c"+i+j+"'") var td1 = "\n" : "\n"; var evt = "onMouseOver=\"top.logo.setBorder(this)\" onMouseOut=\"top.logo.clearBorder(this)\" onClick=\"top.logo.selectDate("+param+")\" "; var ext = ""; var lck = ""; var lnk = ""; var cellValue = (date != 0) ? date+"" : " "; cellValue = "
"+bstart+cellValue+bend+"
"; var cellCode = ""; if ((date == 0) || (bgr=="#E1E1E1" && blockHollidays)) { if (ppcIE) {cellCode = td1+"Style=\"cursor: default\">"+lck+ppcFT+cellValue+td2;} else {cellCode = td1+">"+ppcFT+cellValue+td2;}} else { if (ppcIE) {cellCode = td1+evt+"Style=\"cursor: hand\">"+ext+ppcFT+cellValue+td2;} else { if (date < 10) {cellValue = " " + cellValue + " ";} cellCode = td1+">"+lnk+ppcFT+cellValue+td2;}} return cellCode;} function setBorder(cell) { if (curcell != null) clearBorder(curcell) curcell = cell cell.style.borderColor="#CC0000" i = parseInt(cell.id.substring(1,2)) j = parseInt(cell.id.substring(2,3)) targetframe.document.all("t" + i + "" + j).style.borderColor = "#CC0000" if (i>0) targetframe.document.all("c" + (i-1) + "" + j).style.borderRightColor = "#CC0000" if (j>0) targetframe.document.all("c" + i + "" + (j-1)).style.borderBottomColor = "#CC0000" else targetframe.document.all("t" + i).style.borderBottomColor = "#CC0000" } function clearBorder(cell) { cell.style.borderColor="#999999" i = parseInt(cell.id.substring(1,2)) j = parseInt(cell.id.substring(2,3)) targetframe.document.all("t" + i + "" + j).style.borderColor = "#FFFFFF" if (i>0) targetframe.document.all("c" + (i-1) + "" + j).style.borderRightColor = "#999999" if (j>0) targetframe.document.all("c" + i + "" + (j-1)).style.borderBottomColor = "#999999" else targetframe.document.all("t" + i).style.borderBottomColor = "#999999" } function getgfxpath() { if (ImagePath!=null && ImagePath!="") return ImagePath else return defaulticonpath } function generateMonth(year,month) { lyear = year nyear = year lmonth = month - 1 nmonth = month + 1 if (month == 0) { lyear = year-1 lmonth = 11 } else if (month == 11) { nyear = year+1 nmonth = 0 } csp = 7 wdth = 134 arrcellwtdh = 14 if (showweeks) {csp=8;wdth=153;arrcellwtdh=20} var tmp = ""; tmp += ""; tmp += "" tmp += "" tmp += "" tmp += "" tmp += "" tmp += "" return tmp; } function generateWeekdays() { var tmp = ""; tmp += "" if (showweeks) tmp += "" for (i=0; i" + dayArr[i] + "" } tmp += "" return tmp; } function hideCalendar() { calendarvisible = false if (ppcIE) {ppcSV.focus();} if (ppcIE) {targetframe.document.all['PopUpCalendar'].style.visibility = "hidden";} ppcTI = false; setCalendar(null, null); ppcSV = null; } function showError(message) { window.alert("[ PopUp Calendar ]\n\n" + message);} function isLeap(year) { if ((year%400==0)||((year%4==0)&&(year%100!=0))) {return true;} else {return false;}} function getFullYear(obj) { return obj.getYear();} function validDate(date) { var reply = true; if ((ppcRL == null) || (!ppcRL)) { /* NOP */} else { var arr = ppcRL.split(":"); var mode = arr[0]; var arg = arr[1]; var key = arr[2].charAt(0).toLowerCase(); if (key != "d") { var day = ppcPtr.getDay(); var orn = isEvenOrOdd(date); reply = (mode == "[^]") ? !((day == arg)&&((orn == key)||(key == "a"))) : ((day == arg)&&((orn == key)||(key == "a")));} else {reply = (mode == "[^]") ? (date != arg) : (date == arg);}} return reply;} function isEvenOrOdd(date) { if (date - 21 > 0) {return "e";} else if (date - 14 > 0) {return "o";} else if (date - 7 > 0) {return "e";} else {return "o";}} function dateFormat(year,month,date) { if (ppcDF == null) {ppcDF = "d.m.Y";} var day = ppcPtr.getDay(); var crt = ""; var str = ""; var chars = ppcDF.length; for (var i = 0; i < chars; ++i) { crt = ppcDF.charAt(i); switch (crt) { case "M": str += ppcMN[month]; break; case "m": str += (month<9) ? ("0"+(++month)) : ++month; break; case "Y": str += year; break; case "y": str += year.substring(2); break; case "d": str += ((ppcDF.indexOf("m")!=-1)&&(date<10)) ? ("0"+date) : date; break; case "W": str += ppcWN[day]; break; default: str += crt;}} return unescape(str);} function setMonths(parm) { ppcMN = parm; } function setHollidays(arr) { hollidayArr = arr.split("|"); for ( x = 0; hollidayArr[x]!="" && hollidayArr[x]!=null; ++x){} } function setBlockHolliday(parm) { if (parm=="N") {blockHollidays = false;} else {blockHollidays = true;} } function holliday(date,month,year){ month=month+1; var dateStr= ""; if (date<10) {dateStr += "0"+date;} else {dateStr += date;} if (month<10) {dateStr += "0"+month;} else {dateStr += month;} dateStr += year; var holliday=false; for (var i=0; i < x ; ++i){ if (dateStr==hollidayArr[i]) {holliday=true;}} return holliday;} function y2k(number) { return (number < 1000) ? number + 1900 : number; } function getWeek(year,month,day) { var when = new Date(year,month,day); var newYear = new Date(year,0,1); var modDay = newYear.getDay(); if (modDay == 0) modDay=6; else modDay--; var daynum = ((Date.UTC(y2k(year),when.getMonth(),when.getDate(),0,0,0) - Date.UTC(y2k(year),0,1,0,0,0)) /1000/60/60/24) + 1; if (modDay < 4 ) { var weeknum = Math.floor((daynum+modDay-1)/7)+1; } else { var weeknum = Math.floor((daynum+modDay-1)/7); if (weeknum == 0) { year--; var prevNewYear = new Date(year,0,1); var prevmodDay = prevNewYear.getDay(); if (prevmodDay == 0) prevmodDay = 6; else prevmodDay--; if (prevmodDay < 4) weeknum = 53; else weeknum = 52; } } return weeknum; } var curcell = null function kdown() { if (calendarvisible) { curyear = ppcPtr.getYear() curmonth = ppcPtr.getMonth() if (curcell == null) { curcell = targetframe.document.all("c33") } i = parseInt(curcell.id.substring(1,2)) j = parseInt(curcell.id.substring(2,3)) curi = i curj = j clearBorder(curcell) arrownav(targetframe.window.event.keyCode,1) if (targetframe.window.event.keyCode == 13) // Enter { curcell.click(); return false } if (targetframe.window.event.keyCode == 27) // ESC { hideCalendar(); } } } function arrownav(kc, depth) { if (depth > 2) { switchMonth(curyear + "|" + curmonth) curcell = targetframe.document.all("c" + curi + curj) setBorder(curcell) return } d2 = depth + 1 if (kc == 37) // pil venstre { var ix = i var jx = j do { ix-- if (ix<0) { ix=6 jx-- } if (jx>=0) curcell = targetframe.document.all("c" + (ix) + jx) else { nyear = ppcPtr.getYear() nmonth = ppcPtr.getMonth() - 1 if (nmonth == -1) { nmonth = 11; nyear--; } switchMonth(nyear + "|" + nmonth) i = 7 j = lastj arrownav(37,d2) return; } } while (curcell.bgColor != "#ffffff") setBorder(curcell) targetframe.window.event.returnValue = false } if (kc == 38) // pil op { var ix = i var jx = j do { jx-- if (jx>=0) curcell = targetframe.document.all("c" + (ix) + jx) else { nyear = ppcPtr.getYear() nmonth = ppcPtr.getMonth() - 1 if (nmonth == -1) { nmonth = 11; nyear--; } switchMonth(nyear + "|" + nmonth) i = ix j = lastj+1 arrownav(38,d2) return; } } while (curcell.bgColor != "#ffffff") setBorder(curcell) targetframe.window.event.returnValue = false } if (kc == 39) // pil højre { var ix = i var jx = j do { ix++ if (ix>6) { ix=0 jx++ } if (jx<=lastj) curcell = targetframe.document.all("c" + (ix) + jx) else { nyear = ppcPtr.getYear() nmonth = ppcPtr.getMonth() + 1 if (nmonth == 12) { nmonth = 0; nyear++; } switchMonth(nyear + "|" + nmonth) i = -1 j = 0 arrownav(39,d2) return; } } while (curcell.bgColor != "#ffffff") setBorder(curcell) targetframe.window.event.returnValue = false } if (kc == 40) // pil ned { var ix = i var jx = j do { jx++ if (jx<=lastj) curcell = targetframe.document.all("c" + (ix) + jx) else { nyear = ppcPtr.getYear() nmonth = ppcPtr.getMonth() + 1 if (nmonth == 12) { nmonth = 0; nyear++; } switchMonth(nyear + "|" + nmonth) i = ix j = -1 arrownav(40,d2) return; } } while (curcell.bgColor != "#ffffff") setBorder(curcell) targetframe.window.event.returnValue = false } } function getOffsetLeft(el){ var ol = el.offsetLeft; while ((el = el.offsetParent) != null) { ol += el.offsetLeft; } return ol; } function getOffsetTop(el){ var ot = el.offsetTop; while((el = el.offsetParent) != null) { ot += el.offsetTop; } return ot; } function md(mvurl, sid, title, mvh, mvb){ // Komponent til modale vinduer // mvurl - url på den side applikationen vil vise. Udelades den, er default en standard side fra os // mvh - vinduets højde. Max. værdi/default værdi = 200px // mvb - vinduets bredde. Max. værdi/default værdi = 392px // sid - span id. Objektet som skal sættes ind i span'et i det modale vindue. if ((mvh > 200) || (mvh=='') || (mvh==null)) mvh = 200; if ((mvb > 392) || (mvb=='') || (mvb==null)) mvb = 392; f = ''; f += 'dialogHeight:'+ mvh +'px;'; f += 'dialogWidth:'+ mvb +'px;'; f += 'scroll:no;'; f += 'help:no;'; f += 'status:no;'; sid.ovskr = title; if ((mvurl != null) && (mvurl != "")) RV = window.showModalDialog(mvurl, sid, f); else RV = window.showModalDialog("smd_target.htm", sid, f); // Har formen window.showModalDialog(sURL [, vArguments] [, sFeatures]); return RV; }
" + monthArr[ppcPtr.getMonth()] + " " + getFullYear(ppcPtr) + "