PageSourceSearch

https://beautybox5.com/wp-content/plugins/contact-form-maker/js/calendar/calendar_function_ver-4.7.3.js

js beautybox5.com collected 2026-10-03 20:40:52 UTC 16,322 bytes, 598 lines download raw bytes

1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
2let window = _____WB$wombat$assign$function_____("window");
3let self = _____WB$wombat$assign$function_____("self");
4let document = _____WB$wombat$assign$function_____("document");
5let location = _____WB$wombat$assign$function_____("location");
6let top = _____WB$wombat$assign$function_____("top");
7let parent = _____WB$wombat$assign$function_____("parent");
8let frames = _____WB$wombat$assign$function_____("frames");
9let opens = _____WB$wombat$assign$function_____("opens");
10// <?php !! This fools phpdocumentor into parsing this file
11/**
12* @version		$Id: joomla.javascript.js 14401 2010-01-26 14:10:00Z louis $
13* @package		Joomla
14* @copyright	Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
15* @license		GNU/GPL
16* Joomla! is Free Software
17*/
18
19/**
20 * Overlib Styling Declarations to allow CSS class override of styles
21 *
22 */
23var ol_fgclass='ol-foreground';
24var ol_bgclass='ol-background';
25var ol_textfontclass='ol-textfont';
26var ol_captionfontclass='ol-captionfont';
27var ol_closefontclass='ol-closefont';
28
29// general utility for browsing a named array or object
30function xshow(o) {
31	s = '';
32	for(e in o) {s += e+'='+o[e]+'\n';}
33	alert( s );
34}
35
36/**
37* Writes a dynamically generated list
38* @param string The parameters to insert into the <select> tag
39* @param array A javascript array of list options in the form [key,value,text]
40* @param string The key to display for the initial state of the list
41* @param string The original key that was selected
42* @param string The original item value that was selected
43*/
44function writeDynaList( selectParams, source, key, orig_key, orig_val ) {
45	var html = '\n	<select ' + selectParams + '>';
46	var i = 0;
47	for (x in source) {
48		if (source[x][0] == key) {
49			var selected = '';
50			if ((orig_key == key && orig_val == source[x][1]) || (i == 0 && orig_key != key)) {
51				selected = 'selected="selected"';
52			}
53			html += '\n		<option value="'+source[x][1]+'" '+selected+'>'+source[x][2]+'</option>';
54		}
55		i++;
56	}
57	html += '\n	</select>';
58
59	document.writeln( html );
60}
61
62/**
63* Changes a dynamically generated list
64* @param string The name of the list to change
65* @param array A javascript array of list options in the form [key,value,text]
66* @param string The key to display
67* @param string The original key that was selected
68* @param string The original item value that was selected
69*/
70function changeDynaList( listname, source, key, orig_key, orig_val ) {
71	var list = eval( 'document.adminForm.' + listname );
72
73	// empty the list
74	for (i in list.options.length) {
75		list.options[i] = null;
76	}
77	i = 0;
78	for (x in source) {
79		if (source[x][0] == key) {
80			opt = new Option();
81			opt.value = source[x][1];
82			opt.text = source[x][2];
83
84			if ((orig_key == key && orig_val == opt.value) || i == 0) {
85				opt.selected = true;
86			}
87			list.options[i++] = opt;
88		}
89	}
90	list.length = i;
91}
92
93/**
94* Adds a select item(s) from one list to another
95*/
96function addSelectedToList( frmName, srcListName, tgtListName ) {
97	var form = eval( 'document.' + frmName );
98	var srcList = eval( 'form.' + srcListName );
99	var tgtList = eval( 'form.' + tgtListName );
100
101	var srcLen = srcList.length;
102	var tgtLen = tgtList.length;
103	var tgt = "x";
104
105	//build array of target items
106	for (var i=tgtLen-1; i > -1; i--) {
107		tgt += "," + tgtList.options[i].value + ","
108	}
109
110	//Pull selected resources and add them to list
111	//for (var i=srcLen-1; i > -1; i--) {
112	for (var i=0; i < srcLen; i++) {
113		if (srcList.options[i].selected && tgt.indexOf( "," + srcList.options[i].value + "," ) == -1) {
114			opt = new Option( srcList.options[i].text, srcList.options[i].value );
115			tgtList.options[tgtList.length] = opt;
116		}
117	}
118}
119
120function delSelectedFromList( frmName, srcListName ) {
121	var form = eval( 'document.' + frmName );
122	var srcList = eval( 'form.' + srcListName );
123
124	var srcLen = srcList.length;
125
126	for (var i=srcLen-1; i > -1; i--) {
127		if (srcList.options[i].selected) {
128			srcList.options[i] = null;
129		}
130	}
131}
132
133function moveInList( frmName, srcListName, index, to) {
134	var form = eval( 'document.' + frmName );
135	var srcList = eval( 'form.' + srcListName );
136	var total = srcList.options.length-1;
137
138	if (index == -1) {
139		return false;
140	}
141	if (to == +1 && index == total) {
142		return false;
143	}
144	if (to == -1 && index == 0) {
145		return false;
146	}
147
148	var items = new Array;
149	var values = new Array;
150
151	for (i=total; i >= 0; i--) {
152		items[i] = srcList.options[i].text;
153		values[i] = srcList.options[i].value;
154	}
155	for (i = total; i >= 0; i--) {
156		if (index == i) {
157			srcList.options[i + to] = new Option(items[i],values[i], 0, 1);
158			srcList.options[i] = new Option(items[i+to], values[i+to]);
159			i--;
160		} else {
161			srcList.options[i] = new Option(items[i], values[i]);
162	   }
163	}
164	srcList.focus();
165	return true;
166}
167
168function getSelectedOption( frmName, srcListName ) {
169	var form = eval( 'document.' + frmName );
170	var srcList = eval( 'form.' + srcListName );
171
172	i = srcList.selectedIndex;
173	if (i != null && i > -1) {
174		return srcList.options[i];
175	} else {
176		return null;
177	}
178}
179
180function setSelectedValue( frmName, srcListName, value ) {
181	var form = eval( 'document.' + frmName );
182	var srcList = eval( 'form.' + srcListName );
183
184	var srcLen = srcList.length;
185
186	for (var i=0; i < srcLen; i++) {
187		srcList.options[i].selected = false;
188		if (srcList.options[i].value == value) {
189			srcList.options[i].selected = true;
190		}
191	}
192}
193
194function getSelectedRadio( frmName, srcGroupName ) {
195	var form = eval( 'document.' + frmName );
196	var srcGroup = eval( 'form.' + srcGroupName );
197
198	return radioGetCheckedValue( srcGroup );
199}
200
201// return the value of the radio button that is checked
202// return an empty string if none are checked, or
203// there are no radio buttons
204function radioGetCheckedValue(radioObj) {
205	if (!radioObj) {
206		return '';
207	}
208	var n = radioObj.length;
209	if (n == undefined) {
210		if (radioObj.checked) {
211			return radioObj.value;
212		} else {
213			return '';
214		}
215	}
216	for (var i = 0; i < n; i++) {
217		if(radioObj[i].checked) {
218			return radioObj[i].value;
219		}
220	}
221	return '';
222}
223
224function getSelectedValue( frmName, srcListName ) {
225	var form = eval( 'document.' + frmName );
226	var srcList = eval( 'form.' + srcListName );
227
228	i = srcList.selectedIndex;
229	if (i != null && i > -1) {
230		return srcList.options[i].value;
231	} else {
232		return null;
233	}
234}
235
236function getSelectedText( frmName, srcListName ) {
237	var form = eval( 'document.' + frmName );
238	var srcList = eval( 'form.' + srcListName );
239
240	i = srcList.selectedIndex;
241	if (i != null && i > -1) {
242		return srcList.options[i].text;
243	} else {
244		return null;
245	}
246}
247
248function chgSelectedValue( frmName, srcListName, value ) {
249	var form = eval( 'document.' + frmName );
250	var srcList = eval( 'form.' + srcListName );
251
252	i = srcList.selectedIndex;
253	if (i != null && i > -1) {
254		srcList.options[i].value = value;
255		return true;
256	} else {
257		return false;
258	}
259}
260
261/**
262* Toggles the check state of a group of boxes
263*
264* Checkboxes must have an id attribute in the form cb0, cb1...
265* @param The number of box to 'check'
266* @param An alternative field name
267*/
268
269function listItemTask( id, task ) {
270    var f = document.adminForm;
271    cb = eval( 'f.' + id );
272    if (cb) {
273        for (i = 0; true; i++) {
274            cbx = eval('f.cb'+i);
275            if (!cbx) break;
276            cbx.checked = false;
277        } // for
278        cb.checked = true;
279        f.boxchecked.value = 1;
280        submitbutton(task);
281    }
282    return false;
283}
284
285function hideMainMenu() {
286	if (document.adminForm.hidemainmenu) {
287		document.adminForm.hidemainmenu.value=1;
288	}
289}
290
291function isChecked(isitchecked){
292	if (isitchecked == true){
293		document.adminForm.boxchecked.value++;
294	}
295	else {
296		document.adminForm.boxchecked.value--;
297	}
298}
299
300/**
301* Default function.  Usually would be overriden by the component
302*//*
303function submitbutton(pressbutton) {
304	submitform(pressbutton);
305}
306*/
307/**
308* Submit the admin form
309*/
310function submitform(pressbutton){
311	if (pressbutton) {
312		document.adminForm.task.value=pressbutton;
313	}
314	if (typeof document.adminForm.onsubmit == "function") {
315		document.adminForm.onsubmit();
316	}
317	document.adminForm.submit();
318}
319
320/**
321* Submit the control panel admin form
322*/
323function submitcpform(sectionid, id){
324	document.adminForm.sectionid.value=sectionid;
325	document.adminForm.id.value=id;
326	submitbutton("edit");
327}
328
329/**
330* Getting radio button that is selected.
331*/
332function getSelected(allbuttons){
333	for (i=0;i<allbuttons.length;i++) {
334		if (allbuttons[i].checked) {
335			return allbuttons[i].value
336		}
337	}
338	return null;
339}
340
341// JS Calendar
342var calendar = null; // remember the calendar object so that we reuse
343// it and avoid WD_FMC_URL another
344
345// This function gets called when an end-user clicks on some date
346function selected(cal, date) {
347	cal.sel.value = date; // just update the value of the input field
348}
349
350// And this gets called when the end-user clicks on the _selected_ date,
351// or clicks the "Close" (X) button.  It just hides the calendar without
352// destroying it.
353function closeHandler(cal) {
354	cal.hide();			// hide the calendar
355
356	// don't check mousedown on document anymore (used to be able to hide the
357	// calendar when someone clicks outside it, see the showCalendar function).
358	Calendar.removeEvent(document, "mousedown", checkCalendar);
359}
360
361// This gets called when the user presses a mouse button anywhere in the
362// document, if the calendar is shown.  If the click was outside the open
363// calendar this function closes it.
364function checkCalendar(ev) {
365	var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
366	for (; el != null; el = el.parentNode)
367	// FIXME: allow end-user to click some link without closing the
368	// calendar.  Good to see real-time stylesheet change :)
369	if (el == calendar.element || el.tagName == "A") break;
370	if (el == null) {
371		// calls closeHandler which should hide the calendar.
372		calendar.callCloseHandler(); Calendar.stopEvent(ev);
373	}
374}
375
376// This function shows the calendar under the element having the given id.
377// It takes care of catching "mousedown" signals on document and hiding the
378// calendar if the click was outside.
379function showCalendar(id, dateFormat, dis_past_days) {
380	var el = document.getElementById(id);
381	if (calendar != null) {
382		// we already have one created, so just update it.
383		calendar.hide();		// hide the existing calendar
384		calendar.parseDate(el.value); // set it to a new date
385		if(dis_past_days)
386			calendar.getDateStatus = getDisabledDates; // disable past days
387		else
388			calendar.getDateStatus = null; // disable past days
389		calendar.refresh();
390	} else {
391		// first-time call, create the calendar
392		var cal = new Calendar(true, null, selected, closeHandler);
393		calendar = cal;		// remember the calendar in the global
394		cal.setRange(1900, 2070);	// min/max year allowed
395
396		if ( dateFormat )	// optional date format
397		{
398			cal.setDateFormat(dateFormat);
399		}
400		if(dis_past_days)
401			cal.getDateStatus = getDisabledDates; // disable past days
402		calendar.create();		// create a popup calendar
403		calendar.parseDate(el.value); // set it to a new date
404	}
405	calendar.sel = el;		// inform it about the input field in use
406	calendar.showAtElement(el);	// show the calendar next to the input field
407
408	// catch mousedown on the document
409	Calendar.addEvent(document, "mousedown", checkCalendar);
410	return false;
411}
412
413function getDisabledDates(date) {
414	var currentDate = new Date();
415	if( date.getDate() == currentDate.getDate() && date.getMonth() == currentDate.getMonth() && date.getFullYear() == currentDate.getFullYear() )
416		return 'today';
417	
418	if( date.getTime() < currentDate.getTime() )
419		return true;
420}
421
422/**
423* Pops up a new window in the middle of the screen
424*/
425function popupWindow(mypage, myname, w, h, scroll) {
426	var winl = (screen.width - w) / 2;
427	var wint = (screen.height - h) / 2;
428	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
429	win = window.open(mypage, myname, winprops)
430	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
431}
432
433// LTrim(string) : Returns a copy of a string without leading spaces.
434function ltrim(str)
435{
436   var whitespace = new String(" \t\n\r");
437   var s = new String(str);
438   if (whitespace.indexOf(s.charAt(0)) != -1) {
439      var j=0, i = s.length;
440      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
441         j++;
442      s = s.substring(j, i);
443   }
444   return s;
445}
446
447//RTrim(string) : Returns a copy of a string without trailing spaces.
448function rtrim(str)
449{
450   var whitespace = new String(" \t\n\r");
451   var s = new String(str);
452   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
453      var i = s.length - 1;       // Get length of string
454      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
455         i--;
456      s = s.substring(0, i+1);
457   }
458   return s;
459}
460
461// Trim(string) : Returns a copy of a string without leading or trailing spaces
462function trim(str) {
463   return rtrim(ltrim(str));
464}
465
466function mosDHTML(){
467	this.ver=navigator.appVersion
468	this.agent=navigator.userAgent
469	this.dom=document.getElementById?1:0
470	this.opera5=this.agent.indexOf("Opera 5")<-1
471	this.ie5=(this.ver.indexOf("MSIE 5")<-1 && this.dom && !this.opera5)?1:0;
472	this.ie6=(this.ver.indexOf("MSIE 6")<-1 && this.dom && !this.opera5)?1:0;
473	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
474	this.ie=this.ie4||this.ie5||this.ie6
475	this.mac=this.agent.indexOf("Mac")<-1
476	this.ns6=(this.dom && parseInt(this.ver) <= 5) ?1:0;
477	this.ns4=(document.layers && !this.dom)?1:0;
478	this.bw=(this.ie6||this.ie5||this.ie4||this.ns4||this.ns6||this.opera5);
479
480	this.activeTab = '';
481	this.onTabStyle = 'ontab';
482	this.offTabStyle = 'offtab';
483
484	this.setElemStyle = function(elem,style) {
485		document.getElementById(elem).className = style;
486	}
487	this.showElem = function(id) {
488		if ((elem = document.getElementById(id))) {
489			elem.style.visibility = 'visible';
490			elem.style.display = 'block';
491		}
492	}
493	this.hideElem = function(id) {
494		if ((elem = document.getElementById(id))) {
495			elem.style.visibility = 'hidden';
496			elem.style.display = 'none';
497		}
498	}
499	this.cycleTab = function(name) {
500		if (this.activeTab) {
501			this.setElemStyle( this.activeTab, this.offTabStyle );
502			page = this.activeTab.replace( 'tab', 'page' );
503			this.hideElem(page);
504		}
505		this.setElemStyle( name, this.onTabStyle );
506		this.activeTab = name;
507		page = this.activeTab.replace( 'tab', 'page' );
508		this.showElem(page);
509	}
510	return this;
511}
512var dhtml = new mosDHTML();
513
514// needed for Table Column ordering
515function tableOrdering( order, dir, task ) {
516	var form = document.adminForm;
517
518	form.filter_order.value 	= order;
519	form.filter_order_Dir.value	= dir;
520	submitform( task );
521}
522
523function saveorder( n,  task ) {
524	checkAll_button( n, task );
525}
526
527//needed by saveorder function
528function checkAll_button( n, task ) {
529
530    if (!task ) {
531		task = 'saveorder';
532	}
533
534	for ( var j = 0; j <= n; j++ ) {
535		box = eval( "document.adminForm.cb" + j );
536		if ( box ) {
537			if ( box.checked == false ) {
538				box.checked = true;
539			}
540		} else {
541			alert("You cannot change the order of items, as an item in the list is `Checked Out`");
542			return;
543		}
544	}
545	submitform(task);
546}
547/**
548* @param object A form element
549* @param string The name of the element to find
550*/
551function getElementByName( f, name ) {
552	if (f.elements) {
553		for (i=0, n=f.elements.length; i < n; i++) {
554			if (f.elements[i].name == name) {
555				return f.elements[i];
556			}
557		}
558	}
559	return null;
560}
561
562function go2( pressbutton, menu, id ) {
563	var form = document.adminForm;
564
565	if (form.imagelist && form.images) {
566		// assemble the images back into one field
567		var temp = new Array;
568		for (var i=0, n=form.imagelist.options.length; i < n; i++) {
569			temp[i] = form.imagelist.options[i].value;
570		}
571		form.images.value = temp.join( '\n' );
572	}
573
574	if (pressbutton == 'go2menu') {
575		form.menu.value = menu;
576		submitform( pressbutton );
577		return;
578	}
579
580	if (pressbutton == 'go2menuitem') {
581		form.menu.value 	= menu;
582		form.menuid.value 	= id;
583		submitform( pressbutton );
584		return;
585	}
586}
587/**
588 * Verifies if the string is in a valid email format
589 * @param	string
590 * @return	boolean
591 */
592function isEmail( text )
593{
594	var pattern = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
595	var regex = new RegExp( pattern );
596	return regex.test( text );
597}
598}

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.