var gotoString = "zum aktuellen Monat"; var todayString = "Heute ist"; var weekString = "KW"; monthName = new Array("Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"); startAt = 1; // since we always start at 1, we only change the else part :-) lazy if (startAt==0) { dayName = new Array ("Mo","Di","Mi","Do","Fr","Sa","So"); } else { dayName = new Array ("Mo","Di","Mi","Do","Fr","Sa","So"); } var fixedX = -1; // x position (-1 if to appear below control) var fixedY = -1; // y position (-1 if to appear below control) var showWeekNumber = 1; // 0 - don't show; 1 - show var showToday = 1; // 0 - don't show; 1 - show var imgDir = "./_img/calendar/"; // directory for images ... e.g. var imgDir="/img/" var scrollLeftMessage = "Click to scroll to previous month. Hold mouse button to scroll automatically."; var scrollRightMessage = "Click to scroll to next month. Hold mouse button to scroll automatically."; var selectMonthMessage = "Click to select a month."; var selectYearMessage = "Click to select a year."; var selectDateMessage = "Select [date] as date."; // do not replace [date], it will be replaced by date. var crossobj, crossMonthObj, crossYearObj, monthSelected, yearSelected, dateSelected, omonthSelected, oyearSelected, odateSelected, monthConstructed, yearConstructed, intervalID1, intervalID2, timeoutID1, timeoutID2, ctlToPlaceValue, ctlNow, dateFormat, nStartingYear; var bPageLoaded=false; var ie=document.all; var dom=document.getElementById; var ns4=document.layers; var today = new Date(); var dateNow = today.getDate(); var monthNow = today.getMonth(); var yearNow = today.getYear(); var imgsrc = new Array("drop1.gif","drop2.gif","left1.gif","left2.gif","right1.gif","right2.gif"); var img = new Array(); var bShow = false; var cal_onClickId = null; function HolidayRec (d, m, y, desc, link) { this.d = d this.m = m this.y = y this.desc = desc this.link = link } var HolidaysCounter = 0 var Holidays = new Array() function addHoliday (d, m, y, desc, link) { Holidays[HolidaysCounter++] = new HolidayRec ( d, m, y, desc, link ) } if (dom) { s = ""; for (i=0;i") if (showToday==1) { document.write ("") } document.write ("
"); } function swapImage(srcImg, destImg){ if (ie){ document.getElementById(srcImg).setAttribute("src",imgDir + destImg) } } function init() { if (!ns4) { if (!ie) { yearNow += 1900; } crossobj=(dom)?document.getElementById("calendar").style : ie? document.all.calendar : document.calendar; hideCalendar(true); crossMonthObj=(dom)?document.getElementById("selectMonth").style : ie? document.all.selectMonth : document.selectMonth; crossYearObj=(dom)?document.getElementById("selectYear").style : ie? document.all.selectYear : document.selectYear; monthConstructed=false; yearConstructed=false; if (showToday==1) { document.getElementById("lblToday").innerHTML = todayString + " "+dayName[(today.getDay()-startAt==-1)?6:(today.getDay()-startAt)]+", " + dateNow + " " + monthName[monthNow].substring(0,3) + " " + yearNow + ""; } //sHTML1= "   "; sHTML1+="   "; sHTML1+=" "; sHTML1+=" "; sHTML1= "   "; sHTML1+="   "; sHTML1+=" "; sHTML1+=" "; document.getElementById("caption").innerHTML = sHTML1; bPageLoaded=true; } } var calendarShown = false; function hideCalendar(comesFromInit) { crossobj.visibility="hidden"; if (crossMonthObj != null){crossMonthObj.visibility="hidden"} if (crossYearObj != null){crossYearObj.visibility="hidden"} if (comesFromInit!==true && calendarShown==true) { showMagic(); } calendarShown = false; } function padZero(num) { return (num < 10)? '0' + num : num ; } function constructDate(d,m,y) { sTmp = dateFormat; sTmp = sTmp.replace ("dd",""); sTmp = sTmp.replace ("d",""); sTmp = sTmp.replace ("",padZero(d)); sTmp = sTmp.replace ("",d); sTmp = sTmp.replace ("mmm",""); sTmp = sTmp.replace ("mm",""); sTmp = sTmp.replace ("m",""); sTmp = sTmp.replace ("",m+1); sTmp = sTmp.replace ("",padZero(m+1)); sTmp = sTmp.replace ("",monthName[m]); return sTmp.replace ("yyyy",y); } function closeCalendar() { var sTmp; hideCalendar(); ctlToPlaceValue.value = constructDate(dateSelected,monthSelected,yearSelected); } function StartDecMonth() { intervalID1=setInterval("decMonth()",80) } function StartIncMonth() { intervalID1=setInterval("incMonth()",80) } function incMonth () { monthSelected++ if (monthSelected>11) { monthSelected=0; yearSelected++; } constructCalendar(); } function decMonth () { monthSelected-- if (monthSelected<0) { monthSelected=11; yearSelected--; } constructCalendar(); } function constructMonth() { popDownYear() if (!monthConstructed) { sHTML = "" for (i=0; i<12; i++) { sName = monthName[i]; if (i==monthSelected){ sName = "" + sName + "" } sHTML += " " + sName + " "; } document.getElementById("selectMonth").innerHTML = "" + sHTML + ""; monthConstructed=true; } } function popUpMonth() { constructMonth(); crossMonthObj.visibility = (dom||ie)? "visible" : "show"; crossMonthObj.left = parseInt(crossobj.left) + 50; crossMonthObj.top = parseInt(crossobj.top) - 46; hideMagic("selectMonth"); } function popDownMonth() { crossMonthObj.visibility= "hidden"; } function incYear() { for (i=0; i<7; i++){ newYear = (i+nStartingYear)+1; if (newYear==yearSelected) { txtYear = " " + newYear + " " } else { txtYear = " " + newYear + " " } document.getElementById("y"+i).innerHTML = txtYear; } nStartingYear ++; bShow=true; } function decYear() { for (i=0; i<7; i++){ newYear = (i+nStartingYear)-1; if (newYear==yearSelected) { txtYear = " " + newYear + " " } else { txtYear = " " + newYear + " " } document.getElementById("y"+i).innerHTML = txtYear; } nStartingYear --; bShow=true; } function selectYear(nYear) { yearSelected=parseInt(nYear+nStartingYear); yearConstructed=false; constructCalendar(); popDownYear(); } function constructYear() { popDownMonth(); sHTML = ""; if (!yearConstructed) { sHTML = "-"; j = 0; nStartingYear = yearSelected-3; for (i=(yearSelected-3); i<=(yearSelected+3); i++) { sName = i; if (i==yearSelected){ sName = "" + sName + ""; } sHTML += " " + sName + " "; j ++; } sHTML += "+"; document.getElementById("selectYear").innerHTML = "" + sHTML + ""; yearConstructed = true; } } function popDownYear() { clearInterval(intervalID1); clearTimeout(timeoutID1); clearInterval(intervalID2); clearTimeout(timeoutID2); crossYearObj.visibility= "hidden"; } function popUpYear() { var leftOffset; constructYear(); crossYearObj.visibility = (dom||ie)? "visible" : "show"; leftOffset = parseInt(crossobj.left) + document.getElementById("spanYear").offsetLeft; if (ie) { leftOffset += 6; } crossYearObj.left = leftOffset; crossYearObj.top = parseInt(crossobj.top) -46; } function WeekNbr(today) { Year = takeYear(today); Month = today.getMonth(); Day = today.getDate(); now = Date.UTC(Year,Month,Day+1,0,0,0); var Firstday = new Date(); Firstday.setYear(Year); Firstday.setMonth(0); Firstday.setDate(1); then = Date.UTC(Year,0,1,0,0,0); var Compensation = Firstday.getDay(); if (Compensation > 3) Compensation -= 4; else Compensation += 3; NumberOfWeek = Math.round((((now-then)/86400000)+Compensation)/7); return NumberOfWeek; } function takeYear(theDate) { x = theDate.getYear(); var y = x % 100; y += (y < 38) ? 2000 : 1900; return y; } function constructCalendar () { var dateMessage var startDate = new Date (yearSelected,monthSelected,1) var endDate = new Date (yearSelected,monthSelected+1,1); endDate = new Date (endDate - (24*60*60*1000)); numDaysInMonth = endDate.getDate() datePointer = 0 dayPointer = startDate.getDay() - startAt if (dayPointer<0) { dayPointer = 6 } sHTML = ""; if (showWeekNumber==1) { sHTML += ""; } for (i=0; i<7; i++) { sHTML += ""; } sHTML +="" if (showWeekNumber==1) { sHTML += ""; } for ( var i=1; i<=dayPointer;i++ ) { sHTML += "" } for ( datePointer=1; datePointer<=numDaysInMonth; datePointer++ ) { dayPointer++; sHTML += "" if ((showWeekNumber==1)&&(datePointer"; } } } document.getElementById("content").innerHTML = sHTML; document.getElementById("spanMonth").innerHTML = "" + monthName[monthSelected] + ""; document.getElementById("spanYear").innerHTML = "" + yearSelected + ""; } function popUpCalendar(ctl, ctl2, format) { var leftpos=0; var toppos=0; if (bPageLoaded) { if ( crossobj.visibility == "hidden" ) { ctlToPlaceValue = ctl2 dateFormat=format; formatChar = " " aFormat = dateFormat.split(formatChar) if (aFormat.length<3) { formatChar = "/" aFormat = dateFormat.split(formatChar) if (aFormat.length<3) { formatChar = "." aFormat = dateFormat.split(formatChar) if (aFormat.length<3) { formatChar = "-" aFormat = dateFormat.split(formatChar) if (aFormat.length<3) { formatChar="" } } } } tokensChanged = 0 if ( formatChar != "" ) { aData = ctl2.value.split(formatChar) for (i=0;i<3;i++) { if ((aFormat[i]=="d") || (aFormat[i]=="dd")) { dateSelected = parseInt(aData[i], 10) tokensChanged ++ } else if ((aFormat[i]=="m") || (aFormat[i]=="mm")) { monthSelected = parseInt(aData[i], 10) - 1 tokensChanged ++ } else if (aFormat[i]=="yyyy") { yearSelected = parseInt(aData[i], 10); tokensChanged ++ } else if (aFormat[i]=="mmm") { for (j=0; j<12; j++) { if (aData[i]==monthName[j]) { monthSelected=j; tokensChanged ++ } } } } } if ((tokensChanged!=3)||isNaN(dateSelected)||isNaN(monthSelected)||isNaN(yearSelected)) { dateSelected = dateNow; monthSelected = monthNow; yearSelected = yearNow; } odateSelected=dateSelected ; omonthSelected=monthSelected; oyearSelected=yearSelected; aTag = ctl do { aTag = aTag.offsetParent; leftpos += aTag.offsetLeft; toppos += aTag.offsetTop; } while(aTag.tagName!="BODY"); crossobj.left = fixedX==-1 ? ctl.offsetLeft + leftpos : fixedX crossobj.top = fixedY==-1 ? ctl.offsetTop + toppos + ctl.offsetHeight + 2 : fixedY constructCalendar (1, monthSelected, yearSelected); crossobj.visibility=(dom||ie)? "visible" : "show" calendarShown = true; bShow = true; } } else { init(); popUpCalendar(ctl, ctl2, format) } if (cal_onClickId!=null) { //events.unregister(cal_onClickId); cal_onClickId = null; } //cal_onClickId = events.register("onclick","hidecal2();"); } function hidecal1 () { if (document.all && event.keyCode==27) { hideCalendar() } } function hidecal2 () { if (!bShow) { hideCalendar(); } bShow = false; } ///////////////////////////////////////////////// // // determine the browser used // function userAgent() { var agent = navigator.userAgent.toLowerCase(); this.major = parseInt(navigator.appVersion); this.minor = parseFloat(navigator.appVersion); // alert("agent: "+agent+"\r\nnavVersion"+navigator.appVersion+"\r\nmajor: "+this.major+"\r\nminor: "+this.minor); this.ns = ( ( agent.indexOf('mozilla')!=-1) && ( ( agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1) ) && ( agent.indexOf('netscape6')==-1) // otherwise is.ns will be true and is.dom too ); this.ns2 = (this.ns && (this.major == 3)); this.ns3 = (this.ns && (this.major == 3)); this.ns4 = (this.ns && (this.major == 4)); this.ie = (agent.indexOf("msie") != -1); if (this.ie) { var regExpr = /msie.?([^;]+)/i; regExpr.exec(agent); this.version = RegExp.$1; this.ie3 = parseInt(this.version) == 2; this.ie4 = parseInt(this.version) == 4; this.ie5 = parseInt(this.version) == 5; this.ie6 = parseInt(this.version) == 6; } this.kon = (agent.indexOf("konqueror") != -1); // returns something like that for agent if it simulates a NS: mozilla/4.73 (windows 98; u) opera 4.02 [en] // if it should be simply itself: opera/4.02 (windows 98; u) [en] // or Opera/5.0 (Linux ...) [en] // and the navigator version is the one which is set in the opera setting, since the opera // can do kinda camouflage to say "i am a NS", so the navVersion cant be used this.op = (agent.indexOf("opera") != -1); if( this.op ) { operaVersion = agent.split("opera"); operaVersion = operaVersion[1]; operaVersion = operaVersion.replace(/\//,''); this.version = operaVersion; this.op3 = (parseInt(operaVersion) == 3); this.op4 = (parseInt(operaVersion) == 4); this.op5 = (parseInt(operaVersion) == 5); this.op7 = (parseInt(operaVersion) == 7); // set all others to false, since it is no other browser, but an opera :-) this.ie = this.ie4 = this.ie3 = false; this.ns = this.ns4 = this.ns3 = this.ns2 = false; this.kon = false; //this.ie4 = true; //alert(operaVersion+" parseint "+parseInt(operaVersion)+"\nop4="+this.op4+" op3="+this.op3+" op5="+this.op5); } if (this.op7) { this.dom = true; } if (agent.indexOf("gecko")!=-1) { this.moz = true; var regExpr = /.*(\d.\d)\) gecko.*/i; regExpr.exec(agent); this.version = RegExp.$1; } // netscape 6 PR3 returns something like this for agent: mozilla/5.0 (windows; u; win98; en-us; m18) gecko/20000929 netscape6/6.03b // the version: 5.0 (Windows; en-us) this.dom = (agent.indexOf("netscape6") != -1) || (agent.indexOf("gecko") != -1) || (agent.indexOf("konqueror/2.") != -1) || this.op || (this.ie && this.version>4); //opera doesnt really get it //if(this.dom) alert("cool a domable browser"); else alert("not domable :-("); } /** * hides
" + weekString + ""+ dayName[i]+"
" + WeekNbr(startDate) + "  " var sStyle="normal-day-style"; //regular day if ((datePointer==dateNow)&&(monthSelected==monthNow)&&(yearSelected==yearNow)) //today { sStyle = "current-day-style"; } else if (dayPointer % 7 == (startAt * -1) +1 || //end-of-the-week day dayPointer % 7 == (startAt * -1) +7 ) // for us saturday is weekend too :-) { sStyle = "end-of-weekday-style"; } if ((datePointer==odateSelected) && (monthSelected==omonthSelected) && (yearSelected==oyearSelected)) { sStyle += " selected-day-style"; } sHint = "" sLink = "" for (k=0;k0 && sLink!="#") sHTML += "" + datePointer + " "; else sHTML += "" + datePointer + " "; sHTML += "" if ((dayPointer+startAt) % 7 == startAt) { sHTML += "