PageSourceSearch

http://ftg.by/media/com_hikashop/js/hikashop.js?v=235

js ftg.by collected 2026-10-05 00:12:51 UTC 24,828 bytes, 758 lines download raw bytes

1/**
2 * @package    HikaShop for Joomla!
3 * @version    2.3.5
4 * @author     hikashop.com
5 * @copyright  (C) 2010-2015 HIKARI SOFTWARE. All rights reserved.
6 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
7 */
8(function() {
9	function preventDefault() { this.returnValue = false; }
10	function stopPropagation() { this.cancelBubble = true; }
11	var Oby = {
12		version: 20140908,
13		ajaxEvents : {},
14
15		hasClass : function(o,n) {
16			if(o.className == '' ) return false;
17			var reg = new RegExp("(^|\\s+)"+n+"(\\s+|$)");
18			return reg.test(o.className);
19		},
20		addClass : function(o,n) {
21			if( !this.hasClass(o,n) ) {
22				if( o.className == '' ) {
23					o.className = n;
24				} else {
25					o.className += ' '+n;
26				}
27			}
28		},
29		trim : function(s) {
30			return (s ? '' + s : '').replace(/^\s*|\s*$/g, '');
31		},
32		removeClass : function(e, c) {
33			var t = this;
34			if( t.hasClass(e,c) ) {
35				var cn = ' ' + e.className + ' ';
36				e.className = t.trim(cn.replace(' '+c+' ',' '));
37			}
38		},
39		addEvent : function(d,e,f) {
40			if( d.attachEvent )
41				d.attachEvent('on' + e, f);
42			else if (d.addEventListener)
43				d.addEventListener(e, f, false);
44			else
45				d['on' + e] = f;
46			return f;
47		},
48		removeEvent : function(d,e,f) {
49			try {
50				if( d.detachEvent )
51					d.detachEvent('on' + e, f);
52				else if( d.removeEventListener)
53					d.removeEventListener(e, f, false);
54				else
55					d['on' + e] = null;
56			} catch(e) {}
57		},
58		cancelEvent : function(e) {
59			if( !e ) {
60				e = window.event;
61				if( !e )
62					return false;
63			}
64			if(e.stopPropagation)
65				e.stopPropagation();
66			else
67				 e.cancelBubble = true;
68			if( e.preventDefault )
69				e.preventDefault();
70			else
71				e.returnValue = false;
72			return false;
73		},
74		fireEvent : function(obj,e,data) {
75			var d = document, evt = null;
76			if(document.createEvent) {
77				evt = d.createEvent('HTMLEvents');
78				evt.initEvent(e, false, true);
79				if(data) evt.data = data;
80				obj.dispatchEvent(evt);
81				return;
82			}
83			if(data && d.createEventObject) {
84				evt = d.createEventObject();
85				evt.data = data;
86				obj.fireEvent('on'+e, evt);
87				return;
88			}
89			obj.fireEvent('on'+e);
90		},
91		fireAjax : function(name,params) {
92			var t = this, ev;
93			if( t.ajaxEvents[name] === undefined )
94				return false;
95			for(var e in t.ajaxEvents[name]) {
96				if( e != '_id' ) {
97					ev = t.ajaxEvents[name][e];
98					ev(params);
99				}
100			}
101			return true;
102		},
103		registerAjax : function(name, fct) {
104			var t = this;
105			if( t.ajaxEvents[name] === undefined )
106				t.ajaxEvents[name] = {'_id':0};
107			var id = t.ajaxEvents[name]['_id'];
108			t.ajaxEvents[name]['_id'] += 1;
109			t.ajaxEvents[name][id] = fct;
110			return id;
111		},
112		unregisterAjax : function(name, id) {
113			if( t.ajaxEvents[name] === undefined || t.ajaxEvents[name][id] === undefined)
114				return false;
115			t.ajaxEvents[name][id] = null;
116			return true;
117		},
118		ready: function(fct) {
119			var w = window, d = document, t = this;
120			if(d.readyState === "complete") {
121				fct();
122				return;
123			}
124			var done = false, top = true, root = d.documentElement,
125				init = function(e) {
126					if(e.type == 'readystatechange' && d.readyState != 'complete') return;
127					t.removeEvent((e.type == 'load' ? w : d), e.type, init);
128					if(!done && (done = true))
129						fct();
130				},
131				poll = function() {
132					try{ root.doScroll('left'); } catch(e){ setTimeout(poll, 50); return; }
133					init('poll');
134				};
135			if(d.createEventObject && root.doScroll) {
136				try{ top = !w.frameElement; } catch(e){}
137				if(top) poll();
138			}
139			t.addEvent(d,'DOMContentLoaded',init);
140			t.addEvent(d,'readystatechange',init);
141			t.addEvent(w,'load',init);
142		},
143		evalJSON : function(text, secure) {
144			if( typeof(text) != "string" || !text.length) return null;
145			if(JSON !== undefined && typeof(JSON.parse) == 'function') {
146				try { var ret = JSON.parse(text); return ret; } catch(e) { }
147			}
148			if(secure && !(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(text.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''))) return null;
149			return eval('(' + text + ')');
150		},
151		getXHR : function() {
152			var xhr = null, w = window;
153			if(w.XMLHttpRequest || w.ActiveXObject) {
154				if(w.ActiveXObject) {
155					try {
156						xhr = new ActiveXObject("Microsoft.XMLHTTP");
157					} catch(e) {}
158				} else
159					xhr = new w.XMLHttpRequest();
160			}
161			return xhr;
162		},
163		xRequest: function(url, options, cb, cbError) {
164			var t = this, xhr = t.getXHR();
165			if(!options) options = {};
166			if(!cb) cb = function(){};
167			options.mode = options.mode || 'GET';
168			options.update = options.update || false;
169			xhr.onreadystatechange = function() {
170				if(xhr.readyState == 4) {
171					if( xhr.status == 200 || (xhr.status == 0 && xhr.responseText > 0) || !cbError ) {
172						if(cb)
173							cb(xhr,options.params);
174						if(options.update)
175							t.updateElem(options.update, xhr.responseText);
176					} else {
177						cbError(xhr,options.params);
178					}
179				}
180			};
181			xhr.open(options.mode, url, true);
182			if( options.mode.toUpperCase() == 'POST' ) {
183				xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
184			}
185			xhr.send( options.data );
186		},
187		getFormData : function(target) {
188			var d = document, ret = '';
189			if( typeof(target) == 'string' )
190				target = d.getElementById(target);
191			if( target === undefined )
192				target = d;
193			var typelist = ['input','select','textarea'];
194			for(var t in typelist ) {
195				t = typelist[t];
196				var inputs = target.getElementsByTagName(t);
197				for(var i = inputs.length - 1; i >= 0; i--) {
198					if( inputs[i].name && !inputs[i].disabled ) {
199						var evalue = inputs[i].value, etype = '';
200						if( t == 'input' )
201							etype = inputs[i].type.toLowerCase();
202						if( (etype == 'radio' || etype == 'checkbox') && !inputs[i].checked )
203							evalue = null;
204						if(t == 'select' && inputs[i].multiple) {
205							for(var k = inputs[i].options.length - 1; k >= 0; k--) {
206								if(inputs[i].options[k].selected) {
207									if( ret != '' ) ret += '&';
208									ret += encodeURI(inputs[i].name) + '=' + encodeURIComponent(inputs[i].options[k].value);
209									evalue = null;
210								}
211							}
212						}
213						if( (etype != 'file' && etype != 'submit') && evalue != null ) {
214							if( ret != '' ) ret += '&';
215							ret += encodeURI(inputs[i].name) + '=' + encodeURIComponent(evalue);
216						}
217					}
218				}
219			}
220			return ret;
221		},
222		updateElem : function(elem, data) {
223			var d = document, scripts = '';
224			if( typeof(elem) == 'string' )
225				elem = d.getElementById(elem);
226			var text = data.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(all, code){
227				scripts += code + '\n';
228				return '';
229			});
230			elem.innerHTML = text;
231			if( scripts != '' ) {
232				var script = d.createElement('script');
233				script.setAttribute('type', 'text/javascript');
234				script.text = scripts;
235				d.head.appendChild(script);
236				d.head.removeChild(script);
237			}
238		}
239	};
240	if((typeof(window.Oby) == 'undefined') || window.Oby.version < Oby.version) {
241		window.Oby = Oby;
242		window.obscurelighty = Oby;
243	}
244
245	var oldHikaShop = window.hikashop || hikashop;
246
247	var hikashop = {
248		submitFct: null,
249		submitBox: function(data) {
250			var t = this, d = document, w = window;
251			if( t.submitFct ) {
252				try {
253					t.submitFct(data);
254				} catch(err) {}
255			}
256			t.closeBox();
257		},
258		deleteId: function(id) {
259			var t = this, d = document, el = id;
260			if( typeof(id) == "string") {
261				el = d.getElementById(id);
262			}
263			if(!el)
264				return;
265			el.parentNode.removeChild(el);
266		},
267		dup: function(tplName, htmlblocks, id, extraData, appendTo) {
268			var d = document, tplElem = d.getElementById(tplName);
269			if(!tplElem) return;
270			var container = tplElem.parentNode;
271			elem = tplElem.cloneNode(true);
272			if(!appendTo) {
273				container.insertBefore(elem, tplElem);
274			} else {
275				if(typeof(appendTo) == "string")
276					appendTo = d.getElementById(appendTo);
277				appendTo.appendChild(elem);
278			}
279			elem.style.display = "";
280			elem.id = '';
281			if(id)
282				elem.id = id;
283			for(var k in htmlblocks) {
284				elem.innerHTML = elem.innerHTML.replace(new RegExp("{"+k+"}","g"), htmlblocks[k]);
285				elem.innerHTML = elem.innerHTML.replace(new RegExp("%7B"+k+"%7D","g"), htmlblocks[k]);
286			}
287			if(extraData) {
288				for(var k in extraData) {
289					elem.innerHTML = elem.innerHTML.replace(new RegExp('{'+k+'}','g'), extraData[k]);
290					elem.innerHTML = elem.innerHTML.replace(new RegExp('%7B'+k+'%7D','g'), extraData[k]);
291				}
292			}
293		},
294		deleteRow: function(id) {
295			var t = this, d = document, el = id;
296			if( typeof(id) == "string") {
297				el = d.getElementById(id);
298			} else {
299				while(el != null && el.tagName.toLowerCase() != 'tr') {
300					el = el.parentNode;
301				}
302			}
303			if(!el)
304				return;
305			var table = el.parentNode;
306			table.removeChild(el);
307			if( table.tagName.toLowerCase() == 'tbody' )
308				table = table.parentNode;
309			t.cleanTableRows(table);
310			return;
311		},
312		dupRow: function(tplName, htmlblocks, id, extraData) {
313			var d = document, tplLine = d.getElementById(tplName),
314					tableUser = tplLine.parentNode;
315			if(!tplLine) return;
316			trLine = tplLine.cloneNode(true);
317			tableUser.appendChild(trLine);
318			trLine.style.display = "";
319			trLine.id = "";
320			if(id)
321				trLine.id = id;
322			for(var i = tplLine.cells.length - 1; i >= 0; i--) {
323				if(trLine.cells[i]) {
324					for(var k in htmlblocks) {
325						trLine.cells[i].innerHTML = trLine.cells[i].innerHTML.replace(new RegExp("{"+k+"}","g"), htmlblocks[k]);
326						trLine.cells[i].innerHTML = trLine.cells[i].innerHTML.replace(new RegExp("%7B"+k+"%7D","g"), htmlblocks[k]);
327					}
328					if(extraData) {
329						for(var k in extraData) {
330							trLine.cells[i].innerHTML = trLine.cells[i].innerHTML.replace(new RegExp('{'+k+'}','g'), extraData[k]);
331							trLine.cells[i].innerHTML = trLine.cells[i].innerHTML.replace(new RegExp('%7B'+k+'%7D','g'), extraData[k]);
332						}
333					}
334				}
335			}
336			if(tplLine.className == "row0") tplLine.className = "row1";
337			else if(tplLine.className == "row1") tplLine.className = "row0";
338		},
339		cleanTableRows: function(id) {
340			var d = document, el = id;
341			if(typeof(id) == "string")
342				el = d.getElementById(id);
343			if(el == null || el.tagName.toLowerCase() != 'table')
344				return;
345
346			var k = 0, c = '', line = null, lines = el.getElementsByTagName('tr');
347			for(var i = 0; i < lines.length; i++) {
348				line = lines[i];
349				if( line.style.display != "none") {
350					c = ' '+line.className+' ';
351					if( c.indexOf(' row0 ') >= 0 || c.indexOf(' row1 ') >= 0 ) {
352						line.className = c.replace(' row'+(1-k)+' ', ' row'+k+' ').replace(/^\s*|\s*$/g, '');
353						k = 1 - k;
354					}
355				}
356			}
357		},
358		checkRow: function(id) {
359			var t = this, d = document, el = id;
360			if(typeof(id) == "string")
361				el = d.getElementById(id);
362			if(el == null || el.tagName.toLowerCase() != 'input')
363				return;
364			if(this.clicked) {
365				this.clicked = null;
366				t.isChecked(el);
367				return;
368			}
369			el.checked = !el.checked;
370			t.isChecked(el);
371		},
372		isChecked: function(id,cancel) {
373			var d = document, el = id;
374			if(typeof(id) == "string")
375				el = d.getElementById(id);
376			if(el == null || el.tagName.toLowerCase() != 'input')
377				return;
378			if(el.form.boxchecked) {
379				if(el.checked)
380					el.form.boxchecked.value++;
381				else
382					el.form.boxchecked.value--;
383			}
384		},
385		checkAll: function(checkbox, stub) {
386			stub = stub || 'cb';
387			if(checkbox.form) {
388				var cb = checkbox.form, c = 0;
389				for(var i = 0, n = cb.elements.length; i < n; i++) {
390					var e = cb.elements[i];
391					if (e.type == checkbox.type) {
392						if ((stub && e.id.indexOf(stub) == 0) || !stub) {
393							e.checked = checkbox.checked;
394							c += (e.checked == true ? 1 : 0);
395						}
396					}
397				}
398				if (cb.boxchecked) {
399					cb.boxchecked.value = c;
400				}
401				return true;
402			}
403			return false;
404		},
405		submitform: function(task, form, extra) {
406			var d = document;
407			if(typeof form == 'string') {
408				var f = d.getElementById(form);
409				if(!f)
410					f = d.forms[form];
411				if(!f)
412					return true;
413				form = f;
414			}
415			if(task) {
416				form.task.value = task;
417			}
418			if(typeof form.onsubmit == 'function')
419				form.onsubmit();
420			form.submit();
421			return false;
422		},
423		get: function(elem, target) {
424			window.Oby.xRequest(elem.getAttribute('href'), {update: target});
425			return false;
426		},
427		form: function(elem, target) {
428			var data = window.Oby.getFormData(target);
429			window.Oby.xRequest(elem.getAttribute('href'), {update: target, mode: 'POST', data: data});
430			return false;
431		},
432		openBox: function(elem, url, jqmodal) {
433			var w = window;
434			if(typeof(elem) == "string")
435				elem = document.getElementById(elem);
436			if(!elem)
437				return false;
438			try {
439				if(jqmodal === undefined) {
440					jqmodal = false;
441					var test_rel = elem.getAttribute('rel');
442					if(test_rel == null && typeof(jQuery) != "undefined")
443						jqmodal = true;
444				}
445				if(!jqmodal && w.SqueezeBox !== undefined) {
446					if(url !== undefined && url !== null) {
447						elem.href = url;
448					}
449					if(w.SqueezeBox.open !== undefined)
450						SqueezeBox.open(elem, {parse: 'rel'});
451					else if(w.SqueezeBox.fromElement !== undefined)
452						SqueezeBox.fromElement(elem);
453				} else if(typeof(jQuery) != "undefined") {
454					var id = elem.getAttribute('id');
455					jQuery('#modal-' + id).modal('show');
456					if(url) {
457						jQuery('#modal-' + id + '-container').find('iframe').attr('src', url);
458					}
459				}
460			} catch(e) {}
461			return false;
462		},
463		closeBox: function(parent) {
464			var d = document, w = window;
465			if(parent) {
466				d = window.parent.document;
467				w = window.parent;
468			}
469			try {
470				var e = d.getElementById('sbox-window');
471				if(e && typeof(e.close) != "undefined") {
472					e.close();
473				}else if(typeof(w.jQuery) != "undefined" && w.jQuery('div.modal.in') && w.jQuery('div.modal.in').hasClass('in')){
474					w.jQuery('div.modal.in').modal('hide');
475				}else if(w.SqueezeBox !== undefined) {
476					w.SqueezeBox.close();
477				}
478			} catch(err) {}
479		},
480		submitPopup: function(id, task, form) {
481			var d = document, t = this, el = d.getElementById('modal-'+id+'-iframe');
482			if(el && el.contentWindow.hikashop) {
483				if(task === undefined) task = null;
484				if(form === undefined) form = 'adminForm';
485				el.contentWindow.hikashop.submitform(task, form);
486			}
487		},
488		tabSelect: function(m,c,id) {
489			var d = document, sub = null;
490			if(typeof m == 'string')
491				m = d.getElementById(m);
492			if(!m) return;
493			if(typeof id == 'string')
494				id = d.getElementById(id);
495			sub = m.getElementsByTagName('div');
496			if(sub) {
497				for(var i = sub.length - 1; i >= 0; i--) {
498					if(sub[i].getAttribute('class') == c) {
499						sub[i].style.display = 'none';
500					}
501				}
502			}
503			if(id) id.style.display = '';
504		},
505		changeState: function(el, id, url) {
506			var d = document;
507			if(!d.getElementById(id + '_container'))
508				return false;
509			window.Oby.xRequest(url, null, function(xhr){
510				var w = window;
511				w.Oby.updateElem(id + '_container', xhr.responseText);
512				var defaultVal = '', defaultValInput = d.getElementById(id + '_default_value'), stateSelect = d.getElementById(id);
513				if(defaultValInput) { defaultVal = defaultValInput.value; }
514				if(stateSelect && w.hikashop.optionValueIndexOf(stateSelect.options, defaultVal) >= 0)
515					stateSelect.value = defaultVal;
516				if(typeof(jQuery) != "undefined" && jQuery().chosen) { jQuery('#'+id).chosen(); }
517				w.Oby.fireAjax('hikashop.stateupdated', {id: id, elem: stateSelect});
518			});
519		},
520		optionValueIndexOf: function(options, value) {
521			for(var i = options.length - 1; i >= 0; i--) {
522				if(options[i].value == value)
523					return i;
524			}
525			return -1;
526		},
527		getOffset: function(el) {
528			var x = 0, y = 0;
529			while(el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop )) {
530				x += el.offsetLeft - el.scrollLeft;
531				y += el.offsetTop - el.scrollTop;
532				el = el.offsetParent;
533			}
534			return { top: y, left: x };
535		},
536		dataStore: function(name, value) {
537			if(localStorage) {
538				localStorage.setItem(name, value);
539			} else {
540				var expire = new Date(); expire.setDate(expire.getDate() + 5);
541				document.cookie = name+"="+value+"; expires="+expire;
542			}
543		},
544		dataGet: function(name) {
545			if(localStorage) {
546				return localStorage.getItem(name);
547			}
548			if(document.cookie.length > 0 && document.cookie.indexOf(name+"=") != -1) {
549				var s = name+"=", o = document.cookie.indexOf(s) + s.length, e = document.cookie.indexOf(";",o);
550				if(e == -1) e = document.cookie.length;
551				return unescape(document.cookie.substring(o, e));
552			}
553			return null;
554		},
555		setArrayDisplay: function(fields, displayValue) {
556			var d = document, e = null;
557			if(displayValue === true) displayValue = '';
558			if(displayValue === false) displayValue = 'none';
559			for(var i = 0; i < fields.length; i++) {
560				e = d.getElementById(fields[i]);
561				if(e) e.style.display = displayValue;
562			}
563		},
564		ready: function(fct) {
565			var w = window, d = w.document;
566			if(d.readyState === "complete") {
567				fct();
568				return;
569			}
570			if(w.jQuery !== undefined) {
571				jQuery(d).ready(fct);
572			} else if(window.addEvent) {
573				w.addEvent("domready", fct);
574			} else
575				w.Oby.ready(fct);
576		},
577		noChzn: function() {
578			if(!window.jQuery)
579				return false;
580			jQuery('.no-chzn').each(function(i,el) {
581				var id = el.getAttribute('id');
582				id = id.replace('{','_').replace('}','_');
583				var chzn = jQuery('#'+id+'_chzn');
584				if(chzn) chzn.remove();
585				jQuery(el).removeClass('chzn-done').show();
586			});
587			return true;
588		}
589	};
590	window.hikashop = hikashop;
591
592	if(oldHikaShop && oldHikaShop instanceof Object) {
593		for (var attr in oldHikaShop) {
594			if (oldHikaShop.hasOwnProperty(attr) && !window.hikashop.hasOwnProperty(attr))
595				window.hikashop[attr] = oldHikaShop[attr];
596		}
597	}
598})();
599
600function tableOrdering(order, dir, task) {
601	var form = document.adminForm;
602	form.filter_order.value = order;
603	form.filter_order_Dir.value	= dir;
604	submitform(task);
605}
606
607function submitform(pressbutton) {
608	var d = document;
609	if(!d.adminForm)
610		return false;
611	if(pressbutton)
612		d.adminForm.task.value = pressbutton;
613	if(typeof(CodeMirror) == 'function') {
614		for(x in CodeMirror.instances) {
615			d.getElementById(x).value = CodeMirror.instances[x].getCode();
616		}
617	}
618	if(typeof(d.adminForm.onsubmit) == "function")
619		d.adminForm.onsubmit();
620	d.adminForm.submit();
621	return false;
622}
623
624function hikashopCheckChangeForm(type, form) {
625	if(!form)
626		return true;
627	var varform = document[form];
628
629	if(typeof(hikashopFieldsJs) == 'undefined' || typeof(hikashopFieldsJs['reqFieldsComp']) == 'undefined' || typeof(hikashopFieldsJs['reqFieldsComp'][type]) == 'undefined' || hikashopFieldsJs['reqFieldsComp'][type].length <= 0)
630		return true;
631
632	var d = document;
633	for(var i = hikashopFieldsJs['reqFieldsComp'][type].length - 1; i >= 0; i--) {
634		elementName = 'data['+type+']['+hikashopFieldsJs['reqFieldsComp'][type][i]+']';
635		if(typeof(varform.elements[elementName]) == 'undefined')
636			elementName = type+'_'+hikashopFieldsJs['reqFieldsComp'][type][i];
637
638		elementToCheck = varform.elements[elementName];
639		elementId = 'hikashop_'+type+'_'+ hikashopFieldsJs['reqFieldsComp'][type][i];
640		el = d.getElementById(elementId);
641
642		if(elementToCheck && (typeof el == 'undefined' || el == null || typeof el.style == 'undefined' || el.style.display!='none') && !hikashopCheckField(elementToCheck,type,i,elementName,varform.elements)) {
643			if(typeof(hikashopFieldsJs['entry_id']) == 'undefined')
644				return false;
645
646			for(var j = 1; j <= hikashop['entry_id']; j++) {
647				elementName = 'data['+type+'][entry_'+j+']['+hikashopFieldsJs['reqFieldsComp'][type][i]+']';
648				elementToCheck = varform.elements[elementName];
649				elementId = 'hikashop_'+type+'_'+ hikashopFieldsJs['reqFieldsComp'][type][i] + '_' + j;
650				el = d.getElementById(elementId);
651				if(elementToCheck && (typeof el == 'undefined' || el == null || typeof el.style == 'undefined' || el.style.display != 'none') && !hikashopCheckField(elementToCheck,type,i,elementName,varform.elements)) {
652					return false;
653				}
654			}
655		}
656	}
657
658	if(type == 'register') {
659		// check the password confirmation field only if we are in selector registration and that the user selected "registration" or "simplified registration", or that the registration is on "all in one page" and that the password confirmation field is there
660		var register = d.getElementById('data_register_registration_method0');
661		if(!register)
662			register = d.getElementById('data[register][registration_method]0');
663
664		var simplified_pwd = d.getElementById('data_register_registration_method3');
665		if(!simplified_pwd)
666			simplified_pwd = d.getElementById('data[register][registration_method]3');
667
668		if((simplified_pwd && simplified_pwd.checked) || (register && register.checked) || (!simplified_pwd && !register)) {
669			// check password
670			if(typeof(varform.elements['data[register][password]']) != 'undefined' && typeof(varform.elements['data[register][password2]']) != 'undefined') {
671				passwd = varform.elements['data[register][password]'];
672				passwd2 = varform.elements['data[register][password2]'];
673				if(passwd.value != passwd2.value) {
674					alert(hikashopFieldsJs['password_different']);
675					return false;
676				}
677			}
678		}
679
680		//check email
681		var emailField = varform.elements['data[register][email]'];
682		emailField.value = emailField.value.replace(/ /g,"");
683		var filter = /^([a-z0-9_'&\.\-\+])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,10})+$/i;
684		if(!emailField || !filter.test(emailField.value)) {
685			alert(hikashopFieldsJs['valid_email']);
686			return false;
687		}
688	} else if(type == 'address' && typeof(varform.elements['data[address][address_telephone]']) != 'undefined') {
689		var phoneField = varform.elements['data[address][address_telephone]'], filter = /[0-9]+/i;
690		if(phoneField) {
691			phoneField.value = phoneField.value.replace(/ /g,"");
692			if(phoneField.value.length > 0 && !filter.test(phoneField.value)) {
693				alert(hikashopFieldsJs['valid_phone']);
694				return false;
695			}
696		}
697	}
698
699	return true;
700}
701
702function hikashopCheckField(elementToCheck, type, i, elementName, form) {
703	if(!elementToCheck)
704		return true;
705
706	var d = document, isValid = false;
707	if(typeof(elementToCheck.value) != 'undefined') {
708		if(elementToCheck.value == ' ' && typeof(form[elementName+'[]']) != 'undefined') {
709			if(form[elementName+'[]'].checked) {
710				isValid = true;
711			} else {
712				for(var a = form[elementName+'[]'].length - 1; a >= 0; a--) {
713					if(form[elementName+'[]'][a].checked && form[elementName+'[]'][a].value.length > 0)
714						isValid = true;
715				}
716			}
717		} else if(elementToCheck.value.length > 0)
718			isValid = true;
719	} else {
720		for(var a = elementToCheck.length - 1; a >= 0; a--) {
721			 if(elementToCheck[a].checked && elementToCheck[a].value.length > 0)
722			 	isValid = true;
723		}
724	}
725
726	// Case for the switcher display, ignore check according to the method selected
727	// joomla 3 ids are differents than joomla 1.5...
728	var simplified_pwd = d.getElementById('data_register_registration_method3');
729	if(!simplified_pwd) simplified_pwd = d.getElementById('data[register][registration_method]3');
730
731	var simplified = d.getElementById('data_register_registration_method1');
732	if(!simplified) simplified = d.getElementById('data[register][registration_method]1');
733
734	var guest = d.getElementById('data_register_registration_method2');
735	if(!guest) guest = d.getElementById('data[register][registration_method]2');
736
737	if(!isValid && ((simplified && simplified.checked) || (guest && guest.checked) ) && (elementName == 'data[register][password]' || elementName == 'data[register][password2]')){
738		window.Oby.addClass(elementToCheck, 'invalid');
739		return true;
740	}
741
742	if(!isValid && ( (simplified && simplified.checked) || (guest && guest.checked) || (simplified_pwd && simplified_pwd.checked) ) && (elementName == 'data[register][name]' || elementName == 'data[register][username]')) {
743		window.Oby.addClass(elementToCheck, 'invalid');
744		return true;
745	}
746	if(!isValid) {
747		window.Oby.addClass(elementToCheck, 'invalid');
748		alert(hikashopFieldsJs['validFieldsComp'][type][i]);
749		return false;
750	} else {
751		window.Oby.removeClass(elementToCheck, 'invalid');
752	}
753	return true;
754}
755
756if(window.jQuery && typeof(jQuery.noConflict) == "function" && !window.hkjQuery) {
757	window.hkjQuery = jQuery.noConflict();
758}

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.