1if (typeof loadedalljs == "undefined") { var loadedalljs=true;
vendor: 93,107 bytes, lines 1-6
1/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license 2//@ sourceMappingURL=jquery-1.10.2.min.map 3*/ 4(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t 5}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle); 6u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
7 8/*! 9 * jQuery Form Plugin 10 * version: 4.2.2 11 * Requires jQuery v1.7.2 or later 12 * Project repository: https://github.com/jquery-form/form 13 * Copyright 2017 Kevin Morris 14 * Copyright 2006 M. Alsup 15 * Dual licensed under the LGPL-2.1+ or MIT licenses 16 * https://github.com/jquery-form/form#license 17 * This library is free software; you can redistribute it and/or 18 * modify it under the terms of the GNU Lesser General Public 19 * License as published by the Free Software Foundation; either 20 * version 2.1 of the License, or (at your option) any later version. 21 * This library is distributed in the hope that it will be useful, 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 * Lesser General Public License for more details. 25 */ 26/* global ActiveXObject */ 27 28/* eslint-disable */ 29(function (factory) { 30 if (typeof define === 'function' && define.amd) { 31 // AMD. Register as an anonymous module. 32 define(['jquery'], factory); 33 } else if (typeof module === 'object' && module.exports) { 34 // Node/CommonJS 35 module.exports = function( root, jQuery ) { 36 if (typeof jQuery === 'undefined') { 37 // require('jQuery') returns a factory that requires window to build a jQuery instance, we normalize how we use modules 38 // that require this pattern but the window provided is a noop if it's defined (how jquery works) 39 if (typeof window !== 'undefined') { 40 jQuery = require('jquery'); 41 } 42 else { 43 jQuery = require('jquery')(root); 44 } 45 } 46 factory(jQuery); 47 return jQuery; 48 }; 49 } else { 50 // Browser globals 51 factory(jQuery); 52 } 53 54}(function ($) { 55/* eslint-enable */ 56 'use strict'; 57 58 /* 59 Usage Note: 60 ----------- 61 Do not use both ajaxSubmit and ajaxForm on the same form. These 62 functions are mutually exclusive. Use ajaxSubmit if you want 63 to bind your own submit handler to the form. For example, 64 $(document).ready(function() { 65 $('#myForm').on('submit', function(e) { 66 e.preventDefault(); // <-- important 67 $(this).ajaxSubmit({ 68 target: '#output' 69 }); 70 }); 71 }); 72 Use ajaxForm when you want the plugin to manage all the event binding 73 for you. For example, 74 $(document).ready(function() { 75 $('#myForm').ajaxForm({ 76 target: '#output' 77 }); 78 }); 79 You can also use ajaxForm with delegation (requires jQuery v1.7+), so the 80 form does not have to exist when you invoke ajaxForm: 81 $('#myForm').ajaxForm({ 82 delegation: true, 83 target: '#output' 84 }); 85 When using ajaxForm, the ajaxSubmit function will be invoked for you 86 at the appropriate time. 87 */ 88 89 var rCRLF = /\r?\n/g; 90 91 /** 92 * Feature detection 93 */ 94 var feature = {}; 95 96 feature.fileapi = $('<input type="file">').get(0).files !== undefined; 97 feature.formdata = (typeof window.FormData !== 'undefined'); 98 99 var hasProp = !!$.fn.prop; 100 101 // attr2 uses prop when it can but checks the return type for 102 // an expected string. This accounts for the case where a form 103 // contains inputs with names like "action" or "method"; in those 104 // cases "prop" returns the element 105 $.fn.attr2 = function() { 106 if (!hasProp) { 107 return this.attr.apply(this, arguments); 108 } 109 110 var val = this.prop.apply(this, arguments); 111 112 if ((val && val.jquery) || typeof val === 'string') { 113 return val; 114 } 115 116 return this.attr.apply(this, arguments); 117 }; 118 119 /** 120 * ajaxSubmit() provides a mechanism for immediately submitting 121 * an HTML form using AJAX. 122 * 123 * @param {object|string} options jquery.form.js parameters or custom url for submission 124 * @param {object} data extraData 125 * @param {string} dataType ajax dataType 126 * @param {function} onSuccess ajax success callback function 127 */ 128 $.fn.ajaxSubmit = function(options, data, dataType, onSuccess) { 129 // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) 130 if (!this.length) { 131 log('ajaxSubmit: skipping submit process - no element selected'); 132 133 return this; 134 } 135 136 /* eslint consistent-this: ["error", "$form"] */ 137 var method, action, url, $form = this; 138 139 if (typeof options === 'function') { 140 options = {success: options}; 141 142 } else if (typeof options === 'string' || (options === false && arguments.length > 0)) { 143 options = { 144 'url' : options, 145 'data' : data, 146 'dataType' : dataType 147 }; 148 149 if (typeof onSuccess === 'function') { 150 options.success = onSuccess; 151 } 152 153 } else if (typeof options === 'undefined') { 154 options = {}; 155 } 156 157 method = options.method || options.type || this.attr2('method'); 158 action = options.url || this.attr2('action'); 159 160 url = (typeof action === 'string') ? $.trim(action) : ''; 161 url = url || window.location.href || ''; 162 if (url) { 163 // clean url (don't include hash vaue) 164 url = (url.match(/^([^#]+)/) || [])[1]; 165 } 166 167 options = $.extend(true, { 168 url : url, 169 success : $.ajaxSettings.success, 170 type : method || $.ajaxSettings.type, 171 iframeSrc : /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' // eslint-disable-line no-script-url 172 }, options); 173 174 // hook for manipulating the form data before it is extracted; 175 // convenient for use with rich editors like tinyMCE or FCKEditor 176 var veto = {}; 177 178 this.trigger('form-pre-serialize', [this, options, veto]); 179 180 if (veto.veto) { 181 log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); 182 183 return this; 184 } 185 186 // provide opportunity to alter form data before it is serialized 187 if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { 188 log('ajaxSubmit: submit aborted via beforeSerialize callback'); 189 190 return this; 191 } 192 193 var traditional = options.traditional; 194 195 if (typeof traditional === 'undefined') { 196 traditional = $.ajaxSettings.traditional; 197 } 198 199 var elements = []; 200 var qx, a = this.formToArray(options.semantic, elements, options.filtering); 201 202 if (options.data) { 203 var optionsData = $.isFunction(options.data) ? options.data(a) : options.data; 204 205 options.extraData = optionsData; 206 qx = $.param(optionsData, traditional); 207 } 208 209 // give pre-submit callback an opportunity to abort the submit 210 if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { 211 log('ajaxSubmit: submit aborted via beforeSubmit callback'); 212 213 return this; 214 } 215 216 // fire vetoable 'validate' event 217 this.trigger('form-submit-validate', [a, this, options, veto]); 218 if (veto.veto) { 219 log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); 220 221 return this; 222 } 223 224 var q = $.param(a, traditional); 225 226 if (qx) { 227 q = (q ? (q + '&' + qx) : qx); 228 } 229 230 if (options.type.toUpperCase() === 'GET') { 231 options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; 232 options.data = null; // data is null for 'get' 233 } else { 234 options.data = q; // data is the query string for 'post' 235 } 236 237 var callbacks = []; 238 239 if (options.resetForm) { 240 callbacks.push(function() { 241 $form.resetForm(); 242 }); 243 } 244 245 if (options.clearForm) { 246 callbacks.push(function() { 247 $form.clearForm(options.includeHidden); 248 }); 249 } 250 251 // perform a load on the target only if dataType is not provided 252 if (!options.dataType && options.target) { 253 var oldSuccess = options.success || function(){}; 254 255 callbacks.push(function(data, textStatus, jqXHR) { 256 var successArguments = arguments, 257 fn = options.replaceTarget ? 'replaceWith' : 'html'; 258 259 $(options.target)[fn](data).each(function(){ 260 oldSuccess.apply(this, successArguments); 261 }); 262 }); 263 264 } else if (options.success) { 265 if ($.isArray(options.success)) { 266 $.merge(callbacks, options.success); 267 } else { 268 callbacks.push(options.success); 269 } 270 } 271 272 options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg 273 var context = options.context || this; // jQuery 1.4+ supports scope context 274 275 for (var i = 0, max = callbacks.length; i < max; i++) { 276 callbacks[i].apply(context, [data, status, xhr || $form, $form]); 277 } 278 }; 279 280 if (options.error) { 281 var oldError = options.error; 282 283 options.error = function(xhr, status, error) { 284 var context = options.context || this; 285 286 oldError.apply(context, [xhr, status, error, $form]); 287 }; 288 } 289 290 if (options.complete) { 291 var oldComplete = options.complete; 292 293 options.complete = function(xhr, status) { 294 var context = options.context || this; 295 296 oldComplete.apply(context, [xhr, status, $form]); 297 }; 298 } 299 300 // are there files to upload? 301 302 // [value] (issue #113), also see comment: 303 // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219 304 var fileInputs = $('input[type=file]:enabled', this).filter(function() { 305 return $(this).val() !== ''; 306 }); 307 var hasFileInputs = fileInputs.length > 0; 308 var mp = 'multipart/form-data'; 309 var multipart = ($form.attr('enctype') === mp || $form.attr('encoding') === mp); 310 var fileAPI = feature.fileapi && feature.formdata; 311 312 log('fileAPI :' + fileAPI); 313 314 var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI; 315 var jqxhr; 316 317 // options.iframe allows user to force iframe mode 318 // 06-NOV-09: now defaulting to iframe mode if file input is detected 319 if (options.iframe !== false && (options.iframe || shouldUseFrame)) { 320 // hack to fix Safari hang (thanks to Tim Molendijk for this) 321 // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d 322 if (options.closeKeepAlive) { 323 $.get(options.closeKeepAlive, function() { 324 jqxhr = fileUploadIframe(a); 325 }); 326 327 } else { 328 jqxhr = fileUploadIframe(a); 329 } 330 331 } else if ((hasFileInputs || multipart) && fileAPI) { 332 jqxhr = fileUploadXhr(a); 333 334 } else { 335 jqxhr = $.ajax(options); 336 } 337 338 $form.removeData('jqxhr').data('jqxhr', jqxhr); 339 340 // clear element array 341 for (var k = 0; k < elements.length; k++) { 342 elements[k] = null; 343 } 344 345 // fire 'notify' event 346 this.trigger('form-submit-notify', [this, options]); 347 348 return this; 349 350 // utility fn for deep serialization 351 function deepSerialize(extraData) { 352 var serialized = $.param(extraData, options.traditional).split('&'); 353 var len = serialized.length; 354 var result = []; 355 var i, part; 356 357 for (i = 0; i < len; i++) { 358 // #252; undo param space replacement 359 serialized[i] = serialized[i].replace(/\+/g, ' '); 360 part = serialized[i].split('='); 361 // #278; use array instead of object storage, favoring array serializations 362 result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]); 363 } 364 365 return result; 366 } 367 368 // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz) 369 function fileUploadXhr(a) { 370 var formdata = new FormData(); 371 372 for (var i = 0; i < a.length; i++) { 373 formdata.append(a[i].name, a[i].value); 374 } 375 376 if (options.extraData) { 377 var serializedData = deepSerialize(options.extraData); 378 379 for (i = 0; i < serializedData.length; i++) { 380 if (serializedData[i]) { 381 formdata.append(serializedData[i][0], serializedData[i][1]); 382 } 383 } 384 } 385 386 options.data = null; 387 388 var s = $.extend(true, {}, $.ajaxSettings, options, { 389 contentType : false, 390 processData : false, 391 cache : false, 392 type : method || 'POST' 393 }); 394 395 if (options.uploadProgress) { 396 // workaround because jqXHR does not expose upload property 397 s.xhr = function() { 398 var xhr = $.ajaxSettings.xhr(); 399 400 if (xhr.upload) { 401 xhr.upload.addEventListener('progress', function(event) { 402 var percent = 0; 403 var position = event.loaded || event.position; /* event.position is deprecated */ 404 var total = event.total; 405 406 if (event.lengthComputable) {
407 percent = Math.ceil(position / total * 100); 408 } 409 410 options.uploadProgress(event, position, total, percent); 411 }, false); 412 } 413 414 return xhr; 415 }; 416 } 417 418 s.data = null; 419 420 var beforeSend = s.beforeSend; 421 422 s.beforeSend = function(xhr, o) { 423 // Send FormData() provided by user 424 if (options.formData) { 425 o.data = options.formData; 426 } else { 427 o.data = formdata; 428 } 429 430 if (beforeSend) { 431 beforeSend.call(this, xhr, o); 432 } 433 }; 434 435 return $.ajax(s); 436 } 437 438 // private function for handling file uploads (hat tip to YAHOO!) 439 function fileUploadIframe(a) { 440 var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; 441 var deferred = $.Deferred(); 442 443 // #341 444 deferred.abort = function(status) { 445 xhr.abort(status); 446 }; 447 448 if (a) { 449 // ensure that every serialized input is still enabled 450 for (i = 0; i < elements.length; i++) { 451 el = $(elements[i]); 452 if (hasProp) { 453 el.prop('disabled', false); 454 } else { 455 el.removeAttr('disabled'); 456 } 457 } 458 } 459 460 s = $.extend(true, {}, $.ajaxSettings, options); 461 s.context = s.context || s; 462 id = 'jqFormIO' + new Date().getTime(); 463 var ownerDocument = form.ownerDocument; 464 var $body = $form.closest('body'); 465 466 if (s.iframeTarget) { 467 $io = $(s.iframeTarget, ownerDocument); 468 n = $io.attr2('name'); 469 if (!n) { 470 $io.attr2('name', id); 471 } else { 472 id = n; 473 } 474 475 } else { 476 $io = $('<iframe name="' + id + '" src="' + s.iframeSrc + '" />', ownerDocument); 477 $io.css({position: 'absolute', top: '-1000px', left: '-1000px'}); 478 } 479 io = $io[0]; 480 481 482 xhr = { // mock object 483 aborted : 0, 484 responseText : null, 485 responseXML : null, 486 status : 0, 487 statusText : 'n/a', 488 getAllResponseHeaders : function() {}, 489 getResponseHeader : function() {}, 490 setRequestHeader : function() {}, 491 abort : function(status) { 492 var e = (status === 'timeout' ? 'timeout' : 'aborted'); 493 494 log('aborting upload... ' + e); 495 this.aborted = 1; 496 497 try { // #214, #257 498 if (io.contentWindow.document.execCommand) { 499 io.contentWindow.document.execCommand('Stop'); 500 } 501 } catch (ignore) {} 502 503 $io.attr('src', s.iframeSrc); // abort op in progress 504 xhr.error = e; 505 if (s.error) { 506 s.error.call(s.context, xhr, e, status); 507 } 508 509 if (g) { 510 $.event.trigger('ajaxError', [xhr, s, e]); 511 } 512 513 if (s.complete) { 514 s.complete.call(s.context, xhr, e); 515 } 516 } 517 }; 518 519 g = s.global; 520 // trigger ajax global events so that activity/block indicators work like normal 521 if (g && $.active++ === 0) { 522 $.event.trigger('ajaxStart'); 523 } 524 if (g) { 525 $.event.trigger('ajaxSend', [xhr, s]); 526 } 527 528 if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) { 529 if (s.global) { 530 $.active--; 531 } 532 deferred.reject(); 533 534 return deferred; 535 } 536 537 if (xhr.aborted) { 538 deferred.reject(); 539 540 return deferred; 541 } 542 543 // add submitting element to data if we know it 544 sub = form.clk; 545 if (sub) { 546 n = sub.name; 547 if (n && !sub.disabled) { 548 s.extraData = s.extraData || {}; 549 s.extraData[n] = sub.value; 550 if (sub.type === 'image') { 551 s.extraData[n + '.x'] = form.clk_x; 552 s.extraData[n + '.y'] = form.clk_y; 553 } 554 } 555 } 556 557 var CLIENT_TIMEOUT_ABORT = 1; 558 var SERVER_ABORT = 2; 559 560 function getDoc(frame) { 561 /* it looks like contentWindow or contentDocument do not 562 * carry the protocol property in ie8, when running under ssl 563 * frame.document is the only valid response document, since 564 * the protocol is know but not on the other two objects. strange? 565 * "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy 566 */ 567 568 var doc = null; 569 570 // IE8 cascading access check 571 try { 572 if (frame.contentWindow) { 573 doc = frame.contentWindow.document; 574 } 575 } catch (err) { 576 // IE8 access denied under ssl & missing protocol 577 log('cannot get iframe.contentWindow document: ' + err); 578 } 579 580 if (doc) { // successful getting content 581 return doc; 582 } 583 584 try { // simply checking may throw in ie8 under ssl or mismatched protocol 585 doc = frame.contentDocument ? frame.contentDocument : frame.document; 586 } catch (err) { 587 // last attempt 588 log('cannot get iframe.contentDocument: ' + err); 589 doc = frame.document; 590 } 591 592 return doc; 593 } 594 595 // Rails CSRF hack (thanks to Yvan Barthelemy) 596 var csrf_token = $('meta[name=csrf-token]').attr('content'); 597 var csrf_param = $('meta[name=csrf-param]').attr('content'); 598 599 if (csrf_param && csrf_token) { 600 s.extraData = s.extraData || {}; 601 s.extraData[csrf_param] = csrf_token; 602 } 603 604 // take a breath so that pending repaints get some cpu time before the upload starts 605 function doSubmit() { 606 // make sure form attrs are set 607 var t = $form.attr2('target'), 608 a = $form.attr2('action'), 609 mp = 'multipart/form-data', 610 et = $form.attr('enctype') || $form.attr('encoding') || mp; 611 612 // update form attrs in IE friendly way 613 form.setAttribute('target', id); 614 if (!method || /post/i.test(method)) { 615 form.setAttribute('method', 'POST'); 616 } 617 if (a !== s.url) { 618 form.setAttribute('action', s.url); 619 } 620 621 // ie borks in some cases when setting encoding 622 if (!s.skipEncodingOverride && (!method || /post/i.test(method))) { 623 $form.attr({ 624 encoding : 'multipart/form-data', 625 enctype : 'multipart/form-data' 626 }); 627 } 628 629 // support timout 630 if (s.timeout) { 631 timeoutHandle = setTimeout(function() { 632 timedOut = true; cb(CLIENT_TIMEOUT_ABORT); 633 }, s.timeout); 634 } 635 636 // look for server aborts 637 function checkState() { 638 try { 639 var state = getDoc(io).readyState; 640 641 log('state = ' + state); 642 if (state && state.toLowerCase() === 'uninitialized') { 643 setTimeout(checkState, 50); 644 } 645 646 } catch (e) { 647 log('Server abort: ', e, ' (', e.name, ')'); 648 cb(SERVER_ABORT); // eslint-disable-line callback-return 649 if (timeoutHandle) { 650 clearTimeout(timeoutHandle); 651 } 652 timeoutHandle = undefined; 653 } 654 } 655 656 // add "extra" data to form if provided in options 657 var extraInputs = []; 658 659 try { 660 if (s.extraData) { 661 for (var n in s.extraData) { 662 if (s.extraData.hasOwnProperty(n)) { 663 // if using the $.param format that allows for multiple values with the same name 664 if ($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) { 665 extraInputs.push( 666 $('<input type="hidden" name="' + s.extraData[n].name + '">', ownerDocument).val(s.extraData[n].value) 667 .appendTo(form)[0]); 668 } else { 669 extraInputs.push( 670 $('<input type="hidden" name="' + n + '">', ownerDocument).val(s.extraData[n]) 671 .appendTo(form)[0]); 672 } 673 } 674 } 675 } 676 677 if (!s.iframeTarget) { 678 // add iframe to doc and submit the form 679 $io.appendTo($body); 680 } 681 682 if (io.attachEvent) { 683 io.attachEvent('onload', cb); 684 } else { 685 io.addEventListener('load', cb, false); 686 } 687 688 setTimeout(checkState, 15); 689 690 try { 691 form.submit(); 692 693 } catch (err) { 694 // just in case form has element with name/id of 'submit' 695 var submitFn = document.createElement('form').submit; 696 697 submitFn.apply(form); 698 } 699 700 } finally { 701 // reset attrs and remove "extra" input elements 702 form.setAttribute('action', a); 703 form.setAttribute('enctype', et); // #380 704 if (t) { 705 form.setAttribute('target', t); 706 } else { 707 $form.removeAttr('target'); 708 } 709 $(extraInputs).remove(); 710 } 711 } 712 713 if (s.forceSync) { 714 doSubmit(); 715 } else { 716 setTimeout(doSubmit, 10); // this lets dom updates render 717 } 718 719 var data, doc, domCheckCount = 50, callbackProcessed; 720 721 function cb(e) { 722 if (xhr.aborted || callbackProcessed) { 723 return; 724 } 725 726 doc = getDoc(io); 727 if (!doc) { 728 log('cannot access response document'); 729 e = SERVER_ABORT; 730 } 731 if (e === CLIENT_TIMEOUT_ABORT && xhr) { 732 xhr.abort('timeout'); 733 deferred.reject(xhr, 'timeout'); 734 735 return; 736 737 } else if (e === SERVER_ABORT && xhr) { 738 xhr.abort('server abort'); 739 deferred.reject(xhr, 'error', 'server abort'); 740 741 return; 742 } 743 744 if (!doc || doc.location.href === s.iframeSrc) { 745 // response not received yet 746 if (!timedOut) { 747 return; 748 } 749 } 750 751 if (io.detachEvent) { 752 io.detachEvent('onload', cb); 753 } else { 754 io.removeEventListener('load', cb, false); 755 } 756 757 var status = 'success', errMsg; 758 759 try { 760 if (timedOut) { 761 throw 'timeout'; 762 } 763 764 var isXml = s.dataType === 'xml' || doc.XMLDocument || $.isXMLDoc(doc); 765 766 log('isXml=' + isXml); 767 768 if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) { 769 if (--domCheckCount) { 770 // in some browsers (Opera) the iframe DOM is not always traversable when 771 // the onload callback fires, so we loop a bit to accommodate 772 log('requeing onLoad callback, DOM not available'); 773 setTimeout(cb, 250); 774 775 return; 776 } 777 // let this fall through because server response could be an empty document 778 // log('Could not access iframe DOM after mutiple tries.'); 779 // throw 'DOMException: not available'; 780 } 781 782 // log('response detected'); 783 var docRoot = doc.body ? doc.body : doc.documentElement; 784 785 xhr.responseText = docRoot ? docRoot.innerHTML : null; 786 xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; 787 if (isXml) { 788 s.dataType = 'xml'; 789 } 790 xhr.getResponseHeader = function(header){ 791 var headers = {'content-type': s.dataType}; 792 793 return headers[header.toLowerCase()]; 794 }; 795 // support for XHR 'status' & 'statusText' emulation : 796 if (docRoot) { 797 xhr.status = Number(docRoot.getAttribute('status')) || xhr.status; 798 xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText; 799 } 800 801 var dt = (s.dataType || '').toLowerCase(); 802 var scr = /(json|script|text)/.test(dt); 803 804 if (scr || s.textarea) { 805 // see if user embedded response in textarea 806 var ta = doc.getElementsByTagName('textarea')[0]; 807 808 if (ta) { 809 xhr.responseText = ta.value; 810 // support for XHR 'status' & 'statusText' emulation : 811 xhr.status = Number(ta.getAttribute('status')) || xhr.status; 812 xhr.statusText = ta.getAttribute('statusText') || xhr.statusText; 813 814 } else if (scr) { 815 // account for browsers injecting pre around json response 816 var pre = doc.getElementsByTagName('pre')[0]; 817 var b = doc.getElementsByTagName('body')[0]; 818 819 if (pre) { 820 xhr.responseText = pre.textContent ? pre.textContent : pre.innerText; 821 } else if (b) { 822 xhr.responseText = b.textContent ? b.textContent : b.innerText; 823 } 824 } 825 826 } else if (dt === 'xml' && !xhr.responseXML && xhr.responseText) { 827 xhr.responseXML = toXml(xhr.responseText); // eslint-disable-line no-use-before-define 828 } 829 830 try { 831 data = httpData(xhr, dt, s); // eslint-disable-line no-use-before-define 832 833 } catch (err) { 834 status = 'parsererror'; 835 xhr.error = errMsg = (err || status); 836 } 837 838 } catch (err) { 839 log('error caught: ', err); 840 status = 'error'; 841 xhr.error = errMsg = (err || status); 842 } 843 844 if (xhr.aborted) { 845 log('upload aborted'); 846 status = null; 847 } 848 849 if (xhr.status) { // we've set xhr.status 850 status = ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) ? 'success' : 'error'; 851 } 852 853 // ordering of these callbacks/triggers is odd, but that's how $.ajax does it 854 if (status === 'success') { 855 if (s.success) { 856 s.success.call(s.context, data, 'success', xhr); 857 } 858 859 deferred.resolve(xhr.responseText, 'success', xhr); 860 861 if (g) {
862 $.event.trigger('ajaxSuccess', [xhr, s]); 863 } 864 865 } else if (status) { 866 if (typeof errMsg === 'undefined') { 867 errMsg = xhr.statusText; 868 } 869 if (s.error) { 870 s.error.call(s.context, xhr, status, errMsg); 871 } 872 deferred.reject(xhr, 'error', errMsg); 873 if (g) { 874 $.event.trigger('ajaxError', [xhr, s, errMsg]); 875 } 876 } 877 878 if (g) { 879 $.event.trigger('ajaxComplete', [xhr, s]); 880 } 881 882 if (g && !--$.active) { 883 $.event.trigger('ajaxStop'); 884 } 885 886 if (s.complete) { 887 s.complete.call(s.context, xhr, status); 888 } 889 890 callbackProcessed = true; 891 if (s.timeout) { 892 clearTimeout(timeoutHandle); 893 } 894 895 // clean up 896 setTimeout(function() { 897 if (!s.iframeTarget) { 898 $io.remove(); 899 } else { // adding else to clean up existing iframe response. 900 $io.attr('src', s.iframeSrc); 901 } 902 xhr.responseXML = null; 903 }, 100); 904 } 905 906 var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+) 907 if (window.ActiveXObject) { 908 doc = new ActiveXObject('Microsoft.XMLDOM'); 909 doc.async = 'false'; 910 doc.loadXML(s); 911 912 } else { 913 doc = (new DOMParser()).parseFromString(s, 'text/xml'); 914 } 915 916 return (doc && doc.documentElement && doc.documentElement.nodeName !== 'parsererror') ? doc : null; 917 }; 918 var parseJSON = $.parseJSON || function(s) { 919 /* jslint evil:true */ 920 return window['eval']('(' + s + ')'); // eslint-disable-line dot-notation 921 }; 922 923 var httpData = function(xhr, type, s) { // mostly lifted from jq1.4.4 924 925 var ct = xhr.getResponseHeader('content-type') || '', 926 xml = ((type === 'xml' || !type) && ct.indexOf('xml') >= 0), 927 data = xml ? xhr.responseXML : xhr.responseText; 928 929 if (xml && data.documentElement.nodeName === 'parsererror') { 930 if ($.error) { 931 $.error('parsererror'); 932 } 933 } 934 if (s && s.dataFilter) { 935 data = s.dataFilter(data, type); 936 } 937 if (typeof data === 'string') { 938 if ((type === 'json' || !type) && ct.indexOf('json') >= 0) { 939 data = parseJSON(data); 940 } else if ((type === 'script' || !type) && ct.indexOf('javascript') >= 0) { 941 $.globalEval(data); 942 } 943 } 944 945 return data; 946 }; 947 948 return deferred; 949 } 950 }; 951 952 /** 953 * ajaxForm() provides a mechanism for fully automating form submission. 954 * 955 * The advantages of using this method instead of ajaxSubmit() are: 956 * 957 * 1: This method will include coordinates for <input type="image"> elements (if the element 958 * is used to submit the form). 959 * 2. This method will include the submit element's name/value data (for the element that was 960 * used to submit the form). 961 * 3. This method binds the submit() method to the form for you. 962 * 963 * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely 964 * passes the options argument along after properly binding events for submit elements and 965 * the form itself. 966 */ 967 $.fn.ajaxForm = function(options, data, dataType, onSuccess) { 968 if (typeof options === 'string' || (options === false && arguments.length > 0)) { 969 options = { 970 'url' : options, 971 'data' : data, 972 'dataType' : dataType 973 }; 974 975 if (typeof onSuccess === 'function') { 976 options.success = onSuccess; 977 } 978 } 979 980 options = options || {}; 981 options.delegation = options.delegation && $.isFunction($.fn.on); 982 983 // in jQuery 1.3+ we can fix mistakes with the ready state 984 if (!options.delegation && this.length === 0) { 985 var o = {s: this.selector, c: this.context}; 986 987 if (!$.isReady && o.s) { 988 log('DOM not ready, queuing ajaxForm'); 989 $(function() { 990 $(o.s, o.c).ajaxForm(options); 991 }); 992 993 return this; 994 } 995 996 // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() 997 log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); 998 999 return this; 1000 } 1001 1002 if (options.delegation) { 1003 $(document) 1004 .off('submit.form-plugin', this.selector, doAjaxSubmit) 1005 .off('click.form-plugin', this.selector, captureSubmittingElement) 1006 .on('submit.form-plugin', this.selector, options, doAjaxSubmit) 1007 .on('click.form-plugin', this.selector, options, captureSubmittingElement); 1008 1009 return this; 1010 } 1011 1012 return this.ajaxFormUnbind() 1013 .on('submit.form-plugin', options, doAjaxSubmit) 1014 .on('click.form-plugin', options, captureSubmittingElement); 1015 }; 1016 1017 // private event handlers 1018 function doAjaxSubmit(e) { 1019 /* jshint validthis:true */ 1020 var options = e.data; 1021 1022 if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed 1023 e.preventDefault(); 1024 $(e.target).closest('form').ajaxSubmit(options); // #365 1025 } 1026 } 1027 1028 function captureSubmittingElement(e) { 1029 /* jshint validthis:true */ 1030 var target = e.target; 1031 var $el = $(target); 1032 1033 if (!$el.is('[type=submit],[type=image]')) { 1034 // is this a child element of the submit el? (ex: a span within a button) 1035 var t = $el.closest('[type=submit]'); 1036 1037 if (t.length === 0) { 1038 return; 1039 } 1040 target = t[0]; 1041 } 1042 1043 var form = target.form; 1044 1045 form.clk = target; 1046 1047 if (target.type === 'image') { 1048 if (typeof e.offsetX !== 'undefined') { 1049 form.clk_x = e.offsetX; 1050 form.clk_y = e.offsetY; 1051 1052 } else if (typeof $.fn.offset === 'function') { 1053 var offset = $el.offset(); 1054 1055 form.clk_x = e.pageX - offset.left; 1056 form.clk_y = e.pageY - offset.top; 1057 1058 } else { 1059 form.clk_x = e.pageX - target.offsetLeft; 1060 form.clk_y = e.pageY - target.offsetTop; 1061 } 1062 } 1063 // clear form vars 1064 setTimeout(function() { 1065 form.clk = form.clk_x = form.clk_y = null; 1066 }, 100); 1067 } 1068 1069 1070 // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm 1071 $.fn.ajaxFormUnbind = function() { 1072 return this.off('submit.form-plugin click.form-plugin'); 1073 }; 1074 1075 /** 1076 * formToArray() gathers form element data into an array of objects that can 1077 * be passed to any of the following ajax functions: $.get, $.post, or load. 1078 * Each object in the array has both a 'name' and 'value' property. An example of 1079 * an array for a simple login form might be: 1080 * 1081 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] 1082 * 1083 * It is this array that is passed to pre-submit callback functions provided to the 1084 * ajaxSubmit() and ajaxForm() methods. 1085 */ 1086 $.fn.formToArray = function(semantic, elements, filtering) { 1087 var a = []; 1088 1089 if (this.length === 0) { 1090 return a; 1091 } 1092 1093 var form = this[0]; 1094 var formId = this.attr('id'); 1095 var els = (semantic || typeof form.elements === 'undefined') ? form.getElementsByTagName('*') : form.elements; 1096 var els2; 1097 1098 if (els) { 1099 els = $.makeArray(els); // convert to standard array 1100 } 1101 1102 // #386; account for inputs outside the form which use the 'form' attribute 1103 // FinesseRus: in non-IE browsers outside fields are already included in form.elements. 1104 if (formId && (semantic || /(Edge|Trident)\//.test(navigator.userAgent))) { 1105 els2 = $(':input[form="' + formId + '"]').get(); // hat tip @thet 1106 if (els2.length) { 1107 els = (els || []).concat(els2); 1108 } 1109 } 1110 1111 if (!els || !els.length) { 1112 return a; 1113 } 1114
1115 if ($.isFunction(filtering)) { 1116 els = $.map(els, filtering); 1117 } 1118 1119 var i, j, n, v, el, max, jmax; 1120 1121 for (i = 0, max = els.length; i < max; i++) { 1122 el = els[i]; 1123 n = el.name; 1124 if (!n || el.disabled) { 1125 continue; 1126 } 1127 1128 if (semantic && form.clk && el.type === 'image') { 1129 // handle image inputs on the fly when semantic == true 1130 if (form.clk === el) { 1131 a.push({name: n, value: $(el).val(), type: el.type}); 1132 a.push({name: n + '.x', value: form.clk_x}, {name: n + '.y', value: form.clk_y}); 1133 } 1134 continue; 1135 } 1136 1137 v = $.fieldValue(el, true); 1138 if (v && v.constructor === Array) { 1139 if (elements) { 1140 elements.push(el); 1141 } 1142 for (j = 0, jmax = v.length; j < jmax; j++) { 1143 a.push({name: n, value: v[j]}); 1144 } 1145 1146 } else if (feature.fileapi && el.type === 'file') { 1147 if (elements) { 1148 elements.push(el); 1149 } 1150 1151 var files = el.files; 1152 1153 if (files.length) { 1154 for (j = 0; j < files.length; j++) { 1155 a.push({name: n, value: files[j], type: el.type}); 1156 } 1157 } else { 1158 // #180 1159 a.push({name: n, value: '', type: el.type}); 1160 } 1161 1162 } else if (v !== null && typeof v !== 'undefined') { 1163 if (elements) { 1164 elements.push(el); 1165 } 1166 a.push({name: n, value: v, type: el.type, required: el.required}); 1167 } 1168 } 1169 1170 if (!semantic && form.clk) { 1171 // input type=='image' are not found in elements array! handle it here 1172 var $input = $(form.clk), input = $input[0]; 1173 1174 n = input.name; 1175 1176 if (n && !input.disabled && input.type === 'image') { 1177 a.push({name: n, value: $input.val()}); 1178 a.push({name: n + '.x', value: form.clk_x}, {name: n + '.y', value: form.clk_y}); 1179 } 1180 } 1181 1182 return a; 1183 }; 1184 1185 /** 1186 * Serializes form data into a 'submittable' string. This method will return a string 1187 * in the format: name1=value1&name2=value2 1188 */ 1189 $.fn.formSerialize = function(semantic) { 1190 // hand off to jQuery.param for proper encoding 1191 return $.param(this.formToArray(semantic)); 1192 }; 1193 1194 /** 1195 * Serializes all field elements in the jQuery object into a query string. 1196 * This method will return a string in the format: name1=value1&name2=value2 1197 */ 1198 $.fn.fieldSerialize = function(successful) { 1199 var a = []; 1200 1201 this.each(function() { 1202 var n = this.name; 1203 1204 if (!n) { 1205 return; 1206 } 1207 1208 var v = $.fieldValue(this, successful); 1209 1210 if (v && v.constructor === Array) { 1211 for (var i = 0, max = v.length; i < max; i++) { 1212 a.push({name: n, value: v[i]}); 1213 } 1214 1215 } else if (v !== null && typeof v !== 'undefined') { 1216 a.push({name: this.name, value: v}); 1217 } 1218 }); 1219 1220 // hand off to jQuery.param for proper encoding 1221 return $.param(a); 1222 }; 1223 1224 /** 1225 * Returns the value(s) of the element in the matched set. For example, consider the following form: 1226 * 1227 * <form><fieldset> 1228 * <input name="A" type="text"> 1229 * <input name="A" type="text"> 1230 * <input name="B" type="checkbox" value="B1"> 1231 * <input name="B" type="checkbox" value="B2"> 1232 * <input name="C" type="radio" value="C1"> 1233 * <input name="C" type="radio" value="C2"> 1234 * </fieldset></form> 1235 * 1236 * var v = $('input[type=text]').fieldValue(); 1237 * // if no values are entered into the text inputs 1238 * v === ['',''] 1239 * // if values entered into the text inputs are 'foo' and 'bar' 1240 * v === ['foo','bar'] 1241 * 1242 * var v = $('input[type=checkbox]').fieldValue(); 1243 * // if neither checkbox is checked 1244 * v === undefined 1245 * // if both checkboxes are checked 1246 * v === ['B1', 'B2'] 1247 * 1248 * var v = $('input[type=radio]').fieldValue(); 1249 * // if neither radio is checked 1250 * v === undefined 1251 * // if first radio is checked 1252 * v === ['C1'] 1253 * 1254 * The successful argument controls whether or not the field element must be 'successful' 1255 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). 1256 * The default value of the successful argument is true. If this value is false the value(s) 1257 * for each element is returned. 1258 * 1259 * Note: This method *always* returns an array. If no valid value can be determined the 1260 * array will be empty, otherwise it will contain one or more values. 1261 */ 1262 $.fn.fieldValue = function(successful) { 1263 for (var val = [], i = 0, max = this.length; i < max; i++) { 1264 var el = this[i]; 1265 var v = $.fieldValue(el, successful); 1266 1267 if (v === null || typeof v === 'undefined' || (v.constructor === Array && !v.length)) { 1268 continue; 1269 } 1270 1271 if (v.constructor === Array) { 1272 $.merge(val, v); 1273 } else { 1274 val.push(v); 1275 } 1276 } 1277 1278 return val; 1279 }; 1280 1281 /** 1282 * Returns the value of the field element. 1283 */ 1284 $.fieldValue = function(el, successful) { 1285 var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); 1286 1287 if (typeof successful === 'undefined') { 1288 successful = true; 1289 } 1290 1291 /* eslint-disable no-mixed-operators */ 1292 if (successful && (!n || el.disabled || t === 'reset' || t === 'button' || 1293 (t === 'checkbox' || t === 'radio') && !el.checked || 1294 (t === 'submit' || t === 'image') && el.form && el.form.clk !== el || 1295 tag === 'select' && el.selectedIndex === -1)) { 1296 /* eslint-enable no-mixed-operators */ 1297 return null; 1298 } 1299 1300 if (tag === 'select') { 1301 var index = el.selectedIndex; 1302 1303 if (index < 0) { 1304 return null; 1305 } 1306 1307 var a = [], ops = el.options; 1308 var one = (t === 'select-one'); 1309 var max = (one ? index + 1 : ops.length); 1310 1311 for (var i = (one ? index : 0); i < max; i++) { 1312 var op = ops[i]; 1313 1314 if (op.selected && !op.disabled) { 1315 var v = op.value; 1316 1317 if (!v) { // extra pain for IE... 1318 v = (op.attributes && op.attributes.value && !(op.attributes.value.specified)) ? op.text : op.value; 1319 } 1320 1321 if (one) { 1322 return v; 1323 } 1324 1325 a.push(v); 1326 } 1327 } 1328 1329 return a; 1330 } 1331 1332 return $(el).val().replace(rCRLF, '\r\n'); 1333 }; 1334 1335 /** 1336 * Clears the form data. Takes the following actions on the form's input fields: 1337 * - input text fields will have their 'value' property set to the empty string 1338 * - select elements will have their 'selectedIndex' property set to -1 1339 * - checkbox and radio inputs will have their 'checked' property set to false 1340 * - inputs of type submit, button, reset, and hidden will *not* be effected 1341 * - button elements will *not* be effected 1342 */ 1343 $.fn.clearForm = function(includeHidden) { 1344 return this.each(function() { 1345 $('input,select,textarea', this).clearFields(includeHidden); 1346 }); 1347 }; 1348 1349 /** 1350 * Clears the selected form elements. 1351 */ 1352 $.fn.clearFields = $.fn.clearInputs = function(includeHidden) { 1353 var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list 1354 1355 return this.each(function() { 1356 var t = this.type, tag = this.tagName.toLowerCase(); 1357 1358 if (re.test(t) || tag === 'textarea') { 1359 this.value = ''; 1360 1361 } else if (t === 'checkbox' || t === 'radio') { 1362 this.checked = false;
1363 1364 } else if (tag === 'select') { 1365 this.selectedIndex = -1; 1366 1367 } else if (t === 'file') { 1368 if (/MSIE/.test(navigator.userAgent)) { 1369 $(this).replaceWith($(this).clone(true)); 1370 } else { 1371 $(this).val(''); 1372 } 1373 1374 } else if (includeHidden) { 1375 // includeHidden can be the value true, or it can be a selector string 1376 // indicating a special test; for example: 1377 // $('#myForm').clearForm('.special:hidden') 1378 // the above would clean hidden inputs that have the class of 'special' 1379 if ((includeHidden === true && /hidden/.test(t)) || 1380 (typeof includeHidden === 'string' && $(this).is(includeHidden))) { 1381 this.value = ''; 1382 } 1383 } 1384 }); 1385 }; 1386 1387 1388 /** 1389 * Resets the form data or individual elements. Takes the following actions 1390 * on the selected tags: 1391 * - all fields within form elements will be reset to their original value 1392 * - input / textarea / select fields will be reset to their original value 1393 * - option / optgroup fields (for multi-selects) will defaulted individually 1394 * - non-multiple options will find the right select to default 1395 * - label elements will be searched against its 'for' attribute 1396 * - all others will be searched for appropriate children to default 1397 */ 1398 $.fn.resetForm = function() { 1399 return this.each(function() { 1400 var el = $(this); 1401 var tag = this.tagName.toLowerCase(); 1402 1403 switch (tag) { 1404 case 'input': 1405 this.checked = this.defaultChecked; 1406 // fall through 1407 1408 case 'textarea': 1409 this.value = this.defaultValue; 1410 1411 return true; 1412 1413 case 'option': 1414 case 'optgroup': 1415 var select = el.parents('select'); 1416 1417 if (select.length && select[0].multiple) { 1418 if (tag === 'option') { 1419 this.selected = this.defaultSelected; 1420 } else { 1421 el.find('option').resetForm(); 1422 } 1423 } else { 1424 select.resetForm(); 1425 } 1426 1427 return true; 1428 1429 case 'select': 1430 el.find('option').each(function(i) { // eslint-disable-line consistent-return 1431 this.selected = this.defaultSelected; 1432 if (this.defaultSelected && !el[0].multiple) { 1433 el[0].selectedIndex = i; 1434 1435 return false; 1436 } 1437 }); 1438 1439 return true; 1440 1441 case 'label': 1442 var forEl = $(el.attr('for')); 1443 var list = el.find('input,select,textarea'); 1444 1445 if (forEl[0]) { 1446 list.unshift(forEl[0]); 1447 } 1448 1449 list.resetForm(); 1450 1451 return true; 1452 1453 case 'form': 1454 // guard against an input with the name of 'reset' 1455 // note that IE reports the reset function as an 'object' 1456 if (typeof this.reset === 'function' || (typeof this.reset === 'object' && !this.reset.nodeType)) { 1457 this.reset(); 1458 } 1459 1460 return true; 1461 1462 default: 1463 el.find('form,input,label,select,textarea').resetForm(); 1464 1465 return true; 1466 } 1467 }); 1468 }; 1469 1470 /** 1471 * Enables or disables any matching elements. 1472 */ 1473 $.fn.enable = function(b) { 1474 if (typeof b === 'undefined') { 1475 b = true; 1476 } 1477 1478 return this.each(function() { 1479 this.disabled = !b; 1480 }); 1481 }; 1482 1483 /** 1484 * Checks/unchecks any matching checkboxes or radio buttons and 1485 * selects/deselects and matching option elements. 1486 */ 1487 $.fn.selected = function(select) { 1488 if (typeof select === 'undefined') { 1489 select = true; 1490 } 1491 1492 return this.each(function() { 1493 var t = this.type; 1494 1495 if (t === 'checkbox' || t === 'radio') { 1496 this.checked = select; 1497 1498 } else if (this.tagName.toLowerCase() === 'option') { 1499 var $sel = $(this).parent('select'); 1500 1501 if (select && $sel[0] && $sel[0].type === 'select-one') { 1502 // deselect all other options 1503 $sel.find('option').selected(false); 1504 } 1505 1506 this.selected = select; 1507 } 1508 }); 1509 }; 1510 1511 // expose debug var 1512 $.fn.ajaxSubmit.debug = false; 1513 1514 // helper fn for console logging 1515 function log() { 1516 if (!$.fn.ajaxSubmit.debug) { 1517 return; 1518 } 1519 1520 var msg = '[jquery.form] ' + Array.prototype.join.call(arguments, ''); 1521 1522 if (window.console && window.console.log) { 1523 window.console.log(msg); 1524 1525 } else if (window.opera && window.opera.postError) { 1526 window.opera.postError(msg); 1527 } 1528 } 1529})); 1530 1531jQuery.fn.supersleight = function(settings) { 1532 settings = jQuery.extend({ 1533 imgs: true, 1534 backgrounds: true, 1535 shim: '/graphics/x.gif', 1536 apply_positioning: false 1537 }, settings); 1538 1539 return this.each(function(){
1540 if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7 && parseInt(jQuery.browser.version, 10) > 4) { 1541 jQuery(this).find('*').andSelf().each(function(i,obj) { 1542 var self = jQuery(obj); 1543 // background pngs 1544 if (settings.backgrounds && self.css('background-image').match(/\.png/i) !== null) { 1545 var bg = self.css('background-image'); 1546 var src = bg.substring(5,bg.length-2); 1547 var mode = (self.css('background-repeat') == 'no-repeat' ? 'crop' : 'scale'); 1548 var styles = { 1549 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')", 1550 'background-image': 'url('+settings.shim+')' 1551 }; 1552 self.css(styles); 1553 }; 1554 // image elements 1555 if (settings.imgs && self.is('img[src$=png]')){ 1556 var styles = { 1557 'width': self.width() + 'px', 1558 'height': self.height() + 'px', 1559 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + self.attr('src') + "', sizingMethod='scale')" 1560 }; 1561 self.css(styles).attr('src', settings.shim); 1562 }; 1563 // apply position to 'active' elements 1564 if (settings.apply_positioning && self.is('a, input') && (self.css('position') === '' || self.css('position') == 'static')){ 1565 self.css('position', 'relative'); 1566 }; 1567 }); 1568 }; 1569 }); 1570}; 1571 1572/* 1573 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined 1574 * in FIPS 180-1 1575 * Version 2.2 Copyright Paul Johnston 2000 - 2009. 1576 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet 1577 * Distributed under the BSD License 1578 * See http://pajhome.org.uk/crypt/md5 for details. 1579 */ 1580var hexcase=0;var b64pad="";function hex_sha1(a){return rstr2hex(rstr_sha1(str2rstr_utf8(a)))}function hex_hmac_sha1(a,b){return rstr2hex(rstr_hmac_sha1(str2rstr_utf8(a),str2rstr_utf8(b)))}function sha1_vm_test(){return hex_sha1("abc").toLowerCase()=="a9993e364706816aba3e25717850c26c9cd0d89d"}function rstr_sha1(a){return binb2rstr(binb_sha1(rstr2binb(a),a.length*8))}function rstr_hmac_sha1(c,f){var e=rstr2binb(c);if(e.length>16){e=binb_sha1(e,c.length*8)}var a=Array(16),d=Array(16);for(var b=0;b<16;b++){a[b]=e[b]^909522486;d[b]=e[b]^1549556828}var g=binb_sha1(a.concat(rstr2binb(f)),512+f.length*8);return binb2rstr(binb_sha1(d.concat(g),512+160))}function rstr2hex(c){try{hexcase}catch(g){hexcase=0}var f=hexcase?"0123456789ABCDEF":"0123456789abcdef";var b="";var a;for(var d=0;d<c.length;d++){a=c.charCodeAt(d);b+=f.charAt((a>>>4)&15)+f.charAt(a&15)}return b}function str2rstr_utf8(c){var b="";var d=-1;var a,e;while(++d<c.length){a=c.charCodeAt(d);e=d+1<c.length?c.charCodeAt(d+1):0;if(55296<=a&&a<=56319&&56320<=e&&e<=57343){a=65536+((a&1023)<<10)+(e&1023);d++}if(a<=127){b+=String.fromCharCode(a)}else{if(a<=2047){b+=String.fromCharCode(192|((a>>>6)&31),128|(a&63))}else{if(a<=65535){b+=String.fromCharCode(224|((a>>>12)&15),128|((a>>>6)&63),128|(a&63))}else{if(a<=2097151){b+=String.fromCharCode(240|((a>>>18)&7),128|((a>>>12)&63),128|((a>>>6)&63),128|(a&63))}}}}}return b}function rstr2binb(b){var a=Array(b.length>>2);for(var c=0;c<a.length;c++){a[c]=0}for(var c=0;c<b.length*8;c+=8){a[c>>5]|=(b.charCodeAt(c/8)&255)<<(24-c%32)}return a}function binb2rstr(b){var a="";for(var c=0;c<b.length*32;c+=8){a+=String.fromCharCode((b[c>>5]>>>(24-c%32))&255)}return a}function binb_sha1(v,o){v[o>>5]|=128<<(24-o%32);v[((o+64>>9)<<4)+15]=o;var y=Array(80);var u=1732584193;var s=-271733879;var r=-1732584194;var q=271733878;var p=-1009589776;for(var l=0;l<v.length;l+=16){var n=u;var m=s;var k=r;var h=q;var f=p;for(var g=0;g<80;g++){if(g<16){y[g]=v[l+g]}else{y[g]=bit_rol(y[g-3]^y[g-8]^y[g-14]^y[g-16],1)}var z=safe_add(safe_add(bit_rol(u,5),sha1_ft(g,s,r,q)),safe_add(safe_add(p,y[g]),sha1_kt(g)));p=q;q=r;r=bit_rol(s,30);s=u;u=z}u=safe_add(u,n);s=safe_add(s,m);r=safe_add(r,k);q=safe_add(q,h);p=safe_add(p,f)}return Array(u,s,r,q,p)}function sha1_ft(e,a,g,f){if(e<20){return(a&g)|((~a)&f)}if(e<40){return a^g^f}if(e<60){return(a&g)|(a&f)|(g&f)}return a^g^f}function sha1_kt(a){return(a<20)?1518500249:(a<40)?1859775393:(a<60)?-1894007588:-899497514}function safe_add(a,d){var c=(a&65535)+(d&65535);var b=(a>>16)+(d>>16)+(c>>16);return(b<<16)|(c&65535)}function bit_rol(a,b){return(a<<b)|(a>>>(32-b))}; 1581 1582/* 1583 * jQuery Color Animations 1584 * Copyright 2007 John Resig 1585 * Released under the MIT and GPL licenses. 1586 */ 1587 1588(function(jQuery){ 1589 1590 // We override the animation for all of these color styles 1591 jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ 1592 jQuery.fx.step[attr] = function(fx){ 1593 if ( fx.state == 0 ) { 1594 fx.start = getColor( fx.elem, attr ); 1595 fx.end = getRGB( fx.end ); 1596 } 1597 1598 fx.elem.style[attr] = "rgb(" + [ 1599 Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0
1599), 1600 Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), 1601 Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0) 1602 ].join(",") + ")"; 1603 } 1604 }); 1605 1606 // Color Conversion functions from highlightFade 1607 // By Blair Mitchelmore 1608 // http://jquery.offput.ca/highlightFade/ 1609 1610 // Parse strings looking for color tuples [255,255,255] 1611 function getRGB(color) { 1612 var result; 1613 1614 // Check if we're already dealing with an array of colors 1615 if ( color && color.constructor == Array && color.length == 3 ) 1616 return color; 1617 1618 // Look for rgb(num,num,num) 1619 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) 1620 return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; 1621 1622 // Look for rgb(num%,num%,num%) 1623 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) 1624 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; 1625 1626 // Look for #a0b1c2 1627 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) 1628 return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; 1629 1630 // Look for #fff 1631 if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) 1632 return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; 1633 1634 // Otherwise, we're most likely dealing with a named color 1635 return colors[jQuery.trim(color).toLowerCase()]; 1636 } 1637 1638 function getColor(elem, attr) { 1639 var color; 1640 1641 do { 1642 color = jQuery.curCSS(elem, attr); 1643 1644 // Keep going until we find an element that has color, or we hit the body 1645 if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") ) 1646 break; 1647 1648 attr = "backgroundColor"; 1649 } while ( elem = elem.parentNode ); 1650 1651 return getRGB(color); 1652 }; 1653 1654 // Some named colors to work with 1655 // From Interface by Stefan Petre 1656 // http://interface.eyecon.ro/ 1657 1658 var colors = { 1659 aqua:[0,255,255], 1660 azure:[240,255,255], 1661 beige:[245,245,220], 1662 black:[0,0,0], 1663 blue:[0,0,255], 1664 brown:[165,42,42], 1665 cyan:[0,255,255], 1666 darkblue:[0,0,139], 1667 darkcyan:[0,139,139], 1668 darkgrey:[169,169,169], 1669 darkgreen:[0,100,0], 1670 darkkhaki:[189,183,107], 1671 darkmagenta:[139,0,139], 1672 darkolivegreen:[85,107,47], 1673 darkorange:[255,140,0], 1674 darkorchid:[153,50,204], 1675 darkred:[139,0,0], 1676 darksalmon:[233,150,122], 1677 darkviolet:[148,0,211], 1678 fuchsia:[255,0,255], 1679 gold:[255,215,0], 1680 green:[0,128,0], 1681 indigo:[75,0,130], 1682 khaki:[240,230,140], 1683 lightblue:[173,216,230], 1684 lightcyan:[224,255,255], 1685 lightgreen:[144,238,144], 1686 lightgrey:[211,211,211], 1687 lightpink:[255,182,193], 1688 lightyellow:[255,255,224], 1689 lime:[0,255,0], 1690 magenta:[255,0,255], 1691 maroon:[128,0,0], 1692 navy:[0,0,128], 1693 olive:[128,128,0], 1694 orange:[255,165,0], 1695 pink:[255,192,203], 1696 purple:[128,0,128], 1697 violet:[128,0,128], 1698 red:[255,0,0], 1699 silver:[192,192,192], 1700 white:[255,255,255], 1701 yellow:[255,255,0] 1702 }; 1703 1704})(jQuery); 1705 1706 1707/*! jQuery UI - v1.9.1 - 2012-11-14 1708* http://jqueryui.com 1709* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js 1710* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */ 1711 1712(function(e,t){function i(t,n){var r,i,o,u=t.nodeName.toLowerCase();return"area"===u?(r=t.parentNode,i=r.name,!t.href||!i||r.nodeName.toLowerCase()!=="map"?!1:(o=e("img[usemap=#"+i+"]")[0],!!o&&s(o))):(/input|select|textarea|button|object/.test(u)?!t.disabled:"a"===u?t.href||n:n)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().andSelf().filter(function(){return e.css(this,"visibility")==="hidden"}).length}var n=0,r=/^ui-id-\d+$/;e.ui=e.ui||{};if(e.ui.version)return;e.extend(e.ui,{version:"1.9.1",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({_focus:e.fn.focus,focus:function(t,n){return typeof t=="number"?this.each(function(){var r=this;setTimeout(function(){e(r).focus(),n&&n.call(r)},t)}
vendor: 12,603 bytes, line 1712
1712):this._focus.apply(this,arguments)},scrollParent:function(){var t;return e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?t=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):t=this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css("zIndex",n);if(this.length){var r=e(this[0]),i,s;while(r.length&&r[0]!==document){i=r.css("position");if(i==="absolute"||i==="relative"||i==="fixed"){s=parseInt(r.css("zIndex"),10);if(!isNaN(s)&&s!==0)return s}r=r.parent()}}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++n)})},removeUniqueId:function(){return this.each(function(){r.test(this.id)&&e(this).removeAttr("id")})}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(n,r){function u(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.css(t,"padding"+this))||0,r&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var i=r==="Width"?["Left","Right"]:["Top","Bottom"],s=r.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+r]=function(n){return n===t?o["inner"+r].call(this):this.each(function(){e(this).css(s,u(this,n)+"px")})},e.fn["outer"+r]=function(t,n){return typeof t!="number"?o["outer"+r].call(this,t):this.each(function(){e(this).css(s,u(this,t,!0,n)+"px")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),r=isNaN(n);return(r||n>=0)&&i(t,!r)}}),e(function(){var t=document.body,n=t.appendChild(n=document.createElement("div"));n.offsetHeight,e.extend(n.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),e.support.minHeight=n.offsetHeight===100,e.support.selectstart="onselectstart"in n,t.removeChild(n).style.display="none"}),function(){var t=/msie ([\w.]+)/.exec(navigator.userAgent.toLowerCase())||[];e.ui.ie=t.length?!0:!1,e.ui.ie6=parseFloat(t[1],10)===6}(),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n){var r,i=e.plugins[t];if(!i||!e.element[0].parentNode||e.element[0].parentNode.nodeType===11)return;for(r=0;r<i.length;r++)e.options[i[r][0]]&&i[r][1].apply(e.element,n)}},contains:e.contains,hasScroll:function(t,n){if(e(t).css("overflow")==="hidden")return!1;var r=n&&n==="left"?"scrollLeft":"scrollTop",i=!1;return t[r]>0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},isOverAxis:function(e,t,n){return e>t&&e<t+n},isOver:function(t,n,r,i,s,o){return e.ui.isOverAxis(t,r,s)&&e.ui.isOverAxis(n,i,o)}})})(jQuery);(function(e,t){var n=0,r=Array.prototype.slice,i=e.cleanData;e.cleanData=function(t){for(var n=0,r;(r=t[n])!=null;n++)try{e(r).triggerHandler("remove")}catch(s){}i(t)},e.widget=function(t,n,r){var i,s,o,u,a=t.split(".")[0];t=t.split(".")[1],i=a+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][i.toLowerCase()]=function(t){return!!e.data(t,i)},e[a]=e[a]||{},s=e[a][t],o=e[a][t]=function(e,t){if(!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)},e.extend(o,s,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),u=new n,u.options=e.widget.extend({},u.options),e.each(r,function(t,i){e.isFunction(i)&&(r[t]=function(){var e=function(){return n.prototype[t].apply(this,arguments)},r=function(e){return n.prototype[t].apply(this,e)};return function(){var t=this._super,n=this._superApply,s;return this._super=e,this._superApply=r,s=i.apply(this,arguments),this._super=t,this._superApply=n,s}}())}),o.prototype=e.widget.extend(u,{widgetEventPrefix:u.widgetEventPrefix||t},r,{constructor:o,namespace:a,widgetName:t,widgetBaseClass:i,widgetFullName:i}),s?(e.each(s._childConstructors,function(t,n){var r=n.prototype;e.widget(r.namespace+"."+r.widgetName,o,n._proto)}),delete s._childConstructors):n._childConstructors.push(o),e.widget.bridge(t,o)},e.widget.extend=function(n){var i=r.call(arguments,1),s=0,o=i.length,u,a;for(;s<o;s++)for(u in i[s])a=i[s][u],i[s].hasOwnProperty(u)&&a!==t&&(e.isPlainObject(a)?n[u]=e.isPlainObject(n[u])?e.widget.extend({},n[u],a):e.widget.extend({},a):n[u]=a);return n},e.widget.bridge=function(n,i){var s=i.prototype.widgetFullName;e.fn[n]=function(o){var u=typeof o=="string",a=r.call(arguments,1),f=this;return o=!u&&a.length?e.widget.extend.apply(null,[o].concat(a)):o,u?this.each(function(){var r,i=e.data(this,s);if(!i)return e.error("cannot call methods on "+n+" prior to initialization; "+"attempted to call method '"+o+"'");if(!e.isFunction(i[o])||o.charAt(0)==="_")return e.error("no such method '"+o+"' for "+n+" widget instance");r=i[o].apply(i,a);if(r!==i&&r!==t)return f=r&&r.jquery?f.pushStack(r.get()):r,!1}):this.each(function(){var t=e.data(this,s);t?t.option(o||{})._init():new i(o,this)}),f}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,r){r=e(r||this.defaultElement||this)[0],this.element=e(r),this.uuid=n++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),r!==this&&(e.data(r,this.widgetName,this),e.data(r,this.widgetFullName,this),this._on(this.element,{remove:function(e){e.target===r&&this.destroy()}}),this.document=e(r.style?r.ownerDocument:r.document||r),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(n,r){var i=n,s,o,u;if(arguments.length===0)return e.widget.extend({},this.options);if(typeof n=="string"){i={},s=n.split("."),n=s.shift();if(s.length){o=i[n]=e.widget.extend({},this.options[n]);for(u=0;u<s.length-1;u++)o[s[u]]=o[s[u]]||{},o=o[s[u]];n=s.pop();if(r===t)return o[n]===t?null:o[n];o[n]=r}else{if(r===t)return this.options[n]===t?null:this.options[n];i[n]=r}}return this._setOptions(i),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,e==="disabled"&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(t,n){var r,i=this;n?(t=r=e(t),this.bindings=this.bindings.add(t)):(n=t,t=this.element,r=this.widget()),e.each(n,function(n,s){function o(){if(i.options.disabled===!0||e(this).hasClass("ui-state-disabled"))return;return(typeof s=="string"?i[s]:s).apply(i,arguments)}typeof s!="string"&&(o.guid=s.guid=s.guid||o.guid||e.guid++);var u=n.match(/^(\w+)\s*(.*)$/),a=u[1]+i.eventNamespace,f=u[2];f?r.delegate(f,a,o):t.bind(a,o)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function n(){return(typeof e=="string"?r[e]:e).apply(r,arguments)}var r=this;return setTimeout(n,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,n,r){var i,s,o=this.options[t];r=r||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],s=n.originalEvent;if(s)for(i in s)i in n||(n[i]=s[i]);return this.element.trigger(n,r),!(e.isFunction(o)&&o.apply(this.element[0],[n].concat(r))===!1||n.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,n){e.Widget.prototype["_"+t]=function(r,i,s){typeof i=="string"&&(i={effect:i});var o,u=i?i===!0||typeof i=="number"?n:i.effect||n:t;i=i||{},typeof i=="number"&&(i={duration:i}),o=!e.isEmptyObject(i),i.complete=s,i.delay&&r.delay(i.delay),o&&e.effects&&(e.effects.effect[u]||e.uiBackCompat!==!1&&e.effects[u])?r[t](i):u!==t&&r[u]?r[u](i.duration,i.easing,s):r.queue(function(n){e(this)[t](),s&&s.call(r[0]),n()})}}),e.uiBackCompat!==!1&&(e.Widget.prototype._getCreateOptions=function(){return e.metadata&&e.metadata.get(this.element[0])[this.widgetName]})})(jQuery);(function(e,t){var n=!1;e(document).mouseup(function(e){n=!1}),e.widget("ui.mouse",{version:"1.9.1",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(n){if(!0===e.data(n.target,t.widgetName+".preventClickEvent"))return e.removeData(n.target,t.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(n)return;this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var r=this,i=t.which===1,s=typeof this.options.cancel=="string"&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;if(!i||s||!this._mouseCapture(t))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){r.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)){this._mouseStarted=this._mouseStart(t)!==!1;if(!this._mouseStarted)return t.preventDefault(),!0}return!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return r._mouseMove(e)},this._mouseUpDelegate=function(e){return r._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),n=!0,!0},_mouseMove:function(t){return!e.ui.ie||document.documentMode>=9||!!t.button?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(e){return this.mouseDelayMet},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0
vendor: 18,460 bytes, line 1712
1712}})})(jQuery);(function(e,t){e.widget("ui.draggable",e.ui.mouse,{version:"1.9.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var n=this.options;return this.helper||n.disabled||e(t.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(t),this.handle?(e(n.iframeFix===!0?"iframe":n.iframeFix).each(function(){e('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var n=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),n.containment&&this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,n){this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute");if(!n){var r=this._uiHash();if(this._trigger("drag",t,r)===!1)return this._mouseUp({}),!1;this.position=r.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var n=!1;e.ui.ddmanager&&!this.options.dropBehaviour&&(n=e.ui.ddmanager.drop(this,t)),this.dropped&&(n=this.dropped,this.dropped=!1);var r=this.element[0],i=!1;while(r&&(r=r.parentNode))r==document&&(i=!0);if(!i&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!n||this.options.revert=="valid"&&n||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,n)){var s=this;e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){s._trigger("stop",t)!==!1&&s._clear()})}else this._trigger("stop",t)!==!1&&this._clear();return!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){var n=!this.options.handle||!e(this.options.handle,this.element).length?!0:!1;return e(this.options.handle,this.element).find("*").andSelf().each(function(){this==t.target&&(n=!0)}),n},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t])):n.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return r.parents("body").length||r.appendTo(n.appendTo=="parent"?this.element[0].parentNode:n.appendTo),r[0]!=this.element[0]&&!/(fixed|absolute)/.test(r.css("position"))&&r.css("position","absolute"),r},_adjustOffsetFromHelper:function(t){typeof t=="string"&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&e.ui.ie)t={top:0,left:0};return{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t=this.options;t.containment=="parent"&&(t.containment=this.helper[0].parentNode);if(t.containment=="document"||t.containment=="window")this.containment=[t.containment=="document"?0:e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t.containment=="document"?0:e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(t.containment=="document"?0:e(window).scrollLeft())+e(t.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(t.containment=="document"?0:e(window).scrollTop())+(e(t.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(t.containment)&&t.containment.constructor!=Array){var n=e(t.containment),r=n[0];if(!r)return;var i=n.offset(),s=e(r).css("overflow")!="hidden";this.containment=[(parseInt(e(r).css("borderLeftWidth"),10)||0)+(parseInt(e(r).css("paddingLeft"),10)||0),(parseInt(e(r).css("borderTopWidth"),10)||0)+(parseInt(e(r).css("paddingTop"),10)||0),(s?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(e(r).css("borderLeftWidth"),10)||0)-(parseInt(e(r).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(s?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(e(r).css("borderTopWidth"),10)||0)-(parseInt(e(r).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=n}else t.containment.constructor==Array&&(this.containment=t.containment)},_convertPositionTo:function(t,n){n||(n=this.position);var r=t=="absolute"?1:-1,i=this.options,s=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(s[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():o?0:s.scrollTop())*r,left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():o?0:s.scrollLeft())*r}},_generatePosition:function(t){var n=this.options,r=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,i=/(html|body)/i.test(r[0].tagName),s=t.pageX,o=t.pageY;if(this.originalPosition){var u;if(this.containment){if(this.relative_container){var a=this.relative_container.offset();u=[this.containment[0]+a.left,this.containment[1]+a.top,this.containment[2]+a.left,this.containment[3]+a.top]}else u=this.containment;t.pageX-this.offset.click.left<u[0]&&(s=u[0]+this.offset.click.left),t.pageY-this.offset.click.top<u[1]&&(o=u[1]+this.offset.click.top),t.pageX-this.offset.click.left>u[2]&&(s=u[2]+this.offset.click.left),t.pageY-this.offset.click.top>u[3]&&(o=u[3]+this.offset.click.top)}if(n.grid){var f=n.grid[1]?this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1]:this.originalPageY;o=u?f-this.offset.click.top<u[1]||f-this.offset.click.top>u[3]?f-this.offset.click.top<u[1]?f+n.grid[1]:f-n.grid[1]:f:f;var l=n.grid[0]?this.originalPageX+Math.round((s-this.originalPageX)/n.grid[0])*n.grid[0]:this.originalPageX;s=u?l-this.offset.click.left<u[0]||l-this.offset.click.left>u[2]?l-this.offset.click.left<u[0]?l+n.grid[0]:l-n.grid[0]:l:l}}return{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():i?0:r.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:r.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,n,r){return r=r||this._uiHash(),e.ui.plugin.call(this,t,[n,r]),t=="drag"&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,n,r)},plugins:{},_uiHash:function(e){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,n){var r=e(this).data("draggable"),i=r.options,s=e.extend({},n,{item:r.element});r.sortables=[],e(i.connectToSortable).each(function(){var n=e.data(this,"sortable");n&&!n.options.disabled&&(r.sortables.push({instance:n,shouldRevert:n.options.revert}),n.refreshPositions(),n._trigger("activate",t,s))})},stop:function(t,n){var r=e(this).data("draggable"),i=e.extend({},n,{item:r.element});e.each(r.sortables,function(){this.instance.isOver?(this.instance.isOver=0,r.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,r.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,i))})},drag:function(t,n){var r=e(this).data("draggable"),i=this,s=function(t){var n=this.offset.click.top,r=this.offset.click.left,i=this.positionAbs.top,s=this.positionAbs.left,o=t.height,u=t.width,a=t.top,f=t.left;return e.ui.isOver(i+n,s+r,a,f,o,u)};e.each(r.sortables,function(s){var o=!1,u=this;this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(o=!0,e.each(r.sortables,function(){return this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this!=u&&this.instance._intersectsWith(this.instance.containerCache)&&e.ui.contains(u.instance.element[0],this.instance.element[0])&&(o=!1),o})),o?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(i).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return n.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=r.offset.click.top,this.instance.offset.click.left=r.offset.click.left,this.instance.offset.parent.left-=r.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=r.offset.parent.top-this.instance.offset.parent.top,r._trigger("toSortable",t),r.dropped=this.instance.element,r.currentItem=r.element,this.instance.fromOutside=r),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),r._trigger("fromSortable",t),r.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,n){var r=e("body"),i=e(this).data("draggable").options;r.css("cursor")&&(i._cursor=r.css("cursor")),r.css("cursor",i.cursor)},stop:function(t,n){var r=e(this).data("draggable").options;r._cursor&&e("body").css("cursor",r._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,n){var r=e(n.helper),i=e(this).data("draggable").options;r.css("opacity")&&(i._opacity=r.css("opacity")),r.css("opacity",i.opacity)},stop:function(t,n){var r=e(this).data("draggable").options;r._opacity&&e(n.helper).css("opacity",r._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(t,n){var r=e(this).data("draggable");r.scrollParent[0]!=document&&r.scrollParent[0].tagName!="HTML"&&(r.overflowOffset=r.scrollParent.offset())},drag:function(t,n){var r=e(this).data("draggable"),i=r.options,s=!1;if(r.scrollParent[0]!=document&&r.scrollParent[0].tagName!="HTML"){if(!i.axis||i.axis!="x")r.overflowOffset.top+r.scrollParent[0].offsetHeight-t.pageY<i.scrollSensitivity?r.scrollParent[0].scrollTop=s=r.scrollParent[0].scrollTop+i.scrollSpeed:t.pageY-r.overflowOffset.top<i.scrollSensitivity&&(r.scrollParent[0].scrollTop=s=r.scrollParent[0].scrollTop-i.scrollSpeed);if(!i.axis||i.axis!="y")r.overflowOffset.left+r.scrollParent[0].offsetWidth-t.pageX<i.scrollSensitivity?r.scrollParent[0].scrollLeft=s=r.scrollParent[0].scrollLeft+i.scrollSpeed:t.pageX-r.overflowOffset.left<i.scrollSensitivity&&(r.scrollParent[0].scrollLeft=s=r.scrollParent[0].scrollLeft-i.scrollSpeed)}else{if(!i.axis||i.axis!="x")t.pageY-e(document).scrollTop()<i.scrollSensitivity?s=e(document).scrollTop(e(document).scrollTop()-i.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<i.scrollSensitivity&&(s=e(document).scrollTop(e(document).scrollTop()+i.scrollSpeed));if(!i.axis||i.axis!="y")t.pageX-e(document).scrollLeft()<i.scrollSensitivity?s=e(document).scrollLeft(e(document).scrollLeft()-i.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<i.scrollSensitivity&&(s=e(document).scrollLeft(e(document).scrollLeft()+i.scrollSpeed))}s!==!1&&e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(r,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,n){var r=e(this).data("draggable"),i=r.options;r.snapElements=[],e(i.snap.constructor!=String?i.snap.items||":data(draggable)":i.snap).each(function(){var t=e(this),n=t.offset();this!=r.element[0]&&r.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:n.top,left:n.left})})},drag:function(t,n){var r=e(this).data("draggable"),i=r.options,s=i.snapTolerance,o=n.offset.left,u=o+r.helperProportions.width,a=n.offset.top,f=a+r.helperProportions.height;for(var l=r.snapElements.length-1;l>=0;l--){var c=r.snapElements[l].left,h=c+r.snapElements[l].width,p=r.snapElements[l].top,d=p+r.snapElements[l].height;if(!(c-s<o&&o<h+s&&p-s<a&&a<d+s||c-s<o&&o<h+s&&p-s<f&&f<d+s||c-s<u&&u<h+s&&p-s<a&&a<d+s||c-s<u&&u<h+s&&p-s<f&&f<d+s)){r.snapElements[l].snapping&&r.options.snap.release&&r.options.snap.release.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[l].item})),r.snapElements[l].snapping=!1;continue}if(i.snapMode!="inner"){var v=Math.abs(p-f)<=s,m=Math.abs(d-a)<=s,g=Math.abs(c-u)<=s,y=Math.abs(h-o)<=s;v&&(n.position.top=r._convertPositionTo("relative",{top:p-r.helperProportions.height,left:0}).top-r.margins.top),m&&(n.position.top=r._convertPositionTo("relative",{top:d,left:0}).top-r.margins.top),g&&(n.position.left=r._convertPositionTo("relative",{top:0,left:c-r.helperProportions.width}).left-r.margins.left),y&&(n.position.left=r._convertPositionTo("relative",{top:0,left:h}).left-r.margins.left)}var b=v||m||g||y;if(i.snapMode!="outer"){var v=Math.abs(p-a)<=s,m=Math.abs(d-f)<=s,g=Math.abs(c-o)<=s,y=Math.abs(h-u)<=s;v&&(n.position.top=r._convertPositionTo("relative",{top:p,left:0}).top-r.margins.top),m&&(n.position.top=r._convertPositionTo("relative",{top:d-r.helperProportions.height,left:0}).top-r.margins.top),g&&(n.position.left=r._convertPositionTo("relative",{top:0,left:c}).left-r.margins.left),y&&(n.position.left=r._convertPositionTo("relative",{top:0,left:h-r.helperProportions.width}).left-r.margins.left)}!r.snapElements[l].snapping&&(v||m||g||y||b)&&r.options.snap.snap&&r.options.snap.snap.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[l].item})),r.snapElements[l].snapping=v||m||g||y||b}}}),e.ui.plugin.add("draggable","stack",{start:function(t,n){var r=e(this).data("draggable").options,i=e.makeArray(e(r.stack)).sort(function(t,n){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(n).css("zIndex"),10)||0)});if(!i.length)return;var s=parseInt(i[0].style.zIndex)||0;e(i).each(function(e){this.style.zIndex=s+e}),this[0].style.zIndex=s+i.length}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,n){var r=e(n.helper),i=e(this).data("draggable").options;r.css("zIndex")&&(i._zIndex=r.css("zIndex")),r.css("zIndex",i.zIndex)},stop:function(t,n){var r=e(this).data("draggable").options;r._zIndex&&e(n.helper).css("zIndex",r._zIndex)}})})(jQuery);
1712 1713
vendor: 16,526 bytes, lines 1714-2213
1714/* 1715 * jPlayer Plugin for jQuery JavaScript Library 1716 * http://www.jplayer.org 1717 * 1718 * Copyright (c) 2009 - 2014 Happyworm Ltd 1719 * Licensed under the MIT license. 1720 * http://opensource.org/licenses/MIT 1721 * 1722 * Author: Mark J Panaghiston 1723 * Version: 2.9.2 1724 * Date: 14th December 2014 1725 */ 1726 1727/* Support for Zepto 1.0 compiled with optional data module. 1728 * For AMD or NODE/CommonJS support, you will need to manually switch the related 2 lines in the code below. 1729 * Search terms: "jQuery Switch" and "Zepto Switch" 1730 */ 1731 1732(function (root, factory) { 1733 if (typeof define === 'function' && define.amd) { 1734 // AMD. Register as an anonymous module. 1735 define(['jquery'], factory); // jQuery Switch 1736 // define(['zepto'], factory); // Zepto Switch 1737 } else if (typeof exports === 'object') { 1738 // Node/CommonJS 1739 factory(require('jquery')); // jQuery Switch 1740 //factory(require('zepto')); // Zepto Switch 1741 } else { 1742 // Browser globals 1743 if(root.jQuery) { // Use jQuery if available 1744 factory(root.jQuery); 1745 } else { // Otherwise, use Zepto 1746 factory(root.Zepto); 1747 } 1748 } 1749}(this, function ($, undefined) { 1750 1751 // Adapted from jquery.ui.widget.js (1.8.7): $.widget.bridge - Tweaked $.data(this,XYZ) to $(this).data(XYZ) for Zepto 1752 $.fn.jPlayer = function( options ) { 1753 var name = "jPlayer"; 1754 var isMethodCall = typeof options === "string", 1755 args = Array.prototype.slice.call( arguments, 1 ), 1756 returnValue = this; 1757 1758 // allow multiple hashes to be passed on init 1759 options = !isMethodCall && args.length ? 1760 $.extend.apply( null, [ true, options ].concat(args) ) : 1761 options; 1762 1763 // prevent calls to internal methods 1764 if ( isMethodCall && options.charAt( 0 ) === "_" ) { 1765 return returnValue; 1766 } 1767 1768 if ( isMethodCall ) { 1769 this.each(function() { 1770 var instance = $(this).data( name ), 1771 methodValue = instance && $.isFunction( instance[options] ) ? 1772 instance[ options ].apply( instance, args ) : 1773 instance; 1774 if ( methodValue !== instance && methodValue !== undefined ) { 1775 returnValue = methodValue; 1776 return false; 1777 } 1778 }); 1779 } else { 1780 this.each(function() { 1781 var instance = $(this).data( name ); 1782 if ( instance ) { 1783 // instance.option( options || {} )._init(); // Orig jquery.ui.widget.js code: Not recommend for jPlayer. ie., Applying new options to an existing instance (via the jPlayer constructor) and performing the _init(). The _init() is what concerns me. It would leave a lot of event handlers acting on jPlayer instance and the interface. 1784 instance.option( options || {} ); // The new constructor only changes the options. Changing options only has basic support atm. 1785 } else { 1786 $(this).data( name, new $.jPlayer( options, this ) ); 1787 } 1788 }); 1789 } 1790 1791 return returnValue; 1792 }; 1793 1794 $.jPlayer = function( options, element ) { 1795 // allow instantiation without initializing for simple inheritance 1796 if ( arguments.length ) { 1797 this.element = $(element); 1798 this.options = $.extend(true, {}, 1799 this.options, 1800 options 1801 ); 1802 var self = this; 1803 this.element.bind( "remove.jPlayer", function() { 1804 self.destroy(); 1805 }); 1806 this._init(); 1807 } 1808 }; 1809 // End of: (Adapted from jquery.ui.widget.js (1.8.7)) 1810 1811 // Zepto is missing one of the animation methods. 1812 if(typeof $.fn.stop !== 'function') { 1813 $.fn.stop = function() {}; 1814 } 1815 1816 // Emulated HTML5 methods and properties 1817 $.jPlayer.emulateMethods = "load play pause"; 1818 $.jPlayer.emulateStatus = "src readyState networkState currentTime duration paused ended playbackRate"; 1819 $.jPlayer.emulateOptions = "muted volume"; 1820 1821 // Reserved event names generated by jPlayer that are not part of the HTML5 Media element spec 1822 $.jPlayer.reservedEvent = "ready flashreset resize repeat error warning"; 1823 1824 // Events generated by jPlayer 1825 $.jPlayer.event = {}; 1826 $.each( 1827 [ 1828 'ready', 1829 'setmedia', // Fires when the media is set 1830 'flashreset', // Similar to the ready event if the Flash solution is set to display:none and then shown again or if it's reloaded for another reason by the browser. For example, using CSS position:fixed on Firefox for the full screen feature. 1831 'resize', // Occurs when the size changes through a full/restore screen operation or if the size/sizeFull options are changed. 1832 'repeat', // Occurs when the repeat status changes. Usually through clicks on the repeat button of the interface. 1833 'click', // Occurs when the user clicks on one of the following: poster image, html video, flash video. 1834 'error', // Event error code in event.jPlayer.error.type. See $.jPlayer.error 1835 'warning', // Event warning code in event.jPlayer.warning.type. See $.jPlayer.warning 1836 1837 // Other events match HTML5 spec. 1838 'loadstart', 1839 'progress', 1840 'suspend', 1841 'abort', 1842 'emptied', 1843 'stalled', 1844 'play', 1845 'pause', 1846 'loadedmetadata', 1847 'loadeddata', 1848 'waiting', 1849 'playing', 1850 'canplay', 1851 'canplaythrough', 1852 'seeking', 1853 'seeked', 1854 'timeupdate', 1855 'ended', 1856 'ratechange', 1857 'durationchange', 1858 'volumechange' 1859 ], 1860 function() { 1861 $.jPlayer.event[ this ] = 'jPlayer_' + this; 1862 } 1863 ); 1864 1865 $.jPlayer.htmlEvent = [ // These HTML events are bubbled through to the jPlayer event, without any internal action. 1866 "loadstart", 1867 // "progress", // jPlayer uses internally before bubbling. 1868 // "suspend", // jPlayer uses internally before bubbling. 1869 "abort", 1870 // "error", // jPlayer uses internally before bubbling. 1871 "emptied", 1872 "stalled", 1873 // "play", // jPlayer uses internally before bubbling. 1874 // "pause", // jPlayer uses internally before bubbling. 1875 "loadedmetadata", 1876 // "loadeddata", // jPlayer uses internally before bubbling. 1877 // "waiting", // jPlayer uses internally before bubbling. 1878 // "playing", // jPlayer uses internally before bubbling. 1879 "canplay", 1880 "canplaythrough" 1881 // "seeking", // jPlayer uses internally before bubbling. 1882 // "seeked", // jPlayer uses internally before bubbling. 1883 // "timeupdate", // jPlayer uses internally before bubbling. 1884 // "ended", // jPlayer uses internally before bubbling. 1885 // "ratechange" // jPlayer uses internally before bubbling. 1886 // "durationchange" // jPlayer uses internally before bubbling. 1887 // "volumechange" // jPlayer uses internally before bubbling. 1888 ]; 1889 1890 $.jPlayer.pause = function() { 1891 $.jPlayer.prototype.destroyRemoved(); 1892 $.each($.jPlayer.prototype.instances, function(i, element) { 1893 if(element.data("jPlayer").status.srcSet) { // Check that media is set otherwise would cause error event. 1894 element.jPlayer("pause"); 1895 } 1896 }); 1897 }; 1898 1899 // Default for jPlayer option.timeFormat 1900 $.jPlayer.timeFormat = { 1901 showHour: false, 1902 showMin: true, 1903 showSec: true, 1904 padHour: false, 1905 padMin: true, 1906 padSec: true, 1907 sepHour: ":", 1908 sepMin: ":", 1909 sepSec: "" 1910 }; 1911 var ConvertTime = function() { 1912 this.init(); 1913 }; 1914 ConvertTime.prototype = { 1915 init: function() { 1916 this.options = { 1917 timeFormat: $.jPlayer.timeFormat 1918 }; 1919 }, 1920 time: function(s) { // function used on jPlayer.prototype._convertTime to enable per instance options. 1921 s = (s && typeof s === 'number') ? s : 0; 1922 1923 var myTime = new Date(s * 1000), 1924 hour = myTime.getUTCHours(), 1925 min = this.options.timeFormat.showHour ? myTime.getUTCMinutes() : myTime.getUTCMinutes() + hour * 60, 1926 sec = this.options.timeFormat.showMin ? myTime.getUTCSeconds() : myTime.getUTCSeconds() + min * 60, 1927 strHour = (this.options.timeFormat.padHour && hour < 10) ? "0" + hour : hour, 1928 strMin = (this.options.timeFormat.padMin && min < 10) ? "0" + min : min, 1929 strSec = (this.options.timeFormat.padSec && sec < 10) ? "0" + sec : sec, 1930 strTime = ""; 1931 1932 strTime += this.options.timeFormat.showHour ? strHour + this.options.timeFormat.sepHour : ""; 1933 strTime += this.options.timeFormat.showMin ? strMin + this.options.timeFormat.sepMin : ""; 1934 strTime += this.options.timeFormat.showSec ? strSec + this.options.timeFormat.sepSec : ""; 1935 1936 return strTime; 1937 } 1938 }; 1939 var myConvertTime = new ConvertTime(); 1940 $.jPlayer.convertTime = function(s) { 1941 return myConvertTime.time(s); 1942 }; 1943 1944 // Adapting jQuery 1.4.4 code for jQuery.browser. Required since jQuery 1.3.2 does not detect Chrome as webkit. 1945 $.jPlayer.uaBrowser = function( userAgent ) { 1946 var ua = userAgent.toLowerCase(); 1947 1948 // Useragent RegExp 1949 var rwebkit = /(webkit)[ \/]([\w.]+)/; 1950 var ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/; 1951 var rmsie = /(msie) ([\w.]+)/; 1952 var rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/; 1953 1954 var match = rwebkit.exec( ua ) || 1955 ropera.exec( ua ) || 1956 rmsie.exec( ua ) || 1957 ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || 1958 []; 1959 1960 return { browser: match[1] || "", version: match[2] || "0" }; 1961 }; 1962 1963 // Platform sniffer for detecting mobile devices 1964 $.jPlayer.uaPlatform = function( userAgent ) { 1965 var ua = userAgent.toLowerCase(); 1966 1967 // Useragent RegExp 1968 var rplatform = /(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/; 1969 var rtablet = /(ipad|playbook)/; 1970 var randroid = /(android)/; 1971 var rmobile = /(mobile)/; 1972 1973 var platform = rplatform.exec( ua ) || []; 1974 var tablet = rtablet.exec( ua ) || 1975 !rmobile.exec( ua ) && randroid.exec( ua ) || 1976 []; 1977 1978 if(platform[1]) { 1979 platform[1] = platform[1].replace(/\s/g, "_"); // Change whitespace to underscore. Enables dot notation. 1980 } 1981 1982 return { platform: platform[1] || "", tablet: tablet[1] || "" }; 1983 }; 1984 1985 $.jPlayer.browser = { 1986 }; 1987 $.jPlayer.platform = { 1988 }; 1989 1990 var browserMatch = $.jPlayer.uaBrowser(navigator.userAgent); 1991 if ( browserMatch.browser ) { 1992 $.jPlayer.browser[ browserMatch.browser ] = true; 1993 $.jPlayer.browser.version = browserMatch.version; 1994 } 1995 var platformMatch = $.jPlayer.uaPlatform(navigator.userAgent); 1996 if ( platformMatch.platform ) { 1997 $.jPlayer.platform[ platformMatch.platform ] = true; 1998 $.jPlayer.platform.mobile = !platformMatch.tablet; 1999 $.jPlayer.platform.tablet = !!platformMatch.tablet; 2000 } 2001 2002 // Internet Explorer (IE) Browser Document Mode Sniffer. Based on code at: 2003 // http://msdn.microsoft.com/en-us/library/cc288325%28v=vs.85%29.aspx#GetMode 2004 $.jPlayer.getDocMode = function() { 2005 var docMode; 2006 if ($.jPlayer.browser.msie) { 2007 if (document.documentMode) { // IE8 or later 2008 docMode = document.documentMode; 2009 } else { // IE 5-7 2010 docMode = 5; // Assume quirks mode unless proven otherwise 2011 if (document.compatMode) { 2012 if (document.compatMode === "CSS1Compat") { 2013 docMode = 7; // standards mode 2014 } 2015 } 2016 } 2017 } 2018 return docMode; 2019 }; 2020 $.jPlayer.browser.documentMode = $.jPlayer.getDocMode(); 2021 2022 $.jPlayer.nativeFeatures = { 2023 init: function() { 2024 2025 /* Fullscreen function naming influenced by W3C naming. 2026 * No support for: Mozilla Proposal: https://wiki.mozilla.org/Gecko:FullScreenAPI 2027 */ 2028 2029 var d = document, 2030 v = d.createElement('video'), 2031 spec = { 2032 // http://www.w3.org/TR/fullscreen/ 2033 w3c: [ 2034 'fullscreenEnabled', 2035 'fullscreenElement', 2036 'requestFullscreen', 2037 'exitFullscreen', 2038 'fullscreenchange', 2039 'fullscreenerror' 2040 ], 2041 // https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode 2042 moz: [ 2043 'mozFullScreenEnabled', 2044 'mozFullScreenElement', 2045 'mozRequestFullScreen', 2046 'mozCancelFullScreen', 2047 'mozfullscreenchange', 2048 'mozfullscreenerror' 2049 ], 2050 // http://developer.apple.com/library/safari/#documentation/WebKit/Reference/ElementClassRef/Element/Element.html 2051 // http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html 2052 webkit: [ 2053 '', 2054 'webkitCurrentFullScreenElement', 2055 'webkitRequestFullScreen', 2056 'webkitCancelFullScreen', 2057 'webkitfullscreenchange', 2058 '' 2059 ], 2060 // http://developer.apple.com/library/safari/#documentation/AudioVideo/Reference/HTMLVideoElementClassReference/HTMLVideoElement/HTMLVideoElement.html 2061 // https://developer.apple.com/library/safari/samplecode/HTML5VideoEventFlow/Listings/events_js.html#//apple_ref/doc/uid/DTS40010085-events_js-DontLinkElementID_5 2062 // Events: 'webkitbeginfullscreen' and 'webkitendfullscreen' 2063 webkitVideo: [ 2064 'webkitSupportsFullscreen', 2065 'webkitDisplayingFullscreen', 2066 'webkitEnterFullscreen', 2067 'webkitExitFullscreen', 2068 '', 2069 '' 2070 ], 2071 ms: [ 2072 '', 2073 'msFullscreenElement', 2074 'msRequestFullscreen', 2075 'msExitFullscreen', 2076 'MSFullscreenChange', 2077 'MSFullscreenError' 2078 ] 2079 }, 2080 specOrder = [ 2081 'w3c', 2082 'moz', 2083 'webkit', 2084 'webkitVideo', 2085 'ms' 2086 ], 2087 fs, i, il; 2088 2089 this.fullscreen = fs = { 2090 support: { 2091 w3c: !!d[spec.w3c[0]], 2092 moz: !!d[spec.moz[0]], 2093 webkit: typeof d[spec.webkit[3]] === 'function', 2094 webkitVideo: typeof v[spec.webkitVideo[2]] === 'function', 2095 ms: typeof v[spec.ms[2]] === 'function' 2096 }, 2097 used: {} 2098 }; 2099 2100 // Store the name of the spec being used and as a handy boolean. 2101 for(i = 0, il = specOrder.length; i < il; i++) { 2102 var n = specOrder[i]; 2103 if(fs.support[n]) { 2104 fs.spec = n; 2105 fs.used[n] = true; 2106 break; 2107 } 2108 } 2109 2110 if(fs.spec) { 2111 var s = spec[fs.spec]; 2112 fs.api = { 2113 fullscreenEnabled: true, 2114 fullscreenElement: function(elem) { 2115 elem = elem ? elem : d; // Video element required for webkitVideo 2116 return elem[s[1]]; 2117 }, 2118 requestFullscreen: function(elem) { 2119 return elem[s[2]](); // Chrome and Opera want parameter (Element.ALLOW_KEYBOARD_INPUT) but Safari fails if flag used. 2120 }, 2121 exitFullscreen: function(elem) { 2122 elem = elem ? elem : d; // Video element required for webkitVideo 2123 return elem[s[3]](); 2124 } 2125 }; 2126 fs.event = { 2127 fullscreenchange: s[4], 2128 fullscreenerror: s[5] 2129 }; 2130 } else { 2131 fs.api = { 2132 fullscreenEnabled: false, 2133 fullscreenElement: function() { 2134 return null; 2135 }, 2136 requestFullscreen: function() {}, 2137 exitFullscreen: function() {} 2138 }; 2139 fs.event = {}; 2140 } 2141 } 2142 }; 2143 $.jPlayer.nativeFeatures.init(); 2144 2145 // The keyboard control system. 2146 2147 // The current jPlayer instance in focus. 2148 $.jPlayer.focus = null; 2149 2150 // The list of element node names to ignore with key controls. 2151 $.jPlayer.keyIgnoreElementNames = "A INPUT TEXTAREA SELECT BUTTON"; 2152 2153 // The function that deals with key presses. 2154 var keyBindings = function(event) { 2155 var f = $.jPlayer.focus, 2156 ignoreKey; 2157 2158 // A jPlayer instance must be in focus. ie., keyEnabled and the last one played. 2159 if(f) { 2160 // What generated the key press? 2161 $.each( $.jPlayer.keyIgnoreElementNames.split(/\s+/g), function(i, name) { 2162 // The strings should already be uppercase. 2163 if(event.target.nodeName.toUpperCase() === name.toUpperCase()) { 2164 ignoreKey = true; 2165 return false; // exit each. 2166 } 2167 }); 2168 if(!ignoreKey) { 2169 // See if the key pressed matches any of the bindings. 2170 $.each(f.options.keyBindings, function(action, binding) { 2171 // The binding could be a null when the default has been disabled. ie., 1st clause in if() 2172 if( 2173 (binding && $.isFunction(binding.fn)) && 2174 ((typeof binding.key === 'number' && event.which === binding.key) || 2175 (typeof binding.key === 'string' && event.key === binding.key)) 2176 ) { 2177 event.preventDefault(); // Key being used by jPlayer, so prevent default operation. 2178 binding.fn(f); 2179 return false; // exit each. 2180 } 2181 }); 2182 } 2183 } 2184 }; 2185 2186 $.jPlayer.keys = function(en) { 2187 var event = "keydown.jPlayer"; 2188 // Remove any binding, just in case enabled more than once. 2189 $(document.documentElement).unbind(event); 2190 if(en) { 2191 $(document.documentElement).bind(event, keyBindings); 2192 } 2193 }; 2194 2195 // Enable the global key control handler ready for any jPlayer instance with the keyEnabled option enabled. 2196 $.jPlayer.keys(true); 2197 2198 $.jPlayer.prototype = { 2199 count: 0, // Static Variable: Change it via prototype. 2200 version: { // Static Object 2201 script: "2.9.2", 2202 needFlash: "2.9.0", 2203 flash: "unknown" 2204 }, 2205 options: { // Instanced in $.jPlayer() constructor 2206 swfPath: "js", // Path to jquery.jplayer.swf. Can be relative, absolute or server root relative. 2207 solution: "html, flash", // Valid solutions: html, flash, aurora. Order defines priority. 1st is highest, 2208 supplied: "mp3", // Defines which formats jPlayer will try and support and the priority by the order. 1st is highest, 2209 auroraFormats: "wav", // List the aurora.js codecs being loaded externally. Its core supports "wav". Specify format in jPlayer context. EG., The aac.js codec gives the "m4a" format. 2210 preload: 'metadata', // HTML5 Spec values: none, metadata, auto. 2211 volume: 0.8, // The volume. Number 0 to 1. 2212 muted: false, 2213
2213alt: ""
vendor: 15,153 bytes, lines 2213-2660
2213, 2214 remainingDuration: false, // When true, the remaining time is shown in the duration GUI element. 2215 toggleDuration: false, // When true, clicks on the duration toggle between the duration and remaining display. 2216 captureDuration: true, // When true, clicks on the duration are captured and no longer propagate up the DOM. 2217 playbackRate: 1, 2218 defaultPlaybackRate: 1, 2219 minPlaybackRate: 0.5, 2220 maxPlaybackRate: 4, 2221 wmode: "opaque", // Valid wmode: window, transparent, opaque, direct, gpu. 2222 backgroundColor: "#000000", // To define the jPlayer div and Flash background color. 2223 cssSelectorAncestor: "#jp_container_1", 2224 cssSelector: { // * denotes properties that should only be required when video media type required. _cssSelector() would require changes to enable splitting these into Audio and Video defaults. 2225 videoPlay: ".jp-video-play", // * 2226 play: ".jp-play", 2227 pause: ".jp-pause", 2228 stop: ".jp-stop", 2229 seekBar: ".jp-seek-bar", 2230 playBar: ".jp-play-bar", 2231 mute: ".jp-mute", 2232 unmute: ".jp-unmute", 2233 volumeBar: ".jp-volume-bar", 2234 volumeBarValue: ".jp-volume-bar-value", 2235 volumeMax: ".jp-volume-max", 2236 playbackRateBar: ".jp-playback-rate-bar", 2237 playbackRateBarValue: ".jp-playback-rate-bar-value", 2238 currentTime: ".jp-current-time", 2239 duration: ".jp-duration", 2240 title: ".jp-title", 2241 fullScreen: ".jp-full-screen", // * 2242 restoreScreen: ".jp-restore-screen", // * 2243 repeat: ".jp-repeat", 2244 repeatOff: ".jp-repeat-off", 2245 gui: ".jp-gui", // The interface used with autohide feature. 2246 noSolution: ".jp-no-solution" // For error feedback when jPlayer cannot find a solution. 2247 }, 2248 stateClass: { // Classes added to the cssSelectorAncestor to indicate the state. 2249 playing: "jp-state-playing", 2250 seeking: "jp-state-seeking", 2251 muted: "jp-state-muted", 2252 looped: "jp-state-looped", 2253 fullScreen: "jp-state-full-screen", 2254 noVolume: "jp-state-no-volume" 2255 }, 2256 useStateClassSkin: false, // A state class skin relies on the state classes to change the visual appearance. The single control toggles the effect, for example: play then pause, mute then unmute. 2257 autoBlur: true, // GUI control handlers will drop focus after clicks. 2258 smoothPlayBar: false, // Smooths the play bar transitions, which affects clicks and short media with big changes per second. 2259 fullScreen: false, // Native Full Screen 2260 fullWindow: false, 2261 autohide: { 2262 restored: false, // Controls the interface autohide feature. 2263 full: true, // Controls the interface autohide feature. 2264 fadeIn: 200, // Milliseconds. The period of the fadeIn anim. 2265 fadeOut: 600, // Milliseconds. The period of the fadeOut anim. 2266 hold: 1000 // Milliseconds. The period of the pause before autohide beings. 2267 }, 2268 loop: false, 2269 repeat: function(event) { // The default jPlayer repeat event handler 2270 if(event.jPlayer.options.loop) { 2271 $(this).unbind(".jPlayerRepeat").bind($.jPlayer.event.ended + ".jPlayer.jPlayerRepeat", function() { 2272 $(this).jPlayer("play"); 2273 }); 2274 } else { 2275 $(this).unbind(".jPlayerRepeat"); 2276 } 2277 }, 2278 nativeVideoControls: { 2279 // Works well on standard browsers. 2280 // Phone and tablet browsers can have problems with the controls disappearing. 2281 }, 2282 noFullWindow: { 2283 msie: /msie [0-6]\./, 2284 ipad: /ipad.*?os [0-4]\./, 2285 iphone: /iphone/, 2286 ipod: /ipod/, 2287 android_pad: /android [0-3]\.(?!.*?mobile)/, 2288 android_phone: /(?=.*android)(?!.*chrome)(?=.*mobile)/, 2289 blackberry: /blackberry/, 2290 windows_ce: /windows ce/, 2291 iemobile: /iemobile/, 2292 webos: /webos/ 2293 }, 2294 noVolume: { 2295 ipad: /ipad/, 2296 iphone: /iphone/, 2297 ipod: /ipod/, 2298 android_pad: /android(?!.*?mobile)/, 2299 android_phone: /android.*?mobile/, 2300 blackberry: /blackberry/, 2301 windows_ce: /windows ce/, 2302 iemobile: /iemobile/, 2303 webos: /webos/, 2304 playbook: /playbook/ 2305 }, 2306 timeFormat: { 2307 // Specific time format for this instance. The supported options are defined in $.jPlayer.timeFormat 2308 // For the undefined options we use the default from $.jPlayer.timeFormat 2309 }, 2310 keyEnabled: false, // Enables keyboard controls. 2311 audioFullScreen: false, // Enables keyboard controls to enter full screen with audio media. 2312 keyBindings: { // The key control object, defining the key codes and the functions to execute. 2313 // The parameter, f = $.jPlayer.focus, will be checked truethy before attempting to call any of these functions. 2314 // Properties may be added to this object, in key/fn pairs, to enable other key controls. EG, for the playlist add-on. 2315 play: { 2316 key: 80, // p 2317 fn: function(f) { 2318 if(f.status.paused) { 2319 f.play(); 2320 } else { 2321 f.pause(); 2322 } 2323 } 2324 }, 2325 fullScreen: { 2326 key: 70, // f 2327 fn: function(f) { 2328 if(f.status.video || f.options.audioFullScreen) { 2329 f._setOption("fullScreen", !f.options.fullScreen); 2330 } 2331 } 2332 }, 2333 muted: { 2334 key: 77, // m 2335 fn: function(f) { 2336 f._muted(!f.options.muted); 2337 } 2338 }, 2339 volumeUp: { 2340 key: 190, // . 2341 fn: function(f) { 2342 f.volume(f.options.volume + 0.1); 2343 } 2344 }, 2345 volumeDown: { 2346 key: 188, // , 2347 fn: function(f) { 2348 f.volume(f.options.volume - 0.1); 2349 } 2350 }, 2351 loop: { 2352 key: 76, // l 2353 fn: function(f) { 2354 f._loop(!f.options.loop); 2355 } 2356 } 2357 }, 2358 verticalVolume: false, // Calculate volume from the bottom of the volume bar. Default is from the left. Also volume affects either width or height. 2359 verticalPlaybackRate: false, 2360 globalVolume: false, // Set to make volume and muted changes affect all jPlayer instances with this option enabled 2361 idPrefix: "jp", // Prefix for the ids of html elements created by jPlayer. For flash, this must not include characters: . - + * / \ 2362 noConflict: "jQuery", 2363 emulateHtml: false, // Emulates the HTML5 Media element on the jPlayer element. 2364 consoleAlerts: true, // Alerts are sent to the console.log() instead of alert(). 2365 errorAlerts: false, 2366 warningAlerts: false 2367 }, 2368 optionsAudio: { 2369 size: { 2370 width: "0px", 2371 height: "0px", 2372 cssClass: "" 2373 }, 2374 sizeFull: { 2375 width: "0px", 2376 height: "0px", 2377 cssClass: "" 2378 } 2379 }, 2380 optionsVideo: { 2381 size: { 2382 width: "480px", 2383 height: "270px", 2384 cssClass: "jp-video-270p" 2385 }, 2386 sizeFull: { 2387 width: "100%", 2388 height: "100%", 2389 cssClass: "jp-video-full" 2390 } 2391 }, 2392 instances: {}, // Static Object 2393 status: { // Instanced in _init() 2394 src: "", 2395 media: {}, 2396 paused: true, 2397 format: {}, 2398 formatType: "", 2399 waitForPlay: true, // Same as waitForLoad except in case where preloading. 2400 waitForLoad: true, 2401 srcSet: false, 2402 video: false, // True if playing a video 2403 seekPercent: 0, 2404 currentPercentRelative: 0, 2405 currentPercentAbsolute: 0, 2406 currentTime: 0, 2407 duration: 0, 2408 remaining: 0, 2409 videoWidth: 0, // Intrinsic width of the video in pixels. 2410 videoHeight: 0, // Intrinsic height of the video in pixels. 2411 readyState: 0, 2412 networkState: 0, 2413 playbackRate: 1, // Warning - Now both an option and a status property 2414 ended: 0 2415 2416/* Persistant status properties created dynamically at _init(): 2417 width 2418 height 2419 cssClass 2420 nativeVideoControls 2421 noFullWindow 2422 noVolume 2423 playbackRateEnabled // Warning - Technically, we can have both Flash and HTML, so this might not be correct if the Flash is active. That is a niche case. 2424*/ 2425 }, 2426 2427 internal: { // Instanced in _init() 2428 ready: false 2429 // instance: undefined 2430 // domNode: undefined 2431 // htmlDlyCmdId: undefined 2432 // autohideId: undefined 2433 // mouse: undefined 2434 // cmdsIgnored 2435 }, 2436 solution: { // Static Object: Defines the solutions built in jPlayer. 2437 html: true, 2438 aurora: true, 2439 flash: true 2440 }, 2441 // 'MPEG-4 support' : canPlayType('video/mp4; codecs="mp4v.20.8"') 2442 format: { // Static Object 2443 mp3: { 2444 codec: 'audio/mpeg', 2445 flashCanPlay: true, 2446 media: 'audio' 2447 }, 2448 m4a: { // AAC / MP4 2449 codec: 'audio/mp4; codecs="mp4a.40.2"', 2450 flashCanPlay: true, 2451 media: 'audio' 2452 }, 2453 m3u8a: { // AAC / MP4 / Apple HLS 2454 codec: 'application/vnd.apple.mpegurl; codecs="mp4a.40.2"', 2455 flashCanPlay: false, 2456 media: 'audio' 2457 }, 2458 m3ua: { // M3U 2459 codec: 'audio/mpegurl', 2460 flashCanPlay: false, 2461 media: 'audio' 2462 }, 2463 oga: { // OGG 2464 codec: 'audio/ogg; codecs="vorbis, opus"', 2465 flashCanPlay: false, 2466 media: 'audio' 2467 }, 2468 flac: { // FLAC 2469 codec: 'audio/x-flac', 2470 flashCanPlay: false, 2471 media: 'audio' 2472 }, 2473 wav: { // PCM 2474 codec: 'audio/wav; codecs="1"', 2475 flashCanPlay: false, 2476 media: 'audio' 2477 }, 2478 webma: { // WEBM 2479 codec: 'audio/webm; codecs="vorbis"', 2480 flashCanPlay: false, 2481 media: 'audio' 2482 }, 2483 fla: { // FLV / F4A 2484 codec: 'audio/x-flv', 2485 flashCanPlay: true, 2486 media: 'audio' 2487 }, 2488 rtmpa: { // RTMP AUDIO 2489 codec: 'audio/rtmp; codecs="rtmp"', 2490 flashCanPlay: true, 2491 media: 'audio' 2492 }, 2493 m4v: { // H.264 / MP4 2494 codec: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"', 2495 flashCanPlay: true, 2496 media: 'video' 2497 }, 2498 m3u8v: { // H.264 / AAC / MP4 / Apple HLS 2499 codec: 'application/vnd.apple.mpegurl; codecs="avc1.42E01E, mp4a.40.2"', 2500 flashCanPlay: false, 2501 media: 'video' 2502 }, 2503 m3uv: { // M3U 2504 codec: 'audio/mpegurl', 2505 flashCanPlay: false, 2506 media: 'video' 2507 }, 2508 ogv: { // OGG 2509 codec: 'video/ogg; codecs="theora, vorbis"', 2510 flashCanPlay: false, 2511 media: 'video' 2512 }, 2513 webmv: { // WEBM 2514 codec: 'video/webm; codecs="vorbis, vp8"', 2515 flashCanPlay: false, 2516 media: 'video' 2517 }, 2518 flv: { // FLV / F4V 2519 codec: 'video/x-flv', 2520 flashCanPlay: true, 2521 media: 'video' 2522 }, 2523 rtmpv: { // RTMP VIDEO 2524 codec: 'video/rtmp; codecs="rtmp"', 2525 flashCanPlay: true, 2526 media: 'video' 2527 } 2528 }, 2529 _init: function() { 2530 var self = this; 2531 2532 this.element.empty(); 2533 2534 this.status = $.extend({}, this.status); // Copy static to unique instance. 2535 this.internal = $.extend({}, this.internal); // Copy static to unique instance. 2536 2537 // Initialize the time format 2538 this.options.timeFormat = $.extend({}, $.jPlayer.timeFormat, this.options.timeFormat); 2539 2540 // On iOS, assume commands will be ignored before user initiates them. 2541 this.internal.cmdsIgnored = $.jPlayer.platform.ipad || $.jPlayer.platform.iphone || $.jPlayer.platform.ipod; 2542 2543 this.internal.domNode = this.element.get(0); 2544 2545 // Add key bindings focus to 1st jPlayer instanced with key control enabled. 2546 if(this.options.keyEnabled && !$.jPlayer.focus) { 2547 $.jPlayer.focus = this; 2548 } 2549 2550 // A fix for Android where older (2.3) and even some 4.x devices fail to work when changing the *audio* SRC and then playing immediately. 2551 this.androidFix = { 2552 setMedia: false, // True when media set 2553 play: false, // True when a progress event will instruct the media to play 2554 pause: false, // True when a progress event will instruct the media to pause at a time. 2555 time: NaN // The play(time) parameter 2556 }; 2557 if($.jPlayer.platform.android) { 2558 this.options.preload = this.options.preload !== 'auto' ? 'metadata' : 'auto'; // Default to metadata, but allow auto. 2559 } 2560 2561 this.formats = []; // Array based on supplied string option. Order defines priority. 2562 this.solutions = []; // Array based on solution string option. Order defines priority. 2563 this.require = {}; // Which media types are required: video, audio. 2564 2565 this.htmlElement = {}; // DOM elements created by jPlayer 2566 this.html = {}; // In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array. 2567 this.html.audio = {}; 2568 this.html.video = {}; 2569 this.aurora = {}; // In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array. 2570 this.aurora.formats = []; 2571 this.aurora.properties = []; 2572 this.flash = {}; // In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array. 2573 2574 this.css = {}; 2575 this.css.cs = {}; // Holds the css selector strings 2576 this.css.jq = {}; // Holds jQuery selectors. ie., $(css.cs.method) 2577 2578 this.ancestorJq = []; // Holds jQuery selector of cssSelectorAncestor. Init would use $() instead of [], but it is only 1.4+ 2579 2580 this.options.volume = this._limitValue(this.options.volume, 0, 1); // Limit volume value's bounds. 2581 2582 // Create the formats array, with prority based on the order of the supplied formats string 2583 $.each(this.options.supplied.toLowerCase().split(","), function(index1, value1) { 2584 var format = value1.replace(/^\s+|\s+$/g, ""); //trim 2585 if(self.format[format]) { // Check format is valid. 2586 var dupFound = false; 2587 $.each(self.formats, function(index2, value2) { // Check for duplicates 2588 if(format === value2) { 2589 dupFound = true; 2590 return false; 2591 } 2592 }); 2593 if(!dupFound) { 2594 self.formats.push(format); 2595 } 2596 } 2597 }); 2598 2599 // Create the solutions array, with prority based on the order of the solution string 2600 $.each(this.options.solution.toLowerCase().split(","), function(index1, value1) { 2601 var solution = value1.replace(/^\s+|\s+$/g, ""); //trim 2602 if(self.solution[solution]) { // Check solution is valid. 2603 var dupFound = false; 2604 $.each(self.solutions, function(index2, value2) { // Check for duplicates 2605 if(solution === value2) { 2606 dupFound = true; 2607 return false; 2608 } 2609 }); 2610 if(!dupFound) { 2611 self.solutions.push(solution); 2612 } 2613 } 2614 }); 2615 2616 // Create Aurora.js formats array 2617 $.each(this.options.auroraFormats.toLowerCase().split(","), function(index1, value1) { 2618 var format = value1.replace(/^\s+|\s+$/g, ""); //trim 2619 if(self.format[format]) { // Check format is valid. 2620 var dupFound = false; 2621 $.each(self.aurora.formats, function(index2, value2) { // Check for duplicates 2622 if(format === value2) { 2623 dupFound = true; 2624 return false; 2625 } 2626 }); 2627 if(!dupFound) { 2628 self.aurora.formats.push(format); 2629 } 2630 } 2631 }); 2632 2633 this.internal.instance = "jp_" + this.count; 2634 this.instances[this.internal.instance] = this.element; 2635 2636 // Check the jPlayer div has an id and create one if required. Important for Flash to know the unique id for comms. 2637 if(!this.element.attr("id")) { 2638 this.element.attr("id", this.options.idPrefix + "_jplayer_" + this.count); 2639 } 2640 2641 this.internal.self = $.extend({}, { 2642 id: this.element.attr("id"), 2643 jq: this.element 2644 }); 2645 this.internal.audio = $.extend({}, { 2646 id: this.options.idPrefix + "_audio_" + this.count, 2647 jq: undefined 2648 }); 2649 this.internal.video = $.extend({}, { 2650 id: this.options.idPrefix + "_video_" + this.count, 2651 jq: undefined 2652 }); 2653 this.internal.flash = $.extend({}, { 2654 id: this.options.idPrefix + "_flash_" + this.count, 2655 jq: undefined, 2656 swf: this.options.swfPath + (this.options.swfPath.toLowerCase().slice(-4) !== ".swf" ? (this.options.swfPath && this.options.swfPath.slice(-1) !== "/" ? "/" : "") + "jquery.jplayer.swf" : "") 2657 }); 2658 this.internal.poster = $.extend({}, { 2659 id: this.options.idPrefix + "_poster_" + this.count, 2660 jq: undefined
vendor: 1,900 bytes, lines 2660-2709
2660, 2661 alt: this.options.alt 2662 }); 2663 2664 // Register listeners defined in the constructor 2665 $.each($.jPlayer.event, function(eventName,eventType) { 2666 if(self.options[eventName] !== undefined) { 2667 self.element.bind(eventType + ".jPlayer", self.options[eventName]); // With .jPlayer namespace. 2668 self.options[eventName] = undefined; // Destroy the handler pointer copy on the options. Reason, events can be added/removed in other ways so this could be obsolete and misleading. 2669 } 2670 }); 2671 2672 // Determine if we require solutions for audio, video or both media types. 2673 this.require.audio = false; 2674 this.require.video = false; 2675 $.each(this.formats, function(priority, format) { 2676 self.require[self.format[format].media] = true; 2677 }); 2678 2679 // Now required types are known, finish the options default settings. 2680 if(this.require.video) { 2681 this.options = $.extend(true, {}, 2682 this.optionsVideo, 2683 this.options 2684 ); 2685 } else { 2686 this.options = $.extend(true, {}, 2687 this.optionsAudio, 2688 this.options 2689 ); 2690 } 2691 this._setSize(); // update status and jPlayer element size 2692 2693 // Determine the status for Blocklisted options. 2694 this.status.nativeVideoControls = this._uaBlocklist(this.options.nativeVideoControls); 2695 this.status.noFullWindow = this._uaBlocklist(this.options.noFullWindow); 2696 this.status.noVolume = this._uaBlocklist(this.options.noVolume); 2697 2698 // Create event handlers if native fullscreen is supported 2699 if($.jPlayer.nativeFeatures.fullscreen.api.fullscreenEnabled) { 2700 this._fullscreenAddEventListeners(); 2701 } 2702 2703 // The native controls are only for video and are disabled when audio is also used. 2704 this._restrictNativeVideoControls(); 2705 2706 // Create the poster image. 2707 this.htmlElement.poster = document.createElement('img'); 2708 this.htmlElement.poster.id = this.internal.poster.id; 2709 this.htmlElement.poster.alt = this.internal.poster.alt
vendor: 87,716 bytes, lines 2709-5222
2709; 2710 this.htmlElement.poster.onload = function() { // Note that this did not work on Firefox 3.6: poster.addEventListener("onload", function() {}, false); Did not investigate x-browser. 2711 if(!self.status.video || self.status.waitForPlay) { 2712 self.internal.poster.jq.show(); 2713 } 2714 }; 2715 this.element.append(this.htmlElement.poster); 2716 this.internal.poster.jq = $("#" + this.internal.poster.id); 2717 this.internal.poster.jq.css({'width': this.status.width, 'height': this.status.height}); 2718 this.internal.poster.jq.hide(); 2719 this.internal.poster.jq.bind("click.jPlayer", function() { 2720 self._trigger($.jPlayer.event.click); 2721 }); 2722 2723 // Generate the required media elements 2724 this.html.audio.available = false; 2725 if(this.require.audio) { // If a supplied format is audio 2726 this.htmlElement.audio = document.createElement('audio'); 2727 this.htmlElement.audio.id = this.internal.audio.id; 2728 this.html.audio.available = !!this.htmlElement.audio.canPlayType && this._testCanPlayType(this.htmlElement.audio); // Test is for IE9 on Win Server 2008. 2729 } 2730 this.html.video.available = false; 2731 if(this.require.video) { // If a supplied format is video 2732 this.htmlElement.video = document.createElement('video'); 2733 this.htmlElement.video.id = this.internal.video.id; 2734 this.html.video.available = !!this.htmlElement.video.canPlayType && this._testCanPlayType(this.htmlElement.video); // Test is for IE9 on Win Server 2008. 2735 } 2736 2737 this.flash.available = this._checkForFlash(10.1); 2738 2739 this.html.canPlay = {}; 2740 this.aurora.canPlay = {}; 2741 this.flash.canPlay = {}; 2742 $.each(this.formats, function(priority, format) { 2743 self.html.canPlay[format] = self.html[self.format[format].media].available && "" !== self.htmlElement[self.format[format].media].canPlayType(self.format[format].codec); 2744 self.aurora.canPlay[format] = ($.inArray(format, self.aurora.formats) > -1); 2745 self.flash.canPlay[format] = self.format[format].flashCanPlay && self.flash.available; 2746 }); 2747 this.html.desired = false; 2748 this.aurora.desired = false; 2749 this.flash.desired = false; 2750 $.each(this.solutions, function(solutionPriority, solution) { 2751 if(solutionPriority === 0) { 2752 self[solution].desired = true; 2753 } else { 2754 var audioCanPlay = false; 2755 var videoCanPlay = false; 2756 $.each(self.formats, function(formatPriority, format) { 2757 if(self[self.solutions[0]].canPlay[format]) { // The other solution can play 2758 if(self.format[format].media === 'video') { 2759 videoCanPlay = true; 2760 } else { 2761 audioCanPlay = true; 2762 } 2763 } 2764 }); 2765 self[solution].desired = (self.require.audio && !audioCanPlay) || (self.require.video && !videoCanPlay); 2766 } 2767 }); 2768 // This is what jPlayer will support, based on solution and supplied. 2769 this.html.support = {}; 2770 this.aurora.support = {}; 2771 this.flash.support = {}; 2772 $.each(this.formats, function(priority, format) { 2773 self.html.support[format] = self.html.canPlay[format] && self.html.desired; 2774 self.aurora.support[format] = self.aurora.canPlay[format] && self.aurora.desired; 2775 self.flash.support[format] = self.flash.canPlay[format] && self.flash.desired; 2776 }); 2777 // If jPlayer is supporting any format in a solution, then the solution is used. 2778 this.html.used = false; 2779 this.aurora.used = false; 2780 this.flash.used = false; 2781 $.each(this.solutions, function(solutionPriority, solution) { 2782 $.each(self.formats, function(formatPriority, format) { 2783 if(self[solution].support[format]) { 2784 self[solution].used = true; 2785 return false; 2786 } 2787 }); 2788 }); 2789 2790 // Init solution active state and the event gates to false. 2791 this._resetActive(); 2792 this._resetGate(); 2793 2794 // Set up the css selectors for the control and feedback entities. 2795 this._cssSelectorAncestor(this.options.cssSelectorAncestor); 2796 2797 // If neither html nor aurora nor flash are being used by this browser, then media playback is not possible. Trigger an error event. 2798 if(!(this.html.used || this.aurora.used || this.flash.used)) { 2799 this._error( { 2800 type: $.jPlayer.error.NO_SOLUTION, 2801 context: "{solution:'" + this.options.solution + "', supplied:'" + this.options.supplied + "'}", 2802 message: $.jPlayer.errorMsg.NO_SOLUTION, 2803 hint: $.jPlayer.errorHint.NO_SOLUTION 2804 }); 2805 if(this.css.jq.noSolution.length) { 2806 this.css.jq.noSolution.show(); 2807 } 2808 } else { 2809 if(this.css.jq.noSolution.length) { 2810 this.css.jq.noSolution.hide(); 2811 } 2812 } 2813 2814 // Add the flash solution if it is being used. 2815 if(this.flash.used) { 2816 var htmlObj, 2817 flashVars = 'jQuery=' + encodeURI(this.options.noConflict) + '&id=' + encodeURI(this.internal.self.id) + '&vol=' + this.options.volume + '&muted=' + this.options.muted; 2818 2819 // Code influenced by SWFObject 2.2: http://code.google.com/p/swfobject/ 2820 // Non IE browsers have an initial Flash size of 1 by 1 otherwise the wmode affected the Flash ready event. 2821 2822 if($.jPlayer.browser.msie && (Number($.jPlayer.browser.version) < 9 || $.jPlayer.browser.documentMode < 9)) { 2823 var objStr = '<object id="' + this.internal.flash.id + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0" tabindex="-1"></object>'; 2824 2825 var paramStr = [ 2826 '<param name="movie" value="' + this.internal.flash.swf + '" />', 2827 '<param name="FlashVars" value="' + flashVars + '" />', 2828 '<param name="allowScriptAccess" value="always" />', 2829 '<param name="bgcolor" value="' + this.options.backgroundColor + '" />', 2830 '<param name="wmode" value="' + this.options.wmode + '" />' 2831 ]; 2832 2833 htmlObj = document.createElement(objStr); 2834 for(var i=0; i < paramStr.length; i++) { 2835 htmlObj.appendChild(document.createElement(paramStr[i])); 2836 } 2837 } else { 2838 var createParam = function(el, n, v) { 2839 var p = document.createElement("param"); 2840 p.setAttribute("name", n); 2841 p.setAttribute("value", v); 2842 el.appendChild(p); 2843 }; 2844 2845 htmlObj = document.createElement("object"); 2846 htmlObj.setAttribute("id", this.internal.flash.id); 2847 htmlObj.setAttribute("name", this.internal.flash.id); 2848 htmlObj.setAttribute("data", this.internal.flash.swf); 2849 htmlObj.setAttribute("type", "application/x-shockwave-flash"); 2850 htmlObj.setAttribute("width", "1"); // Non-zero 2851 htmlObj.setAttribute("height", "1"); // Non-zero 2852 htmlObj.setAttribute("tabindex", "-1"); 2853 createParam(htmlObj, "flashvars", flashVars); 2854 createParam(htmlObj, "allowscriptaccess", "always"); 2855 createParam(htmlObj, "bgcolor", this.options.backgroundColor); 2856 createParam(htmlObj, "wmode", this.options.wmode); 2857 } 2858 2859 this.element.append(htmlObj); 2860 this.internal.flash.jq = $(htmlObj); 2861 } 2862 2863 // Setup playbackRate ability before using _addHtmlEventListeners() 2864 if(this.html.used && !this.flash.used) { // If only HTML 2865 // Using the audio element capabilities for playbackRate. ie., Assuming video element is the same. 2866 this.status.playbackRateEnabled = this._testPlaybackRate('audio'); 2867 } else { 2868 this.status.playbackRateEnabled = false; 2869 } 2870 2871 this._updatePlaybackRate(); 2872 2873 // Add the HTML solution if being used. 2874 if(this.html.used) { 2875 2876 // The HTML Audio handlers 2877 if(this.html.audio.available) { 2878 this._addHtmlEventListeners(this.htmlElement.audio, this.html.audio); 2879 this.element.append(this.htmlElement.audio); 2880 this.internal.audio.jq = $("#" + this.internal.audio.id); 2881 } 2882 2883 // The HTML Video handlers 2884 if(this.html.video.available) { 2885 this._addHtmlEventListeners(this.htmlElement.video, this.html.video); 2886 this.element.append(this.htmlElement.video); 2887 this.internal.video.jq = $("#" + this.internal.video.id); 2888 if(this.status.nativeVideoControls) { 2889 this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height}); 2890 } else { 2891 this.internal.video.jq.css({'width':'0px', 'height':'0px'}); // Using size 0x0 since a .hide() causes issues in iOS 2892 } 2893 this.internal.video.jq.bind("click.jPlayer", function() { 2894 self._trigger($.jPlayer.event.click); 2895 }); 2896 } 2897 } 2898 2899 // Add the Aurora.js solution if being used. 2900 if(this.aurora.used) { 2901 // Aurora.js player need to be created for each media, see setMedia function. 2902 } 2903 2904 // Create the bridge that emulates the HTML Media element on the jPlayer DIV 2905 if( this.options.emulateHtml ) { 2906 this._emulateHtmlBridge(); 2907 } 2908 2909 if((this.html.used || this.aurora.used) && !this.flash.used) { // If only HTML, then emulate flash ready() call after 100ms. 2910 setTimeout( function() { 2911 self.internal.ready = true; 2912 self.version.flash = "n/a"; 2913 self._trigger($.jPlayer.event.repeat); // Trigger the repeat event so its handler can initialize itself with the loop option. 2914 self._trigger($.jPlayer.event.ready); 2915 }, 100); 2916 } 2917 2918 // Initialize the interface components with the options. 2919 this._updateNativeVideoControls(); 2920 // The other controls are now setup in _cssSelectorAncestor() 2921 if(this.css.jq.videoPlay.length) { 2922 this.css.jq.videoPlay.hide(); 2923 } 2924 2925 $.jPlayer.prototype.count++; // Change static variable via prototype. 2926 }, 2927 destroy: function() { 2928 // MJP: The background change remains. Would need to store the original to restore it correctly. 2929 // MJP: The jPlayer element's size change remains. 2930 2931 // Clear the media to reset the GUI and stop any downloads. Streams on some browsers had persited. (Chrome) 2932 this.clearMedia(); 2933 // Remove the size/sizeFull cssClass from the cssSelectorAncestor 2934 this._removeUiClass(); 2935 // Remove the times from the GUI 2936 if(this.css.jq.currentTime.length) { 2937 this.css.jq.currentTime.text(""); 2938 } 2939 if(this.css.jq.duration.length) { 2940 this.css.jq.duration.text(""); 2941 } 2942 // Remove any bindings from the interface controls. 2943 $.each(this.css.jq, function(fn, jq) { 2944 // Check selector is valid before trying to execute method. 2945 if(jq.length) { 2946 jq.unbind(".jPlayer"); 2947 } 2948 }); 2949 // Remove the click handlers for $.jPlayer.event.click 2950 this.internal.poster.jq.unbind(".jPlayer"); 2951 if(this.internal.video.jq) { 2952 this.internal.video.jq.unbind(".jPlayer"); 2953 } 2954 // Remove the fullscreen event handlers 2955 this._fullscreenRemoveEventListeners(); 2956 // Remove key bindings 2957 if(this === $.jPlayer.focus) { 2958 $.jPlayer.focus = null; 2959 } 2960 // Destroy the HTML bridge. 2961 if(this.options.emulateHtml) { 2962 this._destroyHtmlBridge(); 2963 } 2964 this.element.removeData("jPlayer"); // Remove jPlayer data 2965 this.element.unbind(".jPlayer"); // Remove all event handlers created by the jPlayer constructor 2966 this.element.empty(); // Remove the inserted child elements 2967 2968 delete this.instances[this.internal.instance]; // Clear the instance on the static instance object 2969 }, 2970 destroyRemoved: function() { // Destroy any instances that have gone away. 2971 var self = this; 2972 $.each(this.instances, function(i, element) { 2973 if(self.element !== element) { // Do not destroy this instance. 2974 if(!element.data("jPlayer")) { // Check that element is a real jPlayer. 2975 element.jPlayer("destroy"); 2976 delete self.instances[i]; 2977 } 2978 } 2979 }); 2980 }, 2981 enable: function() { // Plan to implement 2982 // options.disabled = false 2983 }, 2984 disable: function () { // Plan to implement 2985 // options.disabled = true 2986 }, 2987 _testCanPlayType: function(elem) { 2988 // IE9 on Win Server 2008 did not implement canPlayType(), but it has the property. 2989 try { 2990 elem.canPlayType(this.format.mp3.codec); // The type is irrelevant. 2991 return true; 2992 } catch(err) { 2993 return false; 2994 } 2995 }, 2996 _testPlaybackRate: function(type) { 2997 // type: String 'audio' or 'video' 2998 var el, rate = 0.5; 2999 type = typeof type === 'string' ? type : 'audio'; 3000 el = document.createElement(type); 3001 // Wrapping in a try/catch, just in case older HTML5 browsers throw and error. 3002 try { 3003 if('playbackRate' in el) { 3004 el.playbackRate = rate; 3005 return el.playbackRate === rate; 3006 } else { 3007 return false; 3008 } 3009 } catch(err) { 3010 return false; 3011 } 3012 }, 3013 _uaBlocklist: function(list) { 3014 // list : object with properties that are all regular expressions. Property names are irrelevant. 3015 // Returns true if the user agent is matched in list. 3016 var ua = navigator.userAgent.toLowerCase(), 3017 block = false; 3018 3019 $.each(list, function(p, re) { 3020 if(re && re.test(ua)) { 3021 block = true; 3022 return false; // exit $.each. 3023 } 3024 }); 3025 return block; 3026 }, 3027 _restrictNativeVideoControls: function() { 3028 // Fallback to noFullWindow when nativeVideoControls is true and audio media is being used. Affects when both media types are used. 3029 if(this.require.audio) { 3030 if(this.status.nativeVideoControls) { 3031 this.status.nativeVideoControls = false; 3032 this.status.noFullWindow = true; 3033 } 3034 } 3035 }, 3036 _updateNativeVideoControls: function() { 3037 if(this.html.video.available && this.html.used) { 3038 // Turn the HTML Video controls on/off 3039 this.htmlElement.video.controls = this.status.nativeVideoControls; 3040 // Show/hide the jPlayer GUI. 3041 this._updateAutohide(); 3042 // For when option changed. The poster image is not updated, as it is dealt with in setMedia(). Acceptable degradation since seriously doubt these options will change on the fly. Can again review later. 3043 if(this.status.nativeVideoControls && this.require.video) { 3044 this.internal.poster.jq.hide(); 3045 this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height}); 3046 } else if(this.status.waitForPlay && this.status.video) { 3047 this.internal.poster.jq.show(); 3048 this.internal.video.jq.css({'width': '0px', 'height': '0px'}); 3049 } 3050 } 3051 }, 3052 _addHtmlEventListeners: function(mediaElement, entity) { 3053 var self = this; 3054 mediaElement.preload = this.options.preload; 3055 mediaElement.muted = this.options.muted; 3056 mediaElement.volume = this.options.volume; 3057 3058 if(this.status.playbackRateEnabled) { 3059 mediaElement.defaultPlaybackRate = this.options.defaultPlaybackRate; 3060 mediaElement.playbackRate = this.options.playbackRate; 3061 } 3062 3063 // Create the event listeners 3064 // Only want the active entity to affect jPlayer and bubble events. 3065 // Using entity.gate so that object is referenced and gate property always current 3066 3067 mediaElement.addEventListener("progress", function() { 3068 if(entity.gate) { 3069 if(self.internal.cmdsIgnored && this.readyState > 0) { // Detect iOS executed the command 3070 self.internal.cmdsIgnored = false; 3071 } 3072 self._getHtmlStatus(mediaElement); 3073 self._updateInterface(); 3074 self._trigger($.jPlayer.event.progress); 3075 } 3076 }, false); 3077 mediaElement.addEventListener("loadeddata", function() { 3078 if(entity.gate) { 3079 self.androidFix.setMedia = false; // Disable the fix after the first progress event. 3080 if(self.androidFix.play) { // Play Android audio - performing the fix. 3081 self.androidFix.play = false; 3082 self.play(self.androidFix.time); 3083 } 3084 if(self.androidFix.pause) { // Pause Android audio at time - performing the fix. 3085 self.androidFix.pause = false; 3086 self.pause(self.androidFix.time); 3087 } 3088 self._trigger($.jPlayer.event.loadeddata); 3089 } 3090 }, false); 3091 mediaElement.addEventListener("timeupdate", function() { 3092 if(entity.gate) { 3093 self._getHtmlStatus(mediaElement); 3094 self._updateInterface(); 3095 self._trigger($.jPlayer.event.timeupdate); 3096 } 3097 }, false); 3098 mediaElement.addEventListener("durationchange", function() { 3099 if(entity.gate) { 3100 self._getHtmlStatus(mediaElement); 3101 self._updateInterface(); 3102 self._trigger($.jPlayer.event.durationchange); 3103 } 3104 }, false); 3105 mediaElement.addEventListener("play", function() { 3106 if(entity.gate) { 3107 self._updateButtons(true); 3108 self._html_checkWaitForPlay(); // So the native controls update this variable and puts the hidden interface in the correct state. Affects toggling native controls. 3109 self._trigger($.jPlayer.event.play); 3110 } 3111 }, false); 3112 mediaElement.addEventListener("playing", function() { 3113 if(entity.gate) { 3114 self._updateButtons(true); 3115 self._seeked(); 3116 self._trigger($.jPlayer.event.playing); 3117 } 3118 }, false); 3119 mediaElement.addEventListener("pause", function() { 3120 if(entity.gate) { 3121 self._updateButtons(false); 3122 self._trigger($.jPlayer.event.pause); 3123 } 3124 }, false); 3125 mediaElement.addEventListener("waiting", function() { 3126 if(entity.gate) { 3127 self._seeking(); 3128 self._trigger($.jPlayer.event.waiting); 3129 } 3130 }, false); 3131 mediaElement.addEventListener("seeking", function() { 3132 if(entity.gate) { 3133 self._seeking(); 3134 self._trigger($.jPlayer.event.seeking); 3135 } 3136 }, false); 3137 mediaElement.addEventListener("seeked", function() { 3138 if(entity.gate) { 3139 self._seeked(); 3140 self._trigger($.jPlayer.event.seeked); 3141 } 3142 }, false); 3143 mediaElement.addEventListener("volumechange", function() { 3144 if(entity.gate) { 3145 // Read the values back from the element as the Blackberry PlayBook shares the volume with the physical buttons master volume control. 3146 // However, when tested 6th July 2011, those buttons do not generate an event. The physical play/pause button does though. 3147 self.options.volume = mediaElement.volume; 3148 self.options.muted = mediaElement.muted; 3149 self._updateMute(); 3150 self._updateVolume(); 3151 self._trigger($.jPlayer.event.volumechange); 3152 } 3153 }, false); 3154 mediaElement.addEventListener("ratechange", function() { 3155 if(entity.gate) { 3156 self.options.defaultPlaybackRate = mediaElement.defaultPlaybackRate; 3157 self.options.playbackRate = mediaElement.playbackRate; 3158 self._updatePlaybackRate(); 3159 self._trigger($.jPlayer.event.ratechange); 3160 } 3161 }, false); 3162 mediaElement.addEventListener("suspend", function() { // Seems to be the only way of capturing that the iOS4 browser did not actually play the media from the page code. ie., It needs a user gesture. 3163 if(entity.gate) { 3164 self._seeked(); 3165 self._trigger($.jPlayer.event.suspend); 3166 } 3167 }, false); 3168 mediaElement.addEventListener("ended", function() { 3169 if(entity.gate) { 3170 // Order of the next few commands are important. Change the time and then pause. 3171 // Solves a bug in Firefox, where issuing pause 1st causes the media to play from the start. ie., The pause is ignored. 3172 if(!$.jPlayer.browser.webkit) { // Chrome crashes if you do this in conjunction with a setMedia command in an ended event handler. ie., The playlist demo. 3173 self.htmlElement.media.currentTime = 0; // Safari does not care about this command. ie., It works with or without this line. (Both Safari and Chrome are Webkit.) 3174 } 3175 self.htmlElement.media.pause(); // Pause otherwise a click on the progress bar will play from that point, when it shouldn't, since it stopped playback. 3176 self._updateButtons(false); 3177 self._getHtmlStatus(mediaElement, true); // With override true. Otherwise Chrome leaves progress at full. 3178 self._updateInterface(); 3179 self._trigger($.jPlayer.event.ended); 3180 } 3181 }, false); 3182 mediaElement.addEventListener("error", function() { 3183 if(entity.gate) { 3184 self._updateButtons(false); 3185 self._seeked(); 3186 if(self.status.srcSet) { // Deals with case of clearMedia() causing an error event. 3187 clearTimeout(self.internal.htmlDlyCmdId); // Clears any delayed commands used in the HTML solution. 3188 self.status.waitForLoad = true; // Allows the load operation to try again. 3189 self.status.waitForPlay = true; // Reset since a play was captured. 3190 if(self.status.video && !self.status.nativeVideoControls) { 3191 self.internal.video.jq.css({'width':'0px', 'height':'0px'}); 3192 } 3193 if(self._validString(self.status.media.poster) && !self.status.nativeVideoControls) { 3194 self.internal.poster.jq.show(); 3195 } 3196 if(self.css.jq.videoPlay.length) { 3197 self.css.jq.videoPlay.show(); 3198 } 3199 self._error( { 3200 type: $.jPlayer.error.URL, 3201 context: self.status.src, // this.src shows absolute urls. Want context to show the url given. 3202 message: $.jPlayer.errorMsg.URL, 3203 hint: $.jPlayer.errorHint.URL 3204 }); 3205 } 3206 } 3207 }, false); 3208 // Create all the other event listeners that bubble up to a jPlayer event from html, without being used by jPlayer. 3209 $.each($.jPlayer.htmlEvent, function(i, eventType) { 3210 mediaElement.addEventListener(this, function() { 3211 if(entity.gate) { 3212 self._trigger($.jPlayer.event[eventType]); 3213 } 3214 }, false); 3215 }); 3216 }, 3217 _addAuroraEventListeners : function(player, entity) { 3218 var self = this; 3219 //player.preload = this.options.preload; 3220 //player.muted = this.options.muted; 3221 player.volume = this.options.volume * 100; 3222 3223 // Create the event listeners 3224 // Only want the active entity to affect jPlayer and bubble events. 3225 // Using entity.gate so that object is referenced and gate property always current 3226 3227 player.on("progress", function() { 3228 if(entity.gate) { 3229 if(self.internal.cmdsIgnored && this.readyState > 0) { // Detect iOS executed the command 3230 self.internal.cmdsIgnored = false; 3231 } 3232 self._getAuroraStatus(player); 3233 self._updateInterface(); 3234 self._trigger($.jPlayer.event.progress); 3235 // Progress with song duration, we estimate timeupdate need to be triggered too. 3236 if (player.duration > 0) { 3237 self._trigger($.jPlayer.event.timeupdate); 3238 } 3239 } 3240 }, false); 3241 player.on("ready", function() { 3242 if(entity.gate) { 3243 self._trigger($.jPlayer.event.loadeddata); 3244 } 3245 }, false); 3246 player.on("duration", function() { 3247 if(entity.gate) { 3248 self._getAuroraStatus(player); 3249 self._updateInterface(); 3250 self._trigger($.jPlayer.event.durationchange); 3251 } 3252 }, false); 3253 player.on("end", function() { 3254 if(entity.gate) { 3255 // Order of the next few commands are important. Change the time and then pause. 3256 self._updateButtons(false); 3257 self._getAuroraStatus(player, true); 3258 self._updateInterface(); 3259 self._trigger($.jPlayer.event.ended); 3260 } 3261 }, false); 3262 player.on("error", function() { 3263 if(entity.gate) { 3264 self._updateButtons(false); 3265 self._seeked(); 3266 if(self.status.srcSet) { // Deals with case of clearMedia() causing an error event. 3267 self.status.waitForLoad = true; // Allows the load operation to try again. 3268 self.status.waitForPlay = true; // Reset since a play was captured. 3269 if(self.status.video && !self.status.nativeVideoControls) { 3270 self.internal.video.jq.css({'width':'0px', 'height':'0px'}); 3271 } 3272 if(self._validString(self.status.media.poster) && !self.status.nativeVideoControls) { 3273 self.internal.poster.jq.show(); 3274 } 3275 if(self.css.jq.videoPlay.length) { 3276 self.css.jq.videoPlay.show(); 3277 } 3278 self._error( { 3279 type: $.jPlayer.error.URL, 3280 context: self.status.src, // this.src shows absolute urls. Want context to show the url given. 3281 message: $.jPlayer.errorMsg.URL, 3282 hint: $.jPlayer.errorHint.URL 3283 }); 3284 } 3285 } 3286 }, false); 3287 }, 3288 _getHtmlStatus: function(media, override) { 3289 var ct = 0, cpa = 0, sp = 0, cpr = 0; 3290 3291 // Fixes the duration bug in iOS, where the durationchange event occurs when media.duration is not always correct. 3292 // Fixes the initial duration bug in BB OS7, where the media.duration is infinity and displays as NaN:NaN due to Date() using inifity. 3293 if(isFinite(media.duration)) { 3294 this.status.duration = media.duration; 3295 } 3296 3297 ct = media.currentTime; 3298 cpa = (this.status.duration > 0) ? 100 * ct / this.status.duration : 0; 3299 if((typeof media.seekable === "object") && (media.seekable.length > 0)) { 3300 sp = (this.status.duration > 0) ? 100 * media.seekable.end(media.seekable.length-1) / this.status.duration : 100; 3301 cpr = (this.status.duration > 0) ? 100 * media.currentTime / media.seekable.end(media.seekable.length-1) : 0; // Duration conditional for iOS duration bug. ie., seekable.end is a NaN in that case. 3302 } else { 3303 sp = 100; 3304 cpr = cpa; 3305 } 3306 3307 if(override) { 3308 ct = 0; 3309 cpr = 0; 3310 cpa = 0; 3311 } 3312 3313 this.status.seekPercent = sp; 3314 this.status.currentPercentRelative = cpr; 3315 this.status.currentPercentAbsolute = cpa; 3316 this.status.currentTime = ct; 3317 3318 this.status.remaining = this.status.duration - this.status.currentTime; 3319 3320 this.status.videoWidth = media.videoWidth; 3321 this.status.videoHeight = media.videoHeight; 3322 3323 this.status.readyState = media.readyState; 3324 this.status.networkState = media.networkState; 3325 this.status.playbackRate = media.playbackRate; 3326 this.status.ended = media.ended; 3327 }, 3328 _getAuroraStatus: function(player, override) { 3329 var ct = 0, cpa = 0, sp = 0, cpr = 0; 3330 3331 this.status.duration = player.duration / 1000; 3332 3333 ct = player.currentTime / 1000; 3334 cpa = (this.status.duration > 0) ? 100 * ct / this.status.duration : 0; 3335 if(player.buffered > 0) { 3336 sp = (this.status.duration > 0) ? (player.buffered * this.status.duration) / this.status.duration : 100; 3337 cpr = (this.status.duration > 0) ? ct / (player.buffered * this.status.duration) : 0; 3338 } else { 3339 sp = 100; 3340 cpr = cpa; 3341 } 3342 3343 if(override) { 3344 ct = 0; 3345 cpr = 0; 3346 cpa = 0; 3347 } 3348 3349 this.status.seekPercent = sp; 3350 this.status.currentPercentRelative = cpr; 3351 this.status.currentPercentAbsolute = cpa; 3352 this.status.currentTime = ct; 3353 3354 this.status.remaining = this.status.duration - this.status.currentTime; 3355 3356 this.status.readyState = 4; // status.readyState; 3357 this.status.networkState = 0; // status.networkState; 3358 this.status.playbackRate = 1; // status.playbackRate; 3359 this.status.ended = false; // status.ended; 3360 }, 3361 _resetStatus: function() { 3362 this.status = $.extend({}, this.status, $.jPlayer.prototype.status); // Maintains the status properties that persist through a reset. 3363 }, 3364 _trigger: function(eventType, error, warning) { // eventType always valid as called using $.jPlayer.event.eventType 3365 var event = $.Event(eventType); 3366 event.jPlayer = {}; 3367 event.jPlayer.version = $.extend({}, this.version); 3368 event.jPlayer.options = $.extend(true, {}, this.options); // Deep copy 3369 event.jPlayer.status = $.extend(true, {}, this.status); // Deep copy 3370 event.jPlayer.html = $.extend(true, {}, this.html); // Deep copy 3371 event.jPlayer.aurora = $.extend(true, {}, this.aurora); // Deep copy 3372 event.jPlayer.flash = $.extend(true, {}, this.flash); // Deep copy 3373 if(error) { 3374 event.jPlayer.error = $.extend({}, error); 3375 } 3376 if(warning) { 3377 event.jPlayer.warning = $.extend({}, warning); 3378 } 3379 this.element.trigger(event); 3380 }, 3381 jPlayerFlashEvent: function(eventType, status) { // Called from Flash 3382 if(eventType === $.jPlayer.event.ready) { 3383 if(!this.internal.ready) { 3384 this.internal.ready = true; 3385 this.internal.flash.jq.css({'width':'0px', 'height':'0px'}); // Once Flash generates the ready event, minimise to zero as it is not affected by wmode anymore. 3386 3387 this.version.flash = status.version; 3388 if(this.version.needFlash !== this.version.flash) { 3389 this._error( { 3390 type: $.jPlayer.error.VERSION, 3391 context: this.version.flash, 3392 message: $.jPlayer.errorMsg.VERSION + this.version.flash, 3393 hint: $.jPlayer.errorHint.VERSION 3394 }); 3395 } 3396 this._trigger($.jPlayer.event.repeat); // Trigger the repeat event so its handler can initialize itself with the loop option. 3397 this._trigger(eventType); 3398 } else { 3399 // This condition occurs if the Flash is hidden and then shown again. 3400 // Firefox also reloads the Flash if the CSS position changes. position:fixed is used for full screen. 3401 3402 // Only do this if the Flash is the solution being used at the moment. Affects Media players where both solution may be being used. 3403 if(this.flash.gate) { 3404 3405 // Send the current status to the Flash now that it is ready (available) again. 3406 if(this.status.srcSet) { 3407 3408 // Need to read original status before issuing the setMedia command. 3409 var currentTime = this.status.currentTime, 3410 paused = this.status.paused; 3411 3412 this.setMedia(this.status.media); 3413 this.volumeWorker(this.options.volume); 3414 if(currentTime > 0) { 3415 if(paused) { 3416 this.pause(currentTime); 3417 } else { 3418 this.play(currentTime); 3419 } 3420 } 3421 } 3422 this._trigger($.jPlayer.event.flashreset); 3423 } 3424 } 3425 } 3426 if(this.flash.gate) { 3427 switch(eventType) { 3428 case $.jPlayer.event.progress: 3429 this._getFlashStatus(status); 3430 this._updateInterface(); 3431 this._trigger(eventType); 3432 break; 3433 case $.jPlayer.event.timeupdate: 3434 this._getFlashStatus(status); 3435 this._updateInterface(); 3436 this._trigger(eventType); 3437 break; 3438 case $.jPlayer.event.play: 3439 this._seeked(); 3440 this._updateButtons(true); 3441 this._trigger(eventType); 3442 break; 3443 case $.jPlayer.event.pause: 3444 this._updateButtons(false); 3445 this._trigger(eventType); 3446 break; 3447 case $.jPlayer.event.ended: 3448 this._updateButtons(false); 3449 this._trigger(eventType); 3450 break; 3451 case $.jPlayer.event.click: 3452 this._trigger(eventType); // This could be dealt with by the default 3453 break; 3454 case $.jPlayer.event.error: 3455 this.status.waitForLoad = true; // Allows the load operation to try again. 3456 this.status.waitForPlay = true; // Reset since a play was captured. 3457 if(this.status.video) { 3458 this.internal.flash.jq.css({'width':'0px', 'height':'0px'}); 3459 } 3460 if(this._validString(this.status.media.poster)) { 3461 this.internal.poster.jq.show(); 3462 } 3463 if(this.css.jq.videoPlay.length && this.status.video) { 3464 this.css.jq.videoPlay.show(); 3465 } 3466 if(this.status.video) { // Set up for another try. Execute before error event. 3467 this._flash_setVideo(this.status.media); 3468 } else { 3469 this._flash_setAudio(this.status.media); 3470 } 3471 this._updateButtons(false); 3472 this._error( { 3473 type: $.jPlayer.error.URL, 3474 context:status.src, 3475 message: $.jPlayer.errorMsg.URL, 3476 hint: $.jPlayer.errorHint.URL 3477 }); 3478 break; 3479 case $.jPlayer.event.seeking: 3480 this._seeking(); 3481 this._trigger(eventType); 3482 break; 3483 case $.jPlayer.event.seeked: 3484 this._seeked(); 3485 this._trigger(eventType); 3486 break; 3487 case $.jPlayer.event.ready: 3488 // The ready event is handled outside the switch statement. 3489 // Captured here otherwise 2 ready events would be generated if the ready event handler used setMedia. 3490 break; 3491 default: 3492 this._trigger(eventType); 3493 } 3494 } 3495 return false; 3496 }, 3497 _getFlashStatus: function(status) { 3498 this.status.seekPercent = status.seekPercent; 3499 this.status.currentPercentRelative = status.currentPercentRelative; 3500 this.status.currentPercentAbsolute = status.currentPercentAbsolute; 3501 this.status.currentTime = status.currentTime; 3502 this.status.duration = status.duration; 3503 this.status.remaining = status.duration - status.currentTime; 3504 3505 this.status.videoWidth = status.videoWidth; 3506 this.status.videoHeight = status.videoHeight; 3507 3508 // The Flash does not generate this information in this release 3509 this.status.readyState = 4; // status.readyState; 3510 this.status.networkState = 0; // status.networkState; 3511 this.status.playbackRate = 1; // status.playbackRate; 3512 this.status.ended = false; // status.ended; 3513 }, 3514 _updateButtons: function(playing) { 3515 if(playing === undefined) { 3516 playing = !this.status.paused; 3517 } else { 3518 this.status.paused = !playing; 3519 } 3520 // Apply the state classes. (For the useStateClassSkin:true option) 3521 if(playing) { 3522 this.addStateClass('playing'); 3523 } else { 3524 this.removeStateClass('playing'); 3525 } 3526 if(!this.status.noFullWindow && this.options.fullWindow) { 3527 this.addStateClass('fullScreen'); 3528 } else { 3529 this.removeStateClass('fullScreen'); 3530 } 3531 if(this.options.loop) { 3532 this.addStateClass('looped'); 3533 } else { 3534 this.removeStateClass('looped'); 3535 } 3536 // Toggle the GUI element pairs. (For the useStateClassSkin:false option) 3537 if(this.css.jq.play.length && this.css.jq.pause.length) { 3538 if(playing) { 3539 this.css.jq.play.hide(); 3540 this.css.jq.pause.show(); 3541 } else { 3542 this.css.jq.play.show(); 3543 this.css.jq.pause.hide(); 3544 } 3545 } 3546 if(this.css.jq.restoreScreen.length && this.css.jq.fullScreen.length) { 3547 if(this.status.noFullWindow) { 3548 this.css.jq.fullScreen.hide(); 3549 this.css.jq.restoreScreen.hide(); 3550 } else if(this.options.fullWindow) { 3551 this.css.jq.fullScreen.hide(); 3552 this.css.jq.restoreScreen.show(); 3553 } else { 3554 this.css.jq.fullScreen.show(); 3555 this.css.jq.restoreScreen.hide(); 3556 } 3557 } 3558 if(this.css.jq.repeat.length && this.css.jq.repeatOff.length) { 3559 if(this.options.loop) { 3560 this.css.jq.repeat.hide(); 3561 this.css.jq.repeatOff.show(); 3562 } else { 3563 this.css.jq.repeat.show(); 3564 this.css.jq.repeatOff.hide(); 3565 } 3566 } 3567 }, 3568 _updateInterface: function() { 3569 if(this.css.jq.seekBar.length) { 3570 this.css.jq.seekBar.width(this.status.seekPercent+"%"); 3571 } 3572 if(this.css.jq.playBar.length) { 3573 if(this.options.smoothPlayBar) { 3574 this.css.jq.playBar.stop().animate({ 3575 width: this.status.currentPercentAbsolute+"%" 3576 }, 250, "linear"); 3577 } else { 3578 this.css.jq.playBar.width(this.status.currentPercentRelative+"%"); 3579 } 3580 } 3581 var currentTimeText = ''; 3582 if(this.css.jq.currentTime.length) { 3583 currentTimeText = this._convertTime(this.status.currentTime); 3584 if(currentTimeText !== this.css.jq.currentTime.text()) { 3585 this.css.jq.currentTime.text(this._convertTime(this.status.currentTime)); 3586 } 3587 } 3588 var durationText = '', 3589 duration = this.status.duration, 3590 remaining = this.status.remaining; 3591 if(this.css.jq.duration.length) { 3592 if(typeof this.status.media.duration === 'string') { 3593 durationText = this.status.media.duration; 3594 } else { 3595 if(typeof this.status.media.duration === 'number') { 3596 duration = this.status.media.duration; 3597 remaining = duration - this.status.currentTime; 3598 } 3599 if(this.options.remainingDuration) { 3600 durationText = (remaining > 0 ? '-' : '') + this._convertTime(remaining); 3601 } else { 3602 durationText = this._convertTime(duration); 3603 } 3604 } 3605 if(durationText !== this.css.jq.duration.text()) { 3606 this.css.jq.duration.text(durationText); 3607 } 3608 } 3609 }, 3610 _convertTime: ConvertTime.prototype.time, 3611 _seeking: function() { 3612 if(this.css.jq.seekBar.length) { 3613 this.css.jq.seekBar.addClass("jp-seeking-bg"); 3614 } 3615 this.addStateClass('seeking'); 3616 }, 3617 _seeked: function() { 3618 if(this.css.jq.seekBar.length) { 3619 this.css.jq.seekBar.removeClass("jp-seeking-bg"); 3620 } 3621 this.removeStateClass('seeking'); 3622 }, 3623 _resetGate: function() { 3624 this.html.audio.gate = false; 3625 this.html.video.gate = false; 3626 this.aurora.gate = false; 3627 this.flash.gate = false; 3628 }, 3629 _resetActive: function() { 3630 this.html.active = false; 3631 this.aurora.active = false; 3632 this.flash.active = false; 3633 }, 3634 _escapeHtml: function(s) { 3635 return s.split('&').join('&').split('<').join('<').split('>').join('>').split('"').join('"'); 3636 }, 3637 _qualifyURL: function(url) { 3638 var el = document.createElement('div'); 3639 el.innerHTML= '<a href="' + this._escapeHtml(url) + '">x</a>'; 3640 return el.firstChild.href; 3641 }, 3642 _absoluteMediaUrls: function(media) { 3643 var self = this; 3644 $.each(media, function(type, url) { 3645 if(url && self.format[type] && url.substr(0, 5) !== "data:") { 3646 media[type] = self._qualifyURL(url); 3647 } 3648 }); 3649 return media; 3650 }, 3651 addStateClass: function(state) { 3652 if(this.ancestorJq.length) { 3653 this.ancestorJq.addClass(this.options.stateClass[state]); 3654 } 3655 }, 3656 removeStateClass: function(state) { 3657 if(this.ancestorJq.length) { 3658 this.ancestorJq.removeClass(this.options.stateClass[state]); 3659 } 3660 }, 3661 setMedia: function(media) { 3662 3663 /* media[format] = String: URL of format. Must contain all of the supplied option's video or audio formats. 3664 * media.poster = String: Video poster URL. 3665 * media.track = Array: Of objects defining the track element: kind, src, srclang, label, def. 3666 * media.stream = Boolean: * NOT IMPLEMENTED * Designating actual media streams. ie., "false/undefined" for files. Plan to refresh the flash every so often. 3667 */ 3668 3669 var self = this, 3670 supported = false, 3671 posterChanged = this.status.media.poster !== media.poster; // Compare before reset. Important for OSX Safari as this.htmlElement.poster.src is absolute, even if original poster URL was relative. 3672 3673 this._resetMedia(); 3674 this._resetGate(); 3675 this._resetActive(); 3676 3677 // Clear the Android Fix. 3678 this.androidFix.setMedia = false; 3679 this.androidFix.play = false; 3680 this.androidFix.pause = false; 3681 3682 // Convert all media URLs to absolute URLs. 3683 media = this._absoluteMediaUrls(media); 3684 3685 $.each(this.formats, function(formatPriority, format) { 3686 var isVideo = self.format[format].media === 'video'; 3687 $.each(self.solutions, function(solutionPriority, solution) { 3688 if(self[solution].support[format] && self._validString(media[format])) { // Format supported in solution and url given for format. 3689 var isHtml = solution === 'html'; 3690 var isAurora = solution === 'aurora'; 3691 3692 if(isVideo) { 3693 if(isHtml) { 3694 self.html.video.gate = true; 3695 self._html_setVideo(media); 3696 self.html.active = true; 3697 } else { 3698 self.flash.gate = true; 3699 self._flash_setVideo(media); 3700 self.flash.active = true; 3701 } 3702 if(self.css.jq.videoPlay.length) { 3703 self.css.jq.videoPlay.show(); 3704 } 3705 self.status.video = true; 3706 } else { 3707 if(isHtml) { 3708 self.html.audio.gate = true; 3709 self._html_setAudio(media); 3710 self.html.active = true; 3711 3712 // Setup the Android Fix - Only for HTML audio. 3713 if($.jPlayer.platform.android) { 3714 self.androidFix.setMedia = true; 3715 } 3716 } else if(isAurora) { 3717 self.aurora.gate = true; 3718 self._aurora_setAudio(media); 3719 self.aurora.active = true; 3720 } else { 3721 self.flash.gate = true; 3722 self._flash_setAudio(media); 3723 self.flash.active = true; 3724 } 3725 if(self.css.jq.videoPlay.length) { 3726 self.css.jq.videoPlay.hide(); 3727 } 3728 self.status.video = false; 3729 } 3730 3731 supported = true; 3732 return false; // Exit $.each 3733 } 3734 }); 3735 if(supported) { 3736 return false; // Exit $.each 3737 } 3738 }); 3739 3740 if(supported) { 3741 if(!(this.status.nativeVideoControls && this.html.video.gate)) { 3742 // Set poster IMG if native video controls are not being used 3743 // Note: With IE the IMG onload event occurs immediately when cached. 3744 // Note: Poster hidden by default in _resetMedia() 3745 if(this._validString(media.poster)) { 3746 if(posterChanged) { // Since some browsers do not generate img onload event. 3747 this.htmlElement.poster.src = media.poster; 3748 } else { 3749 this.internal.poster.jq.show(); 3750 } 3751 } 3752 } 3753 if(typeof media.title === 'string') { 3754 if(this.css.jq.title.length) { 3755 this.css.jq.title.html(media.title); 3756 } 3757 if(this.htmlElement.audio) { 3758 this.htmlElement.audio.setAttribute('title', media.title); 3759 } 3760 if(this.htmlElement.video) { 3761 this.htmlElement.video.setAttribute('title', media.title); 3762 } 3763 } 3764 this.status.srcSet = true; 3765 this.status.media = $.extend({}, media); 3766 this._updateButtons(false); 3767 this._updateInterface(); 3768 this._trigger($.jPlayer.event.setmedia); 3769 } else { // jPlayer cannot support any formats provided in this browser 3770 // Send an error event 3771 this._error( { 3772 type: $.jPlayer.error.NO_SUPPORT, 3773 context: "{supplied:'" + this.options.supplied + "'}", 3774 message: $.jPlayer.errorMsg.NO_SUPPORT, 3775 hint: $.jPlayer.errorHint.NO_SUPPORT 3776 }); 3777 } 3778 }, 3779 _resetMedia: function() { 3780 this._resetStatus(); 3781 this._updateButtons(false); 3782 this._updateInterface(); 3783 this._seeked(); 3784 this.internal.poster.jq.hide(); 3785 3786 clearTimeout(this.internal.htmlDlyCmdId); 3787 3788 if(this.html.active) { 3789 this._html_resetMedia(); 3790 } else if(this.aurora.active) { 3791 this._aurora_resetMedia(); 3792 } else if(this.flash.active) { 3793 this._flash_resetMedia(); 3794 } 3795 }, 3796 clearMedia: function() { 3797 this._resetMedia(); 3798 3799 if(this.html.active) { 3800 this._html_clearMedia(); 3801 } else if(this.aurora.active) { 3802 this._aurora_clearMedia(); 3803 } else if(this.flash.active) { 3804 this._flash_clearMedia(); 3805 } 3806 3807 this._resetGate(); 3808 this._resetActive(); 3809 }, 3810 load: function() { 3811 if(this.status.srcSet) { 3812 if(this.html.active) { 3813 this._html_load(); 3814 } else if(this.aurora.active) { 3815 this._aurora_load(); 3816 } else if(this.flash.active) { 3817 this._flash_load(); 3818 } 3819 } else { 3820 this._urlNotSetError("load"); 3821 } 3822 }, 3823 focus: function() { 3824 if(this.options.keyEnabled) { 3825 $.jPlayer.focus = this; 3826 } 3827 }, 3828 play: function(time) { 3829 var guiAction = typeof time === "object"; // Flags GUI click events so we know this was not a direct command, but an action taken by the user on the GUI. 3830 if(guiAction && this.options.useStateClassSkin && !this.status.paused) { 3831 this.pause(time); // The time would be the click event, but passing it over so info is not lost. 3832 } else { 3833 time = (typeof time === "number") ? time : NaN; // Remove jQuery event from click handler 3834 if(this.status.srcSet) { 3835 this.focus(); 3836 if(this.html.active) { 3837 this._html_play(time); 3838 } else if(this.aurora.active) { 3839 this._aurora_play(time); 3840 } else if(this.flash.active) { 3841 this._flash_play(time); 3842 } 3843 } else { 3844 this._urlNotSetError("play"); 3845 } 3846 } 3847 }, 3848 videoPlay: function() { // Handles clicks on the play button over the video poster 3849 this.play(); 3850 }, 3851 pause: function(time) { 3852 time = (typeof time === "number") ? time : NaN; // Remove jQuery event from click handler 3853 if(this.status.srcSet) { 3854 if(this.html.active) { 3855 this._html_pause(time); 3856 } else if(this.aurora.active) { 3857 this._aurora_pause(time); 3858 } else if(this.flash.active) { 3859 this._flash_pause(time); 3860 } 3861 } else { 3862 this._urlNotSetError("pause"); 3863 } 3864 }, 3865 tellOthers: function(command, conditions) { 3866 var self = this, 3867 hasConditions = typeof conditions === 'function', 3868 args = Array.prototype.slice.call(arguments); // Convert arguments to an Array. 3869 3870 if(typeof command !== 'string') { // Ignore, since no command. 3871 return; // Return undefined to maintain chaining. 3872 } 3873 if(hasConditions) { 3874 args.splice(1, 1); // Remove the conditions from the arguments 3875 } 3876 3877 $.jPlayer.prototype.destroyRemoved(); 3878 $.each(this.instances, function() { 3879 // Remember that "this" is the instance's "element" in the $.each() loop. 3880 if(self.element !== this) { // Do not tell my instance. 3881 if(!hasConditions || conditions.call(this.data("jPlayer"), self)) { 3882 this.jPlayer.apply(this, args); 3883 } 3884 } 3885 }); 3886 }, 3887 pauseOthers: function(time) { 3888 this.tellOthers("pause", function() { 3889 // In the conditions function, the "this" context is the other instance's jPlayer object. 3890 return this.status.srcSet; 3891 }, time); 3892 }, 3893 stop: function() { 3894 if(this.status.srcSet) { 3895 if(this.html.active) { 3896 this._html_pause(0); 3897 } else if(this.aurora.active) { 3898 this._aurora_pause(0); 3899 } else if(this.flash.active) { 3900 this._flash_pause(0); 3901 } 3902 } else { 3903 this._urlNotSetError("stop"); 3904 } 3905 }, 3906 playHead: function(p) { 3907 p = this._limitValue(p, 0, 100); 3908 if(this.status.srcSet) { 3909 if(this.html.active) { 3910 this._html_playHead(p); 3911 } else if(this.aurora.active) { 3912 this._aurora_playHead(p); 3913 } else if(this.flash.active) { 3914 this._flash_playHead(p); 3915 } 3916 } else { 3917 this._urlNotSetError("playHead"); 3918 } 3919 }, 3920 _muted: function(muted) { 3921 this.mutedWorker(muted); 3922 if(this.options.globalVolume) { 3923 this.tellOthers("mutedWorker", function() { 3924 // Check the other instance has global volume enabled. 3925 return this.options.globalVolume; 3926 }, muted); 3927 } 3928 }, 3929 mutedWorker: function(muted) { 3930 this.options.muted = muted; 3931 if(this.html.used) { 3932 this._html_setProperty('muted', muted); 3933 } 3934 if(this.aurora.used) { 3935 this._aurora_mute(muted); 3936 } 3937 if(this.flash.used) { 3938 this._flash_mute(muted); 3939 } 3940 3941 // The HTML solution generates this event from the media element itself. 3942 if(!this.html.video.gate && !this.html.audio.gate) { 3943 this._updateMute(muted); 3944 this._updateVolume(this.options.volume); 3945 this._trigger($.jPlayer.event.volumechange); 3946 } 3947 }, 3948 mute: function(mute) { // mute is either: undefined (true), an event object (true) or a boolean (muted). 3949 var guiAction = typeof mute === "object"; // Flags GUI click events so we know this was not a direct command, but an action taken by the user on the GUI. 3950 if(guiAction && this.options.useStateClassSkin && this.options.muted) { 3951 this._muted(false); 3952 } else { 3953 mute = mute === undefined ? true : !!mute; 3954 this._muted(mute); 3955 } 3956 }, 3957 unmute: function(unmute) { // unmute is either: undefined (true), an event object (true) or a boolean (!muted). 3958 unmute = unmute === undefined ? true : !!unmute; 3959 this._muted(!unmute); 3960 }, 3961 _updateMute: function(mute) { 3962 if(mute === undefined) { 3963 mute = this.options.muted; 3964 } 3965 if(mute) { 3966 this.addStateClass('muted'); 3967 } else { 3968 this.removeStateClass('muted'); 3969 } 3970 if(this.css.jq.mute.length && this.css.jq.unmute.length) { 3971 if(this.status.noVolume) { 3972 this.css.jq.mute.hide(); 3973 this.css.jq.unmute.hide(); 3974 } else if(mute) { 3975 this.css.jq.mute.hide(); 3976 this.css.jq.unmute.show(); 3977 } else { 3978 this.css.jq.mute.show(); 3979 this.css.jq.unmute.hide(); 3980 } 3981 } 3982 }, 3983 volume: function(v) { 3984 this.volumeWorker(v); 3985 if(this.options.globalVolume) { 3986 this.tellOthers("volumeWorker", function() { 3987 // Check the other instance has global volume enabled. 3988 return this.options.globalVolume; 3989 }, v); 3990 } 3991 }, 3992 volumeWorker: function(v) { 3993 v = this._limitValue(v, 0, 1); 3994 this.options.volume = v; 3995 3996 if(this.html.used) { 3997 this._html_setProperty('volume', v); 3998 } 3999 if(this.aurora.used) { 4000 this._aurora_volume(v); 4001 } 4002 if(this.flash.used) { 4003 this._flash_volume(v); 4004 } 4005 4006 // The HTML solution generates this event from the media element itself. 4007 if(!this.html.video.gate && !this.html.audio.gate) { 4008 this._updateVolume(v); 4009 this._trigger($.jPlayer.event.volumechange); 4010 } 4011 }, 4012 volumeBar: function(e) { // Handles clicks on the volumeBar 4013 if(this.css.jq.volumeBar.length) { 4014 // Using $(e.currentTarget) to enable multiple volume bars 4015 var $bar = $(e.currentTarget), 4016 offset = $bar.offset(), 4017 x = e.pageX - offset.left, 4018 w = $bar.width(), 4019 y = $bar.height() - e.pageY + offset.top, 4020 h = $bar.height(); 4021 if(this.options.verticalVolume) { 4022 this.volume(y/h); 4023 } else { 4024 this.volume(x/w); 4025 } 4026 } 4027 if(this.options.muted) { 4028 this._muted(false); 4029 } 4030 }, 4031 _updateVolume: function(v) { 4032 if(v === undefined) { 4033 v = this.options.volume; 4034 } 4035 v = this.options.muted ? 0 : v; 4036 4037 if(this.status.noVolume) { 4038 this.addStateClass('noVolume'); 4039 if(this.css.jq.volumeBar.length) { 4040 this.css.jq.volumeBar.hide(); 4041 } 4042 if(this.css.jq.volumeBarValue.length) { 4043 this.css.jq.volumeBarValue.hide(); 4044 } 4045 if(this.css.jq.volumeMax.length) { 4046 this.css.jq.volumeMax.hide(); 4047 } 4048 } else { 4049 this.removeStateClass('noVolume'); 4050 if(this.css.jq.volumeBar.length) { 4051 this.css.jq.volumeBar.show(); 4052 } 4053 if(this.css.jq.volumeBarValue.length) { 4054 this.css.jq.volumeBarValue.show(); 4055 this.css.jq.volumeBarValue[this.options.verticalVolume ? "height" : "width"]((v*100)+"%"); 4056 } 4057 if(this.css.jq.volumeMax.length) { 4058 this.css.jq.volumeMax.show(); 4059 } 4060 } 4061 }, 4062 volumeMax: function() { // Handles clicks on the volume max 4063 this.volume(1); 4064 if(this.options.muted) { 4065 this._muted(false); 4066 } 4067 }, 4068 _cssSelectorAncestor: function(ancestor) { 4069 var self = this; 4070 this.options.cssSelectorAncestor = ancestor; 4071 this._removeUiClass(); 4072 this.ancestorJq = ancestor ? $(ancestor) : []; // Would use $() instead of [], but it is only 1.4+ 4073 if(ancestor && this.ancestorJq.length !== 1) { // So empty strings do not generate the warning. 4074 this._warning( { 4075 type: $.jPlayer.warning.CSS_SELECTOR_COUNT, 4076 context: ancestor, 4077 message: $.jPlayer.warningMsg.CSS_SELECTOR_COUNT + this.ancestorJq.length + " found for cssSelectorAncestor.", 4078 hint: $.jPlayer.warningHint.CSS_SELECTOR_COUNT 4079 }); 4080 } 4081 this._addUiClass(); 4082 $.each(this.options.cssSelector, function(fn, cssSel) { 4083 self._cssSelector(fn, cssSel); 4084 }); 4085 4086 // Set the GUI to the current state. 4087 this._updateInterface(); 4088 this._updateButtons(); 4089 this._updateAutohide(); 4090 this._updateVolume(); 4091 this._updateMute(); 4092 }, 4093 _cssSelector: function(fn, cssSel) { 4094 var self = this; 4095 if(typeof cssSel === 'string') { 4096 if($.jPlayer.prototype.options.cssSelector[fn]) { 4097 if(this.css.jq[fn] && this.css.jq[fn].length) { 4098 this.css.jq[fn].unbind(".jPlayer"); 4099 } 4100 this.options.cssSelector[fn] = cssSel; 4101 this.css.cs[fn] = this.options.cssSelectorAncestor + " " + cssSel; 4102 4103 if(cssSel) { // Checks for empty string 4104 this.css.jq[fn] = $(this.css.cs[fn]); 4105 } else { 4106 this.css.jq[fn] = []; // To comply with the css.jq[fn].length check before its use. As of jQuery 1.4 could have used $() for an empty set. 4107 } 4108 4109 if(this.css.jq[fn].length && this[fn]) { 4110 var handler = function(e) { 4111 e.preventDefault(); 4112 self[fn](e); 4113 if(self.options.autoBlur) { 4114 $(this).blur(); 4115 } else { 4116 $(this).focus(); // Force focus for ARIA. 4117 } 4118 }; 4119 this.css.jq[fn].bind("click.jPlayer", handler); // Using jPlayer namespace 4120 } 4121 4122 if(cssSel && this.css.jq[fn].length !== 1) { // So empty strings do not generate the warning. ie., they just remove the old one. 4123 this._warning( { 4124 type: $.jPlayer.warning.CSS_SELECTOR_COUNT, 4125 context: this.css.cs[fn], 4126 message: $.jPlayer.warningMsg.CSS_SELECTOR_COUNT + this.css.jq[fn].length + " found for " + fn + " method.", 4127 hint: $.jPlayer.warningHint.CSS_SELECTOR_COUNT 4128 }); 4129 } 4130 } else { 4131 this._warning( { 4132 type: $.jPlayer.warning.CSS_SELECTOR_METHOD, 4133 context: fn, 4134 message: $.jPlayer.warningMsg.CSS_SELECTOR_METHOD, 4135 hint: $.jPlayer.warningHint.CSS_SELECTOR_METHOD 4136 }); 4137 } 4138 } else { 4139 this._warning( { 4140 type: $.jPlayer.warning.CSS_SELECTOR_STRING, 4141 context: cssSel, 4142 message: $.jPlayer.warningMsg.CSS_SELECTOR_STRING, 4143 hint: $.jPlayer.warningHint.CSS_SELECTOR_STRING 4144 }); 4145 } 4146 }, 4147 duration: function(e) { 4148 if(this.options.toggleDuration) { 4149 if(this.options.captureDuration) { 4150 e.stopPropagation(); 4151 } 4152 this._setOption("remainingDuration", !this.options.remainingDuration); 4153 } 4154 }, 4155 seekBar: function(e) { // Handles clicks on the seekBar 4156 if(this.css.jq.seekBar.length) { 4157 // Using $(e.currentTarget) to enable multiple seek bars 4158 var $bar = $(e.currentTarget), 4159 offset = $bar.offset(), 4160 x = e.pageX - offset.left, 4161 w = $bar.width(), 4162 p = 100 * x / w; 4163 this.playHead(p); 4164 } 4165 }, 4166 playbackRate: function(pbr) { 4167 this._setOption("playbackRate", pbr); 4168 }, 4169 playbackRateBar: function(e) { // Handles clicks on the playbackRateBar 4170 if(this.css.jq.playbackRateBar.length) { 4171 // Using $(e.currentTarget) to enable multiple playbackRate bars 4172 var $bar = $(e.currentTarget), 4173 offset = $bar.offset(), 4174 x = e.pageX - offset.left, 4175 w = $bar.width(), 4176 y = $bar.height() - e.pageY + offset.top, 4177 h = $bar.height(), 4178 ratio, pbr; 4179 if(this.options.verticalPlaybackRate) { 4180 ratio = y/h; 4181 } else { 4182 ratio = x/w; 4183 } 4184 pbr = ratio * (this.options.maxPlaybackRate - this.options.minPlaybackRate) + this.options.minPlaybackRate; 4185 this.playbackRate(pbr); 4186 } 4187 }, 4188 _updatePlaybackRate: function() { 4189 var pbr = this.options.playbackRate, 4190 ratio = (pbr - this.options.minPlaybackRate) / (this.options.maxPlaybackRate - this.options.minPlaybackRate); 4191 if(this.status.playbackRateEnabled) { 4192 if(this.css.jq.playbackRateBar.length) { 4193 this.css.jq.playbackRateBar.show(); 4194 } 4195 if(this.css.jq.playbackRateBarValue.length) { 4196 this.css.jq.playbackRateBarValue.show(); 4197 this.css.jq.playbackRateBarValue[this.options.verticalPlaybackRate ? "height" : "width"]((ratio*100)+"%"); 4198 } 4199 } else { 4200 if(this.css.jq.playbackRateBar.length) { 4201 this.css.jq.playbackRateBar.hide(); 4202 } 4203 if(this.css.jq.playbackRateBarValue.length) { 4204 this.css.jq.playbackRateBarValue.hide(); 4205 } 4206 } 4207 }, 4208 repeat: function(event) { // Handle clicks on the repeat button 4209 var guiAction = typeof event === "object"; // Flags GUI click events so we know this was not a direct command, but an action taken by the user on the GUI. 4210 if(guiAction && this.options.useStateClassSkin && this.options.loop) { 4211 this._loop(false); 4212 } else { 4213 this._loop(true); 4214 } 4215 }, 4216 repeatOff: function() { // Handle clicks on the repeatOff button 4217 this._loop(false); 4218 }, 4219 _loop: function(loop) { 4220 if(this.options.loop !== loop) { 4221 this.options.loop = loop; 4222 this._updateButtons(); 4223 this._trigger($.jPlayer.event.repeat); 4224 } 4225 }, 4226 4227 // Options code adapted from ui.widget.js (1.8.7). Made changes so the key can use dot notation. To match previous getData solution in jPlayer 1. 4228 option: function(key, value) { 4229 var options = key; 4230 4231 // Enables use: options(). Returns a copy of options object 4232 if ( arguments.length === 0 ) { 4233 return $.extend( true, {}, this.options ); 4234 } 4235 4236 if(typeof key === "string") { 4237 var keys = key.split("."); 4238 4239 // Enables use: options("someOption") Returns a copy of the option. Supports dot notation. 4240 if(value === undefined) { 4241 4242 var opt = $.extend(true, {}, this.options); 4243 for(var i = 0; i < keys.length; i++) { 4244 if(opt[keys[i]] !== undefined) { 4245 opt = opt[keys[i]]; 4246 } else { 4247 this._warning( { 4248 type: $.jPlayer.warning.OPTION_KEY, 4249 context: key, 4250 message: $.jPlayer.warningMsg.OPTION_KEY, 4251 hint: $.jPlayer.warningHint.OPTION_KEY 4252 }); 4253 return undefined; 4254 } 4255 } 4256 return opt; 4257 } 4258 4259 // Enables use: options("someOptionObject", someObject}). Creates: {someOptionObject:someObject} 4260 // Enables use: options("someOption", someValue). Creates: {someOption:someValue} 4261 // Enables use: options("someOptionObject.someOption", someValue). Creates: {someOptionObject:{someOption:someValue}} 4262 4263 options = {}; 4264 var opts = options; 4265 4266 for(var j = 0; j < keys.length; j++) { 4267 if(j < keys.length - 1) { 4268 opts[keys[j]] = {}; 4269 opts = opts[keys[j]]; 4270 } else { 4271 opts[keys[j]] = value; 4272 } 4273 } 4274 } 4275 4276 // Otherwise enables use: options(optionObject). Uses original object (the key) 4277 4278 this._setOptions(options); 4279 4280 return this; 4281 }, 4282 _setOptions: function(options) { 4283 var self = this; 4284 $.each(options, function(key, value) { // This supports the 2 level depth that the options of jPlayer has. Would review if we ever need more depth. 4285 self._setOption(key, value); 4286 }); 4287 4288 return this; 4289 }, 4290 _setOption: function(key, value) { 4291 var self = this; 4292 4293 // The ability to set options is limited at this time. 4294 4295 switch(key) { 4296 case "volume" : 4297 this.volume(value); 4298 break; 4299 case "muted" : 4300 this._muted(value); 4301 break; 4302 case "globalVolume" : 4303 this.options[key] = value; 4304 break; 4305 case "cssSelectorAncestor" : 4306 this._cssSelectorAncestor(value); // Set and refresh all associations for the new ancestor. 4307 break; 4308 case "cssSelector" : 4309 $.each(value, function(fn, cssSel) { 4310 self._cssSelector(fn, cssSel); // NB: The option is set inside this function, after further validity checks. 4311 }); 4312 break; 4313 case "playbackRate" : 4314 this.options[key] = value = this._limitValue(value, this.options.minPlaybackRate, this.options.maxPlaybackRate); 4315 if(this.html.used) { 4316 this._html_setProperty('playbackRate', value); 4317 } 4318 this._updatePlaybackRate(); 4319 break; 4320 case "defaultPlaybackRate" : 4321 this.options[key] = value = this._limitValue(value, this.options.minPlaybackRate, this.options.maxPlaybackRate); 4322 if(this.html.used) { 4323 this._html_setProperty('defaultPlaybackRate', value); 4324 } 4325 this._updatePlaybackRate(); 4326 break; 4327 case "minPlaybackRate" : 4328 this.options[key] = value = this._limitValue(value, 0.1, this.options.maxPlaybackRate - 0.1); 4329 this._updatePlaybackRate(); 4330 break; 4331 case "maxPlaybackRate" : 4332 this.options[key] = value = this._limitValue(value, this.options.minPlaybackRate + 0.1, 16); 4333 this._updatePlaybackRate(); 4334 break; 4335 case "fullScreen" : 4336 if(this.options[key] !== value) { // if changed 4337 var wkv = $.jPlayer.nativeFeatures.fullscreen.used.webkitVideo; 4338 if(!wkv || wkv && !this.status.waitForPlay) { 4339 if(!wkv) { // No sensible way to unset option on these devices. 4340 this.options[key] = value; 4341 } 4342 if(value) { 4343 this._requestFullscreen(); 4344 } else { 4345 this._exitFullscreen(); 4346 } 4347 if(!wkv) { 4348 this._setOption("fullWindow", value); 4349 } 4350 } 4351 } 4352 break; 4353 case "fullWindow" : 4354 if(this.options[key] !== value) { // if changed 4355 this._removeUiClass(); 4356 this.options[key] = value; 4357 this._refreshSize(); 4358 } 4359 break; 4360 case "size" : 4361 if(!this.options.fullWindow && this.options[key].cssClass !== value.cssClass) { 4362 this._removeUiClass(); 4363 } 4364 this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed. 4365 this._refreshSize(); 4366 break; 4367 case "sizeFull" : 4368 if(this.options.fullWindow && this.options[key].cssClass !== value.cssClass) { 4369 this._removeUiClass(); 4370 } 4371 this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed. 4372 this._refreshSize(); 4373 break; 4374 case "autohide" : 4375 this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed. 4376 this._updateAutohide(); 4377 break; 4378 case "loop" : 4379 this._loop(value); 4380 break; 4381 case "remainingDuration" : 4382 this.options[key] = value; 4383 this._updateInterface(); 4384 break; 4385 case "toggleDuration" : 4386 this.options[key] = value; 4387 break; 4388 case "nativeVideoControls" : 4389 this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed. 4390 this.status.nativeVideoControls = this._uaBlocklist(this.options.nativeVideoControls); 4391 this._restrictNativeVideoControls(); 4392 this._updateNativeVideoControls(); 4393 break; 4394 case "noFullWindow" : 4395 this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed. 4396 this.status.nativeVideoControls = this._uaBlocklist(this.options.nativeVideoControls); // Need to check again as noFullWindow can depend on this flag and the restrict() can override it. 4397 this.status.noFullWindow = this._uaBlocklist(this.options.noFullWindow); 4398 this._restrictNativeVideoControls(); 4399 this._updateButtons(); 4400 break; 4401 case "noVolume" : 4402 this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed. 4403 this.status.noVolume = this._uaBlocklist(this.options.noVolume); 4404 this._updateVolume(); 4405 this._updateMute(); 4406 break; 4407 case "emulateHtml" : 4408 if(this.options[key] !== value) { // To avoid multiple event handlers being created, if true already. 4409 this.options[key] = value; 4410 if(value) { 4411 this._emulateHtmlBridge(); 4412 } else { 4413 this._destroyHtmlBridge(); 4414 } 4415 } 4416 break; 4417 case "timeFormat" : 4418 this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed. 4419 break; 4420 case "keyEnabled" : 4421 this.options[key] = value; 4422 if(!value && this === $.jPlayer.focus) { 4423 $.jPlayer.focus = null; 4424 } 4425 break; 4426 case "keyBindings" : 4427 this.options[key] = $.extend(true, {}, this.options[key], value); // store a merged DEEP copy of it, incase not all properties changed. 4428 break; 4429 case "audioFullScreen" : 4430 this.options[key] = value; 4431 break; 4432 case "autoBlur" : 4433 this.options[key] = value; 4434 break; 4435 } 4436 4437 return this; 4438 }, 4439 // End of: (Options code adapted from ui.widget.js) 4440 4441 _refreshSize: function() { 4442 this._setSize(); // update status and jPlayer element size 4443 this._addUiClass(); // update the ui class 4444 this._updateSize(); // update internal sizes 4445 this._updateButtons(); 4446 this._updateAutohide(); 4447 this._trigger($.jPlayer.event.resize); 4448 }, 4449 _setSize: function() { 4450 // Determine the current size from the options 4451 if(this.options.fullWindow) { 4452 this.status.width = this.options.sizeFull.width; 4453 this.status.height = this.options.sizeFull.height; 4454 this.status.cssClass = this.options.sizeFull.cssClass; 4455 } else { 4456 this.status.width = this.options.size.width; 4457 this.status.height = this.options.size.height; 4458 this.status.cssClass = this.options.size.cssClass; 4459 } 4460 4461 // Set the size of the jPlayer area. 4462 this.element.css({'width': this.status.width, 'height': this.status.height}); 4463 }, 4464 _addUiClass: function() { 4465 if(this.ancestorJq.length) { 4466 this.ancestorJq.addClass(this.status.cssClass); 4467 } 4468 }, 4469 _removeUiClass: function() { 4470 if(this.ancestorJq.length) { 4471 this.ancestorJq.removeClass(this.status.cssClass); 4472 } 4473 }, 4474 _updateSize: function() { 4475 // The poster uses show/hide so can simply resize it. 4476 this.internal.poster.jq.css({'width': this.status.width, 'height': this.status.height}); 4477 4478 // Video html or flash resized if necessary at this time, or if native video controls being used. 4479 if(!this.status.waitForPlay && this.html.active && this.status.video || this.html.video.available && this.html.used && this.status.nativeVideoControls) { 4480 this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height}); 4481 } 4482 else if(!this.status.waitForPlay && this.flash.active && this.status.video) { 4483 this.internal.flash.jq.css({'width': this.status.width, 'height': this.status.height}); 4484 } 4485 }, 4486 _updateAutohide: function() { 4487 var self = this, 4488 event = "mousemove.jPlayer", 4489 namespace = ".jPlayerAutohide", 4490 eventType = event + namespace, 4491 handler = function(event) { 4492 var moved = false, 4493 deltaX, deltaY; 4494 if(typeof self.internal.mouse !== "undefined") { 4495 //get the change from last position to this position 4496 deltaX = self.internal.mouse.x - event.pageX; 4497 deltaY = self.internal.mouse.y - event.pageY; 4498 moved = (Math.floor(deltaX) > 0) || (Math.floor(deltaY)>0); 4499 } else { 4500 moved = true; 4501 } 4502 // store current position for next method execution 4503 self.internal.mouse = { 4504 x : event.pageX, 4505 y : event.pageY 4506 }; 4507 // if mouse has been actually moved, do the gui fadeIn/fadeOut 4508 if (moved) { 4509 self.css.jq.gui.fadeIn(self.options.autohide.fadeIn, function() { 4510 clearTimeout(self.internal.autohideId); 4511 self.internal.autohideId = setTimeout( function() { 4512 self.css.jq.gui.fadeOut(self.options.autohide.fadeOut); 4513 }, self.options.autohide.hold); 4514 }); 4515 } 4516 }; 4517 4518 if(this.css.jq.gui.length) { 4519 4520 // End animations first so that its callback is executed now. 4521 // Otherwise an in progress fadeIn animation still has the callback to fadeOut again. 4522 this.css.jq.gui.stop(true, true); 4523 4524 // Removes the fadeOut operation from the fadeIn callback. 4525 clearTimeout(this.internal.autohideId); 4526 // undefine mouse 4527 delete this.internal.mouse; 4528 4529 this.element.unbind(namespace); 4530 this.css.jq.gui.unbind(namespace); 4531 4532 if(!this.status.nativeVideoControls) { 4533 if(this.options.fullWindow && this.options.autohide.full || !this.options.fullWindow && this.options.autohide.restored) { 4534 this.element.bind(eventType, handler); 4535 this.css.jq.gui.bind(eventType, handler); 4536 this.css.jq.gui.hide(); 4537 } else { 4538 this.css.jq.gui.show(); 4539 } 4540 } else { 4541 this.css.jq.gui.hide(); 4542 } 4543 } 4544 }, 4545 fullScreen: function(event) { 4546 var guiAction = typeof event === "object"; // Flags GUI click events so we know this was not a direct command, but an action taken by the user on the GUI. 4547 if(guiAction && this.options.useStateClassSkin && this.options.fullScreen) { 4548 this._setOption("fullScreen", false); 4549 } else { 4550 this._setOption("fullScreen", true); 4551 } 4552 }, 4553 restoreScreen: function() { 4554 this._setOption("fullScreen", false); 4555 }, 4556 _fullscreenAddEventListeners: function() { 4557 var self = this, 4558 fs = $.jPlayer.nativeFeatures.fullscreen; 4559 4560 if(fs.api.fullscreenEnabled) { 4561 if(fs.event.fullscreenchange) { 4562 // Create the event handler function and store it for removal. 4563 if(typeof this.internal.fullscreenchangeHandler !== 'function') { 4564 this.internal.fullscreenchangeHandler = function() { 4565 self._fullscreenchange(); 4566 }; 4567 } 4568 document.addEventListener(fs.event.fullscreenchange, this.internal.fullscreenchangeHandler, false); 4569 } 4570 // No point creating handler for fullscreenerror. 4571 // Either logic avoids fullscreen occurring (w3c/moz), or their is no event on the browser (webkit). 4572 } 4573 }, 4574 _fullscreenRemoveEventListeners: function() { 4575 var fs = $.jPlayer.nativeFeatures.fullscreen; 4576 if(this.internal.fullscreenchangeHandler) { 4577 document.removeEventListener(fs.event.fullscreenchange, this.internal.fullscreenchangeHandler, false); 4578 } 4579 }, 4580 _fullscreenchange: function() { 4581 // If nothing is fullscreen, then we cannot be in fullscreen mode. 4582 if(this.options.fullScreen && !$.jPlayer.nativeFeatures.fullscreen.api.fullscreenElement()) { 4583 this._setOption("fullScreen", false); 4584 } 4585 }, 4586 _requestFullscreen: function() { 4587 // Either the container or the jPlayer div 4588 var e = this.ancestorJq.length ? this.ancestorJq[0] : this.element[0], 4589 fs = $.jPlayer.nativeFeatures.fullscreen; 4590 4591 // This method needs the video element. For iOS and Android. 4592 if(fs.used.webkitVideo) { 4593 e = this.htmlElement.video; 4594 } 4595 4596 if(fs.api.fullscreenEnabled) { 4597 fs.api.requestFullscreen(e); 4598 } 4599 }, 4600 _exitFullscreen: function() { 4601 4602 var fs = $.jPlayer.nativeFeatures.fullscreen, 4603 e; 4604 4605 // This method needs the video element. For iOS and Android. 4606 if(fs.used.webkitVideo) { 4607 e = this.htmlElement.video; 4608 } 4609 4610 if(fs.api.fullscreenEnabled) { 4611 fs.api.exitFullscreen(e); 4612 } 4613 }, 4614 _html_initMedia: function(media) { 4615 // Remove any existing track elements 4616 var $media = $(this.htmlElement.media).empty(); 4617 4618 // Create any track elements given with the media, as an Array of track Objects. 4619 $.each(media.track || [], function(i,v) { 4620 var track = document.createElement('track'); 4621 track.setAttribute("kind", v.kind ? v.kind : ""); 4622 track.setAttribute("src", v.src ? v.src : ""); 4623 track.setAttribute("srclang", v.srclang ? v.srclang : ""); 4624 track.setAttribute("label", v.label ? v.label : ""); 4625 if(v.def) { 4626 track.setAttribute("default", v.def); 4627 } 4628 $media.append(track); 4629 }); 4630 4631 this.htmlElement.media.src = this.status.src; 4632 4633 if(this.options.preload !== 'none') { 4634 this._html_load(); // See function for comments 4635 } 4636 this._trigger($.jPlayer.event.timeupdate); // The flash generates this event for its solution. 4637 }, 4638 _html_setFormat: function(media) { 4639 var self = this; 4640 // Always finds a format due to checks in setMedia() 4641 $.each(this.formats, function(priority, format) { 4642 if(self.html.support[format] && media[format]) { 4643 self.status.src = media[format]; 4644 self.status.format[format] = true; 4645 self.status.formatType = format; 4646 return false; 4647 } 4648 }); 4649 }, 4650 _html_setAudio: function(media) { 4651 this._html_setFormat(media); 4652 this.htmlElement.media = this.htmlElement.audio; 4653 this._html_initMedia(media); 4654 }, 4655 _html_setVideo: function(media) { 4656 this._html_setFormat(media); 4657 if(this.status.nativeVideoControls) { 4658 this.htmlElement.video.poster = this._validString(media.poster) ? media.poster : ""; 4659 } 4660 this.htmlElement.media = this.htmlElement.video; 4661 this._html_initMedia(media); 4662 }, 4663 _html_resetMedia: function() { 4664 if(this.htmlElement.media) { 4665 if(this.htmlElement.media.id === this.internal.video.id && !this.status.nativeVideoControls) { 4666 this.internal.video.jq.css({'width':'0px', 'height':'0px'}); 4667 } 4668 this.htmlElement.media.pause(); 4669 } 4670 }, 4671 _html_clearMedia: function() { 4672 if(this.htmlElement.media) { 4673 this.htmlElement.media.src = "about:blank"; 4674 // The following load() is only required for Firefox 3.6 (PowerMacs). 4675 // Recent HTMl5 browsers only require the src change. Due to changes in W3C spec and load() effect. 4676 this.htmlElement.media.load(); // Stops an old, "in progress" download from continuing the download. Triggers the loadstart, error and emptied events, due to the empty src. Also an abort event if a download was in progress. 4677 } 4678 }, 4679 _html_load: function() { 4680 // This function remains to allow the early HTML5 browsers to work, such as Firefox 3.6 4681 // A change in the W3C spec for the media.load() command means that this is no longer necessary. 4682 // This command should be removed and actually causes minor undesirable effects on some browsers. Such as loading the whole file and not only the metadata. 4683 if(this.status.waitForLoad) { 4684 this.status.waitForLoad = false; 4685 this.htmlElement.media.load(); 4686 } 4687 clearTimeout(this.internal.htmlDlyCmdId); 4688 }, 4689 _html_play: function(time) { 4690 var self = this, 4691 media = this.htmlElement.media; 4692 4693 this.androidFix.pause = false; // Cancel the pause fix. 4694 4695 this._html_load(); // Loads if required and clears any delayed commands. 4696 4697 // Setup the Android Fix. 4698 if(this.androidFix.setMedia) { 4699 this.androidFix.play = true; 4700 this.androidFix.time = time; 4701 4702 } else if(!isNaN(time)) { 4703 4704 // Attempt to play it, since iOS has been ignoring commands 4705 if(this.internal.cmdsIgnored) { 4706 media.play(); 4707 } 4708 4709 try { 4710 // !media.seekable is for old HTML5 browsers, like Firefox 3.6. 4711 // Checking seekable.length is important for iOS6 to work with setMedia().play(time) 4712 if(!media.seekable || typeof media.seekable === "object" && media.seekable.length > 0) { 4713 media.currentTime = time; 4714 media.play(); 4715 } else { 4716 throw 1; 4717 } 4718 } catch(err) { 4719 this.internal.htmlDlyCmdId = setTimeout(function() { 4720 self.play(time); 4721 }, 250); 4722 return; // Cancel execution and wait for the delayed command. 4723 } 4724 } else { 4725 media.play(); 4726 } 4727 this._html_checkWaitForPlay(); 4728 }, 4729 _html_pause: function(time) { 4730 var self = this, 4731 media = this.htmlElement.media; 4732 4733 this.androidFix.play = false; // Cancel the play fix. 4734 4735 if(time > 0) { // We do not want the stop() command, which does pause(0), causing a load operation. 4736 this._html_load(); // Loads if required and clears any delayed commands. 4737 } else { 4738 clearTimeout(this.internal.htmlDlyCmdId); 4739 } 4740 4741 // Order of these commands is important for Safari (Win) and IE9. Pause then change currentTime. 4742 media.pause(); 4743 4744 // Setup the Android Fix. 4745 if(this.androidFix.setMedia) { 4746 this.androidFix.pause = true; 4747 this.androidFix.time = time; 4748 4749 } else if(!isNaN(time)) { 4750 try { 4751 if(!media.seekable || typeof media.seekable === "object" && media.seekable.length > 0) { 4752 media.currentTime = time; 4753 } else { 4754 throw 1; 4755 } 4756 } catch(err) { 4757 this.internal.htmlDlyCmdId = setTimeout(function() { 4758 self.pause(time); 4759 }, 250); 4760 return; // Cancel execution and wait for the delayed command. 4761 } 4762 } 4763 if(time > 0) { // Avoids a setMedia() followed by stop() or pause(0) hiding the video play button. 4764 this._html_checkWaitForPlay(); 4765 } 4766 }, 4767 _html_playHead: function(percent) { 4768 var self = this, 4769 media = this.htmlElement.media; 4770 4771 this._html_load(); // Loads if required and clears any delayed commands. 4772 4773 // This playHead() method needs a refactor to apply the android fix. 4774 4775 try { 4776 if(typeof media.seekable === "object" && media.seekable.length > 0) { 4777 media.currentTime = percent * media.seekable.end(media.seekable.length-1) / 100; 4778 } else if(media.duration > 0 && !isNaN(media.duration)) { 4779 media.currentTime = percent * media.duration / 100; 4780 } else { 4781 throw "e"; 4782 } 4783 } catch(err) { 4784 this.internal.htmlDlyCmdId = setTimeout(function() { 4785 self.playHead(percent); 4786 }, 250); 4787 return; // Cancel execution and wait for the delayed command. 4788 } 4789 if(!this.status.waitForLoad) { 4790 this._html_checkWaitForPlay(); 4791 } 4792 }, 4793 _html_checkWaitForPlay: function() { 4794 if(this.status.waitForPlay) { 4795 this.status.waitForPlay = false; 4796 if(this.css.jq.videoPlay.length) { 4797 this.css.jq.videoPlay.hide(); 4798 } 4799 if(this.status.video) { 4800 this.internal.poster.jq.hide(); 4801 this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height}); 4802 } 4803 } 4804 }, 4805 _html_setProperty: function(property, value) { 4806 if(this.html.audio.available) { 4807 this.htmlElement.audio[property] = value; 4808 } 4809 if(this.html.video.available) { 4810 this.htmlElement.video[property] = value; 4811 } 4812 }, 4813 _aurora_setAudio: function(media) { 4814 var self = this; 4815 4816 // Always finds a format due to checks in setMedia() 4817 $.each(this.formats, function(priority, format) { 4818 if(self.aurora.support[format] && media[format]) { 4819 self.status.src = media[format]; 4820 self.status.format[format] = true; 4821 self.status.formatType = format; 4822 4823 return false; 4824 } 4825 }); 4826 4827 this.aurora.player = new AV.Player.fromURL(this.status.src); 4828 this._addAuroraEventListeners(this.aurora.player, this.aurora); 4829 4830 if(this.options.preload === 'auto') { 4831 this._aurora_load(); 4832 this.status.waitForLoad = false; 4833 } 4834 }, 4835 _aurora_resetMedia: function() { 4836 if (this.aurora.player) { 4837 this.aurora.player.stop(); 4838 } 4839 }, 4840 _aurora_clearMedia: function() { 4841 // Nothing to clear. 4842 }, 4843 _aurora_load: function() { 4844 if(this.status.waitForLoad) { 4845 this.status.waitForLoad = false; 4846 this.aurora.player.preload(); 4847 } 4848 }, 4849 _aurora_play: function(time) { 4850 if (!this.status.waitForLoad) { 4851 if (!isNaN(time)) { 4852 this.aurora.player.seek(time); 4853 } 4854 } 4855 if (!this.aurora.player.playing) { 4856 this.aurora.player.play(); 4857 } 4858 this.status.waitForLoad = false; 4859 this._aurora_checkWaitForPlay(); 4860 4861 // No event from the player, update UI now. 4862 this._updateButtons(true); 4863 this._trigger($.jPlayer.event.play); 4864 }, 4865 _aurora_pause: function(time) { 4866 if (!isNaN(time)) { 4867 this.aurora.player.seek(time * 1000); 4868 } 4869 this.aurora.player.pause(); 4870 4871 if(time > 0) { // Avoids a setMedia() followed by stop() or pause(0) hiding the video play button. 4872 this._aurora_checkWaitForPlay(); 4873 } 4874 4875 // No event from the player, update UI now. 4876 this._updateButtons(false); 4877 this._trigger($.jPlayer.event.pause); 4878 }, 4879 _aurora_playHead: function(percent) { 4880 if(this.aurora.player.duration > 0) { 4881 // The seek() sould be in milliseconds, but the only codec that works with seek (aac.js) uses seconds. 4882 this.aurora.player.seek(percent * this.aurora.player.duration / 100); // Using seconds 4883 } 4884 4885 if(!this.status.waitForLoad) { 4886 this._aurora_checkWaitForPlay(); 4887 } 4888 }, 4889 _aurora_checkWaitForPlay: function() { 4890 if(this.status.waitForPlay) { 4891 this.status.waitForPlay = false; 4892 } 4893 }, 4894 _aurora_volume: function(v) { 4895 this.aurora.player.volume = v * 100; 4896 }, 4897 _aurora_mute: function(m) { 4898 if (m) { 4899 this.aurora.properties.lastvolume = this.aurora.player.volume; 4900 this.aurora.player.volume = 0; 4901 } else { 4902 this.aurora.player.volume = this.aurora.properties.lastvolume; 4903 } 4904 this.aurora.properties.muted = m; 4905 }, 4906 _flash_setAudio: function(media) { 4907 var self = this; 4908 try { 4909 // Always finds a format due to checks in setMedia() 4910 $.each(this.formats, function(priority, format) { 4911 if(self.flash.support[format] && media[format]) { 4912 switch (format) { 4913 case "m4a" : 4914 case "fla" : 4915 self._getMovie().fl_setAudio_m4a(media[format]); 4916 break; 4917 case "mp3" : 4918 self._getMovie().fl_setAudio_mp3(media[format]); 4919 break; 4920 case "rtmpa": 4921 self._getMovie().fl_setAudio_rtmp(media[format]); 4922 break; 4923 } 4924 self.status.src = media[format]; 4925 self.status.format[format] = true; 4926 self.status.formatType = format; 4927 return false; 4928 } 4929 }); 4930 4931 if(this.options.preload === 'auto') { 4932 this._flash_load(); 4933 this.status.waitForLoad = false; 4934 } 4935 } catch(err) { this._flashError(err); } 4936 }, 4937 _flash_setVideo: function(media) { 4938 var self = this; 4939 try { 4940 // Always finds a format due to checks in setMedia() 4941 $.each(this.formats, function(priority, format) { 4942 if(self.flash.support[format] && media[format]) { 4943 switch (format) { 4944 case "m4v" : 4945 case "flv" : 4946 self._getMovie().fl_setVideo_m4v(media[format]); 4947 break; 4948 case "rtmpv": 4949 self._getMovie().fl_setVideo_rtmp(media[format]); 4950 break; 4951 } 4952 self.status.src = media[format]; 4953 self.status.format[format] = true; 4954 self.status.formatType = format; 4955 return false; 4956 } 4957 }); 4958 4959 if(this.options.preload === 'auto') { 4960 this._flash_load(); 4961 this.status.waitForLoad = false; 4962 } 4963 } catch(err) { this._flashError(err); } 4964 }, 4965 _flash_resetMedia: function() { 4966 this.internal.flash.jq.css({'width':'0px', 'height':'0px'}); // Must do via CSS as setting attr() to zero causes a jQuery error in IE. 4967 this._flash_pause(NaN); 4968 }, 4969 _flash_clearMedia: function() { 4970 try { 4971 this._getMovie().fl_clearMedia(); 4972 } catch(err) { this._flashError(err); } 4973 }, 4974 _flash_load: function() { 4975 try { 4976 this._getMovie().fl_load(); 4977 } catch(err) { this._flashError(err); } 4978 this.status.waitForLoad = false; 4979 }, 4980 _flash_play: function(time) { 4981 try { 4982 this._getMovie().fl_play(time); 4983 } catch(err) { this._flashError(err); } 4984 this.status.waitForLoad = false; 4985 this._flash_checkWaitForPlay(); 4986 }, 4987 _flash_pause: function(time) { 4988 try { 4989 this._getMovie().fl_pause(time); 4990 } catch(err) { this._flashError(err); } 4991 if(time > 0) { // Avoids a setMedia() followed by stop() or pause(0) hiding the video play button. 4992 this.status.waitForLoad = false; 4993 this._flash_checkWaitForPlay(); 4994 } 4995 }, 4996 _flash_playHead: function(p) { 4997 try { 4998 this._getMovie().fl_play_head(p); 4999 } catch(err) { this._flashError(err); } 5000 if(!this.status.waitForLoad) { 5001 this._flash_checkWaitForPlay(); 5002 } 5003 }, 5004 _flash_checkWaitForPlay: function() { 5005 if(this.status.waitForPlay) { 5006 this.status.waitForPlay = false; 5007 if(this.css.jq.videoPlay.length) { 5008 this.css.jq.videoPlay.hide(); 5009 } 5010 if(this.status.video) { 5011 this.internal.poster.jq.hide(); 5012 this.internal.flash.jq.css({'width': this.status.width, 'height': this.status.height}); 5013 } 5014 } 5015 }, 5016 _flash_volume: function(v) { 5017 try { 5018 this._getMovie().fl_volume(v); 5019 } catch(err) { this._flashError(err); } 5020 }, 5021 _flash_mute: function(m) { 5022 try { 5023 this._getMovie().fl_mute(m); 5024 } catch(err) { this._flashError(err); } 5025 }, 5026 _getMovie: function() { 5027 return document[this.internal.flash.id]; 5028 }, 5029 _getFlashPluginVersion: function() { 5030 5031 // _getFlashPluginVersion() code influenced by: 5032 // - FlashReplace 1.01: http://code.google.com/p/flashreplace/ 5033 // - SWFObject 2.2: http://code.google.com/p/swfobject/ 5034 5035 var version = 0, 5036 flash; 5037 if(window.ActiveXObject) { 5038 try { 5039 flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); 5040 if (flash) { // flash will return null when ActiveX is disabled 5041 var v = flash.GetVariable("$version"); 5042 if(v) { 5043 v = v.split(" ")[1].split(","); 5044 version = parseInt(v[0], 10) + "." + parseInt(v[1], 10); 5045 } 5046 } 5047 } catch(e) {} 5048 } 5049 else if(navigator.plugins && navigator.mimeTypes.length > 0) { 5050 flash = navigator.plugins["Shockwave Flash"]; 5051 if(flash) { 5052 version = navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/, "$1"); 5053 } 5054 } 5055 return version * 1; // Converts to a number 5056 }, 5057 _checkForFlash: function (version) { 5058 var flashOk = false; 5059 if(this._getFlashPluginVersion() >= version) { 5060 flashOk = true; 5061 } 5062 return flashOk; 5063 }, 5064 _validString: function(url) { 5065 return (url && typeof url === "string"); // Empty strings return false 5066 }, 5067 _limitValue: function(value, min, max) { 5068 return (value < min) ? min : ((value > max) ? max : value); 5069 }, 5070 _urlNotSetError: function(context) { 5071 this._error( { 5072 type: $.jPlayer.error.URL_NOT_SET, 5073 context: context, 5074 message: $.jPlayer.errorMsg.URL_NOT_SET, 5075 hint: $.jPlayer.errorHint.URL_NOT_SET 5076 }); 5077 }, 5078 _flashError: function(error) { 5079 var errorType; 5080 if(!this.internal.ready) { 5081 errorType = "FLASH"; 5082 } else { 5083 errorType = "FLASH_DISABLED"; 5084 } 5085 this._error( { 5086 type: $.jPlayer.error[errorType], 5087 context: this.internal.flash.swf, 5088 message: $.jPlayer.errorMsg[errorType] + error.message, 5089 hint: $.jPlayer.errorHint[errorType] 5090 }); 5091 // Allow the audio player to recover if display:none and then shown again, or with position:fixed on Firefox. 5092 // This really only affects audio in a media player, as an audio player could easily move the jPlayer element away from such issues. 5093 this.internal.flash.jq.css({'width':'1px', 'height':'1px'}); 5094 }, 5095 _error: function(error) { 5096 this._trigger($.jPlayer.event.error, error); 5097 if(this.options.errorAlerts) { 5098 this._alert("Error!" + (error.message ? "\n" + error.message : "") + (error.hint ? "\n" + error.hint : "") + "\nContext: " + error.context); 5099 } 5100 }, 5101 _warning: function(warning) { 5102 this._trigger($.jPlayer.event.warning, undefined, warning); 5103 if(this.options.warningAlerts) { 5104 this._alert("Warning!" + (warning.message ? "\n" + warning.message : "") + (warning.hint ? "\n" + warning.hint : "") + "\nContext: " + warning.context); 5105 } 5106 }, 5107 _alert: function(message) { 5108 var msg = "jPlayer " + this.version.script + " : id='" + this.internal.self.id +"' : " + message; 5109 if(!this.options.consoleAlerts) { 5110 alert(msg); 5111 } else if(window.console && window.console.log) { 5112 window.console.log(msg); 5113 } 5114 }, 5115 _emulateHtmlBridge: function() { 5116 var self = this; 5117 5118 // Emulate methods on jPlayer's DOM element. 5119 $.each( $.jPlayer.emulateMethods.split(/\s+/g), function(i, name) { 5120 self.internal.domNode[name] = function(arg) { 5121 self[name](arg); 5122 }; 5123 5124 }); 5125 5126 // Bubble jPlayer events to its DOM element. 5127 $.each($.jPlayer.event, function(eventName,eventType) { 5128 var nativeEvent = true; 5129 $.each( $.jPlayer.reservedEvent.split(/\s+/g), function(i, name) { 5130 if(name === eventName) { 5131 nativeEvent = false; 5132 return false; 5133 } 5134 }); 5135 if(nativeEvent) { 5136 self.element.bind(eventType + ".jPlayer.jPlayerHtml", function() { // With .jPlayer & .jPlayerHtml namespaces. 5137 self._emulateHtmlUpdate(); 5138 var domEvent = document.createEvent("Event"); 5139 domEvent.initEvent(eventName, false, true); 5140 self.internal.domNode.dispatchEvent(domEvent); 5141 }); 5142 } 5143 // The error event would require a special case 5144 }); 5145 5146 // IE9 has a readyState property on all elements. The document should have it, but all (except media) elements inherit it in IE9. This conflicts with Popcorn, which polls the readyState. 5147 }, 5148 _emulateHtmlUpdate: function() { 5149 var self = this; 5150 5151 $.each( $.jPlayer.emulateStatus.split(/\s+/g), function(i, name) { 5152 self.internal.domNode[name] = self.status[name]; 5153 }); 5154 $.each( $.jPlayer.emulateOptions.split(/\s+/g), function(i, name) { 5155 self.internal.domNode[name] = self.options[name]; 5156 }); 5157 }, 5158 _destroyHtmlBridge: function() { 5159 var self = this; 5160 5161 // Bridge event handlers are also removed by destroy() through .jPlayer namespace. 5162 this.element.unbind(".jPlayerHtml"); // Remove all event handlers created by the jPlayer bridge. So you can change the emulateHtml option. 5163 5164 // Remove the methods and properties 5165 var emulated = $.jPlayer.emulateMethods + " " + $.jPlayer.emulateStatus + " " + $.jPlayer.emulateOptions; 5166 $.each( emulated.split(/\s+/g), function(i, name) { 5167 delete self.internal.domNode[name]; 5168 }); 5169 } 5170 }; 5171 5172 $.jPlayer.error = { 5173 FLASH: "e_flash", 5174 FLASH_DISABLED: "e_flash_disabled", 5175 NO_SOLUTION: "e_no_solution", 5176 NO_SUPPORT: "e_no_support", 5177 URL: "e_url", 5178 URL_NOT_SET: "e_url_not_set", 5179 VERSION: "e_version" 5180 }; 5181 5182 $.jPlayer.errorMsg = { 5183 FLASH: "jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ", // Used in: _flashError() 5184 FLASH_DISABLED: "jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ", // Used in: _flashError() 5185 NO_SOLUTION: "No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.", // Used in: _init() 5186 NO_SUPPORT: "It is not possible to play any media format provided in setMedia() on this browser using your current options.", // Used in: setMedia() 5187 URL: "Media URL could not be loaded.", // Used in: jPlayerFlashEvent() and _addHtmlEventListeners() 5188 URL_NOT_SET: "Attempt to issue media playback commands, while no media url is set.", // Used in: load(), play(), pause(), stop() and playHead() 5189 VERSION: "jPlayer " + $.jPlayer.prototype.version.script + " needs Jplayer.swf version " + $.jPlayer.prototype.version.needFlash + " but found " // Used in: jPlayerReady() 5190 }; 5191 5192 $.jPlayer.errorHint = { 5193 FLASH: "Check your swfPath option and that Jplayer.swf is there.", 5194 FLASH_DISABLED: "Check that you have not display:none; the jPlayer entity or any ancestor.", 5195 NO_SOLUTION: "Review the jPlayer options: support and supplied.", 5196 NO_SUPPORT: "Video or audio formats defined in the supplied option are missing.", 5197 URL: "Check media URL is valid.", 5198 URL_NOT_SET: "Use setMedia() to set the media URL.", 5199 VERSION: "Update jPlayer files." 5200 }; 5201 5202 $.jPlayer.warning = { 5203 CSS_SELECTOR_COUNT: "e_css_selector_count", 5204 CSS_SELECTOR_METHOD: "e_css_selector_method", 5205 CSS_SELECTOR_STRING: "e_css_selector_string", 5206 OPTION_KEY: "e_option_key" 5207 }; 5208 5209 $.jPlayer.warningMsg = { 5210 CSS_SELECTOR_COUNT: "The number of css selectors found did not equal one: ", 5211 CSS_SELECTOR_METHOD: "The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.", 5212 CSS_SELECTOR_STRING: "The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.", 5213 OPTION_KEY: "The option requested in jPlayer('option') is undefined." 5214 }; 5215 5216 $.jPlayer.warningHint = { 5217 CSS_SELECTOR_COUNT: "Check your css selector and the ancestor.", 5218 CSS_SELECTOR_METHOD: "Check your method name.", 5219 CSS_SELECTOR_STRING: "Check your css selector is a string.", 5220 OPTION_KEY: "Check your option name." 5221 }; 5222}));
5223 5224 5225 5226 5227var playerHTML = "<div class='videoPlayerWrapper jplayerThemePlayer'><div class=\"jplayer jp-jplayer\"></div><div class=\"videoloading\"></div><div class=\"jp-play-btn large\"></div><div class=\"videoplayer\"><div class=\"videoplayer_inner\"><div class=\"times\"><span class=\"jp-current-time\"></span><span class=\"time-sep\">/</span><span class=\"jp-duration\"></span></div><div class=\"jp-play\"></div><div class=\"jp-pause\"></div><div class=\"jp-progress\"><div class=\"jp-seek-bar\"><div class=\"jp-play-bar\"></div><span class=\"handle\"></span></div></div><div class='volume med'></div><div class=\"jp-full-screen\"></div><div class=\"jp-restore-screen\"></div></div></div></div>"; 5228/*if(document.createStyleSheet) { 5229 document.createStyleSheet('/javascripts/jplayertheme/jplayer.css?v=1');U 5230} 5231else { 5232 5233 $("head").append("<link rel='stylesheet' href='/javascripts/jplayertheme/jplayer.css?v=1' />"); 5234}*/ 5235var css = "<style>#fulljPlayerVideo{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1000}.jplayerThemePlayer.videoPlayerWrapper{position:relative;background:#333;margin:0 auto;overflow:hidden}.jplayerThemePlayer.videoPlayerWrapper .jplayer{position:absolute;top:0;left:0;background:#000}.jplayerThemePlayer.videoPlayerWrapper .videoplayer{position:absolute;bottom:0;right:0;left:0;margin:0;background:#000;background:rgba(0,0,0,.5);-webkit-transition:all .5s;-moz-transition:all .5s;transition:all .5s}.jplayerThemePlayer.videoPlayerWrapper .videoplayer.hidden{-moz-transform:translateY(48px);-webkit-transform:translateY(48px);transform:translateY(48px)}.jplayerThemePlayer .videoplayer{margin-right:20px;margin-bottom:20px;padding-right:6px}.jplayerThemePlayer .jp-full-screen,.jplayerThemePlayer .jp-restore-screen{width:21px;height:19px;cursor:pointer;background:url(/javascripts/jplayertheme/full-screen-video.png?v=3);background-size:21px 19px;position:absolute;bottom:15px;right:43px}.jplayerThemePlayer .jp-restore-screen,.jplayerThemePlayer.jp-video-full .jp-full-screen{display:none}.jplayerThemePlayer.jp-video-full .jp-restore-screen{display:block}.jplayerThemePlayer .jp-restore-screen{background:url(/javascripts/jplayertheme/full-screen-video-close.png?v=3);background-size:21px 19px}.jplayerThemePlayer .videoplayer .videoplayer_inner{height:48px;padding:1px;position:relative}.jplayerThemePlayer .videoplayer .jp-pause,.jplayerThemePlayer .videoplayer .jp-play{float:left;width:25px;height:25px;cursor:pointer;background:url(/javascripts/jplayertheme/audio-player-slim-play.png?v=2);background-size:25px 25px;margin:10px 9px 0 11px}.jplayerThemePlayer .hq{position:absolute;top:11px;width:25px;height:17px;left:35px;cursor:pointer;background:url(/javascripts/jplayertheme/hq.png) 2px 0 no-repeat}.jplayerThemePlayer .hq.enabled{background:url(/javascripts/jplayertheme/hq.png) -21px 0 no-repeat}.jplayerThemePlayer .jp-play-btn.large{position:absolute;top:0;left:0;right:0;bottom:0;cursor:pointer;background:url(/javascripts/jplayertheme/play-large.png?v=1) 50% 50% no-repeat;background-size:105px 105px;box-shadow:inset 0 0 100px rgba(0,0,0,.5);-webkit-transition:all .5s;-moz-transition:all .5s;transition:all .5s;opacity:1}.jplayerThemePlayer .jp-play-btn.large.hidden{opacity:0}
5235.jplayerThemePlayer .videoplayer .jp-pause{background:url(/javascripts/jplayertheme/audio-player-slim-pause.png?v=2);background-size:25px 25px}.jplayerThemePlayer .videoplayer .jp-progress{position:absolute;bottom:19px;left:55px;height:11px;border:1px solid #fff;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.jplayerThemePlayer .volume{width:23px;height:20px;background:url(/javascripts/jplayertheme/volume.png?v=4) no-repeat;background-size:22px 62px;position:absolute;right:8px;bottom:16px;cursor:pointer}.jplayerThemePlayer .volume.low{background-position:0 0;background-size:22px 62px}.jplayerThemePlayer .volume.med{background-position:0 -21px;background-size:22px 62px}.jplayerThemePlayer .volume.high{background-position:0 -42px;background-size:22px 62px}.jplayerThemePlayer .videoplayer .jp-progress{right:160px}.jplayerThemePlayer .times{margin-right:0;position:absolute;bottom:16px;right:80px;color:#fff;font-size:11px;line-height:16px;font-family:arial,sans-serif}@media (max-width:600px){.jplayerThemePlayer .videoplayer .jp-progress{right:50px}.jplayerThemePlayer .times{display:none}}.jplayerThemePlayer .jp-seek-bar{height:100%;position:relative;width:0;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.jplayerThemePlayer .jp-play-bar{height:100%;width:0;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;position:relative;background:#ccc}.jplayerThemePlayer .jp-seek-bar .handle{width:17px;height:17px;background:#ccc;border:1px solid #fff;position:absolute;top:-4px;border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:10px;margin:0 -5px;left:0;cursor:pointer}div.jp-video-full.videoPlayerWrapper{width:480px;height:270px;position:static!important;position:relative}div.jp-video-full div.jplayer{top:0;left:0;position:fixed!important;position:relative;overflow:hidden}div.jp-video-full div.jp-gui{position:fixed!important;position:static;top:0;left:0;width:100%;height:100%;z-index:1001}div.jp-video-full div.jp-interface{position:absolute!important;position:relative;bottom:0;left:0}</style>"; 5236$('head').append(css); 5237var jplayerdragging=false; 5238 5239function makeVideo (obj,width,height,image,video,autostart,fullscreen,alt) { 5240 5241 var ext = video.split('.').pop(); 5242 5243 if (videoControlBar=="bottom"){ 5244 height=height+24; 5245 } 5246 if (fullscreen) { 5247 $("#"+obj+" .videoPlayerWrapper").css("width","100%").css("height","100%"); 5248 } else { 5249 $("#"+obj+" .videoPlayerWrapper").css("width",width+"px").css("height",height+"px"); 5250 } 5251 $("#"+obj+" .videoPlayerWrapper").hover(function(){ 5252 $(".videoplayer",$(this)).removeClass("hidden"); 5253 },function(){ 5254 if ($(".jplayer",$(this)).hasClass("playing")) { 5255 $(".videoplayer",$(this)).addClass("hidden"); 5256 } 5257 }); 5258 $(".jp-play-btn",$("#"+obj)).click(function(){ 5259 var playerid = $(this).parents(".jplayerInit").attr("id"); 5260 if ($("#"+playerid+" .jplayer").hasClass("playing")) { 5261 $("#"+playerid+" .jplayer").jPlayer("pause"); 5262 } else { 5263 $("#"+playerid+" .jplayer").jPlayer("play"); 5264 } 5265 5266 }); 5267 $(".volume",$("#"+obj)).click(function(){ 5268 var playerid = $(this).parents(".jplayerInit").attr("id"); 5269 if ($(this).hasClass("low")) { 5270 $("#"+playerid+" .jplayer").jPlayer("option","volume",0.5); 5271 $(this).removeClass("low").addClass("med"); 5272 jplayervolume = 0.5; 5273 } else if ($(this).hasClass("med")) { 5274 $("#"+playerid+" .jplayer").jPlayer("option","volume",1); 5275 $(this).removeClass("med").addClass("high"); 5276 jplayervolume = 1; 5277 } else if ($(this).hasClass("high")) { 5278 $("#"+playerid+" .jplayer").jPlayer("option","volume",0.1); 5279 $(this).removeClass("high").addClass("low"); 5280 jplayervolume = 0.1; 5281 } 5282 createCookie("volume",jplayervolume); 5283 }); 5284 $(".handle",$("#"+obj)).draggable({ 5285 containment:"parent" 5286 ,drag: function(event, ui) { 5287 var pos = $(this).position().left; 5288 var pwidth = $(this).parent().width(); 5289 var percent = pos / pwidth; 5290 if (percent!=0) { 5291 percent = percent*100; 5292 } 5293 $(".jp-play-bar",$(this).parent()).css("width",percent+"%"); 5294 if ($(this).parents(".videoPlayerWrapper").length) { 5295 var playerid = $(".jplayer",$(this).parents(".videoPlayerWrapper")).attr("id"); 5296 } 5297 if ($(this).parents(".videoPlayerWrapper").length) { 5298 var playerid = $(".jplayer",$(this).parents(".videoPlayerWrapper")).attr("id"); 5299 } else { 5300 var playerid = $(this).parents(".audioplayer").prev().attr("id"); 5301 } 5302 $("#"+playerid).jPlayer("playHead",percent); 5303 } 5304 ,start: function(event,ui) { 5305 jplayerdragging=true; 5306 } 5307 ,stop:function(event,ui) { 5308 jplayerdragging=false; 5309 } 5310 ,axis:"x" 5311 }); 5312 if (ext=="m4v") { 5313 var supplied="m4v"; 5314 }
5315 if (ext=="mp3") { 5316 var supplied="mp3"; 5317 } 5318 if (ext=="mp4") { 5319 var supplied="m4v"; 5320 } 5321 if (ext=="mov") { 5322 var supplied="m4v"; 5323 } 5324 if (ext=="m4a") { 5325 var supplied="m4a"; 5326 } 5327 if (ext=="ogv") { 5328 var supplied="ogv"; 5329 } 5330 if (ext=="oga") { 5331 var supplied="oga"; 5332 } 5333 if (ext=="ogg") { 5334 var supplied="oga"; 5335 } 5336 if (ext=="wav") { 5337 var supplied="wav"; 5338 } 5339 if (ext=="webm") { 5340 var supplied="webmv"; 5341 } 5342 if (ext=="webma") { 5343 var supplied="webma"; 5344 } 5345 if (ext=="webmv") { 5346 var supplied="webmv"; 5347 } 5348 $("#"+obj+" .jplayer").jPlayer({ 5349 ready: function () { 5350 5351 if (ext=="m4v") { 5352 $(this).jPlayer("setMedia", { 5353 m4v: video 5354 ,poster: image 5355 }); 5356 } 5357 if (ext=="mp3") { 5358 $(this).jPlayer("setMedia", { 5359 m4v: video 5360 ,poster: image 5361 }); 5362 } 5363 if (ext=="mp4") { 5364 $(this).jPlayer("setMedia", { 5365 m4v: video 5366 ,poster: image 5367 }); 5368 } 5369 if (ext=="mov") { 5370 $(this).jPlayer("setMedia", { 5371 m4v: video 5372 ,poster: image 5373 }); 5374 } 5375 if (ext=="m4a") { 5376 $(this).jPlayer("setMedia", { 5377 m4a: video 5378 ,poster: image 5379 }); 5380 } 5381 if (ext=="ogv") { 5382 $(this).jPlayer("setMedia", { 5383 ogv: video 5384 ,poster: image 5385 }); 5386 } 5387 if (ext=="oga") { 5388 $(this).jPlayer("setMedia", { 5389 oga: video 5390 ,poster: image 5391 }); 5392 } 5393 if (ext=="ogg") { 5394 $(this).jPlayer("setMedia", { 5395 oga: video 5396 ,poster: image 5397 }); 5398 } 5399 if (ext=="wav") { 5400 $(this).jPlayer("setMedia", { 5401 wav: video 5402 ,poster: image 5403 }); 5404 } 5405 if (ext=="webm") { 5406 $(this).jPlayer("setMedia", { 5407 webm: video 5408 ,poster: image 5409 }); 5410 } 5411 if (ext=="webma") { 5412 $(this).jPlayer("setMedia", { 5413 webma: video 5414 ,poster: image 5415 }); 5416 } 5417 if (ext=="webmv") { 5418 $(this).jPlayer("setMedia", { 5419 webmv: video 5420 ,poster: image 5421 }); 5422 }
5423 if (autostart) { 5424 $(this).jPlayer("play"); 5425 } 5426 }, 5427 supplied: supplied, 5428 alt: alt, 5429 swfPath: "/javascripts", 5430 size: { 5431 width: width, 5432 height: height 5433 }, 5434 volume: jplayervolume, 5435 fullScreen:fullscreen, 5436 cssSelectorAncestor: "#"+obj+" .videoPlayerWrapper" 5437 ,play: function(event) { 5438 setTimeout(function() { 5439 $(".videoplayer",$(event.jPlayer.options['cssSelectorAncestor'])).addClass("hidden"); 5440 }, 1000); 5441 $(this).addClass("playing"); 5442 $(".videoloading,.jp-play-btn.large",$(event.jPlayer.options['cssSelectorAncestor'])).addClass("hidden"); 5443 }, 5444 pause: function(event) { 5445 $(".videoloading,.jp-play-btn.large",$(event.jPlayer.options['cssSelectorAncestor'])).removeClass("hidden"); 5446 $(".videoplayer",$(event.jPlayer.options['cssSelectorAncestor'])).removeClass("hidden"); 5447 5448 $(this).removeClass("playing"); 5449 }, 5450 timeupdate: function(event) { 5451 if (!jplayerdragging) { 5452 $(".handle",$(event.jPlayer.options['cssSelectorAncestor'])).css("left",$(".jp-play-bar",$(event.jPlayer.options['cssSelectorAncestor'])).width()); 5453 } 5454 } 5455 }); 5456 5457} 5458var jplayerVideoCounter=0; 5459var jplayervolume = 0.5; 5460$(window).load(function(){ 5461 if (readCookie("volume")) { 5462 jplayervolume = readCookie("volume"); 5463 } 5464 5465 5466 if (!$('body').hasClass("accessible-mode")){ 5467 $(".bpe_video:not(.Popup_Video) img").each(function(){ 5468 5469 var img = this; 5470 var width = $(this).width(); 5471 var height = $(this).height(); 5472 var image = $(this).attr("src"); 5473 var alt = $(this).attr("alt"); 5474 var video = $(this).parent().attr("href"); 5475 $(this).parent().after("<div id=\"video"+jplayerVideoCounter+"\" class='jplayerInit' data-poster='"+image+"' data-vid='"+video+"'>"+playerHTML+"</div>"); 5476 $(this).parent().remove(); 5477 5478 makeVideo("video"+jplayerVideoCounter,width,height,image,video,false,false,alt); 5479 5480 jplayerVideoCounter++; 5481 }); 5482 } 5483 5484 5485}); 5486 5487 5488function createCookie(name,value,days) { 5489 if (days) { 5490 var date = new Date(); 5491 date.setTime(date.getTime()+(days*24*60*60*1000)); 5492 var expires = "; expires="+date.toGMTString(); 5493 } 5494 else var expires = ""; 5495 document.cookie = name+"="+value+expires+"; path=/"; 5496} 5497 5498function readCookie(name) { 5499 var nameEQ = name + "="; 5500 var ca = document.cookie.split(';'); 5501 for(var i=0;i < ca.length;i++) { 5502 var c = ca[i]; 5503 while (c.charAt(0)==' ') c = c.substring(1,c.length); 5504 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 5505 } 5506 return null; 5507} 5508 5509function eraseCookie(name) { 5510 createCookie(name,"",-1); 5511} 5512function setPersonalNames($product) { 5513 5514 function setFormNames(form,qty,$product) { 5515 var titles = new Array(); 5516 5517 $(".cms-booking-product-"+qty+"-qty",$product).each(function(){ 5518 5519 var i = 1; 5520 var t = parseInt($("input",$(this)).val()); 5521 5522 var label = $(".booking-price-label",$(this)).data("singular"); 5523 for (var i = 1; i <= t; i++) { 5524 titles.push(label+" "+i+"/"+t); 5525 } 5526 5527 }); 5528 var x = 0; 5529 $(".personal-details-forms .personal-details-form."+form,$product).each(function(){ 5530 $(".booking-person-title",$(this)).text(titles[x]); 5531 x++; 5532 }); 5533 } 5534 setFormNames("personal-details-form-norm","normal",$product); 5535 setFormNames("personal-details-form-children","children",$product); 5536 setFormNames("personal-details-form-special","special",$product); 5537 5538} 5539function urlencode( str ) { 5540 // http://kevin.vanzonneveld.net 5541 // + original by: Philip Peterson 5542 // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 5543 // + input by: AJ 5544 // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 5545 // % note: info on what encoding functions to use from: http://xkr.us/articles/javascript/encode-compare/ 5546 // * example 1: urlencode('Kevin van Zonneveld!'); 5547 // * returns 1: 'Kevin+van+Zonneveld%21' 5548 // * example 2: urlencode('http://kevin.vanzonneveld.net/'); 5549 // * returns 2: 'http%3A%2F%2Fkevin.vanzonneveld.net%2F' 5550 // * example 3: urlencode('http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a'); 5551 // * returns 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%2
55516client%3Dfirefox-a' 5552 5553 var histogram = {}, histogram_r = {}, code = 0, tmp_arr = []; 5554 var ret = str.toString(); 5555 5556 // The histogram is identical to the one in urldecode. 5557 histogram['!'] = '%21'; 5558 histogram['%20'] = '+'; 5559 5560 // Begin with encodeURIComponent, which most resembles PHP's encoding functions 5561 ret = encodeURIComponent(ret); 5562 5563 for (search in histogram) { 5564 replace = histogram[search]; 5565 tmp_arr = ret.split(search); // Custom replace 5566 ret = tmp_arr.join(replace); 5567 } 5568 5569 // Uppercase for full PHP compatibility 5570 return ret.replace(/(\%([a-z0-9]{2}))/g, function(full, m1, m2) { 5571 return "%"+m2.toUpperCase(); 5572 }); 5573 5574 return ret; 5575} 5576var lang=""; 5577var langAppend=""; 5578var sDMT=true; 5579function updateCMSText(html) { 5580 $("#CMSLIVEUPDATE").html(html); 5581} 5582function cmsBookingReapply() { 5583 5584 $(".cms-booking-product-form.cms-booking-combined-dates").each(function(){ 5585 $(".cms-booking-product-selected:not(.cms-master-days .cms-booking-product-selected)",$(this)).removeClass("cms-booking-product-selected"); 5586 $(".cms-master-days .cms-booking-product-date.cms-booking-product-selected.cms-booking-product-available",$(this)).each(function(){ 5587 $(this).trigger("click",true); 5588 }); 5589 }); 5590} 5591var firstShow = true; 5592function cmsUpdateBookingPrices () { 5593 5594 var st = $(window).scrollTop(); 5595 $(".cms-booking-product-form").each(function(){ 5596 5597 5598 var total = 0; 5599 var surcharge = 0; 5600 var $form = $(this); 5601 if ($form.hasClass("cms-booking-combined-dates")) { 5602 $(".cms-master-days",$form).hide(); 5603 $(".cms-booking-product-select-product",$form).show(); 5604 $(".cms-booking-product-legend",$form).hide(); 5605 $(".cms-master-days .cms-booking-product-date:not(.cms-booking-product-history,.cms-booking-filler)",$form).addClass("cms-booking-product-available"); 5606 } 5607 5608 $(".cms-booking-product",$form).each(function(){ 5609 var $prod = $(this); 5610 var use_min_charge = $(this).data("use-minimum-price"); 5611 5612 5613 var qty_adults = parseInt($(".cms-booking-product-normal-qty input",$prod).val()); 5614 var qty_special = parseInt($(".cms-booking-product-special-qty input",$prod).val()); 5615 var qty_children = parseInt($(".cms-booking-product-children-qty input",$prod).val()); 5616 5617 5618 5619 if (isNaN(qty_adults)) { 5620 qty_adults = 0; 5621 } 5622 if (isNaN(qty_special)) { 5623 qty_special = 0; 5624 } 5625 if (isNaN(qty_children)) { 5626 qty_children = 0; 5627 } 5628 5629 if ($prod.data("adult-required")===1 && qty_children>0) { 5630 if (qty_special+qty_adults === 0) { 5631 setTimeout(function () { 5632 $(".cms-booking-product-require-adult",$prod).slideDown(300,function(){ 5633 if (typeof moduleHeights == 'function') { 5634 moduleHeights(); 5635 } 5636 }); 5637 }, 10); 5638 $(".cms-booking-product-children-qty input",$prod).val("0"); 5639 qty_children=0; 5640 } else { 5641 $(".cms-booking-product-require-adult",$prod).slideUp(300,function(){}); 5642 } 5643 } 5644 5645 var t = qty_adults+qty_special+qty_children; 5646 $(this).removeClass("cms-booking-zero-qty"); 5647 if (t===0) { 5648 $(this).addClass("cms-booking-zero-qty"); 5649 } 5650 if (t>0&&$form.hasClass("cms-booking-combined-dates")) { 5651 $(".cms-master-days",$form).show(); 5652 5653 if (firstShow) { 5654 $(".cms-master-days:first").each(function(){ 5655 if ($(".cms-booking-product-date:not(.cms-booking-product-history):first",$(this)).length) { 5656 var ol = $(".cms-booking-product-date:not(.cms-booking-product-history):first",$(this)).position().left; 5657 $(".cms-booking-product-dates-inner",$(this)).animate({scrollLeft:ol},500); 5658 5659 } 5660 }); 5661 firstShow=false; 5662 } 5663 $(".cms-booking-product-select-product",$form).hide(); 5664 $(".cms-booking-product-legend",$form).show(); 5665 5666 } 5667 5668 5669 5670 $(".cms-booking-product-toomany",$prod).removeClass("cms-booking-product-toomany"); 5671 $form.find(".cms-booking-product-min-days-error").hide(); 5672 $form.find(".cms-booking-product-add-to-basket").show(); 5673 $(".cms-booking-product-date",$prod).each(function(){ 5674 var $date = $(this); 5675 if ($form.hasClass("cms-booking-combined-dates")) { 5676 if (t>0 && !$date.hasClass("cms-booking-product-available")) { 5677 $(".cms-master-days .cms-booking-product-date[data-date='"+$date.attr("data-date")+"']",$form).removeClass("cms-booking-product-available"); 5678 } 5679 } 5680 if (t > $date.data("available")) { 5681 $date.addClass("cms-booking-product-toomany"); 5682 if ($form.hasClass("cms-booking-combined-dates")) { 5683 $(".cms-master-days .cms-booking-product-date[data-date='"+$date.attr("data-date")+"']",$form).removeClass("cms-booking-product-available"); 5684 } 5685 var addOrRemove = true; 5686 if ($date.hasClass("block-start")) { 5687 $date.nextUntil($(".block-end")).each(function(){ 5688 $date.toggleClass("cms-booking-product-toomany",addOrRemove); 5689 }).next().toggleClass("cms-booking-product-toomany",addOrRemove); 5690 } 5691 if ($date.hasClass("block-middle")) { 5692 $date.nextUntil($(".block-end")).each(function(){ 5693 $date.toggleClass("cms-booking-product-toomany",addOrRemove); 5694 }).next().toggleClass("cms-booking-product-toomany",addOrRemove);
5695 if ($date.next().hasClass("block-end")) { 5696 $date.next().toggleClass("cms-booking-product-toomany",addOrRemove); 5697 } 5698 $date.prevUntil($(".block-start")).each(function(){ 5699 $date.toggleClass("cms-booking-product-toomany",addOrRemove); 5700 }).prev().toggleClass("cms-booking-product-toomany",addOrRemove); 5701 if ($date.prev().hasClass("block-start")) { 5702 $date.prev().toggleClass("cms-booking-product-toomany",addOrRemove); 5703 } 5704 } 5705 if ($date.hasClass("block-end")) { 5706 $date.prevUntil($(".block-start")).each(function(){ 5707 $date.toggleClass("cms-booking-product-toomany",addOrRemove); 5708 }).prev().toggleClass("cms-booking-product-toomany",addOrRemove); 5709 } 5710 } 5711 if (typeof $date.data("min-days")!="undefined" && $date.data("min-days")!=0 && $date.hasClass("cms-booking-product-selected")) { 5712 if ( 5713 !$date.prevAll('.cms-booking-product-selected').length 5714 ) { 5715 // if first one 5716 var nextcounter = 2; 5717 if (!$date.nextAll('div:not(".cms-booking-filler")').length){ 5718 var text = $(this).parents('.cms-booking-combined-dates').find(".cms-booking-product-min-days-error").data("orig-text").replace("***",$date.data("min-days")); 5719 $(this).parents('.cms-booking-combined-dates').find(".cms-booking-product-min-days-error").text(text).show(); 5720 $(".cms-booking-product-add-to-basket").hide(); 5721 } 5722 $date.nextAll(':not(.cms-booking-filler)').each(function(){ 5723 nextcounter++; 5724 if ($(this).nextAll(':not(".cms-booking-filler")').length){ 5725 5726 if (!$(this).nextAll(':not(".cms-booking-filler")').first().hasClass("cms-booking-product-selected") && nextcounter <= $date.data("min-days")) { 5727 var text = $(this).parents('.cms-booking-combined-dates').find(".cms-booking-product-min-days-error").data("orig-text").replace("***",$date.data("min-days")); 5728 $(this).parents('.cms-booking-combined-dates').find(".cms-booking-product-min-days-error").text(text).show(); 5729 $(".cms-booking-product-add-to-basket").hide(); 5730 return false; 5731 } 5732 } 5733 else { 5734 if (!$(this).nextAll(':not(".cms-booking-filler")').length && nextcounter <= $date.data("min-days")){ 5735 var text = $(this).parents('.cms-booking-combined-dates').find(".cms-booking-product-min-days-error").data("orig-text").replace("***",$date.data("min-days")); 5736 $(this).parents('.cms-booking-combined-dates').find(".cms-booking-product-min-days-error").text(text).show(); 5737 $(".cms-booking-product-add-to-basket").hide(); 5738 return false; 5739 } 5740 5741 } 5742 5743 5744 }); 5745 } 5746 } 5747 }); 5748 5749 var days = "["; 5750 $(".cms-booking-product-selected:not(.cms-booking-product-toomany)",$prod).each(function(){ 5751 5752 var price_normal = parseFloat($(this).data("price-normal")); 5753 var price_special = parseFloat($(this).data("price-special")); 5754 var price_children = parseFloat($(this).data("price-children")); 5755 var min_price = parseFloat($(this).data("minimum-price-per-place")); 5756 5757 var normal = price_normal * qty_adults; 5758 var special = price_special * qty_special; 5759 var children = price_children * qty_children; 5760 5761 var subtotal = normal+special+children; 5762 var subsurcharge=0; 5763 if (subtotal < min_price && use_min_charge) { 5764 var subsurcharge = min_price-subtotal; 5765 surcharge = surcharge+subsurcharge; 5766 } 5767 total = total+subtotal+subsurcharge; 5768 5769 if (days!="[") { 5770 days = days+','; 5771 } 5772 days = days+'"'+$(this).data("date")+'"'; 5773 }); 5774 days = days+"]"; 5775 $(".cms-booking-product-days-input",$(this)).val(days); 5776 5777 if ($(".persondetailsmaseter",$(this)).length) { 5778 $(".persondetailsmaseter",$(this)).find(".required").prop("required",false); 5779 function addBPForms(qty,c,$this) { 5780 $(".personal-details-forms .personal-details-form.personal-details-form-"+c,$this).hide(); 5781 var a = 1; 5782 var t = qty; 5783 5784 while (a <= t) { 5785 5786 if ($(".personal-details-forms .personal-details-form.personal-details-form-"+c+":hidden",$this).length) { 5787 $(".personal-details-forms .personal-details-form.personal-details-form-"+c+":hidden:first",$this).show(); 5788 } else { 5789 if ($('.personal-details-forms .personal-details-form-'+c+":visible",$this).length) { 5790 $('.personal-details-forms .personal-details-form-'+c+":visible:last",$this).after($(".persondetailsmaseter > *",$this).clone().addClass('personal-details-form-'+c)); 5791 } else { 5792 $(".personal-details-forms",$this).append($(".persondetailsmaseter > *",$this).clone().addClass('personal-details-form-'+c)); 5793 } 5794 5795 } 5796 a++; 5797 } 5798 5799 } 5800 addBPForms(qty_adults,"norm",$(this)); 5801 addBPForms(qty_children,"children",$(this)); 5802 addBPForms(qty_special,"special",$(this)); 5803 setPersonalNames($(this)); 5804 } 5805 5806 5807 }); 5808 5809 if (surcharge>0) { 5810 $(".cms-booking-product-total-surcharge",$(this)).show(); 5811 $(".cms-booking-product-total-surcharge span",$(this)).text(surcharge.toFixed(2)); 5812 } else { 5813 $(".cms-booking-product-total-surcharge",$(this)).hide(); 5814 } 5815 $(".cms-booking-product-total-price span",$(this)).text(total.toFixed(2)); 5816 5817 5818 5819 if ($form.hasClass("cms-booking-combined-dates")) { 5820 5821 cmsBookingProdTestEachDay($form); 5822 5823 $(".cms-booking-product-not-available-for-days",$form).removeClass("cms-booking-product-not-available-for-days") 5824 5825 $(".cms-booking-zero-qty",$form).each(function(){ 5826 5827 var $zeroProd = $(this); 5828 setTimeout(function () { 5829 $(".cms-master-days .cms-booking-product-date.cms-booking-product-selected",$form).each(function(){ 5830 var d = $(this).data("date"); 5831 if (!$(".cms-booking-product-date[data-date='"+d+"']",$zeroProd).hasClass("cms-booking-product-available")) { 5832 $zeroProd.addClass("cms-booking-product-not-available-for-days"); 5833 } 5834 }); 5835 }, 10); 5836 5837 5838 }); 5839 } 5840 }); 5841 $("body,html").scrollTop(st); 5842 if (typeof moduleHeights == 'function') { 5843 moduleHeights(); 5844 } 5845} 5846function cmsBookingProdTestEachDay($form) { 5847 $(".cms-master-days .cms-booking-product-available",$form).each(function(){ 5848 var $day = $(this); 5849 var d = $(this).data("date"); 5850 $(".cms-booking-product",$form).each(function(){ 5851 5852 var $prod = $(this); 5853 5854 var qty_adults = parseInt($(".cms-booking-product-normal-qty input",$prod).val()); 5855 var qty_special = parseInt($(".cms-booking-product-special-qty input",$prod).val()); 5856 var qty_children = parseInt($(".cms-booking-product-children-qty input",$prod).val()); 5857 5858 if (isNaN(qty_adults)) { 5859 qty_adults = 0; 5860 } 5861 if (isNaN(qty_special)) { 5862 qty_special = 0; 5863 } 5864 if (isNaN(qty_children)) { 5865 qty_children = 0; 5866 } 5867 var t = qty_adults+qty_special+qty_children; 5868 5869 $(".cms-booking-product-test",$prod).removeClass("cms-booking-product-test"); 5870 5871 $(".cms-booking-product-date[data-date='"+d+"']",$prod).each(function(){ 5872 5873 var addOrRemove = true; 5874 var c = "cms-booking-product-test"; 5875 5876 if ($(this).hasClass("block-start")) { 5877 $(this).nextUntil($(".block-end")).each(function(){ 5878 $(this).toggleClass(c,addOrRemove); 5879 }).next().toggleClass(c,addOrRemove);
5880 if ($(this).next().hasClass("block-end")) { 5881 $(this).next().toggleClass(c,addOrRemove); 5882 } 5883 } 5884 if ($(this).hasClass("block-middle")) { 5885 $(this).nextUntil($(".block-end")).each(function(){ 5886 $(this).toggleClass(c,addOrRemove); 5887 }).next().toggleClass(c,addOrRemove); 5888 if ($(this).next().hasClass("block-end")) { 5889 $(this).next().toggleClass(c,addOrRemove); 5890 } 5891 $(this).prevUntil($(".block-start")).each(function(){ 5892 $(this).toggleClass(c,addOrRemove); 5893 }).prev().toggleClass(c,addOrRemove); 5894 if ($(this).prev().hasClass("block-start")) { 5895 $(this).prev().toggleClass(c,addOrRemove); 5896 } 5897 } 5898 if ($(this).hasClass("block-end")) { 5899 $(this).prevUntil($(".block-start")).each(function(){ 5900 $(this).toggleClass(c,addOrRemove); 5901 }).prev().toggleClass(c,addOrRemove); 5902 if ($(this).prev().hasClass("block-start")) { 5903 $(this).prev().toggleClass(c,addOrRemove); 5904 } 5905 } 5906 5907 $(this).toggleClass(c,addOrRemove); 5908 5909 }); 5910 }); 5911 $(".cms-booking-product-test",$form).each(function(){ 5912 var addD = $(this).data("date"); 5913 $(".cms-master-days .cms-booking-product-date[data-date='"+addD+"']",$form).each(function(){ 5914 if (!$(this).hasClass("cms-booking-product-available")) { 5915 $(".cms-master-days .cms-booking-product-date[data-date='"+d+"']",$form).removeClass("cms-booking-product-available"); 5916 } 5917 }); 5918 }); 5919 }); 5920 $(".cms-booking-product-test",$form).removeClass("cms-booking-product-test"); 5921} 5922function setSSCalendarGroupFilter() { 5923 $(".ss_calendar_group_filter").each(function(){ 5924 $(".event.ss-filter-group-id-"+$(this).data("group-id"),$(".calendar")).hide(); 5925 }); 5926 $(".ss_calendar_group_filter:checked").each(function(){ 5927 $(".event.ss-filter-group-id-"+$(this).data("group-id"),$(".calendar")).show(); 5928 }); 5929} 5930function loadBookingProdForms() { 5931 if (!$(".personal-details-forms").length) { 5932 return false; 5933 } 5934 var str = readCookie('bookingData'+$('body').data('page-id')); 5935 var bookingproducts = JSON.parse(str); 5936 if (bookingproducts && $(".cms-booking-product").length) { 5937 5938 var count = 0; 5939 $(".cms-booking-product").each(function(){ 5940 var adults = bookingproducts[count].adults; 5941 var children = bookingproducts[count].children; 5942 var special = bookingproducts[count].special; 5943 var formdata= bookingproducts[count].forms; 5944 $(this).find('.cms-booking-product-normal-qty input').val(adults); 5945 if ($(this).find('.cms-booking-product-children-qty input').length) { 5946 $(this).find('.cms-booking-product-children-qty input').val(children); 5947 } 5948 if ($(this).find('.cms-booking-product-special-qty input').length) { 5949 $(this).find('.cms-booking-product-special-qty input').val(special); 5950 } 5951 cmsUpdateBookingPrices(); 5952 cmsBookingReapply(); 5953 var formcount=0; 5954 $(".personal-details-forms .personal-details-form",$(this)).each(function(){ 5955 var formd = formdata[formcount]; 5956 for (var i = 0; i < formd.length; i++) { 5957 if (formd[i].value=="checkedPROP") { 5958 $("#"+formd[i].id,$(this)).prop('checked',true); 5959 } else { 5960 $("#"+formd[i].id,$(this)).val(formd[i].value); 5961 } 5962 } 5963 formcount++; 5964 }); 5965 5966 count++; 5967 }); 5968 5969 setTimeout(function () { 5970 cmsUpdateBookingPrices(); 5971 }, 10); 5972 $(".cms-booking-combined-dates:first").before('<p class="Icon_Info">'+$(".cms-booking-combined-dates:first").data("retrieved-msg").replace("(","<a href='' class='resetBooking'>").replace(")","</a>")+'</p>'); 5973 $('.resetBooking').click(function(){ 5974 eraseCookie('bookingData'+$('body').data('page-id')); 5975 window.location.reload(); 5976 return false; 5977 }); 5978 } 5979} 5980function saveBookingProdState() { 5981 var bookingproducts = []; 5982 $(".cms-booking-product").each(function(){ 5983 var forms = []; 5984 $(".personal-details-forms .personal-details-form",$(this)).each(function(){ 5985 var formdata = []; 5986 $(".input,.select",$(this)).each(function(){ 5987 5988 formdata.push({id:$(this).attr('id'),value:$(this).val()}) 5989 }); 5990 $(".radio:checked,.checkbox:checked",$(this)).each(function(){ 5991 formdata.push({id:$(this).attr('id'),value:"checkedPROP"}) 5992 }); 5993 forms.push(formdata); 5994 }); 5995 bookingproducts.push({ 5996 name:$(this).find(".cms-boooking-product-quantities h3").text() 5997 ,adults:$(this).find('.cms-booking-product-normal-qty input').val() 5998 ,children:$(this).find('.cms-booking-product-children-qty input').val() 5999 ,special:$(this).find('.cms-booking-product-special-qty input').val() 6000 ,forms:forms 6001 }); 6002 }); 6003 6004 createCookie('bookingData'+$('body').data('page-id'),JSON.stringify(bookingproducts)); 6005} 6006if (window.performance && window.performance.navigation.type == window.performance.navigation.TYPE_BACK_FORWARD) { 6007 loadBookingProdForms(); 6008}
6009function makeCombinedDays() { 6010 $(".cms-booking-combined-dates").each(function(){ 6011 $(".cms-master-days",$(this)).remove(); 6012 $(".cms-booking-product-total",$(this)).before('<div class="cms-master-days clearfix"></div>'); 6013 var $days= $("<div class=\"cms-booking-product-dates clearfix\"></div>"); 6014 var added= new Array(); 6015 $(".cms-booking-product-dates").each(function(){ 6016 if (!$("h4",$days).length) { 6017 $("h4",$(this)).clone().appendTo($days); 6018 6019 } 6020 if (!$(".cms-booking-product-dates-inner",$days).length) { 6021 $(".cms-booking-product-dates-inner",$(this)).clone().empty().appendTo($days); 6022 } 6023 if ($(".cms-booking-product-nav",$(this)).length && !$(".cms-booking-product-nav",$days).length) { 6024 $(".cms-booking-product-cur-month",$(this)).clone().prependTo($days); 6025 $(".cms-booking-product-nav",$(this)).clone().prependTo($days); 6026 } 6027 6028 6029 $(".cms-booking-product-date",$(this)).each(function(){ 6030 var d = $(this).data("date"); 6031 if ($.inArray(d, added)===-1){ 6032 6033 $days.find(".cms-booking-product-dates-inner").append($(this).clone()); 6034 added.push(d); 6035 } 6036 6037 }) 6038 }); 6039 $(".cms-master-days",$(this)).html($days); 6040 $(".block-start,.block-middle,.block-end",$(".cms-master-days",$(this))).removeClass("block-start block-middle block-end"); 6041 var $form = $(this); 6042 $(".cms-booking-product-date.cms-booking-product-selected:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)",$(this)).each(function(){ 6043 var d = $(this).data('date'); 6044 $(".cms-master-days .cms-booking-product-date[data-date='"+d+"']",$form).addClass("cms-booking-product-selected"); 6045 }); 6046 cmsUpdateBookingPrices(); 6047 6048 }); 6049} 6050function checkCalendars() { 6051 $(".responsive_calendar").each(function(){ 6052 if ($(".calendar_responsive_full_mode:visible",$(this)).length) { 6053 var w = $(".calendar_responsive_full_mode",$(this)).width(); 6054 } else { 6055 var w = $(".calendar_responsive_list_mode",$(this)).width(); 6056 } 6057 if (w<768) { 6058 $(".calendar_responsive_full_mode",$(this)).hide(); 6059 $(".calendar_responsive_list_mode",$(this)).show(); 6060 } else { 6061 $(".calendar_responsive_full_mode",$(this)).show(); 6062 $(".calendar_responsive_list_mode",$(this)).hide(); 6063 } 6064 }); 6065 setTimeout(function () { 6066 if (typeof moduleHeights == 'function') { 6067 moduleHeights(); 6068 } 6069 }, 10); 6070} 6071$(window).resize(function(){ 6072 checkCalendars(); 6073}); 6074dataLayer = []; 6075function showResponseForm (responseText, statusText) { 6076 var toSend = $('.ajaxSending'); 6077 if (toSend.hasClass("formUsedInCheckout")){ 6078 var showErrorIn = $("#paymentGatewayForm"); 6079 } else { 6080 var showErrorIn = toSend; 6081 } 6082 var loader = $("#loader",showErrorIn); 6083 if (responseText=="error: recaptcha") { 6084 loader.fadeOut(200); 6085 $("#recaptcha_error",toSend).fadeIn(); 6086 if (typeof grecaptcha != "undefined") { 6087 if (typeof toSend.attr('recapid') !='undefined') { 6088 grecaptcha.reset(toSend.attr('recapid')); 6089 } else { 6090 grecaptcha.reset(); 6091 } 6092 } 6093 if (typeof turnstile != "undefined") { 6094 if (typeof toSend.attr('recapid') !='undefined') { 6095 turnstile.reset(toSend.attr('recapid')); 6096 } else { 6097 turnstile.reset(); 6098 } 6099 } 6100 6101 return false; 6102 } 6103 if (responseText=="error: duplicate") { 6104 loader.fadeOut(200); 6105 alert("Error: You've already sent this form"); 6106 return false; 6107 } 6108 if (responseText=="error: flood") { 6109 loader.fadeOut(200); 6110 alert("Error: Please wait 15 seconds between sending forms."); 6111 return false; 6112 } 6113 if (responseText=="formInCheckout") { 6114 $("#paymentGatewayForm").addClass("formInCheckoutOK").trigger('submit'); 6115 } else { 6116 if (responseText.substring(0,9)=="redirect:") { 6117 var url = responseText.substring(9,responseText.length); 6118 var counter = 1; 6119 $(".input-wrapper input,.input-wrapper textarea,.input-wrapper select",toSend).each(function(){ 6120 url = url.replace("***FIELD"+counter+"***",encodeURIComponent($(this).val())); 6121 counter++; 6122 }); 6123 6124 window.location.href=url; 6125 } 6126 if (typeof grecaptcha != "undefined" && $('.g-recaptcha',$(toSend)).length) { 6127 grecaptcha.reset(); 6128 } 6129 if (typeof turnstile != "undefined"&& $('.cf-turnstile',$(toSe
6129nd)).length) { 6130 turnstile.reset(); 6131 } 6132 6133 $("#sending_wait").hide(); 6134 setTimeout(function () { 6135 $(".submit_form",toSend).fadeIn(); 6136 if (typeof moduleHeights == 'function') { 6137 moduleHeights(); 6138 } 6139 6140 }, 2500); 6141 loader.fadeOut(200); 6142 $(".submit_form",toSend).hide(); 6143 $("#success",toSend).fadeIn(200,function(){ 6144 if (typeof moduleHeights == 'function') { 6145 moduleHeights(); 6146 } 6147 }); 6148 if (typeof ga === 'function') { 6149 ga('send', 'event', 'Contact Forms', 'Send', 'ID: '+$("input[name=formId]",toSend).val()); 6150 } 6151 $(".input:not(.input[name='group'])",toSend).val(""); 6152 $(".textarea",toSend).val(""); 6153 6154 } 6155 6156} 6157 6158var optionsForm = { 6159 success: showResponseForm // post-submit callback 6160}; 6161function bindForms () { 6162 6163 $(".submit_form a").unbind("click").click(function(){ 6164 $(this).parents("form").submit(); 6165 return false; 6166 }); 6167 6168$(".form:not(.accessible-mode .form),.formUsedInCheckout").unbind("submit").submit(function(){ 6169 $('.recaptchaSend').removeClass('recaptchaSend'); 6170 if (!$("#addToBasketId",$(this)).length&&!$(this).hasClass('addToBasketForm')) { 6171 var ajaxSend = true; 6172 } else { 6173 var ajaxSend = false; 6174 if ($(this).hasClass("oktosend")) { 6175 return true; 6176 } 6177 } 6178 if ($(this).attr("id")=="paymentGatewayForm") { 6179 var ajaxSend = false; 6180 if ($(this).hasClass("oktosend")) { 6181 // this form valid 6182 if (typeof ga === 'function') { 6183 ga('send', 'event', 'Checkout', 'Gone to Payment Gateway', $(this).attr("action")); 6184 } 6185 if (typeof $(this).data("datalayer-total")!="undefined") { 6186 if (readCookie("transid")==$(this).data('transid')) { 6187 var transid = readCookie("transidvalue"); 6188 } else { 6189 createCookie("transid",$(this).data('transid')); 6190 var transid = Math.floor(Math.random()*1000000); 6191 createCookie("transidvalue",transid); 6192 } 6193 dataLayer.push({ 6194 "transactionId":transid 6195 ,"transactionTotal":parseFloat($(this).data('datalayer-total')) 6196 ,"transactionTax":parseFloat($(this).data('datalayer-tax')) 6197 ,"transactionShipping":parseFloat($(this).data('datalayer-shipping')) 6198 // ,"coupon":$(this).data('datalayer-coupon') 6199 // ,"discount":parseFloat($(this).data('datalayer-discount')) 6200 // ,"gateway":$(this).data('datalayer-gateway') 6201 }); 6202 } 6203 6204 if (!$(this).hasClass('formInCheckoutOK')&&$('.formUsedInCheckout').length) { 6205 // extra form valid 6206 $(".form.formUsedInCheckout").trigger('submit'); 6207 return false; 6208 } 6209 return true; 6210 } 6211 } 6212 var toSend = $(this); 6213 $('.ajaxSending').removeClass('ajaxSending'); 6214 toSend.addClass('ajaxSending'); 6215 6216 6217 $(this).addClass("validating"); 6218 $("#success,.signupFormNeedsEmailOrSMS",$(this)).hide(); 6219 $(".cf_contains_errors,.cf_contains_errors_captcha",toSend).hide(); 6220 $(".cf_error").removeClass("cf_error"); 6221 if (toSend.hasClass("formUsedInCheckout")){ 6222 var showErrorIn = $("#paymentGatewayForm"); 6223 } else { 6224 var showErrorIn = toSend; 6225 } 6226 var loader = $("#loader",showErrorIn); 6227 loader.fadeIn(300); 6228 if ($("textarea.required,select.required,input.required[type!='checkbox'], .required[type='checkbox']:not(:checked)",$(this)).filter(function() { 6229 if (typeof $(this).attr('placeholder') !='undefined') { 6230 if ($(this).val()!=$(this).attr('placeholder') && $(this).val()!='') { 6231 if ($(this).data("required-format")) { 6232 6233 for (var i = 0; i < $(this).data("required-format").length; i++) { 6234 if ($(this).data("required-format")[i]=="#"){ 6235 if (isNaN($(this).val()[i])) { 6236 return true; 6237 } 6238 } 6239 if ($(this).data("required-format")[i]==" "){ 6240 if ($(this).val()[i]!=" ") { 6241 return true; 6242 } 6243 } 6244 if ($(this).data("required-format")[i]=="-"){ 6245 if ($(this).val()[i]!="-") { 6246 return true; 6247 } 6248 } 6249 if ($(this).data("required-format")[i]=="/"){ 6250 if ($(this).val()[i]!="/") { 6251 return true; 6252 } 6253 } 6254 } 6255 } else { 6256 return false; 6257 } 6258 } else { 6259 return true; 6260 } 6261 } else { 6262 if ($(this).is(':checkbox')) { 6263 return true; 6264 } else { 6265 return $(this).val() == ""; 6266 } 6267 6268 } 6269 }).length > 0) { 6270 $("textarea.required,select.required,input.required[type!='checkbox'], .required[type='checkbox']:not(:checked)",$(this)).filter(function() { 6271 if (typeof $(this).attr('placeholder') !='undefined') { 6272 if ($(this).val()!=$(this).attr('placeholder') && $(this).val()!='') { 6273 if ($(this).data("required-format")) { 6274 6275 for (var i = 0; i < $(this).data("required-format").length; i++) { 6276 if ($(this).data("required-format")[i]=="#"){
6277 if (isNaN($(this).val()[i])) { 6278 return true; 6279 } 6280 } 6281 if ($(this).data("required-format")[i]==" "){ 6282 if ($(this).val()[i]!=" ") { 6283 return true; 6284 } 6285 } 6286 if ($(this).data("required-format")[i]=="-"){ 6287 if ($(this).val()[i]!="-") { 6288 return true; 6289 } 6290 } 6291 if ($(this).data("required-format")[i]=="/"){ 6292 if ($(this).val()[i]!="/") { 6293 return true; 6294 } 6295 } 6296 } 6297 } else { 6298 return false; 6299 } 6300 } else { 6301 return true; 6302 } 6303 } else { 6304 if ($(this).is(':checkbox')) { 6305 return true; 6306 } else { 6307 return $(this).val() == ""; 6308 } 6309 } 6310 }).addClass('cf_error').first().each(function(){ 6311 $(this).focus(); 6312 loader.fadeOut(200); 6313 return false; 6314 }); 6315 6316 $(".cf_contains_errors",showErrorIn).slideDown(300,function(){ 6317 if (typeof moduleHeights == 'function') { 6318 moduleHeights(); 6319 } 6320 }); 6321 return false; 6322 6323 } else { 6324 if ( $("input[type=email]",$(this)).length > 0 ) { 6325 if ($("input[type=email]",$(this)).hasClass("required")) { 6326 6327 $.ajax({ 6328 type: "GET", 6329 url: "/actions/CheckEmail/", 6330 data: "email="+$("input[type=email]",toSend).val(), 6331 success: function(msg){ 6332 if (msg == "ok") { 6333 var validEmail = true; 6334 } else { 6335 var validEmail = false; 6336 } 6337 if (validEmail == false) { 6338 $("#emailIncorrect",toSend).css("display","block"); 6339 $("input[type=email]",toSend).addClass('cf_error'); 6340 $("input[type=email]",toSend).focus(); 6341 $(".cf_contains_errors",showErrorIn).slideDown(300,function(){ 6342 if (typeof moduleHeights == 'function') { 6343 moduleHeights(); 6344 } 6345 }); 6346 loader.fadeOut(200); 6347 return false; 6348 6349 } else { 6350 $("#emailIncorrect",toSend).css("display","none"); 6351 if (ajaxSend==true) { 6352 if (typeof grecaptcha != "undefined"&&$(toSend).hasClass('withInvisRecaptcha')) { 6353 grecaptcha.execute(toSend.attr('recapid')); 6354 toSend.removeClass("validating").addClass("oktosend").addClass('recaptchaSend'); 6355 }else { 6356 toSend.ajaxSubmit(optionsForm); 6357 } 6358 return false; 6359 } 6360 toSend.removeClass("validating").addClass("oktosend"); 6361 toSend.submit(); 6362 } 6363 } 6364 }); 6365 return false; 6366 //if (ajaxSend==true) { 6367 //return false; 6368 //} 6369 } else { 6370 if ($("input[type=email]",toSend).val()!="") { 6371 $.ajax({ 6372 type: "GET", 6373 url: "/actions/CheckEmail/", 6374 data: "email="+$("input[type=email]",toSend).val(), 6375 success: function(msg){ 6376 if (msg == "ok") { 6377 var validEmail = true; 6378 } else { 6379 var validEmail = false; 6380 } 6381 if (validEmail == false) { 6382 $("#emailIncorrect",toSend).css("display","block"); 6383 $("input[type=email]",toSend).addClass('cf_error'); 6384 $("input[type=email]",toSend).focus(); 6385 $(".cf_contains_errors",showErrorIn).slideDown(300,function(){ 6386 if (typeof moduleHeights == 'function') { 6387 moduleHeights(); 6388 } 6389 }); 6390 loader.fadeOut(200); 6391 return false; 6392 6393 } else { 6394 if (ajaxSend==true) { 6395 $("#emailIncorrect",toSend).css("display","none"); 6396 if (typeof grecaptcha != "undefined"&&$(toSend).hasClass('withInvisRecaptcha')) { 6397 grecaptcha.execute(toSend.attr('recapid')); 6398 toSend.removeClass("validating").addClass("oktosend").addClass('recaptchaSend'); 6399 }else{ 6400 $(toSend).ajaxSubmit(optionsForm); 6401 } 6402 return false; 6403 } 6404 toSend.removeClass("validating").addClass("oktosend"); 6405 toSend.submit(); 6406 } 6407 } 6408 }); 6409 } else { 6410 if ($('.signupFormNeedsEmailOrSMS',toSend).length) { 6411 6412 if ($('input[type=email]',toSend).val()==""&&$('input[name="sms"]',toSend).val()=="") { 6413 $('.signupFormNeedsEmailOrSMS').show(); 6414 if (typeof moduleHeights == 'function') { 6415 moduleHeights(); 6416 } 6417 loader.fadeOut(200); 6418 return false; 6419 } 6420 } 6421 if (ajaxSend==true) { 6422 $("#emailIncorrect",toSend).css("display","none"); 6423 if (typeof grecaptcha != "undefined"&&$(toSend).hasClass('withInv
6423isRecaptcha')) { 6424 grecaptcha.execute(toSend.attr('recapid')); 6425 toSend.removeClass("validating").addClass("oktosend").addClass('recaptchaSend'); 6426 }else{ 6427 $(toSend).ajaxSubmit(optionsForm); 6428 } 6429 return false; 6430 6431 } 6432 toSend.removeClass("validating").addClass("oktosend"); 6433 toSend.submit(); 6434 return false; 6435 } 6436 } 6437 6438 } else { 6439 if (ajaxSend==true) { 6440 $("#emailIncorrect",toSend).css("display","none"); 6441 if (typeof grecaptcha != "undefined"&&$(toSend).hasClass('withInvisRecaptcha')) { 6442 grecaptcha.execute(toSend.attr('recapid')); 6443 toSend.removeClass("validating").addClass("oktosend").addClass('recaptchaSend'); 6444 }else{ 6445 $(toSend).ajaxSubmit(optionsForm); 6446 } 6447 return false; 6448 } 6449 toSend.removeClass("validating").addClass("oktosend"); 6450 toSend.submit(); 6451 } 6452 } 6453 6454 //if (ajaxSend==true) { 6455 return false; 6456 //} 6457 6458}); 6459 6460} 6461$(document).ready(function(){ 6462 $('input[name="giftcard_sender_name"]').change(function() { 6463 createCookie('giftcard_last_sender',$(this).val(),0,'/'); 6464 }); 6465 $('input[name="giftcard_sender_email"]').change(function() { 6466 createCookie('giftcard_sender_email',$(this).val(),0,'/'); 6467 }); 6468 $('textarea[name="giftcard_sender_address"]').change(function() { 6469 var join = $(this).val().split("\n"); 6470 join = join.join('%%!!%%'); 6471 createCookie('giftcard_sender_address',join,0,'/'); 6472 }); 6473 6474 if (readCookie('giftcard_last_sender')) { 6475 $('input[name="giftcard_sender_name"]').val(readCookie('giftcard_last_sender')); 6476 } 6477 if (readCookie('giftcard_sender_email')) { 6478 $('input[name="giftcard_sender_email"]').val(readCookie('giftcard_sender_email')); 6479 } 6480 if (readCookie('giftcard_sender_address')) { 6481 var addr = readCookie('giftcard_sender_address'); 6482 $('textarea[name="giftcard_sender_address"]').val(addr.split('%%!!%%').join("\n")); 6483 } 6484 $("body").addClass("js"); 6485 checkCalendars(); 6486 6487 $(".cms-booking-product").on("change",".personal-details-form input,.personal-details-form select",function(){ 6488 saveBookingProdState(); 6489 }); 6490 if (typeof cmshookBeforeBookingProducts != 'undefined') { 6491 cmshookBeforeBookingProducts(); 6492 } 6493 6494 6495 $(".ss_calendar_group_filter").change(function(){ 6496 setSSCalendarGroupFilter(); 6497 }); 6498 $('.cms-booking-product-min-days-error').hide(); 6499 $(".cms-booking-product-add-to-basket").show(); 6500 if ($(".cms-booking-product-form").length>1) { 6501 $(".cms-booking-product-form").each(function(){ 6502 $(".cms-booking-product-select-product",$(this)).hide(); 6503 $(".cms-booking-product-legend",$(this)).show(); 6504 6505 if ($(this).prev().length && $(this).prev()[0].tagName.toLowerCase()=="script") { 6506 var $prev = $(this).prev().prev(); 6507 } else { 6508 var $prev = $(this).prev(); 6509 } 6510 if (!$prev.hasClass("cms-booking-product-form")) { 6511 $(this).addClass("cms-booking-product-first") 6512 } 6513 }); 6514 var $f; 6515 $(".cms-booking-product-form").each(function(){ 6516 if ($(this).hasClass("cms-booking-product-first")) { 6517 $f = $(this); 6518 } 6519 if ($(this).next().length && $(this).next()[0].tagName.toLowerCase()=="script") { 6520 var $next = $(this).next().next(); 6521 } else { 6522 var $next = $(this).next(); 6523 } 6524 if ($next.hasClass("cms-booking-product-form")) { 6525 $(".cms-booking-product",$next).insertBefore($f.find(".cms-booking-product-total")); 6526 $next.addClass("toremove"); 6527 } else { 6528 return false; 6529 } 6530 }); 6531 $(".toremove").remove(); 6532 } 6533 makeCombinedDays(); 6534 6535 $(".cms-booking-product-form").submit(function(){ 6536 var $form=$(this); 6537 var fail=false; 6538 $(".personal-details-form:visible .required:visible",$(this)).each(function(){ 6539 if ($(this).val()=="") { 6540 fail = true; 6541 } 6542 }); 6543 if (fail) { 6544 alert($form.data('fail-msg')); 6545 return false; 6546 } 6547 $(".personal-details-form:hidden").remove(); 6548 var days = 0; 6549 $(".cms-booking-product-days-input",$(this)).each(function(){ 6550 days = days+JSON.parse($(this).val()).length; 6551 }); 6552 if (days==0) { 6553 $(".cms-booking-product-select-day",$(this)).slideDown(); 6554 return false; 6555 } 6556 }) 6557 $(".cms-booking-combined-dates").on("click",".cms-master-days .cms-booking-product-date",function(e,reapply){ 6558 6559 var $form = $(this).parents(".cms-booking-product-form"); 6560 var $clicked = $(this); 6561 var d = $(this).data("date"); 6562 $(".cms-booking-product-select-day").hide(); 6563 $(".cms-booking-product",$form).each(function(){ 6564 var $prod = $(this); 6565 6566 var qty_adults = parseInt($(".cms-booking-product-normal-qty input",$prod).val()); 6567 var qty_special = parseInt($(".cms-booking-product-special-qty input",$prod).val()); 6568 var qty_children = parseInt($(".cms-booking-product-children-qty input",$prod).val()); 6569 6570 if (isNaN(qty_adults)) { 6571 qty_adults = 0; 6572 } 6573 if (isNaN(qty_special)) { 6574 qty_special = 0; 6575 } 6576 if (isNaN(qty_children)) { 6577 qty_children = 0; 6578 } 6579 var t = qty_adults+qty_special+qty_children; 6580 if (t>0) { 6581 6582 if ($clicked.hasClass("cms-booking-product-selected") && typeof reapply === 'undefined') { 6583 $(".cms-booking-product-date[data-date='"+d+"']",$prod).trigger("click",false); 6584 } else { 6585 $(".cms-booking-product-date[data-date='"+d+"']",$prod).trigger("click",true); 6586 } 6587 6588 } 6589 }); 6590 $("input",$(".cms-master-days .cms-booking-product-selected",$form)).prop("checked", false); 6591 6592 $(".cms-master-days .cms-booking-product-selected",$form).removeClass("cms-booking-product-selected"); 6593 $(".cms-booking-product-date.cms-booking-product-selected:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)",$form).each(function(){ 6594 var d = $(this).data('date'); 6595 $("input",$(".cms-master-days .cms-booking-product-date[data-date='"+d+"']",$form)).prop("checked", true); 6596 $(".cms-master-days .cms-booking-product-date[data-date='"+d+"']",$form).addClass("cms-booking-product-selected"); 6597 }); 6598 }); 6599 $(".cms-booking-product-dates:not(.cms-master-days .cms-booking-product-dates)").hide(); 6600 6601 6602 $(".cms-booking-product-qty input").change(function(){ 6603 6604 cmsUpdateBookingPrices(); 6605 cmsBookingReapply(); 6606 setTimeout(function () { 6607 cmsUpdateBookingPrices(); 6608 }, 10); 6609 6610 }); 6611 $(".cms-booking-product-qty input").keyup(function(){ 6612 cmsUpdateBookingPrices(); 6613 cmsBookingReapply(); 6614 setTimeout(function () { 6615 cmsUpdateBookingPrices(); 6616 }, 10); 6617 saveBookingProdState(); 6618 }); 6619 $(".cms-booking-qty-plus").click(function(){ 6620 /* 6621 if ($(".persondetailsmaseter",$(this).parents('.cms-booking-product')).length) { 6622 if ($(".personal-details-forms .personal-details-form:hidden",$(this).parents('.cms-booking-product')).length) { 6623 6624 $(".personal-details-forms .personal-details-form:hidden:first",$(this).parents('.cms-booking-product ')).show(); 6625 } else { 6626 $(".personal-details-forms",$(this).parents('.cms-booking-product')).append($(".persondetailsmaseter > *",$(this).parents('.cms-booking-product')).clone()); 6627 } 6628 } 6629 */ 6630 var val = parseInt($("input",$(this).parent()).val()); 6631 val = val+1; 6632 $("input",$(this).parent()).val(val); 6633 6634 cmsUpdateBookingPrices(); 6635// cmsBookingReapply(); 6636 6637 setTimeout(function () { 6638// cmsUpdateBookingPrices(); 6639 }, 10); 6640// saveBookingProdState(); 6641 }); 6642 $(".cms-booking-qty-minus").click(function(){ 6643 6644 var val = parseInt($("input",$(this).parent()).val()); 6645 if (val>0) { 6646 //if ($(".persondetailsmaseter",$(this).parents('.cms-booking-product')).length) { 6647 // $(".personal-details-forms .personal-details-form:visible:last",$(this).parents('.cms-booking-product')).hide(); 6648 //} 6649 6650 } 6651 val = val-1; 6652 if (val<0) { 6653 val=0; 6654 } 6655 6656 $("input",$(this).parent()).val(val); 6657 cmsUpdateBookingPrices(); 6658 cmsBookingReapply(); 6659 //setPersonalNames($(this).parents('.cms-booking-product')); 6660 6661 setTimeout(function () { 6662 cmsUpdateBookingPrices(); 6663 }, 10); 6664 saveBookingProdState(); 6665 }); 6666 loadBookingProdForms(); 6667 $(".cms-booking-products-qtys.selectone .cms-booking-qty-plus").trigger("click"); 6668 $(".cms-booking-products-qtys.selectone").hide(); 6669 $(".cms-booking-product-dates-inner").on("scroll",function(){ 6670 if (!$(this).parents("form").hasClass("cms-booking-combined-dates")) { 6671 var sl = $(this).scrollLeft(); 6672 $(".cms-booking-product-dates-inner").scrollLeft(sl); 6673 } 6674 6675 }).on("click",".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date)",function(e,addOverride){ 6676 var $form = $(this).parents(".cms-booking-product-form"); 6677 var combined = ($(this).parents(".cms-booking-combined-dates").length?true:false); 6678 if ($(this).hasClass("cms-booking-product-available") && !$(this).hasClass("cms-booking-product-history")) { 6679 if ($(this).hasClass("cms-booking-product-selected")) { 6680 var addOrRemove = false;
6681 } else { 6682 var addOrRemove = true; 6683 } 6684 if (typeof addOverride !== 'undefined') { 6685 if (addOverride) { 6686 addOrRemove=true; 6687 } else { 6688 addOrRemove=false; 6689 } 6690 } 6691 if ($(this).hasClass("block-start")) { 6692 $(this).nextUntil($(".block-end")).each(function(){ 6693 $(this).toggleClass("cms-booking-product-selected",addOrRemove); 6694 if (combined) { 6695 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 6696 } 6697 6698 }).next().toggleClass("cms-booking-product-selected",addOrRemove); 6699 6700 if (combined) { 6701 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).nextUntil($(".block-end")).next().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 6702 } 6703 6704 if ($(this).next().hasClass("block-end")) { 6705 $(this).next().toggleClass("cms-booking-product-selected",addOrRemove); 6706 if (combined) { 6707 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).next().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 6708 } 6709 } 6710 } 6711 if ($(this).hasClass("block-middle")) { 6712 $(this).nextUntil($(".block-end")).each(function(){ 6713 $(this).toggleClass("cms-booking-product-selected",addOrRemove); 6714 if (combined) { 6715 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 6716 } 6717 6718 }).next().toggleClass("cms-booking-product-selected",addOrRemove); 6719 6720 if (combined) { 6721 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).nextUntil($(".block-end")).next().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 6722 } 6723 6724 if ($(this).next().hasClass("block-end")) { 6725 $(this).next().toggleClass("cms-booking-product-selected",addOrRemove); 6726 if (combined) { 6727 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).next().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 6728 } 6729 } 6730 $(this).prevUntil($(".block-start")).each(function(){ 6731 $(this).toggleClass("cms-booking-product-selected",addOrRemove); 6732 if (combined) { 6733 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 6734 } 6735 }).prev().toggleClass("cms-booking-product-selected",addOrRemove); 6736 6737 if (combined) { 6738 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).prevUntil($(".block-start")).prev().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 6739 } 6740 6741 6742 if ($(this).prev().hasClass("block-start")) { 6743 $(this).prev().toggleClass("cms-booking-product-selected",addOrRemove); 6744 if (combined) { 6745 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).prev().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 6746 } 6747 } 6748 } 6749 if ($(this).hasClass("block-end")) { 6750 $(this).prevUntil($(".block-start")).each(function(){ 6751 $(this).toggleClass("cms-booking-product-selected",addOrRemove); 6752 if (combined) { 6753 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 6754 } 6755 6756 }).prev().toggleClass("cms-booking-product-selected",addOrRemove); 6757 6758 if (combined) { 6759 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).prevUntil($(".block-start")).prev().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 6760 } 6761 6762 6763 if ($(this).prev().hasClass("block-start")) { 6764 $(this).prev().toggleClass("cms-booking-product-selected",addOrRemove); 6765 if (combined) { 6766 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).data("date")+"']",$form).prev().toggleClass("cms-booking-product-selected",addOrRemove); 6767 } 6768 } 6769 } 6770 6771 $(this).toggleClass("cms-booking-product-selected",addOrRemove); 6772 if (combined) { 6773 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 6774 } 6775 } 6776 cmsUpdateBookingPrices(); 6777 }); 6778 function loadCMSBookingProdMonth(month,year,id,$target) { 6779 6780 $.getJSON( "/actions/ShowBookingProdMonth/", "month="+month+"&year="+year+"&id="+id, function( data ) { 6781 6782 $target.parents(".cms-booking-product-dates").data("month",month); 6783 if (month==$target.parents(".cms-booking-product-dates").data("load-month")) { 6784 $target.parents(".cms-booking-product-dates").find(".cms-booking-product-prev-month").css("visibility","hidden"); 6785 6786 } else { 6787 $target.parents(".cms-booking-product-dates").find(".cms-booking-product-prev-month").css("visibility","visible"); 6788 } 6789 $target.parents(".cms-booking-product-dates").data("next-month",data['next_month']); 6790 $target.parents(".cms-booking-product-dates").data("next-month-year",data['next_month_year']); 6791 $target.parents(".cms-booking-product-dates").data("prev-month",data['prev_month']); 6792 $target.parents(".cms-booking-product-dates").data("prev-month-year",data['prev_month_year']); 6793 $target.parents(".cms-booking-product-dates").find("h3").html(month+" "+year); 6794 $target.parents(".cms-booking-product-dates").find(".cms-booking-product-next-month").html(data['next_month']+" →"); 6795 $target.parents(".cms-booking-product-dates").find(".cms-booking-product-prev-month").html("← "+data['prev_month']); 6796 var type = $target.parents(".cms-booking-product-dates").data("product-type"); 6797 var spaces = $target.parents(".cms-booking-product-dates").data("product-spaces"); 6798 var modules = $target.parents(".cms-booking-product-dates").data("product-modules"); 6799 6800 var items = []; 6801 var $p = $target.parents(".cms-booking-product-dates"); 6802 $(".cms-booking-product-date",$p).hide(); 6803 if ($(".date-month-"+month+"-"+year,$p).length) { 6804 if($('body').hasClass('booking-month-at-time')||$target.parents('.cms-booking-combined-dates').hasClass('booking-month-at-time')) { 6805 $(".date-month-"+month+"-"+year,$p).show(); 6806 } else { 6807 $(".date-month-"+month+"-"+year+":not(.cms-booking-filler)",$p).show(); 6808 } 6809 } else { 6810 6811 $.each( data['days'], function( key, val ) { 6812 var notavailable=false; 6813 if (!$("body").hasClass('accessible-mode')) { 6814 if (val[3]=="prevMonth"||val[3]=="nextMonth") { 6815 6816 items.push( "<div class=\"cms-booking-product-date cms-booking-filler cms-booking-product-history date-month-"+month+"-"+year+"\" data-date=\""+val[7]+"-"+val[6]+"+"+val[5]+"\">" 6817 +"<span class=\"cms-booking-product-date-weekday\">"+val[8]+"</span>" 6818 +"<span class=\"cms-booking-product-date-day\">"+val[5]+"</span>" 6819 +"</div>" ); 6820 } 6821 6822 } 6823 6824 if ( 6825 val[3]!="prevMonth" 6826 && val[3]!="nextMonth" 6827 && ( 6828 ( 6829 val[6]==$target.parents(".cms-booking-product-dates").data("load-month") 6830 && val[7]==$target.parents(".cms-booking-product-dates").data("load-year") 6831 && val[5]>=$target.parents(".cms-booking-product-dates").data("load-day") 6832 ) 6833 || 6834 ( 6835 val[6]!=$target.parents(".cms-booking-product-dates").data("load-month") 6836 || val[7]!=$target.parents(".cms-booking-product-dates").data("load-year") 6837 ) 6838 ) 6839 ) 6840 { 6841 var d = ""; 6842 if (type==2) { 6843 var available_modules = modules - val[4]['booked_modules']; 6844 6845 if (available_modules>0) { 6846 d = d+" data-available=\""+spaces+"\""; 6847 } else { 6848 d = d+" data-available=\"0\""; 6849 notavailable =true; 6850 } 6851 } else { 6852 var available = spaces - val[4]['booked_individuals']; 6853 d = d+" data-available=\""+available+"\""; 6854 if (available<=0) { 6855 notavailable = true; 6856 } 6857 } 6858 var c = ""; 6859 if (val[8]=="Mon") { 6860 c = c+" cms-booking-date-mon"; 6861 } 6862 if ("-"+val[4]['price_normal']+"-"!="-0-" && notavailable===false) { 6863 c = c+" cms-booking-product-available"; 6864 } 6865 if (val[4].block_start!=0) { 6866 c = c+" block-start"; 6867 } 6868 if (val[4].block_middle!=0) { 6869 c = c+" block-middle"; 6870 } 6871 if (val[4].block_end!=0) {
6872 c = c+" block-end"; 6873 } 6874 6875 6876 d = d+" data-minimum-price-per-place=\""+val[4]['minimum_price_per_place']+"\""; 6877 d = d+" data-price-normal=\""+val[4]['price_normal']+"\""; 6878 d = d+" data-min-days=\""+val[4]['min_days']+"\""; 6879 d = d+" data-price-special=\""+val[4]['price_special']+"\""; 6880 d = d+" data-price-children=\""+val[4]['price_children']+"\""; 6881 d = d+" data-date=\""+val[1]+"\""; 6882 if ($('body').hasClass("accessible-mode")) { 6883 var i = "<div class=\"cms-booking-product-date date-month-"+val[6]+"-"+val[7]+" "+c+"\" "+d+">"; 6884 i+="<label for=\"day_"+val[8]+"_"+val[5]+"_"+val[6]+"_"+val[7]+"\"><input type=\"checkbox\" "; 6885 6886 if (val[4]['price_normal']!=0 && notavailable===false) {}else{ 6887 i+="disabled"; 6888 } 6889 i+=" name=\"day_"+val[8]+"_"+val[5]+"_"+val[6]+"_"+val[7]+"\" id=\"day_"+val[8]+"_"+val[5]+"_"+val[6]+"_"+val[7]+"\" /> <span class=\"available-label\">Available:</span> <span class=\"unavailable-label\">Unavailable:</span> "+val[8]+" "+val[5]+" "+val[6]+" "+val[7]+"</label></div>"; 6890 6891 items.push(i); 6892 } else { 6893 items.push( "<div class=\"cms-booking-product-date date-month-"+val[6]+"-"+val[7]+" "+c+"\" "+d+"><span class=\"cms-booking-product-date-weekday\">"+val[8]+"</span>" 6894 +"<span class=\"cms-booking-product-date-day\">"+val[5]+" </span></div>" ); 6895 6896 } 6897 } 6898 }); 6899 $target.append(items.join( "" )); 6900 } 6901 $target.scrollLeft(0); 6902 if (month==$target.parents(".cms-booking-product-dates").data("load-month")) { 6903 var ol = $(".cms-booking-product-date:not(.cms-booking-product-history):first",$target).position().left; 6904 $target.animate({scrollLeft:ol},500); 6905 } 6906 makeCombinedDays(); 6907 cmsUpdateBookingPrices(); 6908 6909 }); 6910 } 6911 $(".cms-booking-combined-dates").on("click",".cms-booking-product-prev-month",function(){ 6912 $(".cms-booking-product-prev-month:not(.cms-master-days .cms-booking-product-prev-month)").each(function(){ 6913 var $p = $(this).parents(".cms-booking-product-dates"); 6914 var month = $p.data("prev-month"); 6915 var year = $p.data("prev-month-year"); 6916 var id = $p.data("product-id"); 6917 loadCMSBookingProdMonth(month,year,id,$(".cms-booking-product-dates-inner",$p)); 6918 }); 6919 return false; 6920 }); 6921 $(".cms-booking-combined-dates").on("click",".cms-booking-product-next-month",function(){ 6922 $(".cms-booking-product-next-month:not(.cms-master-days .cms-booking-product-next-month)").each(function(){ 6923 var $p = $(this).parents(".cms-booking-product-dates"); 6924 var month = $p.data("next-month"); 6925 var year = $p.data("next-month-year"); 6926 var id = $p.data("product-id"); 6927 loadCMSBookingProdMonth(month,year,id,$(".cms-booking-product-dates-inner",$p)); 6928 }); 6929 return false; 6930 }); 6931 /* 6932 if ($(".formUsedInCheckout").length && $("#paymentGatewayForm").length) { 6933 $("#paymentGatewayForm").submit(function(){ 6934 6935 if ($(this).hasClass('formInCheckoutOK')) { 6936 if (typeof ga === 'function') { 6937 ga('send', 'event', 'Checkout', 'Gone to Payment Gateway', $(this).attr("action")); 6938 } 6939 if (typeof $(this).data("datalayer-total")!="undefined") { 6940 if (readCookie("transid")==$(this).data('transid')) { 6941 var transid = readCookie("transidvalue"); 6942 } else { 6943 createCookie("transid",$(this).data('transid')); 6944 var transid = Math.floor(Math.random()*1000000); 6945 createCookie("transidvalue",transid); 6946 } 6947 dataLayer.push({ 6948 "transactionId":transid 6949 ,"transactionTotal":parseFloat($(this).data('datalayer-total')) 6950 ,"transactionTax":parseFloat($(this).data('datalayer-tax')) 6951 ,"transactionShipping":parseFloat($(this).data('datalayer-shipping')) 6952 // ,"coupon":$(this).data('datalayer-coupon') 6953 // ,"discount":parseFloat($(this).data('datalayer-discount')) 6954 // ,"gateway":$(this).data('datalayer-gateway') 6955 }); 6956 } 6957 return true; 6958 } else { 6959 $(".form.formUsedInCheckout").submit(); 6960 6961 6962 return false; 6963 } 6964 }); 6965 } 6966 */ 6967 if (!$(".formUsedInCheckout").length && $("#paymentGatewayForm").length) { 6968 $("#paymentGatewayForm").submit(function(){ 6969 if (typeof ga === 'function') { 6970 ga('send', 'event', 'Checkout', 'Gone to Payment Gateway', $(this).attr("action")); 6971 } 6972 if (typeof $(this).data("datalayer-total")!="undefined") { 6973 dataLayer.push({ 6974 "event":"checkoutGoingToGateway" 6975 ,"total":parseFloat($(this).data('datalayer-total')) 6976 ,"tax":parseFloat($(this).data('datalayer-tax')) 6977 ,"shipping":parseFloat($(this).data('datalayer-shipping')) 6978 ,"coupon":$(this).data('datalayer-coupon') 6979 ,"discount":parseFloat($(this).data('datalayer-discount')) 6980 ,"gateway":$(this).data('datalayer-gateway') 6981 }); 6982 } 6983 }); 6984 } 6985 $("body").click(function(e){ 6986 if (!$(e.target).parents("#defaultDatepicker").length && !$(e.target).hasClass("default_datepicker")) { 6987 $("#defaultDatepicker").remove(); 6988 $("body").removeClass("showingDefaultDatepicker"); 6989 $(".default_datepicker_target").removeClass("default_datepicker_target"); 6990 } 6991 }); 6992 $(".default_datepicker").click(function(){ 6993 $(this).addClass("default_datepicker_target"); 6994 $("body").addClass("showingDefaultDatepicker"); 6995 $("#defaultDatepicker").remove(); 6996 var $dp = $("<div id='defaultDatepicker'></div>"); 6997 var ot = $(this).offset().top + $(this).outerHeight() + 3; 6998 var ol = $(this).offset().left; 6999 $dp.css({ 7000 top:ot+"px" 7001 ,left:ol+"px" 7002 ,background:"white" 7003 ,padding:"5px" 7004 ,position:"absolute" 7005 ,zIndex:3000 7006 ,border:"1px solid #ddd" 7007 ,borderRadius:"5px" 7008 ,maxWidth:"250px" 7009 }); 7010 $dp.appendTo($("body")); 7011 if ($(this).hasClass("prevent_past")) { 7012 var more = "?cutoff="+$(this).data('cutoff')+"&timezone="+$(this).data("timezone"); 7013 } else { 7014 var more = ""; 7015 } 7016 $("#defaultDatepicker").load("/actions/DefaultDatepicker/"+more,function(){ 7017 assignDatepickerCal(); 7018 }); 7019 }); 7020 $(".separateOptionStock").change(function(){ 7021 var code = $(this).attr("data-product-code"); 7022 var stock = $("option",$(this)).filter(":selected").attr("data-stock"); 7023 $("#updateWithOptionStock"+code).text(stock); 7024 }); 7025 $('.giftcard_multi').change(function() { 7026 $('.giftcard_multi_input',$(this).parents('form')).val($(this).find('option:selected').data('value')); 7027 }); 7028 $('.giftcard_multi_input,.giftcard_input').change(function() { 7029 if (parseFloat($(this).val())<parseFloat($(this).data('min-value'))) { 7030 $(this).val($(this).data('min-value')); 7031 } 7032 }); 7033if ($("html").attr("lang")!="") { 7034 lang = "?language="+$("html").attr("lang"); 7035 langAppend = "&language="+$("html").attr("lang"); 7036} 7037$(".lightbox").click(function(){ 7038 var clicked = $(this); 7039 var parentsId = $(this).parents(".galleryWrapper").attr("id"); 7040 $(".lightboxCurrent").removeClass("lightboxCurrent"); 7041 clicked.addClass("lightboxCurrent"); 7042 $('embed, object, select',"#wrapper").css({ 'visibility' : 'hidden' }); 7043 var formName = $(this).parents(".galleryWrapper").attr("id").replace(/gallery/, ""); 7044 $('body').append("<div id='lightboxOverlay'></div><div id='lightboxOuter'><div id='lightboxContainer'><div id='lightboxExtra1'><div id='lightboxExtra2'><div id='lightboxExtra3'><div id='lightboxClose'></div><div id='lightboxPrev'></div><div id='lightboxNext'></div><div id='lightboxInner'></div></div></div></div></div><div id='lightboxStuff'><div id='lightboxShop'></div><div id='lightboxCaption'></div></div></div>"); 7045 $(".shopGalleryVariant[name="+formName+"]").appendTo("#lightboxShop").fadeIn(); 7046 $("#lightboxShop form").append("<input type='hidden' name='pic_url' value='' />"); 7047 $("#lightboxOverlay").css("height",$(document).height()+"px");
7048 $("#lightboxOuter").css("top",$(document).scrollTop()+100+"px"); 7049 7050 $("#lightboxContainer").css({ 7051 opacity: 0, 7052 display: "block" 7053 }); 7054 $("#lightboxContainer").animate({ 7055 opacity: 1 7056 }); 7057 function showImage (href,title) { 7058 function cont4 () { 7059 function cont3 () { 7060 showNav(); 7061 $("."+formName+"input").val(title); 7062 $("input[name=pic_url]",$("#lightboxShop form")).val(href); 7063 $("#lightboxCaption").html("<p>"+title+"</p>"); 7064 $("#lightboxInner").html('<img src="'+href+'" alt="'+title+'" style="display:none"/>'); 7065 $("#lightboxInner img").css({ 7066 opacity: 0, 7067 display: "block" 7068 }); 7069 $("#lightboxInner img").animate({ 7070 opacity: 1 7071 },300); 7072 } 7073 $('<img src="'+href+'" style="display:none;"/>').appendTo("body").load(function(){ 7074 $("#lightboxContainer").animate({ 7075 width: $(this).width(), 7076 height: $(this).height() 7077 },300,cont3); 7078 $("#lightboxStuff").animate({ 7079 width: $(this).width() 7080 },300); 7081 }); 7082 } 7083 $("#lightboxNext,#lightboxPrev,#lightboxClose").fadeOut(300); 7084 $("#lightboxInner img").fadeOut(300,cont4); 7085 } 7086 function showNav () { 7087 $("#lightboxClose").fadeIn(); 7088 $("#lightboxClose").unbind().click(function(){ 7089 function cont2 () { 7090 $("#lightboxOverlay,#lightboxOuter").remove(); 7091 $('embed, object, select',"#wrapper").css({ 'visibility' : 'visible' }); 7092 7093 } 7094 $("#lightboxOverlay,#lightboxOuter").fadeOut(300,cont2); 7095 $(".shopGalleryVariant[name="+formName+"]").appendTo("body").hide(); 7096 }); 7097 var totalEls = $("#"+parentsId+" .lightbox").length-1; 7098 var clickedEl = 0; 7099 var currentEl = 0; 7100 $("#"+parentsId+" .lightbox").each(function(){ 7101 if ($(this).hasClass("lightboxCurrent")) { 7102 clickedEl = currentEl; 7103 } 7104 currentEl++; 7105 }); 7106 if (clickedEl!=totalEls) { 7107 $("#lightboxNext").fadeIn(); 7108 $("#lightboxNext").unbind().click(function(){ 7109 var stop = 0; 7110 var stop2 = 0; 7111 $("#"+parentsId+" .lightbox").each(function(){ 7112 stop++; 7113 if ($(this).hasClass("lightboxCurrent")) { 7114 stop2 = stop; 7115 } 7116 }); 7117 var stop3 = 0; 7118 $("#"+parentsId+" .lightbox").each(function(){ 7119 if (stop3 == stop2) { 7120 $(".lightboxCurrent").removeClass("lightboxCurrent"); 7121 $(this).addClass("lightboxCurrent"); 7122 var href = $(this).attr("href"); 7123 var title = $(this).attr("title"); 7124 showImage(href,title); 7125 } 7126 stop3++; 7127 }); 7128 }); 7129 } 7130 if (clickedEl!=0) { 7131 $("#lightboxPrev").fadeIn(); 7132 $("#lightboxPrev").unbind().click(function(){ 7133 var prev = 0; 7134 var clicked = 0; 7135 $("#"+parentsId+" .lightbox").each(function(){ 7136 if ($(this).hasClass("lightboxCurrent")) { 7137 current = prev; 7138 } 7139 prev++; 7140 }); 7141 var prev = 0; 7142 $("#"+parentsId+" .lightbox").each(function(){ 7143 if (prev==current-1) { 7144 $(".lightboxCurrent").removeClass("lightboxCurrent"); 7145 $(this).addClass("lightboxCurrent"); 7146 var href = $(this).attr("href"); 7147 var title = $(this).attr("title"); 7148 showImage(href,title); 7149 } 7150 prev++; 7151 }); 7152 }); 7153 } 7154 } 7155 function cont () { 7156 $("."+formName+"input").val(clicked.attr("title")); 7157 $("input[name=pic_url]",$("#lightboxShop form")).val(clicked.attr("href")); 7158 $("#lightboxStuff").css("width",preloader.width+"px"); 7159 $("#lightboxCaption").html("<p>"+clicked.attr("title")+"</p>"); 7160 $("#lightboxStuff").fadeIn(); 7161 $("#lightboxInner").html('<img src="'+clicked.attr("href")+'" alt="'+clicked.attr("title")+'" style="display:none"/>'); 7162 $("#lightboxInner img").css({ 7163 opacity: 0, 7164 display: "block" 7165 }); 7166 $("#lightboxInner img").animate({ 7167 opacity: 1 7168 },300); 7169 7170 showNav(); 7171 7172 } 7173 7174 var preloader = new Image(); 7175 7176 preloader.onload = function() { 7177 $("#lightboxContainer").animate({ 7178 width: preloader.width, 7179 height: preloader.height 7180 },300,cont); 7181 }; 7182 preloader.src = clicked.attr("href"); 7183 return false; 7184}); 7185function assignDatepickerCal () { 7186 $("#defaultDatepicker td:not(.unavailable)").click(function(){ 7187 $(".default_datepicker_target").val($(this).attr("data-date")).change(); 7188 $("#defaultDatepicker").remove(); 7189 $("body").removeClass("showingDefaultDatepicker"); 7190 $(".default_datepicker_target").removeClass("default_datepicker_target"); 7191 return false;
7192 }); 7193 $("#datepicker_next_month").click(function(){ 7194 month = $("#datepicker_next_month_val").val(); 7195 year = $("#datepicker_next_month_year").val(); 7196 7197 if ($(".default_datepicker_target").hasClass("prevent_past")) { 7198 var more = "&cutoff="+$(".default_datepicker_target").data('cutoff')+"&timezone="+$(".default_datepicker_target").data("timezone"); 7199 } else { 7200 var more = ""; 7201 } 7202 7203 $("#defaultDatepicker").load("/actions/DefaultDatepicker/?month="+month+"&year="+year+langAppend+more,function(){ 7204 assignDatepickerCal(); 7205 }); 7206 return false; 7207 }); 7208 $("#datepicker_prev_month").click(function(){ 7209 month = $("#datepicker_prev_month_val").val(); 7210 year = $("#datepicker_prev_month_year").val(); 7211 7212 if ($(".default_datepicker_target").hasClass("prevent_past")) { 7213 var more = "&cutoff="+$(".default_datepicker_target").data('cutoff')+"&timezone="+$(".default_datepicker_target").data("timezone"); 7214 } else { 7215 var more = ""; 7216 } 7217 7218 7219 $("#defaultDatepicker").load("/actions/DefaultDatepicker/?month="+month+"&year="+year+langAppend+more,function(){ 7220 assignDatepickerCal(); 7221 }); 7222 return false; 7223 }); 7224} 7225function assignBlogCal() { 7226 $("#blog_next_month").click(function(){ 7227 month = $("#blog_next_month_val").val(); 7228 year = $("#blog_next_month_year").val(); 7229 7230 $("#blogCal").load("/actions/BlogCal/?month="+month+"&year="+year+langAppend+"&"+catAppend,function(){ 7231 assignBlogCal(); 7232 }); 7233 return false; 7234 }); 7235 $("#blog_prev_month").click(function(){ 7236 month = $("#blog_prev_month_val").val(); 7237 year = $("#blog_prev_month_year").val(); 7238 7239 $("#blogCal").load("/actions/BlogCal/?month="+month+"&year="+year+langAppend+"&"+catAppend,function(){ 7240 assignBlogCal(); 7241 }); 7242 return false; 7243 }); 7244} 7245var url = window.location.href; 7246url = url.split("/"); 7247if (lang=="") { 7248 var catPrepend="?"; 7249} else { 7250 var catPrepend="&"; 7251} 7252var catAppend=""; 7253if (url[4]=="category"&&url[5]!="") { 7254 var catAppend="cat="+url[5]; 7255} 7256if (url[7]=="category"&&url[8]!="") { 7257 var catAppend="cat="+url[8]; 7258} 7259if (url[8]=="category"&&url[9]!="") { 7260 var catAppend="cat="+url[9]; 7261} 7262$("#blogCal").load("/actions/BlogCal/"+lang+catPrepend+catAppend,function(){ 7263 assignBlogCal(); 7264}); 7265 7266$("#commentForm").load("/actions/ShowCommentForm/"+lang, function(){ 7267 if (typeof moduleHeights == 'function') { 7268 moduleHeights(); 7269 } 7270 $("#commentFormForm a.submitForm").click(function(){ 7271 $(this).parent().submit(); 7272 return false; 7273 }); 7274 $("#commentFormForm").submit(function(){ 7275 $("#loader").fadeIn(300); 7276 7277 7278 if ($("#name").val() == "") { 7279 $("#name").addClass("error"); 7280 $("#name").animate({ 7281 left: +10 7282 }, 20, function(){ 7283 $("#name").animate({ 7284 left: -20 7285 }, 40, function(){ 7286 $("#name").animate({ 7287 left: +20 7288 }, 40, function(){ 7289 $("#name").animate({ 7290 left: 0 7291 }, 20, function(){ 7292 $("#name").removeClass("error"); 7293 $("#name").focus(); 7294 $("#loader").fadeOut(200); 7295 }); 7296 }); 7297 }); 7298 }); 7299 7300 return false; 7301 7302 7303 } else if ($("#email").val() == "") { 7304 $("#email").addClass('error'); 7305 $("#email").animate({ 7306 left: +10 7307 }, 20, function(){ 7308 $("#email").animate({ 7309 left: -20 7310 }, 40 ,function(){ 7311 $("#email").animate({ 7312 left: +20 7313 }, 40 ,function(){ 7314 $("#email").animate({ 7315 left: -0 7316 }, 20 ,function(){ 7317 $("#email").removeClass('error'); 7318 $("#email").focus(); 7319 7320 }); 7321 }); 7322 }); 7323 }); 7324 $("#loader").fadeOut(200); 7325 7326 return false; 7327 7328 } else if ($("#comment").val() == "") { 7329 $("#comment").addClass('error'); 7330 $("#comment").animate({ 7331 left: +10 7332 }, 20 ,function(){ 7333 $("#comment").animate({ 7334 left: -20 7335 }, 40 ,function(){ 7336 $("#comment").animate({ 7337 left: +20 7338 }, 40 ,function(){ 7339 $("#comment").animate({ 7340 left: -0 7341 }, 20 ,function(){ 7342 $("#comment").removeClass('error'); 7343 $("#comment").focus(); 7344 7345 }); 7346 }); 7347 }); 7348 }); 7349 $("#loader").fadeOut(200); 7350 7351 return false; 7352 } else { 7353 function urlencode( str ) { 7354 // http://kevin.vanzonneveld.net 7355 // + original by: Philip Peterson 7356 // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 7357 // * example 1: urlencode('Kevin van Zonneveld!'); 7358 // * returns 1: 'Kevin+van+Zonneveld%21' 7359 7360 var ret = str; 7361 7362 ret = ret.toString(); 7363 ret = encodeURIComponent(ret); 7364 ret = ret.replace(/%20/g, '+'); 7365 7366 return ret; 7367 } 7368 function htmlentities( s ){ 7369 // http://kevin.vanzonneveld.net 7370 // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 7371 // * example 1: htmlentities('Kevin & van Zonneveld'); 7372 // * returns 1: 'Kevin & van Zonneveld' 7373 7374 var div = document.createElement('div'); 7375 var text = document.createTextNode(s); 7376 div.appendChild(text); 7377 return div.innerHTML; 7378 } 7379 $.ajax({ 7380 type: "GET", 7381 url: "/actions/CheckEmail/", 7382 data: "email="+$("#email").val(), 7383 success: function(msg){ 7384 if (msg == "ok") {
7385 var validEmail = true; 7386 } else { 7387 var validEmail = false; 7388 } 7389 if (validEmail == false) { 7390 $("#emailIncorrect").css("display","block"); 7391 $("#email").addClass('error'); 7392 $("#email").animate({ 7393 left: +10 7394 }, 20 ,function(){ 7395 $("#email").animate({ 7396 left: -20 7397 }, 40 ,function(){ 7398 $("#email").animate({ 7399 left: +20 7400 }, 40 ,function(){ 7401 $("#email").animate({ 7402 left: -0 7403 }, 20 ,function(){ 7404 $("#email").removeClass('error'); 7405 $("#email").focus(); 7406 }); 7407 }); 7408 }); 7409 }); 7410 $("#loader").fadeOut(200); 7411 7412 return false; 7413 7414 } else { 7415 $("#emailIncorrect").css("display","none"); 7416 $.ajax({ 7417 type: "GET", 7418 url: "/actions/AddComment/"+lang, 7419 data: "name="+$("#name").val()+"&email="+$("#email").val()+"&website="+urlencode($("#website").val())+"&comment="+urlencode($("#comment").val())+"&blogId="+$("#blogId").val(), 7420 success: function(msg){ 7421 $('#commentsList').html(msg); 7422 if (typeof moduleHeights == 'function') { 7423 moduleHeights(); 7424 } 7425 $('#name').val(""); 7426 $('#email').val(""); 7427 $('#website').val(""); 7428 $('#comment').val(""); 7429 $("#loader").fadeOut(200); 7430 7431 } 7432 }); 7433 7434 return false; 7435 7436 } 7437 } 7438 }); 7439 return false; 7440 7441 } 7442 return false; 7443 }); 7444}); 7445 7446$("#loginForm").submit(function(){ 7447 pwhash = hex_hmac_sha1(hex_hmac_sha1($("input[name=password]",$(this)).val(),$("#saltInput").val()),$("#timestampInput").val()); 7448 $("#hashInput").val(pwhash); 7449 $("input[name=password]",$(this)).val("") 7450 7451}); 7452 7453if ($(".form").length>0) { 7454 $(".email1,.fakeemail").css({ 7455 "position":"absolute" 7456 ,"top":"-40000px" 7457 ,"left":"-50000px" 7458 }); 7459// $(".fakeemail").hide(); 7460 $(".form:not(.accessible-mode .form)").each(function(){ 7461 $(this).append("<input type='hidden' name='ajax' value='yes'/>"); 7462 }); 7463} 7464$(".form:not(.accessible-mode .form),.formUsedInCheckout").find("input,textarea,select").change(function(){ 7465 $(this).parents(".oktosend").removeClass("oktosend"); 7466}); 7467function invisRecaptcha(token) { 7468 $('.recaptchaSend').ajaxSubmit(optionsForm); 7469} 7470var donedecaptcha=false; 7471$(window).load(function() { 7472 setTimeout(function(){ 7473 if (!donedecaptcha){ 7474 $(".g-recaptchaload").each(function() { 7475 if (!$(this).parents('#popupMessageBoxPopupBox').length&&!$(this).parents('#popupMessageBox').length&&!$(this).parents('#popupMessageContents').length&&!$(this).parents('.popupMessageOnClickContent').length) { 7476 var object = $(this); 7477 var rid = grecaptcha.render(object.attr("id"), { 7478 "sitekey" :$(this).data("sitekey"), 7479 "callback" : function(token) { 7480 object.parents('form').find(".g-recaptcha-response").val(token); 7481 invisRecaptcha(token); 7482 } 7483 }); 7484 $(this).parents('form').attr('recapid',rid); 7485 } 7486 }); 7487 } 7488 donedecaptcha=true; 7489 },100); 7490}); 7491window.invisRecaptcha = invisRecaptcha; 7492bindForms(); 7493function checkLivechat () { 7494 7495 $.ajax({ 7496 type: "GET", 7497 url: "/actions/LivechatStatus/", 7498 success: function(msg){ 7499 if (msg=="online") { 7500 $("#livechat").show(); 7501 if (typeof moduleHeights == 'function') { 7502 moduleHeights(); 7503 } 7504 $(".livechatWidgetOffline").hide(); 7505 $(".livechatWidgetOnline").show(); 7506 } else { 7507 $("#livechat").hide(); 7508 if (typeof moduleHeights == 'function') { 7509 moduleHeights(); 7510 } 7511 $(".livechatWidgetOffline").show(); 7512 $(".livechatWidgetOnline").hide(); 7513 } 7514 } 7515 }); 7516 setTimeout(checkLivechat, 10000); 7517 7518 7519} 7520if ($("meta[name=disablelivechat]").length==0) { checkLivechat(); } 7521 7522$("#miniBasket").load("/actions/ShowMiniBasket/"+lang); 7523 7524$("#startConvo").click(function () { 7525 href = this.href; 7526 var popup = window.open(href,'','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=311,height=349'); 7527 return false; 7528}) 7529$(".shopOptions").change(function(){ 7530 href = $("#"+$(this).attr("id")+"button").attr("href"); 7531 href = href.split("&variant="); 7532 newHref = href[0]+"&variant="+urlencode($(this).val()); 7533 $("#"+$(this).attr("id")+"button").attr("href",newHref); 7534}); 7535if ($(".shopGalleryVariant").length>0) { 7536 $(".shopGalleryVariant").each(function(){ 7537 if ($("#"+$(this).attr("name")+"gallery").length>0) { 7538 7539 $(this).prev().prev().data("prodid",$(this).data("datalayer-productid")); 7540 7541 $("."+$(this).attr("name")+"title").show(); 7542 $(this).appendTo('body'); 7543 $(this).hide(); 7544 } 7545 7546 }); 7547} 7548var refpath = document.referrer.split("?"); 7549var hpath = document.location.href.split("?"); 7550$.ajax({ 7551 type: "GET", 7552 url: "/actions/LogStats/?title="+document.title+"&referrer="+refpath[0]+"&url="+hpath[0] 7553 } 7554); 7555 7556}); 7557 7558 7559 7560 7561/* 7562 * jQuery OwlCarousel v1.3.3 7563 * 7564 * Copyright (c) 2013 Bartosz Wojciechowski 7565 * http://www.owlgraphic.com/owlcarousel/ 7566 * 7567 * Licensed under MIT 7568 * 7569 */ 7570 7571/*JS Lint helpers: */ 7572/*global dragMove: false, dragEnd: false, $, jQuery, alert, window, document */ 7573/*jslint nomen: true, continue:true */ 7574 7575if (typeof Object.create !== "function") { 7576 Object.create = function (obj) { 7577 function F() {} 7578 F.prototype = obj; 7579 return new F(); 7580 }; 7581} 7582(function ($, window, document) { 7583 7584 var Carousel = { 7585 init : function (options, el) { 7586 var base = this; 7587 7588 base.$elem = $(el); 7589 base.options = $.extend({}, $.fn.owlCarousel.options, base.$elem.data(), options); 7590 7591 base.userOptions = options; 7592 base.loadContent(); 7593 }, 7594 7595 loadContent : function () { 7596 var base = this, url; 7597 7598 function getData(data) { 7599 var i, content = ""; 7600 if (typeof base.options.jsonSuccess === "function") { 7601 base.options.jsonSuccess.apply(this, [data]); 7602 } else { 7603 for (i in data.owl) { 7604 if (data.owl.hasOwnProperty(i)) { 7605 content += data.owl[i].item; 7606 } 7607 } 7608 base.$elem.html(content); 7609 } 7610 base.logIn(); 7611 } 7612 7613 if (typeof base.options.beforeInit === "function") { 7614 base.options.beforeInit.apply(this, [base.$elem]); 7615 } 7616 7617 if (typeof base.options.jsonPath === "string") { 7618 url = base.options.jsonPath; 7619 $.getJSON(url, getData); 7620 } else { 7621 base.logIn(); 7622 } 7623 }, 7624 7625 logIn : function () { 7626 var base = this; 7627 7628 base.$elem.data("owl-originalStyles", base.$elem.attr("style")); 7629 base.$elem.data("owl-originalClasses", base.$elem.attr("class")); 7630 7631 base.$elem.css({opacity: 0}); 7632 base.orignalItems = base.options.items; 7633 base.checkBrowser();
7634 base.wrapperWidth = 0; 7635 base.checkVisible = null; 7636 base.setVars(); 7637 }, 7638 7639 setVars : function () { 7640 var base = this; 7641 if (base.$elem.children().length === 0) {return false; } 7642 base.baseClass(); 7643 base.eventTypes(); 7644 base.$userItems = base.$elem.children(); 7645 base.itemsAmount = base.$userItems.length; 7646 base.wrapItems(); 7647 base.$owlItems = base.$elem.find(".owl-item"); 7648 base.$owlWrapper = base.$elem.find(".owl-wrapper"); 7649 base.playDirection = "next"; 7650 base.prevItem = 0; 7651 base.prevArr = [0]; 7652 base.currentItem = 0; 7653 base.customEvents(); 7654 base.onStartup(); 7655 }, 7656 7657 onStartup : function () { 7658 var base = this; 7659 base.updateItems(); 7660 base.calculateAll(); 7661 base.buildControls(); 7662 base.updateControls(); 7663 base.response(); 7664 base.moveEvents(); 7665 base.stopOnHover(); 7666 base.owlStatus(); 7667 7668 if (base.options.transitionStyle !== false) { 7669 base.transitionTypes(base.options.transitionStyle); 7670 } 7671 if (base.options.autoPlay === true) { 7672 base.options.autoPlay = 5000; 7673 } 7674 base.play(); 7675 7676 base.$elem.find(".owl-wrapper").css("display", "block"); 7677 7678 if (!base.$elem.is(":visible")) { 7679 base.watchVisibility(); 7680 } else { 7681 base.$elem.css("opacity", 1); 7682 } 7683 base.onstartup = false; 7684 base.eachMoveUpdate(); 7685 if (typeof base.options.afterInit === "function") { 7686 base.options.afterInit.apply(this, [base.$elem]); 7687 } 7688 }, 7689 7690 eachMoveUpdate : function () { 7691 var base = this; 7692 7693 if (base.options.lazyLoad === true) { 7694 base.lazyLoad(); 7695 } 7696 if (base.options.autoHeight === true) { 7697 base.autoHeight(); 7698 } 7699 base.onVisibleItems(); 7700 7701 if (typeof base.options.afterAction === "function") { 7702 base.options.afterAction.apply(this, [base.$elem]); 7703 } 7704 }, 7705 7706 updateVars : function () { 7707 var base = this; 7708 if (typeof base.options.beforeUpdate === "function") { 7709 base.options.beforeUpdate.apply(this, [base.$elem]); 7710 } 7711 base.watchVisibility(); 7712 base.updateItems(); 7713 base.calculateAll(); 7714 base.updatePosition(); 7715 base.updateControls(); 7716 base.eachMoveUpdate(); 7717 if (typeof base.options.afterUpdate === "function") { 7718 base.options.afterUpdate.apply(this, [base.$elem]); 7719 } 7720 }, 7721 7722 reload : function () { 7723 var base = this; 7724 window.setTimeout(function () { 7725 base.updateVars(); 7726 }, 0); 7727 }, 7728 7729 watchVisibility : function () { 7730 var base = this; 7731 7732 if (base.$elem.is(":visible") === false) { 7733 base.$elem.css({opacity: 0}); 7734 window.clearInterval(base.autoPlayInterval); 7735 window.clearInterval(base.checkVisible); 7736 } else { 7737 return false; 7738 } 7739 base.checkVisible = window.setInterval(function () { 7740 if (base.$elem.is(":visible")) { 7741 base.reload(); 7742 base.$elem.animate({opacity: 1}, 200); 7743 window.clearInterval(base.checkVisible); 7744 } 7745 }, 500); 7746 }, 7747 7748 wrapItems : function () { 7749 var base = this; 7750 base.$userItems.wrapAll("<div class=\"owl-wrapper\">").wrap("<div class=\"owl-item\"></div>"); 7751 base.$elem.find(".owl-wrapper").wrap("<div class=\"owl-wrapper-outer\">"); 7752 base.wrapperOuter = base.$elem.find(".owl-wrapper-outer"); 7753 base.$elem.css("display", "block"); 7754 }, 7755 7756 baseClass : function () { 7757 var base = this, 7758 hasBaseClass = base.$elem.hasClass(base.options.baseClass), 7759 hasThemeClass = base.$elem.hasClass(base.options.theme); 7760 7761 if (!hasBaseClass) { 7762 base.$elem.addClass(base.options.baseClass); 7763 } 7764 7765 if (!hasThemeClass) { 7766 base.$elem.addClass(base.options.theme); 7767 } 7768 }, 7769 7770 updateItems : function () { 7771 var base = this, width, i; 7772 7773 if (base.options.responsive === false) { 7774 return false;
7775 } 7776 if (base.options.singleItem === true) { 7777 base.options.items = base.orignalItems = 1; 7778 base.options.itemsCustom = false; 7779 base.options.itemsDesktop = false; 7780 base.options.itemsDesktopSmall = false; 7781 base.options.itemsTablet = false; 7782 base.options.itemsTabletSmall = false; 7783 base.options.itemsMobile = false; 7784 return false; 7785 } 7786 7787 width = $(base.options.responsiveBaseWidth).width(); 7788 7789 if (width > (base.options.itemsDesktop[0] || base.orignalItems)) { 7790 base.options.items = base.orignalItems; 7791 } 7792 if (base.options.itemsCustom !== false) { 7793 //Reorder array by screen size 7794 base.options.itemsCustom.sort(function (a, b) {return a[0] - b[0]; }); 7795 7796 for (i = 0; i < base.options.itemsCustom.length; i += 1) { 7797 if (base.options.itemsCustom[i][0] <= width) { 7798 base.options.items = base.options.itemsCustom[i][1]; 7799 } 7800 } 7801 7802 } else { 7803 7804 if (width <= base.options.itemsDesktop[0] && base.options.itemsDesktop !== false) { 7805 base.options.items = base.options.itemsDesktop[1]; 7806 } 7807 7808 if (width <= base.options.itemsDesktopSmall[0] && base.options.itemsDesktopSmall !== false) { 7809 base.options.items = base.options.itemsDesktopSmall[1]; 7810 } 7811 7812 if (width <= base.options.itemsTablet[0] && base.options.itemsTablet !== false) { 7813 base.options.items = base.options.itemsTablet[1]; 7814 } 7815 7816 if (width <= base.options.itemsTabletSmall[0] && base.options.itemsTabletSmall !== false) { 7817 base.options.items = base.options.itemsTabletSmall[1]; 7818 } 7819 7820 if (width <= base.options.itemsMobile[0] && base.options.itemsMobile !== false) { 7821 base.options.items = base.options.itemsMobile[1]; 7822 } 7823 } 7824 7825 //if number of items is less than declared 7826 if (base.options.items > base.itemsAmount && base.options.itemsScaleUp === true) { 7827 base.options.items = base.itemsAmount; 7828 } 7829 }, 7830 7831 response : function () { 7832 var base = this, 7833 smallDelay, 7834 lastWindowWidth; 7835 7836 if (base.options.responsive !== true) { 7837 return false; 7838 } 7839 lastWindowWidth = $(window).width(); 7840 7841 base.resizer = function () { 7842 if ($(window).width() !== lastWindowWidth) { 7843 if (base.options.autoPlay !== false) { 7844 window.clearInterval(base.autoPlayInterval); 7845 } 7846 window.clearTimeout(smallDelay); 7847 smallDelay = window.setTimeout(function () { 7848 lastWindowWidth = $(window).width(); 7849 base.updateVars(); 7850 }, base.options.responsiveRefreshRate); 7851 } 7852 }; 7853 $(window).resize(base.resizer); 7854 }, 7855 7856 updatePosition : function () { 7857 var base = this; 7858 base.jumpTo(base.currentItem); 7859 if (base.options.autoPlay !== false) { 7860 base.checkAp(); 7861 } 7862 }, 7863 7864 appendItemsSizes : function () { 7865 var base = this, 7866 roundPages = 0, 7867 lastItem = base.itemsAmount - base.options.items; 7868 7869 base.$owlItems.each(function (index) { 7870 var $this = $(this); 7871 $this 7872 .css({"width": base.itemWidth}) 7873 .data("owl-item", Number(index)); 7874 7875 if (index % base.options.items === 0 || index === lastItem) { 7876 if (!(index > lastItem)) { 7877 roundPages += 1; 7878 } 7879 } 7880 $this.data("owl-roundPages", roundPages); 7881 }); 7882 }, 7883 7884 appendWrapperSizes : function () { 7885 var base = this, 7886 width = base.$owlItems.length * base.itemWidth; 7887 7888 base.$owlWrapper.css({ 7889 "width": width * 2, 7890 "left": 0 7891 }); 7892 base.appendItemsSizes(); 7893 }, 7894 7895 calculateAll : function () { 7896 var base = this; 7897 base.calculateWidth(); 7898 base.appendWrapperSizes(); 7899 base.loops(); 7900 base.max(); 7901 }, 7902 7903 calculateWidth : function () { 7904 var base = this; 7905 base.itemWidth = Math.round(base.$elem.width() / base.options.items); 7906 }, 7907 7908 max : function () { 7909 var base = this, 7910 maximum = ((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1; 7911 if (base.options.items > base.itemsAmount) { 7912 base.maximumItem = 0; 7913 maximum = 0; 7914 base.maximumPixels = 0; 7915 } else { 7916 base.maximumItem = base.itemsAmount - base.options.items; 7917 base.maximumPixels = maximum; 7918 } 7919 return maximum; 7920 }, 7921 7922 min : function () { 7923 return 0; 7924 }, 7925 7926 loops : function () { 7927 var base = this, 7928 prev = 0, 7929 elWidth = 0, 7930 i, 7931 item, 7932 roundPageNum; 7933 7934 base.positionsInArray = [0]; 7935 base.pagesInArray = []; 7936 7937 for (i = 0; i < base.itemsAmount; i += 1) { 7938 elWidth += base.itemWidth; 7939 base.positionsInArray.push(-elWidth); 7940 7941 if (base.options.scrollPerPage === true) { 7942 item = $(base.$owlItems[i]); 7943 roundPageNum = item.data("owl-roundPages"); 7944 if (roundPageNum !== prev) { 7945 base.pagesInArray[prev] = base.positionsInArray[i]; 7946 prev = roundPageNum; 7947 } 7948 } 7949 } 7950 }, 7951 7952 buildControls : function () { 7953 var base = this; 7954 if (base.options.navigation === true || base.options.pagination === true) {
7955 base.owlControls = $("<div class=\"owl-controls\"/>").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem); 7956 } 7957 if (base.options.pagination === true) { 7958 base.buildPagination(); 7959 } 7960 if (base.options.navigation === true) { 7961 base.buildButtons(); 7962 } 7963 }, 7964 7965 buildButtons : function () { 7966 var base = this, 7967 buttonsWrapper = $("<div class=\"owl-buttons\"/>"); 7968 base.owlControls.append(buttonsWrapper); 7969 7970 base.buttonPrev = $("<div/>", { 7971 "class" : "owl-prev", 7972 "html" : base.options.navigationText[0] || "" 7973 }); 7974 7975 base.buttonNext = $("<div/>", { 7976 "class" : "owl-next", 7977 "html" : base.options.navigationText[1] || "" 7978 }); 7979 7980 buttonsWrapper 7981 .append(base.buttonPrev) 7982 .append(base.buttonNext); 7983 7984 buttonsWrapper.on("touchstart.owlControls mousedown.owlControls", "div[class^=\"owl\"]", function (event) { 7985 event.preventDefault(); 7986 }); 7987 7988 buttonsWrapper.on("touchend.owlControls mouseup.owlControls", "div[class^=\"owl\"]", function (event) { 7989 event.preventDefault(); 7990 if ($(this).hasClass("owl-next")) { 7991 base.next(); 7992 } else { 7993 base.prev(); 7994 } 7995 }); 7996 }, 7997 7998 buildPagination : function () { 7999 var base = this; 8000 8001 base.paginationWrapper = $("<div class=\"owl-pagination\"/>"); 8002 base.owlControls.append(base.paginationWrapper); 8003 8004 base.paginationWrapper.on("touchend.owlControls mouseup.owlControls", ".owl-page", function (event) { 8005 event.preventDefault(); 8006 if (Number($(this).data("owl-page")) !== base.currentItem) { 8007 base.goTo(Number($(this).data("owl-page")), true); 8008 } 8009 }); 8010 }, 8011 8012 updatePagination : function () { 8013 var base = this, 8014 counter, 8015 lastPage, 8016 lastItem, 8017 i, 8018 paginationButton, 8019 paginationButtonInner; 8020 8021 if (base.options.pagination === false) { 8022 return false; 8023 } 8024 8025 base.paginationWrapper.html(""); 8026 8027 counter = 0; 8028 lastPage = base.itemsAmount - base.itemsAmount % base.options.items; 8029 8030 for (i = 0; i < base.itemsAmount; i += 1) { 8031 if (i % base.options.items === 0) { 8032 counter += 1; 8033 if (lastPage === i) { 8034 lastItem = base.itemsAmount - base.options.items; 8035 } 8036 paginationButton = $("<div/>", { 8037 "class" : "owl-page" 8038 }); 8039 paginationButtonInner = $("<span></span>", { 8040 "text": base.options.paginationNumbers === true ? counter : "", 8041 "class": base.options.paginationNumbers === true ? "owl-numbers" : "" 8042 }); 8043 paginationButton.append(paginationButtonInner); 8044 8045 paginationButton.data("owl-page", lastPage === i ? lastItem : i); 8046 paginationButton.data("owl-roundPages", counter); 8047 8048 base.paginationWrapper.append(paginationButton); 8049 } 8050 } 8051 base.checkPagination(); 8052 }, 8053 checkPagination : function () { 8054 var base = this; 8055 if (base.options.pagination === false) { 8056 return false; 8057 } 8058 base.paginationWrapper.find(".owl-page").each(function () { 8059 if ($(this).data("owl-roundPages") === $(base.$owlItems[base.currentItem]).data("owl-roundPages")) { 8060 base.paginationWrapper 8061 .find(".owl-page") 8062 .removeClass("active"); 8063 $(this).addClass("active"); 8064 } 8065 }); 8066 }, 8067 8068 checkNavigation : function () { 8069 var base = this; 8070 8071 if (base.options.navigation === false) { 8072 return false;
8073 } 8074 if (base.options.rewindNav === false) { 8075 if (base.currentItem === 0 && base.maximumItem === 0) { 8076 base.buttonPrev.addClass("disabled"); 8077 base.buttonNext.addClass("disabled"); 8078 } else if (base.currentItem === 0 && base.maximumItem !== 0) { 8079 base.buttonPrev.addClass("disabled"); 8080 base.buttonNext.removeClass("disabled"); 8081 } else if (base.currentItem === base.maximumItem) { 8082 base.buttonPrev.removeClass("disabled"); 8083 base.buttonNext.addClass("disabled"); 8084 } else if (base.currentItem !== 0 && base.currentItem !== base.maximumItem) { 8085 base.buttonPrev.removeClass("disabled"); 8086 base.buttonNext.removeClass("disabled"); 8087 } 8088 } 8089 }, 8090 8091 updateControls : function () { 8092 var base = this; 8093 base.updatePagination(); 8094 base.checkNavigation(); 8095 if (base.owlControls) { 8096 if (base.options.items >= base.itemsAmount) { 8097 base.owlControls.hide(); 8098 } else { 8099 base.owlControls.show(); 8100 } 8101 } 8102 }, 8103 8104 destroyControls : function () { 8105 var base = this; 8106 if (base.owlControls) { 8107 base.owlControls.remove(); 8108 } 8109 }, 8110 8111 next : function (speed) { 8112 var base = this; 8113 8114 if (base.isTransition) { 8115 return false; 8116 } 8117 8118 base.currentItem += base.options.scrollPerPage === true ? base.options.items : 1; 8119 if (base.currentItem > base.maximumItem + (base.options.scrollPerPage === true ? (base.options.items - 1) : 0)) { 8120 if (base.options.rewindNav === true) { 8121 base.currentItem = 0; 8122 speed = "rewind"; 8123 } else { 8124 base.currentItem = base.maximumItem; 8125 return false; 8126 } 8127 } 8128 base.goTo(base.currentItem, speed); 8129 }, 8130 8131 prev : function (speed) { 8132 var base = this; 8133 8134 if (base.isTransition) { 8135 return false; 8136 } 8137 8138 if (base.options.scrollPerPage === true && base.currentItem > 0 && base.currentItem < base.options.items) { 8139 base.currentItem = 0; 8140 } else { 8141 base.currentItem -= base.options.scrollPerPage === true ? base.options.items : 1; 8142 } 8143 if (base.currentItem < 0) { 8144 if (base.options.rewindNav === true) { 8145 base.currentItem = base.maximumItem; 8146 speed = "rewind"; 8147 } else { 8148 base.currentItem = 0; 8149 return false; 8150 } 8151 } 8152 base.goTo(base.currentItem, speed); 8153 }, 8154 8155 goTo : function (position, speed, drag) { 8156 var base = this, 8157 goToPixel; 8158 8159 if (base.isTransition) { 8160 return false; 8161 } 8162 if (typeof base.options.beforeMove === "function") { 8163 base.options.beforeMove.apply(this, [base.$elem]); 8164 } 8165 if (position >= base.maximumItem) { 8166 position = base.maximumItem; 8167 } else if (position <= 0) { 8168 position = 0; 8169 } 8170 8171 base.currentItem = base.owl.currentItem = position; 8172 if (base.options.transitionStyle !== false && drag !== "drag" && base.options.items === 1 && base.browser.support3d === true) { 8173 base.swapSpeed(0); 8174 if (base.browser.support3d === true) { 8175 base.transition3d(base.positionsInArray[position]); 8176 } else { 8177 base.css2slide(base.positionsInArray[position], 1); 8178 } 8179 base.afterGo(); 8180 base.singleItemTransition(); 8181 return false;
8182 } 8183 goToPixel = base.positionsInArray[position]; 8184 8185 if (base.browser.support3d === true) { 8186 base.isCss3Finish = false; 8187 8188 if (speed === true) { 8189 base.swapSpeed("paginationSpeed"); 8190 window.setTimeout(function () { 8191 base.isCss3Finish = true; 8192 }, base.options.paginationSpeed); 8193 8194 } else if (speed === "rewind") { 8195 base.swapSpeed(base.options.rewindSpeed); 8196 window.setTimeout(function () { 8197 base.isCss3Finish = true; 8198 }, base.options.rewindSpeed); 8199 8200 } else { 8201 base.swapSpeed("slideSpeed"); 8202 window.setTimeout(function () { 8203 base.isCss3Finish = true; 8204 }, base.options.slideSpeed); 8205 } 8206 base.transition3d(goToPixel); 8207 } else { 8208 if (speed === true) { 8209 base.css2slide(goToPixel, base.options.paginationSpeed); 8210 } else if (speed === "rewind") { 8211 base.css2slide(goToPixel, base.options.rewindSpeed); 8212 } else { 8213 base.css2slide(goToPixel, base.options.slideSpeed); 8214 } 8215 } 8216 base.afterGo(); 8217 }, 8218 8219 jumpTo : function (position) { 8220 var base = this; 8221 if (typeof base.options.beforeMove === "function") { 8222 base.options.beforeMove.apply(this, [base.$elem]); 8223 } 8224 if (position >= base.maximumItem || position === -1) { 8225 position = base.maximumItem; 8226 } else if (position <= 0) { 8227 position = 0; 8228 } 8229 base.swapSpeed(0); 8230 if (base.browser.support3d === true) { 8231 base.transition3d(base.positionsInArray[position]); 8232 } else { 8233 base.css2slide(base.positionsInArray[position], 1); 8234 } 8235 base.currentItem = base.owl.currentItem = position; 8236 base.afterGo(); 8237 }, 8238 8239 afterGo : function () { 8240 var base = this; 8241 8242 base.prevArr.push(base.currentItem); 8243 base.prevItem = base.owl.prevItem = base.prevArr[base.prevArr.length - 2]; 8244 base.prevArr.shift(0); 8245 8246 if (base.prevItem !== base.currentItem) { 8247 base.checkPagination(); 8248 base.checkNavigation(); 8249 base.eachMoveUpdate(); 8250 8251 if (base.options.autoPlay !== false) { 8252 base.checkAp(); 8253 } 8254 } 8255 if (typeof base.options.afterMove === "function" && base.prevItem !== base.currentItem) { 8256 base.options.afterMove.apply(this, [base.$elem]); 8257 } 8258 }, 8259 8260 stop : function () { 8261 var base = this; 8262 base.apStatus = "stop"; 8263 window.clearInterval(base.autoPlayInterval); 8264 }, 8265 8266 checkAp : function () { 8267 var base = this; 8268 if (base.apStatus !== "stop") { 8269 base.play(); 8270 } 8271 }, 8272 8273 play : function () { 8274 var base = this; 8275 base.apStatus = "play"; 8276 if (base.options.autoPlay === false) { 8277 return false; 8278 } 8279 window.clearInterval(base.autoPlayInterval); 8280 base.autoPlayInterval = window.setInterval(function () { 8281 base.next(true); 8282 }, base.options.autoPlay); 8283 }, 8284 8285 swapSpeed : function (action) { 8286 var base = this; 8287 if (action === "slideSpeed") { 8288 base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed)); 8289 } else if (action === "paginationSpeed") { 8290 base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed)); 8291 } else if (typeof action !== "string") { 8292 base.$owlWrapper.css(base.addCssSpeed(action)); 8293 } 8294 }, 8295 8296 addCssSpeed : function (speed) { 8297 return { 8298 "-webkit-transition": "all " + speed + "ms ease", 8299 "-moz-transition": "all " + speed + "ms ease", 8300 "-o-transition": "all " + speed + "ms ease", 8301 "transition": "all " + speed + "ms ease" 8302 }; 8303 }, 8304 8305 removeTransition : function () { 8306 return { 8307 "-webkit-transition": "", 8308 "-moz-transition": "", 8309 "-o-transition": "", 8310 "transition": "" 8311 }; 8312 }, 8313 8314 doTranslate : function (pixels) { 8315 return { 8316 "-webkit-transform": "translate3d(" + pixels + "px, 0px, 0px)", 8317 "-moz-transform": "translate3d(" + pixels + "px, 0px, 0px)", 8318 "-o-transform": "translate3d(" + pixels + "px, 0px, 0px)", 8319 "-ms-transform": "translate3d(" + pixels + "px, 0px, 0px)", 8320 "transform": "translate3d(" + pixels + "px, 0px,0px)" 8321 }; 8322 }, 8323 8324 transition3d : function (value) { 8325 var base = this; 8326 base.$owlWrapper.css(base.doTranslate(value)); 8327 }, 8328 8329 css2move : function (value) { 8330 var base = this; 8331 base.$owlWrapper.css({"left" : value}); 8332 }, 8333 8334 css2slide : function (value, speed) { 8335 var base = this; 8336 8337 base.isCssFinish = false;
8338 base.$owlWrapper.stop(true, true).animate({ 8339 "left" : value 8340 }, { 8341 duration : speed || base.options.slideSpeed, 8342 complete : function () { 8343 base.isCssFinish = true; 8344 } 8345 }); 8346 }, 8347 8348 checkBrowser : function () { 8349 var base = this, 8350 translate3D = "translate3d(0px, 0px, 0px)", 8351 tempElem = document.createElement("div"), 8352 regex, 8353 asSupport, 8354 support3d, 8355 isTouch; 8356 8357 tempElem.style.cssText = " -moz-transform:" + translate3D + 8358 "; -ms-transform:" + translate3D + 8359 "; -o-transform:" + translate3D + 8360 "; -webkit-transform:" + translate3D + 8361 "; transform:" + translate3D; 8362 regex = /translate3d\(0px, 0px, 0px\)/g; 8363 asSupport = tempElem.style.cssText.match(regex); 8364 support3d = (asSupport !== null && asSupport.length === 1); 8365 8366 isTouch = "ontouchstart" in window || window.navigator.msMaxTouchPoints; 8367 8368 base.browser = { 8369 "support3d" : support3d, 8370 "isTouch" : isTouch 8371 }; 8372 }, 8373 8374 moveEvents : function () { 8375 var base = this; 8376 if (base.options.mouseDrag !== false || base.options.touchDrag !== false) { 8377 base.gestures(); 8378 base.disabledEvents(); 8379 } 8380 }, 8381 8382 eventTypes : function () { 8383 var base = this, 8384 types = ["s", "e", "x"]; 8385 8386 base.ev_types = {}; 8387 8388 if (base.options.mouseDrag === true && base.options.touchDrag === true) { 8389 types = [ 8390 "touchstart.owl mousedown.owl", 8391 "touchmove.owl mousemove.owl", 8392 "touchend.owl touchcancel.owl mouseup.owl" 8393 ]; 8394 } else if (base.options.mouseDrag === false && base.options.touchDrag === true) { 8395 types = [ 8396 "touchstart.owl", 8397 "touchmove.owl", 8398 "touchend.owl touchcancel.owl" 8399 ]; 8400 } else if (base.options.mouseDrag === true && base.options.touchDrag === false) { 8401 types = [ 8402 "mousedown.owl", 8403 "mousemove.owl", 8404 "mouseup.owl" 8405 ]; 8406 } 8407 8408 base.ev_types.start = types[0]; 8409 base.ev_types.move = types[1]; 8410 base.ev_types.end = types[2]; 8411 }, 8412 8413 disabledEvents : function () { 8414 var base = this; 8415 base.$elem.on("dragstart.owl", function (event) { event.preventDefault(); }); 8416 base.$elem.on("mousedown.disableTextSelect", function (e) { 8417 return $(e.target).is('input, textarea, select, option'); 8418 }); 8419 }, 8420 8421 gestures : function () { 8422 /*jslint unparam: true*/ 8423 var base = this, 8424 locals = { 8425 offsetX : 0, 8426 offsetY : 0, 8427 baseElWidth : 0, 8428 relativePos : 0, 8429 position: null, 8430 minSwipe : null, 8431 maxSwipe: null, 8432 sliding : null, 8433 dargging: null, 8434 targetElement : null 8435 }; 8436 8437 base.isCssFinish = true; 8438 8439 function getTouches(event) { 8440 if (event.touches !== undefined) { 8441 return { 8442 x : event.touches[0].pageX, 8443 y : event.touches[0].pageY 8444 }; 8445 } 8446 8447 if (event.touches === undefined) { 8448 if (event.pageX !== undefined) { 8449 return { 8450 x : event.pageX, 8451 y : event.pageY 8452 }; 8453 } 8454 if (event.pageX === undefined) { 8455 return { 8456 x : event.clientX, 8457 y : event.clientY 8458 }; 8459 } 8460 } 8461 } 8462 8463 function swapEvents(type) { 8464 if (type === "on") { 8465 $(document).on(base.ev_types.move, dragMove); 8466 $(document).on(base.ev_types.end, dragEnd); 8467 } else if (type === "off") { 8468 $(document).off(base.ev_types.move); 8469 $(document).off(base.ev_types.end); 8470 } 8471 } 8472 8473 function dragStart(event) { 8474 var ev = event.originalEvent || event || window.event, 8475 position; 8476 8477 if (ev.which === 3) { 8478 return false;
8479 } 8480 if (base.itemsAmount <= base.options.items) { 8481 return; 8482 } 8483 if (base.isCssFinish === false && !base.options.dragBeforeAnimFinish) { 8484 return false; 8485 } 8486 if (base.isCss3Finish === false && !base.options.dragBeforeAnimFinish) { 8487 return false; 8488 } 8489 8490 if (base.options.autoPlay !== false) { 8491 window.clearInterval(base.autoPlayInterval); 8492 } 8493 8494 if (base.browser.isTouch !== true && !base.$owlWrapper.hasClass("grabbing")) { 8495 base.$owlWrapper.addClass("grabbing"); 8496 } 8497 8498 base.newPosX = 0; 8499 base.newRelativeX = 0; 8500 8501 $(this).css(base.removeTransition()); 8502 8503 position = $(this).position(); 8504 locals.relativePos = position.left; 8505 8506 locals.offsetX = getTouches(ev).x - position.left; 8507 locals.offsetY = getTouches(ev).y - position.top; 8508 8509 swapEvents("on"); 8510 8511 locals.sliding = false; 8512 locals.targetElement = ev.target || ev.srcElement; 8513 } 8514 8515 function dragMove(event) { 8516 var ev = event.originalEvent || event || window.event, 8517 minSwipe, 8518 maxSwipe; 8519 8520 base.newPosX = getTouches(ev).x - locals.offsetX; 8521 base.newPosY = getTouches(ev).y - locals.offsetY; 8522 base.newRelativeX = base.newPosX - locals.relativePos; 8523 8524 if (typeof base.options.startDragging === "function" && locals.dragging !== true && base.newRelativeX !== 0) { 8525 locals.dragging = true; 8526 base.options.startDragging.apply(base, [base.$elem]); 8527 } 8528 8529 if ((base.newRelativeX > 8 || base.newRelativeX < -8) && (base.browser.isTouch === true)) { 8530 if (ev.preventDefault !== undefined) { 8531 ev.preventDefault(); 8532 } else { 8533 ev.returnValue = false; 8534 } 8535 locals.sliding = true; 8536 } 8537 8538 if ((base.newPosY > 10 || base.newPosY < -10) && locals.sliding === false) { 8539 $(document).off("touchmove.owl"); 8540 } 8541 8542 minSwipe = function () { 8543 return base.newRelativeX / 5; 8544 }; 8545 8546 maxSwipe = function () { 8547 return base.maximumPixels + base.newRelativeX / 5; 8548 }; 8549 8550 base.newPosX = Math.max(Math.min(base.newPosX, minSwipe()), maxSwipe()); 8551 if (base.browser.support3d === true) { 8552 base.transition3d(base.newPosX); 8553 } else { 8554 base.css2move(base.newPosX); 8555 } 8556 } 8557 8558 function dragEnd(event) { 8559 var ev = event.originalEvent || event || window.event, 8560 newPosition, 8561 handlers, 8562 owlStopEvent; 8563 8564 ev.target = ev.target || ev.srcElement; 8565 8566 locals.dragging = false; 8567 8568 if (base.browser.isTouch !== true) { 8569 base.$owlWrapper.removeClass("grabbing"); 8570 } 8571 8572 if (base.newRelativeX < 0) { 8573 base.dragDirection = base.owl.dragDirection = "left"; 8574 } else { 8575 base.dragDirection = base.owl.dragDirection = "right"; 8576 } 8577 8578 if (base.newRelativeX !== 0) { 8579 newPosition = base.getNewPosition(); 8580 base.goTo(newPosition, false, "drag"); 8581 if (locals.targetElement === ev.target && base.browser.isTouch !== true) { 8582 $(ev.target).on("click.disable", function (ev) { 8583 ev.stopImmediatePropagation(); 8584 ev.stopPropagation(); 8585 ev.preventDefault(); 8586 $(ev.target).off("click.disable"); 8587 }); 8588 handlers = $._data(ev.target, "events").click; 8589 owlStopEvent = handlers.pop(); 8590 handlers.splice(0, 0, owlStopEvent); 8591 } 8592 } 8593 swapEvents("off"); 8594 } 8595 base.$elem.on(base.ev_types.start, ".owl-wrapper", dragStart); 8596 }, 8597 8598 getNewPosition : function () { 8599 var base = this, 8600 newPosition = base.closestItem(); 8601 8602 if (newPosition > base.maximumItem) { 8603 base.currentItem = base.maximumItem; 8604 newPosition = base.maximumItem; 8605 } else if (base.newPosX >= 0) { 8606 newPosition = 0; 8607 base.currentItem = 0; 8608 } 8609 return newPosition; 8610 }, 8611 closestItem : function () { 8612 var base = this, 8613 array = base.options.scrollPerPage === true ? base.pagesInArray : base.positionsInArray, 8614 goal = base.newPosX, 8615 closest = null; 8616 8617 $.each(array, function (i, v) { 8618 if (goal - (base.itemWidth / 20) > array[i + 1] && goal - (base.itemWidth / 20) < v && base.moveDirection() === "left") { 8619 closest = v; 8620 if (base.options.scrollPerPage === true) { 8621 base.currentItem = $.inArray(closest, base.positionsInArray); 8622 } else { 8623 base.currentItem = i; 8624 } 8625 } else if (goal + (base.itemWidth / 20) < v && goal + (base.itemWidth / 20) > (array[i + 1] || array[i] - base.itemWidth) && base.moveDirection() === "right") { 8626 if (base.options.scrollPerPage === true) { 8627 closest = array[i + 1] || array[array.length - 1]; 8628 base.currentItem = $.inArray(closest, base.positionsInArray); 8629 } else { 8630 closest = array[i + 1]; 8631 base.currentItem = i + 1; 8632 } 8633 } 8634 }); 8635 return base.currentItem; 8636 }, 8637 8638 moveDirection : function () { 8639 var base = this, 8640 direction; 8641 if (base.newRelativeX < 0) { 8642 direction = "right"; 8643 base.playDirection = "next"; 8644 } else { 8645 direction = "left"; 8646 base.playDirection = "prev"; 8647 } 8648 return direction; 8649 }, 8650 8651 customEvents : function () { 8652 /*jslint unparam: true*/ 8653 var base = this; 8654 base.$elem.on("owl.next", function () { 8655 base.next(); 8656 }); 8657 base.$elem.on("owl.prev", function () { 8658 base.prev(); 8659 }); 8660 base.$elem.on("owl.play", function (event, speed) { 8661 base.options.autoPlay = speed; 8662 base.play(); 8663 base.hoverStatus = "play"; 8664 }); 8665 base.$elem.on("owl.stop", function () { 8666 base.stop(); 8667 base.hoverStatus = "stop"; 8668 }); 8669 base.$elem.on("owl.goTo", function (event, item) { 8670 base.goTo(item); 8671 }); 8672 base.$elem.on("owl.jumpTo", function (event, item) { 8673 base.jumpTo(item); 8674 }); 8675 }, 8676 8677 stopOnHover : function () { 8678 var base = this; 8679 if (base.options.stopOnHover === true && base.browser.isTouch !== true && base.options.autoPlay !== false) { 8680 base.$elem.on("mouseover", function () { 8681 base.stop(); 8682 }); 8683 base.$elem.on("mouseout", function () { 8684 if (base.hoverStatus !== "stop") { 8685 base.play(); 8686 } 8687 }); 8688 } 8689 }, 8690 8691 lazyLoad : function () { 8692 var base = this, 8693 i, 8694 $item, 8695 itemNumber, 8696 $lazyImg, 8697 follow; 8698 8699 if (base.options.lazyLoad === false) { 8700 return false;
8701 } 8702 for (i = 0; i < base.itemsAmount; i += 1) { 8703 $item = $(base.$owlItems[i]); 8704 8705 if ($item.data("owl-loaded") === "loaded") { 8706 continue; 8707 } 8708 8709 itemNumber = $item.data("owl-item"); 8710 $lazyImg = $item.find(".lazyOwl"); 8711 8712 if (typeof $lazyImg.data("src") !== "string") { 8713 $item.data("owl-loaded", "loaded"); 8714 continue; 8715 } 8716 if ($item.data("owl-loaded") === undefined) { 8717 $lazyImg.hide(); 8718 $item.addClass("loading").data("owl-loaded", "checked"); 8719 } 8720 if (base.options.lazyFollow === true) { 8721 follow = itemNumber >= base.currentItem; 8722 } else { 8723 follow = true; 8724 } 8725 if (follow && itemNumber < base.currentItem + base.options.items && $lazyImg.length) { 8726 base.lazyPreload($item, $lazyImg); 8727 } 8728 } 8729 }, 8730 8731 lazyPreload : function ($item, $lazyImg) { 8732 var base = this, 8733 iterations = 0, 8734 isBackgroundImg; 8735 8736 if ($lazyImg.prop("tagName") === "DIV") { 8737 $lazyImg.css("background-image", "url(" + $lazyImg.data("src") + ")"); 8738 isBackgroundImg = true; 8739 } else { 8740 $lazyImg[0].src = $lazyImg.data("src"); 8741 } 8742 8743 function showImage() { 8744 $item.data("owl-loaded", "loaded").removeClass("loading"); 8745 $lazyImg.removeAttr("data-src"); 8746 if (base.options.lazyEffect === "fade") { 8747 $lazyImg.fadeIn(400); 8748 } else { 8749 $lazyImg.show(); 8750 } 8751 if (typeof base.options.afterLazyLoad === "function") { 8752 base.options.afterLazyLoad.apply(this, [base.$elem]); 8753 } 8754 } 8755 8756 function checkLazyImage() { 8757 iterations += 1; 8758 if (base.completeImg($lazyImg.get(0)) || isBackgroundImg === true) { 8759 showImage(); 8760 } else if (iterations <= 100) {//if image loads in less than 10 seconds 8761 window.setTimeout(checkLazyImage, 100); 8762 } else { 8763 showImage(); 8764 } 8765 } 8766 8767 checkLazyImage(); 8768 }, 8769 8770 autoHeight : function () { 8771 var base = this, 8772 $currentimg = $(base.$owlItems[base.currentItem]).find("img"), 8773 iterations; 8774 8775 function addHeight() { 8776 var $currentItem = $(base.$owlItems[base.currentItem]).height(); 8777 base.wrapperOuter.css("height", $currentItem + "px"); 8778 if (!base.wrapperOuter.hasClass("autoHeight")) { 8779 window.setTimeout(function () { 8780 base.wrapperOuter.addClass("autoHeight"); 8781 }, 0); 8782 } 8783 } 8784 8785 function checkImage() { 8786 iterations += 1; 8787 if (base.completeImg($currentimg.get(0))) { 8788 addHeight(); 8789 } else if (iterations <= 100) { //if image loads in less than 10 seconds 8790 window.setTimeout(checkImage, 100); 8791 } else { 8792 base.wrapperOuter.css("height", ""); //Else remove height attribute 8793 } 8794 } 8795 8796 if ($currentimg.get(0) !== undefined) { 8797 iterations = 0; 8798 checkImage(); 8799 } else { 8800 addHeight(); 8801 } 8802 }, 8803 8804 completeImg : function (img) { 8805 var naturalWidthType; 8806 8807 if (!img.complete) { 8808 return false; 8809 } 8810 naturalWidthType = typeof img.naturalWidth;
8811 if (naturalWidthType !== "undefined" && img.naturalWidth === 0) { 8812 return false; 8813 } 8814 return true; 8815 }, 8816 8817 onVisibleItems : function () { 8818 var base = this, 8819 i; 8820 8821 if (base.options.addClassActive === true) { 8822 base.$owlItems.removeClass("active"); 8823 } 8824 base.visibleItems = []; 8825 for (i = base.currentItem; i < base.currentItem + base.options.items; i += 1) { 8826 base.visibleItems.push(i); 8827 8828 if (base.options.addClassActive === true) { 8829 $(base.$owlItems[i]).addClass("active"); 8830 } 8831 } 8832 base.owl.visibleItems = base.visibleItems; 8833 }, 8834 8835 transitionTypes : function (className) { 8836 var base = this; 8837 //Currently available: "fade", "backSlide", "goDown", "fadeUp" 8838 base.outClass = "owl-" + className + "-out"; 8839 base.inClass = "owl-" + className + "-in"; 8840 }, 8841 8842 singleItemTransition : function () { 8843 var base = this, 8844 outClass = base.outClass, 8845 inClass = base.inClass, 8846 $currentItem = base.$owlItems.eq(base.currentItem), 8847 $prevItem = base.$owlItems.eq(base.prevItem), 8848 prevPos = Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem], 8849 origin = Math.abs(base.positionsInArray[base.currentItem]) + base.itemWidth / 2, 8850 animEnd = 'webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend'; 8851 8852 base.isTransition = true; 8853 8854 base.$owlWrapper 8855 .addClass('owl-origin') 8856 .css({ 8857 "-webkit-transform-origin" : origin + "px", 8858 "-moz-perspective-origin" : origin + "px", 8859 "perspective-origin" : origin + "px" 8860 }); 8861 function transStyles(prevPos) { 8862 return { 8863 "position" : "relative", 8864 "left" : prevPos + "px" 8865 }; 8866 } 8867 8868 $prevItem 8869 .css(transStyles(prevPos, 10)) 8870 .addClass(outClass) 8871 .on(animEnd, function () { 8872 base.endPrev = true; 8873 $prevItem.off(animEnd); 8874 base.clearTransStyle($prevItem, outClass); 8875 }); 8876 8877 $currentItem 8878 .addClass(inClass) 8879 .on(animEnd, function () { 8880 base.endCurrent = true; 8881 $currentItem.off(animEnd); 8882 base.clearTransStyle($currentItem, inClass); 8883 }); 8884 }, 8885 8886 clearTransStyle : function (item, classToRemove) { 8887 var base = this; 8888 item.css({ 8889 "position" : "", 8890 "left" : "" 8891 }).removeClass(classToRemove); 8892 8893 if (base.endPrev && base.endCurrent) { 8894 base.$owlWrapper.removeClass('owl-origin'); 8895 base.endPrev = false; 8896 base.endCurrent = false; 8897 base.isTransition = false; 8898 } 8899 }, 8900 8901 owlStatus : function () { 8902 var base = this; 8903 base.owl = { 8904 "userOptions" : base.userOptions, 8905 "baseElement" : base.$elem, 8906 "userItems" : base.$userItems, 8907 "owlItems" : base.$owlItems, 8908 "currentItem" : base.currentItem, 8909 "prevItem" : base.prevItem, 8910 "visibleItems" : base.visibleItems, 8911 "isTouch" : base.browser.isTouch, 8912 "browser" : base.browser, 8913 "dragDirection" : base.dragDirection 8914 }; 8915 }, 8916 8917 clearEvents : function () { 8918 var base = this; 8919 base.$elem.off(".owl owl mousedown.disableTextSelect"); 8920 $(document).off(".owl owl"); 8921 $(window).off("resize", base.resizer); 8922 }, 8923 8924 unWrap : function () { 8925 var base = this; 8926 if (base.$elem.children().length !== 0) { 8927 base.$owlWrapper.unwrap(); 8928 base.$userItems.unwrap().unwrap(); 8929 if (base.owlControls) { 8930 base.owlControls.remove(); 8931 } 8932 } 8933 base.clearEvents(); 8934 base.$elem 8935 .attr("style", base.$elem.data("owl-originalStyles") || "") 8936 .attr("class", base.$elem.data("owl-originalClasses")); 8937 }, 8938 8939 destroy : function () { 8940 var base = this; 8941 base.stop(); 8942 window.clearInterval(base.checkVisible); 8943 base.unWrap(); 8944 base.$elem.removeData(); 8945 }, 8946 8947 reinit : function (newOptions) { 8948 var base = this, 8949 options = $.extend({}, base.userOptions, newOptions); 8950 base.unWrap(); 8951 base.init(options, base.$elem); 8952 }, 8953 8954 addItem : function (htmlString, targetPosition) { 8955 var base = this, 8956 position; 8957 8958 if (!htmlString) {return false; } 8959 8960 if (base.$elem.children().length === 0) { 8961 base.$elem.append(htmlString); 8962 base.setVars(); 8963 return false;
8964 } 8965 base.unWrap(); 8966 if (targetPosition === undefined || targetPosition === -1) { 8967 position = -1; 8968 } else { 8969 position = targetPosition; 8970 } 8971 if (position >= base.$userItems.length || position === -1) { 8972 base.$userItems.eq(-1).after(htmlString); 8973 } else { 8974 base.$userItems.eq(position).before(htmlString); 8975 } 8976 8977 base.setVars(); 8978 }, 8979 8980 removeItem : function (targetPosition) { 8981 var base = this, 8982 position; 8983 8984 if (base.$elem.children().length === 0) { 8985 return false; 8986 } 8987 if (targetPosition === undefined || targetPosition === -1) { 8988 position = -1; 8989 } else { 8990 position = targetPosition; 8991 } 8992 8993 base.unWrap(); 8994 base.$userItems.eq(position).remove(); 8995 base.setVars(); 8996 } 8997 8998 }; 8999 9000 $.fn.owlCarousel = function (options) { 9001 return this.each(function () { 9002 if ($(this).data("owl-init") === true) { 9003 return false; 9004 } 9005 $(this).data("owl-init", true); 9006 var carousel = Object.create(Carousel); 9007 carousel.init(options, this); 9008 $.data(this, "owlCarousel", carousel); 9009 }); 9010 }; 9011 9012 $.fn.owlCarousel.options = { 9013 9014 items : 5, 9015 itemsCustom : false, 9016 itemsDesktop : [1199, 4], 9017 itemsDesktopSmall : [979, 3], 9018 itemsTablet : [768, 2], 9019 itemsTabletSmall : false, 9020 itemsMobile : [479, 1], 9021 singleItem : false, 9022 itemsScaleUp : false, 9023 9024 slideSpeed : 200, 9025 paginationSpeed : 800, 9026 rewindSpeed : 1000, 9027 9028 autoPlay : false, 9029 stopOnHover : false, 9030 9031 navigation : false, 9032 navigationText : ["prev", "next"], 9033 rewindNav : true, 9034 scrollPerPage : false, 9035 9036 pagination : true, 9037 paginationNumbers : false, 9038 9039 responsive : true, 9040 responsiveRefreshRate : 200, 9041 responsiveBaseWidth : window, 9042 9043 baseClass : "owl-carousel", 9044 theme : "owl-theme", 9045 9046 lazyLoad : false, 9047 lazyFollow : true, 9048 lazyEffect : "fade", 9049 9050 autoHeight : false, 9051 9052 jsonPath : false, 9053 jsonSuccess : false, 9054 9055 dragBeforeAnimFinish : true, 9056 mouseDrag : true, 9057 touchDrag : true, 9058 9059 addClassActive : false, 9060 transitionStyle : false, 9061 9062 beforeUpdate : false, 9063 afterUpdate : false, 9064 beforeInit : false, 9065 afterInit : false, 9066 beforeMove : false, 9067 afterMove : false, 9068 afterAction : false, 9069 startDragging : false, 9070 afterLazyLoad: false 9071 }; 9072}(jQuery, window, document)); 9073/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) 9074 * Licensed under the MIT License (LICENSE.txt). 9075 * 9076 * Version 1.2.3 9077 */ 9078 9079(function (factory) { 9080 if (typeof define === 'function' && define.amd) { 9081 // AMD. Register as an anonymous module. 9082 define(['jquery'], factory); 9083 } else { 9084 // Browser globals 9085 factory(jQuery); 9086 } 9087}(function ($) { 9088 9089 $.fn.overlaps = function(selector) { 9090 return this.pushStack(filterOverlaps(this, selector && $(selector))); 9091 }; 9092 9093 function filterOverlaps(collection1, collection2) { 9094 var dims1 = getDims(collection1), 9095 dims2 = !collection2 ? dims1 : getDims(collection2), 9096 stack = [], 9097 index1 = 0, 9098 index2 = 0, 9099 length1 = dims1.length, 9100 length2 = !collection2 ? dims1.length : dims2.length; 9101 9102 if (!collection2) { collection2 = collection1; } 9103 9104 for (; index1 < length1; index1++) { 9105 for (index2 = 0; index2 < length2; index2++) { 9106 if (collection1[index1] === collection2[index2]) { 9107 continue; 9108 } else if (checkOverlap(dims1[index1], dims2[index2])) { 9109 stack.push( (length1 > length2) ? 9110 collection1[index1] : 9111 collection2[index2]); 9112 } 9113 } 9114 } 9115 9116 return $.unique(stack); 9117 } 9118 9119 function getDims(elems) { 9120 var dims = [], i = 0, offset, elem; 9121 9122 while ((elem = elems[i++])) { 9123 offset = $(elem).offset(); 9124 dims.push([ 9125 offset.top, 9126 offset.left, 9127 elem.offsetWidth, 9128 elem.offsetHeight 9129 ]); 9130 } 9131 9132 return dims; 9133 } 9134 9135 function checkOverlap(dims1, dims2) { 9136 var x1 = dims1[1], y1 = dims1[0], 9137 w1 = dims1[2], h1 = dims1[3], 9138 x2 = dims2[1], y2 = dims2[0], 9139 w2 = dims2[2], h2 = dims2[3]; 9140 return !(y2 + h2 <= y1 || y1 + h1 <= y2 || x2 + w2 <= x1 || x1 + w1 <= x2); 9141 } 9142 9143})); 9144/* 9145waitForImages plugin 9146 9147Copyright (c) 2014 Alex Dickson 9148 9149Permission is hereby granted, free of charge, to any person 9150obtaining a copy of this software and associated documentation 9151files (the "Software"), to deal in the Software without
9152restriction, including without limitation the rights to use, 9153copy, modify, merge, publish, distribute, sublicense, and/or sell 9154copies of the Software, and to permit persons to whom the 9155Software is furnished to do so, subject to the following 9156conditions: 9157 9158The above copyright notice and this permission notice shall be 9159included in all copies or substantial portions of the Software. 9160 9161THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 9162EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 9163OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 9164NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 9165HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 9166WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 9167FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 9168OTHER DEALINGS IN THE SOFTWARE. 9169 9170*/ 9171/*! waitForImages jQuery Plugin 2016-01-04 */ 9172!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){var b="waitForImages";a.waitForImages={hasImageProperties:["backgroundImage","listStyleImage","borderImage","borderCornerImage","cursor"],hasImageAttributes:["srcset"]},a.expr[":"]["has-src"]=function(b){return a(b).is('img[src][src!=""]')},a.expr[":"].uncached=function(b){return a(b).is(":has-src")?!b.complete:!1},a.fn.waitForImages=function(){var c,d,e,f=0,g=0,h=a.Deferred();if(a.isPlainObject(arguments[0])?(e=arguments[0].waitForAll,d=arguments[0].each,c=arguments[0].finished):1===arguments.length&&"boolean"===a.type(arguments[0])?e=arguments[0]:(c=arguments[0],d=arguments[1],e=arguments[2]),c=c||a.noop,d=d||a.noop,e=!!e,!a.isFunction(c)||!a.isFunction(d))throw new TypeError("An invalid callback was supplied.");return this.each(function(){var i=a(this),j=[],k=a.waitForImages.hasImageProperties||[],l=a.waitForImages.hasImageAttributes||[],m=/url\(\s*(['"]?)(.*?)\1\s*\)/g;e?i.find("*").addBack().each(function(){var b=a(this);b.is("img:has-src")&&!b.is("[srcset]")&&j.push({src:b.attr("src"),element:b[0]}),a.each(k,function(a,c){var d,e=b.css(c);if(!e)return!0;for(;d=m.exec(e);)j.push({src:d[2],element:b[0]})}),a.each(l,function(a,c){var d=b.attr(c);return d?void j.push({src:b.attr("src"),srcset:b.attr("srcset"),element:b[0]}):!0})}):i.find("img:has-src").each(function(){j.push({src:this.src,element:this})}),f=j.length,g=0,0===f&&(c.call(i[0]),h.resolveWith(i[0])),a.each(j,function(e,j){var k=new Image,l="load."+b+" error."+b;a(k).one(l,function m(b){var e=[g,f,"load"==b.type];return g++,d.apply(j.element,e),h.notifyWith(j.element,e),a(this).off(l,m),g==f?(c.call(i[0]),h.resolveWith(i[0]),!1):void 0}),j.srcset&&(k.srcset=j.srcset),k.src=j.src})}),h.promise()}}); 9173 9174/* 9175End waitForImages plugin 9176*/ 9177 9178/*! 9179 * jQuery UI Touch Punch 0.2.3 9180 * 9181 * Copyright 2011–2014, Dave Furfero 9182 * Dual licensed under the MIT or GPL Version 2 licenses. 9183 * 9184 * Depends: 9185 * jquery.ui.widget.js 9186 * jquery.ui.mouse.js 9187 */ 9188!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery); 9189 9190 9191 9192/* 9193 9194 Starting Blocks Theme Custom jQuery File 9195 9196 ====== 9197 Contents: 9198 ------ 9199 #Popup Video 9200 #Expand Collapse Widgets 9201 #Popdown widgets 9202 #Basic init setup 9203 #'Default' Gallery Style (Lightbox with thumbs) - including support for prodcuts based on this gallery style 9204 #'Montage' Gallery Style - including support for prodcuts based on this gallery style 9205 #'Slideshow' Gallery Styles (single and multi) - including support for prodcuts based on these gallery styles 9206 #'Gallery with thumbs' Gallery Style - including support for prodcuts based on these gallery styles 9207 #'Carousel Slide' Widget 9208 #'Live Shopping Basket' Widget 9209 # Livechat Status Widget 9210 # Searchable Subpage Index 9211 # Searchable Preview Based Subpage Index 9212 #Responsive video helper for jPlayer 9213 #Responsive video helper for JWPlayer 9214 #Responsive Calendar 9215 #Full width banner 9216 #Blog Loop 9217 #Countdown 9218 #Consent widgets 9219 9220 9221*/ 9222 9223/* Magic Heights */ 9224 9225$(window).on('scroll',function(e){ 9226 floatingScroll(); 9227 backtotopScroll(); 9228 fixedHeaderScroll(); 9229 frillsScroll(); 9230 asyncImagesLoad(); 9231}); 9232$(window).on('load',function(e){ 9233 floatingLoad(); 9234 stickyLoad(); 9235 miscLoad(); 9236 searchImageLoad(); 9237 montageLoad();
9238 magicHeights(); 9239 asyncImagesLoad(); 9240}); 9241$(window).on('resize',function(e){ 9242 if ($(window).width()==windowwidth) { 9243 return false; 9244 } 9245 windowwidth=$(window).width(); 9246 backstretches(); 9247 magicHeights(); 9248 asyncImagesLoad(); 9249 floatingResize(); 9250 mp_lightboxResize(); 9251 miscResize(); 9252 galleryResize(); 9253 montageResize(); 9254 galThumbResize(); 9255 responsiveVideoResize(); 9256 responsiveVideoJWResize(); 9257}); 9258$(document).on('ready',function() { 9259 frillsScroll(); 9260 windowwidth=$(window).width(); 9261 galThumbReady(); 9262 bannerHeightWithFloating(); 9263 walthroughReady(); 9264 consentReady(); 9265 countdownReady(); 9266 calendarReady(); 9267 bannerReady(); 9268 livechatReady(); 9269 pbReady(); 9270 kbReady(); 9271 productQuanReady(); 9272 carouselReady(); 9273 slideshowReady(); 9274 montageReady(); 9275 galleryReady(); 9276 popupReady(); 9277 popdownReady(); 9278 expandReady(); 9279 filterReady(); 9280 floatingReady(); 9281 stickyReady(); 9282 magicHeights(); 9283 asyncImagesLoad(); 9284 accessibleReady(); 9285 imagesReady(); 9286 mpPopupReady(); 9287 iconsReady(); 9288 hoverImageReady(); 9289 anchorCheckLoad(); 9290 preReady(); 9291}); 9292function preReady() { 9293 $('pre').wrapInner('<code></code>'); 9294} 9295function anchorCheckLoad() { 9296 setTimeout(function() { 9297 if (window.location.href){ 9298 var hs = window.location.hash.split('#'); 9299 if ($('*[name="'+hs[1]+'"]').length) { 9300 var target = $('*[name="'+hs[1]+'"]'); 9301 } 9302 if ($(window.location.hash).length) { 9303 var target = $(window.location.hash); 9304 } 9305 if (typeof target != "undefined") { 9306 if ($('#dmt-floating-sub-menu:not(.fixed)').length) { 9307 if (typeof $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').data('move-dist') !='undefined'){ 9308 var extra = $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').outerHeight() - $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').data('move-dist'); 9309 } else { 9310 var extra = $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').outerHeight(); 9311 } 9312 9313 } else if ($('body').hasClass("with-fixed-header")) { 9314 var extra = $("#header").outerHeight(); 9315 } else { 9316 var extra = 0; 9317 } 9318 9319 $('html, body').animate({ 9320 scrollTop: target.offset().top - extra 9321 }, 1500,function(){ 9322 if ($('#dmt-floating-sub-menu:not(.fixed)').length) { 9323 checkFloatingSub(); 9324 } 9325 9326 }); 9327 } 9328 } 9329 },50); 9330} 9331var asyncRunning=false; 9332function asyncImagesLoad() { 9333 if (asyncRunning){ 9334 return false; 9335 } 9336 asyncRunning=true; 9337 9338 var added = false; 9339 $(".index-async-load:not(.async-loaded .index-async-load,.async-loading .index-async-load)").each(function(){ 9340 var rect = $(this)[0].getBoundingClientRect(); 9341 if (rect.top < window.innerHeight && rect.bottom >= 0){ 9342 $(this).parents(".subPageProducts").addClass("async-loading"); 9343 var added = true; 9344 9345 } 9346 }); 9347 if (added){ 9348 $(".subPageProducts").eq($(".async-loading:last").index()+1).addClass("async-preload"); 9349 $(".subPageProducts").eq($(".async-loading:last").index()+2).addClass("async-preload"); 9350 $(".subPageProducts").eq($(".async-loading:last").index()+3).addClass("async-preload"); 9351 $(".subPageProducts").eq($(".async-loading:last").index()+4).addClass("async-preload"); 9352 9353 } 9354 9355 $(".async-loading,.async-preload").each(function(){ 9356 if ($(this).hasClass("src-requested")){ 9357 return true; 9358 } 9359 $(this).addClass("src-requested"); 9360 if (!$(this).find(".index-async-load").length){ 9361 return true; 9362 } 9363 var path = $(this).find(".index-async-load").data("async-src").split("?"); 9364 var w = $(this).find(".index-async-load").parents("div").innerWidth()*2; 9365 var $t = $(this); 9366 $(this).find(".index-async-load").attr("src",path[0]+"?width="+w+"&height=auto").load(function(){ 9367 //magicHeights(); 9368 //moduleHeights(); 9369 $t.addClass("async-loaded"); 9370 $t.removeClass("async-loading"); 9371 $t.removeClass("async-preload"); 9372 }); 9373 }); 9374 9375 asyncRunning=false; 9376} 9377function magicHeights() { 9378 $('.magic-heights:visible').each(function(){ 9379 if ($(".magic-heights-inner",$(this)).length) { 9380 var $i = $('.magic-heights-inner',$(this)); 9381 }else { 9382 var $i = $(this); 9383 } 9384 $i.css('height','auto'); 9385 if ($(".magic-heights-inner-2",$(this)).length) { 9386 var $i = $('.magic-heights-inner-2',$(this)); 9387 $i.css('height','auto'); 9388 } 9389 }); 9390 9391 $('.magic-heights-wrap:visible').each(function(){ 9392 if (!$('.magic-heights:visible:first',$(this)).length) { 9393 return true; 9394 } 9395 $('.firstinrow',$(this)).removeClass('firstinrow'); 9396 var ot = $('.magic-heights:visible:first',$(this)).offset().top; 9397 var count = 0; 9398 $('.magic-heights:visible',$(this)).each(function(){ 9399 if ($(this).offset().top != ot) { 9400 return false;
9401 } 9402 count++; 9403 }); 9404 var iteration = 1; 9405 var h = 0; 9406 var h2 = 0; 9407 var h3 = 0; 9408 $('.magic-heights:visible',$(this)).addClass('notdone').each(function(){ 9409 if ($(".magic-heights-inner",$(this)).length) { 9410 var $i = $('.magic-heights-inner',$(this)); 9411 }else { 9412 var $i = $(this); 9413 } 9414 if ($i.innerHeight()>h) { 9415 h = $i.innerHeight(); 9416 } 9417 if ($(".magic-heights-inner-2",$(this)).length) { 9418 var $i2 = $('.magic-heights-inner-2',$(this)); 9419 if ($i2.innerHeight()>h2) { 9420 h2 = $i2.innerHeight(); 9421 } 9422 } 9423 if ($(".magic-heights-inner-3",$(this)).length) { 9424 var $i3 = $('.magic-heights-inner-3',$(this)); 9425 if ($i3.innerHeight()>h3) { 9426 h3 = $i3.innerHeight(); 9427 } 9428 } 9429 if (iteration==1) { 9430 $(this).addClass('firstinrow'); 9431 } 9432 if (iteration % count == 0) { 9433 $(this).next(":visible").addClass('firstinrow'); 9434 $(this).prevAll(":visible").slice(0,count-1).removeClass('notdone').each(function(){ 9435 if ($(".magic-heights-inner",$(this)).length) { 9436 var $i = $('.magic-heights-inner',$(this)); 9437 }else { 9438 var $i = $(this); 9439 } 9440 $i.css('height',h+'px'); 9441 if ($(".magic-heights-inner-2",$(this)).length) { 9442 $('.magic-heights-inner-2',$(this)).css('height',h2+'px'); 9443 } 9444 if ($(".magic-heights-inner-3",$(this)).length) { 9445 $('.magic-heights-inner-3',$(this)).css('height',h3+'px'); 9446 } 9447 }); 9448 $(this).removeClass('notdone'); 9449 $i.css('height',h+'px'); 9450 if ($(".magic-heights-inner-2",$(this)).length) { 9451 $(".magic-heights-inner-2",$(this)).css('height',h2+'px'); 9452 } 9453 if ($(".magic-heights-inner-3",$(this)).length) { 9454 $(".magic-heights-inner-3",$(this)).css('height',h3+'px'); 9455 } 9456 h = 0; 9457 h2 = 0; 9458 h3 = 0; 9459 } 9460 iteration++; 9461 }); 9462 iteration = 1; 9463 h = 0; 9464 h2 = 0; 9465 h3 = 0; 9466 $('.notdone:visible',$(this)).each(function(){ 9467 if ($(".magic-heights-inner",$(this)).length) { 9468 var $i = $('.magic-heights-inner',$(this)); 9469 }else { 9470 var $i = $(this); 9471 } 9472 if ($i.innerHeight()>h) { 9473 h = $i.innerHeight(); 9474 } 9475 if ($(".magic-heights-inner-2",$(this)).length) { 9476 var $i2 = $('.magic-heights-inner-2',$(this)); 9477 if ($i2.innerHeight()>h2) { 9478 h2 = $i2.innerHeight(); 9479 } 9480 } 9481 if ($(".magic-heights-inner-3",$(this)).length) { 9482 var $i3 = $('.magic-heights-inner-3',$(this)); 9483 if ($i3.innerHeight()>h3) { 9484 h3 = $i3.innerHeight(); 9485 } 9486 } 9487 iteration++; 9488 }); 9489 $('.notdone:visible',$(this)).each(function(){ 9490 if ($(".magic-heights-inner",$(this)).length) { 9491 var $i = $('.magic-heights-inner',$(this)); 9492 }else { 9493 var $i = $(this); 9494 } 9495 $i.css('height',h+'px'); 9496 if ($(".magic-heights-inner-2",$(this)).length) { 9497 $(".magic-heights-inner-2",$(this)).css('height',h2+'px'); 9498 } 9499 if ($(".magic-heights-inner-3",$(this)).length) { 9500 $(".magic-heights-inner-3",$(this)).css('height',h3+'px'); 9501 } 9502 $(this).removeClass('notdone'); 9503 }); 9504 }); 9505} 9506function walthroughReady() { 9507 $("h1,h2,h3,h4,p,li,h1 a,h2 a,h3 a,h4 a,p a,li a,.disclosure-reveal",$(".prevent-orphans .content")).each(function(){ 9508 if ($(this).width()>200) { 9509 if ($(this).children().length==0) { 9510 $(this).html($(this).text().replace(/ (?=[^ ]*$)/i, " ")); 9511 } 9512 } 9513 }); 9514 $(".walkthrough_checkbox").each(function(){ 9515 var nth = $(this).prevAll(".walkthrough_checkbox").length; 9516 var uid = hex_hmac_sha1($(this).text()+nth,window.location.pathname); 9517 $(this).data('uid',uid); 9518 if (readCookie('checkbox'+uid)) { 9519 $(this).addClass("checked"); 9520 } 9521 }); 9522 9523 $(".walkthrough_reset a").click(function(){ 9524 $(".walkthrough_checkbox.checked").trigger("click") 9525 return false; 9526 }); 9527 $(".walkthrough_checkbox").click(function(){ 9528 if ($(this).hasClass("checked")) { 9529 $(this).removeClass("checked"); 9530 eraseCookie("checkbox"+$(this).data('uid')); 9531 } else { 9532 $(this).addClass("checked"); 9533 createCookie('checkbox'+$(this).data('uid'),true,0); 9534 } 9535 return false; 9536 }); 9537} 9538function accessibleReady() { 9539 $('.accessible-mode .subPageIndexGrid .title').remove(); 9540 $(".accessible-mode .form:not(#paymentGatewayForm.form) .hide_if_no_js").hide(); 9541 $(".accessible-mode .form:not(#paymentGatewayForm.form) .contact-form-hide-with-js").show(); 9542 $("select[name=chb_sh]").change(function(){ 9543 $(this).parent().submit(); 9544 }); 9545 $("input[name=gateway]").change(function(){ 9546 $(this).parents("form").submit(); 9547 }); 9548 9549 $("#header .row,#footer .row").each(function(){ 9550 $(this).waitForImages(function(){ 9551 flexiBreak(); 9552 var $t = $(this); 9553 setTimeout(function () { 9554 $t.addClass('jsLoaded'); 9555 }, 100); 9556 }); 9557 }); 9558 $(".nav li").mouseleave(function(){ 9559 clearTimeout(hidingPagePreview); 9560 9561 hidingPagePreview = setTimeout(function () { 9562 $(".hover-preview").removeClass('hover-preview'); 9563 $(".page-preview").fadeOut(100); 9564 }, 50); 9565 9566 }); 9567 $(".nav li").mouseover(function(){ 9568 clearTimeout(hidingPagePreview); 9569 if ($(this).hasClass('show-preview')) { 9570 var mw = $(this).width(); 9571 var left = $(this).offset().left-$(this).parents(".row").offset().left; 9572 var w = $("#page-preview-id-"+$(this).data('page-id')+"").show().css({"visibility":"hidden","width":"auto","position":"relative"}).find('.page-preview-inner').css("float","left").outerWidth();
9573 var space= $(this).parents(".row").width(); 9574 9575 if (left+w > space) { 9576 if (w > space) { 9577 // need to move to left and shrink 9578 left = 0; 9579 w = space; 9580 } else { 9581 9582 // just need to move left 9583 var diff = (left+w) - space; 9584 left = left - diff; 9585 } 9586 } 9587 $(this).addClass('hover-preview'); 9588 if ($(".page-preview:visible").length) { 9589 $(".page-preview").hide(); 9590 9591 $("#page-preview-id-"+$(this).data('page-id')).css("visibility","visible").css("min-width",mw+"px").css("width",w+"px").css("position","absolute").css("left",left+"px").show().find('.page-preview-inner').css("float","none"); 9592 } else { 9593 $("#page-preview-id-"+$(this).data('page-id')).css("visibility","visible").css("min-width",mw+"px").css("width",w+"px").css("position","absolute").css("left",left+"px").fadeIn(100).find('.page-preview-inner').css("float","none"); 9594 } 9595 9596 } else { 9597 $(".hover-preview").removeClass('hover-preview'); 9598 $(".nav li.hover-preview").removeClass("hover-preview"); 9599 $(".page-preview").fadeOut(100); 9600 } 9601 }); 9602 9603 $(".page-preview").mouseleave(function(){ 9604 $(".hover-preview").removeClass('hover-preview'); 9605 $(this).fadeOut(100); 9606 }); 9607 9608 $(".page-preview").mouseover(function(){ 9609 clearTimeout(hidingPagePreview); 9610 }); 9611 9612 $(".Smaller").wrapInner("<span class=\"smallerWrap\"></span>") 9613 $(".Much_Smaller").wrapInner("<span class=\"muchSmallerWrap\"></span>") 9614 $(".Bigger").wrapInner("<span class=\"biggerWrap\"></span>") 9615 $(".Much_Bigger").wrapInner("<span class=\"muchBiggerWrap\"></span>") 9616 if (!$('body').hasClass("accessible-mode")){ 9617 $('a[href*="#"]:not([href="#"],[href="#navSearch"]),#backToTop').click(function() { 9618 9619 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 9620 9621 var target = $(this.hash); 9622 target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 9623 if ($(this).attr("id")=="backToTop") { 9624 var target = $("body"); 9625 } 9626 if (target.length) { 9627 if ($('#dmt-floating-sub-menu:not(.fixed)').length) { 9628 if (typeof $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').data('move-dist') !='undefined'){ 9629 var extra = $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').outerHeight() - $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').data('move-dist'); 9630 } else { 9631 var extra = $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').outerHeight(); 9632 } 9633 9634 } else if ($('body').hasClass("with-fixed-header")) { 9635 var extra = $("#header").outerHeight(); 9636 } else { 9637 var extra = 0; 9638 } 9639 9640 $('html, body').animate({ 9641 scrollTop: target.offset().top - extra 9642 }, 1500,function(){ 9643 if ($('#dmt-floating-sub-menu:not(.fixed)').length) { 9644 checkFloatingSub(); 9645 } 9646 9647 }); 9648 return false; 9649 } 9650 } 9651 }); 9652 } 9653 9654 parallaxScroll(); 9655 9656 if ($(window).width()<768) { 9657 $("body").addClass("mobile-header-enabled"); 9658 $("#header .row,#footer .row").addClass("jsLoaded"); 9659 }else{ 9660 $("body").addClass("js"); 9661 $("body").addClass("prepping"); 9662 flexiBreak(); 9663 } 9664 9665 9666 $("body").removeClass("prepping"); 9667 9668 $(".column").each(function(){ 9669 if ($(this).text().trim()==""&&!$(this).children().length) { 9670 $(this).addClass("empty-column"); 9671 } 9672 }); 9673 9674 $(".mobile-menu a").click(function(){ 9675 var $this = $(this); 9676 9677 if (!$(this).parents(".flexibreak-small").length&&!$(this).parents('#mobileheader').length) { 9678 $this = $("#"+$(".module.nav").parent().data("flexibreak-small")).find(".mobile-menu a"); 9679 var i = $this.parents(".flexibreak-small").attr("id"); 9680 var $orig = $("*[data-flexibreak-small=\""+i+"\"]"); 9681 } 9682 else { 9683 var $orig = $('#header .nav').parent(); 9684 } 9685 if (!$this.parents(".mobile-menu").hasClass("style") || $this.parents(".mobile-menu").hasClass("style-append")) { 9686 if (!$("#mobile-menu-auto").length) { 9687 $this.parents(".row").after('<section class="row jsLoaded mobile-menu-row"><ul id="mobile-menu-auto" class="hidden"></ul></section>'); 9688 var $target = $("#mobile-menu-auto"); 9689 $(".nav > ul",$orig).children(":not(#nav-logo,#nav-search)").each(function(){ 9690 $target.append($(this).clone()); 9691 }); 9692 if ($(".nav > ul #nav-search.nav-search-first",$orig).length) { 9693 $target.prepend($("#search-form-popdown form").clone()); 9694 } 9695 if ($(".nav > ul #nav-search.nav-search-last",$orig).length) { 9696 $target.append($("#search-form-popdown form").clone()); 9697 } 9698 $target.find("> li > a").removeAttr("style"); 9699 } else { 9700 var $target = $("#mobile-menu-auto"); 9701 } 9702 setTimeout(function () { 9703 if ($target.hasClass("hidden")) { 9704 $target.removeClass("hidden"); 9705 } else { 9706 $target.addClass("hidden"); 9707 } 9708 }, 0); 9709 } 9710 if ($this.parents(".mobile-menu").hasClass("style-reveal-left")||$this.parents(".mobile-menu").hasClass("style-reveal-right")) { 9711 var revealDirection = ($this.parents(".mobile-menu").hasClass("style-reveal-left")?"left":"right"); 9712 if (!$("#mobile-menu-behind").length) { 9713 $("body").addClass("mobile-menu-position-"+revealDirection); 9714 $("body").wrapInner('<div id="mobile-menu-page-wrap"></div>'); 9715 $("#mobile-menu-page-wrap").click(function(){ 9716 $("body").removeClass("mobile-menu-revealing-left mobile-menu-revealing-right"); 9717 setTimeout(function () { 9718 $("body").removeClass("mobile-menu-animating-"+revealDirection); 9719 }, 700); 9720 }); 9721 checkMobileMenuHeights(); 9722 $("body").prepend('<div id="mobile-menu-behind"><ul></ul></section>'); 9723 var $target = $("#mobile-menu-behind ul"); 9724 $(".nav > ul",$orig).children(":not(#nav-logo,#nav-search)").each(function(){ 9725 $target.append($(this).clone()); 9726 }); 9727 if ($(".nav > ul #nav-search.nav-search-first",$orig).length) { 9728 $target.prepend($("#search-form-popdown form").clone()); 9729 } 9730 if ($(".nav > ul #nav-search.nav-search-last",$orig).length) { 9731 $target.append($("#search-form-popdown form").clone()); 9732 } 9733 9734 $target.find("> li > a").removeAttr("style"); 9735 } 9736 setTimeout(function () { 9737 9738 $("body").addClass("mobile-menu-animating-"+revealDirection+" mobile-menu-revealing-"+revealDirection); 9739 9740 }, 10); 9741 $("#mobile-menu-behind ul ul").each(function(){ 9742 $(this).parent().addClass("withHiddenNav").append("<div class='showSubMenu'></div>"); 9743 }); 9744 $(".showSubMenu").click(function(){ 9745 $(this).parent().toggleClass("showingSubMenu"); 9746 return false;
9747 }); 9748 } 9749 return false; 9750 }); 9751 9752 $("*[data-scroll-decay]").each(function(){ 9753 $(this).addClass("parallax"); 9754 }); 9755 // Fix for image margins when floated before headings 9756 $("div.Right_Image,div.Left_Image").each(function(){ 9757 if ($(this).prev().length && $(this).next().length) { 9758 if ($(this).prev()[0].tagName.toLowerCase()=="p"&&$(this).next()[0].tagName.toLowerCase()=="h1") { 9759 $(this).css("margin-top","30px"); 9760 } 9761 if ( 9762 $(this).prev()[0].tagName.toLowerCase()=="p"&& 9763 ( 9764 $(this).next()[0].tagName.toLowerCase()=="h2" 9765 ||$(this).next()[0].tagName.toLowerCase()=="h3" 9766 ||$(this).next()[0].tagName.toLowerCase()=="h4" 9767 ) 9768 ) { 9769 $(this).css("margin-top","18px"); 9770 } 9771 } 9772 9773 }); 9774 // Small bit of code to enable 'warning' class to be added to stock level based on 'Warning stock level' theme variable. 9775 $(".separateOptionStock").change(function(){ 9776 9777 if (parseInt($("option:selected",$(this)).attr("data-stock"))<parseInt($(".stockAndPrice",$(this).parent()).attr("data-warning-threshold"))) { 9778 $(".stockAndPrice .stock",$(this).parent()).addClass("warning"); 9779 } else { 9780 $(".stockAndPrice .stock",$(this).parent()).removeClass("warning"); 9781 } 9782 9783 if ($(this).val()=="") { 9784 $('.out-of-stock',$(this).parents(".addToBasketForm")).hide(); 9785 $('.submit_form',$(this).parents(".addToBasketForm")).hide(); 9786 } else { 9787 $('.out-of-stock',$(this).parents(".addToBasketForm")).show(); 9788 $('.submit_form',$(this).parents(".addToBasketForm")).show(); 9789 } 9790 }); 9791 imageMarginHelper(); 9792 9793 $(".submit_form a").unbind("click").click(function(){ 9794 $(this).parents("form").submit(); 9795 return false; 9796 }); 9797 9798 $(".Circular.bpe_image").wrapInner('<span class="circularwrap"></span>'); 9799 9800 $(".Caption,.Heavy_Border_Caption,.Light_Border_Caption,.Caption_Below_Image").each(function(){ 9801 if (typeof $("img",$(this)).attr("alt") != 'undefined') { 9802 var text = $("img",$(this)).attr("alt"); 9803 if (text.indexOf('[caption:')!=-1) { 9804 var texts = text.split("[caption:"); 9805 var captions = texts[1].split("]"); 9806 caption = captions[0].trim(); 9807 text = caption.split("||"); 9808 var alt = captions[1].trim(); 9809 $("img",$(this)).attr("alt",alt); 9810 } else { 9811 var alt = text; 9812 text = text.split("||"); 9813 var caption = alt; 9814 } 9815 var newString = ""; 9816 for (var i=0; i < text.length; i++) { 9817 if (i==0) { 9818 newString = "<strong>"+text[i]+"</strong>"; 9819 } else { 9820 newString = newString+"<br/>"+text[i]; 9821 } 9822 }; 9823 $(this).addClass("clearfix"); 9824 if (!$('body').hasClass('accessible-mode')) { 9825 if ($("a",$(this)).length) { 9826 $("a",$(this)).wrapInner("<div class='captionWrap'></div>"); 9827 } else { 9828 $(this).wrapInner("<div class='captionWrap'></div>"); 9829 } 9830 $(".captionWrap",$(this)).append('<span class="caption">'+newString+'</span>'); 9831 } 9832 9833 if ($("a",$(this)).length) { 9834 $("a",$(this)).attr("title",caption); 9835 } 9836 } 9837 }); 9838 9839 9840 $(".bpe_image").each(function(){ 9841 if (typeof $("img",$(this)).attr("alt") != 'undefined') { 9842 if (typeof $("img",$(this)).attr("title") == 'undefined') { 9843 $("img",$(this)).attr("title",$("img",$(this)).attr("alt")); 9844 } 9845 } 9846 }); 9847 9848 $("body").addClass("js"); 9849 9850 $(".focusSwapWrap input[type=text]").focus(function(){ 9851 $(this).parent('.focusSwapWrap').addClass("focus"); 9852 }); 9853 $(".focusSwapWrap input[type=text]").blur(function(){ 9854 if ($(this).val().replace(/ /g,'')=="") { 9855 $(this).val(""); 9856 $(this).parent('.focusSwapWrap').removeClass("focus"); 9857 } 9858 }); 9859 $( '#nav li:has(ul)' ).doubleTapToGo(); 9860 $("#updateQuantitiesP").click(function(){ 9861 $("#quantityForm").submit(); 9862 return false; 9863 }); 9864 9865 9866}; 9867 9868 9869/* Frills mode */ 9870var frillinterval= 0; 9871var clearfrillsinterval; 9872function frillsScroll() { 9873 var $frills = $("h1:not(.column h1),h2:not(.column h2),.bpe_image:not(.column .bpe_image),.column"); 9874 var bottomedge = $(window).scrollTop() + $(window).height() - 50; 9875 $frills.each(function(){ 9876 if (!$(this).hasClass("frills_showing") && $(this).offset().top < bottomedge) { 9877 $(this).addClass("frills_showing"); 9878 var $t = $(this); 9879 setTimeout(function(){ 9880 $t.addClass("frills_shown"); 9881 },frillinterval); 9882 frillinterval = frillinterval+200; 9883 9884 } 9885 }); 9886 clearfrillsinterval = setTimeout(function(){ 9887 frillinterval= 0; 9888 },1000); 9889 9890}; 9891/* Sticky Sidebar */ 9892 9893function stickyReady() { 9894 $(".sticky-column-sidebar").parents('.container').addClass("with-sticky"); 9895 $(".sticky-column-sidebar").height($(".sticky-sidebar-inner").outerHeight()+"px"); 9896}; 9897function stickyLoad() { 9898 $(".sticky-column-sidebar").height($(".sticky-sidebar-inner").outerHeight()+"px"); 9899}; 9900/* Popup Message */ 9901 9902function popupReady() { 9903 var popuphash = hex_sha1($('#popupMessageBox').html()+""); 9904 if($('#popupMessageBox.autoshow').length && !$("body").hasClass("accessible-mode")) { 9905 $('#popupMessageBox.autoshow').each(function(){ 9906 $(this).data('html',$(this).html()); 9907 $(this).html(''); 9908 }); 9909
9910 var delay = $("body").data("popup-delay"); 9911 9912 if (!readCookie('seenPopupMessage'+popuphash)) { 9913 9914 setTimeout(function () { 9915 var message= $($("#popupMessageBox.autoshow").data('html')); 9916 $('body').append('<div id="popupMessageBoxPopup" title="Important Information"><div id="popupMessageBoxPopupCenter"><div id="popupMessageBoxPopupBox"><div id="closePopupBox"></div><div></div></div>'); 9917 message.appendTo($("#popupMessageBoxPopup > div > div")); 9918 setTimeout(function(){ 9919 $("#popupMessageBoxPopup .g-recaptchaload").each(function() { 9920 var object = $(this); 9921 var rid = grecaptcha.render(object.attr("id"), { 9922 "sitekey" :$(this).data("sitekey"), 9923 "callback" : function(token) { 9924 object.parents('form').find(".g-recaptcha-response").val(token); 9925 invisRecaptcha(token); 9926 } 9927 }); 9928 $(this).parents('form').attr('recapid',rid); 9929 }); 9930 bindForms(); 9931 },100); 9932 }, delay); 9933 9934 9935 } 9936 } 9937 $("body").on("click","#closePopupBox",function(){ 9938 9939 if (!$("#popupMessageBoxPopup").hasClass("fromlink")) { 9940 createCookie('seenPopupMessage'+popuphash,true,0); 9941 } 9942 9943 9944 $("#popupMessageBoxPopup").fadeOut(); 9945 setTimeout(function () { 9946 $("#popupMessageBoxPopup").remove(); 9947 }, 300); 9948 }); 9949 $('.popupMessageOnClickContent').each(function(){ 9950 $(this).data('html',$(this).html()); 9951 $(this).html(''); 9952 }); 9953 $(".popupMessageOnClick a").click(function(){ 9954 var message= $($(this).parents(".popupMessageOnClick").next('.popupMessageOnClickContent').data('html')); 9955 $('body').append('<div id="popupMessageBoxPopup" class="fromlink" title="Important Information"><div id="popupMessageBoxPopupCenter"><div id="popupMessageBoxPopupBox"><div id="closePopupBox"></div><div id="popupMessageContents"></div></div></div></div >'); 9956 message.appendTo($("#popupMessageContents")); 9957 setTimeout(function(){ 9958 $("#popupMessageContents .g-recaptchaload").each(function() { 9959 var object = $(this); 9960 var rid = grecaptcha.render(object.attr("id"), { 9961 "sitekey" :$(this).data("sitekey"), 9962 "callback" : function(token) { 9963 object.parents('form').find(".g-recaptcha-response").val(token); 9964 invisRecaptcha(token); 9965 } 9966 }); 9967 $(this).parents('form').attr('recapid',rid); 9968 }); 9969 bindForms(); 9970 },100); 9971 return false; 9972 }); 9973 9974}; 9975/* 9976function popupReady() { 9977 var popuphash = hex_sha1($('#popupMessageBox').html()+""); 9978 if($('#popupMessageBox.autoshow').length && !$("body").hasClass("accessible-mode")) { 9979 9980 var delay = $("body").data("popup-delay"); 9981 9982 if (!readCookie('seenPopupMessage'+popuphash)) { 9983 9984 setTimeout(function () { 9985 $('body').append('<div id="popupMessageBoxPopup" title="Important Information"><div id="popupMessageBoxPopupCenter"><div id="popupMessageBoxPopupBox"><div id="closePopupBox"></div><div></div></div></div></div>'); 9986$('#popupMessageBox').contents().clone(true).appendTo("#popupMessageBoxPopup >div> div"); 9987 }, delay); 9988 9989 9990 } 9991 } 9992 $("body").on("click","#closePopupBox",function(){ 9993 if (!$("#popupMessageBoxPopup").hasClass("fromlink")) { 9994 createCookie('seenPopupMessage'+popuphash,true,0); 9995 } 9996 9997 $("#popupMessageBoxPopup").fadeOut(); 9998 setTimeout(function () { 9999 $("#popupMessageBoxPopup").remove(); 10000 }, 300); 10001 }); 10002 $("#popupMessageOnClick a").click(function(){ 10003 var message = $(this).parents("#popupMessageOnClick").next('#popupMessageOnClickContent').contents().clone(true); 10004 $('body').append('<div id="popupMessageBoxPopup" class="fromlink" title="Important Information"><div id="popupMessageBoxPopupCenter"><div id="popupMessageBoxPopupBox"><div id="closePopupBox"></div><div id="popupMessageContents"></div></div></div></div >'); 10005 message.appendTo($("#popupMessageContents")); 10006 return false; 10007 }); 10008 10009}; 10010*/ 10011/* Filter subpage index 10012*/ 10013function filterReady() { 10014 $("#subPageIndexProducts").each(function(){ 10015 var attributes = {}; 10016 $(".productMeta",$(this)).each(function(){ 10017 var $product = $(this).parent(); 10018 if ($(this).text().trim()!="") { 10019 10020 var metaString = $(this).text().split(","); 10021 10022 for (var i = metaString.length - 1; i >= 0; i--){ 10023 var metaName = metaString[i].split(":")[0].trim(); 10024 var metaVal = metaString[i].split(":")[1].trim().split("||"); 10025 10026 10027 if (metaName in attributes) { 10028 10029 for (var y = 0; y < metaVal.length; y++) { 10030 $product.addClass("attr_"+metaName.replace(/[^a-zA-Z0-9]+/g,'')+"_"+metaVal[y].replace(/[^a-zA-Z0-9]+/g,'')); 10031 if ($.inArray(metaVal[y], attributes[metaName])===-1&&metaVal[y]!="") { 10032 attributes[metaName].push(metaVal[y]); 10033 } 10034 } 10035 10036 10037 } else { 10038 10039 attributes[metaName] = new Array(); 10040 for (var y = 0; y < metaVal.length; y++) { 10041 if (metaVal[y]!="") { 10042 $product.addClass("attr_"+metaName.replace(/[^a-zA-Z0-9]+/g,'')+"_"+metaVal[y].replace(/[^a-zA-Z0-9]+/g,'')); 10043 attributes[metaName].push(metaVal[y]); 10044 } 10045 } 10046 10047 } 10048 } 10049 10050 } 10051 10052 }); 10053 10054 for (var property in attributes) { 10055 10056 var filter = "<div class='filter_"+property.replace(/[^a-zA-Z0-9]+/g,'')+"'><label><strong>"+property+"</strong><br/><select name='"+property.replace(/[^a-zA-Z0-9]+/g,'')+"' class='filterMenu'><option value=''>All</option>"; 10057 10058 for (var i=0; i < attributes[property].length; i++) { 10059 filter += "<option value='"+attributes[property][i].replace(/[^a-zA-Z0-9]+/g,'')+"'>"+attributes[property][i]+"</option>"; 10060 }; 10061 10062 filter += "</select></label></div>"; 10063
10064 $("#subPageIndexProducts #filterBox").prepend(filter); 10065 10066 } 10067 $(".filterMenu").change(function(){ 10068 var needsClasses = ""; 10069 $(".subPageProducts").hide(); 10070 $(".filterMenu").each(function(){ 10071 if ($(this).val()!="") { 10072 needsClasses += ".attr_"+$(this).attr("name")+"_"+$(this).val(); 10073 } 10074 }); 10075 $(".filterMenu").each(function(){ 10076 var allhidden=true; 10077 if ($(this).val()!="") { 10078 var toRemoveWhenTesting=".attr_"+$(this).attr("name")+"_"+$(this).val(); 10079 }else{ 10080 var toRemoveWhenTesting=""; 10081 } 10082 $('option',$(this)).each(function() { 10083 var test = needsClasses + ".attr_"+$(this).parent().attr("name")+"_"+$(this).attr('value'); 10084 if (toRemoveWhenTesting!=""){ 10085 test = test.replace(toRemoveWhenTesting,""); 10086 } 10087 var testlength = $(test).length; 10088 if (testlength==0&&$(this).val()!="") { 10089 $(this).prop('disabled',true); 10090 }else { 10091 $(this).prop('disabled',false); 10092 if ($(this).val()!="") { 10093 allhidden=false; 10094 } 10095 } 10096 }); 10097 if (allhidden) { 10098 $(this).parent().hide(); 10099 }else{ 10100 $(this).parent().show(); 10101 } 10102 }); 10103 10104 if (needsClasses=="") { 10105 $(".subPageProducts").show(); 10106 } else { 10107 $(needsClasses).show(); 10108 } 10109 magicHeights(); 10110 10111 }); 10112 }); 10113 setTimeout(function () { 10114 if (window.location.href){ 10115 if (window.location.hash.indexOf("#filter")===0) { 10116 var preselect = window.location.hash.split("#filter-"); 10117 var string = preselect[1].split(":"); 10118 var option = string[0]; 10119 var value = string[1] 10120 if (option && value) { 10121 $(".filterMenu[name=\""+option+"\"]").val(value).trigger("change"); 10122 $("#filterBox .filterRadio[name=\""+option+"\"][value=\""+value+"\"]").prop("checked",true); 10123 10124 } 10125 } 10126 } 10127 }, 590); 10128 10129}; 10130/* 10131 Floating Sub Menu 10132*/ 10133 function checkFloatingSub() { 10134 if ($("#dmt-floating-sub-menu").length==0) { 10135 return false; 10136 } 10137 var $el = $("#dmt-floating-sub-menu:not(.fixed)"); 10138 $el.removeClass('mobile'); 10139 if ($("#dmt-floating-sub-menu:not(.fixed) a").length > 2 && $(window).width()<480) { 10140 $el.addClass('mobile'); 10141 } 10142 if ($("#dmt-floating-sub-menu:not(.fixed) a").length > 3 && $(window).width()<540) { 10143 $el.addClass('mobile'); 10144 } 10145 if ($("#dmt-floating-sub-menu:not(.fixed) a").length > 4 && $(window).width()<600) { 10146 $el.addClass('mobile'); 10147 } 10148 if ($("#dmt-floating-sub-menu:not(.fixed) a").length > 5 && $(window).width()<700) { 10149 $el.addClass('mobile'); 10150 } 10151 if ($("#dmt-floating-sub-menu:not(.fixed) a").length > 6 && $(window).width()<750) { 10152 $el.addClass('mobile'); 10153 } 10154 if ($("#dmt-floating-sub-menu:not(.fixed) a").length > 7 && $(window).width()<800) { 10155 $el.addClass('mobile'); 10156 } 10157 if ($el.offset().top + $el.outerHeight() < window.pageYOffset) { 10158 if (!$("#dmt-floating-sub-menu.fixed").length) { 10159 var l = $el.offset().left; 10160 $("body").append($el.clone(true).addClass("fixed").css("left",l+"px")); 10161 if ($el.hasClass('mobile')) { 10162 $("#submenu").remove(); 10163 $el.prepend("<div id='submenu'></div>") 10164 $("#dmt-floating-sub-menu.fixed a").remove(); 10165 $("#dmt-floating-sub-menu.fixed").append("<div class='mobile-menu'><p><a href=\"#submenu\">Menu</a></p></div>"); 10166 } else { 10167 $("#dmt-floating-sub-menu.fixed .dmt-floating-sub-menu-link").each(function(){ 10168 if (typeof $(this).data("move-dist")!="undefined") { 10169 $(this).css("top","-"+$(this).data("move-dist")+'px').css("margin-bottom","-"+$(this).data("move-dist")+'px'); 10170 } 10171 }); 10172 $("#dmt-floating-sub-menu.fixed .dmt-floating-sub-menu-link").hover(function(){ 10173 $(this).css("top","0px"); 10174 },function(){ 10175 $(this).css("top","-"+$(this).data("move-dist")+'px'); 10176 }); 10177 10178 } 10179 10180 $('a[href*="#"]:not([href="#"],[href="#navSearch"])',$('#dmt-floating-sub-menu.fixed')).unbind('click').click(function() { 10181 10182 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 10183 var target = $(this.hash); 10184 target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 10185 if (target.length) { 10186 10187 10188 if (typeof $(this).data("move-dist") != "undefined") { 10189 $('html, body').animate({ 10190 scrollTop: target.offset().top - $(this).outerHeight() + $(this).data("move-dist") 10191 }, 1500); 10192 } else { 10193 $('html, body').animate({ 10194 scrollTop: target.offset().top - $(this).outerHeight() 10195 }, 1500); 10196 } 10197 10198 10199 return false;
10200 } 10201 } 10202 }); 10203 10204 setTimeout(function () { 10205 $("#dmt-floating-sub-menu.fixed").addClass("visible"); 10206 }, 10); 10207 } 10208 10209 } 10210 if ($el.offset().top > window.pageYOffset -$el.outerHeight()) { 10211 $("#dmt-floating-sub-menu.fixed").removeClass("visible"); 10212 setTimeout(function () { 10213 $("#dmt-floating-sub-menu.fixed").remove(); 10214 }, 500); 10215 10216 } 10217 10218 10219 } 10220 function floatingScroll() { 10221 if ($("#dmt-floating-sub-menu:not(.fixed)").length) { 10222 checkFloatingSub(); 10223 } 10224 }; 10225 function floatingReady() { 10226 var $el = $("#dmt-floating-sub-menu:not(.fixed)"); 10227 $el.css("width",$el.width()); 10228 }; 10229 function floatingResize() { 10230 $("#dmt-floating-sub-menu.fixed").remove(); 10231 10232 var $el = $("#dmt-floating-sub-menu:not(.fixed)"); 10233 $el.removeAttr('style'); 10234 $el.css("width",$el.outerWidth()); 10235 checkFloatingSub(); 10236 addFloatingSubHeights(); 10237 }; 10238 function addFloatingSubHeights() { 10239 var $el = $("#dmt-floating-sub-menu:not(.fixed)"); 10240 $(".dmt-floating-sub-menu-link",$el).each(function(){ 10241 if ($(".bpe_image",$(this)).length) { 10242 10243 var h = $(".bpe_image",$(this)).outerHeight(); 10244 10245 $(this).data('move-dist',h); 10246 } 10247 }); 10248 } 10249 function floatingLoad() { 10250 addFloatingSubHeights(); 10251 10252 }; 10253 10254/* 10255 Product images 10256*/ 10257 function imagesReady() { 10258 if ($("#main .bpe_image").length) { 10259 var pagepic = $("#main .bpe_image:first").find("img").attr('src'); 10260 } else { 10261 var pagepic=false; 10262 } 10263 10264 10265 $(".addToBasketForm").each(function(){ 10266 if (pagepic) { 10267 if (!$("input[name=pic_url]",$(this)).length) { 10268 $(this).append('<input type="hidden" name="pic_url" value="'+pagepic+'"/>'); 10269 } 10270 } 10271 if (!$("input[name=url_str]",$(this)).length) { 10272 $(this).append('<input type="hidden" name="url_str" value="'+window.location.pathname+'"/>'); 10273 } 10274 }); 10275 $(".addToBasketLink").each(function(){ 10276 if (pagepic) { 10277 if ($(this).attr('href').indexOf("pic_url")==-1) { 10278 $(this).attr('href',$(this).attr('href')+'&pic_url='+encodeURIComponent(pagepic)); 10279 } 10280 10281 } 10282 if ($(this).attr('href').indexOf("url_str")==-1) { 10283 $(this).attr('href',$(this).attr('href')+'&url_str='+encodeURIComponent(window.location.pathname)); 10284 } 10285 }); 10286 $(".column_row").each(function(){ 10287 if ($("input[name=pic_url]",$(this)).length==1 && $("img",$(this)).length) { 10288 $("input[name=pic_url]",$(this)).val($("img",$(this)).first().attr('src')); 10289 } 10290 if ($(".addToBasketLink",$(this)).length==1 && $("img",$(this)).length) { 10291 var urlparts = $(".addToBasketLink",$(this)).attr('href').split("?"); 10292 10293 var query_parts = urlparts[1].split('&'); 10294 var newquery=""; 10295 for (var i = 0; i < query_parts.length; i++) { 10296 if (newquery!="") { 10297 newquery+="&"; 10298 } 10299 if (query_parts[i].indexOf("pic_url=")===0) { 10300 var imgurl = $("img",$(this)).first().attr('src').split("?"); 10301 newquery+="pic_url="+imgurl[0]; 10302 } else { 10303 newquery+=query_parts[i]; 10304 } 10305 10306 } 10307 10308 $(".addToBasketLink",$(this)).attr('href',urlparts[0]+"?"+newquery); 10309 } 10310 10311 }); 10312 $(".column").each(function(){ 10313 if ($("input[name=pic_url]",$(this)).length==1 && $("img",$(this)).length) { 10314 $("input[name=pic_url]",$(this)).val($("img",$(this)).first().attr('src')); 10315 } 10316 if ($(".addToBasketLink",$(this)).length==1 && $("img",$(this)).length) { 10317 var urlparts = $(".addToBasketLink",$(this)).attr('href').split("?"); 10318 10319 var query_parts = urlparts[1].split('&'); 10320 var newquery=""; 10321 for (var i = 0; i < query_parts.length; i++) { 10322 if (newquery!="") { 10323 newquery+="&"; 10324 } 10325 if (query_parts[i].indexOf("pic_url=")===0) { 10326 var imgurl = $("img",$(this)).first().attr('src').split("?"); 10327 newquery+="pic_url="+imgurl[0]; 10328 } else { 10329 newquery+=query_parts[i]; 10330 } 10331 10332 } 10333 10334 $(".addToBasketLink",$(this)).attr('href',urlparts[0]+"?"+newquery); 10335 } 10336 10337 }); 10338 }; 10339/* 10340 Icon text 10341*/ 10342 function fixIconLinks(c) { 10343 $("."+c).each(function(){ 10344 if ($(">a",$(this)).length) { 10345 if ($(">a",$(this)).text()==$(this).text()) { 10346 $(">a",$(this)).addClass(c); 10347 $(this).removeClass(c); 10348 } 10349 } 10350 }); 10351 } 10352 function iconsReady() { 10353 var icons = new Array(); 10354 icons.push("Icon_Phone"); 10355 icons.push("Icon_Tick"); 10356 icons.push("Icon_Info"); 10357 icons.push("Icon_Question"); 10358 icons.push("Icon_Alert"); 10359 icons.push("Icon_Email"); 10360 icons.push("Icon_Home"); 10361 icons.push("Icon_Livechat"); 10362 10363 for (var i = 0; i < icons.length; i++) { 10364 fixIconLinks(icons[i]); 10365 } 10366 }; 10367/* 10368 Hover Image 10369*/ 10370 function hoverImageReady() { 10371 if (!$('body').hasClass("accessible-mode")){ 10372 $(".Hover_Image_Button").click(function(){ $("a",$(this)).trigger("click"); }); 10373 $(".Hover_Image_Button").each(function(){ 10374 $("a",$(this)).append("<div class='cms_hover_image_hover'><img src='"+$(this).data('hover-src')+"'/></div>"); 10375 }); 10376 } 10377 }; 10378/* 10379 10380 #Popup Video 10381 10382*/ 10383 function showMPPopup(src,desc) { 10384 $("#mp_lightbox_outer").removeClass("ytvidmp"); 10385 10386 $("#mp_lightbox_inner,#mp_lightbox_outer_outer").removeAttr("style"); 10387 if (src.substr(src.length - 4).toLowerCase()==".png" 10388 || src.substr(src.length - 4).toLowerCase()==".jpg" 10389 || src.substr(src.length - 5).toLowerCase()==".jpeg" 10390 || src.substr(src.length - 4).toLowerCase()==".gif" 10391 || src.substr(src.length - 5).toLowerCase()==".apng" 10392 ) { 10393 10394 var img = new Image(); 10395 img.onload = function() { 10396 $("#mp_lightbox_outer").fadeIn(); 10397 10398 var r = this.height/this.width*100; 10399 $("#mp_lightbox_inner").css("padding-bottom",r+"%"); 10400 $("#mp_lighbox_content").data("ratio",r); 10401 $("#mp_lightbox_outer_outer").data("maxw",this.width).css("width",this.width+"px"); 10402 if ($("#mp_lighbox_content").height()+100>$(window).height()) { 10403 var nw = ($(window).height()-100) / (r/100); 10404 $("#mp_lightbox_outer_outer").css("width",nw+"px"); 10405 } 10406 10407 $("#mp_lighbox_content").html("<img src='"+src+"' style=\"width:100%\"/>"); 10408 if (desc!="") { 10409 $("#mp_lighbox_content").append('<div class="mpPopupDescOuter"><div class="mpPopupDesc">'+desc+'</div></div>'); 10410 } 10411 10412 } 10413 img.src = src; 10414 } 10415 if (src.substr(src.length - 4).toLowerCase()==".mp4") { 10416 10417 $("#mp_lightbox_outer").fadeIn(); 10418 10419 $("#mp_lightbox_inner").css("padding-bottom","56.25%"); 10420 $("#mp_lightbox_outer_outer").css("width","1800px"); 10421 if ($("#mp_lighbox_content").height()+100>$(window).height()) { 10422 var nw = ($(window).height()-100) / (56.25/100); 10423 $("#mp_lightbox_outer_outer").css("width",nw+"px"); 10424 } 10425 10426 10427 var width = $("#mp_lighbox_content").width(); 10428 var height = $("#mp_lighbox_content").height(); 10429 var video = src; 10430 $("#mp_lighbox_content").html("<div id=\"videoMPPopup\" class='jplayerInit' data-poster='/graphics/play.jpg' data-vid='"+video+"'>"+playerHTML+"</div>"); 10431 makeVideo("videoMPPopup",width,height,"/graphics/play.jpg",video,true,false); 10432 } 10433 10434 if (src.substr(0,23)=="https://www.youtube.com" || src.substr(0,22)=="http://www.youtube.com") { 10435 src = src.replace("/watch?v=","/embed/"); 10436 src = src.split("/embed/"); 10437 src = src[1]; 10438 $("#mp_lightbox_outer").fadeIn().addClass("ytvidmp"); 10439 10440 $("#mp_lightbox_inner").css("padding-bottom","56.25%"); 10441 $("#mp_lightbox_outer_outer").css("width","1800px"); 10442 if ($("#mp_lighbox_content").height()+100>$(window).height()) { 10443 var nw = ($(window).height()-100) / (56.25/100); 10444 $("#mp_lightbox_outer_outer").css("width",nw+"px"); 10445 } 10446 10447 10448 var width = $("#mp_lighbox_content").width(); 10449 var height = $("#mp_lighbox_content").height(); 10450 $("#mp_lighbox_content").html("<div id='mppopupytplayer'></div>"); 10451 10452 mpytplayer = new YT.Player('mppopupytplayer', { 10453 height: "100%", 10454 width: "100%", 10455 videoId: src, 10456 playerVars: {autoplay:1,rel:0} 10457 }); 10458 10459 } 10460 10461 } 10462 function mp_lightboxResize() { 10463 if ($("#mp_lightbox_outer:visible").length && $("#mp_lighbox_content img").length) { 10464 10465 var r = $("#mp_lighbox_content").data("ratio"); 10466 if ($("#mp_lighbox_content").height()+100>$(window).height()) { 10467 var nw = ($(window).height()-100) / (r/100); 10468 $("#mp_lightbox_outer_outer").css("width",nw+"px"); 10469 } else { 10470 $("#mp_lightbox_outer_outer").css("width",$("#mp_lightbox_outer_outer").data("maxw")+'px'); 10471 } 10472 } 10473 if ($("#mp_lightbox_outer:visible").length && $("#mp_lightbox_outer").hasClass("ytvidmp")) { 10474 10475 $("#mp_lightbox_inner").css("padding-bottom","56.25%"); 10476 $("#mp_lightbox_outer_outer").data("maxw",this.width).css("width",this.width+"px"); 10477 if ($("#mp_lighbox_content").height()+100>$(window).height()) { 10478 var nw = ($(window).height()-100) / (56.25/100); 10479 $("#mp_lightbox_outer_outer").css("width",nw+"px"); 10480 } else { 10481 $("#mp_lightbox_outer_outer").css("width","1800px"); 10482 } 10483 } 10484 }; 10485 var mpplayer_tag = document.createElement('script'); 10486 mpplayer_tag.src = "https://www.youtube.com/iframe_api"; 10487 var firstScriptTag = document.getElementsByTagName('script')[0]; 10488 firstScriptTag.parentNode.insertBefore(mpplayer_tag, firstScriptTag); 10489 var mpytplayer; 10490 function mpPopupReady() { 10491 $("#showCouponCode").click(function(){ 10492 $("#couponForm").slideDown(); 10493 return false;
10494 }); 10495 $(".Popup_Link").each(function(){ 10496 if (typeof $("img",$(this)).attr("alt") != 'undefined') { 10497 var text = $("img",$(this)).attr("alt"); 10498 if (text.indexOf('[caption:')!=-1) { 10499 var texts = text.split("[caption:"); 10500 var captions = texts[1].split("]"); 10501 caption = captions[0].trim(); 10502 text = caption.split("||"); 10503 var alt = captions[1].trim(); 10504 $("img",$(this)).attr("alt",alt); 10505 } else { 10506 var alt = text; 10507 text = text.split("||"); 10508 var caption = alt; 10509 } 10510 $("img",$(this)).attr('caption',caption); 10511 } 10512 }); 10513 if (!$('body').hasClass("accessible-mode")){ 10514 $(".Popup_Link").click(function(){ 10515 var desc = ""; 10516 if (typeof $(this).find("img").attr("alt") != "undefined" && $(this).find("img").attr("alt")!="") { 10517 desc = $(this).find("img").attr("alt"); 10518 } 10519 if (typeof $(this).find("img").attr('caption')!="undefined") { 10520 desc = $(this).find('img').attr('caption'); 10521 } 10522 if ($(this).find('a').length) { 10523 var href=$(this).find('a').attr('href'); 10524 } else { 10525 if ($(this).find('img').length) { 10526 var href = $(this).find('img').attr('src').split('?'); 10527 href = href[0]; 10528 } 10529 } 10530 if (typeof href != "undefined") { 10531 showMPPopup(href,desc); 10532 } 10533 return false; 10534 }); 10535 $("#closeMP").click(function(){ 10536 $("#mp_lightbox_outer").fadeOut(); 10537 if ($("#videoMPPopup .jplayer").hasClass("playing")) { 10538 $("#videoMPPopup .jplayer").jPlayer("stop"); 10539 } 10540 if (mpytplayer) { 10541 mpytplayer.stopVideo(); 10542 } 10543 return false; 10544 10545 }); 10546 } 10547 }; 10548/* 10549 10550 #Expand Collapse Widgets 10551 10552*/ 10553 function expandReady() { 10554 if (!$('body').hasClass("accessible-mode")){ 10555 $(".expand-box-content").slideUp(300,function(){ 10556 moduleHeights(); 10557 }); 10558 $(".expand-box-title").click(function(e){ 10559 if ($(e.target)[0].tagName.toLowerCase() == "a") { 10560 if ($(e.target).attr('href')!="#") { 10561 return true; 10562 } 10563 10564 } 10565 if ($(this).parent().hasClass("showing")) { 10566 $(this).parent().removeClass("showing").find("> .expand-box-content").slideUp(300,function(){ 10567 moduleHeights(); 10568 }); 10569 } else { 10570 $("> .showing > .expand-box-content",$(this).parent().parent()).slideUp(295).parent().removeClass("showing"); 10571 $(this).parent().addClass("showing"); 10572 $("> .expand-box-content",$(this).parent()).slideDown(300,function(){ 10573 imageMarginHelper(); 10574 moduleHeights(); 10575 }); 10576 } 10577 return false; 10578 }); 10579 10580 } 10581 }; 10582/* 10583 10584 #Popdown widgets 10585 10586*/ 10587 function hideSearchPopdown() { 10588 $("#search-form-popdown").removeClass("visible"); 10589 setTimeout(function () { 10590 $("#search-form-popdown").removeClass("animate").removeAttr("style"); 10591 }, 300); 10592 $(".display-popdown-widget a.active").removeClass("active"); 10593 10594 } 10595 function popdownReady() { 10596 backstretches(); 10597 $("html").click(function(e){ 10598 if (e.target.nodeName.toLowerCase()!="input") { 10599 hideSearchPopdown(); 10600 } 10601 10602 }); 10603 $("body").on("click",".display-popdown-widget a",function(e){ 10604 if ($(this).hasClass("active")) { 10605 $(this).removeClass("active"); 10606 hideSearchPopdown(e); 10607 } else { 10608 $(this).addClass("active"); 10609 var $pd = $("#"+$(this).data("target")); 10610 10611 var lh = $(this).outerWidth() / 2; 10612 var ol = $(this).offset().left + lh; 10613 var t = $(this).offset().top + $(this).outerHeight() + 3; 10614 var pl = 160; 10615 ol = ol - pl; 10616 $(".tri",$pd).css("margin-left","-6px"); 10617 if (ol + 320 > $(window).width()-20) { 10618 var diff = ol + 320 - $(window).width() + 10; 10619 ol = ol - diff; 10620 diff = diff-6; 10621 $(".tri",$pd).css("margin-left",diff+"px"); 10622 } 10623 $pd.css("left",ol+"px").css("top",t+"px"); 10624 setTimeout(function () { 10625 $pd.addClass("animate"); 10626 $pd.addClass("visible"); 10627 }, 1); 10628 $("input",$pd).focus(); 10629 } 10630 10631 return false; 10632 }); 10633 }; 10634/* 10635 10636 #Basic init setup 10637 10638*/ 10639 10640 var scrolling = false; 10641 var scrollingTimer; 10642 var scroll = window.requestAnimationFrame || 10643 window.webkitRequestAnimationFrame || 10644 window.mozRequestAnimationFrame || 10645 window.msRequestAnimationFrame || 10646 window.oRequestAnimationFrame || 10647 function(callback){ window.setTimeout(callback, 1000/60) }; 10648 10649 if(navigator.userAgent.indexOf('AppleWebKit') != -1){ 10650 var isWebKit = true; 10651 } else { 10652 var isWebKit = false;
10653 } 10654 10655 10656 10657 function parallaxScroll(timestamp) { 10658 $("*[data-scroll-decay]").each(function(){ 10659 //var st = $(document).scrollTop(); 10660 var st = window.pageYOffset; 10661 var ot = $(this).offset().top; 10662 var th = $(this).outerHeight(); 10663 var wh = $(window).height(); 10664 10665 var decay = 0.5; 10666 if (typeof $(this).data("scroll-decay") != 'undefined') { 10667 decay = $(this).data("scroll-decay"); 10668 } 10669 if (st<0) { 10670 st=0; 10671 } 10672 10673 if (isWebKit) { 10674 $("body").addClass("supports-pos-fixed"); 10675 decay = 1-decay; 10676 move = ot-st; 10677 move = move*decay; 10678 10679 } else { 10680 move = ot-st; 10681 move = -move*decay; 10682 } 10683 10684 $("> .backstretch img:last",$(this)) 10685 .css("-moz-transform","translate3d(0,"+move+"px,0)") 10686 .css("-webkit-transform","translate3d(0,"+move+"px,0)") 10687 .css("-o-transform","translate3d(0,"+move+"px,0)") 10688 .css("transform","translate3d(0,"+move+"px,0)"); 10689 10690 10691 }); 10692 scroll(parallaxScroll); 10693 10694 } 10695 10696 function backtotopScroll() { 10697 scrolling = true; 10698 clearTimeout(scrollingTimer); 10699 scrollingTimer = setTimeout(function () { 10700 scrolling = false; 10701 }, 100); 10702 10703 $("#backToTop").show().css("opacity","0"); 10704 if ($(document).scrollTop()>200) { 10705 $("#backToTop").css("opacity","1"); 10706 } else { 10707 $("#backToTop").css("opacity","0"); 10708 } 10709 10710 }; 10711 function miscLoad() { 10712 setRecentBlogWidths(); 10713 if ($("#logo img").width()<$("#logo").width()) { 10714 $("#logo").css("width",$("#logo img").width()+"px"); 10715 } 10716 imageMarginHelper(); 10717 flexiBreak(); 10718 backstretches(); 10719 10720 setTimeout(function () { 10721 $(window).trigger("resize"); 10722 $("body").addClass("loaded"); 10723 }, 50); 10724 10725 }; 10726 var ww = 0; 10727 function miscResize() { 10728 if (!scrolling){ 10729 var st = $(document).scrollTop(); 10730 $("#mobile-menu-auto").addClass("hidden"); 10731 imageMarginHelper(); 10732 hideSearchPopdown(); 10733 flexiBreak(); 10734 setRecentBlogWidths(); 10735 $("body,html").scrollTop(st); 10736 if ($('body').hasClass("match-parallax-zoom")) { 10737 backstretches(); 10738 } 10739 setTimeout(function () { 10740 backstretches(); 10741 }, 200); 10742 } 10743 10744 10745 }; 10746 var hidingPagePreview; 10747 10748 10749 function backstretches() { 10750 if (!$('body').hasClass('accessible-mode')) { 10751 $("*[data-backgrounds]").each(function(){ 10752 var duration = 4000; 10753 var fade = 1000; 10754 var opacity = 1; 10755 var colour = "transparent"; 10756 var align = "center"; 10757 if (typeof $(this).data("background-align") != 'undefined') { 10758 align = $(this).data("background-align"); 10759 } 10760 if (typeof $(this).data("background-color") != 'undefined') { 10761 colour = $(this).data("background-color"); 10762 } 10763 if (typeof $(this).data("background-opacity") != 'undefined') { 10764 opacity = $(this).data("background-opacity"); 10765 } 10766 if (typeof $(this).data("background-duration") != 'undefined') { 10767 duration = $(this).data("background-duration"); 10768 } 10769 if (typeof $(this).data("background-fade") != 'undefined') { 10770 fade = $(this).data("background-fade"); 10771 } 10772 if ($(this).data('parallax-combined')) { 10773 $(".combined-parallax-bg-wrap",$(this)).remove(); 10774 var c = 9; 10775 10776 for (var i = 0; i < $(this).data("backgrounds").length; i++) { 10777 10778 $(this).append("<div class='combined-parallax-bg-wrap' data-scroll-decay='0."+c+"'></div>") 10779 $(this).find(".combined-parallax-bg-wrap:last").backstretch($(this).data("backgrounds")[i], {duration: duration, fade: fade, parallax: true,align:align}); 10780 10781 c--; 10782 10783 } 10784 10785 } else { 10786 10787 if (typeof $(this).data("scroll-decay") != "undefined") { 10788 if ($(this).data("background-panzoom")==1) { 10789 $(this).backstretch($(this).data("backgrounds"), {duration: duration, fade: fade, parallax: true, panzoom: true,align:align}); 10790 } else { 10791 $(this).backstretch($(this).data("backgrounds"), {duration: duration, fade: fade, parallax: true,align:align}); 10792 } 10793 10794 } else { 10795 if ($(this).data("background-panzoom")==1) { 10796 $(this).backstretch($(this).data("backgrounds"), {duration: duration, fade: fade, panzoom: true,align:align}); 10797 } else { 10798 $(this).backstretch($(this).data("backgrounds"), {duration: duration, fade: fade,align:align}); 10799 } 10800 10801 } 10802 if ($(this).data("background-panzoom")==1) { 10803 $(this).addClass('panzoom'); 10804 } 10805 $(".backstretch",$(this)).css("opacity",opacity); 10806 } 10807 10808 $(this).css("background-color",colour); 10809 }); 10810 } 10811 } 10812 function moduleHeights () { 10813 10814 $(".widget-banner-window-height").each(function(){ 10815 var wh = $(window).height(); 10816 10817 $('.banner-feature',$(this)).css('min-height',wh+"px"); 10818 }); 10819 $(".vertical-align .column").css("padding-top","0px"); 10820 $(".vertical-align").each(function(){ 10821 var tallest = 0; 10822 $(".column",$(this)).each(function(){ 10823 if ($(this).height()>tallest) { 10824 tallest = $(this).height(); 10825 } 10826 }); 10827 $(".column",$(this)).each(function(){ 10828 if ($(this).height()<tallest) { 10829 var pt = tallest - $(this).height(); 10830 pt = pt / 2; 10831 $(this).css('padding-top',pt+'px'); 10832 } 10833 }); 10834 10835 }); 10836 $(".row:visible:not(.mobile-menu-row,.exclude .row)").each(function(){ 10837 // calculate row height 10838 var rowhl = 0; 10839 var rowhr = 0; 10840 var subrowh=0; 10841 var firstrow=true; 10842 var wrapperspace = 0; 10843 if ($("> *:not(.module)",$(this)).length) { 10844 wrapperspace = 10845 parseFloat($("> *:not(.module)",$(this)).css("padding-top")) 10846 + parseFloat($("> *:not(.module)",$(this)).css("margin-top")) 10847 + parseFloat($("> *:not(.module)",$(this)).css("border-top-width")) 10848 + parseFloat($("> *:not(.module)",$(this)).css("padding-bottom")) 10849 + parseFloat($("> *:not(.module)",$(this)).css("margin-bottom")) 10850 + parseFloat($("> *:not(.module)",$(this)).css("border-bottom-width")) 10851 ; 10852 rowhl = wrapperspace; 10853 } 10854 $(".module",$(this)).each(function(){ 10855 if ($(this).outerHeight(true)>rowhl) { 10856 rowhl = $(this).outerHeight(true); 10857 } 10858 }); 10859 rowhl = rowhl+subrowh; 10860 10861 $(".align-left:not(.valign),.align-:not(.valign)",$(this)).each(function(){ 10862 if ($(this).hasClass("clear-left") || firstrow) { 10863 firstrow = false;
10864 subrowh = subrowh+$(this).outerHeight(true); 10865 10866 } else { 10867 if ($(this).outerHeight(true)>subrowh) { 10868 subrowh=$(this).outerHeight(true); 10869 } 10870 } 10871 }); 10872 if (subrowh>rowhl) { 10873 rowhl = subrowh; 10874 } 10875 subrowh=0; 10876 firstrow=true; 10877 $(".align-right:not(.valign)",$(this)).each(function(){ 10878 10879 if ($(this).hasClass("clear-right") || firstrow) { 10880 firstrow=false 10881 subrowh = subrowh+$(this).outerHeight(true); 10882 } else { 10883 if ($(this).outerHeight(true)>subrowh) { 10884 subrowh=$(this).outerHeight(true); 10885 } 10886 } 10887 10888 rowhr = rowhr+subrowh; 10889 10890 }); 10891 10892 subrowh=0; 10893 firstrow=true; 10894 $(".align-center",$(this)).each(function(){ 10895 if (!$(this).next().length&&!$(this).prev().length) { 10896 subrowh = $(this).outerHeight(true); 10897 } 10898 rowhr = rowhr+subrowh; 10899 if ($(this).outerHeight(true)>rowhr) { 10900 rowhr=$(this).outerHeight(true); 10901 } 10902 10903 }); 10904 10905 10906 $(".align-justify",$(this)).each(function(){ 10907 10908 if (!$(this).hasClass("clear-right")) { 10909 if ($(this).prev().hasClass("align-right")) { 10910 if ($(this).prev().hasClass("clear-right")) { 10911 var oldrow = $(this).prev().outerHeight(true); 10912 } else { 10913 var oldrow = 0; 10914 $(this).prevUntil(".clear-right",".align-right").each(function(){ 10915 if ($(this).outerHeight(true)>oldrow) { 10916 oldrow = $(this).outerHeight(true); 10917 } 10918 }); 10919 } 10920 if ($(this).outerHeight(true) > oldrow) { 10921 rowhr = rowhr-oldrow; 10922 rowhr = rowhr+$(this).outerHeight(true); 10923 } 10924 } 10925 if (!$(this).next().length&&!$(this).prev().length) { 10926 rowhr = rowhr+$(this).outerHeight(true); 10927 } 10928 } 10929 10930 10931 if (!$(this).hasClass("clear-left")) { 10932 if ($(this).prev().hasClass("align-left")) { 10933 if ($(this).prev().hasClass("clear-left")) { 10934 var oldrow = $(this).prev().outerHeight(true); 10935 } else { 10936 var oldrow = 0; 10937 $(this).prevUntil(".clear-left",".align-left").each(function(){ 10938 if ($(this).outerHeight(true)>oldrow) { 10939 oldrow = $(this).outerHeight(true); 10940 } 10941 }); 10942 } 10943 if ($(this).outerHeight(true) > oldrow) { 10944 rowhl = rowhl-oldrow; 10945 rowhl = rowhl+$(this).outerHeight(true); 10946 } 10947 } 10948 } 10949 10950 10951 }); 10952 10953 10954 var wh = 0; 10955 $(".width",$(this)).each(function(){ 10956 if ($(this).hasClass("width-valign-middle")||$(this).hasClass("width-valign-bottom")) { 10957 if ($(this).find("> div").outerHeight(true)>wh) { 10958 wh=$(this).find("> div").outerHeight(true); 10959 } 10960 10961 } else { 10962 if ($(this).outerHeight(true)>wh) { 10963 wh=$(this).outerHeight(true); 10964 } 10965 10966 } 10967 }); 10968 $(".width",$(this)).css("height",wh+"px"); 10969 10970 10971 10972 if (rowhl>rowhr) { 10973 var r = rowhl; 10974 } else { 10975 var r = rowhr; 10976 } 10977 10978 if (wh > r) { 10979 r = wh; 10980 } 10981 10982 $(this).css("height",r+"px"); 10983 10984 10985 if (typeof $(this).data("min-height")!='undefined') { 10986 $(this).css('height','auto'); 10987 10988 if ($(this).data("min-height")=="window") { 10989 var wh = $(window).height(); 10990 } else { 10991 var wh = parseFloat($(this).data("min-height")); 10992 if ($(this).data("scale-prop")) { 10993 var ratio = 1000 / wh; 10994 wh = $(window).width() / ratio; 10995 } 10996 } 10997 10998 var p = wh / 2; 10999 var pt = p - r/2; 11000 var pb = p - r/2; 11001 var deduct = parseFloat($(this).parent(".container").css("padding-top")) + parseFloat($(this).parent(".container").css("border-top-width")) + parseFloat($(this).css("margin-top")); 11002 11003 pt = pt - deduct; 11004 pb = pb - deduct; 11005 if (pt>0&&pb>0) { 11006 //if (pb>r) { 11007 $(this).css("padding-top",pt+"px").css("padding-bottom",pb+"px"); 11008 //} else { 11009 // $(this).css("padding-top","0px").css("padding-bottom","0px"); 11010 //} 11011 11012 } else { 11013 $(this).css("padding-top","0px").css("padding-bottom","0px"); 11014 } 11015 } 11016 11017 $(".width-valign-middle").each(function(){ 11018 var t = $(this).find("> div,> ul").height() / 2; 11019 $(this).find("> *").css("margin-bottom","-"+t+'px'); 11020 }); 11021 11022 }); 11023 $(".sticky-column-sidebar").height($(".sticky-sidebar-inner").outerHeight()+"px"); 11024 11025 } 11026 function setFixedHeader() { 11027 if ($("body").hasClass("with-fixed-header")) { 11028 if ($("#all_headers_bg").length) { 11029 var $header = $("#all_headers_bg"); 11030 } else { 11031 var $header = $("#header"); 11032 } 11033 11034 $("body").css("padding-top","0px"); 11035 $header.css({position:"relative"}); 11036 var targeth = $header.height()*1.2; 11037 if ($(window).height()>targeth) { 11038 $header.css({top:"0px",left:"0px",right:"0px",position:"fixed"}); 11039 toscroll = 1; 11040 if (!$("body").hasClass("skip-padding")) { 11041 11042 $("#header .container.hide-in-fixed").each(function(){ 11043 $(this).addClass("no-animate"); 11044 $(this).css("max-height","2000px"); 11045 $(this).css("max-height",$(this).outerHeight()+"px"); 11046 $(this).removeClass("no-animate"); 11047 toscroll = toscroll + $(this).outerHeight(); 11048 }); 11049 $("#header .container:not(.hide-in-fixed)").each(function(){ 11050 if ($(".logo-module.with-fixed-logo-version",$(this)).length) { 11051 toscroll = toscroll + $(this).outerHeight()/2; 11052 } 11053 }); 11054 var headerHeight = $header.outerHeight(); 11055 11056 $("body").css("padding-top",headerHeight+"px"); 11057 11058 } 11059 } 11060 } 11061 if ($("body").hasClass("header-no-height")) { 11062 if ($("#all_headers_bg").length) { 11063 var $header = $("#all_headers_bg"); 11064 } else { 11065 var $header = $("#header"); 11066 } 11067 var headerHeight = $("#header").outerHeight(); 11068 $header.css("margin-bottom","-"+headerHeight+"px"); 11069 } 11070 } 11071 var toscroll = 1; 11072 function fixedHeaderScroll() { 11073 if ($("#all_headers_bg").length) { 11074 var $header = $("#all_headers_bg"); 11075 } else { 11076 var $header = $("#header"); 11077 } 11078 11079 var targeth = $header.height()*1.2; 11080 11081 if ($("body").hasClass("with-fixed-header") && $(window).height()>targeth) { 11082 var t = $(document).scrollTop(); 11083 if (t > toscroll) { 11084 $("body").addClass("showing-fixed-header"); 11085 setTimeout(function () { 11086 $(".backstretch").each(function(){ 11087 var instance = $(this).parent().data("backstretch"); 11088 instance.resize(); 11089 }); 11090 }, 650); 11091 $(".logo-module.with-fixed-logo-version").each(function(){ 11092 $("img",$(this)).attr("src",$(this).data("logo-fixed-img")); 11093 $("img",$(this)).attr("width",$(this).data("logo-fixed-width")); 11094 $("img",$(this)).attr("height",$(this).data("logo-fixed-height")); 11095 }); 11096 var miniHeaderSpace = $("#header").height(); 11097 if ($(window).width()>800) { 11098 $(".sticky-column-sidebar").css("top",miniHeaderSpace+"px"); 11099 } 11100 11101 } else { 11102 $("body").removeClass("showing-fixed-header"); 11103 setTimeout(function () { 11104 $(".backstretch").each(function(){ 11105 var instance = $(this).parent().data("backstretch"); 11106 instance.resize(); 11107 }); 11108 }, 650); 11109 $(".logo-module.with-fixed-logo-version").each(function(){ 11110 $("img",$(this)).attr("src",$(this).data("logo-normal-img")); 11111 $("img",$(this)).attr("width",$("img",$(this)).data("orig-width")); 11112 $("img",$(this)).attr("height",$("img",$(this)).data("orig-height")); 11113 }); 11114 if ($(window).width()>800) { 11115 11116 $(".sticky-column-sidebar").height($(".sticky-sidebar-inner").outerHeight()+"px"); 11117 } 11118 } 11119 if ($(".logo-module.with-fixed-logo-version").length) { 11120 moduleHeights(); 11121 } 11122 }; 11123 } 11124 function checkMobileMenuHeights() { 11125 if ($("#mobile-menu-page-wrap").length) { 11126 if ($("#mobile-menu-page-wrap").height()<$(window).height()) { 11127 $("#mobile-menu-page-wrap").css("min-height",$(window).height()+"px").css("padding-top",$("body").css("padding-top")); 11128 } 11129 if ($("#mobile-menu-behind").height()<$(window).height()) { 11130 $("#mobile-menu-behind").css("min-height",$(window).height()+"px").css("padding-top",$("body").css("padding-top")); 11131 } 11132 } 11133 } 11134 function modules() { 11135 11136 $(".align-center:visible:not(.width)").each(function(){ 11137 var $t = $(this); 11138 var l = $t.css("left"); 11139 var r = $t.css("right"); 11140 $t.css({opacity:0,float:"left",width:"auto",right:"auto",left:"auto"}); 11141 var w = $t.outerWidth() + 1; 11142 $t.css({width:w+"px",float:"none",opacity:1,left:l,right:r}); 11143 }); 11144 $(".valign-middle:not(.width,.align-center)").each(function(){ 11145 var t = $(this).height() / 2; 11146 $(this).css("margin-bottom","-"+t+'px'); 11147 }); 11148 $(".align-center.valign-middle.nav").each(function(){ 11149 var t = $(this).find("li:first").height() / 2; 11150 $(this).find("li:not(#nav-logo)").css("margin-top","-"+t+'px'); 11151 }); 11152 11153 $(".row:visible:not(.exclude .row)").each(function(){ 11154 11155 var $row = $(this); 11156 $row.css("height","auto"); 11157 $(".width",$(this)).css("height","auto"); 11158 11159 // Loop through all valign-bottom align-right clear-right items and adjust the bottom position so they stack. 11160 var offset =0 11161 var $els = $($(".valign-bottom.clear-right",$(this)).get().reverse()); 11162 $els.each(function(){ 11163 $(this).css("bottom",offset+"px"); 11164 offset=offset+$(this).outerHeight(true); 11165 });
11166 if ($els.last().hasClass("valign-bottom")) { 11167 $els.last().prevUntil(":not(.align-right,.align-justify),.clear-right",".valign-bottom.align-right").css("bottom",offset+"px"); 11168 } 11169 11170 // Loop through all valign-bottom align-left clear-left items and adjust the bottom position so they stack. 11171 var offset =0 11172 var $els = $($(".valign-bottom.clear-left",$(this)).get().reverse()); 11173 $els.each(function(){ 11174 $(this).css("bottom",offset+"px"); 11175 offset=offset+$(this).outerHeight(true); 11176 }); 11177 if ($els.last().prev().hasClass("valign-bottom")) { 11178 $els.last().prevUntil(":not(.align-left,.align-justify),.clear-left",".valign-bottom.align-left").css("bottom",offset+"px"); 11179 } 11180 11181 // Loop through all valign-top align-right clear-right items and adjust the top position so they stack. 11182 var offset =0 11183 var $els = $($(".valign-top.clear-right",$(this)).get()); 11184 $els.each(function(){ 11185 $(this).css("top",offset+"px"); 11186 offset=offset+$(this).outerHeight(true); 11187 }); 11188 if ($els.last().hasClass("valign-top")) { 11189 $els.last().prevUntil(":not(.align-right,.align-justify),.clear-right",".valign-top.align-right").css("top",offset+"px"); 11190 } 11191 11192 // Loop through all valign-top align-left clear-left items and adjust the top position so they stack. 11193 var offset =0 11194 var $els = $($(".valign-top.clear-left",$(this)).get()); 11195 $els.each(function(){ 11196 $(this).css("top",offset+"px"); 11197 offset=offset+$(this).outerHeight(true); 11198 });
11199 if ($els.last().prev().hasClass("valign-top")) { 11200 $els.last().prevUntil(":not(.align-left,.align-justify),.clear-left",".valign-top.align-left").css("top",offset+"px"); 11201 } 11202 11203 11204 11205 11206 // Go through valign-top align-right items and adjust right position so they sit on the same row 11207 var widths = parseFloat($(".valign-top.align-right",$(this)).css("right")); 11208 $(".valign-top.align-right",$(this)).each(function(){ 11209 widths = widths+$(this).outerWidth(true); 11210 if (!$(this).next().hasClass("clear-right") && $(this).next(".valign-top.align-right").length) { 11211 $(this).next().css("right",widths+"px"); 11212 } 11213 11214 }); 11215 11216 // Go through valign-middle align-right items and adjust right position so they sit on the same row 11217 var widths = parseFloat($(".valign-middle.align-right",$(this)).css("right")); 11218 $(".valign-middle.align-right",$(this)).each(function(){ 11219 widths = widths+$(this).outerWidth(true); 11220 if (!$(this).next().hasClass("clear-right") && $(this).next(".valign-middle.align-right").length) { 11221 $(this).next().css("right",widths+"px"); 11222 } 11223 11224 }); 11225 11226 // Go through valign-bottom align-right items and adjust right position so they sit on the same row 11227 var widths = parseFloat($(".valign-bottom.align-right",$(this)).css("right")); 11228 $(".valign-bottom.align-right",$(this)).each(function(){ 11229 widths = widths+$(this).outerWidth(true); 11230 if (!$(this).next().hasClass("clear-right") && $(this).next(".valign-bottom.align-right").length) { 11231 $(this).next().css("right",widths+"px"); 11232 } 11233 11234 }); 11235 11236 // Go through valign-bottom align-left items and adjust right position so they sit on the same row 11237 var widths = parseFloat($(".valign-bottom.align-left",$(this)).css("left")); 11238 $(".valign-bottom.align-left",$(this)).each(function(){ 11239 widths = widths+$(this).outerWidth(true); 11240 if (!$(this).next().hasClass("clear-left") && $(this).next(".valign-bottom.align-left").length) { 11241 $(this).next().css("left",widths+"px"); 11242 } 11243 11244 }); 11245 11246 // Go through valign-middle align-left items and adjust right position so they sit on the same row 11247 var widths = parseFloat($(".valign-middle.align-left",$(this)).css("left")); 11248 $(".valign-middle.align-left",$(this)).each(function(){ 11249 widths = widths+$(this).outerWidth(true); 11250 if (!$(this).next().hasClass("clear-left") && $(this).next(".valign-middle.align-left").length) { 11251 $(this).next().css("left",widths+"px"); 11252 } 11253 11254 }); 11255 11256 // Go through valign-middle align-right items and adjust right position so they sit on the same row 11257 var widths = parseFloat($(".valign-middle.align-right",$(this)).css("right")); 11258 $(".valign-middle.align-right",$(this)).each(function(){ 11259 widths = widths+$(this).outerWidth(true); 11260 if (!$(this).next().hasClass("clear-right") && $(this).next(".valign-middle.align-right").length) { 11261 $(this).next().css("right",widths+"px"); 11262 } 11263 }); 11264 11265 11266 // Go through valign-top align-left items and adjust right position so they sit on the same row 11267 var widths = parseFloat($(".valign-top.align-left",$(this)).css("left")); 11268 $(".valign-top.align-left",$(this)).each(function(){ 11269 widths = widths+$(this).outerWidth(true); 11270 if (!$(this).next().hasClass("clear-left") && $(this).next(".valign-top.align-left").length) { 11271 $(this).next().css("left",widths+"px"); 11272 } 11273 11274 }); 11275 11276 11277 // Go through valign-top align-right items and adjust right position so they sit on the same row 11278 var widths = parseFloat($(".valign-top.align-right",$(this)).css("right")); 11279 $(".valign-top.align-right",$(this)).each(function(){ 11280 widths = widths+$(this).outerWidth(true); 11281 if (!$(this).next().hasClass("clear-right") && $(this).next(".valign-top.align-right").length) { 11282 $(this).next().css("right",widths+"px"); 11283 } 11284 11285 }); 11286 11287 // Check any valign-middle or valign-bottom justify items to make sure they they don't overlap left aligned items. 11288 var leftedge = 20; 11289 $(".align-left,.align-",$(this)).each(function(){ 11290 var rightedge = $(this).outerWidth(true) + $(this).position().left; 11291 if (rightedge>leftedge) { 11292 leftedge =rightedge; 11293 } 11294 }); 11295 $(".valign-bottom.align-justify,.valign-middle.align-justify,.valign-top.align-justify",$(this)).each(function(){ 11296 $(this).css("left",leftedge+"px"); 11297 }); 11298 11299 11300 11301 }); 11302 11303 $(".module.align-justify.style-equal").each(function(){ 11304 var $lis = $("> * > *",$(this)); 11305 var n = $lis.length; 11306 var space = n * 10 - 10; 11307 var width = ($(this).width() - space) / n; 11308 width = Math.floor(width); 11309 $lis.css("width",width+"px"); 11310 }); 11311 $(".module.align-justify:not(.style-equal,.style-space)").each(function(){ 11312 var w = $(this).innerWidth(); 11313 var ews = 0; 11314 var $m = $(this); 11315 $("> * >*",$(this)).each(function(){ 11316 if ($("> a",$(this)).length) { 11317 var $el = $(">a",$(this)); 11318 var incOuter = true; 11319 } else { 11320 var $el = $(this); 11321 var incOuter = false;
11322 } 11323 if (typeof $m.attr("padding-left") == 'undefined') { 11324 $m.attr("padding-left",$el.css("padding-left")); 11325 $m.attr("padding-right",$el.css("padding-right")); 11326 } 11327 11328 $el.css("padding-left","0px").css("padding-right","0px"); 11329 if (incOuter) { 11330 var ew = $el.parent().outerWidth(true); 11331 } else { 11332 var ew = $el.outerWidth(true); 11333 } 11334 11335 ews = ews+ew; 11336 }); 11337 var d = w - ews - 2; 11338 var c = $("> * > *",$(this)).length; 11339 var p = d/c; 11340 p = p/2; 11341 11342 $("> * > *",$(this)).each(function(){ 11343 if ($("> a",$(this)).length) { 11344 var $el = $(">a",$(this)); 11345 } else { 11346 var $el = $(this); 11347 } 11348 11349 if (p<parseFloat($m.attr("padding-right"))) { 11350 $el.css({"padding-left":$m.attr("padding-left"),"padding-right":$m.attr("padding-right")}); 11351 } else { 11352 $el.css({"padding-left":p+"px","padding-right":p+"px"}); 11353 } 11354 }); 11355 }); 11356 $(".nav.valign-bottom.logo-first,.nav.valign-middle.logo-first,.nav.valign-bottom.logo-last,.nav.valign-middle.logo-last,.nav.with-middle-logo").each(function(){ 11357 $(">ul>li:not(#nav-logo)",$(this)).css("margin-top","0px"); 11358 var th = $("> ul > li#nav-logo",$(this)).outerHeight(); 11359 var $t = $(this); 11360 $(">ul>li:not(#nav-logo)",$(this)).each(function(){ 11361 var h = $(">a,>form",$(this)).outerHeight(); 11362 var mt = th-h;
11363 if ($t.hasClass("valign-middle")||$t.hasClass("with-middle-logo")) { 11364 mt = mt/2; 11365 } 11366 $(this).css("margin-top",mt+"px"); 11367 }); 11368 11369 }); 11370 11371 11372 11373 } 11374 function testFlexiBreak($container) { 11375 11376 var offset = 0; 11377 var ok = true; 11378 if ($container.hasClass("contains-text")) { 11379 var offset = $("> li",$container).offset().top; 11380 11381 $("> li:not(#nav-logo)",$container).each(function(){ 11382 if ($(this).offset().top!=offset) { 11383 ok = false; 11384 } 11385 }); 11386 } 11387 11388 if ($container.parent().hasClass("align-justify") && $container.parent().hasClass("style-equal")) { 11389 $(".tfb").contents().unwrap(); 11390 11391 $("> li > a",$container).wrapInner("<span class='tfb'>"); 11392 11393 $('.tfb').each(function(){ 11394 var outer = $(this).parent().width() - (parseInt($(this).parent().css("padding-left"))+parseInt($(this).parent().css("padding-right"))); 11395 11396 if ($(this).width()>outer) { 11397 ok = false; 11398 } 11399 }); 11400 11401 } 11402 11403 if (!$container.hasClass("allow-line-breaks")) { 11404 var h = $("> li:not(#nav-search,#nav-basket,#nav-logo) > a",$container).first().height(); 11405 $("> li:gt(0):not(#nav-search,#nav-basket,#nav-logo) > a",$container).each(function(){ 11406 if ($(this).height()!=h) { 11407 ok=false; 11408 } 11409 }); 11410 } 11411 return ok; 11412 } 11413 function flexiBreak() { 11414 $("body").removeClass("mobile-header-enabled"); 11415 11416 $(".flexibreak-big").each(function(){ 11417 var ok = true; 11418 var fb = false; 11419 if ($(".flexibreak-container",$(this)).length) { 11420 var $container = $(".flexibreak-container",$(this)); 11421 $container.removeClass("flexibreak1 flexibreak2 flexibreak3"); 11422 fb=true; 11423 } 11424 var $row = $(this); 11425 $row.removeClass("rowscale1 rowscale2 rowscale3"); 11426 11427 $row.show(); 11428 $("#"+$row.data("flexibreak-small")).hide(); 11429 11430 11431 modules(); 11432 11433 if (fb) { 11434 if (!testFlexiBreak($container)) { 11435 $container.addClass("flexibreak1"); 11436 if (!testFlexiBreak($container)) { 11437 $container.removeClass("flexibreak1 flexibreak2 flexibreak3"); 11438 $container.addClass("flexibreak2"); 11439 if (!testFlexiBreak($container)) { 11440 $container.removeClass("flexibreak1 flexibreak2 flexibreak3"); 11441 $container.addClass("flexibreak3"); 11442 if (!testFlexiBreak($container)) { 11443 ok = false; 11444 } 11445 } 11446 } 11447 } 11448 } 11449 11450 var $modules = $(".module:not(.width)",$row); 11451 if ($modules.overlaps($(".module:not(.width)",$row)).length) { 11452 $row.addClass("rowscale1"); 11453 if ($modules.overlaps($modules).length) { 11454 $row.addClass("rowscale2"); 11455 if ($modules.overlaps($modules).length) { 11456 $row.addClass("rowscale3"); 11457 if ($modules.overlaps($modules).length) { 11458 11459 ok = false; 11460 } 11461 } 11462 } 11463 } 11464 11465 if (!ok) { 11466 11467 $row.hide(); 11468 if (!$row.parent().children(":not(.flexibreak-big)").length) { 11469 $row.parent().hide().addClass("flex-wrap-hidden"); 11470 } 11471 $("#"+$row.data("flexibreak-small")).show(); 11472 $("body").addClass("mobile-header-enabled"); 11473 } 11474 11475 11476 }); 11477 11478 modules(); 11479 moduleHeights(); 11480 fixPropsHeights(); 11481 setFixedHeader(); 11482 11483 } 11484 11485 11486 function setRecentBlogWidths () { 11487 $(".recent_blog_articles").each(function(){ 11488 if ($(this).width()<287) { 11489 $(this).addClass("narrow"); 11490 } else { 11491 $(this).removeClass("narrow"); 11492 } 11493 }); 11494 var h = 0; 11495 $(".blog-grid-index-height").css("height","auto").each(function(){ 11496 var t = $(this).height(); 11497 h = (t>h?t:h); 11498 }).css("height",h+"px"); 11499 var h = 0; 11500 $(".blogDate").css("height","auto").each(function(){ 11501 var t = $(this).height(); 11502 h = (t>h?t:h); 11503 }).css("height",h+"px"); 11504 } 11505 function imageMarginHelper () { 11506 $(".Right_Image:not(.align-left .Right_Image, .align-right .Right_Image, .align-center .Right_Image),.Left_Image:not(.align-right .Left_Image,.align-left .Left_Image,.align-center .Left_Image)").each(function(){ 11507 if ($(this).next().length) { 11508 $(this).removeClass("enoughSpaceForText").removeClass("notEnoughSpaceForText"); 11509 var avail = $(this).parent().innerWidth(); 11510 var thisW = $("img",$(this)).width(); 11511 var space = avail-thisW; 11512 if (space>140) { 11513 $(this).addClass("enoughSpaceForText"); 11514 } else { 11515 $(this).addClass("notEnoughSpaceForText"); 11516 } 11517 } 11518 }); 11519 $(".Caption_Below_Image").each(function(){ 11520 $(".captionWrap",$(this)).css("width",$(this).find("img").width()+'px'); 11521 }); 11522 11523 } 11524 11525/* 11526Search select image 11527*/ 11528 11529 function searchImageLoad() { 11530 if (window.location.hash.substr(0, 11)=="#showimage-") { 11531 var id = window.location.hash.split("-"); 11532 $(".galleryitem"+id[1]).trigger("click"); 11533 } 11534 }; 11535 11536/* 11537 Banner height fix with floating header 11538*/ 11539 function fixPropsHeights() { 11540 $(".banner-feature",$(".with-scale-prop-widgets")).each(function(){ 11541 var $outer = $(this).parents(".with-scale-prop-widgets"); 11542 if (typeof $outer.data("min-height")!='undefined') { 11543 var visible = 0; 11544 if ($outer.data("min-height")=="window") { 11545 var wh = $(window).height(); 11546 } else { 11547 var wh = parseFloat($outer.data("min-height")); 11548 if ($outer.data("scale-prop")) { 11549 if ($('body').hasClass('with-fixed-header')) { 11550 var visible = $('#header').height(); 11551 } 11552 11553 var ratio = 1000 / wh; 11554 wh = $(window).width() / ratio; 11555 } 11556 } 11557 var $t = $(this); 11558 $t.find(".banner-feature-inner").removeClass('banner-feature-force-bottom'); 11559 if (typeof custombannergap != 'undefined') { 11560 var gap = custombannergap; 11561 }else { 11562 var gap = 60; 11563 } 11564 if ($t.find(".banner-feature-inner").offset().top<visible+gap/2||$t.height()<$t.find(".banner-feature-inner").height()) { 11565 $(this).css('height','auto'); 11566 $(this).css('min-height','auto'); 11567 console.log(gap);
11568 var h = $t.find(".banner-feature-inner").height() + visible+gap; 11569 if ($t.find(".banner-feature-inner").hasClass('banner-feature-content-middle')||$t.find(".banner-feature-inner").hasClass('banner-feature-content-top')) { 11570 $t.find(".banner-feature-inner").addClass('banner-feature-force-bottom'); 11571 } 11572 $t.css('height',h+'px'); 11573 } 11574 11575 11576 } 11577 }); 11578 $(".banner-feature-content-inner",$(".with-scale-prop-widgets")).each(function(){ 11579 var $outer = $(this).parents(".with-scale-prop-widgets"); 11580 if (typeof $outer.find('.row').data("min-height")!='undefined') { 11581 $(this).removeAttr('style'); 11582 var visible = 0; 11583 if ($outer.find(".row").data("min-height")=="window") { 11584 var wh = $(window).height(); 11585 } else { 11586 var wh = parseFloat($outer.find(".row").data("min-height")); 11587 if ($outer.find(".row").data("scale-prop")) { 11588 if ($('body').hasClass('with-fixed-header')) { 11589 var visible = $('#header').height(); 11590 } 11591 11592 var ratio = 1000 / wh; 11593 wh = $(window).width() / ratio; 11594 } 11595 } 11596 var $t = $(this); 11597 $t.removeClass('banner-feature-force-bottom'); 11598 if (typeof custombannergap != 'undefined') { 11599 var gap = custombannergap; 11600 }else { 11601 var gap = 60; 11602 } 11603 if ($t.offset().top<visible+gap/2) { 11604 var difference = visible-$t.offset().top+gap/2; 11605 $t.css('padding-top',difference+'px'); 11606 } 11607 11608 11609 } 11610 }); 11611 11612 } 11613 function bannerHeightWithFloating() { 11614 11615 11616 $('.with-scale-prop-widgets .row').each(function(){ 11617 if (!$('> *',$(this)).hasClass('banner-feature')) { 11618 $(this).wrapInner('<div class="banner-feature-content"></div>'); 11619 $(this).find(".banner-feature-content").wrapInner('<div class="banner-feature-content-inner"></div>'); 11620 } 11621 }); 11622 fixPropsHeights(); 11623 }; 11624/* 11625 #'Default' Gallery Style (Lightbox with thumbs) - including support for prodcuts based on this gallery style 11626 11627*/ 11628 function galleryResize() { 11629 if ($("#lightboxContainer").length) { 11630 $('<img src="'+$("#lightboxInner img").attr("src")+'" style="display:none;max-width:10000px !important;width:auto;"/>').appendTo("html").load(function(){ 11631 var originalWidth = $(this).width(); 11632 var originalHeight = $(this).height(); 11633 var ratio = originalWidth/originalHeight; 11634 var newMaxWidth = $(window).width()-60; 11635 var newHeight = newMaxWidth/ratio; 11636 if (originalWidth>newMaxWidth) { 11637 var w = newMaxWidth; 11638 var h = newHeight; 11639 } else { 11640 var w = originalWidth; 11641 var h = originalHeight; 11642 } 11643 $("#lightboxContainer").stop(false,true).animate({ 11644 width: w, 11645 height: h 11646 },300); 11647 $("#lightboxStuff").stop(false,true).animate({ 11648 width: w 11649 },300); 11650 }); 11651 } 11652 }; 11653 function galleryReady() { 11654 $(".responsive_lightbox_trigger").click(function(){ 11655 $(this).parents(".galleryThumb").find(".responsive_lightbox").trigger("click"); 11656 return false; 11657 }); 11658 $(".responsive_lightbox").click(function(){ 11659 var clicked = $(this); 11660 var parentsId = $(this).parents(".galleryWrapper").attr("id"); 11661 $(".lightboxCurrent").removeClass("lightboxCurrent"); 11662 clicked.addClass("lightboxCurrent"); 11663 $('embed, object, select',"#wrapper").css({ 'visibility' : 'hidden' }); 11664 var formName = $(this).parents(".galleryWrapper").attr("id").replace(/gallery/, ""); 11665 var prodid = $(this).parents(".galleryWrapper").data("prodid"); 11666 11667 if ($('body').hasClass('accessible-mode') && !$(".shopGalleryVariant[name="+formName+"].prodid"+prodid).length) { 11668 return true; 11669 } 11670 $('body').append("<div id='lightboxOverlay'></div><div id='lightboxOuter'><div id='lightboxContainer'><div id='lightboxExtra1'><div id='lightboxExtra2'><div id='lightboxExtra3'><div id='lightboxClose'>x</div><div id='lightboxPrev'><</div><div id='lightboxNext'>></div><div id='lightboxInner'></div></div></div></div></div><div id='lightboxStuff'><div id='lightboxShop'></div><div id='lightboxCaption'></div></div></div>"); 11671 11672 $(".shopGalleryVariant[name="+formName+"].prodid"+prodid).appendTo("#lightboxShop").fadeIn(); 11673 $("#lightboxShop form").append("<input type='hidden' name='pic_url' value='' />"); 11674 $("#lightboxOverlay").css("height",$(document).height()+"px");
11675 $("#lightboxOuter").css("top",$(document).scrollTop()+100+"px"); 11676 11677 $("#lightboxContainer").css({ 11678 opacity: 0, 11679 display: "block" 11680 }); 11681 $("#lightboxContainer").animate({ 11682 opacity: 1 11683 }); 11684 function showImage (href,title,retina) { 11685 function cont4 () { 11686 function cont3 () { 11687 showNav(); 11688 $("."+formName+"input").val(title); 11689 $("input[name=pic_url]",$("#lightboxShop form")).val(href); 11690 $("#lightboxCaption").html("<p>"+title+"</p>"); 11691 $("#lightboxInner").html('<img srcset="'+retina+' 2x" src="'+href+'" alt="'+title+'" style="display:none"/>'); 11692 $("#lightboxInner img").css({ 11693 opacity: 0, 11694 display: "block" 11695 }); 11696 $("#lightboxInner img").animate({ 11697 opacity: 1 11698 },300); 11699 } 11700 $('<img srcset="'+retina+' 2x" src="'+href+'" style="display:none;"/>').appendTo("body").load(function(){ 11701 var originalWidth = $(this).width(); 11702 var originalHeight = $(this).height(); 11703 var ratio = originalWidth/originalHeight; 11704 var newMaxWidth = $(window).width()-60; 11705 var newHeight = newMaxWidth/ratio; 11706 if (originalWidth>newMaxWidth||originalHeight>newHeight) { 11707 var w = newMaxWidth; 11708 var h = newHeight; 11709 } else { 11710 var w = originalWidth; 11711 var h = originalHeight; 11712 } 11713 $("#lightboxContainer").stop(false,true).animate({ 11714 width: w, 11715 height: h 11716 },300,cont3); 11717 $("#lightboxStuff").stop(false,true).animate({ 11718 width: w 11719 },300); 11720 }); 11721 } 11722 $("#lightboxNext,#lightboxPrev,#lightboxClose").fadeOut(300); 11723 $("#lightboxInner img").fadeOut(300,cont4); 11724 11725 11726 11727 } 11728 function showNav () { 11729 $("#lightboxClose").fadeIn(); 11730 $("#lightboxClose").unbind().click(function(){ 11731 function cont2 () { 11732 $("#lightboxOverlay,#lightboxOuter").remove(); 11733 $('embed, object, select',"#wrapper").css({ 'visibility' : 'visible' }); 11734 } 11735 $("#lightboxOuter,#lightboxOverlay").fadeOut(300,cont2); 11736 11737 $(".shopGalleryVariant[name="+formName+"]").appendTo("body").hide(); 11738 }); 11739 var totalEls = $("#"+parentsId+" .responsive_lightbox").length-1; 11740 var clickedEl = 0; 11741 var currentEl = 0; 11742 $("#"+parentsId+" .responsive_lightbox").each(function(){ 11743 if ($(this).hasClass("lightboxCurrent")) { 11744 clickedEl = currentEl; 11745 } 11746 currentEl++; 11747 }); 11748 if (clickedEl!=totalEls) { 11749 $("#lightboxNext").fadeIn(); 11750 $("#lightboxNext").unbind().click(function(){ 11751 var stop = 0; 11752 var stop2 = 0; 11753 $("#"+parentsId+" .responsive_lightbox").each(function(){ 11754 stop++; 11755 if ($(this).hasClass("lightboxCurrent")) { 11756 stop2 = stop; 11757 } 11758 }); 11759 var stop3 = 0; 11760 $("#"+parentsId+" .responsive_lightbox").each(function(){ 11761 if (stop3 == stop2) { 11762 $(".lightboxCurrent").removeClass("lightboxCurrent"); 11763 $(this).addClass("lightboxCurrent"); 11764 var href = $(this).attr("href"); 11765 var title = $(this).attr("title"); 11766 showImage(href,title,$(this).data('retina')); 11767 } 11768 stop3++; 11769 }); 11770 }); 11771 } 11772 if (clickedEl!=0) { 11773 $("#lightboxPrev").fadeIn(); 11774 $("#lightboxPrev").unbind().click(function(){ 11775 var prev = 0; 11776 var clicked = 0; 11777 $("#"+parentsId+" .responsive_lightbox").each(function(){ 11778 if ($(this).hasClass("lightboxCurrent")) { 11779 current = prev; 11780 } 11781 prev++; 11782 }); 11783 var prev = 0; 11784 $("#"+parentsId+" .responsive_lightbox").each(function(){ 11785 if (prev==current-1) { 11786 $(".lightboxCurrent").removeClass("lightboxCurrent"); 11787 $(this).addClass("lightboxCurrent"); 11788 var href = $(this).attr("href"); 11789 var title = $(this).attr("title"); 11790 showImage(href,title,$(this).data('retina')); 11791 } 11792 prev++; 11793 }); 11794 }); 11795 } 11796 } 11797 function cont () { 11798 $("."+formName+"input").val(clicked.attr("title")); 11799 $("input[name=pic_url]",$("#lightboxShop form")).val(clicked.attr("href")); 11800 $("#lightboxCaption").html("<p>"+clicked.attr("title")+"</p>"); 11801 $("#lightboxStuff").fadeIn(); 11802 $("#lightboxInner").html('<img srcset="'+clicked.data('retina')+' 2x" src="'+clicked.attr("href")+'" alt="'+clicked.attr("title")+'" style="display:none"/>'); 11803 $("#lightboxInner img").css({ 11804 opacity: 0, 11805 display: "block" 11806 }); 11807 $("#lightboxInner img").animate({ 11808 opacity: 1 11809 },300); 11810 11811 showNav(); 11812 11813 } 11814 11815 var preloader = new Image(); 11816 11817 preloader.onload = function() { 11818 var originalWidth = preloader.width; 11819 if (is_retina()) { 11820 originalWidth = originalWidth/2; 11821 } 11822 var originalHeight = preloader.height; 11823 if (is_retina()) { 11824 originalHeight = originalHeight/2; 11825 } 11826 var ratio = originalWidth/originalHeight; 11827 var newMaxWidth = $(window).width()-60; 11828 var newHeight = newMaxWidth/ratio; 11829 if (originalWidth>
11829newMaxWidth||originalHeight>newHeight) { 11830 var w = newMaxWidth; 11831 var h = newHeight; 11832 } else { 11833 var w = originalWidth; 11834 var h = originalHeight; 11835 } 11836 $("#lightboxStuff").css("width",w+"px"); 11837 $("#lightboxContainer").stop(false,true).animate({ 11838 width: w, 11839 height: h 11840 },300,cont); 11841 11842 11843 }; 11844 preloader.src = clicked.attr("href"); 11845 preloader.srcset = clicked.data("retina")+' 2x'; 11846 return false; 11847 }); 11848 }; 11849 11850 11851 function is_retina() { 11852 return window.devicePixelRatio > 1; 11853 } 11854 11855/* 11856 #'Montage' Gallery Style - including support for prodcuts based on this gallery style 11857 11858*/ 11859 function montageLoad() { 11860 setMontageMargin(); 11861 $(".montageSlideshow").hide().css("width","0"); 11862 setTimeout(function() { 11863 $(".montageSlideshow").css("width","100%").show(); 11864 }, 1); 11865 }; 11866 function montageReady() { 11867 $(".montageSlideshow").each(function(){ 11868 var formId = $(this).attr("id").replace("gallery",""); 11869 if ($("form[name="+formId+"]").length) { 11870 $(this).after("<div class='montageProductWrapper'></div>"); 11871 var $wrapper = $(this).next(); 11872 $wrapper.append($(this)); 11873 $wrapper.append($("form[name="+formId+"]").show().addClass("montageProductForm")); 11874 var $form = $("form",$wrapper); 11875 $(".montage-pic",$wrapper).append('<span class="montageCheckbox"></span>'); 11876 $(".montage-pic:first",$wrapper).addClass("selected"); 11877 $(".montageSlideshow",$wrapper).addClass("with-product"); 11878 $form.append("<input type='hidden' name='pic_url' value='' />"); 11879 $("."+formId+"input",$form).val($("img:first",$wrapper).attr("alt")); 11880 var href = $("img:first",$wrapper).attr("src").split("?"); 11881 $("input[name=pic_url]",$form).val(href[0]); 11882 } 11883 }); 11884 $(".with-product .montage-pic").click(function(){ 11885 $montage = $(this).parents(".with-product"); 11886 $(".selected",$montage).removeClass("selected"); 11887 $(this).addClass("selected"); 11888 var $form = $(this).parents(".with-product").next(); 11889 var formId = $(this).parents(".with-product").attr("id").replace("gallery",""); 11890 $("."+formId+"input",$form).val($("img",$(this)).attr("alt")); 11891 var href = $("img",$(this)).attr("src").split("?"); 11892 $("input[name=pic_url]",$form).val(href[0]); 11893 }); 11894 }; 11895 11896 function montageResize() { 11897 setMontageMargin(); 11898 }; 11899 function setMontageMargin () { 11900 $(".imagesInMontage4").each(function(){ 11901 var w = $(this).width(); 11902 var p = $(".item1",$(this)).width()+$(".item2",$(this)).width(); 11903 var g = w-p; 11904 $(".for-margin",$(this)).css("margin-top",g+"px"); 11905 }); 11906 } 11907 11908 11909/* 11910 #'Slideshow' Gallery Styles (single and multi) - including support for prodcuts based on these gallery styles 11911*/ 11912 11913 function slideshowReady() { 11914 if (!$('body').hasClass("accessible-mode")){ 11915 $(".banner-feature:not(#content_bar_1_banner_slideshow .banner-feature,#content_bar_2_banner_slideshow .banner-feature,#content_bar_3_banner_slideshow .banner-feature,#content_bar_4_banner_slideshow .banner-feature,#content_bar_5_banner_slideshow .banner-feature,#content_bar_6_banner_slideshow .banner-feature,#content_bar_7_banner_slideshow .banner-feature)").each(function(){ 11916 if (!$(this).prev().hasClass("banner-feature")) { 11917 $(this).before("<div class='banner-feature-wrap'></div>"); 11918 } 11919 }); 11920 $(".banner-feature-wrap").each(function(){ 11921 $wrapper = $(this); 11922 $(this).nextAll().each(function(){ 11923 if (!$(this).hasClass("banner-feature")) { 11924 return false; 11925 } else { 11926 $(this).appendTo($wrapper); 11927 } 11928 }); 11929 }); 11930 $(".banner-feature-wrap").each(function(){ 11931 $(this).owlCarousel({ 11932 navigation : true, 11933 slideSpeed : 300, 11934 paginationSpeed : 400, 11935 singleItem:true, 11936 navigationText : ["<",">"], 11937 afterAction: function(el){ 11938 this.$owlItems.removeClass('activebanner'); 11939 this.$owlItems.eq(this.currentItem).addClass('activebanner'); 11940 setTimeout(function () { 11941 moduleHeights(); 11942 },550); 11943 } 11944 }); 11945 }); 11946 11947 11948 $("#content_bar_1_banner_slideshow,#content_bar_2_banner_slideshow,#content_bar_3_banner_slideshow,#content_bar_4_banner_slideshow,#content_bar_5_banner_slideshow,#content_bar_6_banner_slideshow,#content_bar_7_banner_slideshow").each(function(){
11949 var speed = $(this).data("slideshow-speed"); 11950 var transstyle = $(this).data("slideshow-style"); 11951 $(" > div > div",$(this)).owlCarousel({ 11952 navigation : true, 11953 pagination:false, 11954 autoPlay : speed, 11955 singleItem : true, 11956 slideSpeed:500, 11957 afterMove: function(){ 11958 setTimeout(function () { 11959 moduleHeights(); 11960 }, 550); 11961 11962 }, 11963 autoHeight : false, 11964 transitionStyle:transstyle, 11965 navigationText : ["<",">"], 11966 afterAction: function(el){ 11967 this.$owlItems.removeClass('activebanner'); 11968 this.$owlItems.eq(this.currentItem).addClass('activebanner'); 11969 setTimeout(function () { 11970 moduleHeights(); 11971 },550); 11972 } 11973 }); 11974 }); 11975 11976 $(".owl-slideshow-single").each(function(){ 11977 var speed = $(this).data("speed"); 11978 $(this).owlCarousel({ 11979 navigation : true, 11980 slideSpeed : 300, 11981 autoPlay : speed, 11982 stopOnHover : true, 11983 paginationSpeed : 400, 11984 goToFirstSpeed : 2000, 11985 singleItem : true, 11986 autoHeight : true, 11987 afterMove: function(){ 11988 setTimeout(function () { 11989 moduleHeights(); 11990 }, 550); 11991 11992 }, 11993 transitionStyle:"fade", 11994 navigationText : ["<",">"], 11995 afterAction: function() { 11996 11997 setTimeout(function () { 11998 moduleHeights(); 11999 },550); 12000 } 12001 }); 12002 }); 12003 $(".owl-slideshow-multi").each(function(){ 12004 var speed = $(this).data("speed"); 12005 $(this).owlCarousel({ 12006 items : 4, 12007 slideSpeed : 300, 12008 autoPlay : speed, 12009 stopOnHover : true, 12010 paginationSpeed : 400, 12011 goToFirstSpeed : 2000, 12012 navigationText : ["<",">"], 12013 afterAction: function() { 12014 12015 setTimeout(function () { 12016 moduleHeights(); 12017 },550); 12018 } 12019 }); 12020 }); 12021 12022 $(".owl-slideshow-multi,.owl-slideshow-single").each(function(){ 12023 var formId = $(this).attr("id").replace("gallery",""); 12024 if ($("form[name="+formId+"]").length) { 12025 $(this).after("<div class='slideshowProductWrapper'></div>"); 12026 var $wrapper = $(this).next(); 12027 $wrapper.append($(this)); 12028 $wrapper.append($("form[name="+formId+"]").show().addClass("slideshowProductForm")); 12029 var $form = $("form",$wrapper); 12030 $(".item",$wrapper).append('<span class="slideshowCheckbox"></span>'); 12031 $(".item:first",$wrapper).addClass("current"); 12032 12033 $(".owl-slideshow-multi,.owl-slideshow-single",$wrapper).addClass("with-product"); 12034 $form.append("<input type='hidden' name='pic_url' value='' />"); 12035 $("."+formId+"input",$form).val($(".item:first img",$wrapper).attr("alt")); 12036 var href = $("img:first",$wrapper).attr("src").split("?"); 12037 $("input[name=pic_url]",$form).val(href[0]); 12038 } 12039 }); 12040 $(".owl-slideshow-multi.with-product .item,.owl-slideshow-single.with-product .item").click(function(){ 12041 12042 var $galThumbs = $(this).parents(".with-product"); 12043 $(".current",$galThumbs).removeClass("current"); 12044 $(this).addClass("current"); 12045 12046 var $form = $(this).parents(".with-product").next(); 12047 var formId = $(this).parents(".with-product").attr("id").replace("gallery",""); 12048 $("."+formId+"input",$form).val($("img",$(this)).attr("alt")); 12049 var href = $("img",$(this)).attr("src").split("?"); 12050 $("input[name=pic_url]",$form).val(href[0]); 12051 }); 12052 } 12053 12054 }; 12055 12056/* 12057 #'Gallery with thumbs' Gallery Style - including support for prodcuts based on these gallery styles 12058 12059*/ 12060 function galThumbResize() { 12061 $(".enlarge img").fadeOut(); 12062 clearTimeout(afterResizingGallery); 12063 afterResizingGallery = setTimeout(function () { 12064 afterResizeGallery(); 12065 }, 400); 12066 }; 12067 var afterResizingGallery; 12068 function afterResizeGallery () { 12069 $(".galleryWithThumbs").each(function(){ 12070 var $e = $(".enlarge",$(this)); 12071 $e.css("height","auto"); 12072 var $t = $(this); 12073 var $a = $("a.current",$t); 12074 showPic($a,$e); 12075 }); 12076 } 12077 function galThumbReady() { 12078 if (!$('body').hasClass("accessible-mode")){ 12079 12080 $(".owl-gallery-thumbs").each(function(){ 12081 $(this).owlCarousel({ 12082 items : 10, 12083 slideSpeed : 300, 12084 paginationSpeed : 400, 12085 navigationText : ["<",">"], 12086 itemsDesktop : [1000,8], 12087 itemsDesktopSmall : [768,6], 12088 itemsTablet: [480,5], 12089 itemsMobile : false 12090 }); 12091 }); 12092 $(".galleryWithThumbs").each(function(){ 12093 12094 var $e = $(".enlarge",$(this)); 12095 var $t = $(this); 12096 var $a = $("a:first",$t); 12097 showPic($a,$e); 12098 12099 $("a",$t).click(function(){ 12100 $(".current",$t).removeClass("current"); 12101 showPic($(this),$e); 12102 return false;
12103 }); 12104 }); 12105 } else { 12106 $(".enlarge").remove(); 12107 } 12108 $(".galleryWithThumbs").each(function(){ 12109 var formId = $(this).attr("id").replace("gallery",""); 12110 if ($("form[name="+formId+"]").length) { 12111 $(this).after("<div class='galleryThumbsProductWrapper'></div>"); 12112 var $wrapper = $(this).next(); 12113 $wrapper.append($(this)); 12114 $wrapper.append($("form[name="+formId+"]").show().addClass("galleryThumbsProductForm")); 12115 var $form = $("form",$wrapper); 12116 $(".galleryWithThumbs",$wrapper).addClass("with-product"); 12117 $form.append("<input type='hidden' name='pic_url' value='' />"); 12118 $("."+formId+"input",$form).val($(".owl-gallery-thumbs img:first",$wrapper).attr("alt")); 12119 var href = $("img:first",$wrapper).attr("src").split("?"); 12120 $("input[name=pic_url]",$form).val(href[0]); 12121 } 12122 }); 12123 $(".galleryWithThumbs.with-product .owl-gallery-thumbs a").click(function(){ 12124 var $galThumbs = $(this).parents(".with-product"); 12125 var $form = $(this).parents(".with-product").next(); 12126 var formId = $(this).parents(".with-product").attr("id").replace("gallery",""); 12127 $("."+formId+"input",$form).val($("img",$(this)).attr("alt")); 12128 var href = $("img",$(this)).attr("src").split("?"); 12129 $("input[name=pic_url]",$form).val(href[0]); 12130 }); 12131 }; 12132 function showPic ($a,$e) { 12133 $a.addClass("current"); 12134 $(".captionWrap,.caption,img",$e).fadeOut().remove(); 12135 12136 var $img = $("<img src='"+$a.attr("href")+"' style='display:none;'/>"); 12137 if ($("img",$a).attr("alt")!="") { 12138 var $i = $("<span class='captionWrap'><span class='caption'>"+$("img",$a).attr("alt")+"</span></span>"); 12139 $img.prependTo($i); 12140 } else { 12141 var $i = $img; 12142 } 12143 12144 $e.append($i); 12145 12146 $img.one('load', function() { 12147 $e.css("height",$(this).height()+"px"); 12148 $img.fadeIn(); 12149 setTimeout(function () { 12150 moduleHeights(); 12151 setFixedHeader(); 12152 }, 500); 12153 }).each(function() { 12154 if(this.complete) $(this).load(); 12155 }); 12156 } 12157 12158 12159/* 12160 #'Carousel Slide' Widget 12161*/ 12162 12163 function carouselReady() { 12164 if (!$('body').hasClass("accessible-mode")){ 12165 $(".carousel_slide").each(function(){ 12166 if (!$(this).prev().hasClass("carousel_slide")) { 12167 if ($(this).hasClass("carousel_slide_autoscroll")) { 12168 $(this).before("<div class='owl-carousel owl-carousel-autoscroll' data-speed="+$(this).data("speed")+"></div>"); 12169 } else { 12170 $(this).before("<div class='owl-carousel'></div>"); 12171 } 12172 } 12173 }); 12174 $(".owl-carousel").each(function(){ 12175 $wrapper = $(this); 12176 $(this).nextAll().each(function(){ 12177 if (!$(this).hasClass("carousel_slide")) { 12178 return false; 12179 } else { 12180 $(this).appendTo($wrapper); 12181 } 12182 }); 12183 }); 12184 $(".owl-carousel").each(function(){ 12185 if ($(this).hasClass("owl-carousel-autoscroll")) { 12186 var speed = $(this).data("speed"); 12187 $(this).owlCarousel({ 12188 navigation : true, 12189 slideSpeed : 300, 12190 autoPlay : speed, 12191 paginationSpeed : 300, 12192 singleItem:true, 12193 navigationText : ["<",">"] 12194 }); 12195 }else{ 12196 $(this).owlCarousel({ 12197 navigation : true, 12198 slideSpeed : 300, 12199 paginationSpeed : 400, 12200 singleItem:true, 12201 navigationText : ["<",">"] 12202 }); 12203 } 12204 12205 }); 12206 12207 } 12208 }; 12209 12210 12211/* 12212 #'Live Shopping Basket' Widget 12213*/ 12214function showCounts() { 12215 $(".chekoutcount").load("/actions/ShowMiniBasket/"+lang+"&count=true",function(){ 12216 modules(); 12217 }); 12218} 12219function bindMiniBasket () { 12220 var options = { 12221 success: function(){ 12222 $("#miniBasket2").load("/actions/ShowMiniBasket/"+lang,function(){ 12223 bindMiniBasket(); 12224 $("#loading").stop(true,false).fadeOut(); 12225 $('.formloader,#loader:visible').fadeOut(); 12226 moduleHeights(); 12227 setFixedHeader(); 12228 12229 }); 12230 12231 12232 } // post-submit callback 12233 }; 12234 $("#miniBasket2 #updateQuantities").click(function(){ 12235 $("#miniBasketForm").submit(); 12236 return false; 12237 }); 12238 $("#miniBasket2 .quantity").blur(function(e){ 12239 if ($(e.target).attr("id")!="updateQuantities") { 12240 $("#miniBasketForm").submit(); 12241 } 12242 }); 12243 $("#miniBasket2 #miniBasketForm").submit(function(){ 12244 $("#loading").fadeIn(); 12245 12246 $("#miniBasketForm").ajaxSubmit(options); 12247 return false; 12248 }); 12249 $("#miniBasket2 .removeCell a").click(function(){ 12250 $("#loading").fadeIn(); 12251 $.ajax({ url: $(this).attr("href"), success: function(){
12252 $("#miniBasket2").load("/actions/ShowMiniBasket/"+lang,function(){ 12253 bindMiniBasket(); 12254 $("#loading").stop(true,false).fadeOut(); 12255 moduleHeights(); 12256 setFixedHeader(); 12257 12258 }); 12259 showCounts(); 12260 }}); 12261 return false; 12262 }); 12263} 12264 function productQuanReady() { 12265 $('input[name="giftcardme"]').change(function() { 12266 if ($(this).val()=='else') { 12267 $('.giftcard_someoneelse',$(this).parents('form')).show(); 12268 } 12269 else { 12270 $('.giftcard_someoneelse',$(this).parents('form')).hide(); 12271 } 12272 moduleHeights(); 12273 }); 12274 $('.product-quantity-input').on("click",function(){ 12275 $(this)[0].select(); 12276 }); 12277 $('.product-quantity-input').on("keyup change",function(){ 12278 12279 if ($(this).parents(".addToBasketForm.multi.only-sell-if-in-stock").length && typeof $("option:selected",$(this).parents(".addToBasketForm.multi")).attr("data-stock") != "undefined") { 12280 12281 if (parseInt($("option:selected",$(this).parents(".addToBasketForm.multi")).attr("data-stock"))<parseInt($(this).val())) { 12282 $(this).val(parseInt($("option:selected",$(this).parents(".addToBasketForm.multi")).attr("data-stock"))); 12283 } 12284 } else { 12285 if (typeof $(this).attr("data-max")!='undefined') { 12286 if (parseInt($(this).val())>$(this).data("max")) { 12287 $(this).val($(this).data("max")); 12288 } 12289 } 12290 12291 } 12292 if ($(this).val()<1) { 12293 $(this).val(1); 12294 } 12295 var newv = $(this).val(); 12296 if ($(this).parents(".simpleProduct").length) { 12297 var hrefstr = $(".button a",$(this).parents(".simpleProduct")).attr("href"); 12298 var href = hrefstr.split("&"); 12299 var newhref = ''; 12300 if (href.length>1 && hrefstr.indexOf("&quantity=")>0) { 12301 12302 for (var i = 0; i < href.length; i++) { 12303 12304 if (newhref!="") { 12305 newhref+="&"; 12306 } 12307 if (href[i].indexOf("quantity=")==0) { 12308 newhref += "quantity="+newv; 12309 } else { 12310 newhref += href[i]; 12311 } 12312 12313 12314 } 12315 } else { 12316 newhref = hrefstr+"&quantity="+newv; 12317 } 12318 $(".button a",$(this).parents(".simpleProduct")).attr("href",newhref); 12319 12320 } 12321 }); 12322 $(".product-quantity-plus").on("click",function(){ 12323 var c = parseInt($("input",$(this).parent()).val()); 12324 c = c+1; 12325 $("input",$(this).parent()).val(c).trigger("change"); 12326 }); 12327 $(".product-quantity-minus").on("click",function(){ 12328 var c = parseInt($("input",$(this).parent()).val()); 12329 c = c-1; 12330 $("input",$(this).parent()).val(c).trigger("change"); 12331 }); 12332 if (!$('body').hasClass('accessible-mode')) { 12333 $(".form .submit_form").before("<img src=\"/graphics/form-load.gif\" alt=\"\" class=\"formloader\" id=\"loader\"/>"); 12334 } 12335 if ($('.formUsedInCheckout').length) { 12336 $("#paymentGatewayForm").css("float","none"); 12337 } 12338 showCounts(); 12339 $("#miniBasket2").load("/actions/ShowMiniBasket/"+lang,function(){ 12340 bindMiniBasket(); 12341 moduleHeights(); 12342 setFixedHeader(); 12343 12344 }); 12345 if ($("#miniBasket2").length) { 12346 $(".addToBasketLink").click(function(){ 12347 $("#loading").fadeIn(); 12348 dataLayer.push({"event":"addToBasket","productID":$(this).parents(".simpleProduct").data("datalayer-productid"),"productPrice":$(this).parents(".simpleProduct").data("datalayer-price"),"productName":$(this).parents(".simpleProduct").data("datalayer-name")}); 12349 $.ajax({ url: $(this).attr("href"), success: function(){ 12350 $("#miniBasket2").load("/actions/ShowMiniBasket/"+lang,function(){ 12351 bindMiniBasket(); 12352 $("#loading").stop(true,false).fadeOut(); 12353 moduleHeights(); 12354 setFixedHeader(); 12355 12356 }); 12357 showCounts(); 12358 12359 }}); 12360 return false; 12361 }); 12362 $(".addToBasketForm").ajaxForm(function(r,s,x,t){ 12363 $("#loading").fadeIn(); 12364 if (t.find("input[name=donation_amount]")) { 12365 var pp = t.find("input[name=donation_amount]").val(); 12366 } 12367 if (t.find("select[name=variant_price]")) { 12368 var pp = t.find("select[name=variant_price] option:checked").data("datalayer-price"); 12369 dataLayer.push({"event":"addToBasket","productID":$(this).data("datalayer-productid"),"productPrice":pp,"productName":$(this).parents(".simpleProduct").data("datalayer-name"),"variantName":$(this).find("select[name=variant_price]").val()}); 12370 } else { 12371 dataLayer.push({"event":"addToBasket","productID":$(this).data("datalayer-productid"),"productPrice":pp,"productName":$(this).parents(".simpleProduct").data("datalayer-name")}); 12372 } 12373 t.find($('textarea[name="giftcard_greeting"],input[name="giftcard_recipient_email"],input[name="giftcard_recipient_address"],input[name="giftcard_recipient_name"]')).val(''); 12374 t.find('.giftcard_success').show();
12375 $("#miniBasket2").load("/actions/ShowMiniBasket/"+lang,function(){ 12376 bindMiniBasket(); 12377 $("#loading").stop(true,false).fadeOut(); 12378 $("body").find('.formloader,#loader').hide(); 12379 moduleHeights(); 12380 setFixedHeader(); 12381 12382 }); 12383 showCounts(); 12384 }); 12385 } 12386 }; 12387 12388 /* 12389 12390 # Searchable Subpage Index 12391 12392 */ 12393 12394 function kbReady() { 12395 $("#kbSearchInput").keyup(function(){ 12396 $("#contactform textarea").val($(this).val()); 12397 if ($(this).val()!="") { 12398 $("#kbIndex").addClass("searching"); 12399 } else { 12400 $("#kbIndex").removeClass("searching"); 12401 } 12402 12403 $(".searchShow,.searchShowTemp").removeClass("searchShow"); 12404 $(".revealH3").removeClass("revealH3"); 12405 $(".revealUL").removeClass("revealUL"); 12406 $(".revealMore").removeClass("revealMore"); 12407 12408 var words = $(this).val().split(" "); 12409 var $i; 12410 $(".kbItem1,.kbItem2").attr("data-count","0"); 12411 var highestCount=0; 12412 for (var i = words.length - 1; i >= 0; i--) { 12413 $i=$(".kbItem1[data-keywords*="+words[i].toLowerCase().replace('$','\\$').replace('.','\\.')+"],.kbItem2[data-keywords*="+words[i].toLowerCase().replace('$','\\$').replace('.','\\.')+"]"); 12414 if ($i.length) { 12415 $i.addClass("searchShowTemp"); 12416 $i.each(function(){ 12417 var count = parseInt($(this).attr("data-count"))+1; 12418 if (count>highestCount) { 12419 highestCount=count; 12420 } 12421 $(this).attr("data-count",count); 12422 }); 12423 } 12424 }; 12425 $(".searchShowTemp").filter(function(){ 12426 return (parseInt($(this).attr("data-count"))<highestCount); 12427 }).removeClass("searchShowTemp"); 12428 $(".searchShowTemp").removeClass("searchShowTemp").addClass("searchShow"); 12429 $(".searchShow").parents(".kbItem").addClass("revealH3"); 12430 $(".searchShow").parents(".kbItem1").addClass("revealUL"); 12431 $(".searchShow.hidden").parent().addClass("revealMore"); 12432 12433 }); 12434 $(".kbItem1.hasSubs > a").click(function(){ 12435 if ($(this).parent().hasClass("showingSubUL")) { 12436 $(this).parent().removeClass("showingSubUL"); 12437 } else { 12438 $(this).parent().addClass("showingSubUL"); 12439 } 12440 12441 return false; 12442 }); 12443 $(".kbAll a").click(function(){ 12444 if ($(this).parents("ul").hasClass("revealHidden")) { 12445 $(this).parents("ul").removeClass("revealHidden"); 12446 $(this).html($(this).attr("data-lang-open")); 12447 } else { 12448 $(this).parents("ul").addClass("revealHidden"); 12449 $(this).html($(this).attr("data-lang-close")); 12450 } 12451 return false; 12452 }); 12453 12454 if (window.self == window.top) { 12455 $("#kbSearchInput").focus(); 12456 } 12457 12458 $("#clearKBSearch").click(function(){ 12459 $("#kbSearchInput").val("").trigger("keyup"); 12460 }); 12461 $("#contactSupport a").click(function(){ 12462 $("#hideWhenContact").hide(); 12463 $(this).parent().hide(); 12464 $(this).parent().next().addClass("revealed"); 12465 return false; 12466 }); 12467 }; 12468 /* 12469 12470 # Searchable Preview Based Subpage Index 12471 12472 */ 12473 12474 function pbReady() { 12475 $("#pbSearchInput").keyup(function(){ 12476 12477 if ($(this).val()!="") { 12478 $("#pbIndex").addClass("searching"); 12479 } else { 12480 $("#pbIndex").removeClass("searching"); 12481 } 12482 12483 $(".searchShow,.searchShowTemp").removeClass("searchShow"); 12484 12485 12486 var words = $(this).val().split(" "); 12487 var $i; 12488 $(".pbItem").attr("data-count","0"); 12489 var highestCount=0; 12490 for (var i = words.length - 1; i >= 0; i--) { 12491 $i=$(".pbItem[data-keywords*="+words[i].toLowerCase().replace('$','\\$').replace('.','\\.')+"]"); 12492 if ($i.length) { 12493 $i.addClass("searchShowTemp"); 12494 $i.each(function(){ 12495 var count = parseInt($(this).attr("data-count"))+1; 12496 if (count>highestCount) { 12497 highestCount=count; 12498 } 12499 $(this).attr("data-count",count); 12500 }); 12501 } 12502 }; 12503 $(".searchShowTemp").filter(function(){ 12504 return (parseInt($(this).attr("data-count"))<highestCount); 12505 }).removeClass("searchShowTemp"); 12506 $(".searchShowTemp").removeClass("searchShowTemp").addClass("searchShow"); 12507 }); 12508 $(".kbItem1.hasSubs > a").click(function(){ 12509 if ($(this).parent().hasClass("showingSubUL")) { 12510 $(this).parent().removeClass("showingSubUL"); 12511 } else { 12512 $(this).parent().addClass("showingSubUL"); 12513 } 12514 12515 return false; 12516 }); 12517 12518 if (window.self == window.top) { 12519 $("#pbSearchInput").focus(); 12520 } 12521 12522 $("#clearPBSearch").click(function(){ 12523 $("#pbSearchInput").val("").trigger("keyup"); 12524 }); 12525 12526 12527 }; 12528 12529 12530/* 12531 12532 #Livechat Status Widget 12533*/ 12534 12535 12536 function livechatReady() { 12537 if(typeof sDMT=='undefined') { 12538 function checkLivechat () { 12539 12540 $.ajax({ 12541 type: "GET", 12542 url: "/actions/LivechatStatus/", 12543 success: function(msg){ 12544 if (msg=="online") { 12545 $(".livechatWidgetOffline").hide(); 12546 $(".livechatWidgetOnline").show(); 12547 } else { 12548 $(".livechatWidgetOffline").show(); 12549 $(".livechatWidgetOnline").hide(); 12550 } 12551 } 12552 }); 12553 setTimeout(checkLivechat, 10000); 12554 12555 } 12556 if ($("meta[name=disablelivechat]").length==0) { checkLivechat(); } 12557 } 12558 12559 $(".startConvo").click(function () { 12560 href = this.href; 12561 var popup = window.open(href,'','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=311,height=349'); 12562 return false;
12563 }); 12564 12565 }; 12566 12567/* 12568 #Responsive video helper for jPlayer 12569 12570*/ 12571 12572 var afterResizing; 12573 var windowwidth; 12574 function responsiveVideoResize() { 12575 if (!$('body').hasClass("accessible-mode")){ 12576 12577 if (!$(".jplayerInit .jplayer").hasClass("playing")) { 12578 if ($("#videoMPPopup .jplayer").length) { 12579 $("#mp_lightbox_outer").fadeOut(); 12580 if ($("#videoMPPopup .jplayer").hasClass("playing")) { 12581 $("#videoMPPopup .jplayer").jPlayer("stop"); 12582 } 12583 12584 } 12585 clearTimeout(afterResizing); 12586 if (!$(".jp-video-full").length) { 12587 12588 afterResizing = setTimeout(function () { 12589 if ($(".jplayerInit").length && !$(".jp-video-full").length) { 12590 12591 $(".jplayerInit .jplayer").jPlayer("destroy"); 12592 $(".jplayerInit").each(function(){ 12593 var img = $(this).attr("data-poster"); 12594 var vid = $(this).attr("data-vid"); 12595 var $t = $(this).parent(); 12596 $(this).remove(); 12597 $t.html("<a href='"+vid+"'><img src='"+img+"' /></a>"); 12598 $t.waitForImages(function(){ 12599 afterResize(); 12600 }); 12601 }); 12602 12603 } 12604 }, 1000); 12605 } 12606 } 12607 } 12608 }; 12609function afterResize() { 12610 var jplayerVideoCounter=0; 12611 $(".bpe_video:not(.Popup_Video) img").each(function(){ 12612 if (!$(".jplayerInit",$(this).parents(".bpe_video")).length) { 12613 12614 var width = $(this).width(); 12615 var height = $(this).height(); 12616 var image = $(this).attr("src"); 12617 var alt = $(this).attr("alt"); 12618 var video = $(this).parent().attr("href"); 12619 $(this).parent().after("<div id=\"video"+jplayerVideoCounter+"\" class='jplayerInit' data-poster='"+image+"' data-vid='"+video+"' alt='"+alt+"'>"+playerHTML+"</div>"); 12620 $(this).parent().remove(); 12621 12622 makeVideo("video"+jplayerVideoCounter,width,height,image,video,false,false); 12623 12624 jplayerVideoCounter++; 12625 } 12626 }); 12627 } 12628/* 12629 #Responsive video helper for JWPlayer 12630 12631*/ 12632 12633 var afterResizingJW; 12634 function responsiveVideoJWResize () { 12635 if (!$('body').hasClass("accessible-mode")){ 12636 if ($(window).width()==windowwidth) { 12637 return false; 12638 } 12639 windowwidth=$(window).width(); 12640 if (window.jwplayer) { 12641 var i = 0; 12642 while (true) { 12643 var player = jwplayer("video"+i); 12644 if (!player) 12645 break; 12646 player.remove(); 12647 i++; 12648 } 12649 $(".bpe_video:not(.Popup_Video)").show(); 12650 12651 clearTimeout(afterResizingJW); 12652 afterResizingJW = setTimeout(function () { 12653 afterResizeJW(); 12654 }, 1000); 12655 } 12656 } 12657 12658 }; 12659 function afterResizeJW() { 12660 if (!$('body').hasClass("accessible-mode")){ 12661 var JWPlayerVideoCounter=0; 12662 $(".bpe_video:not(.Popup_Video) img").each(function(){ 12663 12664 var img = this; 12665 var width = $(this).width(); 12666 var height = $(this).height(); 12667 var image = $(this).attr("src"); 12668 var video = $(this).parent().attr("href"); 12669 $(this).parent().parent().hide(); 12670 $(this).parent().parent().after("<div id=\"video"+JWPlayerVideoCounter+"\"></div>"); 12671 makeVideo("video"+JWPlayerVideoCounter,width,height,image,video,false); 12672 12673 12674 JWPlayerVideoCounter++; 12675 }); 12676 } 12677 } 12678 12679/* 12680 12681 #Responsive Calendar 12682 12683*/ 12684 function calendarReady() { 12685 $(".calendar").on("click",".event",function(e){ 12686 var $t = $(this); 12687 if ($(window).width()>768 && $(".eventdetails",$t).length) { 12688 $("body").append("<div id='eventPopupWrapper'><div id='eventPopup'><div id='closeEventPopup'>x</div><div id='eventInfo'></div></div></div>"); 12689 12690 $(".eventdetails",$t).clone().appendTo($("#eventInfo")); 12691 12692 var h = $("#eventPopup").outerHeight() / 2; 12693 $("#eventPopup").css("margin-top","-"+h+"px"); 12694 12695 $("#closeEventPopup").click(function(){ 12696 $("#eventPopupWrapper").remove(); 12697 }); 12698 return false; 12699 } 12700 }); 12701 $(".calendar").on("click",".hasEvents",function(e){ 12702 12703 if ($(window).width()<=768) { 12704 $("body").append("<div id='eventPopupWrapper'><div id='eventPopup'><div id='closeEventPopup'>x</div><div id='eventInfo'></div></div></div>"); 12705 12706 $(".eventdetails",$t).clone().appendTo($("#eventInfo")); 12707 12708 var h = $("#eventPopup").outerHeight() / 2; 12709 $("#eventPopup").css("margin-top","-"+h+"px"); 12710 12711 $("#closeEventPopup").click(function(){ 12712 $("#eventPopupWrapper").remove(); 12713 }); 12714 return false; 12715 } 12716 12717 }); 12718 12719 }; 12720 12721/* 12722 #Full width banner + Disclosures 12723 12724*/ 12725 function bannerReady() { 12726 if ($("#fullWidthBanner").length) { 12727 if ($("#fullWidthBannerBG img").length) { 12728 var src = $("#fullWidthBannerBG img").attr("src"); 12729 src = src.split("?"); 12730 src = src[0]+"?width=1920&height=auto"; 12731 } else { 12732 var src="/graphics/full-width-bg.jpg" 12733 } 12734 $("#fullWidthBanner").backstretch(src); 12735 $("h1,h2,h3,h4,p,li","#fullWidthBanner").filter(":not(.Button_Small,.Button_Medium,.Button_Large)").wrapInner("<span></span>"); 12736 } 12737 $("h1,h2,h3,h4,p,li",".disclose").filter(":not(.Button_Small,.Button_Medium,.Button_Large)").wrapInner("<span class=\"disclosure-reveal\"></span>"); 12738 }; 12739 12740/* 12741 12742 #Blog Loop 12743 12744*/ 12745 /* 12746 $(document).ready(function(){ 12747 $(".blogItemLoop").each(function(){ 12748 if (typeof $(this).attr("data-pic") != 'undefined') { 12749 $(this).backstretch($(this).attr("data-pic")); 12750 } 12751 $("h1,h2,h3,h4,p,li",$(this)).filter(":not(.Button_Small,.Button_Medium,.Button_Large,.blogDate)").wrapInner("<span></span>"); 12752 }); 12753 }); 12754 */ 12755 12756/* 12757 #Countdown 12758 12759*/ 12760 function countdownReady() { 12761 $('.countdownclock').each(function(){ 12762 var time = $(this).data("time"); 12763 $(this).countdown({ 12764 date: time, 12765 offset: +2, 12766 day: 'Day', 12767 days: 'Days' 12768 }, function () { 12769 12770 }); 12771 12772 }); 12773 12774 12775 }; 12776 12777 12778 12779 12780// If you add JWPlayer to your installation you can set some basic config for the player here. 12781var videoControlBar = "over"; 12782var videoScreenColor = "#FFFFFF"; 12783 12784/* 12785#Consent widgets 12786*/ 12787function consentReady() { 12788 var consent = new Array(); 12789 consent[1] = readCookie("consent1"); 12790 consent[2] = readCookie("consent2"); 12791 consent[3] = readCookie("consent3"); 12792 consent[4] = readCookie("consent4"); 12793 12794 $(".consent-container").each(function(){
12795 var purp = $(this).data("consent-purpose"); 12796 if (($(this).hasClass("consent-container-require-consent")&&consent[purp])||!$(this).hasClass("consent-container-require-consent")) { 12797 $(this).html($(this).data("content")); 12798 moduleHeights(); 12799 12800 } 12801 }); 12802 var consentYT = readCookie("consentYT"); 12803 $(".yt-check-consent").each(function(){ 12804 if (consentYT) { 12805 $(this).html('<iframe src="'+$(this).data("iframe-src")+'" frameborder="0" allowfullscreen></iframe>').removeClass("styleBox"); 12806 } 12807 }); 12808 if (consentYT) { 12809 $(".consent-yt").addClass("on"); 12810 } 12811 var consentGM = readCookie("consentGM"); 12812 $(".gm-check-consent").each(function(){ 12813 if (consentGM) { 12814 $(this).html('<iframe src="'+$(this).data("iframe-src")+'" frameborder="0" allowfullscreen></iframe>').removeClass("styleBox"); 12815 } 12816 }); 12817 if (consentGM) { 12818 $(".consent-gm").addClass("on"); 12819 } 12820 $(".consent-item").each(function(){ 12821 var purp = $(this).data("consent-purpose"); 12822 var consent = readCookie("consent"+purp); 12823 if (consent) { 12824 $(".consent-"+purp).addClass("on"); 12825 } 12826 }); 12827 $(".consent-yt").click(function(){ 12828 if ($(this).hasClass("on")) { 12829 eraseCookie('consentYT'); 12830 $(this).removeClass("on"); 12831 } else { 12832 createCookie('consentYT',true,182); 12833 $(this).addClass("on"); 12834 setTimeout(function () { 12835 $(".yt-check-consent").each(function(){ 12836 $(this).html('<iframe src="'+$(this).data("iframe-src")+'" frameborder="0" allowfullscreen></iframe>').removeClass("styleBox"); 12837 }); 12838 12839 }, 500); 12840 } 12841 12842 }); 12843 $(".consent-gm").click(function(){ 12844 if ($(this).hasClass("on")) { 12845 eraseCookie('consentGM'); 12846 $(this).removeClass("on"); 12847 } else { 12848 createCookie('consentGM',true,182); 12849 $(this).addClass("on"); 12850 setTimeout(function () { 12851 $(".gm-check-consent").each(function(){ 12852 $(this).html('<iframe src="'+$(this).data("iframe-src")+'" frameborder="0" allowfullscreen></iframe>').removeClass("styleBox"); 12853 }); 12854 12855 }, 500); 12856 } 12857 12858 }); 12859 $(".consent-item").click(function(){ 12860 var purp = $(this).data("consent-purpose"); 12861 if ($(this).hasClass("on")) { 12862 eraseCookie('consent'+purp); 12863 $(this).removeClass("on"); 12864 } else { 12865 12866 createCookie('consent'+purp,true,182); 12867 $(this).addClass("on"); 12868 $(".consent-container-"+purp).each(function(){ 12869 $(this).html($(this).data("content")); 12870 }); 12871 moduleHeights(); 12872 } 12873 12874 }); 12875}; 12876 12877 12878 12879 12880 }
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.