jQuery(function(){ initSubscribe(); //jcf.customForms.replaceAll(); $('#formflex1513 input[type="submit"]').val('GO'); homeGall(); actionGall(); //$('.nav-hold li.selected').closest('.hasChild ul').show(); // convert education-presentation to Education Presentation $('#map-cat').hide(); var str = $('#map-cat').text(); str = str.toLowerCase().replace(/\b[a-z]/g, function(letter){return letter.toUpperCase();}); $('#map-cat').text(str).replaceText('-',' ').show(); $('#formflex1554 p.radio-2 input').not(':last').each(function(){ var mybutt = $(this).attr("checked"); if (mybutt = "undefined") $('p.radio-2 input:first').attr("checked","checked"); }); $('#formflex1554 input#cat_4677').prop("checked",true); if ($('#campaign .gallery-holder .ca-list').length > 0){ $('#campaign .gallery-holder .ca-list').cycle(); } //$('#footer').after(''); }); /** * Get the value of a cookie with the given name. * * @example $.cookie('the_cookie'); * @desc Get the value of a cookie. * * @param String name The name of the cookie. * @return The value of the cookie. * @type String * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ jQuery.cookie = function(name, value, options) { if (typeof value != 'undefined') { // name and value given, set cookie options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE } // CAUTION: Needed to parenthesize options.path and options.domain // in the following expressions, otherwise they evaluate to undefined // in the packed version for some reason... var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { // only name given, get cookie var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } }; /* * jQuery replaceText - v1.1 * http://benalman.com/projects/jquery-replacetext-plugin/ */ (function($){$.fn.replaceText=function(b,a,c){return this.each(function(){var f=this.firstChild,g,e,d=[];if(f){do{if(f.nodeType===3){g=f.nodeValue;e=g.replace(b,a);if(e!==g){if(!c&&/ ul'); var _list = list_hold.children(); var btn_prev = _hold.find('a.btn-prev'); var btn_next = _hold.find('a.btn-next'); var list_w = 0, hold_w = list_hold.parent().width(), _m = 0; var move_f = true; var _step = _list.outerWidth(true); for(var i = 0; i < _list.length; i++) list_w += _list.eq(i).outerWidth(true); if(list_w > hold_w){ _m = list_w; list_hold.append(_list.clone(true)).append(_list.clone(true)).css('left', -_m); btn_prev.click(function(){ moveList(false); return false; }); btn_next.click(function(){ moveList(true); return false; }); } else{ btn_prev.css('display', 'none'); btn_next.css('display', 'none'); } function moveList(_f){ if(move_f){ move_f = false; if(_f){ if(_m + _step > list_w*3 - hold_w){ _m -= list_w; list_hold.css('left', -_m); } _m += _step; } else{ if(_m - _step < 0){ _m += list_w; list_hold.css('left', -_m); } _m -= _step; } list_hold.animate({left:-_m}, move_speed, function(){ move_f = true;}); } } } } /*--- home gallery ---*/ function homeGall(){ var stay_time = 5000; //in ms var img_hold = jQuery('#home-gallery > div.img-hold'); if(img_hold.length){ var _list = img_hold.find('img'); var img_list = []; _list.css('opacity', 0).each(function(_i){ img_list[_i] = this;}); var _a = 0; var _pi = Math.PI; var k_x = img_hold.outerWidth()/2; var k_y = img_hold.outerHeight()/2; var _p = _pi*2/img_list.length; var n_x, n_y, s_p = 0, _t1, _active = false, t_p, hover_f = true, auto_t; /*--- ---*/ function elParams(_el){ _el._p += s_p; _el._k = 1/(2 - Math.cos(_el._p)); _el._x = k_x * (1 + Math.sin(_el._p)) - _el._w/2; } function elStyles(_el){ _el.style.width = _el._k * _el._w + 'px'; _el.style.marginLeft = _el._w * (1 - _el._k)/2 + 'px'; _el.style.height = _el._k * _el._h + 'px'; _el.style.marginTop = _el._h * (1 - _el._k)/2 + 'px'; _el.style.left = _el._x + 'px'; _el.style.zIndex = Math.round(_el._k * 100); _el.style.opacity = _el._k; _el.style.MozOpacity = _el._k; _el.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + (_el._k*100) + ')'; } /*--- ---*/ for(var i = 0; i < img_list.length; i++){ img_list[i]._p = _p*i; img_list[i]._w = jQuery(img_list[i]).width(); img_list[i]._h = jQuery(img_list[i]).height(); elParams(img_list[i]); elStyles(img_list[i]); } _list.click(function(){ if(_list.index(this) != _a){ changeEl(_list.index(this)); return false; } }); if(stay_time && hover_f){ auto_t = setTimeout(function(){ if(_a < img_list.length - 1) changeEl(_a + 1); else changeEl(0); }, stay_time); } img_hold.mouseenter(function(){ hover_f = false; if(auto_t) clearTimeout(auto_t); }).mouseleave(function(){ hover_f = true; if(stay_time && hover_f){ auto_t = setTimeout(function(){ if(_a < img_list.length - 1) changeEl(_a + 1); else changeEl(0); }, stay_time); } }); /*--- ---*/ function elMove(){ if(_active){ if(_active._p > 0) t_p = _active._p; else t_p = 2*_pi + _active._p; if(t_p > _pi) t_p = Math.abs(2*_pi - t_p); if(t_p < Math.abs(s_p)){ s_p = 0; for(var i = 0; i < img_list.length; i++){ img_list[i]._p = Math.round(img_list[i]._p/_p)*_p; elParams(img_list[i]); elStyles(img_list[i]); } _active = false; clearTimeout(_t1); if(stay_time && hover_f){ auto_t = setTimeout(function(){ if(_a < img_list.length - 1) changeEl(_a + 1); else changeEl(0); }, stay_time); } return; } } for(var i = 0; i < img_list.length; i++){ if(img_list[i]._p >= 2*_pi) img_list[i]._p -= 2*_pi; else if(img_list[i]._p <= -2*_pi) img_list[i]._p += 2*_pi; elParams(img_list[i]); elStyles(img_list[i]); } _t1 = setTimeout(function(){ elMove(); }, 25); } function changeEl(_ind){ if(!_active && _ind != _a){ _active = img_list[_ind]; if(_t1) clearTimeout(_t1); if(auto_t) clearTimeout(auto_t); if(_active._p < 0){ if(Math.abs(_active._p) < _pi){ if(_ind < _a) s_p = _pi/50*Math.abs(_ind - _a); else s_p = _pi/50*Math.abs(_a + img_list.length - _ind); elMove(); } else{ if(_ind > _a) s_p = -_pi/50*Math.abs(_ind - _a); else s_p = -_pi/50*Math.abs(img_list.length - _a + _ind); elMove(); } } else{ if(_active._p < _pi){ if(_ind > _a) s_p = -_pi/50*Math.abs(_ind - _a); else s_p = -_pi/50*Math.abs(img_list.length - _a + _ind); elMove(); } else{ if(_ind < _a) s_p = _pi/50*Math.abs(_ind - _a); else s_p = _pi/50*Math.abs(_a + img_list.length - _ind); elMove(); } } _a = _ind; } } } } /*--- Subscribe ---*/ function initSubscribe(){ var _hold = jQuery('#subscribe'); if(_hold.length){ var _btn = _hold.children('a.btn'); var _box = _hold.children('div.box'); _btn.click(function(){ if(_hold.hasClass('opened')) _hold.removeClass('opened'); else _hold.addClass('opened'); return false; }); $(document).bind('mousedown', function(e){ if(_hold.hasClass('opened')){ e = e || event; var t = e.target || e.srcElement; t = $(t); if(!(t.parents().filter(_hold).length != 0 || t.get(0) == _hold.get(0))){ _hold.removeClass('opened'); } } }); } } /* * JavaScript Custom Forms Module */ jcf = { // global options modules: {}, plugins: {}, baseOptions: { useNativeDropOnMobileDevices: true, unselectableClass:'jcf-unselectable', labelActiveClass:'jcf-label-active', labelDisabledClass:'jcf-label-disabled', classPrefix: 'jcf-class-', hiddenClass:'jcf-hidden', focusClass:'jcf-focus', wrapperTag: 'div' }, // replacer function customForms: { setOptions: function(obj) { for(var p in obj) { if(obj.hasOwnProperty(p) && typeof obj[p] === 'object') { jcf.lib.extend(jcf.modules[p].prototype.defaultOptions, obj[p]); } } }, replaceAll: function() { for(var k in jcf.modules) { var els = jcf.lib.queryBySelector(jcf.modules[k].prototype.selector); for(var i = 0; i element and rules var head = document.getElementsByTagName('head')[0], style = document.createElement('style'), rules = document.createTextNode('.'+jcf.baseOptions.unselectableClass+'{'+ '-moz-user-select:none;'+ '-webkit-tap-highlight-color:rgba(255,255,255,0);'+ '-webkit-user-select:none;'+ 'user-select:none;'+ '}'); // append style element style.type = 'text/css'; if(style.styleSheet) { style.styleSheet.cssText = rules.nodeValue; } else { style.appendChild(rules); } head.appendChild(style); } }.init(); /* * Custom Form Control prototype */ jcf.setBaseModule({ init: function(){ if(this.options.replaces) { this.realElement = this.options.replaces; this.realElement.jcf = this; this.replaceObject(); } }, defaultOptions: { // default module options (will be merged with base options) }, checkElement: function(el){ return true; // additional check for correct form element }, replaceObject: function(){ this.createWrapper(); this.attachEvents(); this.fixStyles(); this.setupWrapper(); }, createWrapper: function(){ this.fakeElement = jcf.lib.createElement(this.options.wrapperTag); this.labelFor = jcf.lib.getLabelFor(this.realElement); jcf.lib.disableTextSelection(this.fakeElement); jcf.lib.addClass(this.fakeElement, jcf.lib.getAllClasses(this.realElement.className, this.options.classPrefix)); jcf.lib.addClass(this.realElement, jcf.baseOptions.hiddenClass); }, attachEvents: function(){ jcf.lib.event.add(this.realElement, 'focus', this.onFocusHandler, this); jcf.lib.event.add(this.realElement, 'blur', this.onBlurHandler, this); jcf.lib.event.add(this.fakeElement, 'click', this.onFakeClick, this); jcf.lib.event.add(this.fakeElement, jcf.eventPress, this.onFakePressed, this); jcf.lib.event.add(this.fakeElement, jcf.eventRelease, this.onFakeReleased, this); if(this.labelFor) { this.labelFor.jcf = this; jcf.lib.event.add(this.labelFor, 'click', this.onFakeClick, this); jcf.lib.event.add(this.labelFor, jcf.eventPress, this.onFakePressed, this); jcf.lib.event.add(this.labelFor, jcf.eventRelease, this.onFakeReleased, this); } }, fixStyles: function() { // hide mobile webkit tap effect if(jcf.isTouchDevice) { var tapStyle = 'rgba(255,255,255,0)'; this.realElement.style.webkitTapHighlightColor = tapStyle; this.fakeElement.style.webkitTapHighlightColor = tapStyle; if(this.labelFor) { this.labelFor.style.webkitTapHighlightColor = tapStyle; } } }, setupWrapper: function(){ // implement in subclass }, refreshState: function(){ // implement in subclass }, destroy: function() { if(this.fakeElement && this.fakeElement.parentNode) { this.fakeElement.parentNode.removeChild(this.fakeElement); } jcf.lib.removeClass(this.realElement, jcf.baseOptions.hiddenClass); this.realElement.jcf = null; }, onFocus: function(){ // emulated focus event jcf.lib.addClass(this.fakeElement,this.options.focusClass); }, onBlur: function(cb){ // emulated blur event jcf.lib.removeClass(this.fakeElement,this.options.focusClass); }, onFocusHandler: function() { // handle focus loses if(this.focused) return; this.focused = true; // handle touch devices also if(jcf.isTouchDevice) { if(jcf.focusedInstance && jcf.focusedInstance.realElement != this.realElement) { jcf.focusedInstance.onBlur(); jcf.focusedInstance.realElement.blur(); } jcf.focusedInstance = this; } this.onFocus.apply(this, arguments); }, onBlurHandler: function() { // handle focus loses if(!this.pressedFlag) { this.focused = false; this.onBlur.apply(this, arguments); } }, onFakeClick: function(){ if(jcf.isTouchDevice) { this.onFocus(); } else if(!this.realElement.disabled) { this.realElement.focus(); } }, onFakePressed: function(e){ this.pressedFlag = true; }, onFakeReleased: function(){ this.pressedFlag = false; }, onCreateModule: function(){ // implement in subclass }, onModuleAdded: function(module) { // implement in subclass }, onControlReady: function() { // implement in subclass } }); /* * JCF Utility Library */ jcf.lib = { bind: function(func, scope){ return function() { return func.apply(scope, arguments); } }, browser: (function() { var ua = navigator.userAgent.toLowerCase(), res = {}, match = /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+))?/.exec(ua) || []; res[match[1]] = true; res.version = match[2] || "0"; res.safariMac = ua.indexOf('mac') != -1 && ua.indexOf('safari') != -1; return res; })(), getOffset: function (obj) { if (obj.getBoundingClientRect) { var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft; var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; var clientLeft = document.documentElement.clientLeft || document.body.clientLeft || 0; var clientTop = document.documentElement.clientTop || document.body.clientTop || 0; return { top:Math.round(obj.getBoundingClientRect().top + scrollTop - clientTop), left:Math.round(obj.getBoundingClientRect().left + scrollLeft - clientLeft) } } else { var posLeft = 0, posTop = 0; while (obj.offsetParent) {posLeft += obj.offsetLeft; posTop += obj.offsetTop; obj = obj.offsetParent;} return {top:posTop,left:posLeft}; } }, getScrollTop: function() { return window.pageYOffset || document.documentElement.scrollTop; }, getScrollLeft: function() { return window.pageXOffset || document.documentElement.scrollLeft; }, getWindowWidth: function(){ return document.compatMode=='CSS1Compat' ? document.documentElement.clientWidth : document.body.clientWidth; }, getWindowHeight: function(){ return document.compatMode=='CSS1Compat' ? document.documentElement.clientHeight : document.body.clientHeight; }, getStyle: function(el, prop) { if (document.defaultView && document.defaultView.getComputedStyle) { return document.defaultView.getComputedStyle(el, null)[prop]; } else if (el.currentStyle) { return el.currentStyle[prop]; } else { return el.style[prop]; } }, getParent: function(obj, selector) { while(obj.parentNode && obj.parentNode != document.body) { if(obj.parentNode.tagName.toLowerCase() == selector.toLowerCase()) { return obj.parentNode; } obj = obj.parentNode; } return false; }, isParent: function(child, parent) { while(child.parentNode) { if(child.parentNode === parent) { return true; } child = child.parentNode; } return false; }, getLabelFor: function(object) { if(jcf.lib.getParent(object,'label')) { return object.parentNode; } else if(object.id) { return jcf.lib.queryBySelector('label[for="' + object.id + '"]')[0]; } }, disableTextSelection: function(el){ if (typeof el.onselectstart !== 'undefined') { el.onselectstart = function() {return false}; } else if(window.opera) { el.setAttribute('unselectable', 'on'); } else { jcf.lib.addClass(el, jcf.baseOptions.unselectableClass); } }, enableTextSelection: function(el) { if (typeof el.onselectstart !== 'undefined') { el.onselectstart = null; } else if(window.opera) { el.removeAttribute('unselectable'); } else { jcf.lib.removeClass(el, jcf.baseOptions.unselectableClass); } }, queryBySelector: function(selector, scope){ return this.getElementsBySelector(selector, scope); }, prevSibling: function(node) { while(node = node.previousSibling) if(node.nodeType == 1) break; return node; }, nextSibling: function(node) { while(node = node.nextSibling) if(node.nodeType == 1) break; return node; }, fireEvent: function(element,event) { if(element.dispatchEvent){ var evt = document.createEvent('HTMLEvents'); evt.initEvent(event, true, true ); return !element.dispatchEvent(evt); }else if(document.createEventObject){ var evt = document.createEventObject(); return element.fireEvent('on'+event,evt); } }, isParent: function(p, c) { while(c.parentNode) { if(p == c) { return true; } c = c.parentNode; } return false; }, inherit: function(Child, Parent) { var F = function() { } F.prototype = Parent.prototype Child.prototype = new F() Child.prototype.constructor = Child Child.superclass = Parent.prototype }, extend: function(obj) { for(var i = 1; i < arguments.length; i++) { for(var p in arguments[i]) { if(arguments[i].hasOwnProperty(p)) { obj[p] = arguments[i][p]; } } } return obj; }, hasClass: function (obj,cname) { return (obj.className ? obj.className.match(new RegExp('(\\s|^)'+cname+'(\\s|$)')) : false); }, addClass: function (obj,cname) { if (!this.hasClass(obj,cname)) obj.className += (!obj.className.length || obj.className.charAt(obj.className.length - 1) === ' ' ? '' : ' ') + cname; }, removeClass: function (obj,cname) { if (this.hasClass(obj,cname)) obj.className=obj.className.replace(new RegExp('(\\s|^)'+cname+'(\\s|$)'),' ').replace(/\s+$/, ''); }, toggleClass: function(obj, cname, condition) { if(condition) this.addClass(obj, cname); else this.removeClass(obj, cname); }, createElement: function(tagName, options) { var el = document.createElement(tagName); for(var p in options) { if(options.hasOwnProperty(p)) { switch (p) { case 'class': el.className = options[p]; break; case 'html': el.innerHTML = options[p]; break; case 'style': this.setStyles(el, options[p]); break; default: el.setAttribute(p, options[p]); } } } return el; }, setStyles: function(el, styles) { for(var p in styles) { if(styles.hasOwnProperty(p)) { switch (p) { case 'float': el.style.cssFloat = styles[p]; break; case 'opacity': el.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity='+styles[p]*100+')'; el.style.opacity = styles[p]; break; default: el.style[p] = (typeof styles[p] === 'undefined' ? 0 : styles[p]) + (typeof styles[p] === 'number' ? 'px' : ''); } } } return el; }, getInnerWidth: function(el) { return el.offsetWidth - (parseInt(this.getStyle(el,'paddingLeft')) || 0) - (parseInt(this.getStyle(el,'paddingRight')) || 0); }, getInnerHeight: function(el) { return el.offsetHeight - (parseInt(this.getStyle(el,'paddingTop')) || 0) - (parseInt(this.getStyle(el,'paddingBottom')) || 0); }, getAllClasses: function(cname, prefix, skip) { if(!skip) skip = ''; if(!prefix) prefix = ''; return cname ? cname.replace(new RegExp('(\\s|^)'+skip+'(\\s|$)'),' ').replace(/[\s]*([\S]+)+[\s]*/gi,prefix+"$1 ") : ''; }, getElementsBySelector: function(selector, scope) { if(typeof document.querySelectorAll === 'function') { return (scope || document).querySelectorAll(selector); } var selectors = selector.split(','); var resultList = []; for(var s = 0; s < selectors.length; s++) { var currentContext = [scope || document]; var tokens = selectors[s].replace(/^\s+/,'').replace(/\s+$/,'').split(' '); for (var i = 0; i < tokens.length; i++) { token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,''); if (token.indexOf('#') > -1) { var bits = token.split('#'), tagName = bits[0], id = bits[1]; var element = document.getElementById(id); if (tagName && element.nodeName.toLowerCase() != tagName) { return []; } currentContext = [element]; continue; } if (token.indexOf('.') > -1) { var bits = token.split('.'), tagName = bits[0] || '*', className = bits[1], found = [], foundCount = 0; for (var h = 0; h < currentContext.length; h++) { var elements; if (tagName == '*') { elements = currentContext[h].getElementsByTagName('*'); } else { elements = currentContext[h].getElementsByTagName(tagName); } for (var j = 0; j < elements.length; j++) { found[foundCount++] = elements[j]; } } currentContext = []; var currentContextIndex = 0; for (var k = 0; k < found.length; k++) { if (found[k].className && found[k].className.match(new RegExp('(\\s|^)'+className+'(\\s|$)'))) { currentContext[currentContextIndex++] = found[k]; } } continue; } if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) { var tagName = RegExp.$1 || '*', attrName = RegExp.$2, attrOperator = RegExp.$3, attrValue = RegExp.$4; if(attrName.toLowerCase() == 'for' && this.browser.msie && this.browser.version < 8) { attrName = 'htmlFor'; } var found = [], foundCount = 0; for (var h = 0; h < currentContext.length; h++) { var elements; if (tagName == '*') { elements = currentContext[h].getElementsByTagName('*'); } else { elements = currentContext[h].getElementsByTagName(tagName); } for (var j = 0; elements[j]; j++) { found[foundCount++] = elements[j]; } } currentContext = []; var currentContextIndex = 0, checkFunction; switch (attrOperator) { case '=': checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue) }; break; case '~': checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('(\\s|^)'+attrValue+'(\\s|$)'))) }; break; case '|': checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))) }; break; case '^': checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0) }; break; case '$': checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length) }; break; case '*': checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1) }; break; default : checkFunction = function(e) { return e.getAttribute(attrName) }; } currentContext = []; var currentContextIndex = 0; for (var k = 0; k < found.length; k++) { if (checkFunction(found[k])) { currentContext[currentContextIndex++] = found[k]; } } continue; } tagName = token; var found = [], foundCount = 0; for (var h = 0; h < currentContext.length; h++) { var elements = currentContext[h].getElementsByTagName(tagName); for (var j = 0; j < elements.length; j++) { found[foundCount++] = elements[j]; } } currentContext = found; } resultList = [].concat(resultList,currentContext); } return resultList; }, scrollSize: (function(){ var content, hold, sizeBefore, sizeAfter; function buildSizer(){ if(hold) removeSizer(); content = document.createElement('div'); hold = document.createElement('div'); hold.style.cssText = 'position:absolute;overflow:hidden;width:100px;height:100px'; hold.appendChild(content); document.body.appendChild(hold); } function removeSizer(){ document.body.removeChild(hold); hold = null; } function calcSize(vertical) { buildSizer(); content.style.cssText = 'height:'+(vertical ? '100%' : '200px'); sizeBefore = (vertical ? content.offsetHeight : content.offsetWidth); hold.style.overflow = 'scroll'; content.innerHTML = 1; sizeAfter = (vertical ? content.offsetHeight : content.offsetWidth); if(vertical && hold.clientHeight) sizeAfter = hold.clientHeight; removeSizer(); return sizeBefore - sizeAfter; } return { getWidth:function(){ return calcSize(false); }, getHeight:function(){ return calcSize(true) } } }()), domReady: function (handler){ var called = false function ready() { if (called) return; called = true; handler(); } if (document.addEventListener) { document.addEventListener("DOMContentLoaded", ready, false); } else if (document.attachEvent) { if (document.documentElement.doScroll && window == window.top) { function tryScroll(){ if (called) return if (!document.body) return try { document.documentElement.doScroll("left") ready() } catch(e) { setTimeout(tryScroll, 0) } } tryScroll() } document.attachEvent("onreadystatechange", function(){ if (document.readyState === "complete") { ready() } }) } if (window.addEventListener) window.addEventListener('load', ready, false) else if (window.attachEvent) window.attachEvent('onload', ready) }, event: (function(){ var guid = 0; function fixEvent(e) { e = e || window.event; if (e.isFixed) { return e; } e.isFixed = true; e.preventDefault = e.preventDefault || function(){this.returnValue = false} e.stopPropagation = e.stopPropagaton || function(){this.cancelBubble = true} if (!e.target) { e.target = e.srcElement } if (!e.relatedTarget && e.fromElement) { e.relatedTarget = e.fromElement == e.target ? e.toElement : e.fromElement; } if (e.pageX == null && e.clientX != null) { var html = document.documentElement, body = document.body; e.pageX = e.clientX + (html && html.scrollLeft || body && body.scrollLeft || 0) - (html.clientLeft || 0); e.pageY = e.clientY + (html && html.scrollTop || body && body.scrollTop || 0) - (html.clientTop || 0); } if (!e.which && e.button) { e.which = e.button & 1 ? 1 : (e.button & 2 ? 3 : (e.button & 4 ? 2 : 0)); } if(e.type === "DOMMouseScroll" || e.type === 'mousewheel') { e.mWheelDelta = 0; if (e.wheelDelta) { e.mWheelDelta = e.wheelDelta/120; } else if (e.detail) { e.mWheelDelta = -e.detail/3; } } return e; } function commonHandle(event, customScope) { event = fixEvent(event); var handlers = this.events[event.type]; for (var g in handlers) { var handler = handlers[g]; var ret = handler.call(customScope || this, event); if (ret === false) { event.preventDefault() event.stopPropagation() } } } var publicAPI = { add: function(elem, type, handler, forcedScope) { if (elem.setInterval && (elem != window && !elem.frameElement)) { elem = window; } if (!handler.guid) { handler.guid = ++guid; } if (!elem.events) { elem.events = {}; elem.handle = function(event) { return commonHandle.call(elem, event); } } if (!elem.events[type]) { elem.events[type] = {}; if (elem.addEventListener) elem.addEventListener(type, elem.handle, false); else if (elem.attachEvent) elem.attachEvent("on" + type, elem.handle); if(type === 'mousewheel') { publicAPI.add(elem, 'DOMMouseScroll', handler, forcedScope); } } var fakeHandler = jcf.lib.bind(handler, forcedScope); fakeHandler.guid = handler.guid; elem.events[type][handler.guid] = forcedScope ? fakeHandler : handler; }, remove: function(elem, type, handler) { var handlers = elem.events && elem.events[type]; if (!handlers) return; delete handlers[handler.guid]; for(var any in handlers) return; if (elem.removeEventListener) elem.removeEventListener(type, elem.handle, false); else if (elem.detachEvent) elem.detachEvent("on" + type, elem.handle); delete elem.events[type]; for (var any in elem.events) return; try { delete elem.handle; delete elem.events; } catch(e) { if(elem.removeAttribute) { elem.removeAttribute("handle"); elem.removeAttribute("events"); } } if(type === 'mousewheel') { publicAPI.remove(elem, 'DOMMouseScroll', handler); } } } return publicAPI; }()) } // custom radio module jcf.addModule({ name:'radio', selector: 'input[type="radio"]', defaultOptions: { wrapperClass:'rad-area', focusClass:'rad-focus', checkedClass:'rad-checked', uncheckedClass:'rad-unchecked', disabledClass:'rad-disabled', radStructure:'' }, getRadioGroup: function(item){ var name = item.getAttribute('name'); if(name) { return jcf.lib.queryBySelector('input[name="'+name+'"]', jcf.lib.getParent('form')); } else { return [item]; } }, setupWrapper: function(){ jcf.lib.addClass(this.fakeElement, this.options.wrapperClass); this.fakeElement.innerHTML = this.options.radStructure; this.realElement.parentNode.insertBefore(this.fakeElement, this.realElement); this.refreshState(); this.addEvents(); }, addEvents: function(){ jcf.lib.event.add(this.fakeElement, 'click', this.toggleRadio, this); if(this.labelFor) { jcf.lib.event.add(this.labelFor, 'click', this.toggleRadio, this); } }, onFocus: function(e) { jcf.modules[this.name].superclass.onFocus.apply(this, arguments); setTimeout(jcf.lib.bind(function(){ this.refreshState(); },this),10); }, toggleRadio: function(){ if(!this.realElement.disabled) { this.realElement.checked = true; } this.refreshState(); }, refreshState: function(){ var els = this.getRadioGroup(this.realElement); for(var i = 0; i < els.length; i++) { var curEl = els[i].jcf; if(curEl) { if(curEl.realElement.checked) { jcf.lib.addClass(curEl.fakeElement, curEl.options.checkedClass); jcf.lib.removeClass(curEl.fakeElement, curEl.options.uncheckedClass); if(curEl.labelFor) { jcf.lib.addClass(curEl.labelFor, curEl.options.labelActiveClass); } } else { jcf.lib.removeClass(curEl.fakeElement, curEl.options.checkedClass); jcf.lib.addClass(curEl.fakeElement, curEl.options.uncheckedClass); if(curEl.labelFor) { jcf.lib.removeClass(curEl.labelFor, curEl.options.labelActiveClass); } } if(curEl.realElement.disabled) { jcf.lib.addClass(curEl.fakeElement, curEl.options.disabledClass); if(curEl.labelFor) { jcf.lib.addClass(curEl.labelFor, curEl.options.labelDisabledClass); } } else { jcf.lib.removeClass(curEl.fakeElement, curEl.options.disabledClass); if(curEl.labelFor) { jcf.lib.removeClass(curEl.labelFor, curEl.options.labelDisabledClass); } } } } } }); // custom checkbox module jcf.addModule({ name:'checkbox', selector:'input[type="checkbox"]', defaultOptions: { wrapperClass:'chk-area', focusClass:'chk-focus', checkedClass:'chk-checked', labelActiveClass:'chk-label-active', uncheckedClass:'chk-unchecked', disabledClass:'chk-disabled', chkStructure:'' }, setupWrapper: function(){ jcf.lib.addClass(this.fakeElement, this.options.wrapperClass); this.fakeElement.innerHTML = this.options.chkStructure; this.realElement.parentNode.insertBefore(this.fakeElement, this.realElement); jcf.lib.event.add(this.realElement, 'click', this.onRealClick, this); this.refreshState(); }, isLinkTarget: function(target, limitParent) { while(target.parentNode || target === limitParent) { if(target.tagName.toLowerCase() === 'a') { return true; } target = target.parentNode; } }, onFakePressed: function() { jcf.modules[this.name].superclass.onFakePressed.apply(this, arguments); if(!this.realElement.disabled) { this.realElement.focus(); } }, onFakeClick: function(e) { jcf.modules[this.name].superclass.onFakeClick.apply(this, arguments); this.tmpTimer = setTimeout(jcf.lib.bind(function(){ this.toggle(); },this),10); if(!this.isLinkTarget(e.target, this.labelFor)) { return false; } }, onRealClick: function(e) { setTimeout(jcf.lib.bind(function(){ this.refreshState(); },this),10); e.stopPropagation(); }, toggle: function(e){ if(!this.realElement.disabled) { if(this.realElement.checked) { this.realElement.checked = false; } else { this.realElement.checked = true; } } this.refreshState(); return false; }, refreshState: function(){ if(this.realElement.checked) { jcf.lib.addClass(this.fakeElement, this.options.checkedClass); jcf.lib.removeClass(this.fakeElement, this.options.uncheckedClass); if(this.labelFor) { jcf.lib.addClass(this.labelFor, this.options.labelActiveClass); } } else { jcf.lib.removeClass(this.fakeElement, this.options.checkedClass); jcf.lib.addClass(this.fakeElement, this.options.uncheckedClass); if(this.labelFor) { jcf.lib.removeClass(this.labelFor, this.options.labelActiveClass); } } if(this.realElement.disabled) { jcf.lib.addClass(this.fakeElement, this.options.disabledClass); if(this.labelFor) { jcf.lib.addClass(this.labelFor, this.options.labelDisabledClass); } } else { jcf.lib.removeClass(this.fakeElement, this.options.disabledClass); if(this.labelFor) { jcf.lib.removeClass(this.labelFor, this.options.labelDisabledClass); } } } }); $(document).ready(function() { $("#formflex1513 input[type=submit]").attr("value","SUBMIT"); var clone_of_text = $('#formflex1399 p.checkbox-list span label:nth-child(1) input[type="checkbox"]').clone(); var clone_of_div = $('#formflex1399 p.checkbox-list span label:nth-child(1) div.jcf-class-checkbox-input').clone(); $('#formflex1399 p.checkbox-list span label:nth-child(1)').text('I will raise awareness in my community'); $('#formflex1399 p.checkbox-list span label:nth-child(1)').prepend(clone_of_div); $('#formflex1399 p.checkbox-list span label:nth-child(1)').prepend(clone_of_text); var clone_of_text_2 = $('#formflex1399 p.checkbox-list span label:nth-child(2) input[type="checkbox"]').clone(); var clone_of_div_2 = $('#formflex1399 p.checkbox-list span label:nth-child(2) div.jcf-class-checkbox-input').clone(); $('#formflex1399 p.checkbox-list span label:nth-child(2)').text('I will organise/host a Finish the Race event'); $('#formflex1399 p.checkbox-list span label:nth-child(2)').prepend(clone_of_div_2); $('#formflex1399 p.checkbox-list span label:nth-child(2)').prepend(clone_of_text_2); var clone_of_text_3 = $('#formflex1399 p.checkbox-list span label:nth-child(3) input[type="checkbox"]').clone(); var clone_of_div_3 = $('#formflex1399 p.checkbox-list span label:nth-child(3) div.jcf-class-checkbox-input').clone(); $('#formflex1399 p.checkbox-list span label:nth-child(3)').text('I will commit to praying for the campaign'); $('#formflex1399 p.checkbox-list span label:nth-child(3)').prepend(clone_of_div_3); $('#formflex1399 p.checkbox-list span label:nth-child(3)').prepend(clone_of_text_3); var clone_of_text_4 = $('#formflex1399 p.checkbox-list span label:nth-child(4) input[type="checkbox"]').clone(); var clone_of_div_4 = $('#formflex1399 p.checkbox-list span label:nth-child(4) div.jcf-class-checkbox-input').clone(); $('#formflex1399 p.checkbox-list span label:nth-child(4)').text('I will participate in/support a public event in my electorate'); $('#formflex1399 p.checkbox-list span label:nth-child(4)').prepend(clone_of_div_4); $('#formflex1399 p.checkbox-list span label:nth-child(4)').prepend(clone_of_text_4); $('#formflex1399 p.checkbox-1 > label').text('Monthly E-Update'); $('#formflex1399 p.checkbox-4 label.title').text('My Pledge'); var clone_of_text_5 = $('#formflex1399 p.checkbox-1 span label input[type="checkbox"]').clone(); var clone_of_div_5 = $('#formflex1399 p.checkbox-1 span label div.jcf-class-checkbox-input').clone(); $('#formflex1399 p.checkbox-1 span label').text('Please subscribe me to Micah Challenges monthly e-update'); $('#formflex1399 p.checkbox-1 span label').prepend(clone_of_div_5); $('#formflex1399 p.checkbox-1 span label').prepend(clone_of_text_5); var clone_of_text_6 = $('#formflex1506 p.checkbox-list span label:nth-child(1) input[type="checkbox"]').clone(); var clone_of_div_6 = $('#formflex1506 p.checkbox-list span label:nth-child(1) div.jcf-class-checkbox-input').clone(); $('#formflex1506 p.checkbox-list span label:nth-child(1)').text('We will raise awareness in our community'); $('#formflex1506 p.checkbox-list span label:nth-child(1)').prepend(clone_of_div_6); $('#formflex1506 p.checkbox-list span label:nth-child(1)').prepend(clone_of_text_6); var clone_of_text_7 = $('#formflex1506 p.checkbox-list span label:nth-child(2) input[type="checkbox"]').clone(); var clone_of_div_7 = $('#formflex1506 p.checkbox-list span label:nth-child(2) div.jcf-class-checkbox-input').clone(); $('#formflex1506 p.checkbox-list span label:nth-child(2)').text('We will organise/host a Finish the Race event'); $('#formflex1506 p.checkbox-list span label:nth-child(2)').prepend(clone_of_div_7); $('#formflex1506 p.checkbox-list span label:nth-child(2)').prepend(clone_of_text_7); var clone_of_text_8 = $('#formflex1506 p.checkbox-list span label:nth-child(3) input[type="checkbox"]').clone(); var clone_of_div_8 = $('#formflex1506 p.checkbox-list span label:nth-child(3) div.jcf-class-checkbox-input').clone(); $('#formflex1506 p.checkbox-list span label:nth-child(3)').text('We will commit to praying for the campaign'); $('#formflex1506 p.checkbox-list span label:nth-child(3)').prepend(clone_of_div_8); $('#formflex1506 p.checkbox-list span label:nth-child(3)').prepend(clone_of_text_8); var clone_of_text_9 = $('#formflex1506 p.checkbox-list span label:nth-child(4) input[type="checkbox"]').clone(); var clone_of_div_9 = $('#formflex1506 p.checkbox-list span label:nth-child(4) div.jcf-class-checkbox-input').clone(); $('#formflex1506 p.checkbox-list span label:nth-child(4)').text('We will participate in/support a public event in our electorate'); $('#formflex1506 p.checkbox-list span label:nth-child(4)').prepend(clone_of_div_9); $('#formflex1506 p.checkbox-list span label:nth-child(4)').prepend(clone_of_text_9); $('#formflex1506 p.checkbox-1 > label').text('Monthly E-Update'); var clone_of_text_10 = $('#formflex1506 p.checkbox-1 span label input[type="checkbox"]').clone(); $('#formflex1506 p.checkbox-1 span label').text('Please subscribe me to Micah Challenges monthly e-update'); $('#formflex1506 p.checkbox-1 span label').prepend(clone_of_text_10); var clone_of_text_11 = $('#formflex1506 p.company-name label span').clone(); $('#formflex1506 p.company-name label').text('Church'); $('#formflex1506 p.company-name label').append(clone_of_text_11); $('#formflex1506 p:nth-child(6) label.title').text('Position/Role:'); var url_grabber = window.location.pathname; //console.log(url_grabber); }); $(window).load(function(){ /*if( $.cookie('survey') === null ) { // if expired / non-existent console.log('cookie does not exist'); $('#popup-notification a').trigger('click'); $.cookie("survey", 1, {expires: 7}); console.log('cookie created'); $(document).ajaxComplete(function(){ $('#popup-notification').addClass('hidden'); setTimeout(function(){ $('#popup-notification').animate({bottom: "0px"}, 500); $('#popup-notification').removeClass('hidden').addClass('show'); }, 1000); $('#notification a.btn').click(function(){ $('#popup-notification').animate({bottom: "-120px"}, 500); $('#popup-notification').removeClass('show').addClass('hidden'); }); }); } else { console.log('cookie exists'); }*/ });