/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ /** * @class The Yahoo global namespace */ var YAHOO = function() { return { /** * Yahoo presentation platform utils namespace */ util: {}, /** * Yahoo presentation platform widgets namespace */ widget: {}, /** * Yahoo presentation platform examples namespace */ example: {}, /** * Returns the namespace specified and creates it if it doesn't exist * * YAHOO.namespace("property.package"); * YAHOO.namespace("YAHOO.property.package"); * * Either of the above would create YAHOO.property, then * YAHOO.property.package * * @param {String} sNameSpace String representation of the desired * namespace * @return {Object} A reference to the namespace object */ namespace: function( sNameSpace ) { if (!sNameSpace || !sNameSpace.length) { return null; } var levels = sNameSpace.split("."); var currentNS = YAHOO; // YAHOO is implied, so it is ignored if it is included for (var i=(levels[0] == "YAHOO") ? 1 : 0; i=0){cacheItem=listeners[index];} if(!el||!cacheItem){return false;} if(el.removeEventListener){el.removeEventListener(sType,cacheItem[this.WFN],false);}else if(el.detachEvent){el.detachEvent("on"+sType,cacheItem[this.WFN]);} delete listeners[index][this.WFN];delete listeners[index][this.FN];delete listeners[index];return true;},getTarget:function(ev,resolveTextNode){var t=ev.target||ev.srcElement;if(resolveTextNode&&t&&"#text"==t.nodeName){return t.parentNode;}else{return t;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}} return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}} return y;},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else if(ev.type=="mouseover"){t=ev.fromElement;}} return t;},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(e){return t;}} return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;} c=c.caller;}} return ev;},getCharCode:function(ev){return ev.charCode||(ev.type=="keypress")?ev.keyCode:0;},_getCacheIndex:function(el,sType,fn){for(var i=0;i0){for(i=0;i11){while(newMonth>11) {newMonth-=12;years+=1;}} d.setMonth(newMonth);d.setFullYear(date.getFullYear()+years);break;case this.DAY:d.setDate(date.getDate()+amount);break;case this.YEAR:d.setFullYear(date.getFullYear()+amount);break;case this.WEEK:d.setDate(date.getDate()+7);break;} return d;};this.subtract=function(date,field,amount){return this.add(date,field,(amount*-1));};this.before=function(date,compareTo){var ms=compareTo.getTime();if(date.getTime()ms){return true;}else{return false;}};this.getJan1=function(calendarYear){return new Date(calendarYear,0,1);};this.getDayOffset=function(date,calendarYear){var beginYear=this.getJan1(calendarYear);var dayOffset=Math.ceil((date.getTime()-beginYear.getTime())/this.ONE_DAY_MS);return dayOffset;};this.getWeekNumber=function(date,calendarYear,weekStartsOn){if(!weekStartsOn){weekStartsOn=0;} if(!calendarYear){calendarYear=date.getFullYear();} var weekNum=-1;var jan1=this.getJan1(calendarYear);var jan1DayOfWeek=jan1.getDay();var month=date.getMonth();var day=date.getDate();var year=date.getFullYear();var dayOffset=this.getDayOffset(date,calendarYear);if(dayOffset<0&&dayOffset>=(-1*jan1DayOfWeek)){weekNum=1;}else{weekNum=1;var testDate=this.getJan1(calendarYear);while(testDate.getTime()0) {this.init(id,containerId,monthyear,selected);}} YAHOO.widget.Calendar_Core.DATE="D";YAHOO.widget.Calendar_Core.MONTH_DAY="MD";YAHOO.widget.Calendar_Core.WEEKDAY="WD";YAHOO.widget.Calendar_Core.RANGE="R";YAHOO.widget.Calendar_Core.MONTH="M";YAHOO.widget.Calendar_Core.DISPLAY_DAYS=42;YAHOO.widget.Calendar_Core.STOP_RENDER="S";YAHOO.widget.Calendar_Core.prototype={Config:null,parent:null,index:-1,cells:null,weekHeaderCells:null,weekFooterCells:null,cellDates:null,id:null,oDomContainer:null,today:null,renderStack:null,_renderStack:null,pageDate:null,_pageDate:null,minDate:null,maxDate:null,selectedDates:null,_selectedDates:null,shellRendered:false,table:null,headerCell:null};YAHOO.widget.Calendar_Core.prototype.init=function(id,containerId,monthyear,selected){this.setupConfig();this.id=id;this.cellDates=new Array();this.cells=new Array();this.renderStack=new Array();this._renderStack=new Array();this.oDomContainer=document.getElementById(containerId);this.today=new Date();YAHOO.widget.DateMath.clearTime(this.today);var month;var year;if(monthyear) {var aMonthYear=monthyear.split(this.Locale.DATE_FIELD_DELIMITER);month=parseInt(aMonthYear[this.Locale.MY_MONTH_POSITION-1]);year=parseInt(aMonthYear[this.Locale.MY_YEAR_POSITION-1]);}else{month=this.today.getMonth()+1;year=this.today.getFullYear();} this.pageDate=new Date(year,month-1,1);this._pageDate=new Date(this.pageDate.getTime());if(selected) {this.selectedDates=this._parseDates(selected);this._selectedDates=this.selectedDates.concat();}else{this.selectedDates=new Array();this._selectedDates=new Array();} this.wireDefaultEvents();this.wireCustomEvents();};YAHOO.widget.Calendar_Core.prototype.wireDefaultEvents=function(){this.doSelectCell=function(e,cal){var cell=this;var index=cell.index;if(cal.Options.MULTI_SELECT){var link=cell.getElementsByTagName("A")[0];link.blur();var cellDate=cal.cellDates[index];var cellDateIndex=cal._indexOfSelectedFieldArray(cellDate);if(cellDateIndex>-1) {cal.deselectCell(index);}else{cal.selectCell(index);}}else{var link=cell.getElementsByTagName("A")[0];link.blur() cal.selectCell(index);}} this.doCellMouseOver=function(e,cal){YAHOO.widget.Calendar_Core.prependCssClass(this,cal.Style.CSS_CELL_HOVER);} this.doCellMouseOut=function(e,cal){YAHOO.widget.Calendar_Core.removeCssClass(this,cal.Style.CSS_CELL_HOVER);} this.doNextMonth=function(e,cal){cal.nextMonth();} this.doPreviousMonth=function(e,cal){cal.previousMonth();}} YAHOO.widget.Calendar_Core.prototype.wireCustomEvents=function(){} YAHOO.widget.Calendar_Core.prototype.setupConfig=function(){this.Config=new Object();this.Config.Style={CSS_ROW_HEADER:"calrowhead",CSS_ROW_FOOTER:"calrowfoot",CSS_CELL:"calcell",CSS_CELL_SELECTED:"selected",CSS_CELL_RESTRICTED:"restricted",CSS_CELL_TODAY:"today",CSS_CELL_OOM:"oom",CSS_HEADER:"calheader",CSS_HEADER_TEXT:"calhead",CSS_WEEKDAY_CELL:"calweekdaycell",CSS_WEEKDAY_ROW:"calweekdayrow",CSS_FOOTER:"calfoot",CSS_CALENDAR:"calendar",CSS_BORDER:"calbordered",CSS_CONTAINER:"calcontainer",CSS_NAV_LEFT:"calnavleft",CSS_NAV_RIGHT:"calnavright",CSS_CELL_TOP:"calcelltop",CSS_CELL_LEFT:"calcellleft",CSS_CELL_RIGHT:"calcellright",CSS_CELL_BOTTOM:"calcellbottom",CSS_CELL_HOVER:"calcellhover",CSS_CELL_HIGHLIGHT1:"highlight1",CSS_CELL_HIGHLIGHT2:"highlight2",CSS_CELL_HIGHLIGHT3:"highlight3",CSS_CELL_HIGHLIGHT4:"highlight4"};this.Style=this.Config.Style;this.Config.Locale={MONTHS_SHORT:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],MONTHS_LONG:["January","February","March","April","May","June","July","August","September","October","November","December"],WEEKDAYS_1CHAR:["S","M","T","W","T","F","S"],WEEKDAYS_SHORT:["Su","Mo","Tu","We","Th","Fr","Sa"],WEEKDAYS_MEDIUM:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],WEEKDAYS_LONG:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],DATE_DELIMITER:",",DATE_FIELD_DELIMITER:"/",DATE_RANGE_DELIMITER:"-",MY_MONTH_POSITION:1,MY_YEAR_POSITION:2,MD_MONTH_POSITION:1,MD_DAY_POSITION:2,MDY_MONTH_POSITION:1,MDY_DAY_POSITION:2,MDY_YEAR_POSITION:3};this.Locale=this.Config.Locale;this.Config.Options={MULTI_SELECT:false,SHOW_WEEKDAYS:true,START_WEEKDAY:0,SHOW_WEEK_HEADER:false,SHOW_WEEK_FOOTER:false,HIDE_BLANK_WEEKS:false,NAV_ARROW_LEFT:"/image/callt.gif",NAV_ARROW_RIGHT:"/image/calrt.gif"};this.Options=this.Config.Options;this.customConfig();if(!this.Options.LOCALE_MONTHS){this.Options.LOCALE_MONTHS=this.Locale.MONTHS_LONG;} if(!this.Options.LOCALE_WEEKDAYS){this.Options.LOCALE_WEEKDAYS=this.Locale.WEEKDAYS_SHORT;} if(this.Options.START_WEEKDAY>0) {for(var w=0;w0){this.preMonthDays-=this.Options.START_WEEKDAY;} if(this.preMonthDays<0){this.preMonthDays+=7;} this.monthDays=YAHOO.widget.DateMath.findMonthEnd(workingDate).getDate();this.postMonthDays=YAHOO.widget.Calendar_Core.DISPLAY_DAYS-this.preMonthDays-this.monthDays;workingDate=YAHOO.widget.DateMath.subtract(workingDate,YAHOO.widget.DateMath.DAY,this.preMonthDays);this.table.style.visibility="hidden";var weekRowIndex=0;for(var c=0;c=d1.getTime()&&workingDate.getTime()<=d2.getTime()) {renderer=rArray[2];if(workingDate.getTime()==d2.getTime()){this.renderStack.splice(r,1);}} break;case YAHOO.widget.Calendar_Core.WEEKDAY:var weekday=rArray[1][0];if(workingDate.getDay()+1==weekday) {renderer=rArray[2];} break;case YAHOO.widget.Calendar_Core.MONTH:month=rArray[1][0];if(workingDate.getMonth()+1==month) {renderer=rArray[2];} break;} if(renderer){cellRenderers[cellRenderers.length]=renderer;}}} if(this._indexOfSelectedFieldArray([workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()])>-1) {cellRenderers[cellRenderers.length]=this.renderCellStyleSelected;} if(this.minDate) {this.minDate=YAHOO.widget.DateMath.clearTime(this.minDate);} if(this.maxDate) {this.maxDate=YAHOO.widget.DateMath.clearTime(this.maxDate);} if((this.minDate&&(workingDate.getTime()this.maxDate.getTime()))){cellRenderers[cellRenderers.length]=this.renderOutOfBoundsDate;}else{cellRenderers[cellRenderers.length]=this.renderCellDefault;} for(var x=0;x=0&&c<=6){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_TOP);} if((c%7)==0){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_LEFT);} if(((c+1)%7)==0){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_RIGHT);} var postDays=this.postMonthDays;if(postDays>=7&&this.Options.HIDE_BLANK_WEEKS){var blankWeeks=Math.floor(postDays/7);for(var p=0;p=((this.preMonthDays+postDays+this.monthDays)-7)){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_BOTTOM);}} this.table.style.visibility="visible";};YAHOO.widget.Calendar_Core.prototype.renderFooter=function(){};YAHOO.widget.Calendar_Core.prototype._unload=function(e,cal){for(var c in cal.cells){c=null;} cal.cells=null;cal.tbody=null;cal.oDomContainer=null;cal.table=null;cal.headerCell=null;cal=null;};YAHOO.widget.Calendar_Core.prototype.renderOutOfBoundsDate=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,"previous");cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar_Core.STOP_RENDER;} YAHOO.widget.Calendar_Core.prototype.renderRowHeader=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_ROW_HEADER);var useYear=this.pageDate.getFullYear();if(!YAHOO.widget.DateMath.isYearOverlapWeek(workingDate)){useYear=workingDate.getFullYear();} var weekNum=YAHOO.widget.DateMath.getWeekNumber(workingDate,useYear,this.Options.START_WEEKDAY);cell.innerHTML=weekNum;if(this.isDateOOM(workingDate)&&!YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_OOM);}};YAHOO.widget.Calendar_Core.prototype.renderRowFooter=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_ROW_FOOTER);if(this.isDateOOM(workingDate)&&!YAHOO.widget.DateMath.isMonthOverlapWeek(workingDate)){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_OOM);}};YAHOO.widget.Calendar_Core.prototype.renderCellDefault=function(workingDate,cell){cell.innerHTML="";var link=document.createElement("a");link.href="javascript:void(null);";link.name=this.id+"__"+workingDate.getFullYear()+"_"+(workingDate.getMonth()+1)+"_"+workingDate.getDate();YAHOO.util.Event.addListener(cell,"click",this.doSelectCell,this);if(YAHOO.widget.Calendar_Core._getBrowser()=="ie"){YAHOO.util.Event.addListener(cell,"mouseover",this.doCellMouseOver,this);YAHOO.util.Event.addListener(cell,"mouseout",this.doCellMouseOut,this);} link.appendChild(document.createTextNode(this.buildDayLabel(workingDate)));cell.appendChild(link);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight1=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_HIGHLIGHT1);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight2=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_HIGHLIGHT2);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight3=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_HIGHLIGHT3);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleHighlight4=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_HIGHLIGHT4);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleToday=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_TODAY);};YAHOO.widget.Calendar_Core.prototype.renderCellStyleSelected=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_SELECTED);};YAHOO.widget.Calendar_Core.prototype.renderCellNotThisMonth=function(workingDate,cell){YAHOO.widget.Calendar_Core.addCssClass(cell,this.Style.CSS_CELL_OOM);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar_Core.STOP_RENDER;};YAHOO.widget.Calendar_Core.prototype.renderBodyCellRestricted=function(workingDate,cell){YAHOO.widget.Calendar_Core.setCssClasses(cell,[this.Style.CSS_CELL,this.Style.CSS_CELL_RESTRICTED]);cell.innerHTML=workingDate.getDate();return YAHOO.widget.Calendar_Core.STOP_RENDER;};YAHOO.widget.Calendar_Core.prototype.addMonths=function(count){this.pageDate=YAHOO.widget.DateMath.add(this.pageDate,YAHOO.widget.DateMath.MONTH,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.subtractMonths=function(count){this.pageDate=YAHOO.widget.DateMath.subtract(this.pageDate,YAHOO.widget.DateMath.MONTH,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.addYears=function(count){this.pageDate=YAHOO.widget.DateMath.add(this.pageDate,YAHOO.widget.DateMath.YEAR,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.subtractYears=function(count){this.pageDate=YAHOO.widget.DateMath.subtract(this.pageDate,YAHOO.widget.DateMath.YEAR,count);this.resetRenderers();this.onChangePage();};YAHOO.widget.Calendar_Core.prototype.nextMonth=function(){this.addMonths(1);};YAHOO.widget.Calendar_Core.prototype.previousMonth=function(){this.subtractMonths(1);};YAHOO.widget.Calendar_Core.prototype.nextYear=function(){this.addYears(1);};YAHOO.widget.Calendar_Core.prototype.previousYear=function(){this.subtractYears(1);};YAHOO.widget.Calendar_Core.prototype.reset=function(){this.selectedDates.length=0;this.selectedDates=this._selectedDates.concat();this.pageDate=new Date(this._pageDate.getTime());this.onReset();};YAHOO.widget.Calendar_Core.prototype.clear=function(){this.selectedDates.length=0;this.pageDate=new Date(this.today.getTime());this.onClear();};YAHOO.widget.Calendar_Core.prototype.select=function(date){this.onBeforeSelect();var aToBeSelected=this._toFieldArray(date);for(var a=0;a-1) {if(this.pageDate.getMonth()==dCellDate.getMonth()&&this.pageDate.getFullYear()==dCellDate.getFullYear()) {YAHOO.widget.Calendar_Core.removeCssClass(cell,this.Style.CSS_CELL_SELECTED);} this.selectedDates.splice(cellDateIndex,1);} if(this.parent){this.parent.sync(this);} this.onDeselect();return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype.deselectAll=function(){this.onBeforeDeselect();var count=this.selectedDates.length;this.selectedDates.length=0;if(this.parent){this.parent.sync(this);} if(count>0){this.onDeselect();} return this.getSelectedDates();};YAHOO.widget.Calendar_Core.prototype._toFieldArray=function(date){var returnDate=new Array();if(date instanceof Date) {returnDate=[[date.getFullYear(),date.getMonth()+1,date.getDate()]];} else if(typeof date=='string') {returnDate=this._parseDates(date);} else if(date instanceof Array) {for(var i=0;i0) {this.init(pageCount,id,containerId,monthyear,selected);}} YAHOO.widget.CalendarGroup.prototype.init=function(pageCount,id,containerId,monthyear,selected){this.id=id;this.selectedDates=new Array();this.containerId=containerId;this.pageCount=pageCount;this.pages=new Array();for(var p=0;p0) {year+=1;} cal.setYear(year);}};YAHOO.widget.CalendarGroup.prototype.render=function(){for(var p=0;p=0;--p) {var cal=this.pages[p];cal.previousMonth();}};YAHOO.widget.CalendarGroup.prototype.nextYear=function(){for(var p=0;p0) {this.init(id,containerId,monthyear,selected);}} YAHOO.widget.Calendar.prototype=new YAHOO.widget.Calendar_Core();YAHOO.widget.Calendar.prototype.buildShell=function(){this.border=document.createElement("DIV");this.border.className=this.Style.CSS_BORDER;this.table=document.createElement("TABLE");this.table.cellSpacing=0;YAHOO.widget.Calendar_Core.setCssClasses(this.table,[this.Style.CSS_CALENDAR]);this.border.id=this.id;this.buildShellHeader();this.buildShellBody();this.buildShellFooter();};YAHOO.widget.Calendar.prototype.renderShell=function(){this.border.appendChild(this.table);this.oDomContainer.appendChild(this.border);this.shellRendered=true;};YAHOO.widget.Calendar.prototype.renderHeader=function(){this.headerCell.innerHTML="";var headerContainer=document.createElement("DIV");headerContainer.className=this.Style.CSS_HEADER;var linkLeft=document.createElement("A");linkLeft.href="javascript:"+this.id+".previousMonth()";var imgLeft=document.createElement("IMG");imgLeft.src=this.Options.NAV_ARROW_LEFT;imgLeft.className=this.Style.CSS_NAV_LEFT;linkLeft.appendChild(imgLeft);var linkRight=document.createElement("A");linkRight.href="javascript:"+this.id+".nextMonth()";var imgRight=document.createElement("IMG");imgRight.src=this.Options.NAV_ARROW_RIGHT;imgRight.className=this.Style.CSS_NAV_RIGHT;linkRight.appendChild(imgRight);headerContainer.appendChild(linkLeft);headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));headerContainer.appendChild(linkRight);this.headerCell.appendChild(headerContainer);};YAHOO.widget.Cal=YAHOO.widget.Calendar;YAHOO.namespace("YAHOO.widget");YAHOO.widget.Calendar2up_Cal=function(id,containerId,monthyear,selected){if(arguments.length>0) {this.init(id,containerId,monthyear,selected);}} YAHOO.widget.Calendar2up_Cal.prototype=new YAHOO.widget.Calendar_Core();YAHOO.widget.Calendar2up_Cal.prototype.renderHeader=function(){this.headerCell.innerHTML="";var headerContainer=document.createElement("DIV");headerContainer.className=this.Style.CSS_HEADER;if(this.index==0){var linkLeft=document.createElement("A");linkLeft.href="javascript:void(null)";YAHOO.util.Event.addListener(linkLeft,"click",this.parent.doPreviousMonth,this.parent);var imgLeft=document.createElement("IMG");imgLeft.src=this.Options.NAV_ARROW_LEFT;imgLeft.className=this.Style.CSS_NAV_LEFT;linkLeft.appendChild(imgLeft);headerContainer.appendChild(linkLeft);} headerContainer.appendChild(document.createTextNode(this.buildMonthLabel()));if(this.index==1){var linkRight=document.createElement("A");linkRight.href="javascript:void(null)";YAHOO.util.Event.addListener(linkRight,"click",this.parent.doNextMonth,this.parent);var imgRight=document.createElement("IMG");imgRight.src=this.Options.NAV_ARROW_RIGHT;imgRight.className=this.Style.CSS_NAV_RIGHT;linkRight.appendChild(imgRight);headerContainer.appendChild(linkRight);} this.headerCell.appendChild(headerContainer);};YAHOO.widget.Calendar2up=function(id,containerId,monthyear,selected){if(arguments.length>0) {this.buildWrapper(containerId);this.init(2,id,containerId,monthyear,selected);}} YAHOO.widget.Calendar2up.prototype=new YAHOO.widget.CalendarGroup();YAHOO.widget.Calendar2up.prototype.constructChild=function(id,containerId,monthyear,selected){var cal=new YAHOO.widget.Calendar2up_Cal(id,containerId,monthyear,selected);return cal;};YAHOO.widget.Calendar2up.prototype.buildWrapper=function(containerId){var outerContainer=document.getElementById(containerId);outerContainer.className="calcontainer";var innerContainer=document.createElement("DIV");innerContainer.className="calbordered";innerContainer.id=containerId+"_inner";var cal1Container=document.createElement("DIV");cal1Container.id=containerId+"_0";cal1Container.className="cal2up";cal1Container.style.marginRight="10px";var cal2Container=document.createElement("DIV");cal2Container.id=containerId+"_1";cal2Container.className="cal2up";outerContainer.appendChild(innerContainer);innerContainer.appendChild(cal1Container);innerContainer.appendChild(cal2Container);this.innerContainer=innerContainer;this.outerContainer=outerContainer;} YAHOO.widget.Calendar2up.prototype.render=function(){this.renderHeader();YAHOO.widget.CalendarGroup.prototype.render.call(this);this.renderFooter();};YAHOO.widget.Calendar2up.prototype.renderHeader=function(){if(!this.title){this.title="";} if(!this.titleDiv) {this.titleDiv=document.createElement("DIV");if(this.title=="") {this.titleDiv.style.display="none";}} this.titleDiv.className="title";this.titleDiv.innerHTML=this.title;if(this.outerContainer.style.position=="absolute") {var linkClose=document.createElement("A");linkClose.href="javascript:void(null)";YAHOO.util.Event.addListener(linkClose,"click",this.hide,this);var imgClose=document.createElement("IMG");imgClose.src="/image/calx.gif";imgClose.className="close-icon";linkClose.appendChild(imgClose);this.linkClose=linkClose;this.titleDiv.appendChild(linkClose);} this.innerContainer.insertBefore(this.titleDiv,this.innerContainer.firstChild);} YAHOO.widget.Calendar2up.prototype.hide=function(e,cal){if(!cal) {cal=this;} cal.outerContainer.style.display="none";} YAHOO.widget.Calendar2up.prototype.renderFooter=function(){} YAHOO.widget.Cal2up=YAHOO.widget.Calendar2up; // CALENDAR YAHOO.widget.Calendar2up_DE_Cal = function(id, containerId, monthyear, selected) { if (arguments.length > 0) { this.init(id, containerId, monthyear, selected); } } YAHOO.widget.Calendar2up_DE_Cal.prototype = new YAHOO.widget.Calendar2up_Cal(); YAHOO.widget.Calendar2up_DE_Cal.prototype.customConfig = function() { this.Config.Locale.MONTHS_SHORT = ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]; this.Config.Locale.MONTHS_LONG = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]; this.Config.Locale.WEEKDAYS_1CHAR = ["S", "M", "D", "M", "D", "F", "S"]; this.Config.Locale.WEEKDAYS_SHORT = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]; this.Config.Locale.WEEKDAYS_MEDIUM = ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam"]; this.Config.Locale.WEEKDAYS_LONG = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]; this.Config.Options.START_WEEKDAY = 1; } /*************************************/ YAHOO.widget.Calendar2up_DE = function(id, containerId, monthyear, selected) { if (arguments.length > 0) { this.buildWrapper(containerId); this.init(2, id, containerId, monthyear, selected); } } YAHOO.widget.Calendar2up_DE.prototype = new YAHOO.widget.Calendar2up(); YAHOO.widget.Calendar2up_DE.prototype.constructChild = function(id,containerId,monthyear,selected) { var cal = new YAHOO.widget.Calendar2up_DE_Cal(id,containerId,monthyear,selected); return cal; }; /*************************************/ var cal1; var cal2; function init() { this.today = new Date(); var thisMonth = this.today.getMonth(); var thisDay = this.today.getDate(); var thisYear = this.today.getFullYear(); this.link1 = document.getElementById('dateLink1'); this.link2 = document.getElementById('dateLink2'); this.selMonth1 = document.getElementById('selMonth1'); this.selDay1 = document.getElementById('selDay1'); //this.selMonth1.selectedIndex = thisMonth; //this.selDay1.selectedIndex = thisDay-1; this.selMonth2 = document.getElementById('selMonth2'); this.selDay2 = document.getElementById('selDay2'); //this.selMonth2.selectedIndex = thisMonth; //this.selDay2.selectedIndex = thisDay-1; cal1 = new YAHOO.widget.Calendar2up_DE("cal1","container1",(thisMonth+1)+"/"+thisYear,(thisMonth+1)+"/"+thisDay+"/"+thisYear); cal1.setChildFunction("onSelect",setDate1); cal1.title = "Wählen Sie Ihren 1. Miettag:"; //cal1.addRenderer("1/1,1/6,5/1,8/15,10/3,10/31,12/25,12/26", cal1.pages[0].renderCellStyleHighlight1); cal1.minDate = YAHOO.widget.DateMath.add(new Date(), YAHOO.widget.DateMath.DAY, 1); cal1.render(); cal2 = new YAHOO.widget.Calendar2up_DE("cal2","container2",(thisMonth+1)+"/"+thisYear,(thisMonth+1)+"/"+thisDay+"/"+thisYear); cal2.setChildFunction("onSelect",setDate2); cal2.title = "Wählen Sie Ihren letzten Miettag:"; //cal2.addRenderer("1/1,1/6,5/1,8/15,10/3,10/31,12/25,12/26", cal2.renderCellStyleHighlight1); cal2.render(); } function showCalendar1() { cal2.hide(); cal1.outerContainer.style.top = (link1.offsetTop+link1.offsetParent.offsetTop+link1.height-1) + "px"; //"80px" // cal1.outerContainer.style.left = (link1.offsetLeft+link1.offsetParent.offsetLeft +200) + "px"; cal1.outerContainer.style.display='block'; cal1.outerContainer.style.zIndex='100'; } function showCalendar2() { cal1.hide(); cal2.outerContainer.style.top = (link2.offsetTop+link2.offsetParent.offsetTop+link2.height-1) + "px"; // "80px" // cal2.outerContainer.style.left = (link2.offsetLeft+link2.offsetParent.offsetLeft +200) + "px"; cal2.outerContainer.style.display='block'; cal2.outerContainer.style.zIndex='100'; } function showCalendar2XY(xPos,yPos) { cal1.hide(); cal2.outerContainer.style.top = yPos + "px"; cal2.outerContainer.style.left = xPos + "px"; cal2.outerContainer.style.display='block'; cal2.outerContainer.style.zIndex='100'; } function showCalendar1XY(xPos,yPos) { cal2.hide(); cal1.outerContainer.style.top = yPos + "px"; cal1.outerContainer.style.left = xPos + "px"; cal1.outerContainer.style.display='block'; cal1.outerContainer.style.zIndex='100'; } function setDate1() { var date1 = cal1.getSelectedDates()[0]; selMonth1.selectedIndex=date1.getMonth(); selDay1.selectedIndex=date1.getDate()-1; cal1.hide(); } function setDate2() { var date2 = cal2.getSelectedDates()[0]; selMonth2.selectedIndex=date2.getMonth(); selDay2.selectedIndex=date2.getDate()-1; cal2.hide(); } function changeDate1() { var month = this.selMonth1.selectedIndex; var day = this.selDay1.selectedIndex + 1; var year = this.today.getFullYear(); var yearP = new Date(); yearP.setFullYear(document.getElementById('yearP').value); yearP = yearP.getFullYear(); if (month > 6) { year = this.today.getFullYear(); cal1.setYear(year); } else { if (year < yearP) { year++; } cal1.setYear(year); } cal1.select((month+1) + "/" + day + "/" + year); cal1.setMonth(month); cal1.render(); } function changeDate2() { var month = this.selMonth2.selectedIndex; var day = this.selDay2.selectedIndex + 1; var year = this.today.getFullYear(); var yearP = new Date(); yearP.setFullYear(document.getElementById('yearP').value); yearP = yearP.getFullYear(); if (month > 6) { year = this.today.getFullYear(); cal2.setYear(year); } else { if (year < yearP) { year++; } cal2.setYear(year); } cal2.select((month+1) + "/" + day + "/" + year); cal2.setMonth(month); cal2.render(); }