var ytObj;this.today=new Date();var thisMonth=this.today.getMonth();var thisDay=this.today.getDate();var thisYear=this.today.getFullYear();var mnth;var dday;if(thisMonth+1<10){mnth="0"+parseInt(thisMonth+1)}else{mnth=thisMonth+1}if(thisDay<10){dday="0"+parseInt(thisDay)}else{dday=thisDay}var objDate="";function days_between(e,d){var f=1000*60*60*24;var c=e.getTime();var b=d.getTime();var a=Math.abs(c-b);return Math.round(a/f)}function changeReturnDate(e){var a="";if(e=="ddate"){a="rdate"}else{if(e=="Bdate"){a="Brdate"}else{if(e=="cidate"){a="codate"}else{if(e=="popupcid_map"){a="popupcod_map"}else{if(e=="popupcid_r"){a="popupcod_r"}}}}}var d=document.getElementById(e).value;var l=d.split("/");var j=new Date(l[2],l[1]-1,l[0]);j.setHours(12,0,0);if(e=="cidate"){var h=new Date(j.setDate(j.getDate()+2))}else{if(e=="ddate"){if(document.getElementById("outbound").value=="true"){var h=new Date(j.setDate(j.getDate()+7))}else{var h=new Date(j.setDate(j.getDate()+3))}}else{if(e=="Bdate"){var h=new Date(j.setDate(j.getDate()+3))}else{if(e=="popupcid_map"){var h=new Date(j.setDate(j.getDate()+2))}else{if(e=="popupcid_r"){var h=new Date(j.setDate(j.getDate()+2))}}}}}var b=h.getMonth();var f=h.getDate();var c="";var g="";if(parseInt(f)<=9){c="0"+f}else{c=f}if((parseInt(b)+1)<=9){g="0"+(parseInt(b)+1)}else{g=(parseInt(b)+1)}var k=c+"/"+g+"/"+h.getFullYear();if(isNaN(parseInt(f))||isNaN(parseInt(b))){document.getElementById(a).value="dd/mm/yyyy"}else{document.getElementById(a).value=k}}function disablePreviousDates(b){var c="";var a="";if(b=="flight"){c=document.getElementById("rdate").value;a=document.getElementById("ddate").value}else{if(b=="bus"){c=document.getElementById("Brdate").value;a=document.getElementById("Bdate").value}else{if(b=="hotel"){c=document.getElementById("codate").value;a=document.getElementById("cidate").value}else{if(b=="map"){c=document.getElementById("popupcod_map").value;a=document.getElementById("popupcid_map").value}else{if(b=="bbs"){c=document.getElementById("popupcod_r").value;a=document.getElementById("popupcid_r").value}}}}}var g=a.split("/");var e=new Date(g[2],g[1]-1,g[0]);e.setHours(12,0,0);var h=c.split("/");var f=new Date(h[2],h[1]-1,h[0]);var d=days_between(e,this.today);if(objDate=="rdate"||objDate=="Brdate"||objDate=="codate"||objDate=="popupcod_map"||objDate=="popupcod_r"){this.today.setDate(this.today.getDate()+d);if(isNaN(f.getDate())||isNaN(f.getMonth())||isNaN(e.getFullYear())){f=new Date()}document.getElementById("YTContainer").innerHTML="";ytObj=new YATRA.caldoy.Calendar2up("ytObj","YTContainer",(parseInt(f.getMonth())+1)+"/"+f.getFullYear(),parseInt(f.getMonth()+1)+"/"+f.getDate()+"/"+f.getFullYear());ytObj.title=" &nbsp;&nbsp;&nbsp;&nbsp;Select Your Travel  Date &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";ytObj.setChildFunction("onSelect",setDate);ytObj.render()}else{this.today=new Date();if(isNaN(e.getDate())||isNaN(e.getMonth())||isNaN(e.getFullYear())){e=new Date()}document.getElementById("YTContainer").innerHTML="";ytObj=new YATRA.caldoy.Calendar2up("ytObj","YTContainer",(parseInt(e.getMonth())+1)+"/"+e.getFullYear(),parseInt(e.getMonth()+1)+"/"+e.getDate()+"/"+e.getFullYear());ytObj.title=" &nbsp;&nbsp;&nbsp;&nbsp;Select Your Travel  Date &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";ytObj.setChildFunction("onSelect",setDate);ytObj.render()}}function findPosX(a){var b=0;if(a.offsetParent){while(1){b+=a.offsetLeft;if(!a.offsetParent){break}a=a.offsetParent}}else{if(a.x){b+=a.x}}return b}function findPosY(b){var a=0;if(b.offsetParent){while(1){a+=b.offsetTop;if(!b.offsetParent){break}b=b.offsetParent}}else{if(b.y){a+=b.y}}return a}function objCal(a,h,c,j,e){var f=findPosX(document.getElementById(a));var d=findPosY(document.getElementById(a));if(j=="bestbusstay"){ytObj.outerContainer.style.top=d+"px";ytObj.outerContainer.style.left=f-300+"px"}else{ytObj.outerContainer.style.top=d+"px";ytObj.outerContainer.style.left=f+20+"px"}var b=document.getElementById("YTContainer");var g=document.getElementById("framediv");b.style.width="auto";b.style.display="inline";g.style.display="inline";g.style.width=ytObj.outerContainer.offsetWidth;g.style.height=ytObj.outerContainer.offsetHeight;g.style.top=ytObj.outerContainer.offsetTop+280;g.style.left=ytObj.outerContainer.offsetLeft-10;ytObj.outerContainer.style.zIndex=g.style.zIndex+1;ytObj.outerContainer.style.display="block";objDate=h;disablePreviousDates(e)}function setDate(){var b=ytObj.getSelectedDates()[0];var c=b.getMonth()+1;var a=b.getDate();if(c<10){c="0"+c}if(a<10){a="0"+a}document.getElementById(objDate).value=(a)+"/"+c+"/"+b.getFullYear();if(objDate=="ddate"||objDate=="Bdate"||objDate=="cidate"||objDate=="popupcid_map"||objDate=="popupcid_r"){changeReturnDate(objDate)}ytObj.hide();document.getElementById("framediv").style.display="none"}var YATRA=function(){return{util:{},caldoy:{},example:{},namespace:function(c){if(!c||!c.length){return null}var d=c.split(".");var b=YATRA;for(var a=(d[0]=="YATRA")?1:0;a<d.length;++a){b[d[a]]=b[d[a]]||{};b=b[d[a]]}return b}}}();YATRA.util.CustomEvent=function(b,a){this.type=b;this.scope=a||window;this.subscribers=[];if(YATRA.util.Event){YATRA.util.Event.regCE(this)}};YATRA.util.CustomEvent.prototype={subscribe:function(b,c,a){this.subscribers.push(new YATRA.util.Subscriber(b,c,a))},unsubscribe:function(c,e){var d=false;for(var a=0;a<this.subscribers.length;++a){var b=this.subscribers[a];if(b&&b.contains(c,e)){this._delete(a);d=true}}return d},fire:function(){for(var a=0;a<this.subscribers.length;++a){var c=this.subscribers[a];if(c){var b=(c.override)?c.obj:this.scope;c.fn.call(b,this.type,arguments,c.obj)}}},unsubscribeAll:function(){for(var a=0;a<this.subscribers.length;++a){this._delete(a)}},_delete:function(a){var b=this.subscribers[a];if(b){delete b.fn;delete b.obj}delete this.subscribers[a]}};YATRA.util.Subscriber=function(b,c,a){this.fn=b;this.obj=c||null;this.override=(a)};YATRA.util.Subscriber.prototype.contains=function(a,b){return(this.fn==a&&this.obj==b)};if(!YATRA.util.Event){YATRA.util.Event=function(){var d=false;var e=[];var b=[];var g=[];var c=[];var f=[];var a=[];return{EL:0,TYPE:1,FN:2,WFN:3,SCOPE:3,ADJ_SCOPE:4,isSafari:(navigator.userAgent.match(/safari/gi)),isIE:(!this.isSafari&&navigator.userAgent.match(/msie/gi)),addListener:function(k,h,p,r,j){if(this._isValidCollection(k)){var q=true;for(var n=0;n<k.length;++n){q=(this.on(k[n],h,p,r,j)&&q)}return q}else{if(typeof k=="string"){if(d){k=this.getEl(k)}else{b[b.length]=[k,h,p,r,j];return true}}}if(!k){return false}if("unload"==h&&r!==this){g[g.length]=[k,h,p,r,j];return true}var t=(j)?r:k;var l=function(u){return p.call(t,YATRA.util.Event.getEvent(u),r)};var s=[k,h,p,l,t];var o=e.length;e[o]=s;if(this.useLegacyEvent(k,h)){var m=this.getLegacyIndex(k,h);if(m==-1){m=f.length;f[m]=[k,h,k["on"+h]];a[m]=[];k["on"+h]=function(u){YATRA.util.Event.fireLegacyEvent(YATRA.util.Event.getEvent(u),m)}}a[m].push(o)}else{if(k.addEventListener){k.addEventListener(h,l,false)}else{if(k.attachEvent){k.attachEvent("on"+h,l)}}}return true},fireLegacyEvent:function(o,p){var m=true;var l=a[p];for(i=0;i<l.length;++i){var k=l[i];if(k){var h=e[k];var n=h[this.ADJ_SCOPE];var j=h[this.WFN].call(n,o);m=(m&&j)}}return m},getLegacyIndex:function(k,l){for(var j=0;j<f.length;++j){var h=f[j];if(h&&h[0]==k&&h[1]==l){return j}}return -1},useLegacyEvent:function(h,j){return((!h.addEventListener&&!h.attachEvent)||(j=="click"&&this.isSafari))},removeListener:function(n,o,m){if(typeof n=="string"){n=this.getEl(n)}else{if(this._isValidCollection(n)){var l=true;for(var k=0;k<n.length;++k){l=(this.removeListener(n[k],o,m)&&l)}return l}}var h=null;var j=this._getCacheIndex(n,o,m);if(j>=0){h=e[j]}if(!n||!h){return false}if(n.removeEventListener){n.removeEventListener(o,h[this.WFN],false)}else{if(n.detachEvent){n.detachEvent("on"+o,h[this.WFN])}}delete e[j][this.WFN];delete e[j][this.FN];delete e[j];return true},getTarget:function(k,j){var h=k.target||k.srcElement;if(j&&h&&"#text"==h.nodeName){return h.parentNode}else{return h}},getPageX:function(j){var h=j.pageX;if(!h&&0!==h){h=j.clientX||0;if(this.isIE){h+=this._getScrollLeft()}}return h},getPageY:function(h){var j=h.pageY;if(!j&&0!==j){j=h.clientY||0;if(this.isIE){j+=this._getScrollTop()}}return j},getRelatedTarget:function(j){var h=j.relatedTarget;if(!h){if(j.type=="mouseout"){h=j.toElement}else{if(j.type=="mouseover"){h=j.fromElement}}}return h},getTime:function(j){if(!j.time){var h=new Date().getTime();try{j.time=h}catch(k){return h}}return j.time},stopEvent:function(h){this.stopPropagation(h);this.preventDefault(h)},stopPropagation:function(h){if(h.stopPropagation){h.stopPropagation()}else{h.cancelBubble=true}},preventDefault:function(h){if(h.preventDefault){h.preventDefault()}else{h.returnValue=false}},getEvent:function(j){var h=j||window.event;if(!h){var k=this.getEvent.caller;while(k){h=k.arguments[0];if(h&&Event==h.constructor){break}k=k.caller}}return h},getCharCode:function(h){return h.charCode||(h.type=="keypress")?h.keyCode:0},_getCacheIndex:function(l,m,k){for(var j=0;j<e.length;++j){var h=e[j];if(h&&h[this.FN]==k&&h[this.EL]==l&&h[this.TYPE]==m){return j}}return -1},_isValidCollection:function(h){return(h&&h.length&&typeof h!="string"&&!h.tagName&&!h.alert&&typeof h[0]!="undefined")},elCache:{},getEl:function(h){return document.getElementById(h)},clearCache:function(){for(i in this.elCache){delete this.elCache[i]}},regCE:function(h){c.push(h)},_load:function(h){d=true},_tryPreloadAttach:function(){var k=!d;for(var h=0;h<b.length;++h){var l=b[h];if(l){var j=this.getEl(l[this.EL]);if(j){this.on(j,l[this.TYPE],l[this.FN],l[this.SCOPE],l[this.ADJ_SCOPE]);delete b[h]}}}if(k){setTimeout("YATRA.util.Event._tryPreloadAttach()",50)}},_unload:function(n,m){for(var j=0;j<g.length;++j){var h=g[j];if(h){var k=(h[this.ADJ_SCOPE])?h[this.SCOPE]:window;h[this.FN].call(k,this.getEvent(n),h[this.SCOPE])}}if(e&&e.length>0){for(j=0;j<e.length;++j){h=e[j];if(h){this.removeListener(h[this.EL],h[this.TYPE],h[this.FN])}}this.clearCache()}for(j=0;j<c.length;++j){c[j].unsubscribeAll();delete c[j]}for(j=0;j<f.length;++j){delete f[j][0];delete f[j]}},_getScrollLeft:function(){return this._getScroll()[1]},_getScrollTop:function(){return this._getScroll()[0]},_getScroll:function(){var h=document.documentElement;db=document.body;if(h&&h.scrollTop){return[h.scrollTop,h.scrollLeft]}else{if(db){return[db.scrollTop,db.scrollLeft]}else{return[0,0]}}}}}();YATRA.util.Event.on=YATRA.util.Event.addListener;if(document&&document.body){YATRA.util.Event._load()}else{YATRA.util.Event.on(window,"load",YATRA.util.Event._load,YATRA.util.Event,true)}YATRA.util.Event.on(window,"unload",YATRA.util.Event._unload,YATRA.util.Event,true);YATRA.util.Event._tryPreloadAttach()}YATRA.namespace("YATRA.caldoy");YATRA.caldoy.DateMath=new function(){this.DAY="D";this.WEEK="W";this.YEAR="Y";this.MONTH="M";this.ONE_DAY_MS=1000*60*60*24;this.add=function(a,e,c){var g=new Date(a.getTime());switch(e){case this.MONTH:var f=a.getMonth()+c;var b=0;if(f<0){while(f<0){f+=12;b-=1}}else{if(f>11){while(f>11){f-=12;b+=1}}}g.setMonth(f);g.setFullYear(a.getFullYear()+b);break;case this.DAY:g.setDate(a.getDate()+c);break;case this.YEAR:g.setFullYear(a.getFullYear()+c);break;case this.WEEK:g.setDate(a.getDate()+7);break}return g};this.subtract=function(a,c,b){return this.add(a,c,(b*-1))};this.before=function(c,b){var a=b.getTime();if(c.getTime()<a){return true}else{return false}};this.after=function(c,b){var a=b.getTime();if(c.getTime()>a){return true}else{return false}};this.getJan1=function(a){return new Date(a,0,1)};this.getDayOffset=function(b,d){var c=this.getJan1(d);var a=Math.ceil((b.getTime()-c.getTime())/this.ONE_DAY_MS);return a};this.getWeekNumber=function(b,d,k){if(!k){k=0}if(!d){d=b.getFullYear()}var c=-1;var a=this.getJan1(d);var f=a.getDay();var e=b.getMonth();var h=b.getDate();var g=b.getFullYear();var l=this.getDayOffset(b,d);if(l<0&&l>=(-1*f)){c=1}else{c=1;var j=this.getJan1(d);while(j.getTime()<b.getTime()&&j.getFullYear()==d){c+=1;j=this.add(j,this.WEEK,1)}}return c};this.isYearOverlapWeek=function(a){var c=false;var b=this.add(a,this.DAY,6);if(b.getFullYear()!=a.getFullYear()){c=true}return c};this.isMonthOverlapWeek=function(a){var c=false;var b=this.add(a,this.DAY,6);if(b.getMonth()!=a.getMonth()){c=true}return c};this.findMonthStart=function(a){var b=new Date(a.getFullYear(),a.getMonth(),1);return b};this.findMonthEnd=function(b){var d=this.findMonthStart(b);var c=this.add(d,this.MONTH,1);var a=this.subtract(c,this.DAY,1);return a};this.clearTime=function(a){a.setHours(0,0,0,0);return a}};YATRA.namespace("YATRA.caldoy");YATRA.caldoy.Calendar_Core=function(d,a,c,b){if(arguments.length>0){this.init(d,a,c,b)}};YATRA.caldoy.Calendar_Core.DATE="D";YATRA.caldoy.Calendar_Core.MONTH_DAY="MD";YATRA.caldoy.Calendar_Core.WEEKDAY="WD";YATRA.caldoy.Calendar_Core.RANGE="R";YATRA.caldoy.Calendar_Core.MONTH="M";YATRA.caldoy.Calendar_Core.DISPLAY_DAYS=42;YATRA.caldoy.Calendar_Core.STOP_RENDER="S";YATRA.caldoy.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};YATRA.caldoy.Calendar_Core.prototype.init=function(g,a,e,d){this.setupConfig();this.id=g;this.cellDates=new Array();this.cells=new Array();this.renderStack=new Array();this._renderStack=new Array();this.oDomContainer=document.getElementById(a);this.today=new Date();YATRA.caldoy.DateMath.clearTime(this.today);var f;var c;if(e){var b=e.split(this.Locale.DATE_FIELD_DELIMITER);f=parseInt(b[this.Locale.MY_MONTH_POSITION-1]);c=parseInt(b[this.Locale.MY_YEAR_POSITION-1])}else{f=this.today.getMonth()+1;c=this.today.getFullYear()}this.pageDate=new Date(c,f-1,1);this._pageDate=new Date(this.pageDate.getTime());if(d){this.selectedDates=this._parseDates(d);this._selectedDates=this.selectedDates.concat()}else{this.selectedDates=new Array();this._selectedDates=new Array()}this.wireDefaultEvents();this.wireCustomEvents()};YATRA.caldoy.Calendar_Core.prototype.wireDefaultEvents=function(){this.doSelectCell=function(g,f){var a=this;var c=a.index;if(f.Options.MULTI_SELECT){var d=a.getElementsByTagName("A")[0];d.blur();var h=f.cellDates[c];var b=f._indexOfSelectedFieldArray(h);if(b>-1){f.deselectCell(c)}else{f.selectCell(c)}}else{var d=a.getElementsByTagName("A")[0];d.blur();f.selectCell(c)}};this.doCellMouseOver=function(b,a){YATRA.caldoy.Calendar_Core.prependCssClass(this,a.Style.CSS_CELL_HOVER)};this.doCellMouseOut=function(b,a){YATRA.caldoy.Calendar_Core.removeCssClass(this,a.Style.CSS_CELL_HOVER)};this.doNextMonth=function(b,a){a.nextMonth()};this.doPreviousMonth=function(b,a){a.previousMonth()}};YATRA.caldoy.Calendar_Core.prototype.wireCustomEvents=function(){};YATRA.caldoy.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:"http://img1.yatra.com/YT/YT_common/js/YT_cal/YTlt.gif",NAV_ARROW_RIGHT:"http://img1.yatra.com/YT/YT_common/js/YT_cal/YTrt.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 a=0;a<this.Options.START_WEEKDAY;++a){this.Locale.WEEKDAYS_SHORT.push(this.Locale.WEEKDAYS_SHORT.shift());this.Locale.WEEKDAYS_MEDIUM.push(this.Locale.WEEKDAYS_MEDIUM.shift());this.Locale.WEEKDAYS_LONG.push(this.Locale.WEEKDAYS_LONG.shift())}}};YATRA.caldoy.Calendar_Core.prototype.customConfig=function(){};YATRA.caldoy.Calendar_Core.prototype.buildMonthLabel=function(){var a=this.Options.LOCALE_MONTHS[this.pageDate.getMonth()]+" "+this.pageDate.getFullYear();return a};YATRA.caldoy.Calendar_Core.prototype.buildDayLabel=function(b){var a=b.getDate();return a};YATRA.caldoy.Calendar_Core.prototype.buildShell=function(){this.table=document.createElement("TABLE");this.table.cellSpacing=0;YATRA.caldoy.Calendar_Core.setCssClasses(this.table,[this.Style.CSS_CALENDAR]);this.table.id=this.id;this.buildShellHeader();this.buildShellBody();this.buildShellFooter();YATRA.util.Event.addListener(window,"unload",this._unload,this)};YATRA.caldoy.Calendar_Core.prototype.buildShellHeader=function(){var c=document.createElement("THEAD");var g=document.createElement("TR");var e=document.createElement("TH");var d=7;if(this.Config.Options.SHOW_WEEK_HEADER){this.weekHeaderCells=new Array();d+=1}if(this.Config.Options.SHOW_WEEK_FOOTER){this.weekFooterCells=new Array();d+=1}e.colSpan=d;YATRA.caldoy.Calendar_Core.setCssClasses(e,[this.Style.CSS_HEADER_TEXT]);this.headerCell=e;g.appendChild(e);c.appendChild(g);if(this.Options.SHOW_WEEKDAYS){var f=document.createElement("TR");var h;YATRA.caldoy.Calendar_Core.setCssClasses(f,[this.Style.CSS_WEEKDAY_ROW]);if(this.Config.Options.SHOW_WEEK_HEADER){h=document.createElement("TH");YATRA.caldoy.Calendar_Core.setCssClasses(h,[this.Style.CSS_WEEKDAY_CELL]);f.appendChild(h)}for(var b=0;b<this.Options.LOCALE_WEEKDAYS.length;++b){var a=document.createElement("TH");YATRA.caldoy.Calendar_Core.setCssClasses(a,[this.Style.CSS_WEEKDAY_CELL]);a.innerHTML=this.Options.LOCALE_WEEKDAYS[b];f.appendChild(a)}if(this.Config.Options.SHOW_WEEK_FOOTER){h=document.createElement("TH");YATRA.caldoy.Calendar_Core.setCssClasses(h,[this.Style.CSS_WEEKDAY_CELL]);f.appendChild(h)}c.appendChild(f)}this.table.appendChild(c)};YATRA.caldoy.Calendar_Core.prototype.buildShellBody=function(){this.tbody=document.createElement("TBODY");for(var b=0;b<6;++b){var d=document.createElement("TR");for(var e=0;e<this.headerCell.colSpan;++e){var a;if(this.Config.Options.SHOW_WEEK_HEADER&&e===0){a=document.createElement("TH");this.weekHeaderCells[this.weekHeaderCells.length]=a}else{if(this.Config.Options.SHOW_WEEK_FOOTER&&e==(this.headerCell.colSpan-1)){a=document.createElement("TH");this.weekFooterCells[this.weekFooterCells.length]=a}else{a=document.createElement("TD");this.cells[this.cells.length]=a;YATRA.caldoy.Calendar_Core.setCssClasses(a,[this.Style.CSS_CELL])}}d.appendChild(a)}this.tbody.appendChild(d)}this.table.appendChild(this.tbody)};YATRA.caldoy.Calendar_Core.prototype.buildShellFooter=function(){};YATRA.caldoy.Calendar_Core.prototype.renderShell=function(){this.oDomContainer.appendChild(this.table);this.shellRendered=true};YATRA.caldoy.Calendar_Core.prototype.render=function(){if(!this.shellRendered){this.buildShell();this.renderShell()}this.resetRenderers();this.cellDates.length=0;var a=YATRA.caldoy.DateMath.findMonthStart(this.pageDate);this.renderHeader();this.renderBody(a);this.renderFooter();this.onRender()};YATRA.caldoy.Calendar_Core.prototype.renderHeader=function(){this.headerCell.innerHTML="";var a=document.createElement("DIV");a.className=this.Style.CSS_HEADER;a.appendChild(document.createTextNode(this.buildMonthLabel()));this.headerCell.appendChild(a)};YATRA.caldoy.Calendar_Core.prototype.renderBody=function(h){this.preMonthDays=h.getDay();if(this.Options.START_WEEKDAY>0){this.preMonthDays-=this.Options.START_WEEKDAY}if(this.preMonthDays<0){this.preMonthDays+=7}this.monthDays=YATRA.caldoy.DateMath.findMonthEnd(h).getDate();this.postMonthDays=YATRA.caldoy.Calendar_Core.DISPLAY_DAYS-this.preMonthDays-this.monthDays;h=YATRA.caldoy.DateMath.subtract(h,YATRA.caldoy.DateMath.DAY,this.preMonthDays);this.table.style.visibility="hidden";var e=0;for(var C=0;C<this.cells.length;++C){var B=new Array();var b=this.cells[C];this.clearElement(b);YATRA.util.Event.removeListener(b,"click",this.doSelectCell);if(YATRA.caldoy.Calendar_Core._getBrowser()=="ie"){YATRA.util.Event.removeListener(b,"mouseover",this.doCellMouseOver);YATRA.util.Event.removeListener(b,"mouseout",this.doCellMouseOut)}b.index=C;b.id=this.id+"_cell"+C;this.cellDates[this.cellDates.length]=[h.getFullYear(),h.getMonth()+1,h.getDate()];if(h.getDay()==this.Options.START_WEEKDAY){var a=null;var H=null;if(this.Options.SHOW_WEEK_HEADER){a=this.weekHeaderCells[e];this.clearElement(a)}if(this.Options.SHOW_WEEK_FOOTER){H=this.weekFooterCells[e];this.clearElement(H)}if(this.Options.HIDE_BLANK_WEEKS&&this.isDateOOM(h)&&!YATRA.caldoy.DateMath.isMonthOverlapWeek(h)){continue}else{if(a){this.renderRowHeader(h,a)}if(H){this.renderRowFooter(h,H)}}}var w=null;if(h.getFullYear()==this.today.getFullYear()&&h.getMonth()==this.today.getMonth()&&h.getDate()==this.today.getDate()){B[B.length]=this.renderCellStyleToday}if(this.isDateOOM(h)){B[B.length]=this.renderCellNotThisMonth}else{for(var o=0;o<this.renderStack.length;++o){var q=this.renderStack[o];var g=q[0];var E;var z;var l;switch(g){case YATRA.caldoy.Calendar_Core.DATE:E=q[1][1];z=q[1][2];l=q[1][0];if(h.getMonth()+1==E&&h.getDate()==z&&h.getFullYear()==l){w=q[2];this.renderStack.splice(o,1)}break;case YATRA.caldoy.Calendar_Core.MONTH_DAY:E=q[1][0];z=q[1][1];if(h.getMonth()+1==E&&h.getDate()==z){w=q[2];this.renderStack.splice(o,1)}break;case YATRA.caldoy.Calendar_Core.RANGE:var u=q[1][0];var t=q[1][1];var v=u[1];var y=u[2];var F=u[0];var I=new Date(F,v-1,y);var A=t[1];var D=t[2];var m=t[0];var G=new Date(m,A-1,D);if(h.getTime()>=I.getTime()&&h.getTime()<=G.getTime()){w=q[2];if(h.getTime()==G.getTime()){this.renderStack.splice(o,1)}}break;case YATRA.caldoy.Calendar_Core.WEEKDAY:var f=q[1][0];if(h.getDay()+1==f){w=q[2]}break;case YATRA.caldoy.Calendar_Core.MONTH:E=q[1][0];if(h.getMonth()+1==E){w=q[2]}break}if(w){B[B.length]=w}}}if(this._indexOfSelectedFieldArray([h.getFullYear(),h.getMonth()+1,h.getDate()])>-1){B[B.length]=this.renderCellStyleSelected}if(this.minDate){this.minDate=YATRA.caldoy.DateMath.clearTime(this.minDate)}if(this.maxDate){this.maxDate=YATRA.caldoy.DateMath.clearTime(this.maxDate)}if((this.minDate&&(h.getTime()<this.minDate.getTime()))||(this.maxDate&&(h.getTime()>this.maxDate.getTime()))){B[B.length]=this.renderOutOfBoundsDate}else{B[B.length]=this.renderCellDefault}for(var j=0;j<B.length;++j){var d=B[j];if(d.call(this,h,b)==YATRA.caldoy.Calendar_Core.STOP_RENDER){break}}h=YATRA.caldoy.DateMath.add(h,YATRA.caldoy.DateMath.DAY,1);if(h.getDay()==this.Options.START_WEEKDAY){e+=1}YATRA.caldoy.Calendar_Core.addCssClass(b,this.Style.CSS_CELL);if(C>=0&&C<=6){YATRA.caldoy.Calendar_Core.addCssClass(b,this.Style.CSS_CELL_TOP)}if((C%7)==0){YATRA.caldoy.Calendar_Core.addCssClass(b,this.Style.CSS_CELL_LEFT)}if(((C+1)%7)==0){YATRA.caldoy.Calendar_Core.addCssClass(b,this.Style.CSS_CELL_RIGHT)}var k=this.postMonthDays;if(k>=7&&this.Options.HIDE_BLANK_WEEKS){var n=Math.floor(k/7);for(var s=0;s<n;++s){k-=7}}if(C>=((this.preMonthDays+k+this.monthDays)-7)){YATRA.caldoy.Calendar_Core.addCssClass(b,this.Style.CSS_CELL_BOTTOM)}}this.table.style.visibility="visible"};YATRA.caldoy.Calendar_Core.prototype.renderFooter=function(){};YATRA.caldoy.Calendar_Core.prototype._unload=function(b,a){for(var d in a.cells){d=null}a.cells=null;a.tbody=null;a.oDomContainer=null;a.table=null;a.headerCell=null;a=null};YATRA.caldoy.Calendar_Core.prototype.renderOutOfBoundsDate=function(b,a){YATRA.caldoy.Calendar_Core.addCssClass(a,"previous");a.innerHTML=b.getDate();return YATRA.caldoy.Calendar_Core.STOP_RENDER};YATRA.caldoy.Calendar_Core.prototype.renderRowHeader=function(d,b){YATRA.caldoy.Calendar_Core.addCssClass(b,this.Style.CSS_ROW_HEADER);var a=this.pageDate.getFullYear();if(!YATRA.caldoy.DateMath.isYearOverlapWeek(d)){a=d.getFullYear()}var c=YATRA.caldoy.DateMath.getWeekNumber(d,a,this.Options.START_WEEKDAY);b.innerHTML=c;if(this.isDateOOM(d)&&!YATRA.caldoy.DateMath.isMonthOverlapWeek(d)){YATRA.caldoy.Calendar_Core.addCssClass(b,this.Style.CSS_CELL_OOM)}};YATRA.caldoy.Calendar_Core.prototype.renderRowFooter=function(b,a){YATRA.caldoy.Calendar_Core.addCssClass(a,this.Style.CSS_ROW_FOOTER);if(this.isDateOOM(b)&&!YATRA.caldoy.DateMath.isMonthOverlapWeek(b)){YATRA.caldoy.Calendar_Core.addCssClass(a,this.Style.CSS_CELL_OOM)}};YATRA.caldoy.Calendar_Core.prototype.renderCellDefault=function(c,a){a.innerHTML="";var b=document.createElement("a");b.href="javascript:void(null);";b.name=this.id+"__"+c.getFullYear()+"_"+(c.getMonth()+1)+"_"+c.getDate();YATRA.util.Event.addListener(a,"click",this.doSelectCell,this);if(YATRA.caldoy.Calendar_Core._getBrowser()=="ie"){YATRA.util.Event.addListener(a,"mouseover",this.doCellMouseOver,this);YATRA.util.Event.addListener(a,"mouseout",this.doCellMouseOut,this)}b.appendChild(document.createTextNode(this.buildDayLabel(c)));a.appendChild(b)};YATRA.caldoy.Calendar_Core.prototype.renderCellStyleHighlight1=function(b,a){YATRA.caldoy.Calendar_Core.addCssClass(a,this.Style.CSS_CELL_HIGHLIGHT1)};YATRA.caldoy.Calendar_Core.prototype.renderCellStyleHighlight2=function(b,a){YATRA.caldoy.Calendar_Core.addCssClass(a,this.Style.CSS_CELL_HIGHLIGHT2)};YATRA.caldoy.Calendar_Core.prototype.renderCellStyleHighlight3=function(b,a){YATRA.caldoy.Calendar_Core.addCssClass(a,this.Style.CSS_CELL_HIGHLIGHT3)};YATRA.caldoy.Calendar_Core.prototype.renderCellStyleHighlight4=function(b,a){YATRA.caldoy.Calendar_Core.addCssClass(a,this.Style.CSS_CELL_HIGHLIGHT4)};YATRA.caldoy.Calendar_Core.prototype.renderCellStyleToday=function(b,a){YATRA.caldoy.Calendar_Core.addCssClass(a,this.Style.CSS_CELL_TODAY)};YATRA.caldoy.Calendar_Core.prototype.renderCellStyleSelected=function(b,a){YATRA.caldoy.Calendar_Core.addCssClass(a,this.Style.CSS_CELL_SELECTED)};YATRA.caldoy.Calendar_Core.prototype.renderCellNotThisMonth=function(b,a){YATRA.caldoy.Calendar_Core.addCssClass(a,this.Style.CSS_CELL_OOM);a.innerHTML=b.getDate();return YATRA.caldoy.Calendar_Core.STOP_RENDER};YATRA.caldoy.Calendar_Core.prototype.renderBodyCellRestricted=function(b,a){YATRA.caldoy.Calendar_Core.setCssClasses(a,[this.Style.CSS_CELL,this.Style.CSS_CELL_RESTRICTED]);a.innerHTML=b.getDate();return YATRA.caldoy.Calendar_Core.STOP_RENDER};YATRA.caldoy.Calendar_Core.prototype.addMonths=function(a){this.pageDate=YATRA.caldoy.DateMath.add(this.pageDate,YATRA.caldoy.DateMath.MONTH,a);this.resetRenderers();this.onChangePage()};YATRA.caldoy.Calendar_Core.prototype.subtractMonths=function(a){this.pageDate=YATRA.caldoy.DateMath.subtract(this.pageDate,YATRA.caldoy.DateMath.MONTH,a);this.resetRenderers();this.onChangePage()};YATRA.caldoy.Calendar_Core.prototype.addYears=function(a){this.pageDate=YATRA.caldoy.DateMath.add(this.pageDate,YATRA.caldoy.DateMath.YEAR,a);this.resetRenderers();this.onChangePage()};YATRA.caldoy.Calendar_Core.prototype.subtractYears=function(a){this.pageDate=YATRA.caldoy.DateMath.subtract(this.pageDate,YATRA.caldoy.DateMath.YEAR,a);this.resetRenderers();this.onChangePage()};YATRA.caldoy.Calendar_Core.prototype.nextMonth=function(){this.addMonths(1)};YATRA.caldoy.Calendar_Core.prototype.previousMonth=function(){this.subtractMonths(1)};YATRA.caldoy.Calendar_Core.prototype.nextYear=function(){this.addYears(1)};YATRA.caldoy.Calendar_Core.prototype.previousYear=function(){this.subtractYears(1)};YATRA.caldoy.Calendar_Core.prototype.reset=function(){this.selectedDates.length=0;this.selectedDates=this._selectedDates.concat();this.pageDate=new Date(this._pageDate.getTime());this.onReset()};YATRA.caldoy.Calendar_Core.prototype.clear=function(){this.selectedDates.length=0;this.pageDate=new Date(this.today.getTime());this.onClear()};YATRA.caldoy.Calendar_Core.prototype.select=function(c){this.onBeforeSelect();var e=this._toFieldArray(c);for(var b=0;b<e.length;++b){var d=e[b];if(this._indexOfSelectedFieldArray(d)==-1){this.selectedDates[this.selectedDates.length]=d}}if(this.parent){this.parent.sync(this)}this.onSelect();return this.getSelectedDates()};YATRA.caldoy.Calendar_Core.prototype.selectCell=function(c){this.onBeforeSelect();this.cells=this.tbody.getElementsByTagName("TD");var b=this.cells[c];var e=this.cellDates[c];var d=this._toDate(e);var a=e.concat();this.selectedDates.push(a);if(this.parent){this.parent.sync(this)}this.renderCellStyleSelected(d,b);this.onSelect();this.doCellMouseOut.call(b,null,this);return this.getSelectedDates()};YATRA.caldoy.Calendar_Core.prototype.deselect=function(d){this.onBeforeDeselect();var f=this._toFieldArray(d);for(var b=0;b<f.length;++b){var e=f[b];var c=this._indexOfSelectedFieldArray(e);if(c!=-1){this.selectedDates.splice(c,1)}}if(this.parent){this.parent.sync(this)}this.onDeselect();return this.getSelectedDates()};YATRA.caldoy.Calendar_Core.prototype.deselectCell=function(d){this.onBeforeDeselect();this.cells=this.tbody.getElementsByTagName("TD");var b=this.cells[d];var f=this.cellDates[d];var c=this._indexOfSelectedFieldArray(f);var e=this._toDate(f);var a=f.concat();if(c>-1){if(this.pageDate.getMonth()==e.getMonth()&&this.pageDate.getFullYear()==e.getFullYear()){YATRA.caldoy.Calendar_Core.removeCssClass(b,this.Style.CSS_CELL_SELECTED)}this.selectedDates.splice(c,1)}if(this.parent){this.parent.sync(this)}this.onDeselect();return this.getSelectedDates()};YATRA.caldoy.Calendar_Core.prototype.deselectAll=function(){this.onBeforeDeselect();var a=this.selectedDates.length;this.selectedDates.length=0;if(this.parent){this.parent.sync(this)}if(a>0){this.onDeselect()}return this.getSelectedDates()};YATRA.caldoy.Calendar_Core.prototype._toFieldArray=function(b){var a=new Array();if(b instanceof Date){a=[[b.getFullYear(),b.getMonth()+1,b.getDate()]]}else{if(typeof b=="string"){a=this._parseDates(b)}else{if(b instanceof Array){for(var c=0;c<b.length;++c){var e=b[c];a[a.length]=[e.getFullYear(),e.getMonth()+1,e.getDate()]}}}}return a};YATRA.caldoy.Calendar_Core.prototype._toDate=function(a){if(a instanceof Date){return a}else{return new Date(a[0],a[1]-1,a[2])}};YATRA.caldoy.Calendar_Core.prototype._fieldArraysAreEqual=function(c,b){var a=false;if(c[0]==b[0]&&c[1]==b[1]&&c[2]==b[2]){a=true}return a};YATRA.caldoy.Calendar_Core.prototype._indexOfSelectedFieldArray=function(d){var c=-1;for(var b=0;b<this.selectedDates.length;++b){var a=this.selectedDates[b];if(d[0]==a[0]&&d[1]==a[1]&&d[2]==a[2]){c=b;break}}return c};YATRA.caldoy.Calendar_Core.prototype.isDateOOM=function(a){var b=false;this.today=new Date();if(a.getMonth()!=this.pageDate.getMonth()||(a.getDate()<today.getDate()&&a.getMonth()==today.getMonth()&&a.getFullYear()==today.getFullYear())){b=true}if(a.getFullYear()<today.getFullYear()){b=true}if(a.getFullYear()==today.getFullYear()&&a.getMonth()<today.getMonth()){b=true}if(a.getFullYear()>today.getFullYear()&&a.getMonth()>today.getMonth()){b=true}if(a.getFullYear()>today.getFullYear()&&a.getMonth()>today.getMonth()){if(a.getMonth()==today.getMonth()){if(a.getDate()==today.getDate()){b=true}}}if(a.getFullYear()>today.getFullYear()&&a.getMonth()==today.getMonth()){if(a.getMonth()==today.getMonth()){if(a.getDate()>today.getDate()){b=true}}}return b};YATRA.caldoy.Calendar_Core.prototype.onBeforeSelect=function(){if(!this.Options.MULTI_SELECT){this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);this.deselectAll()}};YATRA.caldoy.Calendar_Core.prototype.onSelect=function(){};YATRA.caldoy.Calendar_Core.prototype.onBeforeDeselect=function(){};YATRA.caldoy.Calendar_Core.prototype.onDeselect=function(){};YATRA.caldoy.Calendar_Core.prototype.onChangePage=function(){this.render()};YATRA.caldoy.Calendar_Core.prototype.onRender=function(){};YATRA.caldoy.Calendar_Core.prototype.onReset=function(){this.render()};YATRA.caldoy.Calendar_Core.prototype.onClear=function(){this.render()};YATRA.caldoy.Calendar_Core.prototype.validate=function(){return true};YATRA.caldoy.Calendar_Core.prototype._parseDate=function(b){var c=b.split(this.Locale.DATE_FIELD_DELIMITER);var a;if(c.length==2){a=[c[this.Locale.MD_MONTH_POSITION-1],c[this.Locale.MD_DAY_POSITION-1]];a.type=YATRA.caldoy.Calendar_Core.MONTH_DAY}else{a=[c[this.Locale.MDY_YEAR_POSITION-1],c[this.Locale.MDY_MONTH_POSITION-1],c[this.Locale.MDY_DAY_POSITION-1]];a.type=YATRA.caldoy.Calendar_Core.DATE}return a};YATRA.caldoy.Calendar_Core.prototype._parseDates=function(b){var k=new Array();var j=b.split(this.Locale.DATE_DELIMITER);for(var h=0;h<j.length;++h){var g=j[h];if(g.indexOf(this.Locale.DATE_RANGE_DELIMITER)!=-1){var a=g.split(this.Locale.DATE_RANGE_DELIMITER);var f=this._parseDate(a[0]);var l=this._parseDate(a[1]);var e=this._parseRange(f,l);k=k.concat(e)}else{var c=this._parseDate(g);k.push(c)}}return k};YATRA.caldoy.Calendar_Core.prototype._parseRange=function(a,f){var e=new Date(a[0],a[1]-1,a[2]);var b=YATRA.caldoy.DateMath.add(new Date(a[0],a[1]-1,a[2]),YATRA.caldoy.DateMath.DAY,1);var d=new Date(f[0],f[1]-1,f[2]);var c=new Array();c.push(a);while(b.getTime()<=d.getTime()){c.push([b.getFullYear(),b.getMonth()+1,b.getDate()]);b=YATRA.caldoy.DateMath.add(b,YATRA.caldoy.DateMath.DAY,1)}return c};YATRA.caldoy.Calendar_Core.prototype.resetRenderers=function(){this.renderStack=this._renderStack.concat()};YATRA.caldoy.Calendar_Core.prototype.clearElement=function(a){a.innerHTML="&nbsp;";a.className=""};YATRA.caldoy.Calendar_Core.prototype.addRenderer=function(a,b){var d=this._parseDates(a);for(var c=0;c<d.length;++c){var e=d[c];if(e.length==2){if(e[0] instanceof Array){this._addRenderer(YATRA.caldoy.Calendar_Core.RANGE,e,b)}else{this._addRenderer(YATRA.caldoy.Calendar_Core.MONTH_DAY,e,b)}}else{if(e.length==3){this._addRenderer(YATRA.caldoy.Calendar_Core.DATE,e,b)}}}};YATRA.caldoy.Calendar_Core.prototype._addRenderer=function(b,c,a){var d=[b,c,a];this.renderStack.unshift(d);this._renderStack=this.renderStack.concat()};YATRA.caldoy.Calendar_Core.prototype.addMonthRenderer=function(b,a){this._addRenderer(YATRA.caldoy.Calendar_Core.MONTH,[b],a)};YATRA.caldoy.Calendar_Core.prototype.addWeekdayRenderer=function(b,a){this._addRenderer(YATRA.caldoy.Calendar_Core.WEEKDAY,[b],a)};YATRA.caldoy.Calendar_Core.addCssClass=function(a,b){if(a.className.length===0){a.className+=b}else{a.className+=" "+b}};YATRA.caldoy.Calendar_Core.prependCssClass=function(a,b){a.className=b+" "+a.className};YATRA.caldoy.Calendar_Core.removeCssClass=function(b,d){var a=b.className.split(" ");for(var c=0;c<a.length;++c){if(a[c]==d){a.splice(c,1);break}}YATRA.caldoy.Calendar_Core.setCssClasses(b,a)};YATRA.caldoy.Calendar_Core.setCssClasses=function(b,a){b.className="";var c=a.join(" ");b.className=c};YATRA.caldoy.Calendar_Core.prototype.clearAllBodyCellStyles=function(a){for(var b=0;b<this.cells.length;++b){YATRA.caldoy.Calendar_Core.removeCssClass(this.cells[b],a)}};YATRA.caldoy.Calendar_Core.prototype.setMonth=function(a){this.pageDate.setMonth(a)};YATRA.caldoy.Calendar_Core.prototype.setYear=function(a){this.pageDate.setFullYear(a)};YATRA.caldoy.Calendar_Core.prototype.getSelectedDates=function(){var b=new Array();for(var e=0;e<this.selectedDates.length;++e){var c=this.selectedDates[e];var a=new Date(c[0],c[1]-1,c[2]);b.push(a)}b.sort();return b};YATRA.caldoy.Calendar_Core._getBrowser=function(){var a=navigator.userAgent.toLowerCase();if(a.indexOf("opera")!=-1){return"opera"}else{if(a.indexOf("msie")!=-1){return"ie"}else{if(a.indexOf("safari")!=-1){return"safari"}else{if(a.indexOf("gecko")!=-1){return"gecko"}else{return false}}}}};YATRA.caldoy.Cal_Core=YATRA.caldoy.Calendar_Core;YATRA.namespace("YATRA.caldoy");YATRA.caldoy.CalendarGroup=function(b,e,a,d,c){if(arguments.length>0){this.init(b,e,a,d,c)}};YATRA.caldoy.CalendarGroup.prototype.init=function(b,g,a,d,c){this.id=g;this.selectedDates=new Array();this.containerId=a;this.pageCount=b;this.pages=new Array();for(var f=0;f<b;++f){var e=this.constructChild(g+"_"+f,this.containerId+"_"+f,d,c);e.parent=this;e.index=f;e.pageDate.setMonth(e.pageDate.getMonth()+f);e._pageDateOrig=new Date(e.pageDate.getFullYear(),e.pageDate.getMonth(),e.pageDate.getDate());this.pages.push(e)}this.doNextMonth=function(j,h){h.nextMonth()};this.doPreviousMonth=function(j,h){h.previousMonth()}};YATRA.caldoy.CalendarGroup.prototype.setChildFunction=function(c,a){for(var b=0;b<this.pageCount;++b){this.pages[b][c]=a}};YATRA.caldoy.CalendarGroup.prototype.callChildFunction=function(e,a){for(var d=0;d<this.pageCount;++d){var c=this.pages[d];if(c[e]){var b=c[e];b.call(c,a)}}};YATRA.caldoy.CalendarGroup.prototype.constructChild=function(d,a,c,b){return new YATRA.caldoy.Calendar_Core(d,a,c,b)};YATRA.caldoy.CalendarGroup.prototype.setMonth=function(c){for(var b=0;b<this.pages.length;++b){var a=this.pages[b];a.setMonth(c+b)}};YATRA.caldoy.CalendarGroup.prototype.setYear=function(a){for(var c=0;c<this.pages.length;++c){var b=this.pages[c];if((b.pageDate.getMonth()+1)==1&&c>0){a+=1}b.setYear(a)}};YATRA.caldoy.CalendarGroup.prototype.render=function(){for(var b=0;b<this.pages.length;++b){var a=this.pages[b];a.render()}};YATRA.caldoy.CalendarGroup.prototype.select=function(b){var a;for(var d=0;d<this.pages.length;++d){var c=this.pages[d];a=c.select(b)}return a};YATRA.caldoy.CalendarGroup.prototype.selectCell=function(b){var a;for(var d=0;d<this.pages.length;++d){var c=this.pages[d];a=c.selectCell(b)}return a};YATRA.caldoy.CalendarGroup.prototype.deselect=function(b){var a;for(var d=0;d<this.pages.length;++d){var c=this.pages[d];a=c.deselect(b)}return a};YATRA.caldoy.CalendarGroup.prototype.deselectAll=function(){var a;for(var c=0;c<this.pages.length;++c){var b=this.pages[c];a=b.deselectAll()}return a};YATRA.caldoy.CalendarGroup.prototype.deselectCell=function(a){for(var c=0;c<this.pages.length;++c){var b=this.pages[c];b.deselectCell(a)}return this.getSelectedDates()};YATRA.caldoy.CalendarGroup.prototype.reset=function(){for(var b=0;b<this.pages.length;++b){var a=this.pages[b];a.reset()}};YATRA.caldoy.CalendarGroup.prototype.clear=function(){for(var b=0;b<this.pages.length;++b){var a=this.pages[b];a.clear()}};YATRA.caldoy.CalendarGroup.prototype.nextMonth=function(){for(var b=0;b<this.pages.length;++b){var a=this.pages[b];a.nextMonth()}};YATRA.caldoy.CalendarGroup.prototype.previousMonth=function(){for(var b=this.pages.length-1;b>=0;--b){var a=this.pages[b];a.previousMonth()}};YATRA.caldoy.CalendarGroup.prototype.nextYear=function(){for(var b=0;b<this.pages.length;++b){var a=this.pages[b];a.nextYear()}};YATRA.caldoy.CalendarGroup.prototype.previousYear=function(){for(var b=0;b<this.pages.length;++b){var a=this.pages[b];a.previousYear()}};YATRA.caldoy.CalendarGroup.prototype.sync=function(b){var d;if(b){this.selectedDates=b.selectedDates.concat()}else{var e=new Object();var f=new Array();for(var a=0;a<this.pages.length;++a){d=this.pages[a];var h=d.selectedDates;for(var j=0;j<h.length;++j){var g=h[j];e[g.toString()]=g}}for(var c in e){f[f.length]=e[c]}this.selectedDates=f.concat()}for(a=0;a<this.pages.length;++a){d=this.pages[a];if(!d.Options.MULTI_SELECT){d.clearAllBodyCellStyles(d.Config.Style.CSS_CELL_SELECTED)}d.selectedDates=this.selectedDates.concat()}return this.getSelectedDates()};YATRA.caldoy.CalendarGroup.prototype.getSelectedDates=function(){var b=new Array();for(var e=0;e<this.selectedDates.length;++e){var c=this.selectedDates[e];var a=new Date(c[0],c[1]-1,c[2]);b.push(a)}b.sort();return b};YATRA.caldoy.CalendarGroup.prototype.addRenderer=function(a,b){for(var d=0;d<this.pages.length;++d){var c=this.pages[d];c.addRenderer(a,b)}};YATRA.caldoy.CalendarGroup.prototype.addMonthRenderer=function(d,a){for(var c=0;c<this.pages.length;++c){var b=this.pages[c];b.addMonthRenderer(d,a)}};YATRA.caldoy.CalendarGroup.prototype.addWeekdayRenderer=function(b,a){for(var d=0;d<this.pages.length;++d){var c=this.pages[d];c.addWeekdayRenderer(b,a)}};YATRA.caldoy.CalendarGroup.prototype.wireEvent=function(a,b){for(var d=0;d<this.pages.length;++d){var c=this.pages[d];c[a]=b}};YATRA.caldoy.CalGrp=YATRA.caldoy.CalendarGroup;YATRA.namespace("YATRA.caldoy");YATRA.caldoy.Calendar=function(d,a,c,b){if(arguments.length>0){this.init(d,a,c,b)}};YATRA.caldoy.Calendar.prototype=new YATRA.caldoy.Calendar_Core();YATRA.caldoy.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;YATRA.caldoy.Calendar_Core.setCssClasses(this.table,[this.Style.CSS_CALENDAR]);this.border.id=this.id;this.buildShellHeader();this.buildShellBody();this.buildShellFooter()};YATRA.caldoy.Calendar.prototype.renderShell=function(){this.border.appendChild(this.table);this.oDomContainer.appendChild(this.border);this.shellRendered=true};YATRA.caldoy.Calendar.prototype.renderHeader=function(){this.headerCell.innerHTML="";var d=document.createElement("DIV");d.className=this.Style.CSS_HEADER;var b=document.createElement("A");b.href="javascript:"+this.id+".previousMonth()";var e=document.createElement("IMG");e.src=this.Options.NAV_ARROW_LEFT;e.className=this.Style.CSS_NAV_LEFT;b.appendChild(e);var c=document.createElement("A");c.href="javascript:"+this.id+".nextMonth()";var a=document.createElement("IMG");a.src=this.Options.NAV_ARROW_RIGHT;a.className=this.Style.CSS_NAV_RIGHT;c.appendChild(a);d.appendChild(b);d.appendChild(document.createTextNode(this.buildMonthLabel()));d.appendChild(c);this.headerCell.appendChild(d)};YATRA.caldoy.Cal=YATRA.caldoy.Calendar;YATRA.namespace("YATRA.caldoy");YATRA.caldoy.Calendar2up_Cal=function(d,a,c,b){if(arguments.length>0){this.init(d,a,c,b)}};YATRA.caldoy.Calendar2up_Cal.prototype=new YATRA.caldoy.Calendar_Core();YATRA.caldoy.Calendar2up_Cal.prototype.renderHeader=function(){this.headerCell.innerHTML="";var d=document.createElement("DIV");d.className=this.Style.CSS_HEADER;if(this.index==0){var b=document.createElement("A");b.href="javascript:void(null)";YATRA.util.Event.addListener(b,"click",this.parent.doPreviousMonth,this.parent);var e=document.createElement("IMG");e.src=this.Options.NAV_ARROW_LEFT;e.className=this.Style.CSS_NAV_LEFT;b.appendChild(e);d.appendChild(b)}d.appendChild(document.createTextNode(this.buildMonthLabel()));if(this.index==1){var c=document.createElement("A");c.href="javascript:void(null)";YATRA.util.Event.addListener(c,"click",this.parent.doNextMonth,this.parent);var a=document.createElement("IMG");a.src=this.Options.NAV_ARROW_RIGHT;a.className=this.Style.CSS_NAV_RIGHT;c.appendChild(a);d.appendChild(c)}this.headerCell.appendChild(d)};YATRA.caldoy.Calendar2up=function(e,a,c,b,d){if(arguments.length>0){this.buildWrapper(a);this.init(2,e,a,c,b)}};YATRA.caldoy.Calendar2up.prototype=new YATRA.caldoy.CalendarGroup();YATRA.caldoy.Calendar2up.prototype.constructChild=function(e,a,c,b){var d=new YATRA.caldoy.Calendar2up_Cal(e,a,c,b);return d};YATRA.caldoy.Calendar2up.prototype.buildWrapper=function(b){var d=document.getElementById(b);d.className="calcontainer";var a=document.createElement("DIV");a.className="calbordered";a.id=b+"_inner";var c=document.createElement("DIV");c.id=b+"_0";c.className="cal2up";c.style.marginRight="7px";var e=document.createElement("DIV");e.id=b+"_1";e.className="cal2up";d.appendChild(a);a.appendChild(c);a.appendChild(e);this.innerContainer=a;this.outerContainer=d};YATRA.caldoy.Calendar2up.prototype.render=function(){this.renderHeader();YATRA.caldoy.CalendarGroup.prototype.render.call(this);this.renderFooter()};YATRA.caldoy.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 b=document.createElement("A");b.href="javascript:void(null)";YATRA.util.Event.addListener(b,"click",this.hide,this);var a=document.createElement("IMG");a.src="http://img1.yatra.com/YT/YT_common/js/YT_cal/close.gif";a.className="close-icon";b.appendChild(a);this.linkClose=b;this.titleDiv.appendChild(b)}this.innerContainer.insertBefore(this.titleDiv,this.innerContainer.firstChild)};YATRA.caldoy.Calendar2up.prototype.hide=function(b,a){if(!a){a=this}a.outerContainer.style.display="none";document.getElementById("framediv").style.display="none";if(typeof(document.getElementById("chage2"))!=undefined&&(document.getElementById("chage2"))){document.getElementById("chage2").style.display=""}if(formtypefl=="FLIGHT"){document.getElementById("class").style.display=""}if(formtype=="HOTELV2POPUP"){if(document.getElementById("Child1_PopupMap")){document.getElementById("Child1_PopupMap").style.display=""}document.getElementById("Child1_PopupCY").style.display="";if(document.getElementById("adzonediv")){document.getElementById("adzonediv").style.display=""}}};YATRA.caldoy.Calendar2up.prototype.renderFooter=function(){};YATRA.caldoy.Cal2up=YATRA.caldoy.Calendar2up;function HideObjects(){if(ytObj){ytObj.hide()}};