PageSourceSearch

https://www.viaworld.in/static/js/utils/fromToCalendar_nw-v29032011.js

js viaworld.in collected 2026-09-26 18:53:05 UTC 5,694 bytes, 38 lines download raw bytes

1
2function to_from_calendar(fromInput,fromDiv,fromDisplayer,toInput,toDiv,toDisplayer,fromInitObj,toInitObj,initOptions){this.hasToCal=(typeof(toInput)!='undefined');this.fromInitObj=(typeof(fromInitObj)=='undefined')?new Object():fromInitObj;this.toInitObj=(typeof(toInitObj)=='undefined')?new Object():toInitObj;this.opts=(typeof(initOptions)=='undefined')?new Object():initOptions;this.fromRenderRequired=true;this.toRenderRequired=true;this.showFromCalendar=function(event,obj){if(typeof(obj)=='undefined')obj=this;if(obj.fromRenderRequired){obj.fromCal.render();obj.fromRenderRequired=false;}
3obj.fromCal.show();if(obj.hasToCal)obj.toCal.hide();}
4if(this.hasToCal)
5this.showToCalendar=function(event,obj){if(obj.toRenderRequired){obj.toCal.render();obj.toRenderRequired=false;}
6this.adjustToDate();obj.fromCal.hide();obj.toCal.show();}
7this.setFromDate=function(str){var date=JS_UTIL.parseDate(str);if(typeof(date)!='undefined'){this.fromCal.select(date);var selMonth=date.getMonth()+1;var selYear=date.getFullYear();this.fromCal.cfg.setProperty("pagedate",selMonth+'/'+selYear);}}
8if(this.hasToCal)
9this.setToDate=function(str){var date=JS_UTIL.parseDate(str);if(typeof(date)!='undefined'){this.toCal.select(date);var selMonth=date.getMonth()+1;var selYear=date.getFullYear();this.toCal.cfg.setProperty("pagedate",selMonth+'/'+selYear);}}
10this.fromDateSelected=function(event,args,obj){this.setFromField();this.fromCal.hide();if(this.hasToCal)this.adjustToDate();}
11if(this.hasToCal)
12this.toDateSelected=function(event,args,obj){this.setToField();this.toCal.hide();this.adjustToDate();}
13if(this.hasToCal)
14this.setToField=function(){var dates=this.toCal.getSelectedDates();if(dates.length==1)
15this.to_field.value=this.formattedDate(dates[0].getDate(),dates[0].getMonth()+1,dates[0].getFullYear());}
16if(this.hasToCal)
17this.adjustToDate=function(){var fromDate=this.fromCal.getSelectedDates()[0];var toDate=this.toCal.getSelectedDates()[0];if(typeof(fromDate)!='undefined'){var selMonth=fromDate.getMonth()+1;var selYear=fromDate.getFullYear();if((fromDate>toDate)||(typeof(toDate)=='undefined')){if(fromDate>toDate)
18this.toCal.select(fromDate);this.toCal.cfg.setProperty("pagedate",selMonth+'/'+selYear);}
19this.toCal.cfg.setProperty("mindate",selMonth+'/'+fromDate.getDate()+'/'+selYear);this.toRenderRequired=true;}}
20this.setFromField=function(){var dates=this.fromCal.getSelectedDates();if(dates.length==1)
21this.from_field.value=this.formattedDate(dates[0].getDate(),dates[0].getMonth()+1,dates[0].getFullYear());}
22this.formattedDate=function(day,month,year){return JS_UTIL.leadingZeros(day,2)+JS_UTIL.dateSeparator+JS_UTIL.leadingZeros(month,2)+JS_UTIL.dateSeparator+JS_UTIL.leadingZeros(year,4);}
23this._setExtraCalOptionsIfNull=function(option,value){if(typeof(this.fromInitObj[option])=='undefined'){this.fromInitObj[option]=value;}
24if((this.hasToCal)&&typeof(this.toInitObj[option])=='undefined'){this.toInitObj[option]=value;}}
25this._setDefaults=function(){var currDate=SERVER_VARS.currentDate;if(typeof(this.opts.mindate)=='undefined'){this.opts.mindate=currDate.getMonth()+1;this.opts.mindate+='/'+currDate.getDate()+'/'+currDate.getFullYear();}
26this.opts.PAGES=(typeof(this.opts.PAGES)=='undefined')?1:this.opts.PAGES;this.opts.iframe=true;}
27this.from_field=fromInput;if(this.hasToCal)
28this.to_field=toInput;this._setDefaults();for(key in this.opts){this._setExtraCalOptionsIfNull(key,this.opts[key]);}
29this.initialized=false;this.initEvent=new YAHOO.util.CustomEvent("fromToCalInit",this);this.initialize=function(){var overrideFromDate,overrideToDate;if(typeof(JS_UTIL.parseDate(this.from_field.value))!='undefined'){overrideFromDate=this.from_field.value;}
30if((this.hasToCal)&&typeof(this.to_field)!='undefined'&&typeof(JS_UTIL.parseDate(this.to_field.value))!='undefined'){overrideToDate=this.to_field.value;}
31this.fromCal=new YAHOO.widget.CalendarGroup(YAHOO.util.Dom.generateId(null,"ft_cal"),fromDiv,this.fromInitObj);if(this.hasToCal)this.toCal=new YAHOO.widget.CalendarGroup(YAHOO.util.Dom.generateId(null,"ft_cal"),toDiv,this.toInitObj);if(this.hasToCal)this.toCal.cfg.setProperty("close",true);this.fromCal.cfg.setProperty("close",true);
31YAHOO.util.Event.addListener(fromDisplayer,"click",this.showFromCalendar,this,true);YAHOO.util.Event.addListener(fromInput,"click",this.showFromCalendar,this,true);YAHOO.util.Event.addListener(fromInput,"focus",this.showFromCalendar,this,true);if(this.hasToCal){YAHOO.util.Event.addListener(toDisplayer,"click",this.showToCalendar,this,true);YAHOO.util.Event.addListener(toInput,"click",this.showToCalendar,this,true);YAHOO.util.Event.addListener(toInput,"focus",this.showToCalendar,this,true);}
32this.fromCal.selectEvent.subscribe(this.fromDateSelected,this,true);if(this.hasToCal)this.toCal.selectEvent.subscribe(this.toDateSelected,this,true);this.setFromField();if(this.hasToCal)this.setToField();this.setFromDate(overrideFromDate);if(this.hasToCal)this.setToDate(overrideToDate);if(YAHOO.lang.trim(this.from_field.value)==''){this.from_field.value='-Select-';}
33if(this.hasToCal&&YAHOO.lang.trim(this.to_field.value)==''){this.to_field.value='-Select-';}
34this.initEvent.fire();this.initialized=true;}
35this.initializeElements=function(){this.cal_Obj.initialize();}
36this.init=function(){var loader=new YAHOO.util.YUILoader({require:["calendar"],skin:{defaultSkin:''},base:'/static/js/yui/2_5_1/',onSuccess:this.initializeElements,loadOptional:false,moduleInfo:{'calendar':{'type':'js','path':'calendar/calendar-min.js','requires':['event','dom'],supersedes:['datemeth'],'skinnable':false}},onFailure:function(o){alert("error: "+YAHOO.lang.dump(o));}});loader.cal_Obj=this;loader.insert();}
37if(this.opts.deferLoad!=true)
38this.init();}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.