1/* 2 * jQuery JavaScript Library v1.3.2 3 * http://jquery.com/ 4 * 5 * Copyright (c) 2009 John Resig 6 * Dual licensed under the MIT and GPL licenses. 7 * http://docs.jquery.com/License 8 * 9 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) 10 * Revision: 6246 11 */ 12(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})}
12,css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})}
12,remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?
120:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];
12if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); 13/* 14 * Sizzle CSS Selector Engine - v0.9.3 15 * Copyright 2009, The Dojo Foundation 16 * Released under the MIT, BSD, and GPL Licenses. 17 * More information: http://sizzlejs.com/ 18 */ 19(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*
19)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}
19if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCo
19de clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}
19o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();
19if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["o
19pacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;
19if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.
19clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();;// $Id: drupal.js,v 1.41.2.4 2009/07/21 08:59:10 goba Exp $ 20 21var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {} }; 22 23/** 24 * Set the variable that indicates if JavaScript behaviors should be applied 25 */ 26Drupal.jsEnabled = document.getElementsByTagName && document.createElement && document.createTextNode && document.documentElement && document.getElementById; 27 28/** 29 * Attach all registered behaviors to a page element. 30 * 31 * Behaviors are event-triggered actions that attach to page elements, enhancing 32 * default non-Javascript UIs. Behaviors are registered in the Drupal.behaviors 33 * object as follows: 34 * @code 35 * Drupal.behaviors.behaviorName = function () { 36 * ... 37 * }; 38 * @endcode 39 * 40 * Drupal.attachBehaviors is added below to the jQuery ready event and so 41 * runs on initial page load. Developers implementing AHAH/AJAX in their 42 * solutions should also call this function after new page content has been 43 * loaded, feeding in an element to be processed, in order to attach all 44 * behaviors to the new content. 45 * 46 * Behaviors should use a class in the form behaviorName-processed to ensure 47 * the behavior is attached only once to a given element. (Doing so enables 48 * the reprocessing of given elements, which may be needed on occasion despite 49 * the ability to limit behavior attachment to a particular element.) 50 * 51 * @param context 52 * An element to attach behaviors to. If none is given, the document element 53 * is used. 54 */ 55Drupal.attachBehaviors = function(context) { 56 context = context || document; 57 if (Drupal.jsEnabled) { 58 // Execute all of them. 59 jQuery.each(Drupal.behaviors, function() { 60 this(context); 61 }); 62 } 63}; 64 65/** 66 * Encode special characters in a plain-text string for display as HTML. 67 */ 68Drupal.checkPlain = function(str) { 69 str = String(str); 70 var replace = { '&': '&', '"': '"', '<': '<', '>': '>' }; 71 for (var character in replace) { 72 var regex = new RegExp(character, 'g'); 73 str = str.replace(regex, replace[character]); 74 } 75 return str; 76}; 77 78/** 79 * Translate strings to the page language or a given language. 80 * 81 * See the documentation of the server-side t() function for further details. 82 * 83 * @param str 84 * A string containing the English string to translate. 85 * @param args 86 * An object of replacements pairs to make after translation. Incidences 87 * of any key in this array are replaced with the corresponding value. 88 * Based on the first character of the key, the value is escaped and/or themed: 89 * - !variable: inserted as is 90 * - @variable: escape plain text to HTML (Drupal.checkPlain) 91 * - %variable: escape text and theme as a placeholder for user-submitted 92 * content (checkPlain + Drupal.theme('placeholder')) 93 * @return 94 * The translated string. 95 */ 96Drupal.t = function(str, args) { 97 // Fetch the localized version of the string. 98 if (Drupal.locale.strings && Drupal.locale.strings[str]) { 99 str = Drupal.locale.strings[str]; 100 } 101 102 if (args) { 103 // Transform arguments before inserting them 104 for (var key in args) { 105 switch (key.charAt(0)) { 106 // Escaped only 107 case '@': 108 args[key] = Drupal.checkPlain(args[key]); 109 break; 110 // Pass-through 111 case '!': 112 break; 113 // Escaped and placeholder 114 case '%': 115 default: 116 args[key] = Drupal.theme('placeholder', args[key]); 117 break; 118 } 119 str = str.replace(key, args[key]); 120 } 121 } 122 return str; 123}; 124 125/** 126 * Format a string containing a count of items. 127 * 128 * This function ensures that the string is pluralized correctly. Since Drupal.t() is 129 * called by this function, make sure not to pass already-localized strings to it. 130 * 131 * See the documentation of the server-side format_plural() function for further details. 132 * 133 * @param count 134 * The item count to display. 135 * @param singular 136 * The string for the singular case. Please make sure it is clear this is 137 * singular, to ease translation (e.g. use "1 new comment" instead of "1 new"). 138 * Do not use @count in the singular string. 139 * @param plural 140 * The string for the plural case. Please make sure it is clear this is plural, 141 * to ease translation. Use @count in place of the item count, as in "@count 142 * new comments". 143 * @param args 144 * An object of replacements pairs to make after translation. Incidences 145 * of any key in this array are replaced with the corresponding value. 146 * Based on the first character of the key, the value is escaped and/or themed: 147 * - !variable: inserted as is 148 * - @variable: escape plain text to HTML (Drupal.checkPlain) 149 * - %variable: escape text and theme as a placeholder for user-submitted 150 * content (checkPlain + Drupal.theme('placeholder')) 151 * Note that you do not need to include @count in this array.
152 * This replacement is done automatically for the plural case. 153 * @return 154 * A translated string. 155 */ 156Drupal.formatPlural = function(count, singular, plural, args) { 157 var args = args || {}; 158 args['@count'] = count; 159 // Determine the index of the plural form. 160 var index = Drupal.locale.pluralFormula ? Drupal.locale.pluralFormula(args['@count']) : ((args['@count'] == 1) ? 0 : 1); 161 162 if (index == 0) { 163 return Drupal.t(singular, args); 164 } 165 else if (index == 1) { 166 return Drupal.t(plural, args); 167 } 168 else { 169 args['@count['+ index +']'] = args['@count']; 170 delete args['@count']; 171 return Drupal.t(plural.replace('@count', '@count['+ index +']')); 172 } 173}; 174 175/** 176 * Generate the themed representation of a Drupal object. 177 * 178 * All requests for themed output must go through this function. It examines 179 * the request and routes it to the appropriate theme function. If the current 180 * theme does not provide an override function, the generic theme function is 181 * called. 182 * 183 * For example, to retrieve the HTML that is output by theme_placeholder(text), 184 * call Drupal.theme('placeholder', text). 185 * 186 * @param func 187 * The name of the theme function to call. 188 * @param ... 189 * Additional arguments to pass along to the theme function. 190 * @return 191 * Any data the theme function returns. This could be a plain HTML string, 192 * but also a complex object. 193 */ 194Drupal.theme = function(func) { 195 for (var i = 1, args = []; i < arguments.length; i++) { 196 args.push(arguments[i]); 197 } 198 199 return (Drupal.theme[func] || Drupal.theme.prototype[func]).apply(this, args); 200}; 201 202/** 203 * Parse a JSON response. 204 * 205 * The result is either the JSON object, or an object with 'status' 0 and 'data' an error message. 206 */ 207Drupal.parseJson = function (data) { 208 if ((data.substring(0, 1) != '{') && (data.substring(0, 1) != '[')) { 209 return { status: 0, data: data.length ? data : Drupal.t('Unspecified error') }; 210 } 211 return eval('(' + data + ');'); 212}; 213 214/** 215 * Freeze the current body height (as minimum height). Used to prevent 216 * unnecessary upwards scrolling when doing DOM manipulations. 217 */ 218Drupal.freezeHeight = function () { 219 Drupal.unfreezeHeight(); 220 var div = document.createElement('div'); 221 $(div).css({ 222 position: 'absolute', 223 top: '0px', 224 left: '0px', 225 width: '1px', 226 height: $('body').css('height') 227 }).attr('id', 'freeze-height'); 228 $('body').append(div); 229}; 230 231/** 232 * Unfreeze the body height 233 */ 234Drupal.unfreezeHeight = function () { 235 $('#freeze-height').remove(); 236}; 237 238/** 239 * Wrapper around encodeURIComponent() which avoids Apache quirks (equivalent of 240 * drupal_urlencode() in PHP). This function should only be used on paths, not 241 * on query string arguments. 242 */ 243Drupal.encodeURIComponent = function (item, uri) { 244 uri = uri || location.href; 245 item = encodeURIComponent(item).replace(/%2F/g, '/'); 246 return (uri.indexOf('?q=') != -1) ? item : item.replace(/%26/g, '%2526').replace(/%23/g, '%2523').replace(/\/\//g, '/%252F'); 247}; 248 249/** 250 * Get the text selection in a textarea. 251 */ 252Drupal.getSelection = function (element) { 253 if (typeof(element.selectionStart) != 'number' && document.selection) { 254 // The current selection 255 var range1 = document.selection.createRange(); 256 var range2 = range1.duplicate(); 257 // Select all text. 258 range2.moveToElementText(element); 259 // Now move 'dummy' end point to end point of original range. 260 range2.setEndPoint('EndToEnd', range1); 261 // Now we can calculate start and end points. 262 var start = range2.text.length - range1.text.length; 263 var end = start + range1.text.length; 264 return { 'start': start, 'end': end }; 265 } 266 return { 'start': element.selectionStart, 'end': element.selectionEnd }; 267}; 268 269/** 270 * Build an error message from ahah response. 271 */ 272Drupal.ahahError = function(xmlhttp, uri) { 273 if (xmlhttp.status == 200) { 274 if (jQuery.trim($(xmlhttp.responseText).text())) { 275 var message = Drupal.t("An error occurred. \n@uri\n@text", {'@uri': uri, '@text': xmlhttp.responseText }); 276 } 277 else { 278 var message = Drupal.t("An error occurred. \n@uri\n(no information available).", {'@uri': uri, '@text': xmlhttp.responseText }); 279 } 280 } 281 else { 282 var message = Drupal.t("An HTTP error @status occurred. \n@uri", {'@uri': uri, '@status': xmlhttp.status }); 283 } 284 return message; 285} 286 287// Global Killswitch on the <html> element 288if (Drupal.jsEnabled) { 289 // Global Killswitch on the <html> element 290 $(document.documentElement).addClass('js'); 291 // 'js enabled' cookie 292 document.cookie = 'has_js=1; path=/'; 293 // Attach all behaviors. 294 $(document).ready(function() { 295 Drupal.attachBehaviors(this); 296 }); 297} 298 299/** 300 * The default themes. 301 */ 302Drupal.theme.prototype = { 303 304 /** 305 * Formats text for emphasized display in a placeholder inside a sentence. 306 * 307 * @param str 308 * The text to format (plain-text). 309 * @return 310 * The formatted text (html). 311 */ 312 placeholder: function(str) { 313 return '<em>' + Drupal.checkPlain(str) + '</em>'; 314 } 315}; 316;/** 317 * @file 318 * Core JS functions that need to be available on all sites 319 */ 320 321var $ = jQuery; 322 323if (typeof isiPad != 'undefined' && isiPad) { 324 $.getScript('/sites/all/themes/gold_master/ipad_utils.js', function() { 325 gcui_log('iPad specific JS loaded'); 326 }); 327} 328 329// apply polyfills for jQuery 1.9.0, if needed 330if (typeof jQuery !== 'undefined' && jQuery.fn.jquery === '1.9.0') { 331 332 // copied over from the jQuery migrate plugin 333 var matched, browser; 334 335 jQuery.uaMatch = function(ua) { 336 ua = ua.toLowerCase(); 337 338 var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || 339 /(webkit)[ \/]([\w.]+)/.exec(ua) || 340 /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || 341 /(msie) ([\w.]+)/.exec(ua) || 342 ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || 343 []; 344 345 return { 346 browser: match[ 1 ] || "", 347 version: match[ 2 ] || "0" 348 }; 349 }; 350 351 matched = jQuery.uaMatch(navigator.userAgent); 352 browser = {}; 353 354 if (matched.browser) { 355 browser[matched.browser] = true; 356 browser.version = matched.version; 357 } 358 359 // Chrome is Webkit, but Webkit is also Safari. 360 if (browser.chrome) { 361 browser.webkit = true; 362 } else if (browser.webkit) { 363 browser.safari = true; 364 } 365 366 jQuery.browser = browser; 367 368 jQuery.fn.live = function(types, data, fn) { 369 jQuery(this.context).on(types, this.selector, data, fn); 370 return this; 371 }; 372 373} 374 375/* GOOGLE EVENTS FUNCTIONS */ 376/* GOOGLE EVENTS FUNCTIONS */ 377/* GOOGLE EVENTS FUNCTIONS */ 378/* GOOGLE EVENTS FUNCTIONS */ 379/* GOOGLE EVENTS FUNCTIONS */ 380 381if (typeof gcui_google_event != 'function') { 382 383 /** 384 * Track an event with Google Analytics event tracking. 385 * @from: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide 386 */ 387 function gcui_google_event(category, event, label, value, noninteract) { 388 389 if (label) { 390 gcui_log('Google analytics event: ' + category + ' % ' + event + ' % ' + label); 391 if (typeof gcui_var_number != 'undefined' && gcui_var_number > 0) { 392 gcui_log('Google analytics event: ' + category + ' - variations' + ' % ' + gcui_var_number + '|' + event + ' % ' + gcui_var_number + '|' + label); 393 } 394 } else { 395 gcui_log('Google analytics event: ' + category + ' % ' + event); 396 if (typeof gcui_var_number != 'undefined' && gcui_var_number > 0) { 397 gcui_log('Google analytics event: ' + category + ' - variations' + ' % ' + gcui_var_number + '|' + event); 398 } 399 } 400 401 // make sure that pageTracker is defined 402 _gcui_google_get_pageTracker(); 403 404 // call trackEvent with the correct amount of parameters 405 try{ 406 if (typeof noninteract == 'undefined') { 407 if (typeof label == 'undefined') { 408 pageTracker._trackEvent(category, event + ''); 409 if (typeof gcui_var_number != 'undefined' && gcui_var_number > 0) { 410 pageTracker._trackEvent(category + ' - variations', gcui_var_number + '|' + event + ''); 411 } 412 } else { 413 if (typeof value == 'undefined') { 414 pageTracker._trackEvent(category, event + '', label + ''); 415 if (typeof gcui_var_number != 'undefined' && gcui_var_number > 0) { 416 pageTracker._trackEvent(category + ' - variations', gcui_var_number + '|' + event + '', gcui_var_number + '|' + label + ''); 417 } 418 } else { 419 pageTracker._trackEvent(category, event + '', label + '', value); 420 if (typeof gcui_var_number != 'undefined' && gcui_var_number > 0) { 421 pageTracker._trackEvent(category + ' - variations', gcui_var_number + '|' + event + '', gcui_var_number + '|' + label + '', value); 422 } 423 } 424 } 425 } else { 426 pageTracker._trackEvent(category, event + '', label + '', value, noninteract); 427 if (typeof gcui_var_number != 'undefined' && gcui_var_number > 0) { 428 pageTracker._trackEvent(category + ' - variations', gcui_var_number + '|' + event + '', gcui_var_number + '|' + label + '', value, noninteract); 429 } 430 } 431 } catch(e) { 432 gcui_log('Google analytics event failed: ' + category + ' | ' + event + ' | ' + label); 433 } 434 } 435} 436 437// track a link and redirect 438function gcui_google_ajax_link(link) { 439 440 if (link.match(/^tel/)) { 441 // don't track click-to-call links - it breaks them 442 window.location = link; 443 return; 444 } 445 446 // make sure that pageTracker is defined 447 _gcui_google_get_pageTracker(); 448 449 // see http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html, bottom of the page, section 'Cookies' 450 pageTracker._setDomainName(_gcui_my_base_domain); 451 pageTracker._setAllowLinker(true); 452 pageTracker._setAllowHash(false); 453 pageTracker._link(link); 454 455 // fall-back (in case it doesn't redirect) 456 setTimeout(function() { 457 window.location = link; 458 }, 2000); 459 460} 461 462var _gcui_google_ajax_submit_form = null; 463 464// track a form submission and redirect 465function gcui_google_ajax_submit(form) { 466 467 // make sure that pageTracker is defined 468 _gcui_google_get_pageTracker(); 469 470 // see http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html, bottom of the page, section 'Cookies' 471 pageTracker._setDomainName(_gcui_my_base_domain); 472 pageTracker._setAllowLinker(true); 473 pageTracker._setAllowHash(false); 474 pageTracker._linkByPost(form, false); 475 _gcui_google_ajax_submit_form = form; 476 477 // fall-back (in case it doesn't redirect) 478 setTimeout(function() { 479 _gcui_google_ajax_submit_form.submit(); 480 }, 2000); 481 482} 483 484// get the pageTracker global object in place 485function _gcui_google_get_pageTracker() { 486 if (typeof pageTracker == 'undefined') { 487 if (typeof _gat == 'undefined') { 488 // too early 489 gcui_log('Google Event too early - not tracking!!!'); 490 return; 491 } 492 if (typeof _gcui_google_analytics_acc == 'undefined') { 493 gcui_log('using default account: ' + _gcui_google_analytics_acc_def); 494 pageTracker = _gat._getTracker(_gcui_google_analytics_acc_def); 495 } else { 496 gcui_log('using account: ' + _gcui_google_analytics_acc); 497 pageTracker = _gat._getTracker(_gcui_google_analytics_acc); 498 } 499 } 500} 501 502/* UTILITY FUNCTIONS */ 503/* UTILITY FUNCTIONS */ 504/* UTILITY FUNCTIONS */ 505/* UTILITY FUNCTIONS */ 506/* UTILITY FUNCTIONS */ 507 508if (typeof gcui_in_array == 'undefined') { 509 // from: http://phpjs.org/functions/in_array 510 function gcui_in_array(needle, haystack, argStrict) { 511 // Checks if the given value exists in the array 512 // 513 // version: 1103.1210 514 // discuss at: http://phpjs.org/functions/in_array 515 // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 516 // + improved by: vlado houba 517 // + input by: Billy 518 // + bugfixed by: Brett Zamir (http://brett-zamir.me) 519 // * example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']); 520 // * returns 1: true 521 // * example 2: in_array('vlado', {0: 'Kevin', vlado: 'van', 1: 'Zonneveld'}); 522 // * returns 2: false 523 // * example 3: in_array(1, ['1', '2', '3']); 524 // * returns 3: true 525 // * example 3: in_array(1, ['1', '2', '3'], false); 526 // * returns 3: true 527 // * example 4: in_array(1, ['1', '2', '3'], true); 528 // * returns 4: false 529 var key = '',
530 strict = !! argStrict; 531 532 if (strict) { 533 for (key in haystack) { 534 if (haystack[key] === needle) { 535 return true; 536 } 537 } 538 } else { 539 for (key in haystack) { 540 if (haystack[key] == needle) { 541 return true; 542 } 543 } 544 } 545 546 return false; 547 } 548} 549 550/** 551* Utility function to get the current page's langauge from JS, using the lang-[language_code] class from the <body> tag. 552*/ 553if (typeof _gcui_get_lang == 'undefined') { 554 function _gcui_get_lang() { 555 556 var body_classes = $('body').attr('class'); 557 var class_parts = body_classes.split(' '); 558 var lang = ''; 559 for (var j in class_parts) { 560 if (class_parts[j].indexOf('lang-') != -1) { 561 // this is the part 562 lang = class_parts[j].substr(5); 563 } 564 } 565 566 // fallback 567 if (lang == '') { 568 gcui_log('ERROR: body class lang-[language_code] is not set'); 569 lang = 'en'; 570 } 571 572 return lang; 573 574 } 575} 576 577/** 578 * preg_replace for JS (PHP style) 579 */ 580if (typeof preg_replace == 'undefined') { 581 function preg_replace(find, replace, the_string) { 582 return the_string.replace(find, replace); 583 } 584} 585 586/** 587 * isset for JS (PHP style), kinda. Needs the variable name as string, like: 588 * if (isset('varname')) ... 589 */ 590if (typeof isset == 'undefined') { 591 function isset(variable) { 592 return typeof window[variable] != 'undefined'; 593 } 594} 595 596if (typeof $.fn.delay != 'function') { 597 $.fn.delay = function(time, callback){ 598 jQuery.fx.step.delay = function(){}; 599 return this.animate({delay:1}, time, callback); 600 } 601} 602 603/** 604 * jQuery plugin to get the $_GET params from the URL and hashtags 605 * from: http://stackoverflow.com/questions/439463/how-to-get-get-and-post-variables-with-jquery 606 * changed: added hashtags 607 */ 608jQuery.extend({ 609 'Q' : window.location.search.length <= 1 ? {hash: window.location.hash} 610 : function(a){ 611 var i = a.length, 612 r = /%25/g, // Ensure '%' is properly represented 613 h = {}; // (Safari auto-encodes '%', Firefox 1.5 does not) 614 while(i--) { 615 var p = a[i].split('='); 616 h[ p[0] ] = r.test( p[1] ) ? decodeURIComponent( p[1] ) : p[1]; 617 } 618 619 h.hash = window.location.hash; 620 621 return h; 622 }(window.location.search.substr(1).split('&')) 623}); 624 625/* Example usage: 626 627switch ($.Q.event) { 628 case 'new' : 629 // http://www.site.com/?event=new 630 $('#NewItemButton').trigger('click'); 631 break; 632 default : 633} 634 635if ($.Q.setorg) { 636 ... 637} 638 639if ($.Q.hash && $.Q.hash.match(/setorg/)) { 640 ... 641} 642 643*/ 644 645/* GOOGLE MAPS */ 646/* GOOGLE MAPS */ 647/* GOOGLE MAPS */ 648/* GOOGLE MAPS */ 649/* GOOGLE MAPS */ 650 651/** 652 * Generates URLs for the different map services. 653 */ 654if (typeof _gcui_get_map_urls == 'undefined') { 655 function _gcui_get_map_urls(org_data, options) { 656 657 org_lat = org_data.latitude; 658 org_long = org_data.longitude; 659 org_street = org_data.address1; 660 org_city = org_data.city; 661 org_state = org_data.state_province; 662 org_zip = org_data.postal_code; 663 org_country = org_data.country_code; 664 org_phone = org_data.phone; 665 org_name = org_data.full_name; 666 locale = _gcui_get_lang(); 667 668 // default options 669 var aOptions = { 670 width: 245, 671 height: 150, 672 zoom: 14 673 }; 674 675 if (options) { 676 $.extend(aOptions, options); 677 } 678 679 //http://mashupguide.net/1.0/html/ch13s03.xhtml 680 681 /*////////// YAHOO MAPS //////////*/ 682 var yahoo_maps_url = 'http://maps.yahoo.com/#mvt=m&lat=' + org_lat + '&lon=' + org_long + '&zoom=17&q2=' + 683 org_street + ', ' + 684 org_city + ', ' + 685 org_state + ' ' + 686 org_zip + ', ' + 687 org_country; 688 689 /*////////// BING //////////*/ 690 // http://help.live.com/help.aspx?project=wl_local&market=en-us&querytype=topic&query=wl_local_proc_buildurl.htm 691 var bing_maps_url = 'http://bing.com/maps/default.aspx?v=2&mkt=' + locale + '&rtp=~pos.' + org_lat + '_' + org_long + '_' + 692 org_street + ', ' + 693 org_city + ', ' + 694 org_state + ' ' + 695 org_zip + ', ' + 696 org_country + '_' + 697 org_name + '_' + 698 org_phone; 699 700 /*////////// GOOGLE MAPS STATIC IMAGE //////////*/ 701 var google_maps_static = 'http://maps.google.com/maps/api/staticmap?center=' + 702 org_lat + ',' + org_long + 703 '&zoom=' + aOptions.zoom + '&size=' + aOptions.width + 'x' + aOptions.height + '&maptype=roadmap&markers=color:red|' + org_lat + ',' + org_long + '&sensor=false'; 704 705 /*////////// GOOGLE MAPS //////////*/ 706 var google_maps_url = 'http://maps.google.com/maps?f=d&source=s_d&saddr=&daddr=' + 707 preg_replace('~ ~', '+', org_street) + ',+' +
708 preg_replace('~ ~', '+', org_city) + ',+' + 709 preg_replace('~ ~', '+', org_state) + '+' + 710 preg_replace('~ ~', '+', org_zip) + ',+' + 711 preg_replace('~ ~', '+', org_country) + '&hl=' + locale + '&geocode=&mra=ls&sll=' + org_lat + ',' + org_long + 'ie=UTF8&z=17'; 712 713 /*////////// MAPQUEST MAPS //////////*/ 714 // http://www.mapquest.com/features/lf_maps 715 716 ///maps?&=3031&=AU&latitude=-37.78091&longitude=144.93232&geocode=BLOCK 717 718 var mapquest_maps_url = 'http://classic.mapquest.com/maps?address=' + 719 preg_replace('~ ~', '+', org_street) + '&city=' + 720 preg_replace('~ ~', '+', org_city) + '&state=' + 721 preg_replace('~ ~', '+', org_state) + '&zipcode=' + 722 preg_replace('~ ~', '+', org_zip) + '&country=' + 723 preg_replace('~ ~', '+', org_country); 724 725 /* 726 $mapquest_maps_url = 'http://www.mapquest.com/maps?address=' . 727 preg_replace('~ ~', '+', org_street) + ',+' . 728 preg_replace('~ ~', '+', org_city) + ',+' . 729 preg_replace('~ ~', '+', org_state) + '+' . 730 preg_replace('~ ~', '+', org_zip) + ',+' . 731 preg_replace('~ ~', '+', org_country); 732 */ 733 734 var res = { 735 'yahoo_maps_url': yahoo_maps_url, 736 'bing_maps_url': bing_maps_url, 737 'google_maps_url': google_maps_url, 738 'mapquest_maps_url': mapquest_maps_url, 739 'google_static_map_image': google_maps_static 740 }; 741 742 return res; 743 744 } 745} 746 747/** 748 * Loads in the google maps API, asynchronously. 749 */ 750if (typeof gcui_load_google_maps_api == 'undefined') { 751 function gcui_load_google_maps_api(options) { 752 753 gcui_google_map_js_loaded = 1; 754 755 // default options 756 var aOptions = { 757 locale: 'en' 758 }; 759 760 if (options) { 761 $.extend(aOptions, options); 762 } 763 764 // code from: http://code.google.com/apis/maps/documentation/javascript/basics.html 765 var script_url = 'http://maps.google.com/maps/api/js?sensor=false'; 766 767 // apply the various options to the script URL 768 if (typeof aOptions.callback != 'undefined' && aOptions.callback != '') { 769 script_url += '&callback=' + aOptions.callback; 770 } 771 script_url += '&language=' + aOptions.locale; 772 773 // make sure it's not already loaded 774 if (typeof google != 'undefined' && typeof google.maps != 'undefined') { 775 gcui_log('google maps api already loaded, not doing it again, just calling callback'); 776 aOptions && aOptions.callback && eval(aOptions.callback+'()'); 777 } 778 else { 779 780 // load the script 781 $.ajax({ 782 url: script_url, 783 dataType: 'script' 784 }); 785 } 786 787 } 788} 789 790/* HTML5 GEOLOCATION */ 791/* HTML5 GEOLOCATION */ 792/* HTML5 GEOLOCATION */ 793/* HTML5 GEOLOCATION */ 794/* HTML5 GEOLOCATION */ 795 796/** 797 * Example of _gcui_get_geolocate() call 798 */ 799/* 800_gcui_get_geolocate( 801 function(position) { 802 gcui_log('success'); 803 // the position object 804 gcui_log(position); 805 // the coordinates 806 gcui_log(position.coords.latitude + ' | ' + position.coords.longitude); 807 // formatted address (optional) 808 if (position.formatted_address) { 809 gcui_log(position.formatted_address); 810 } 811 }, 812 function(error) { 813 gcui_log('error'); 814 // the error object 815 gcui_log(error); 816 // the error message 817 gcui_log(error.message); 818 } 819); 820*/ 821 822var __gcui_get_geolocate_success_callback; 823var __gcui_get_geolocate_success_save = {}; 824var __gcui_get_geolocate_error_callback; 825var __gcui_get_geolocate_in_call = false; 826var __gcui_get_geolocate_debug = false; 827 828/** 829 * Utility function to geolocate the user using the HTML5 Geolocation API or whatever else is available. 830 * Based on: http://dev.w3.org/geo/api/spec-source.html 831 * and: http://code.google.com/apis/maps/documentation/javascript/services.html#Geocoding 832 */ 833function _gcui_get_geolocate(success_function, error_function) { 834 835 gcui_log('_gcui_get_geolocate called...'); 836 837 // if we're already on a call, abort (to avoid possible concurrency issues 838 if (__gcui_get_geolocate_in_call) { 839 error_function({ 840 'code': 100001, 841 'message': 'Geolocation conflict - another geolocation request is already ongoing' 842 }); 843 } 844 845 // store the callback functions so we can use them later 846 __gcui_get_geolocate_success_callback = success_function; 847 __gcui_get_geolocate_error_callback = error_function; 848 __gcui_get_geolocate_in_call = true; 849 850 if (navigator.geolocation) { 851 852 gcui_log('has HTML5 geolocation support'); 853 854 // we have Geolocation support 855 navigator.geolocation.getCurrentPosition( 856 __gcui_get_geolocate_success, 857 __gcui_get_geolocate_error 858 ); 859 860 } else { 861 862 // no Geolocation API support or not enabled 863 gcui_log('no HTML5 geolocation support or not enabled'); 864 865 // check if we can use geolocation based on IP 866 var geolocation_from_ip = gcui_org_preference_get_location(); 867 868 if ( geolocation_from_ip && 869 geolocation_from_ip.result && 870 geolocation_from_ip.result.estimated_location && 871 geolocation_from_ip.result.estimated_location.latitude && 872 geolocation_from_ip.result.estimated_location.longitude) { 873 874 // we have IP-based geolocation, but let's ask for the user's OK to use it 875 var ok_given = false;
876 877 // check if the user already given OK earlier 878 if ($.cookie('gcui_org_preference_geoloc_ok') != null) { 879 ok_given = true; 880 } else { 881 ok_given = confirm('We were unable to find your exact location. Use approximate location instead?'); 882 if (ok_given) { 883 // store it in the cookie 884 $.cookie( 885 'gcui_org_preference_geoloc_ok', 886 new Date(), 887 { path: '/', expires: 7 } 888 ); 889 } 890 } 891 892 if (ok_given) { 893 894 // user given OK, go ahead 895 __gcui_get_geolocate_success({ 896 'coords': { 897 'latitude': geolocation_from_ip.result.estimated_location.latitude, 898 'longitude': geolocation_from_ip.result.estimated_location.longitude 899 } 900 }); 901 902 } else { 903 904 // user refused, don't use the data 905 __gcui_get_geolocate_error({ 906 'code': 100002, 907 'message': 'User has not given OK to detect location' 908 }); 909 910 } 911 912 } else { 913 914 // we don't even have IP-based geolocation 915 __gcui_get_geolocate_error({ 916 'code': 100003, 917 'message': 'Unable to detect location' 918 }); 919 920 } 921 922 } 923 924} 925 926/** 927 * Callback function for _gcui_get_geolocate() 928 */ 929function __gcui_get_geolocate_success(position) { 930 // all good, but let's reverse geocode this to get an address as well 931 // this doesn't seem to work - back to the stone age... 932 //__gcui_get_geolocate_success_save = JSON.parse(JSON.stringify(position)); // use JSON encode and decode to extra data from native object 933 934// console.log('__gcui_get_geolocate_success'); 935// console.log(position); 936 937 __gcui_get_geolocate_success_save = { 938 coords: { 939 latitude: position.coords.latitude, 940 longitude: position.coords.longitude 941 } 942 }; 943 944 gcui_load_google_maps_api({ 945 locale: _gcui_get_lang(), 946 callback: '__gcui_get_geolocate_success2' 947 }); 948 949 // disabled - this was just making an extra call 950 // if ww fail for some reason on geodecoding, still attempt to pass back 951 // the geolocated result 952 //__gcui_get_geolocate_success_callback(position); 953 954} 955 956/** 957 * Callback function for _gcui_get_geolocate() (from reverse geocode) 958 */ 959function __gcui_get_geolocate_success2() { 960 var geocoder = new google.maps.Geocoder(); 961 var latlang = new google.maps.LatLng( 962 __gcui_get_geolocate_success_save.coords.latitude, 963 __gcui_get_geolocate_success_save.coords.longitude 964 ); 965 966 geocoder.geocode( 967 { 'latLng': latlang }, 968 function(results, status) { 969 if (status == google.maps.GeocoderStatus.OK) { 970 971 // geodecoding success, append it to the result object and exit 972 /* 973 if (typeof __gcui_get_geolocate_success_save.formatted_address == 'undefined') { 974 gcui_log('ERROR: something is wrong here ...'); 975 __gcui_get_geolocate_success_save = null; 976 __gcui_get_geolocate_success_save = {}; 977 } 978 */ 979 __gcui_get_geolocate_success_save.formatted_address = results[0].formatted_address; 980 __gcui_get_geolocate_in_call = false; 981 if (typeof __gcui_get_geolocate_success_callback == 'function') { 982 __gcui_get_geolocate_success_callback(__gcui_get_geolocate_success_save); 983 } 984 985 } else { 986 987 // geodecoding failes, but out original geolocation was a success 988 // so just pass it the original result as if nothing happened 989 __gcui_get_geolocate_in_call = false; 990 if (typeof __gcui_get_geolocate_success_callback == 'function') { 991 __gcui_get_geolocate_success_callback(__gcui_get_geolocate_success_save); 992 } 993 994 } 995 } 996 ); 997 998} 999 1000/** 1001 * Callback function for _gcui_get_geolocate() 1002 */ 1003function __gcui_get_geolocate_error(error) { 1004 // all good, return the value 1005 __gcui_get_geolocate_in_call = false; 1006 __gcui_get_geolocate_error_callback(error); 1007} 1008 1009/** 1010 * Rewrite jQuery animations into CSS transitions. Detect if browser can use CSS transitions, otherwise pass 1011 * the call to the jQuery animate() function. 1012 * 1013 * @usage 1014 * Use "animate2" instead of "animate" in any jQuery animate() statement. 1015 * 1016 * @param 1017 * same as <a href="http://api.jquery.com/animate/">jQuery animate()</a> 1018 * 1019 * @from 1020 * <a href="http://www.bradshawenterprises.com/blog/2011/a-jquery-function-to-animate-using-css3-transitions-if-possible-with-the-animate-fallback/http://www.bradshawenterprises.com/blog/2011/a-jquery-function-to-animate-using-css3-transitions-if-possible-with-the-animate-fallback/"> 1021 * http://www.bradshawenterprises.com/blog/2011/a-jquery-function-to-animate-using-css3-transitions-if-possible-with-the-animate-fallback/ 1022 * </a> 1023 */ 1024$.fn.animate2 = function(cssProperties, ms, easing, callback) { 1025 animate2_($(this), cssProperties, ms, easing, callback); 1026} 1027 1028var speed = 1000; // Default animation speed in milliseconds (1000 = 1 second) 1029 1030var vP = ""; 1031var transitionEnd = "TransitionEnd"; 1032if ($.browser.webkit) { 1033 vP = "-webkit-"; 1034 transitionEnd = "webkitTransitionEnd"; 1035 vTransform = '-webkit-transform'; 1036} else if ($.browser.safari) { 1037 vP = "-webkit-"; 1038 transitionEnd = "webkitTransitionEnd"; 1039 vTransform = '-webkit-transform'; 1040} else if ($.browser.msie) { 1041 vP = "-ms-"; 1042 vTransform = '-ms-transform'; 1043} else if ($.browser.mozilla) { 1044 vP = "-moz-"; 1045 vTransform = '-moz-transform'; 1046 transitionEnd = "transitionend"; 1047} else if ($.browser.opera) { 1048 vP = "-o-"; 1049 vTransform = '-o-transform'; 1050 transitionEnd = "oTransitionEnd"; 1051} 1052 1053// detect if we can use CSS transitions 1054// from: http://technology.razorfish.com/2010/02/08/detecting-css-transitions-support-using-javascript/ 1055var cssTransitionsSupported = false;
1056(function() { 1057 var div = document.createElement('div'); 1058 div.innerHTML = '<div style="-webkit-transition:color 1s linear;-moz-transition:color 1s linear;"></div>'; 1059 cssTransitionsSupported = (div.firstChild.style.webkitTransition !== undefined) || (div.firstChild.style.MozTransition !== undefined); 1060 delete div; 1061})(); 1062 1063// @HACK: only do this for mobile for now 1064var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())); 1065if (mobile) { 1066 cssTransitionsSupported = true; 1067} else { 1068 cssTransitionsSupported = false; 1069} 1070 1071 1072function animate2_(object, cssProperties, ms, _easing, callback) { 1073 1074 if (!ms) { 1075 ms = speed; 1076 } 1077 1078 if (cssTransitionsSupported && typeof cssProperties.width == 'undefined') { 1079 1080 gcui_log('using CSS transitions instead of $.animate()'); 1081 1082 var defaultEasings = ['linear', 'ease-in', 'ease-out', 'ease-in-out']; 1083 1084 if (gcui_in_array(easing, defaultEasings)) { 1085 var easing = _easing; 1086 } else { 1087 // default to easeOutCirc 1088 // from: https://github.com/matthewlein/Ceaser-CSS-Easing-tmbundle/blob/master/Snippets/transition:%20easeOutCirc.tmSnippet 1089 var easing = 'cubic-bezier(0.075, 0.820, 0.165, 1.000)'; 1090 easing = 'cubic-bezier(0.165, 0.840, 0.440, 1.000)'; 1091 } 1092 1093 object.css(vP + "transition", "all " + ms + "ms " + easing); 1094 1095 // @HACK: rewrite left: +=800 and similar animations 1096 var props = {left: 1, right: 1}; 1097 var transateProps = {left: 0, top: 0}; 1098 var transatePropsChanged = false; 1099 for (var prop in props) { 1100 if (typeof cssProperties[prop] != 'undefined' && cssProperties[prop].match(/[+-]=/)) { 1101 1102 transatePropsChanged = true; 1103 1104 var dir = cssProperties[prop].replace(/=.*$/, ''); 1105 var amount = parseInt(cssProperties[prop].replace(/^.*=/, '').replace(/px/, '')); 1106 1107 /* 1108 if (dir == '+') { 1109 cssProperties[prop] = (object.position()[prop] + amount) + 'px'; 1110 } else { 1111 cssProperties[prop] = (object.position()[prop] - amount) + 'px'; 1112 } 1113 */ 1114 1115 var existingCoords = {left: 0, top: 0}; 1116 var currentTransform = object.css(vTransform); 1117 if (vTransform == '-moz-transform') currentTransform = object.css('transform'); 1118 gcui_log(translateParts); 1119 if (currentTransform && currentTransform.match(/translate3d/)) { 1120 var translateParts = /translate3d\((.*),(.*),(.*)\)/.exec(currentTransform); 1121 if (translateParts && translateParts.length > 3) { 1122 existingCoords.left = translateParts[1].replace(/px/, ''); 1123 existingCoords.top = translateParts[2].replace(/px/, ''); 1124 } 1125 } 1126 1127 // change the left/top animations into a translate3d 1128 delete cssProperties[prop]; 1129 transateProps[prop] = 1130 existingCoords[prop] ? 1131 ( 1132 dir == '+' ? 1133 parseInt(existingCoords[prop]) + amount : 1134 parseInt(existingCoords[prop]) - amount 1135 ) : 1136 ( 1137 dir == '+' ? 1138 parseInt(amount) : 1139 -parseInt(amount) 1140 ) 1141 ; 1142 } 1143 } 1144 1145 if (transatePropsChanged) { 1146 cssProperties[vTransform] = 'translate3d(' + 1147 transateProps.left + 'px,' + 1148 transateProps.top + 'px,' + 1149 '0px' + 1150 ')'; 1151 } 1152 1153 gcui_log('applying: ' + JSON.stringify(cssProperties)); 1154 1155 object.css(cssProperties); 1156 1157 object.bind(transitionEnd,function(){ 1158 object.unbind(transitionEnd); 1159 // object.css(vP + 'transition', 'none'); 1160 if ($.isFunction(callback)) callback(); 1161 }); 1162 1163 } else { 1164 1165 // do regular jQuery animation instead 1166 if ($.isFunction(callback)) { 1167 object.animate(cssProperties, ms, _easing, callback); 1168 } else { 1169 object.animate(cssProperties, ms, _easing); 1170 } 1171 1172 } 1173} 1174 1175function getInternetExplorerVersion() 1176 // Returns the version of Internet Explorer or a -1 1177 // (indicating the use of another browser). 1178{ 1179 var rv = -1; // Return value assumes failure. 1180 if (navigator.appName == 'Microsoft Internet Explorer') 1181 { 1182 var ua = navigator.userAgent; 1183 var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); 1184 if (re.exec(ua) != null) 1185 rv = parseFloat( RegExp.$1 ); 1186 } 1187 return rv; 1188} 1189 1190// add 1191var __ieVersion = getInternetExplorerVersion(); 1192if (__ieVersion > 0) { 1193 var h = $('html'); 1194 h.addClass('ie'+__ieVersion); 1195 h.addClass('ie'); 1196} 1197else { 1198 var h = $('html'); 1199 h.addClass('not-ie'); 1200} 1201 1202/** 1203 * Get the actual width of the text in an element. 1204 * @from: http://stackoverflow.com/questions/1582534/calculating-text-width-with-jquery 1205 */ 1206$.fn.textWidth = function() { 1207 var html_org = $(this).html(); 1208 var html_calc = '<span>' + html_org + '</span>'; 1209 $(this).html(html_calc); 1210 var width = $(this).find('span:first').width(); 1211 $(this).html(html_org); 1212 return width; 1213} 1214 1215/** 1216 * Adjust letter spacing of elements inside a div so the text 1217 * fills out the full width of the div (more or less). 1218 */ 1219$.fn.spaceOut = function() { 1220 return this.each(function() { 1221 var $elem = $(this); 1222 1223 // get the widest element 1224 var max_width = 0; 1225 $($elem).children().each(function() { 1226 max_width = $(this).textWidth() > max_width ? $(this).textWidth() : max_width; 1227 }); 1228 1229 // then go through and expand each as needed 1230 $($elem).children().each(function() { 1231 if ($(this).textWidth() < max_width) { 1232 var latest_width = 0; 1233 var init_height = $(this).height(); 1234 var max_tries = 50; 1235 var current_spacing = 0; 1236 while (max_tries-- > 0 && $(this).textWidth() < max_width) { 1237 current_spacing += 0.5; 1238 $(this).css('letter-spacing', current_spacing + 'px'); 1239 } 1240 1241 // if needed, reduce it by a bit 1242 if ($(this).height() > init_height) { // $(this).textWidth() > max_width || 1243 current_spacing -= 0.5; 1244 $(this).css('letter-spacing', current_spacing + 'px'); 1245 } 1246 } 1247 }); 1248 }); 1249} 1250 1251/** 1252 * Vertically center any element having the class "dynamic-vert-center". 1253 * @note: you should set the height of the parent element to the desired height. 1254 */ 1255function gcui_dynamic_center() { 1256 // only run once 1257 if (typeof gcui_dynamic_center_ran == 'undefined') { 1258 1259 // note: this is actually a global var
1260 gcui_dynamic_center_ran = true; 1261 1262 $(document).ready(function() { 1263 $('.dynamic-vert-center').each(function() { 1264 var parent_height = $(this).parent().height(); 1265 $(this).addClass('vert-center'); 1266 var horiz_center = ''; 1267 if ($(this).hasClass('dynamic-horiz-center')) { 1268 horiz_center = 'margin: auto;'; 1269 } 1270 $(this).wrap('<div style="height: ' + parent_height + 'px;' + horiz_center + '" class="outer-vert-center"></div>'); 1271 $(this).wrap('<div class="mid-vert-center"></div>'); 1272 }); 1273 }); 1274 } 1275} 1276 1277/** 1278 * Return the same as $(window).scrollTop() but faster. Use if you need to check 1279 * the scrollTop all the time, i.e. in a setInterval(...). 1280 */ 1281function _window_scrollTop() { 1282 return (document.documentElement.scrollTop ? document.documentElement.scrollTop : window.scrollY); 1283} 1284 1285/** 1286 * Return the same as $(window).height() but faster. 1287 */ 1288function _window_height() { 1289 // var myWidth = 0; 1290 var myHeight = 0; 1291 if (typeof( window.innerWidth ) == 'number') { 1292 //Non-IE 1293 // myWidth = window.innerWidth; 1294 myHeight = window.innerHeight; 1295 } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { 1296 // IE 6+ in 'standards compliant mode' 1297 //myWidth = document.documentElement.clientWidth; 1298 myHeight = document.documentElement.clientHeight; 1299 } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { 1300 //IE 4 compatible 1301 // myWidth = document.body.clientWidth; 1302 myHeight = document.body.clientHeight; 1303 } 1304 return myHeight; 1305} 1306 1307/** 1308 * Quick way to check for CSS3 support. 1309 * @from: http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-detect-css-support-in-browsers-with-javascript/ 1310 * @usage: if ( supports('textShadow') ) { ... } 1311 */ 1312var supports = (function() { 1313 var div = document.createElement('div'), 1314 vendors = 'Khtml Ms O Moz Webkit'.split(' '), 1315 len = vendors.length; 1316 1317 return function(prop) { 1318 if ( prop in div.style ) return true; 1319 1320 prop = prop.replace(/^[a-z]/, function(val) { 1321 return val.toUpperCase(); 1322 }); 1323 1324 while(len--) { 1325 if ( vendors[len] + prop in div.style ) { 1326 // browser supports box-shadow. Do what you need. 1327 // Or use a bang (!) to test if the browser doesn't. 1328 return true; 1329 } 1330 } 1331 return false; 1332 }; 1333})(); 1334 1335/** 1336 * Trigger a click event on something. Unfortunately, just .trigger('click') or .click() doesn't do the job 1337 * in all cases. 1338 */ 1339/* 1340 $('#docker-wrapper table td div').click(function(e) { 1341 1342 var $this = $(this); 1343 1344 if ($this.data('ignore_click') == 'ignore') { 1345 return true; 1346 } 1347 e.preventDefault(); 1348 1349 if (document.createEvent) { 1350 var e2 = document.createEvent('MouseEvents'); 1351 e2.initEvent( 'click', true, true ); 1352 $this.data('ignore_click', 'ignore'); 1353 $this.find('a')[0].dispatchEvent(e2); 1354 $this.data('ignore_click', ''); 1355 // location = $(this).parent().siblings('a').attr('href'); 1356 } else { 1357 var e2 = document.createEventObject(); 1358 $this.data('ignore_click', 'ignore'); 1359 $this.find('a')[0].fireEvent('onclick', e2); 1360 $this.data('ignore_click', ''); 1361 // location = $(this).parent().siblings('a').attr('href'); 1362 } 1363 return false; 1364 }); 1365*/ 1366 1367/** 1368 * EXPERIMENTAL STUFF 1369 1370function _class(className, elm) { 1371 1372 if (typeof elm == 'undefined') { 1373 elm = document; 1374 } 1375 1376 if (typeof elm.getElementsByClassName == 'function') { 1377 return elm.getElementsByClassName(className); 1378 } 1379} 1380 1381 1382$(document).ready(function() { 1383 gcui_log(_class('playbutton-wrapper')); 1384}); 1385*/ 1386 1387 1388/** 1389 * Utility function to achieve a delayed hover behavior, i.e. instead of some action right on hover, 1390 * the action happens only when hovered over the element for a certain time. Takes care of ignoring repeated hovers, 1391 * hovering out and back on, etc. 1392 * 1393 * @usage: 1394 * Instead of $(selector).hover(function() { ... }, function() { ... }); use 1395 * hover_on_timer(selector, function() { ... }, function() { ... }, delay); 1396 */ 1397function hover_on_timer(selector, on_function, off_function, timeout) { 1398 $(selector).hover( 1399 function() { 1400 var $this = $(this); 1401 var that = this; 1402 if (!$this.data('_timer3')) { 1403 $this.data('_timer3', setTimeout(function() { 1404 on_function.apply(that); 1405 }, timeout)); 1406 } 1407 }, 1408 function() { 1409 var $this = $(this); 1410 if ($this.data('_timer3')) { 1411 clearTimeout($this.data('_timer3')); 1412 $this.data('_timer3', 0); 1413 } 1414 off_function.apply(this); 1415 } 1416 ); 1417} 1418
1419// @TODO: finish developing this as a way to debug JS in IE (instead of console.log) 1420function console_log(message) { 1421 $('#main').append('<div class="messages warning bug-report">' + message + '</div>'); 1422} 1423 1424// convenience function for simple click tracking on elements 1425// @note: <modules>/js/gcui_google_events.js needs to be loaded as well 1426// @note: details can be a function (in case it needs to get the element's arrtibutes and so on) 1427function gcui_click_track(elem, category, title, details) { 1428 1429 // if a string or DOM object is passed in, create a jQuery object from it 1430 if (elem instanceof jQuery) { 1431 var $elem = elem; 1432 } else { 1433 var $elem = $(elem); 1434 } 1435 1436 $elem.live('click', function() { 1437 if (typeof details == 'function') { 1438 gcui_google_event(category, title, details.apply(this, arguments)); 1439 } else { 1440 gcui_google_event(category, title, details); 1441 } 1442 return true; 1443 }); 1444 1445} 1446 1447/** 1448 * Generic function for sending a click to a DOM element 1449 * (since the jQuery trigger('click') does not seem to work in all cases) 1450 */ 1451function gcui_send_click(dom_elem) { 1452 if (document.createEvent) { 1453 var e = document.createEvent('MouseEvents'); 1454 e.initEvent( 'click', true, true ); 1455 dom_elem.dispatchEvent(e); 1456 } else { 1457 var e = document.createEventObject(); 1458 dom_elem.fireEvent('onclick', e); 1459 } 1460} 1461 1462/** 1463 * Wire up an element with a click handler. 1464 * Does not need to be wrapped in document.ready(). 1465 * 1466 * Usage: 1467 * gcui_wire_up_live_click('.some-class', function(e) { 1468 * ... 1469 * }); 1470 */ 1471function gcui_wire_up_live_click(sel, func) { 1472 1473 var selector = sel; 1474 1475 $(document).ready(function() { 1476 $(selector).live('click', function(e) { 1477 e.preventDefault(); 1478 e.stopPropagation(); 1479 func.apply(this, [e]); 1480 return false; 1481 }); 1482 }); 1483 1484} 1485 1486/** 1487 * Detect if the current page is rtl or ltr. 1488 * 1489 * @return 1490 * string "rtl" or "ltr" 1491 * 1492 * @from: http://stackoverflow.com/questions/16957533/how-to-detect-current-web-page-or-element-direction-rtl-ltr-or-any-other-attri 1493 */ 1494function gcui_get_direction() { 1495 var elem = document.body; 1496 if (window.getComputedStyle) { // all browsers 1497 return window.getComputedStyle(elem, null).getPropertyValue('direction'); 1498 } else { 1499 return elem.currentStyle.direction; // IE5-8 1500 } 1501} 1502 1503 1504 1505;Drupal.locale = { 'pluralFormula': function($n) { return Number(($n!=1)); }, 'strings': { "The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.": "A kiválasztott %filename fájlt nem lehet feltölteni. Csak a következő kiterjesztésekkel rendelkező fájlok engedélyezettek: %extensions.", "An error occurred at @path.": "@path helyen hiba fordult elő.", "jQuery UI Tabs: Mismatching fragment identifier.": "\x3cem\x3ejQuery UI Tabs\x3c/em\x3e: Nem megfelelő a töredékazonosÃÂtó.", "jQuery UI Tabs: Not enough arguments to add tab.": "\x3cem\x3ejQuery UI Tabs\x3c/em\x3e: Nincs elég argumentum a fül hozzáadásához.", "Translate Text": "Szöveg fordÃÂtása", "An HTTP error @status occured.": "HTTP @status hiba fordult elő." } };;// $Id: block_edit.js,v 1.1.2.14 2010/02/17 18:24:24 psynaptic Exp $ 1506 1507Drupal.behaviors.block_edit = function (context) { 1508 if (Drupal.settings.block_edit.hover_links) { 1509 $('.node-edit-link, .block-edit-link').hide(); 1510 $('div.block, div.node').mouseover(function() { 1511 $(this).find('.node-edit-link, .block-edit-link').css('display', 'block'); 1512 }); 1513 1514 $('div.block, div.node').mouseout(function() { 1515 $(this).find('.node-edit-link, .block-edit-link').css('display', 'none'); 1516 }); 1517 }; 1518}; 1519;// $Id: dhtml_menu.js,v 1.18.2.10 2009/01/12 10:13:30 arancaytar Exp $ 1520 1521/** 1522 * @file dhtml_menu.js 1523 * The Javascript code for DHTML Menu 1524 */ 1525 1526Drupal.dhtmlMenu = {}; 1527 1528/** 1529 * Initialize the module's JS functions 1530 */ 1531Drupal.behaviors.dhtmlMenu = function() { 1532 // Do not run this function more than once. 1533 if (Drupal.dhtmlMenu.init) { 1534 return; 1535 } 1536 else { 1537 Drupal.dhtmlMenu.init = true; 1538 } 1539 1540 // Get the settings. 1541 var effects = Drupal.settings.dhtmlMenu; 1542 1543 $('.collapsed').removeClass('expanded'); 1544 1545 // Get cookie 1546 if (!effects.siblings) { 1547 var cookie = Drupal.dhtmlMenu.cookieGet(); 1548 for (var i in cookie) { 1549 // If the cookie was not applied to the HTML code yet, do so now. 1550 var li = $('#dhtml_menu-' + cookie[i]).parents('li:first'); 1551 if ($(li).hasClass('collapsed')) { 1552 Drupal.dhtmlMenu.toggleMenu(li); 1553 } 1554 } 1555 } 1556 1557 /* Add jQuery effects and listeners to all menu items. 1558 * The ~ (sibling) selector is unidirectional and selects 1559 * only the latter element, so we must use siblings() to get 1560 * back to the link element. 1561 */ 1562 $('ul.menu li.dhtml-menu:not(.leaf,.no-dhtml)').each(function() { 1563 var li = this; 1564 if (effects.clone) { 1565 var ul = $(li).find('ul:first'); 1566 if (ul.length) { 1567 $(li).find('a:first').clone().prependTo(ul).wrap('<li class="leaf fake-leaf"></li>'); 1568 } 1569 } 1570 1571 if (effects.doubleclick) { 1572 $(li).find('a:first').dblclick(function(e) { 1573 window.location = this.href; 1574 }); 1575 } 1576
1577 $(li).find('a:first').click(function(e) { 1578 Drupal.dhtmlMenu.toggleMenu($(li)); 1579 return false; 1580 }); 1581 }); 1582} 1583 1584/** 1585 * Toggles the menu's state between open and closed. 1586 * 1587 * @param li 1588 * Object. The <li> element that will be expanded or collapsed. 1589 */ 1590Drupal.dhtmlMenu.toggleMenu = function(li) { 1591 var effects = Drupal.settings.dhtmlMenu; 1592 1593 // If the menu is expanded, collapse it. 1594 if($(li).hasClass('expanded')) { 1595 if (effects.slide) { 1596 $(li).find('ul:first').animate({height: 'hide', opacity: 'hide'}, '1000'); 1597 } 1598 else $(li).find('ul:first').css('display', 'none'); 1599 1600 // If children are closed automatically, find and close them now. 1601 if (effects.children) { 1602 if (effects.slide) { 1603 $(li).find('li.expanded').find('ul:first').animate({height: 'hide', opacity: 'hide'}, '1000'); 1604 } 1605 else $(li).find('li.expanded').find('ul:first').css('display', 'none'); 1606 1607 $(li).find('li.expanded').removeClass('expanded').addClass('collapsed') 1608 } 1609 1610 $(li).removeClass('expanded').addClass('collapsed'); 1611 } 1612 1613 // Otherwise, expand it. 1614 else { 1615 if (effects.slide) { 1616 $(li).find('ul:first').animate({height: 'show', opacity: 'show'}, '1000'); 1617 } 1618 else $(li).find('ul:first').css('display', 'block'); 1619 $(li).removeClass('collapsed').addClass('expanded'); 1620 1621 // If the siblings effect is on, close all sibling menus. 1622 if (effects.siblings) { 1623 var id = $(li).find('a:first').attr('id'); 1624 1625 // Siblings are all open menus that are neither parents nor children of this menu. 1626 $(li).find('li').addClass('own-children-temp'); 1627 1628 // If the relativity option is on, select only the siblings that have the same parent 1629 if (effects.relativity) { 1630 var siblings = $(li).parent().find('li.expanded').not('.own-children-temp').not(':has(#' + id + ')'); 1631 } 1632 // Otherwise, select all menus of the same level 1633 else { 1634 var siblings = $('ul.menu li.expanded').not('.own-children-temp').not(':has(#' + id + ')'); 1635 } 1636 1637 // If children should not get closed automatically... 1638 if (!effects.children) { 1639 // Remove items that are currently hidden from view (do not close these). 1640 $('li.collapsed li.expanded').addClass('sibling-children-temp'); 1641 // Only close the top-most open sibling, not its children. 1642 $(siblings).find('li.expanded').addClass('sibling-children-temp'); 1643 siblings = $(siblings).not('.sibling-children-temp'); 1644 } 1645 1646 $('.own-children-temp, .sibling-children-temp').removeClass('own-children-temp').removeClass('sibling-children-temp'); 1647 1648 if (effects.slide) { 1649 $(siblings).find('ul:first').animate({height: 'hide', opacity: 'hide'}, '1000'); 1650 } 1651 else $(siblings).find('ul:first').css('display', 'none'); 1652 1653 $(siblings).removeClass('expanded').addClass('collapsed'); 1654 } 1655 } 1656 1657 // Save the current state of the menus in the cookie. 1658 Drupal.dhtmlMenu.cookieSet(); 1659} 1660 1661/** 1662 * Reads the dhtml_menu cookie. 1663 */ 1664Drupal.dhtmlMenu.cookieGet = function() { 1665 var c = /dhtml_menu=(.*?)(;|$)/.exec(document.cookie); 1666 if (c) { 1667 return c[1]; 1668 } 1669 else return ''; 1670} 1671 1672/** 1673 * Saves the dhtml_menu cooki. 1674 */ 1675Drupal.dhtmlMenu.cookieSet = function() { 1676 var expanded = new Array(); 1677 $('li.expanded').each(function() { 1678 expanded.push($(this).find('a:first').attr('id').substr(5)); 1679 }); 1680 document.cookie = 'dhtml_menu=' + expanded.join(',') + ';path=/'; 1681} 1682 1683;function extlinkAttach(context) { 1684 // Strip the host name down, removing subdomains or www. 1685 var host = window.location.host.replace(/^(([^\/]+?\.)*)([^\.]{4,})((\.[a-z]{1,4})*)$/, '$3$4'); 1686 var subdomain = window.location.host.replace(/^(([^\/]+?\.)*)([^\.]{4,})((\.[a-z]{1,4})*)$/, '$1'); 1687 1688 // Determine what subdomains are considered internal. 1689 if (Drupal.settings.extlink.extSubdomains) { 1690 var subdomains = "([^/]*)?"; 1691 } 1692 else if (subdomain == 'www.' || subdomain == '') { 1693 var subdomains = "(www\.)?"; 1694 } 1695 else { 1696 var subdomains = subdomain.replace(".", "\."); 1697 } 1698 1699 // Build regular expressions that define an internal link. 1700 var internal_link = new RegExp("^https?://" + subdomains + host, "i"); 1701 1702 // Extra internal link matching. 1703 var extInclude = false;
1704 if (Drupal.settings.extlink.extInclude) { 1705 extInclude = new RegExp(Drupal.settings.extlink.extInclude.replace(/\\/, '\\')); 1706 } 1707 1708 // Extra external link matching. 1709 var extExclude = false; 1710 if (Drupal.settings.extlink.extExclude) { 1711 extExclude = new RegExp(Drupal.settings.extlink.extExclude.replace(/\\/, '\\')); 1712 } 1713 1714 // Find all links which are NOT internal and begin with http (as opposed 1715 // to ftp://, javascript:, etc. other kinds of links. 1716 // When operating on the 'this' variable, the host has been appended to 1717 // all links by the browser, even local ones. 1718 // In jQuery 1.1 and higher, we'd use a filter method here, but it is not 1719 // available in jQuery 1.0 (Drupal 5 default). 1720 var external_links = new Array(); 1721 var mailto_links = new Array(); 1722 $("a", context).each(function(el) { 1723 try { 1724 var url = this.href.toLowerCase(); 1725 if (url.indexOf('http') == 0 && (!url.match(internal_link) || (extInclude && url.match(extInclude))) && !(extExclude && url.match(extExclude))) { 1726 external_links.push(this); 1727 } 1728 else if (url.indexOf('mailto:') == 0) { 1729 mailto_links.push(this); 1730 } 1731 } 1732 // IE7 throws errors often when dealing with irregular links, such as: 1733 // <a href="node/10"></a> Empty tags. 1734 // <a href="http://user:[email protected]">example</a> User:pass syntax. 1735 catch(error) { 1736 return false; 1737 } 1738 }); 1739 1740 if (Drupal.settings.extlink.extClass) { 1741 // Apply the "ext" class to all links not containing images. 1742 if (parseFloat($().jquery) < 1.2) { 1743 $(external_links).not('[img]').addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>'); }); 1744 } 1745 else { 1746 $(external_links).not($(external_links).find('img').parents('a')).addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>'); }); 1747 } 1748 } 1749 1750 if (Drupal.settings.extlink.mailtoClass) { 1751 // Apply the "mailto" class to all mailto links not containing images. 1752 if (parseFloat($().jquery) < 1.2) { 1753 $(mailto_links).not('[img]').addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>'); }); 1754 } 1755 else { 1756 $(mailto_links).not($(mailto_links).find('img').parents('a')).addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>'); }); 1757 } 1758 } 1759 1760 if (Drupal.settings.extlink.extTarget) { 1761 // Apply the target attribute to all links. 1762 $(external_links).attr('target', Drupal.settings.extlink.extTarget); 1763 } 1764 1765 if (Drupal.settings.extlink.extAlert) { 1766 // Add pop-up click-through dialog. 1767 $(external_links).click(function(e) { 1768 return confirm(Drupal.settings.extlink.extAlertText); 1769 }); 1770 } 1771 1772} 1773 1774Drupal.behaviors.extlink = function(context){ 1775 extlinkAttach(context); 1776};/* $Id: lightbox.js,v 1.5.2.6.2.120 2009/09/13 23:27:32 snpower Exp $ */ 1777 1778/** 1779 * jQuery Lightbox 1780 * @author 1781 * Stella Power, <http://drupal.org/user/66894> 1782 * 1783 * Based on Lightbox v2.03.3 by Lokesh Dhakar 1784 * <http://www.huddletogether.com/projects/lightbox2/> 1785 * Also partially based on the jQuery Lightbox by Warren Krewenki 1786 * <http://warren.mesozen.com> 1787 * 1788 * Permission has been granted to Mark Ashmead & other Drupal Lightbox2 module 1789 * maintainers to distribute this file via Drupal.org 1790 * Under GPL license. 1791 * 1792 * Slideshow, iframe and video functionality added by Stella Power. 1793 */ 1794 1795var Lightbox = { 1796 auto_modal : false, 1797 overlayOpacity : 0.8, // Controls transparency of shadow overlay. 1798 overlayColor : '000', // Controls colour of shadow overlay. 1799 disableCloseClick : true, 1800 // Controls the order of the lightbox resizing animation sequence. 1801 resizeSequence: 0, // 0: simultaneous, 1: width then height, 2: height then width. 1802 resizeSpeed: 'normal', // Controls the speed of the lightbox resizing animation. 1803 fadeInSpeed: 'normal', // Controls the speed of the image appearance. 1804 slideDownSpeed: 'slow', // Controls the speed of the image details appearance. 1805 minWidth: 240, 1806 borderSize : 10, 1807 boxColor : 'fff', 1808 fontColor : '000', 1809 topPosition : '', 1810 infoHeight: 20, 1811 alternative_layout : false, 1812 imageArray : [], 1813 imageNum : null, 1814 total : 0, 1815 activeImage : null, 1816 inprogress : false, 1817 disableResize : false, 1818 disableZoom : false, 1819 isZoomedIn : false, 1820 rtl : false, 1821 loopItems : false, 1822 keysClose : ['c', 'x', 27], 1823 keysPrevious : ['p', 37], 1824 keysNext : ['n', 39], 1825 keysZoom : ['z'], 1826 keysPlayPause : [32], 1827 1828 // Slideshow options. 1829 slideInterval : 5000, // In milliseconds. 1830 showPlayPause : true, 1831 autoStart : true, 1832 autoExit : true, 1833 pauseOnNextClick : false, // True to pause the slideshow when the "Next" button is clicked. 1834 pauseOnPrevClick : true, // True to pause the slideshow when the "Prev" button is clicked. 1835 slideIdArray : [], 1836 slideIdCount : 0, 1837 isSlideshow : false, 1838 isPaused : false, 1839 loopSlides : false, 1840 1841 // Iframe options. 1842 isLightframe : false, 1843 iframe_width : 600, 1844 iframe_height : 400, 1845 iframe_border : 1, 1846 1847 // Video and modal options. 1848 enableVideo : false, 1849 flvPlayer : '/flvplayer.swf', 1850 flvFlashvars : '', 1851 isModal : false, 1852 isVideo : false, 1853 videoId : false, 1854 modalWidth : 400,
1855 modalHeight : 400, 1856 modalHTML : null, 1857 1858 1859 // initialize() 1860 // Constructor runs on completion of the DOM loading. 1861 // The function inserts html at the bottom of the page which is used 1862 // to display the shadow overlay and the image container. 1863 initialize: function() { 1864 1865 var s = Drupal.settings.lightbox2; 1866 Lightbox.overlayOpacity = s.overlay_opacity; 1867 Lightbox.overlayColor = s.overlay_color; 1868 Lightbox.disableCloseClick = s.disable_close_click; 1869 Lightbox.resizeSequence = s.resize_sequence; 1870 Lightbox.resizeSpeed = s.resize_speed; 1871 Lightbox.fadeInSpeed = s.fade_in_speed; 1872 Lightbox.slideDownSpeed = s.slide_down_speed; 1873 Lightbox.borderSize = s.border_size; 1874 Lightbox.boxColor = s.box_color; 1875 Lightbox.fontColor = s.font_color; 1876 Lightbox.topPosition = s.top_position; 1877 Lightbox.rtl = s.rtl; 1878 Lightbox.loopItems = s.loop_items; 1879 Lightbox.keysClose = s.keys_close.split(" "); 1880 Lightbox.keysPrevious = s.keys_previous.split(" "); 1881 Lightbox.keysNext = s.keys_next.split(" "); 1882 Lightbox.keysZoom = s.keys_zoom.split(" "); 1883 Lightbox.keysPlayPause = s.keys_play_pause.split(" "); 1884 Lightbox.disableResize = s.disable_resize; 1885 Lightbox.disableZoom = s.disable_zoom; 1886 Lightbox.slideInterval = s.slideshow_interval; 1887 Lightbox.showPlayPause = s.show_play_pause; 1888 Lightbox.autoStart = s.slideshow_automatic_start; 1889 Lightbox.autoExit = s.slideshow_automatic_exit; 1890 Lightbox.pauseOnNextClick = s.pause_on_next_click; 1891 Lightbox.pauseOnPrevClick = s.pause_on_previous_click; 1892 Lightbox.loopSlides = s.loop_slides; 1893 Lightbox.alternative_layout = s.use_alt_layout; 1894 Lightbox.iframe_width = s.iframe_width; 1895 Lightbox.iframe_height = s.iframe_height; 1896 Lightbox.iframe_border = s.iframe_border; 1897 Lightbox.enableVideo = s.enable_video; 1898 if (s.enable_video) { 1899 Lightbox.flvPlayer = s.flvPlayer; 1900 Lightbox.flvFlashvars = s.flvFlashvars; 1901 } 1902 1903 // Make the lightbox divs. 1904 var output = '<div id="overlay" style="display: none;"></div>\ 1905 <div id="lightbox" style="display: none;">\ 1906 <div id="outerImageContainer"></div>\ 1907 <div id="imageDataContainer" class="clearfix">\ 1908 <div id="imageData"></div>\ 1909 </div>\ 1910 </div>'; 1911 var loading = '<div id="loading"><a href="#" id="loadingLink"></a></div>'; 1912 var modal = '<div id="modalContainer" style="display: none;"></div>'; 1913 var frame = '<div id="frameContainer" style="display: none;"></div>'; 1914 var imageContainer = '<div id="imageContainer" style="display: none;"></div>'; 1915 var details = '<div id="imageDetails"></div>'; 1916 var bottomNav = '<div id="bottomNav"></div>'; 1917 var image = '<img id="lightboxImage" />'; 1918 var hoverNav = '<div id="hoverNav"><a id="prevLink" href="#"></a><a id="nextLink" href="#"></a></div>'; 1919 var frameNav = '<div id="frameHoverNav"><a id="framePrevLink" href="#"></a><a id="frameNextLink" href="#"></a></div>'; 1920 var caption = '<span id="caption"></span>'; 1921 var numberDisplay = '<span id="numberDisplay"></span>'; 1922 var close = '<a id="bottomNavClose" href="#"></a>'; 1923 var zoom = '<a id="bottomNavZoom" href="#"></a>'; 1924 var zoomOut = '<a id="bottomNavZoomOut" href="#"></a>'; 1925 var pause = '<a id="lightshowPause" href="#" style="display: none;"></a>'; 1926 var play = '<a id="lightshowPlay" href="#" style="display: none;"></a>'; 1927 1928 $("body").append(output); 1929 $('#outerImageContainer').append(modal + frame + imageContainer + loading); 1930 if (!s.use_alt_layout) { 1931 $('#imageContainer').append(image + hoverNav); 1932 $('#imageData').append(frameNav + details + bottomNav); 1933 $('#imageDetails').append(caption + numberDisplay); 1934 $('#bottomNav').append(close + zoom + zoomOut + pause + play); 1935 } 1936 else { 1937 $('#outerImageContainer').append(bottomNav); 1938 $('#imageContainer').append(image); 1939 $('#bottomNav').append(close + zoom + zoomOut); 1940 $('#imageData').append(hoverNav + details); 1941 $('#imageDetails').append(caption + numberDisplay + pause + play); 1942 } 1943 1944 // Setup onclick handlers. 1945 if (Lightbox.disableCloseClick) { 1946 $('#overlay').click(function() { Lightbox.end(); return false; } ).hide(); 1947 } 1948 $('#loadingLink, #bottomNavClose').click(function() { Lightbox.end('forceClose'); return false; } ); 1949 $('#prevLink, #framePrevLink').click(function() { Lightbox.changeData(Lightbox.activeImage - 1); return false; } ); 1950 $('#nextLink, #frameNextLink').click(function() { Lightbox.changeData(Lightbox.activeImage + 1); return false; } ); 1951 $('#bottomNavZoom').click(function() { Lightbox.changeData(Lightbox.activeImage, true); return false; } ); 1952 $('#bottomNavZoomOut').click(function() { Lightbox.changeData(Lightbox.activeImage, false); return false; } ); 1953 $('#lightshowPause').click(function() { Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); return false; } ); 1954 $('#lightshowPlay').click(function() { Lightbox.togglePlayPause("lightshowPlay", "lightshowPause"); return false; } ); 1955 1956 // Fix positioning. 1957 $('#prevLink, #nextLink, #framePrevLink, #frameNextLink').css({ 'paddingTop': Lightbox.borderSize + 'px'}); 1958 $('#imageContainer, #frameContainer, #modalContainer').css({ 'padding': Lightbox.borderSize + 'px'}); 1959 $('#outerImageContainer, #imageDataContainer, #bottomNavClose').css({'backgroundColor': '#' + Lightbox.boxColor, 'color': '#'+Lightbox.fontColor}); 1960 if (Lightbox.alternative_layout) { 1961 $('#bottomNavZoom, #bottomNavZoomOut').css({'bottom': Lightbox.borderSize + 'px', 'right': Lightbox.borderSize + 'px'}); 1962 } 1963 else if (Lightbox.rtl == 1 && $.browser.msie) { 1964 $('#bottomNavZoom, #bottomNavZoomOut').css({'left': '0px'}); 1965 } 1966 1967 // Force navigation links to always be displayed 1968 if (s.force_show_nav) { 1969 $('#prevLink, #nextLink').addClass("force_show_nav"); 1970 } 1971 1972 }, 1973 1974 // initList() 1975 // Loops through anchor tags looking for 'lightbox', 'lightshow' and 1976 // 'lightframe', etc, references and applies onclick events to appropriate 1977 // links. You can rerun after dynamically adding images w/ajax. 1978 initList : function(context) { 1979 1980 if (context == undefined || context == null) { 1981 context = document; 1982 } 1983 1984 // Attach lightbox to any links with rel 'lightbox', 'lightshow' or 1985 // 'lightframe', etc. 1986 $("a[rel^='lightbox']:not(.lightbox-processed), area[rel^='lightbox']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { 1987 if (Lightbox.disableCloseClick) { 1988 $('#lightbox').unbind('click'); 1989 $('#lightbox').click(function() { Lightbox.end('forceClose'); } ); 1990 } 1991 Lightbox.start(this, false, false, false, false); 1992 if (e.preventDefault) { e.preventDefault(); } 1993 return false;
1994 }); 1995 $("a[rel^='lightshow']:not(.lightbox-processed), area[rel^='lightshow']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { 1996 if (Lightbox.disableCloseClick) { 1997 $('#lightbox').unbind('click'); 1998 $('#lightbox').click(function() { Lightbox.end('forceClose'); } ); 1999 } 2000 Lightbox.start(this, true, false, false, false); 2001 if (e.preventDefault) { e.preventDefault(); } 2002 return false; 2003 }); 2004 $("a[rel^='lightframe']:not(.lightbox-processed), area[rel^='lightframe']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { 2005 if (Lightbox.disableCloseClick) { 2006 $('#lightbox').unbind('click'); 2007 $('#lightbox').click(function() { Lightbox.end('forceClose'); } ); 2008 } 2009 Lightbox.start(this, false, true, false, false); 2010 if (e.preventDefault) { e.preventDefault(); } 2011 return false; 2012 }); 2013 if (Lightbox.enableVideo) { 2014 $("a[rel^='lightvideo']:not(.lightbox-processed), area[rel^='lightvideo']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { 2015 if (Lightbox.disableCloseClick) { 2016 $('#lightbox').unbind('click'); 2017 $('#lightbox').click(function() { Lightbox.end('forceClose'); } ); 2018 } 2019 Lightbox.start(this, false, false, true, false); 2020 if (e.preventDefault) { e.preventDefault(); } 2021 return false; 2022 }); 2023 } 2024 $("a[rel^='lightmodal']:not(.lightbox-processed), area[rel^='lightmodal']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { 2025 $('#lightbox').unbind('click'); 2026 Lightbox.start(this, false, false, false, true); 2027 if (e.preventDefault) { e.preventDefault(); } 2028 return false; 2029 }); 2030 $("#lightboxAutoModal:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) { 2031 Lightbox.auto_modal = true; 2032 $('#lightbox').unbind('click'); 2033 Lightbox.start(this, false, false, false, true); 2034 if (e.preventDefault) { e.preventDefault(); } 2035 return false; 2036 }); 2037 }, 2038 2039 // start() 2040 // Display overlay and lightbox. If image is part of a set, add siblings to 2041 // imageArray. 2042 start: function(imageLink, slideshow, lightframe, lightvideo, lightmodal) { 2043 2044 Lightbox.isPaused = !Lightbox.autoStart; 2045 2046 // Replaces hideSelectBoxes() and hideFlash() calls in original lightbox2. 2047 Lightbox.toggleSelectsFlash('hide'); 2048 2049 // Stretch overlay to fill page and fade in. 2050 var arrayPageSize = Lightbox.getPageSize(); 2051 $("#overlay").hide().css({ 2052 'width': '100%', 2053 'zIndex': '10090', 2054 'height': arrayPageSize[1] + 'px', 2055 'backgroundColor' : '#' + Lightbox.overlayColor 2056 }); 2057 // Detect OS X FF2 opacity + flash issue. 2058 if (lightvideo && this.detectMacFF2()) { 2059 $("#overlay").removeClass("overlay_default"); 2060 $("#overlay").addClass("overlay_macff2"); 2061 $("#overlay").css({'opacity' : null}); 2062 } 2063 else { 2064 $("#overlay").removeClass("overlay_macff2"); 2065 $("#overlay").addClass("overlay_default"); 2066 $("#overlay").css({'opacity' : Lightbox.overlayOpacity}); 2067 } 2068 $("#overlay").fadeIn(Lightbox.fadeInSpeed); 2069 2070 2071 Lightbox.isSlideshow = slideshow; 2072 Lightbox.isLightframe = lightframe; 2073 Lightbox.isVideo = lightvideo; 2074 Lightbox.isModal = lightmodal; 2075 Lightbox.imageArray = []; 2076 Lightbox.imageNum = 0; 2077 2078 var anchors = $(imageLink.tagName); 2079 var anchor = null; 2080 var rel_parts = Lightbox.parseRel(imageLink); 2081 var rel = rel_parts["rel"]; 2082 var rel_group = rel_parts["group"]; 2083 var title = (rel_parts["title"] ? rel_parts["title"] : imageLink.title); 2084 var rel_style = null; 2085 var i = 0; 2086 2087 2088 // Set the title for image alternative text. 2089 var alt = imageLink.title; 2090 if (!alt) { 2091 var img = $(imageLink).find("img"); 2092 if (img && $(img).attr("alt")) { 2093 alt = $(img).attr("alt"); 2094 } 2095 else { 2096 alt = title; 2097 } 2098 } 2099 2100 if ($(imageLink).attr('id') == 'lightboxAutoModal') { 2101 rel_style = rel_parts["style"]; 2102 Lightbox.imageArray.push(['#lightboxAutoModal > *', title, alt, rel_style, 1]); 2103 } 2104 else { 2105 // Handle lightbox images with no grouping. 2106 if ((rel == 'lightbox' || rel == 'lightshow') && !rel_group) { 2107 Lightbox.imageArray.push([imageLink.href, title, alt]); 2108 } 2109 2110 // Handle other items with no grouping. 2111 else if (!rel_group) { 2112 rel_style = rel_parts["style"]; 2113 Lightbox.imageArray.push([imageLink.href, title, alt, rel_style]); 2114 } 2115 2116 // Handle grouped items. 2117 else { 2118 2119 // Loop through anchors and add them to imageArray. 2120 for (i = 0; i < anchors.length; i++) { 2121 anchor = anchors[i]; 2122 if (anchor.href && typeof(anchor.href) == "string" && $(anchor).attr('rel')) { 2123 var rel_data = Lightbox.parseRel(anchor); 2124 var anchor_title = (rel_data["title"] ? rel_data["title"] : anchor.title); 2125 img_alt = anchor.title; 2126 if (!img_alt) { 2127 var anchor_img = $(anchor).find("img"); 2128 if (anchor_img && $(anchor_img).attr("alt")) { 2129 img_alt = $(anchor_img).attr("alt"); 2130 } 2131 else { 2132 img_alt = title; 2133 } 2134 } 2135 if (rel_data["rel"] == rel) { 2136 if (rel_data["group"] == rel_group) { 2137 if (Lightbox.isLightframe || Lightbox.isModal) { 2138 rel_style = rel_data["style"]; 2139 } 2140 Lightbox.imageArray.push([anchor.href, anchor_title, img_alt, rel_style]); 2141 } 2142 } 2143 } 2144 } 2145 2146 // Remove duplicates. 2147 for (i = 0; i < Lightbox.imageArray.length; i++) { 2148 for (j = Lightbox.imageArray.length-1; j > i; j--) { 2149 if (Lightbox.imageArray[i][0] == Lightbox.imageArray[j][0]) { 2150 Lightbox.imageArray.splice(j,1); 2151 } 2152 } 2153 } 2154 while (Lightbox.imageArray[Lightbox.imageNum][0] != imageLink.href) { 2155 Lightbox.imageNum++; 2156 } 2157 } 2158 } 2159 2160 if (Lightbox.isSlideshow && Lightbox.showPlayPause && Lightbox.isPaused) { 2161 $('#lightshowPlay').show(); 2162 $('#lightshowPause').hide(); 2163 } 2164 2165 // Calculate top and left offset for the lightbox. 2166 var arrayPageScroll = Lightbox.getPageScroll(); 2167 var lightboxTop = arrayPageScroll[1] + (Lightbox.topPosition == '' ? (arrayPageSize[3] / 10) : Lightbox.topPosition) * 1; 2168 var lightboxLeft = arrayPageScroll[0]; 2169 $('#frameContainer, #modalContainer, #lightboxImage').hide();
2170 $('#hoverNav, #prevLink, #nextLink, #frameHoverNav, #framePrevLink, #frameNextLink').hide(); 2171 $('#imageDataContainer, #numberDisplay, #bottomNavZoom, #bottomNavZoomOut').hide(); 2172 $('#outerImageContainer').css({'width': '250px', 'height': '250px'}); 2173 $('#lightbox').css({ 2174 'zIndex': '10500', 2175 'top': lightboxTop + 'px', 2176 'left': lightboxLeft + 'px' 2177 }).show(); 2178 2179 Lightbox.total = Lightbox.imageArray.length; 2180 Lightbox.changeData(Lightbox.imageNum); 2181 }, 2182 2183 // changeData() 2184 // Hide most elements and preload image in preparation for resizing image 2185 // container. 2186 changeData: function(imageNum, zoomIn) { 2187 2188 if (Lightbox.inprogress === false) { 2189 if (Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) { 2190 if (imageNum >= Lightbox.total) imageNum = 0; 2191 if (imageNum < 0) imageNum = Lightbox.total - 1; 2192 } 2193 2194 if (Lightbox.isSlideshow) { 2195 for (var i = 0; i < Lightbox.slideIdCount; i++) { 2196 window.clearTimeout(Lightbox.slideIdArray[i]); 2197 } 2198 } 2199 Lightbox.inprogress = true; 2200 Lightbox.activeImage = imageNum; 2201 2202 if (Lightbox.disableResize && !Lightbox.isSlideshow) { 2203 zoomIn = true; 2204 } 2205 Lightbox.isZoomedIn = zoomIn; 2206 2207 2208 // Hide elements during transition. 2209 $('#loading').css({'zIndex': '10500'}).show(); 2210 if (!Lightbox.alternative_layout) { 2211 $('#imageContainer').hide(); 2212 } 2213 $('#frameContainer, #modalContainer, #lightboxImage').hide(); 2214 $('#hoverNav, #prevLink, #nextLink, #frameHoverNav, #framePrevLink, #frameNextLink').hide(); 2215 $('#imageDataContainer, #numberDisplay, #bottomNavZoom, #bottomNavZoomOut').hide(); 2216 2217 // Preload image content, but not iframe pages. 2218 if (!Lightbox.isLightframe && !Lightbox.isVideo && !Lightbox.isModal) { 2219 imgPreloader = new Image(); 2220 imgPreloader.onerror = function() { Lightbox.imgNodeLoadingError(this); }; 2221 2222 imgPreloader.onload = function() { 2223 var photo = document.getElementById('lightboxImage'); 2224 photo.src = Lightbox.imageArray[Lightbox.activeImage][0]; 2225 photo.alt = Lightbox.imageArray[Lightbox.activeImage][2]; 2226 2227 var imageWidth = imgPreloader.width; 2228 var imageHeight = imgPreloader.height; 2229 2230 // Resize code. 2231 var arrayPageSize = Lightbox.getPageSize(); 2232 var targ = { w:arrayPageSize[2] - (Lightbox.borderSize * 2), h:arrayPageSize[3] - (Lightbox.borderSize * 6) - (Lightbox.infoHeight * 4) - (arrayPageSize[3] / 10) }; 2233 var orig = { w:imgPreloader.width, h:imgPreloader.height }; 2234 2235 // Image is very large, so show a smaller version of the larger image 2236 // with zoom button. 2237 if (zoomIn !== true) { 2238 var ratio = 1.0; // Shrink image with the same aspect. 2239 $('#bottomNavZoomOut, #bottomNavZoom').hide(); 2240 if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w) { 2241 ratio = ((targ.w / orig.w) < (targ.h / orig.h)) ? targ.w / orig.w : targ.h / orig.h; 2242 if (!Lightbox.disableZoom && !Lightbox.isSlideshow) { 2243 $('#bottomNavZoom').css({'zIndex': '10500'}).show(); 2244 } 2245 } 2246 2247 imageWidth = Math.floor(orig.w * ratio); 2248 imageHeight = Math.floor(orig.h * ratio); 2249 } 2250 2251 else { 2252 $('#bottomNavZoom').hide();
2253 // Only display zoom out button if the image is zoomed in already. 2254 if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w) { 2255 // Only display zoom out button if not a slideshow and if the 2256 // buttons aren't disabled. 2257 if (!Lightbox.disableResize && Lightbox.isSlideshow === false && !Lightbox.disableZoom) { 2258 $('#bottomNavZoomOut').css({'zIndex': '10500'}).show(); 2259 } 2260 } 2261 } 2262 2263 photo.style.width = (imageWidth) + 'px'; 2264 photo.style.height = (imageHeight) + 'px'; 2265 Lightbox.resizeContainer(imageWidth, imageHeight); 2266 2267 // Clear onLoad, IE behaves irratically with animated gifs otherwise. 2268 imgPreloader.onload = function() {}; 2269 }; 2270 2271 imgPreloader.src = Lightbox.imageArray[Lightbox.activeImage][0]; 2272 imgPreloader.alt = Lightbox.imageArray[Lightbox.activeImage][2]; 2273 } 2274 2275 // Set up frame size, etc. 2276 else if (Lightbox.isLightframe) { 2277 var src = Lightbox.imageArray[Lightbox.activeImage][0]; 2278 $('#frameContainer').html('<iframe id="lightboxFrame" style="display: none;" src="'+src+'"></iframe>'); 2279 2280 // Enable swf support in Gecko browsers. 2281 if ($.browser.mozilla && src.indexOf('.swf') != -1) { 2282 setTimeout(function () { 2283 document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0]; 2284 }, 1000); 2285 } 2286 2287 if (!Lightbox.iframe_border) { 2288 $('#lightboxFrame').css({'border': 'none'}); 2289 $('#lightboxFrame').attr('frameborder', '0'); 2290 } 2291 var iframe = document.getElementById('lightboxFrame'); 2292 var iframeStyles = Lightbox.imageArray[Lightbox.activeImage][3]; 2293 iframe = Lightbox.setStyles(iframe, iframeStyles); 2294 Lightbox.resizeContainer(parseInt(iframe.width, 10), parseInt(iframe.height, 10)); 2295 } 2296 else if (Lightbox.isVideo || Lightbox.isModal) { 2297 var container = document.getElementById('modalContainer'); 2298 var modalStyles = Lightbox.imageArray[Lightbox.activeImage][3]; 2299 container = Lightbox.setStyles(container, modalStyles); 2300 if (Lightbox.isVideo) { 2301 Lightbox.modalHeight = parseInt(container.height, 10); 2302 Lightbox.modalWidth = parseInt(container.width, 10); 2303 Lightvideo.startVideo(Lightbox.imageArray[Lightbox.activeImage][0]); 2304 } 2305 Lightbox.resizeContainer(parseInt(container.width, 10), parseInt(container.height, 10)); 2306 } 2307 } 2308 }, 2309 2310 // imgNodeLoadingError() 2311 imgNodeLoadingError: function(image) { 2312 var s = Drupal.settings.lightbox2; 2313 var original_image = Lightbox.imageArray[Lightbox.activeImage][0]; 2314 if (s.display_image_size !== "") { 2315 original_image = original_image.replace(new RegExp("."+s.display_image_size), ""); 2316 } 2317 Lightbox.imageArray[Lightbox.activeImage][0] = original_image; 2318 image.onerror = function() { Lightbox.imgLoadingError(image); }; 2319 image.src = original_image; 2320 }, 2321 2322 // imgLoadingError() 2323 imgLoadingError: function(image) { 2324 var s = Drupal.settings.lightbox2; 2325 Lightbox.imageArray[Lightbox.activeImage][0] = s.default_image; 2326 image.src = s.default_image; 2327 }, 2328 2329 // resizeContainer() 2330 resizeContainer: function(imgWidth, imgHeight) { 2331 2332 imgWidth = (imgWidth < Lightbox.minWidth ? Lightbox.minWidth : imgWidth); 2333 2334 this.widthCurrent = $('#outerImageContainer').width(); 2335 this.heightCurrent = $('#outerImageContainer').height(); 2336 2337 var widthNew = (imgWidth + (Lightbox.borderSize * 2)); 2338 var heightNew = (imgHeight + (Lightbox.borderSize * 2)); 2339 2340 // Scalars based on change from old to new. 2341 this.xScale = ( widthNew / this.widthCurrent) * 100; 2342 this.yScale = ( heightNew / this.heightCurrent) * 100; 2343 2344 // Calculate size difference between new and old image, and resize if 2345 // necessary. 2346 wDiff = this.widthCurrent - widthNew; 2347 hDiff = this.heightCurrent - heightNew; 2348 2349 $('#modalContainer').css({'width': imgWidth, 'height': imgHeight}); 2350 // Detect animation sequence. 2351 if (Lightbox.resizeSequence) { 2352 var animate1 = {width: widthNew}; 2353 var animate2 = {height: heightNew}; 2354 if (Lightbox.resizeSequence == 2) { 2355 animate1 = {height: heightNew}; 2356 animate2 = {width: widthNew}; 2357 } 2358 $('#outerImageContainer').animate(animate1, Lightbox.resizeSpeed).animate(animate2, Lightbox.resizeSpeed, 'linear', function() { Lightbox.showData(); }); 2359 } 2360 // Simultaneous. 2361 else { 2362 $('#outerImageContainer').animate({'width': widthNew, 'height': heightNew}, Lightbox.resizeSpeed, 'linear', function() { Lightbox.showData(); }); 2363 } 2364 2365 // If new and old image are same size and no scaling transition is necessary 2366 // do a quick pause to prevent image flicker. 2367 if ((hDiff === 0) && (wDiff === 0)) { 2368 if ($.browser.msie) { 2369 Lightbox.pause(250); 2370 } 2371 else { 2372 Lightbox.pause(100); 2373 } 2374 } 2375 2376 var s = Drupal.settings.lightbox2; 2377 if (!s.use_alt_layout) { 2378 $('#prevLink, #nextLink').css({'height': imgHeight + 'px'}); 2379 } 2380 $('#imageDataContainer').css({'width': widthNew + 'px'}); 2381 }, 2382 2383 // showData() 2384 // Display image and begin preloading neighbors. 2385 showData: function() { 2386 $('#loading').hide(); 2387 2388 if (Lightbox.isLightframe || Lightbox.isVideo || Lightbox.isModal) { 2389 Lightbox.updateDetails(); 2390 if (Lightbox.isLightframe) { 2391 $('#frameContainer').show(); 2392 if ($.browser.safari) { 2393 $('#lightboxFrame').css({'zIndex': '10500'}).show(); 2394 } 2395 else { 2396 $('#lightboxFrame').css({'zIndex': '10500'}).fadeIn(Lightbox.fadeInSpeed); 2397 } 2398 } 2399 else { 2400 if (Lightbox.isVideo) { 2401 $("#modalContainer").html(Lightbox.modalHTML); 2402 $("#modalContainer").click(function() { return false; } ); 2403 } 2404 else { 2405 var src = unescape(Lightbox.imageArray[Lightbox.activeImage][0]); 2406 if (Lightbox.imageArray[Lightbox.activeImage][4]) { 2407 $(src).appendTo("#modalContainer"); 2408 } 2409 else { 2410 $("#modalContainer").load(src); 2411 } 2412 $('#modalContainer').unbind('click'); 2413 } 2414 $('#modalContainer').css({'zIndex': '10500'}).show(); 2415 } 2416 } 2417 2418 // Handle display of image content. 2419 else { 2420 $('#imageContainer').show(); 2421 if ($.browser.safari) { 2422 $('#lightboxImage').css({'zIndex': '10500'}).show(); 2423 } 2424 else { 2425 $('#lightboxImage').css({'zIndex': '10500'}).fadeIn(Lightbox.fadeInSpeed); 2426 } 2427 Lightbox.updateDetails(); 2428 this.preloadNeighborImages(); 2429 } 2430 Lightbox.inprogress = false;
2431 2432 // Slideshow specific stuff. 2433 if (Lightbox.isSlideshow) { 2434 if (!Lightbox.loopSlides && Lightbox.activeImage == (Lightbox.total - 1)) { 2435 if (Lightbox.autoExit) { 2436 Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function () {Lightbox.end('slideshow');}, Lightbox.slideInterval); 2437 } 2438 } 2439 else { 2440 if (!Lightbox.isPaused && Lightbox.total > 1) { 2441 Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function () {Lightbox.changeData(Lightbox.activeImage + 1);}, Lightbox.slideInterval); 2442 } 2443 } 2444 if (Lightbox.showPlayPause && Lightbox.total > 1 && !Lightbox.isPaused) { 2445 $('#lightshowPause').show(); 2446 $('#lightshowPlay').hide(); 2447 } 2448 else if (Lightbox.showPlayPause && Lightbox.total > 1) { 2449 $('#lightshowPause').hide(); 2450 $('#lightshowPlay').show(); 2451 } 2452 } 2453 2454 // Adjust the page overlay size. 2455 var arrayPageSize = Lightbox.getPageSize(); 2456 var arrayPageScroll = Lightbox.getPageScroll(); 2457 var pageHeight = arrayPageSize[1]; 2458 if (Lightbox.isZoomedIn && arrayPageSize[1] > arrayPageSize[3]) { 2459 var lightboxTop = (Lightbox.topPosition == '' ? (arrayPageSize[3] / 10) : Lightbox.topPosition) * 1; 2460 pageHeight = pageHeight + arrayPageScroll[1] + lightboxTop; 2461 } 2462 $('#overlay').css({'height': pageHeight + 'px', 'width': arrayPageSize[0] + 'px'}); 2463 2464 // Gecko browsers (e.g. Firefox, SeaMonkey, etc) don't handle pdfs as 2465 // expected. 2466 if ($.browser.mozilla) { 2467 if (Lightbox.imageArray[Lightbox.activeImage][0].indexOf(".pdf") != -1) { 2468 setTimeout(function () { 2469 document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0]; 2470 }, 1000); 2471 } 2472 } 2473 }, 2474 2475 // updateDetails() 2476 // Display caption, image number, and bottom nav. 2477 updateDetails: function() { 2478 2479 $("#imageDataContainer").hide(); 2480 2481 var caption = Lightbox.imageArray[Lightbox.activeImage][1]; 2482 if (!caption) caption = ' '; 2483 $('#caption').html(caption).css({'zIndex': '10500'}).show(); 2484 2485 // If image is part of set display 'Image x of x'. 2486 var s = Drupal.settings.lightbox2; 2487 var numberDisplay = null; 2488 if (Lightbox.total > 1) { 2489 var currentImage = Lightbox.activeImage + 1; 2490 if (!Lightbox.isLightframe && !Lightbox.isModal && !Lightbox.isVideo) { 2491 numberDisplay = s.image_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total); 2492 } 2493 else if (Lightbox.isVideo) { 2494 numberDisplay = s.video_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total); 2495 } 2496 else { 2497 numberDisplay = s.page_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total); 2498 }
2499 $('#numberDisplay').html(numberDisplay).css({'zIndex': '10500'}).show(); 2500 } 2501 2502 $("#imageDataContainer").hide().slideDown(Lightbox.slideDownSpeed, function() { 2503 $("#bottomNav").show(); 2504 }); 2505 if (Lightbox.rtl == 1) { 2506 $("#bottomNav").css({'float': 'left'}); 2507 } 2508 Lightbox.updateNav(); 2509 }, 2510 2511 // updateNav() 2512 // Display appropriate previous and next hover navigation. 2513 updateNav: function() { 2514 2515 $('#hoverNav').css({'zIndex': '10500'}).show(); 2516 var prevLink = '#prevLink'; 2517 var nextLink = '#nextLink'; 2518 2519 // Slideshow is separated as we need to show play / pause button. 2520 if (Lightbox.isSlideshow) { 2521 if ((Lightbox.total > 1 && Lightbox.loopSlides) || Lightbox.activeImage !== 0) { 2522 $(prevLink).css({'zIndex': '10500'}).show().click(function() { 2523 if (Lightbox.pauseOnPrevClick) { 2524 Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); 2525 } 2526 Lightbox.changeData(Lightbox.activeImage - 1); return false; 2527 }); 2528 } 2529 else { 2530 $(prevLink).hide(); 2531 } 2532 2533 // If not last image in set, display next image button. 2534 if ((Lightbox.total > 1 && Lightbox.loopSlides) || Lightbox.activeImage != (Lightbox.total - 1)) { 2535 $(nextLink).css({'zIndex': '10500'}).show().click(function() { 2536 if (Lightbox.pauseOnNextClick) { 2537 Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); 2538 } 2539 Lightbox.changeData(Lightbox.activeImage + 1); return false; 2540 }); 2541 } 2542 // Safari browsers need to have hide() called again. 2543 else { 2544 $(nextLink).hide(); 2545 } 2546 } 2547 2548 // All other types of content. 2549 else { 2550 2551 if ((Lightbox.isLightframe || Lightbox.isModal || Lightbox.isVideo) && !Lightbox.alternative_layout) { 2552 $('#frameHoverNav').css({'zIndex': '10500'}).show(); 2553 $('#hoverNav').css({'zIndex': '10500'}).hide(); 2554 prevLink = '#framePrevLink'; 2555 nextLink = '#frameNextLink'; 2556 } 2557 2558 // If not first image in set, display prev image button. 2559 if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage !== 0) { 2560 $(prevLink).css({'zIndex': '10500'}).show().click(function() { 2561 Lightbox.changeData(Lightbox.activeImage - 1); return false; 2562 }); 2563 } 2564 // Safari browsers need to have hide() called again. 2565 else { 2566 $(prevLink).hide(); 2567 } 2568 2569 // If not last image in set, display next image button. 2570 if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage != (Lightbox.total - 1)) { 2571 $(nextLink).css({'zIndex': '10500'}).show().click(function() { 2572 Lightbox.changeData(Lightbox.activeImage + 1); return false; 2573 }); 2574 } 2575 // Safari browsers need to have hide() called again. 2576 else { 2577 $(nextLink).hide(); 2578 } 2579 } 2580 2581 // Don't enable keyboard shortcuts so forms will work. 2582 if (!Lightbox.isModal) { 2583 this.enableKeyboardNav(); 2584 } 2585 }, 2586 2587 2588 // enableKeyboardNav() 2589 enableKeyboardNav: function() { 2590 $(document).bind("keydown", this.keyboardAction); 2591 }, 2592 2593 // disableKeyboardNav() 2594 disableKeyboardNav: function() { 2595 $(document).unbind("keydown", this.keyboardAction); 2596 }, 2597 2598 // keyboardAction() 2599 keyboardAction: function(e) { 2600 if (e === null) { // IE. 2601 keycode = event.keyCode; 2602 escapeKey = 27; 2603 } 2604 else { // Mozilla. 2605 keycode = e.keyCode; 2606 escapeKey = e.DOM_VK_ESCAPE; 2607 } 2608 2609 key = String.fromCharCode(keycode).toLowerCase(); 2610 2611 // Close lightbox. 2612 if (Lightbox.checkKey(Lightbox.keysClose, key, keycode)) { 2613 Lightbox.end('forceClose'); 2614 } 2615 // Display previous image (p, <-). 2616 else if (Lightbox.checkKey(Lightbox.keysPrevious, key, keycode)) { 2617 if ((Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) || Lightbox.activeImage !== 0) { 2618 Lightbox.changeData(Lightbox.activeImage - 1); 2619 } 2620 2621 } 2622 // Display next image (n, ->). 2623 else if (Lightbox.checkKey(Lightbox.keysNext, key, keycode)) { 2624 if ((Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) || Lightbox.activeImage != (Lightbox.total - 1)) { 2625 Lightbox.changeData(Lightbox.activeImage + 1); 2626 } 2627 } 2628 // Zoom in. 2629 else if (Lightbox.checkKey(Lightbox.keysZoom, key, keycode) && !Lightbox.disableResize && !Lightbox.disableZoom && !Lightbox.isSlideshow && !Lightbox.isLightframe) { 2630 if (Lightbox.isZoomedIn) { 2631 Lightbox.changeData(Lightbox.activeImage, false); 2632 } 2633 else if (!Lightbox.isZoomedIn) { 2634 Lightbox.changeData(Lightbox.activeImage, true); 2635 } 2636 return false;
2637 } 2638 // Toggle play / pause (space). 2639 else if (Lightbox.checkKey(Lightbox.keysPlayPause, key, keycode) && Lightbox.isSlideshow) { 2640 2641 if (Lightbox.isPaused) { 2642 Lightbox.togglePlayPause("lightshowPlay", "lightshowPause"); 2643 } 2644 else { 2645 Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); 2646 } 2647 return false; 2648 } 2649 }, 2650 2651 preloadNeighborImages: function() { 2652 2653 if ((Lightbox.total - 1) > Lightbox.activeImage) { 2654 preloadNextImage = new Image(); 2655 preloadNextImage.src = Lightbox.imageArray[Lightbox.activeImage + 1][0]; 2656 } 2657 if (Lightbox.activeImage > 0) { 2658 preloadPrevImage = new Image(); 2659 preloadPrevImage.src = Lightbox.imageArray[Lightbox.activeImage - 1][0]; 2660 } 2661 2662 }, 2663 2664 end: function(caller) { 2665 var closeClick = (caller == 'slideshow' ? false : true); 2666 if (Lightbox.isSlideshow && Lightbox.isPaused && !closeClick) { 2667 return; 2668 } 2669 // To prevent double clicks on navigation links. 2670 if (Lightbox.inprogress === true && caller != 'forceClose') { 2671 return; 2672 } 2673 Lightbox.disableKeyboardNav(); 2674 $('#lightbox').hide(); 2675 $("#overlay").fadeOut(); 2676 Lightbox.isPaused = true; 2677 Lightbox.inprogress = false; 2678 // Replaces calls to showSelectBoxes() and showFlash() in original 2679 // lightbox2. 2680 Lightbox.toggleSelectsFlash('visible'); 2681 if (Lightbox.isSlideshow) { 2682 for (var i = 0; i < Lightbox.slideIdCount; i++) { 2683 window.clearTimeout(Lightbox.slideIdArray[i]); 2684 } 2685 $('#lightshowPause, #lightshowPlay').hide(); 2686 } 2687 else if (Lightbox.isLightframe) { 2688 $('#frameContainer').empty().hide(); 2689 } 2690 else if (Lightbox.isVideo || Lightbox.isModal) { 2691 if (!Lightbox.auto_modal) { 2692 $('#modalContainer').hide().html(""); 2693 } 2694 Lightbox.auto_modal = false; 2695 } 2696 }, 2697 2698 2699 // getPageScroll() 2700 // Returns array with x,y page scroll values. 2701 // Core code from - quirksmode.com. 2702 getPageScroll : function() { 2703 2704 var xScroll, yScroll; 2705 2706 if (self.pageYOffset) { 2707 yScroll = self.pageYOffset; 2708 xScroll = self.pageXOffset; 2709 } 2710 else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict. 2711 yScroll = document.documentElement.scrollTop; 2712 xScroll = document.documentElement.scrollLeft; 2713 } 2714 else if (document.body) {// All other Explorers. 2715 yScroll = document.body.scrollTop; 2716 xScroll = document.body.scrollLeft; 2717 } 2718 2719 arrayPageScroll = [xScroll,yScroll]; 2720 return arrayPageScroll; 2721 }, 2722 2723 // getPageSize() 2724 // Returns array with page width, height and window width, height. 2725 // Core code from - quirksmode.com. 2726 // Edit for Firefox by pHaez. 2727 2728 getPageSize : function() { 2729 2730 var xScroll, yScroll; 2731 2732 if (window.innerHeight && window.scrollMaxY) { 2733 xScroll = window.innerWidth + window.scrollMaxX; 2734 yScroll = window.innerHeight + window.scrollMaxY; 2735 } 2736 else if (document.body.scrollHeight > document.body.offsetHeight) { // All but Explorer Mac. 2737 xScroll = document.body.scrollWidth; 2738 yScroll = document.body.scrollHeight; 2739 } 2740 else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari. 2741 xScroll = document.body.offsetWidth; 2742 yScroll = document.body.offsetHeight; 2743 } 2744 2745 var windowWidth, windowHeight; 2746 2747 if (self.innerHeight) { // All except Explorer. 2748 if (document.documentElement.clientWidth) { 2749 windowWidth = document.documentElement.clientWidth; 2750 } 2751 else { 2752 windowWidth = self.innerWidth; 2753 } 2754 windowHeight = self.innerHeight; 2755 } 2756 else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode. 2757 windowWidth = document.documentElement.clientWidth; 2758 windowHeight = document.documentElement.clientHeight; 2759 } 2760 else if (document.body) { // Other Explorers. 2761 windowWidth = document.body.clientWidth; 2762 windowHeight = document.body.clientHeight; 2763 } 2764 // For small pages with total height less than height of the viewport. 2765 if (yScroll < windowHeight) { 2766 pageHeight = windowHeight; 2767 } 2768 else { 2769 pageHeight = yScroll; 2770 } 2771 // For small pages with total width less than width of the viewport. 2772 if (xScroll < windowWidth) { 2773 pageWidth = xScroll; 2774 } 2775 else { 2776 pageWidth = windowWidth; 2777 } 2778 arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight); 2779 return arrayPageSize; 2780 }, 2781 2782 2783 // pause(numberMillis) 2784 pause : function(ms) { 2785 var date = new Date(); 2786 var curDate = null; 2787 do { curDate = new Date(); } 2788 while (curDate - date < ms); 2789 }, 2790 2791 2792 // toggleSelectsFlash() 2793 // Hide / unhide select lists and flash objects as they appear above the 2794 // lightbox in some browsers. 2795 toggleSelectsFlash: function (state) { 2796 if (state == 'visible') { 2797 $("select.lightbox_hidden, embed.lightbox_hidden, object.lightbox_hidden").show(); 2798 } 2799 else if (state == 'hide') { 2800 $("select:visible, embed:visible, object:visible").addClass("lightbox_hidden"); 2801 $("select.lightbox_hidden, embed.lightbox_hidden, object.lightbox_hidden").hide(); 2802 } 2803 }, 2804 2805 2806 // parseRel() 2807 parseRel: function (link) { 2808 var parts = []; 2809 parts["rel"] = parts["title"] = parts["group"] = parts["style"] = null; 2810 if (!$(link).attr('rel')) return parts; 2811 parts["rel"] = $(link).attr('rel').match(/\w+/)[0]; 2812 2813 if ($(link).attr('rel').match(/\[(.*)\]/)) { 2814 var info = $(link).attr('rel').match(/\[(.*?)\]/)[1].split('|'); 2815 parts["group"] = info[0]; 2816 parts["style"] = info[1]; 2817 } 2818 if ($(link).attr('rel').match(/\[.*\]\[(.*)\]/)) { 2819 parts["title"] = $(link).attr('rel').match(/\[.*\]\[(.*)\]/)[1]; 2820 } 2821 return parts; 2822 }, 2823 2824 // setStyles() 2825 setStyles: function(item, styles) { 2826 item.width = Lightbox.iframe_width; 2827 item.height = Lightbox.iframe_height; 2828 item.scrolling = "auto"; 2829 2830 if (!styles) return item; 2831 var stylesArray = styles.split(';'); 2832 for (var i = 0; i< stylesArray.length; i++) { 2833 if (stylesArray[i].indexOf('width:') >= 0) { 2834 var w = stylesArray[i].replace('width:', ''); 2835 item.width = jQuery.trim(w); 2836 } 2837 else if (stylesArray[i].indexOf('height:') >= 0) { 2838 var h = stylesArray[i].replace('height:', ''); 2839 item.height = jQuery.trim(h); 2840 } 2841 else if (stylesArray[i].indexOf('scrolling:') >= 0) { 2842 var scrolling = stylesArray[i].replace('scrolling:', ''); 2843 item.scrolling = jQuery.trim(scrolling); 2844 } 2845 else if (stylesArray[i].indexOf('overflow:') >= 0) { 2846 var overflow = stylesArray[i].replace('overflow:', ''); 2847 item.overflow = jQuery.trim(overflow); 2848 } 2849 } 2850 return item; 2851 }, 2852 2853 2854 // togglePlayPause() 2855 // Hide the pause / play button as appropriate. If pausing the slideshow also 2856 // clear the timers, otherwise move onto the next image. 2857 togglePlayPause: function(hideId, showId) { 2858 if (Lightbox.isSlideshow && hideId == "lightshowPause") { 2859 for (var i = 0; i < Lightbox.slideIdCount; i++) { 2860 window.clearTimeout(Lightbox.slideIdArray[i]); 2861 } 2862 } 2863 $('#' + hideId).hide(); 2864 $('#' + showId).show(); 2865 2866 if (hideId == "lightshowPlay") { 2867 Lightbox.isPaused = false;
2868 if (!Lightbox.loopSlides && Lightbox.activeImage == (Lightbox.total - 1)) { 2869 Lightbox.end(); 2870 } 2871 else if (Lightbox.total > 1) { 2872 Lightbox.changeData(Lightbox.activeImage + 1); 2873 } 2874 } 2875 else { 2876 Lightbox.isPaused = true; 2877 } 2878 }, 2879 2880 triggerLightbox: function (rel_type, rel_group) { 2881 if (rel_type.length) { 2882 if (rel_group && rel_group.length) { 2883 $("a[rel^='" + rel_type +"\[" + rel_group + "\]'], area[rel^='" + rel_type +"\[" + rel_group + "\]']").eq(0).trigger("click"); 2884 } 2885 else { 2886 $("a[rel^='" + rel_type +"'], area[rel^='" + rel_type +"']").eq(0).trigger("click"); 2887 } 2888 } 2889 }, 2890 2891 detectMacFF2: function() { 2892 var ua = navigator.userAgent.toLowerCase(); 2893 if (/firefox[\/\s](\d+\.\d+)/.test(ua)) { 2894 var ffversion = new Number(RegExp.$1); 2895 if (ffversion < 3 && ua.indexOf('mac') != -1) { 2896 return true; 2897 } 2898 } 2899 return false; 2900 }, 2901 2902 checkKey: function(keys, key, code) { 2903 return (jQuery.inArray(key, keys) != -1 || jQuery.inArray(String(code), keys) != -1); 2904 } 2905 2906 2907}; 2908 2909// Initialize the lightbox. 2910Drupal.behaviors.initLightbox = function (context) { 2911 $('body:not(.lightbox-processed)', context).addClass('lightbox-processed').each(function() { 2912 Lightbox.initialize(); 2913 return false; // Break the each loop. 2914 }); 2915 2916 // Attach lightbox to any links with lightbox rels. 2917 Lightbox.initList(context); 2918 $('#lightboxAutoModal', context).triggerHandler('click'); 2919}; 2920 2921;/* if we are being viewed on an iphone, find a tags that have iphonehref= 2922 on them and make that the main href */ 2923$.gcuiIPhoneLinks = function() { 2924 if (/iPhone/.test(navigator.userAgent)) { 2925 $('a[iphonehref]').each(function(){ 2926 var myNewHref = $(this).attr('iphonehref'); 2927 $(this).attr('href', myNewHref); 2928 }); 2929 } 2930} 2931 2932;(function($) { 2933 $.fn.gcuiSwfObjEmbed = function(aSwf,aSettings) { 2934 if (aSwf) { 2935 var myConfig = {}; 2936 $.each($.fn.gcuiSwfObjEmbed.defaults,function(k,v) { 2937 // NOTE: jQuery.extend() doesn't copy properties, 2938 // may work in jQuery 1.4, but we're on 1.3.2 2939 // copy default 2940 // http://jquery14.com/day-01/jquery-14 2941 var mySub = {}; 2942 for (var p in v) { 2943 mySub[p] = v[p]; 2944 } 2945 // on the copy overwrite the defaults with the specific settings 2946 for (var p in aSettings[k]) { 2947 mySub[p] = aSettings[k][p]; 2948 } 2949 // assign to myConfig 2950 myConfig[k] = mySub; 2951 }); 2952 this.each(function() { 2953 myConfig.attributes.id = $(this).attr('id'); 2954 if (myConfig.attributes.id == '') { 2955 gcui_log('ID of div missing, cannot embed video'); 2956 gcui_log(this); 2957 gcui_log($(this)); 2958 } 2959 swfobject.embedSWF( 2960 aSwf, myConfig.attributes.id, myConfig.config.width, 2961 myConfig.config.height, myConfig.config.requiredVersion, 2962 myConfig.config.alternativeSwf, 2963 myConfig.flashvars, myConfig.params, myConfig.attributes 2964 ); 2965 }); 2966 } else { 2967 console.log('aSwf not passed in'); 2968 } 2969 return this; 2970 }; 2971 $.fn.gcuiSwfObjEmbed.defaults = { 2972 config : { 2973 height : '360', 2974 width: '640', 2975 requiredVersion : '8.0.0', 2976 alternativeSwf : 'expressInstall.swf' 2977 }, 2978 params :{ 2979 quality: "high", 2980 scale: "noscale", 2981 wmode: "transparent", 2982 allowscriptaccess: "always", 2983 allowFullScreen: "true", 2984 bgcolor: "#000000" 2985 }, 2986 flashvars : { 2987 fullLocale:"en_US", 2988 locale:"en", 2989 cdnPath:"", 2990 localPath:"", 2991 trackerCode:"", 2992 configuration:"production", 2993 sharedAssetPath:"/assets/", 2994 siteAssetPath: "/assets/", 2995 sharedDataPath: "/en/sdata/", 2996 siteDataPath: "/data/", 2997 siteStylesPath: "/data/styles/", 2998 siteRootPath: "/", 2999 infoRequestUrl: "http://contact2.firechrome.org/inquiry.action", 3000 siteXML:"/site.xml", 3001 localePostfix: "", 3002 region: "US", 3003 autoplay: "true" 3004 }, 3005 attributes : {} 3006 }; 3007 3008 $.createElement = function(aEl,innerHtml,aClose,attrs) { 3009 var r = ['<', aEl,' ']; 3010 for(var k in attrs) { 3011 r.push(k); 3012 r.push('="'); 3013 r.push($.isArray(attrs[k]) ? attrs[k].join(' ') : attrs[k]); 3014 r.push('" '); 3015 3016 } 3017 r.push('>'); 3018 r.push(innerHtml); 3019 if(aClose) { 3020 r.push('</'); 3021 r.push(aEl); 3022 r.push('>'); 3023 } 3024 return r.join(''); 3025 }; 3026 3027 $.fn.gcuiSlideShow = function(aId,aImages,aSettings) { 3028 var config = {}; 3029 if (settings) $.extend(config, settings); 3030 this.each(function() {}); 3031 return this; 3032 }; 3033 3034 $.gcuiDataClone = function(aTarget,aSources) { 3035 // NOTE: jQuery.extend() doesn't copy properties we're on 1.3.2 3036 // http://jquery14.com/day-01/jquery-14 3037 var mySources = $.makeArray(aSources) 3038 $.each(mySources,function(i,v) { 3039 for (var p in v) { 3040 aTarget[p] = v[p]; 3041 } 3042 }); 3043 return aTarget; 3044 }; 3045 $.intRange = function(aFrom,aTo,aMin,aMax,aDir) { 3046 var myF = parseInt(aFrom); 3047 var myT = parseInt(aTo); 3048 var myMin = parseInt(aMin); 3049 var myMax = parseInt(aMax); 3050 if(myF==myT) return []; 3051 var r = [myF]; 3052 var myInc = aDir==null?myF < myT:aDir; 3053 var i = myF; 3054 while(i!=myT) { 3055 r.push(i = $.increment(i,myMin,myMax,myInc)); 3056 //if(i) {break;}//Avoid infinite loops 3057 } 3058 return r; 3059 }; 3060 $.increment = function(aFrom,aMin,aMax,aDir) { 3061 var i = aDir ? ++aFrom : --aFrom; 3062 if(i > aMax) return aMin; 3063 if(i < aMin) return aMax; 3064 return i; 3065 }; 3066 $.getAt = function(aObj,aParams) { 3067 var r = null; 3068 $.each(aParams,function(){ 3069 if(aObj[this]) r=aObj[this]; 3070 }); 3071 return r; 3072 }; 3073 3074 $.fn.customFadeIn = function(speed, callback) { 3075 return $(this).fadeIn($.support.opacity ? speed : 1,callback); 3076 }; 3077 $.fn.customFadeOut = function(speed, callback) {
3078 return $(this).fadeOut($.support.opacity ? speed : 1,callback); 3079 }; 3080 3081 $.getHost = function() { 3082 var h = new String(document.location); 3083 return h.replace(/http:\/\/([^\/]*)\/.*/,'$1'); 3084 }; 3085 3086 /** 3087 * Find out if certain support exists 3088 */ 3089 $.gcuiSupports = function(features) { 3090 var ret = true; 3091 if (features.canvas) { 3092 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { 3093 return false; 3094 } 3095 } 3096 if (features.basic_html5) { 3097 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { 3098 return false; 3099 } 3100 if (/Version\/3\.[0-9. ]+ Safari\//.test(navigator.userAgent)) { 3101 return false; 3102 } 3103 if (/Version\/3\.[0-9. ]+ Mobile\//.test(navigator.userAgent)) { 3104 return false; 3105 } 3106 if (/Firefox\/[1-2]\.[0-9]/.test(navigator.userAgent)) { 3107 return false; 3108 } 3109 if (/Firefox\/3\.0/.test(navigator.userAgent)) { 3110 return false; 3111 } 3112 if (/iPad/.test(navigator.userAgent)) { 3113 return false; 3114 } 3115 if (/iPhone/.test(navigator.userAgent)) { 3116 return false; 3117 } 3118 /*if (/Version\/4\.[0-9. ]+ Mobile\//.test(navigator.userAgent)) { 3119 return false; 3120 } */ 3121 } 3122 return ret; 3123 }; 3124 $.gcuiSupportsNativeCanvasText = function(supports) { 3125 var ret = true; 3126 if (supports.supportsCanvasText) { 3127 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { 3128 return false; 3129 } 3130 if (/Version\/3\.[0-9. ]+ Safari\//.test(navigator.userAgent)) { 3131 return false; 3132 } 3133 if (/Version\/3\.[0-9. ]+ Mobile\//.test(navigator.userAgent)) { 3134 return false; 3135 } 3136 if (/Version\/4\.[0-9. ]+ Mobile\//.test(navigator.userAgent)) { 3137 return false; 3138 } 3139 } 3140 return ret; 3141 } 3142 3143 3144})(jQuery); 3145 3146if(!console) { 3147 var console = {log : function(){}}; 3148} 3149 3150if (typeof $.fn.delay != 'function') { 3151 $.fn.delay = function(time, callback){ 3152 jQuery.fx.step.delay = function(){}; 3153 return this.animate({delay:1}, time, callback); 3154 } 3155} 3156 3157 3158 3159 3160;/** 3161 * jquery.gcui-html5.js - Gold Common UI HTML5/ish functionality. 3162 */ 3163 3164(function($) { 3165 /** 3166 * Gets or sets the "mobile" flag, indicating if we are on a mobile device, 3167 * and thus need to change the way our hover/click events work to make sense 3168 * on touch devices. 3169 */ 3170 $.gcuiMobile = function(aMobileMode) { 3171 3172 /* 3173 3174 // if they didn't provide a value 3175 if (typeof aMobileMode == 'undefined' || typeof aMobileMode == null) { 3176 return $.gcuiIsMobile; 3177 } 3178 3179 if (aMobileMode == 'auto') { 3180 // do detection 3181 aMobileMode = true; 3182 aMobileMode = false; 3183 } 3184 3185 */ 3186 3187 // TODO: add user agent detection 3188 3189 return true; 3190 3191 } 3192 3193 /** 3194 * Create a "Canvas Button". Call this on a <canvas> element to give it 3195 * the appropriate states, drawing function, etc. 3196 */ 3197 $.fn.gcuiCanvasButton = function(aDrawFunc) { 3198 this.data('__drawFunc', aDrawFunc); 3199 return this.each(function() { 3200 if ($.gcuiSupports({basic_html5:true})) { 3201 $(this).addClass('gcuiAnimated'); 3202 3203 // create animator div 3204 var myDiv = $("<div class='dfwHeaderButtonAnimator'></div>").appendTo("body"); 3205 myDiv.css("opacity", 0); 3206 myDiv.css("display", "none"); 3207 $(this).data('__animatorDiv', myDiv); 3208 if (!document.gcuiAnimationInterval) { 3209 document.gcuiAnimationInterval = setInterval(function() { 3210 $(".gcuiAnimated").gcuiDrawCanvas(); 3211 },25); 3212 } 3213 } else { 3214 $(this).addClass('gcuiAlt'); 3215 } 3216 }); 3217 }; 3218 3219 /** 3220 * Begin animating "in" (move toward the "over" state). 3221 * @param aDuration - how many milliseconds should it take 3222 * @param aEasing - the easing function to use - see jQuery.animate() 3223 * and if undefined, set to default of 200 milliseconds and ease of "swing" 3224 */ 3225 $.fn.gcuiAnimateIn = function(aDuration, aEasing) { 3226 return this.each(function() { 3227 if ($.gcuiSupports({basic_html5:true})) { 3228 if (aDuration == "undefined" || aDuration == null) { aDuration = 200 }; 3229 if (aEasing == "undefined" || aEasing == null) { aEasing = "swing" }; 3230 3231 3232 var myDiv = $(this).data('__animatorDiv'); 3233 myDiv.stop().animate({"opacity":1},aDuration,aEasing,null); 3234 }
3235 if ($.gcuiSupportsNativeCanvasText({supportsCanvasText:true})) { 3236 3237 } 3238 }); 3239 }; 3240 3241 /** 3242 * Begin animating "out" (move toward the default state - away from "over"). 3243 * @param aDuration - how many milliseconds should it take 3244 * @param aEasing - the easing function to use - see jQuery.animate() 3245 * and if undefined, set to default of 200 milliseconds and ease of "swing" 3246 */ 3247 $.fn.gcuiAnimateOut = function(aDuration, aEasing) { 3248 return this.each(function() { 3249 if ($.gcuiSupports({basic_html5:true})) { 3250 if (aDuration == "undefined" || aDuration == null) { aDuration = 200 }; 3251 if (aEasing == "undefined" || aEasing == null) { aEasing = "swing" }; 3252 3253 var myDiv = $(this).data('__animatorDiv'); 3254 myDiv.stop().animate({"opacity":0},aDuration,aEasing,null); 3255 } 3256 }); 3257 }; 3258 3259 /** 3260 * Begin animating "in" (move toward the "over" state). 3261 * @param aDuration - how many milliseconds should it take 3262 * @param aEasing - the easing function to use - see jQuery.animate() 3263 * and if undefined, set to default of 200 milliseconds and ease of "swing" 3264 */ 3265 3266 $.fn.gcuiFlyoutAnimateIn = function(aDuration, aEasing, aImageDim) { 3267 return this.each(function() { 3268 if (swfobject.hasFlashPlayerVersion('9.0.115.0') == false) { 3269 $("#gcui-header-player-wrapper #main_player").gcuiStopVideo(aImageDim); 3270 } 3271 if (aDuration == "undefined" || aDuration == null) { aDuration = 200 }; 3272 if (aEasing == "undefined" || aEasing == null) { aEasing = "swing" }; 3273 var myAltFlyoutArray = $(this).attr("id").split('-'); 3274 var itemClicked = myAltFlyoutArray[0]; 3275 3276 var myButton = $(this).attr("id"); 3277 //alert("myButton is "+$(this).attr("id")); 3278 var myButtonsChildren = $(this).children(); 3279 //alert("myButtonsChildren is "+myButtonsChildren); 3280 3281 //$("#gcui-header-player-wrapper #main_player").gcuiStopVideo(aImageDim);
3282 var myDeactivatedFlyouts = $($(this).data('__groupSelector') + ':not(#'+$(this).attr("id")+')'); 3283 $(myDeactivatedFlyouts).each(function() { 3284 var myAltFlyoutArray2 = $(this).attr("id").split('-'); 3285 var itemClicked2 = myAltFlyoutArray2[0]; 3286 3287 $('.'+itemClicked2).gcuiAnimateOut(); 3288 $('.'+itemClicked2+ '-flyout').stop().animate({"opacity":0},aDuration,aEasing,null); 3289 $('.'+itemClicked2+ '-flyout').css("display", "none"); 3290 }) 3291 3292 var myFlyout = $('.'+itemClicked+'-flyout'); 3293 myFlyout.stop().animate({"opacity":1},aDuration,aEasing,null); 3294 myFlyout.css("display", "block"); 3295 var timer; 3296 3297 $("div#gcui-header-player-wrapper > div."+itemClicked+"-flyout, #"+myButton).mouseenter(function(){ 3298 clearTimeout(timer); 3299 }).mouseleave(function(){ 3300 timer = setTimeout(function() { myFlyout.gcuiClearThisFlyout(); $('#'+myButton).gcuiAnimateOut(); },100); 3301 }); 3302 3303 }); 3304 }; 3305 3306 /** 3307 * Begin animating "out" (move toward the default state - away from "over"). 3308 * @param aDuration - how many milliseconds should it take 3309 * @param aEasing - the easing function to use - see jQuery.animate() 3310 * and if undefined, set to default of 200 milliseconds and ease of "swing" 3311 */ 3312 $.fn.gcuiFlyoutAnimateOut = function(aDuration, aEasing) { 3313 return this.each(function() { 3314 if (aDuration == "undefined" || aDuration == null) { aDuration = 200 }; 3315 if (aEasing == "undefined" || aEasing == null) { aEasing = "swing" }; 3316 3317 var myAltFlyoutArray = $(this).attr("id").split('-'); 3318 var itemClicked = myAltFlyoutArray[0]; 3319 3320 var myFlyout = $('.'+itemClicked+'-flyout'); 3321 myFlyout.stop().animate({"opacity":0},aDuration,aEasing, function () {$(this).css({display: "none"})}); 3322 //alert(myFlyout.attr("id")); 3323 }); 3324 }; 3325 3326 /** 3327 * Draw the canvas - does some setup and then calls the drawing function 3328 * provided to gcuiCanvasButton() 3329 */ 3330 $.fn.gcuiDrawCanvas = function(aForce) { 3331 return this.each(function() { 3332 var myAnimator = $(this).data('__animatorDiv').css('opacity'); 3333 3334 var lastanimator = $(this).data('__lastanimator'); 3335 if (!aForce && lastanimator == myAnimator && lastanimator) { 3336 return; 3337 } 3338 3339 $(this).data('__lastanimator', myAnimator); 3340 3341 var myDrawFunc = $(this).data('__drawFunc'); 3342 var ctx = this.getContext('2d'); 3343 ctx.save(); 3344 myDrawFunc.call(this, ctx, myAnimator); 3345 ctx.restore(); 3346 }); 3347 }; 3348 3349 /** 3350 * Wire up "activation" events that correspond to mouse over, mouse out, 3351 * click or have different behavior on mobile devices. 3352 */ 3353 $.fn.gcuiActivate = function(aGroupSelector, aSelectFunc, aInFunc, aOutFunc, aExpandFunc, aCollapseFunc) { 3354 this.data('__groupSelector', aGroupSelector); 3355 this.data('__selectFunc', aSelectFunc); 3356 this.data('__inFunc', aInFunc); 3357 this.data('__outFunc', aOutFunc); 3358 this.data('__expandFunc', aExpandFunc); 3359 this.data('__collapseFunc', aCollapseFunc); 3360 3361 this.hover( 3362 function() { 3363 //Animate button in 3364 $(this).data('__inFunc').call(this); 3365 if (rollOverActivated) { 3366 var myAltFlyoutArray = $(this).attr("id").split('-'); 3367 var itemClicked = myAltFlyoutArray[0]; 3368 3369 // if the button has a flyout under it... 3370 if (this.id && $('.'+itemClicked+'-flyout').size()) { 3371 //If its visible, then do nothing 3372 if ($('.'+itemClicked+'-flyout').css("opacity") != 0 && $('.'+itemClicked+'-flyout').css("display") != "none") { 3373 //and its not is visible, then show it! 3374 } else { 3375 $(this).data('__expandFunc').call(this); 3376 //if ($.gcuiMobile()) { 3377 //$(this).data('__inFunc').call(this); 3378 //} 3379 } 3380 // And if it has no flyout, then clear all flyouts on roll over 3381 } else { 3382 if ($(this).hasClass('header-menu-button')) { 3383 $.gcuiClearAllFlyouts(); 3384 } 3385 } 3386 } 3387 3388 //Call gcuiAnimateOut on all header menu buttons to animate them out - this is so that the user can fly over the buttons and have them stay activated 3389 //while still browsing through that specific flyout 3390 if ($(this).hasClass('header-menu-button')) { 3391 var myDeactivatedMenuButtons = $($(this).data('__groupSelector') + ':not(#'+$(this).attr("id")+')'); 3392 $(myDeactivatedMenuButtons).each(function() { 3393 var myDeactivatedBtn = $(this).attr("id").split('-'); 3394 var itemDeactivated = myDeactivatedBtn[0]; 3395 //alert(itemDeactivated); 3396 //alert("#"+itemDeactivated); 3397 $("#"+itemDeactivated).gcuiAnimateOut(); 3398 }) 3399 } 3400 }, 3401 function() { 3402 var myAltFlyoutArray = $(this).attr("id").split('-'); 3403 var itemClicked = myAltFlyoutArray[0]; 3404 //If it is a flyout, act normally and call animate outFunc 3405 if ($(this).hasClass('flyout-button')) { 3406 $(this).data('__outFunc').call(this); 3407 } 3408 3409 // if the button has a flyout under it... 3410 if (this.id && $('.'+itemClicked+'-flyout').size()) { 3411 //Dont animate it out 3412 } else { 3413 //Animate it out 3414 $(this).data('__outFunc').call(this); 3415 } 3416 } 3417 ); 3418 this.click(function() { 3419 var myAltFlyoutArray = $(this).attr("id").split('-'); 3420 var itemClicked = myAltFlyoutArray[0]; 3421 3422 // if the button has a flyout under it... 3423 if (this.id && $('.'+itemClicked+'-flyout').size()) { 3424 //And it is visible then hide it! 3425 if ($('.'+itemClicked+'-flyout').css("opacity") > 0) { 3426 $(this).data('__collapseFunc').call(this); 3427 if ($.gcuiMobile()) { 3428 $(this).data('__outFunc').call(this); 3429 } 3430 //If not, then show it! 3431 } else { 3432 $(this).data('__expandFunc').call(this); 3433 if ($.gcuiMobile()) { 3434 $(this).data('__inFunc').call(this); 3435 } 3436 } 3437 // And if it has no flyout, then select it and clear all flyouts 3438 } else { 3439 if ($.gcuiMobile()) { 3440 $(this).data('__inFunc').call(this); 3441 } 3442 $(this).data('__selectFunc').call(this); 3443 } 3444 //Call gcuiAnimateOut on all header menu buttons to animate them out - this is so that the user can fly over the buttons and have them stay activated 3445 //while still browsing through that specific flyout 3446 if ($(this).hasClass('header-menu-button')) { 3447 var myDeactivatedMenuButtons = $($(this).data('__groupSelector') + ':not(#'+$(this).attr("id")+')'); 3448 $(myDeactivatedMenuButtons).each(function() { 3449 var myDeactivatedBtn = $(this).attr("id").split('-'); 3450 var itemDeactivated = myDeactivatedBtn[0]; 3451 3452 //alert("#"+itemDeactivated); 3453 $("#"+itemDeactivated).gcuiAnimateOut(); 3454 }) 3455 } 3456 }); 3457 return this; 3458 }; 3459 3460 $.gcuiClearAllFlyouts = function () { 3461 //Hides all flyouts 3462 $('.flyout').stop().animate({"opacity":0},200,"swing", function () {$(this).css({display: "none"})}); 3463 $("#defaultimagediv").animate({"opacity":1},400,"swing",null); 3464 } 3465 3466 $.gcuiAnimateOutAll = function() { 3467 //Animates out every button 3468 $('.header-menu-button').gcuiAnimateOut(); 3469 } 3470 3471 $.fn.gcuiVideoPlayer = function(aSiteId, aPlayVidId, aPlaylistId, aVideoWidth, aVideoHeight, aAutoPlay, aThumb, aFullLocale, aLocale) { 3472 //This function is called at the bottom of each local site TPL file, and it passes the variables specific to that page 3473 //in order to play the video, and they are all listed below 3474 3475 this.data('__aSiteId', aSiteId); 3476 this.data('__aPlayVidId', aPlayVidId); 3477 this.data('__aPlaylistId', aPlaylistId); 3478 this.data('__aVideoWidth', aVideoWidth); 3479 this.data('__aVideoHeight', aVideoHeight); 3480 this.data('__aThumb', aThumb); 3481 this.data('__aFullLocale', aFullLocale); 3482 this.data('__aLocale', aLocale); 3483 3484 3485 if (aAutoPlay == true) { 3486 $("#gcui-header-player-wrapper #main_player").css("display", "block"); 3487 $("#gcui-header-player-wrapper #main_player").gcuiPlayVideo(aPlayVidId, aPlaylistId, aFullLocale, aLocale); 3488 } else { 3489 if (foBarActive) {
3490 var foBarMessage = "press_play_to_watch"; 3491 // var foBarMessage = "gcui_common_strings:common_playing_video_ellipsis"; 3492 $("#gcui-header-player-wrapper #main_player").css("display", "none"); 3493 if (!aThumb) { 3494 $("#defaultimagediv").html( 3495 '<img id="defaultimage" width="576" height="324" src="/sassets/videos/640_thumbs/'+aPlayVidId+'_'+aLocale+'.jpg"><div id="autoplayFoBar"><?php print t1k("'+foBarMessage+'"); ?></div>'); 3496 //console.log('/assets/videos/640_thumbs/'+aPlayVidId+'.jpg'); 3497 } else { 3498 $("#defaultimagediv").html( 3499 '<img id="defaultimage" width="576" height="324" src="'+aThumb+'"><div id="autoplayFoBar"><?php print t1k("'+foBarMessage+'"); ?></div>'); 3500 } 3501 3502 $("#autoplayFoBar").click(function() { 3503 /* $("#gcui-header-player-wrapper #main_player").gcuiVideoPlayer(aSiteId, aPlayVidId, aPlaylistId, aVideoWidth, aVideoHeight, true); */ 3504 $("#gcui-header-player-wrapper #main_player").css("display", "block"); 3505 $("#gcui-header-player-wrapper #main_player").gcuiPlayVideo(aPlayVidId, aPlaylistId, aFullLocale, aLocale); 3506 }); 3507 } else { 3508 if (!aThumb) { 3509 $("#defaultimagediv").html( 3510 '<img id="defaultimage" width="576" height="324" src="/sassets/videos/64
35100_thumbs/'+aPlayVidId+'_'+aLocale+'.jpg">'); 3511 } else { 3512 $("#defaultimagediv").html( 3513 '<img id="defaultimage" width="576" height="324" src="'+aThumb+'">'); 3514 } 3515 } 3516 } 3517 }; 3518 3519 $.fn.gcuiPlayVideo = function(aVideoId, aPlaylistId, aFullLocale, aLocale) { 3520 //Switch out to the new image based on video Id selected no matter which video player is selected 3521 3522 $.gcuiSwapVideoImage(aVideoId); 3523 3524 var videoHeight = $(this).data('__aVideoHeight'); 3525 var videoWidth = $(this).data('__aVideoWidth'); 3526 var siteId = $(this).data('__aSiteId'); 3527 3528 // provide sensible defaults if not specified 3529 if (!videoHeight) { videoHeight = 324; } 3530 if (!videoWidth) { videoWidth = 576; } 3531 if (!siteId) { siteId = $.urlParser.host; } 3532 3533 //alert(siteId); 3534 3535 return this.each(function() { 3536 // detect if flash is supported/should be used 3537 // output player - flash or html5 or quicktime fallback 3538 $(this).css("opacity", 0); 3539 $(this).animate({"opacity":1},300,"swing",null); 3540 //alert("HI2"); 3541 if (swfobject.hasFlashPlayerVersion('9.0.115.0')) { 3542 //console.log(aVideoId); 3543 //console.log(aPlaylistId); 3544 //console.log($.urlParser.host); 3545 //console.log(videoHeight); 3546 //console.log(videoWidth); 3547 3548 var aSharedDataPath = "/"+aLocale+"/sdata/"; 3549 3550 if (aLocale == undefined) { 3551 aFullLocale = 'en_EN'; 3552 aLocale = 'en'; 3553 aSharedDataPath = '/en/sdata/'; 3554 } 3555 //console.log(aFullLocale); 3556 //console.log(aLocale); 3557 //console.log(aSharedDataPath); 3558 3559 //Has Flash Player, so show flash player 3560 //alert("HERE1:"+$(this).children(":first").attr('id')); 3561 //alert(videoWidth); 3562 3563 $(this).children(":first").gcuiSwfObjEmbed("/assets/shared-assets/video-player_sa_"+videoWidth+".swf", 3564 { 3565 flashvars : { 3566 configuration:"development", 3567 siteName: $.urlParser.host, 3568 videoID: aVideoId, 3569 playlistID: aPlaylistId, 3570 fullLocale : aFullLocale, 3571 locale: aLocale, 3572 sharedDataPath: aSharedDataPath, 3573 enableVidTracker: true 3574 }, 3575 config : { 3576 height : videoHeight, 3577 width : videoWidth 3578 }, 3579 params : { 3580 scale: "default" 3581 } 3582 }) 3583 } else { 3584 //Does not support Flash, show html5 player 3585 3586 var video_id_path; 3587 if (aLocale == 'en') { 3588 video_id_path = '/getvideo2/'+aVideoId+'?quality=std'; 3589 } else { 3590 video_id_path = '/'+aLocale+'/getvideo2/'+aVideoId+'?quality=std'; 3591 } 3592 3593 $(this).children(":first").html( 3594 '<video id="video_player" src="' + 3595 /*$.urlParser.parse('/en/getvideo2/'+aVideoId+'?quality=std').assemble()*/ 3596 $.urlParser.parse(video_id_path).assemble() + 3597 '" preload autoplay controls height="324" width="576" poster="' +
3598 $.urlParser.parse('/sassets/videos/640_thumbs/'+aVideoId+'_'+aLocale+'.jpg').assemble() + '">' + 3599 '</video>' 3600 ); 3601 }; 3602 }); 3603 return this; 3604 }; 3605 3606 $.gcuiSwapVideoImage = function (aVideoId) { 3607 var img = new Image(); 3608 img.src = "/sassets/videos/640_thumbs/"+aVideoId+"_"+_gcui_get_lang()+".jpg"; 3609 $(img).bind('load readystatechange', function(e) { 3610 if (this.complete || (this.readyState == 'complete' && e.type == 'readystatechange')) { 3611 $("#defaultimagediv").css("opacity", 0); 3612 //$("#defaultimagediv").animate({"opacity":0},400,"swing", null); 3613 $("#defaultimagediv").html( 3614 '<img id="defaultimage" width="576" height="324" src="/sassets/videos/640_thumbs/'+aVideoId+'_'+_gcui_get_lang()+'.jpg">'); 3615 } 3616 }); 3617 }; 3618 3619 $.fn.gcuiStopVideo = function(aImageDim) { 3620 if (!aImageDim) {aImageDim = 1;}; 3621 $("#defaultimagediv").animate({"opacity":aImageDim},400,"swing",null); 3622 if (swfobject.hasFlashPlayerVersion('9.0.115.0')) { 3623 $('#main_player').fadeOut('fast'); 3624 //$(this).children(":first").fadeOut('fast'); 3625 $('#main_player').html('<div id="player_holder"></div>'); 3626 } else { 3627 $(this).children(":first").html(''); 3628 } 3629 } 3630 3631 /** 3632 * Utility function to get the current page's langauge from JS, using the lang-[language_code] class from the <body> tag. 3633 * @TODO: extract this into some common JS module 3634 */ 3635 function _gcui_get_lang() { 3636 3637 var body_classes = $('body').attr('class'); 3638 var class_parts = body_classes.split(' '); 3639 var lang = ''; 3640 for (var j in class_parts) { 3641 if ((class_parts[j]+'').indexOf('lang-') != -1) { 3642 // this is the part 3643 lang = class_parts[j].substr(5); 3644 } 3645 } 3646 3647 // fallback 3648 if (lang == '') { 3649 gcui_log('body class lang-[language_code] is not set'); 3650 lang = 'en'; 3651 } 3652 3653 return lang; 3654 3655 } 3656 $.gcuiFlyoutTimeout = function(autoHideFlyout) { 3657 var timer; 3658 if (autoHideFlyout || autoHideFlyout == undefined) { 3659 $("#gcui-header-player-wrapper").mouseenter(function(){ 3660 clearTimeout(timer); 3661 }).mouseleave(function(){ 3662 timer = setTimeout(function() { $.gcuiClearAllFlyouts(); $.gcuiAnimateOutAll(); },10); 3663 }); 3664 /*$("#button-bottom").mouseenter(function(){ 3665 timer = setTimeout(function() { $.gcuiFlyoutTimeoutComplete(); },10); 3666 }); 3667 $(".gcuihpw-menu").mouseenter(function(){ 3668 timer = setTimeout(function() { $.gcuiClearAllFlyouts(); },10); 3669 });*/ 3670 } 3671 } 3672 3673 $.fn.gcuiFlyoutTimeoutComplete = function() { 3674 return this.each(function() { 3675 alert("flyingout"); 3676 $(this).gcuiAnimateOut(); 3677 $(this).gcuiClearThisFlyout(); 3678 }); 3679 } 3680 3681 $.fn.gcuiClearThisFlyout = function () { 3682 return this.each(function() { 3683 $(this).stop().animate({"opacity":0},200,"swing", function () {$(this).css({display: "none"})}); 3684 $("#defaultimagediv").animate({"opacity":1},400,"swing",null); 3685 }); 3686 } 3687 3688 var rollOverActivated; 3689 $.gcuiFlyoutOnRollOver = function(rollOver) { 3690 if (rollOver == true) { 3691 rollOverActivated = true; 3692 } else { 3693 rollOverActivated = false; 3694 } 3695 3696 } 3697 3698 var foBarActive = false; 3699 $.gcuiAutoPlayFoBar = function(showFoBar) { 3700 //console.log(showFoBar); 3701 if (showFoBar == true) { 3702 foBarActive = true; 3703 } else { 3704 foBarActive = false 3705 } 3706 } 3707 3708})(jQuery); 3709 3710 3711 3712/////////////////////////////////////////////////////////////////////////////////// 3713// Newer video playback stuff 3714 3715(function($) { 3716 3717 /** 3718 * Static set of video sizes 3719 */ 3720 $.gcuiVideoSizes = { 3721 undefined: { width: 432, height: 243 }, 3722 odd: { width: 432, height: 243 }, 3723 low: { width: 320, height: 180 }, 3724 reg: { width: 480, height: 270 }, 3725 std: { width: 480, height: 270 }, 3726 med: { width: 576, height: 324 }, 3727 hi: { width: 640, height: 360 }, 3728 stddef: { width: 864, height: 486 }, 3729 stddef860: { width: 860, height: 484 }, 3730 hd: { width: 1280, height: 720 }, 3731 hd1920: { width: 1920, height: 1080 } 3732 }; 3733 3734 3735 3736 /** 3737 * Play a video, with appropriate fallbacks. 3738 * 3739 * @param options 3740 * The paramter provided is an object which can contain these properties:<br> 3741 * {<br> 3742 * videoId: 'lrh_bio', // (required) the video id<br> 3743 * quality: 'med', // (recommended) the size/quality to show, default is "med" - 576/324<br> 3744 * locale: 'fr', // (recommended) the locale of the video to play, defaults to 'en'<br> 3745 * playlistId: 'main', // (optional) the playlist id to pass to the Flash player (no effect on alternate video output)<br> 3746 * mechanisms: ['flash', 'html5', 'qt'], // (optional) the sequence of video playback mechanisms to attempt, the example shown is the default - the first acceptable mechanism is used<br> 3747 * preferFlv: false, // (optional) prefer FLV format files when using Flash video player<br> 3748 * flashVersionRequired: '9.0.115.0', // (optional) the flash version required to use the flash mechanism for video playback, normally you don't want to change this<br> 3749 * enableVidTracker: true // (optional) whether or not to use the vid_tracker ???<br> 3750 * fallbackToDownload: true // (optional) whether to send the user to a download link if fails on all fronts<br> 3751 * } 3752 */ 3753 $.fn.gcuiInitVideo = function(options) { 3754 3755 // default options 3756 var aOptions = { 3757 quality: 'med', 3758 locale: 'en', 3759 //playlistId: 'main', 3760 mechanisms: ['flash', 'html5', 'qt'], 3761 preferFlv: false, 3762 flashVersionRequired: '9.0.115.0', 3763 enableVidTracker: true, 3764 fallbackToDownload: true, 3765 autoplay: true, 3766 extraFlashvars: {} 3767 }; 3768 3769 if (options) { 3770 $.extend(aOptions, options); 3771 } 3772 3773 // @HACK: fullLocale is gonna be the same 3774 aOptions.fullLocale = aOptions.locale; 3775 3776 // @HACK: playlist ID 3777 aOptions.playlistId = aOptions.videoId; 3778 3779 // sanity check 3780 if ($(this).children().length == 0) { 3781 gcui_log('ERROR: video wrapper div needs to have an inner div (with an ID on the inner div)'); 3782 } 3783 3784 //Switch out to the new image based on video Id selected no matter which video player is selected 3785 $.gcuiSwapVideoImage(aOptions.videoId); 3786 3787 for (i in aOptions.mechanisms) { 3788 var myMech = aOptions.mechanisms[i]; 3789 gcui_log('Checking ' + myMech + ' capability ...'); 3790 // flash detection 3791 if (myMech == 'flash') { 3792 // if required flash version is supported 3793 if (typeof swfobject == 'undefined'){ 3794 gcui_log('ERROR: swfobject not available, skipping Flash playback! Please use "swfobject_api_ensure_swfobject()"'); 3795 } else { 3796 if (typeof $.urlParser == 'undefined') { 3797 gcui_log('ERROR: $.urlParser not available, skipping Flash playback! Please use "drupal_add_library(\'jquery.urlParser\')"'); 3798 } else { 3799 if (typeof $.fn.gcuiSwfObjEmbed == 'undefined') { 3800 gcui_log('ERROR: $.fn.gcuiSwfObjEmbed not available, skipping Flash playback! Please include jquery.gcui.js') 3801 } else { 3802 if (swfobject.hasFlashPlayerVersion(aOptions.flashVersionRequired)) { 3803 gcui_log('Playing Flash ...'); 3804 return this.gcuiInitVideoFlash(aOptions); 3805 } 3806 } 3807 } 3808 } 3809 gcui_log('No Flash'); 3810 } 3811 // is HTML appropriate? 3812 else if (myMech == 'html5') { 3813 // for now, we only do HTML5 in Safari/iWhatever... 3814 var ua = navigator.userAgent+""; 3815 if (ua.indexOf('Safari') >= 0 || ua.indexOf('iPad') >= 0 || ua.indexOf('iPhone') >= 0 || ua.indexOf('iPod') >= 0) { 3816 if (typeof $.urlParser == 'undefined') { 3817 gcui_log('ERROR: $.urlParser not available, skipping HTML5 playback! Please use "drupal_add_library(\'jquery.urlParser\')"'); 3818 } else { 3819 gcui_log('Playing HTML5 ...'); 3820 return this.gcuiInitVideoHtml5(aOptions); 3821 } 3822 } else { 3823 gcui_log('No HTML5'); 3824 } 3825 } 3826 // detect QuickTime 3827 else if (myMech == 'qt') { 3828 // load in the apple detection script and ask it... 3829 var caller = this; 3830 if (typeof detectPlugin == 'undefined') { 3831 // don't have function yet, load in JS 3832 $.ajax({
3833 url: '/sites/all/modules/gold_common_ui/js/detect_apple_plugins.js', 3834 dataType: 'script', 3835 async: false 3836 }); 3837 } 3838 3839 if (detectPlugin && detectPlugin('QuickTime')) { 3840 gcui_log('Playing Quicktime ...'); 3841 return caller.gcuiInitVideoQuickTime(aOptions); 3842 } 3843 } 3844 } 3845 3846 // if no video can be played (neither Flash nor HTML5 nor QuickTime), redirect to the video file so 3847 // the user can at least download the file 3848 if (aOptions.fallbackToDownload) { 3849 if (aOptions.locale == 'en') { 3850 window.location = $.urlParser.parse('/getvideo2/' + aOptions.videoId + '?quality=' + aOptions.quality).assemble(); 3851 } else { 3852 window.location = $.urlParser.parse('/' + aOptions.locale + '/getvideo2/' + aOptions.videoId + '?quality=' + aOptions.quality).assemble(); 3853 } 3854 } 3855 return null; 3856 }; 3857 3858 $.fn.gcuiInitVideoFlash = function(aOptions) { 3859 return this.each(function() { 3860 3861 // some intro animation 3862 $(this).css("opacity", 0); 3863 $(this).animate({"opacity":1},300,"swing",null); 3864 3865 // get the data together 3866 var aSharedDataPath = "/" + aOptions.locale + "/sdata/"; 3867 var aVideoSize = $.gcuiVideoSizes[aOptions.quality]; 3868 3869 var isRtl = ""; 3870 3871 if (aOptions.locale == 'he') { 3872 var isRtl = "_rtl"; 3873 } 3874 3875 // extraFlashvars 3876 var temp_flash_vars = { 3877 configuration:"development", 3878 siteName: $.urlParser.host, 3879 videoID: aOptions.videoId, 3880 playlistID: aOptions.playlistId, 3881 fullLocale : aOptions.fullLocale, 3882 locale: aOptions.locale, 3883 sharedDataPath: aSharedDataPath, 3884 preferFlv: aOptions.preferFlv, 3885 enableVidTracker: aOptions.enableVidTracker 3886 }; 3887 3888 for (var i in aOptions.extraFlashvars) { 3889 gcui_log('video player extra flashvar: ' + i + ' = ' + aOptions.extraFlashvars[i]); 3890 temp_flash_vars[i] = aOptions.extraFlashvars[i]; 3891 } 3892 3893 // embed the Flash player 3894 $(this).children(":first").gcuiSwfObjEmbed("/assets/shared-assets/video-player_sa_" + aVideoSize.width + isRtl + ".swf", { 3895 flashvars : temp_flash_vars, 3896 config : { 3897 height : aVideoSize.height, 3898 width : aVideoSize.width 3899 }, 3900 params : { 3901 scale: "default" 3902 } 3903 }); 3904 3905 }); 3906 }; 3907 3908 $.fn.gcuiInitVideoHtml5 = function(aOptions) { 3909 return this.each(function() { 3910 3911 // get the data together 3912 var aVideoSize = $.gcuiVideoSizes[aOptions.quality]; 3913 3914 // get assembled video ID URL 3915 var video_id_path; 3916 if (aOptions.locale == 'en') { 3917 video_id_path = '/getvideo2/' + aOptions.videoId + '?quality=' + aOptions.quality; 3918 } else { 3919 video_id_path = '/' + aOptions.locale + '/getvideo2/' + aOptions.videoId + '?quality=' + aOptions.quality; 3920 } 3921 3922 // handle autoplay 3923 var autoplay_string = ''; 3924 if (aOptions.autoplay) { 3925 autoplay_string = ' autoplay '; 3926 } 3927 3928 // embed html5 player 3929 $(this).children(":first").html( 3930 '<video id="video_player" src="' + 3931 /*$.urlParser.parse('/en/getvideo2/'+aVideoId+'?quality=std').assemble()*/ 3932 $.urlParser.parse(video_id_path).assemble() + 3933 '" preload ' + autoplay_string + ' controls height="' + aVideoSize.height + '" width="' + aVideoSize.width + '" poster="' +
3934 $.urlParser.parse('/sassets/videos/640_thumbs/' + aOptions.videoId + '_'+_gcui_get_lang()+'.jpg').assemble() + 3935 '">' + 3936 '</video>' 3937 ); 3938 3939 }); 3940 }; 3941 3942 $.fn.gcuiInitVideoQuickTime = function(aOptions) { 3943 return this.each(function() { 3944 3945 gcui_log('playing Quicktime'); 3946 3947 //$('.breadcrumb-section .breadcrumb').html('Playing QuickTime...'); 3948 3949 // get the data together 3950 var aVideoSize = $.gcuiVideoSizes[aOptions.quality]; 3951 3952 var video_id_path; 3953 if (aOptions.locale == 'en') { 3954 video_id_path = '/getvideo2/' + aOptions.videoId + '?quality=' + aOptions.quality; 3955 } else { 3956 video_id_path = '/' + aOptions.locale + '/getvideo2/' + aOptions.videoId + '?quality=' + aOptions.quality; 3957 } 3958 3959 // embed quicktime player 3960 $(this).children(":first").html( 3961 '<object width="' + aVideoSize.width + '" height="' + (aVideoSize.height+16) + '" ' + 3962 ' classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"> ' + 3963 ' <param name="src" value="' + 3964 $.urlParser.parse(video_id_path).assemble() + 3965 '"> ' + 3966 ' <param name="autoplay" value="true"> ' + 3967 ' <param name="controller" value="true"> ' + 3968 ' <embed src="' + 3969 $.urlParser.parse(video_id_path).assemble() + 3970 '" width="' + aVideoSize.width + '" height="' + (aVideoSize.height+16) + '" autoplay="true" controller="true" ' + 3971 ' pluginspage="http://www.apple.com/quicktime/download/"> ' + 3972 ' </embed> ' + 3973 '</object>' 3974 ); 3975 }); 3976 }; 3977 3978})(jQuery); 3979 3980/////////////////////////////////////////////////////////////////////////////////// 3981// This function is being called from Flash when the video ends. 3982 3983function endOfVideo() { 3984 $(document).trigger('gcuiEndVideo'); 3985} 3986 3987/** 3988 * Implement "read more" functionality 3989 */ 3990jQuery.fn.gcuiReadMore = function(aOptions) { 3991 3992 if (!aOptions) { 3993 aOptions = {}; 3994 } 3995 if (!aOptions.linkHtml) { 3996 aOptions.linkHtml = "read more »"; 3997 } 3998 if (!aOptions.linkClass) { 3999 aOptions.linkClass = ""; 4000 } 4001 4002 var mySet = $(this); 4003 4004 var c = 0; 4005 return this.each(function() { 4006 if (c == 0) { 4007 var myEl = $('<span> </span><a href="#" class="gcui-read-more-link '+aOptions.linkClass+' ">'+aOptions.linkHtml+'</a>'); 4008 myEl.click(function(e) { 4009 e.preventDefault(); 4010 myEl.hide(); 4011 mySet.show(); 4012 }); 4013 $(this).append(myEl); 4014 } 4015 else { 4016 $(this).hide(); 4017 } 4018 c++; 4019 }); 4020 4021}; 4022 4023; 4024/* function loadThumbnails(event) { 4025 4026 // I assign this in the onload (the jquery attached onload) as data from the calling div, the div that is clicked that is. It's a list of the images to be loaded. 4027 var flyoutVideoCaptions = $(this).data('__flyoutVideoCaptions'); 4028 var flyOutVideoIds = $(this).data('__flyoutVideoIds'); 4029 var myDefaultImage = $(this).data('__defaultimage'); 4030 var myMenuDiv = $('#flyout'); 4031 myMenuDiv.html('<table width="576" height="324" class="newTable"><tr><td class="box box-1"></td><td class="box box-2"></td><td class="box box-3"></td><td class="box box-4"></td></tr><tr><td class="box box-5"></td><td class="box box-6"></td><td class="box box-7"></td><td class="box box-8"></td></tr><tr><td class="box box-9"></td><td class="box box-10"></td><td class="box box-11"></td><td class="box box-12"></td></tr><tr><td class="box box-13"></td><td class="box box-14"></td><td class="box box-15"></td><td class="box box-16"></td></tr></table>'); 4032 4033 myMenuDiv.css("display", "block"); 4034 var myThumbNails = flyOutVideoIds.split(","); 4035 var myCaptions = flyoutVideoCaptions.split(","); 4036 4037 for (var string in myCaptions) { 4038 myCaptions[string] = $("<div>" + myCaptions[string] + "</div>").text(); 4039 //alert(myCaptions[string]); 4040 } 4041 4042 for (var i = 0; i < myThumbNails.length;i++) { 4043 var myBoxes = $(".box-"+i); 4044 4045 4046 4047 myBoxes.html(
4048 '<canvas class="flyoutImg" __img="(/assets/videos/medium_thumbs/'+myThumbNails[i-1]+'.jpg) top center" __caption="'+myCaptions[i-1]+'" onclick="playVideo(\''+myThumbNails[i-1]+'\')" __videoid="'+myThumbNails[i-1]+'"></canvas>'); 4049 4050 $('myBox'+i).dfwSetupFlyoutButton({ 4051 "__img" : '/assets/videos/medium_thumbs/'+myThumbNails[i-1]+'.jpg', 4052 4053 "__caption" : myCaptions[i-1], 4054 4055 }); 4056 4057 $("#myBox"+i).hover(function() { 4058 $(this).css("cursor", "pointer"); 4059 $(this).dfwAnimateInHeaderButton(); 4060 }, function() { 4061 $(this).dfwAnimateOutHeaderButton(); 4062 }); 4063 var myBoxImage = $("#myBox"+i); 4064 myBoxImage.css("margin-bottom", 0); 4065 myBoxes.css("text-align", "center"); 4066 } 4067 myMenuDiv.css("opacity", 0); 4068 4069 myMenuDiv.animate({"opacity":.9},500,"swing",null); 4070} */ 4071 4072function playVideo(passedVideo) { 4073 var myMenuDiv = $('#gcui-header-player-wrapper #flyout'); 4074 myMenuDiv.stop().animate({"opacity":0},200,"swing",null); 4075 4076 var myDefaultImageDiv = $('#gcui-header-player-wrapper #defaultimagediv'); 4077 myDefaultImageDiv.css("opacity", 0); 4078 setTimeout(function() { 4079 myDefaultImageDiv.html ('<img id="defaultimage" width="576" height="324" src="/assets/videos/64
40790_thumbs/'+passedVideo+'.jpg">'); 4080 },2000); 4081 4082 var myPlayerDiv = $('#main_player'); 4083 myPlayerDiv.animate({"opacity":1},500,"swing",null); 4084 4085 if (passedVideo) { 4086 // set the source 4087 $('#gcui-header-player-wrapper #main_player').gcuiSwfObjEmbed("/assets/shared-assets/video-player_sa_576.swf", 4088 { 4089 flashvars : { 4090 configuration:"development", 4091 siteName:$.urlParser.host, 4092 videoID: passedVideo, 4093 playlistID: passedVideo 4094 }, 4095 config : { 4096 height : '324', 4097 width : '576' 4098 } 4099 }) 4100 } 4101 myMenuDiv.css("display", "none"); 4102} 4103 4104$.fn.dfwSetupFlyoutButton = function(aButtonConfig) { 4105 this.data('__buttonConfig', aButtonConfig); 4106 return this.each(function() { 4107 // add class to canvas so we can find it later 4108 $(this).addClass('dfwFlyoutButton'); 4109 4110 // create div which we will animate the opacity of using jquery and which will be our animation state 4111 var myDiv = $("<div class='dfwHeaderButtonAnimator'></div>").appendTo("body"); 4112 myDiv.css("opacity", 0); 4113 myDiv.css("display", "none"); 4114 $(this).data('__animatorDiv', myDiv); 4115 4116 if (!document.dfwFlyoutButtonInterval) { 4117 document.dfwFlyoutButtonInterval = setInterval(function() { 4118 $(".dfwFlyoutButton").dfwDrawFlyoutButton(); 4119 },0); 4120 } 4121 }) 4122}; 4123 4124$.fn.dfwSetupHeaderButton = function(aButtonConfig) { 4125 4126 //Because canvas cannot do line breaks, we have to split the caption into individual lines 4127 var myCaption = $(this).attr('__caption'); 4128 4129 //Split at the line break in the XML 4130 myCaptionArray = myCaption.split('<br/>'); 4131 4132 //Go through each split line and strip the html and assign it to the array 4133 for (var string in myCaptionArray) { 4134 myCaptionArray[string] = $("<div>" + myCaptionArray[string] + "</div>").text(); 4135 } 4136 4137 aButtonConfig.caption = myCaptionArray; 4138 4139 this.data('__buttonConfig', aButtonConfig); 4140 return this.each(function() { 4141 4142 // add class to canvas so we can find it later 4143 $(this).addClass('dfwHeaderButton'); 4144 4145 // create div which we will animate the opacity of using jquery and which will be our animation state 4146 var myDiv = $("<div class='dfwHeaderButtonAnimator'></div>").appendTo("body"); 4147 myDiv.css("opacity", 0); 4148 myDiv.css("display", "none"); 4149 $(this).data('__animatorDiv', myDiv); 4150 4151 // start the interval which does the animation - if not already done 4152 if (!document.dfwHeaderButtonInterval) { 4153 document.dfwHeaderButtonInterval = setInterval(function() { 4154 $(".dfwHeaderButton").dfwDrawHeaderButton(); 4155 },25); 4156 } 4157 }) 4158} 4159 4160 4161$.fn.dfwDrawFlyoutButton = function() { 4162 return this.each(function() { 4163 var animator = $(this).data('__animatorDiv').css('opacity'); 4164 alert(animator); 4165 var lastanimator = $(this).data('__lastanimator'); 4166 if (lastanimator == animator && lastanimator) { 4167 return; 4168 } 4169 4170 var myButtonConfig = $(this).data('__buttonConfig'); 4171 var myCaption = myButtonConfig.caption; 4172 var myImg = myButtonConfig.caption; 4173 var flag = new Image(); 4174 flag.src = '/arrow.png'; 4175 $(this).data('__lastanimator', animator); 4176 ctx.drawImage(flag, 10, 20); 4177 ctx.stroke(); 4178 ctx.font = '600 17px/2 "Trebuchet MS",Helvetica,sans-serif'; 4179 ctx.fillStyle = "rgba(44, 167, 170, 1)"; 4180 ctx.textBaseline = "middle"; 4181 ctx.fillText(myCaption, 40*animator/10+32, this.height/2-10); 4182 4183}) 4184} 4185 4186$.fn.dfwDrawHeaderButton = function() { 4187 return this.each(function() { 4188 var animator = $(this).data('__animatorDiv').css('opacity'); 4189 var lastanimator = $(this).data('__lastanimator'); 4190 if (lastanimator == animator && lastanimator) { 4191 return; 4192 } 4193 $(this).data('__lastanimator', animator); 4194 4195 var myButtonConfig = $(this).data('__buttonConfig'); 4196 var myButtonShape = myButtonConfig.box_coords; 4197 var myArrowPosition = myButtonConfig.arrow_position; 4198 var myCaption = myButtonConfig.caption; 4199 4200 var animatorSmall = animator/50; 4201 var animateOpacity = animator/3+.5; 4202 var flag = new Image(); 4203 flag.src = '/arrow.png'; 4204 var ctx = this.getContext('2d'); 4205 4206 ctx.save(); 4207 ctx.clearRect(0,0,300,110); 4208 ctx.setTransform(1+animatorSmall,0,0,1+animatorSmall,-7*animator,-8*animator); 4209 ctx.rotate(animatorSmall); 4210 ctx.beginPath(); 4211 ctx.fillStyle="rgba(0, 0, 0, "+animateOpacity+")"; 4212 ctx.strokeStyle="rgba(0, 0, 0, "+animateOpacity+")"; 4213 ctx.scale(1+animatorSmall*2.7,1+animatorSmall*3); 4214 for (var i in myButtonShape) { 4215 var myCoords = myButtonShape[i]; 4216 // if first one.. 4217 if (i==0) { 4218 ctx.moveTo(myCoords[0],myCoords[1]); 4219 } else { 4220 ctx.lineTo(myCoords[0],myCoords[1]); 4221 } 4222 } 4223 ctx.fill(); 4224 ctx.beginPath();
4225 ctx.restore(); 4226 ctx.fillStyle="rgba(0, 0, 0, 1)"; 4227 ctx.strokeStyle="rgba(0, 0, 0, 1)"; 4228 4229 // Load an image 4230 ctx.drawImage(flag, myArrowPosition[0]*animator/16+220, myArrowPosition[1]); 4231 4232 ctx.restore(); 4233 4234 if (myCaption.length == 2) { 4235 ctx.stroke(); 4236 ctx.font = '600 17px/2 "Trebuchet MS",Helvetica,sans-serif'; 4237 ctx.fillStyle = "rgba(44, 167, 170, 1)"; 4238 ctx.textBaseline = "middle"; 4239 ctx.fillText(myCaption[0], 40*animator/10+32, this.height/2-10); 4240 ctx.font = '600 14px/2 "Trebuchet MS",Helvetica,sans-serif'; 4241 ctx.fillStyle = "rgba(255, 255, 255, 1)"; 4242 ctx.textBaseline = "middle"; 4243 ctx.fillText(myCaption[1], 40*animator/10+32, this.height/2+10); 4244 } else if (myCaption.length == 3) { 4245 ctx.stroke(); 4246 ctx.font = '600 17px/2 "Trebuchet MS",Helvetica,sans-serif'; 4247 ctx.fillStyle = "rgba(44, 167, 170, 1)"; 4248 ctx.textBaseline = "middle"; 4249 ctx.fillText(myCaption[0], 40*animator/10+32, this.height/2-17); 4250 ctx.font = '600 17px/2 "Trebuchet MS",Helvetica,sans-serif'; 4251 ctx.fillStyle = "rgba(44, 167, 170, 1)"; 4252 ctx.textBaseline = "middle"; 4253 ctx.fillText(myCaption[1], 40*animator/10+32, this.height/2); 4254 ctx.font = '600 14px/2 "Trebuchet MS",Helvetica,sans-serif'; 4255 ctx.fillStyle = "rgba(255, 255, 255, 1)"; 4256 ctx.textBaseline = "middle"; 4257 ctx.fillText(myCaption[2], 40*animator/10+32, this.height/2+17); 4258 } 4259 ctx.restore(); 4260 }) 4261}; 4262 4263$.fn.dfwAnimateInHeaderButton = function() { 4264 return this.each(function() { 4265 var myDiv = $(this).data('__animatorDiv'); 4266 myDiv.stop().animate({"opacity":1},200,"swing",null); 4267 }) 4268}; 4269 4270$.fn.dfwAnimateOutHeaderButton = function() { 4271 return this.each(function() { 4272 var myDiv = $(this).data('__animatorDiv'); 4273 myDiv.stop().animate({"opacity":0},200,"swing",null); 4274 }) 4275}; 4276 4277$.fn.dfwRunClickEvent = function(e) { 4278 return this.each(function() { 4279 // if it's an actual link then just let it link 4280 var myHref = $(this).attr('href'); 4281 var myTarget = $(this).attr('target'); 4282 if (myHref && myHref.length > 1) { 4283 var myPlayerDiv = $('#main_player'); 4284 $('#main_player').fadeOut('fast'); 4285 if (myTarget == "_blank") { 4286 window.open(myHref); 4287 } else { 4288 document.location(myHref); 4289 } 4290 return true; 4291 } 4292 4293 // hide the flyout if there. 4294 var myMenuDiv = $('#gcui-header-player-wrapper #flyout'); 4295 myMenuDiv.css("display", "none"); 4296 4297 var myVideoId = $(this).attr('__videoid'); 4298 var flyOutVideoIds = $(this).attr('__flyoutVideoIds'); 4299 var flyOutVideoCaptions = $(this).attr('__flyoutVideoCaptions'); 4300 4301 if (myVideoId && flyOutVideoIds.length==0) { 4302 4303 // set the source 4304 $('#gcui-header-player-wrapper #player').animate({"opacity":0, "visibility":"hidden"},500,"swing",null); 4305 var myPlayerDiv = $('#gcui-header-player-wrapper #main_player'); 4306 myPlayerDiv.animate({"opacity":1},500,"swing",null); 4307 myPlayerDiv.fadeOut('fast'); 4308 4309 if (swfobject.hasFlashPlayerVersion('9.0.115.0')) { 4310 myPlayerDiv.gcuiSwfObjEmbed("/assets/shared-assets/video-player_sa_576.swf", 4311 { 4312 flashvars : { 4313 configuration:"development", 4314 siteName: $.urlParser.host, 4315 videoID: myVideoId, 4316 playlistID: myVideoId 4317 4318 }, 4319 config : { 4320 height : '324', 4321 width : '576' 4322 } 4323 }) 4324 } else { 4325 myPlayerDiv.html( 4326 '<video id="video_player" autoplay controls height="324" width="576" poster="' +
4327 $.urlParser.parse("/assets/videos/640_thumbs/"+myVideoId+".jpg").assemble() 4328 + 4329 '">' + 4330 '<source src="' + 4331 $.urlParser.parse("/en/getvideo/"+myVideoId+"?quality=std").assemble() 4332 + 4333 '" />' + 4334 '</video>'); 4335 } 4336 4337 4338 } 4339 // no video ID, assume it's a submenu 4340 else { 4341 var myPlayerDiv = $('#gcui-header-player-wrapper #main_player'); 4342 $('#gcui-header-player-wrapper #main_player').fadeOut('fast'); 4343 myPlayerDiv.data("__flyoutVideoIds", flyOutVideoIds); 4344 myPlayerDiv.data("__flyoutVideoCaptions", flyOutVideoCaptions); 4345 myPlayerDiv.animate({"opacity":100},200,"swing",loadThumbnails); 4346 var myDefaultImageDiv = $('#gcui-header-player-wrapper #defaultimagediv'); 4347 myDefaultImageDiv.stop().animate({"opacity":100},200,"swing",null); 4348 return false; 4349 } 4350 }) 4351}; 4352/* 4353$(document).ready(function() { 4354 $("#button1").dfwSetupHeaderButton({ 4355 "box_coords" : [ 4356 [12,12], 4357 [255,15], 4358 [257,60], 4359 [222,60], 4360 [224,75], 4361 [28,83], 4362 [26,53], 4363 [12,53] 4364 ], 4365 "arrow_position" : [220,25], 4366 4367 }); 4368 if ($("#button2").css("width") != undefined) { 4369 $("#button2").dfwSetupHeaderButton({ 4370 "box_coords" : [ 4371 [18,15], 4372 [255,7], 4373 [257,45], 4374 [268,45], 4375 [266,80], 4376 [27,78], 4377 [27,63], 4378 [18,63] 4379 ], 4380 "arrow_position" : [220,45], 4381 4382 }); 4383 } 4384 if ($("#button3").css("width") != undefined) { 4385 $("#button3").dfwSetupHeaderButton({ 4386 "box_coords" : [ 4387 [12,12], 4388 [255,15], 4389 [257,60], 4390 [222,60], 4391 [224,75], 4392 [28,83], 4393 [26,53], 4394 [12,53] 4395 ], 4396 "arrow_position" : [220,25], 4397 }); 4398 } 4399 4400 $("#button1").click(function() { 4401 $(this).dfwRunClickEvent(); 4402 }); 4403 $("#button2").click(function() { 4404 $(this).dfwRunClickEvent(); 4405 }); 4406 $("#button3").click(function() { 4407 $(this).dfwRunClickEvent(); 4408 }); 4409 4410 $("#button1").hover(function() { 4411 $(this).css("cursor", "pointer"); 4412 $(this).dfwAnimateInHeaderButton(); 4413 }, function() { 4414 $(this).dfwAnimateOutHeaderButton(); 4415 }); 4416 $("#button2").hover(function() { 4417 $(this).css("cursor", "pointer"); 4418 $(this).dfwAnimateInHeaderButton(); 4419 }, function() { 4420 $(this).dfwAnimateOutHeaderButton(); 4421 }); 4422 $("#button3").hover(function() { 4423 $(this).css("cursor", "pointer"); 4424 $(this).dfwAnimateInHeaderButton(); 4425 }, function() { 4426 $(this).dfwAnimateOutHeaderButton(); 4427 }); 4428});*/; function urlParser(url) 4429 { 4430 if(url != undefined) this.parse(url); 4431 } 4432 4433 urlParser.prototype.protocol = window.location.protocol; 4434 urlParser.prototype.host = window.location.host; 4435 urlParser.prototype.path = window.location.pathname; 4436 urlParser.prototype.parameters = {}; 4437 urlParser.prototype.anchor = ''; 4438 4439 urlParser.prototype.baseUrl; 4440 4441 urlParser.prototype.setBaseUrl = function(url) 4442 { 4443 this.baseUrl = new urlParser(url); 4444 this.parse(); 4445 return this; 4446 } 4447 4448 urlParser.prototype.resetBaseUrl = function() 4449 { 4450 this.baseUrl = undefined; 4451 } 4452 4453 urlParser.prototype.reset = function() 4454 { 4455 4456 if(this.baseUrl != undefined) 4457 { 4458 this.protocol = this.baseUrl.protocol; 4459 this.host = this.baseUrl.host; 4460 this.path = this.baseUrl.path; 4461 } 4462 else 4463 { 4464 this.protocol = window.location.protocol; 4465 this.host = window.location.host; 4466 this.path = window.location.pathname; 4467 } 4468 4469 this.parameters = {}; 4470 this.anchor = ''; 4471 } 4472 4473 urlParser.prototype.parse = function(ref) 4474 { 4475 if(ref == undefined) ref = ''; 4476 4477 this.reset(); 4478 4479 var pos; 4480 4481 if((pos = ref.search(/\:/)) >= 0) 4482 { 4483 this.protocol = ref.substring(0, pos + 1); 4484 ref = ref.substring(pos + 1); 4485 } 4486 4487 if((pos = ref.search(/\#/)) >= 0) 4488 { 4489 this.anchor = ref.substring(pos + 1); 4490 ref = ref.substring(0, pos); 4491 } 4492 4493 if((pos = ref.search(/\?/)) >= 0) 4494 { 4495 var paramsStr = ref.substring(pos + 1) + '&'; 4496 ref = ref.substring(0, pos); 4497 while((pos = paramsStr.search(/\&/)) >= 0) 4498 { 4499 var paramStr = paramsStr.substring(0, pos); 4500 paramsStr = paramsStr.substring(pos + 1); 4501 4502 if(paramStr.length) 4503 { 4504 var equPos = paramStr.search(/\=/); 4505 if(equPos < 0) this.parameters[paramStr] = ''; 4506 else this.parameters[paramStr.substring(0, equPos)] = decodeURIComponent(paramStr.substring(equPos + 1)); 4507 } 4508 } 4509 } 4510 4511 if(ref.search(/\/\//) == 0) // absolute 4512 { 4513 ref = ref.substring(2); 4514 if((pos = ref.search(/\//)) >= 0) 4515 { 4516 this.host = ref.substring(0, pos); 4517 this.path = ref.substring(pos); 4518 } 4519 else 4520 { 4521 this.host = ref; 4522 this.path = '/'; 4523 } 4524 } 4525 else if(ref.search(/\//) == 0) // relative to host 4526 { 4527 this.path = ref; 4528 } 4529 4530 else // relative to directory 4531 { 4532 var p = this.path.lastIndexOf('/'); 4533 if(p < 0) this.path = '/'; 4534 else if(p < this.path.length - 1) this.path = this.path.substring(0, p + 1); 4535 4536 while(ref.search(/\.\.\//) == 0) 4537 { 4538 var p = this.path.lastIndexOf('/', this.path.lastIndexOf('/') - 1); 4539 if(p >= 0) this.path = this.path.substring(0, p + 1); 4540 ref = ref.substring(3); // removing '../' from begining 4541 } 4542 this.path = this.path + ref; 4543 } 4544 4545 return this; 4546 } 4547 4548 urlParser.prototype.assemble = function() 4549 { 4550 var ref = this.protocol + '//' + this.host + this.path; 4551 var div = '?'; 4552 for(var key in this.parameters) 4553 { 4554 ref += div + key + '=' + encodeURIComponent(this.parameters[key]); 4555 div = '&'; 4556 } 4557 return ref; 4558 } 4559 4560 jQuery.urlParser = new urlParser(); 4561;/* SWFObject v2.2 <http://code.google.com/p/swfobject/> 4562 is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 4563*/ 4564var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}
4564else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();;// JavaScript Document 4565// Handles lightbox resizing when window is resized 4566 4567 4568// Storing final sizes. 4569var finalHeight = 0; 4570var finalWidth = 0; 4571var lastResizedHeight = 0; 4572var lastResizedWidth = 0; 4573 4574// Storing current the timeoutID. 4575var timeoutID = 0; 4576 4577// Storing the IDs (in case we need them for resizing). 4578var scribd_book_id = ""; 4579var scribd_doc_id = ""; 4580var scribd_doc_key = ""; 4581var scribd_page_num = "1"; 4582 4583$(window).resize(function() { 4584 // IE fix 4585 if(document.all) { 4586 window.resizeEnd = (window.resizeEnd==null)?(new Object()):window.resizeEnd; 4587 clearTimeout(window.resizeEnd); 4588 window.resizeEnd = setTimeout(gcui_lightboxResize,1); 4589 } else { 4590 // Store the current sizes. 4591 4592 finalHeight = document.documentElement.clientHeight; 4593 finalWidth = document.documentElement.clientWidth; 4594 4595 // If there's no timeout going on, get it scheduled. 4596 if (timeoutID == 0) { 4597 //timeoutID = setTimeout(gcui_lightboxResize, 5); 4598 } 4599 } 4600}); 4601 4602function gcui_lightboxResize() { 4603 4604 // Check if this is the same size 4605 if (Math.abs(lastResizedHeight-document.documentElement.clientHeight) > 5 || Math.abs(lastResizedWidth-document.documentElement.clientWidth) > 5) { 4606 4607 // Check if the lightbox is on. 4608 //if (document.getElementById('lightbox').style.display == 'block') { 4609 4610 // Refresh the embedded viewer 4611 if (scribd_book_id != "") { 4612 $('#modalContainer').load('/gcui_book_viewer_scribd_viewer?' + gcui_getLightboxSizes_for_reader() + '&book_id=' + scribd_book_id + '&page_num=' + scribd_page_num); 4613 } else { 4614 $('#modalContainer').load('/gcui_book_viewer_scribd_viewer?' + gcui_getLightboxSizes_for_reader() + '&doc_id=' + scribd_doc_id + '&doc_key=' + scribd_doc_key + '&page_num=' + scribd_page_num); 4615 } 4616 4617 // Figure out the new measurements. 4618 baseWidth = Math.round(document.documentElement.clientWidth * 0.8); 4619 baseHeight = Math.round(document.documentElement.clientHeight * 0.8) - 66; 4620 if (baseWidth < 200) baseWidth = 200; 4621 if (baseHeight < 200) baseHeight = 200; 4622 4623 // Center the box vertically. 4624 $('#lightbox').css('top', Math.round(baseHeight * 0.1) + "px"); 4625 4626 // Apply the new measurements. 4627 $('#overlay').css('width', (document.documentElement.clientWidth)+ "px"); 4628 $('#outerImageContainer').css('width', (baseWidth+25)+ "px"); 4629 $('#outerImageContainer').css('height', (baseHeight+25) + "px"); 4630 //$('#frameContainer').css('width', (baseWidth+10)+ "px"); 4631 //$('#frameContainer').css('height', (baseHeight+10) + "px"); 4632 //$('#lightboxFrame').css('width', baseWidth + "px"); 4633 //$('#lightboxFrame').css('height', baseHeight + "px"); 4634 $('#imageDataContainer').css('width', (baseWidth+25) + "px"); 4635 $('#imageData').css('width', (baseWidth+25) + "px"); 4636 $('#bottomNav').css('width', (baseWidth+10) + "px"); 4637 4638 $('#modalContainer').css('width', (baseWidth+10)+ "px"); 4639 $('#modalContainer').css('height', (baseHeight+10) + "px"); 4640 4641 lastResizedHeight = document.documentElement.clientHeight; 4642 lastResizedWidth = document.documentElement.clientWidth; 4643 //} 4644 } 4645 4646 timeoutID = 0; 4647} 4648 4649function gcui_getLightboxSizes() { 4650 return('width:' + (Math.round(document.documentElement.clientWidth * 0.8)+10) + 'px; height:' + (Math.round(document.documentElement.clientHeight * 0.8)-56) + 'px'); 4651} 4652 4653function gcui_getLightboxSizes_for_reader() { 4654 return('width=' + Math.round(document.documentElement.clientWidth * 0.8) + '&height=' + (Math.round(document.documentElement.clientHeight * 0.8)-66)); 4655} 4656 4657function gcui_embedScribdReader(book_id, page_num, title, link_text) { 4658 scribd_page_num = page_num; 4659 scribd_book_id = book_id; 4660 document.writeln('<a rel="lightmodal[|' + gcui_getLightboxSizes() + '; scrolling: auto;][' + title + ']" href="/gcui_book_viewer_scribd_viewer?' + gcui_getLightboxSizes_for_reader() + '&book_id=' + scribd_book_id + '&page_num=' + scribd_page_num +'">'); 4661 document.writeln(link_text); 4662 document.writeln('</a>'); 4663} 4664 4665function gcui_embedScribdReader_lang(book_id, page_num, title, link_text, lang) { 4666 scribd_page_num = page_num; 4667 scribd_book_id = book_id; 4668 var lang_prefix = lang; 4669 if (lang_prefix == '' || lang_prefix == 'en') { 4670 lang_prefix = ''; 4671 } else { 4672 lang_prefix = '/' + lang_prefix; 4673 } 4674 4675 document.writeln('<a rel="lightmodal[|' + gcui_getLightboxSizes() + '; scrolling: auto;][' + title + ']" href="' + lang_prefix + '/gcui_book_viewer_scribd_viewer?' + gcui_getLightboxSizes_for_reader() + '&book_id=' + scribd_book_id + '&page_num=' + scribd_page_num +'">'); 4676 document.writeln(link_text); 4677 document.writeln('</a>'); 4678} 4679 4680function gcui_embedGoogleReader(book_id, page_num, title, link_text, lang, nid) { 4681 scribd_page_num = page_num; 4682 scribd_book_id = book_id; 4683 var lang_prefix = lang; 4684 if (lang_prefix == '' || lang_prefix == 'en') { 4685 lang_prefix = ''; 4686 } else { 4687 lang_prefix = '/' + lang_prefix; 4688 } 4689 document.writeln('<a rel="lightframe[|' + gcui_getLightboxSizes() + '; scrolling: auto;][' + title + ']" href="/gcui-google-doc-viewer.action?url=/sites/default/files/booklets/split/' + scribd_book_id + '_' + nid + '-' + lang + '.pdf&embedded=true">'); 4690 4691 document.writeln(link_text); 4692 document.writeln('</a>'); 4693} 4694 4695function gcui_embed_custom_reader(book_id, page_num, title, link_text, lang, nid) { 4696 scribd_page_num = page_num; 4697 scribd_book_id = book_id; 4698 var lang_prefix = lang; 4699 if (lang_prefix == '' || lang_prefix == 'en') { 4700 lang_prefix = ''; 4701 } else { 4702 lang_prefix = '/' + lang_prefix; 4703 } 4704 4705 var window_height = $(window).height(); 4706 var window_width = $(window).width(); 4707 4708 // [|' + gcui_getLightboxSizes() + '; scrolling: auto;][' + title + '] 4709 // gcui_getLightboxSizes_for_reader() 4710 var custom_html = '<a rel="gcui_custom_frame" href="' + lang_prefix + '/gcui_book_viewer_scribd_viewer?height=' + (window_height-120) + 4711 '&width=' + (window_width-120) + '&book_id=' + scribd_book_id + '&page_num=' + scribd_page_num +'">'; 4712 custom_html += link_text; 4713 custom_html += '</a>'; 4714 4715 return custom_html; 4716} 4717 4718 4719/** 4720 * Our very own lightbox-like popup widget. To use it, define elements like this: 4721 * 4722 * <a rel="gcui_custom_frame" href="[URL_goes_here]"> 4723 * 4724 * and call the init function in document.ready, like: 4725 * 4726 * $(document).ready(function() { 4727 * gcui_custom_frame_init(); 4728 * }); 4729 * 4730 */ 4731function gcui_custom_frame_init() { 4732 4733 $('a[rel="gcui_custom_frame"]').each(function() { 4734 4735 $(this).click(function(e) { 4736 e.preventDefault(); 4737 4738 // remove any leftover frames still around 4739 $('#gcui_custom_frame_overlay').remove(); 4740 $('#gcui_custom_frame').remove(); 4741 4742 if ($.browser.msie) { 4743 if ($.browser.version.indexOf('8.') > -1) { 4744 // IE 8 4745 } else { 4746 if ($.browser.version.indexOf('7.') > -1) { 4747 // IE 7 4748 $("html").css("overflow", "hidden"); 4749 } else { 4750 $("body").css("overflow", "hidden"); 4751 } 4752 } 4753 } else { 4754 $("body").css("overflow", "hidden"); 4755 } 4756 4757 var window_height = $(window).height(); 4758 var window_width = $(window).width(); 4759 var document_height = $(document).height(); 4760 var document_width = $(document).width(); 4761 4762 // get the overlay there 4763 $('body').prepend('<div id="gcui_custom_frame_overlay"></div>'); 4764 $('#gcui_custom_frame_overlay').css('position', 'absolute').css('width', document_width + 'px').css('height', document_height + 'px'); 4765 $('#gcui_custom_frame_overlay').css('z-index', 20000).css('opacity', 0).css('background-color', 'black'); 4766 $('#gcui_custom_frame_overlay').animate({opacity: 0.7}); 4767 4768 // get the container box there 4769 $('body').prepend('<div id="gcui_custom_frame"></div>'); 4770 $('#gcui_custom_frame').css('position', 'fixed').css('top', 50).css('left', 50).css('width', (window_width-100) + 'px'); 4771 $('#gcui_custom_frame').css('height', (window_height-100) + 'px').css('z-index', 20001).css('background-color', 'white'); 4772 4773 // put an iframe in the box with the contents 4774 $('#gcui_custom_frame').append('<div id="gcui_custom_frame_iframe"><iframe width="100%" height="100%" ' + 4775 ' src="' + $(this).attr('href') + '">'); 4776 $('#gcui_custom_frame_iframe').css('width', (window_width-100) + 'px'); 4777 $('#gcui_custom_frame_iframe').css('height', (window_height-100) + 'px'); 4778 4779 // add close button 4780 $('#gcui_custom_frame').append('<div id="gcui_custom_frame_close"><a href="#">CLOSE</a></div>'); 4781 $('#gcui_custom_frame_close a').css('position', 'fixed').css('right', '50px').css('top', '30px').css('color', 'white') 4782
4783 // onclick for the overlay 4784 $('#gcui_custom_frame_close a').click(function(e) { 4785 e.preventDefault(); 4786 gcui_custom_frame_close(); 4787 return false; 4788 }); 4789 4790 return false; 4791 }); 4792 }); 4793 4794 $(window).resize(function() { 4795 4796 // only do something if we've got a lightbox 4797 var is_lightbox = $('#gcui_custom_frame_overlay').length; 4798 if (is_lightbox == 0) { 4799 // no lightbox 4800 return; 4801 } 4802 4803 var window_height = $(window).height(); 4804 var window_width = $(window).width(); 4805 var document_height = $(document).height(); 4806 var document_width = $(document).width(); 4807 4808 // resize the container and the overlay 4809 $('#gcui_custom_frame_overlay').css('width', document_width + 'px').css('height', document_height + + 'px'); 4810 $('#gcui_custom_frame').css('height', (window_height-100) + 'px').css('width', (window_width-100) + 'px'); 4811 4812 // remove the iframe 4813 $('#gcui_custom_frame_iframe').remove(); 4814 4815 // @HACK: call again the original link generating function, have it output a fake link and use the href from it 4816 var my_new_a_tag = gcui_crs_get_reader(); 4817 $('body').append('<div id="gcui_custom_frame_iframe_temp">' + my_new_a_tag + '</div>'); 4818 var my_link = $('#gcui_custom_frame_iframe_temp a').attr('href'); 4819 $('#gcui_custom_frame_iframe_temp').remove(); 4820 4821 // make the new iframe 4822 $('#gcui_custom_frame').append('<div id="gcui_custom_frame_iframe"><iframe width="100%" height="100%" ' + 4823 ' src="' + my_link + '">'); 4824 $('#gcui_custom_frame_iframe').css('width', (window_width-100) + 'px'); 4825 $('#gcui_custom_frame_iframe').css('height', (window_height-100) + 'px'); 4826 }); 4827 4828 4829} 4830 4831function gcui_custom_frame_close() { 4832 $('#gcui_custom_frame_iframe').remove(); 4833 $('#gcui_custom_frame').fadeOut(200, function() { 4834 $('#gcui_custom_frame_overlay').fadeOut(200, function() { 4835 // get the browser scrollbars back on 4836 // for some unknown reason, this (jQuery) errors on IEs, but does recover the scrollbar, 4837 // so an elegant handling is to swallow the error 4838 if ($.browser.msie) { 4839 if ($.browser.version.indexOf('8.') > -1) { 4840 // IE 8 4841 } else { 4842 if ($.browser.version.indexOf('7.') > -1) { 4843 // IE 7 4844 $("html").css("overflow", "auto"); 4845 } else { 4846 $("body").css("overflow", "auto"); 4847 } 4848 } 4849 } else { 4850 $("body").css("overflow", "auto"); 4851 } 4852 4853 }); 4854 }); 4855} 4856;/*! 4857 * jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010 4858 * http://benalman.com/projects/jquery-dotimeout-plugin/ 4859 * 4860 * Copyright (c) 2010 "Cowboy" Ben Alman 4861 * Dual licensed under the MIT and GPL licenses. 4862 * http://benalman.com/about/license/ 4863 */ 4864 4865// Script: jQuery doTimeout: Like setTimeout, but better! 4866// 4867// *Version: 1.0, Last updated: 3/3/2010* 4868// 4869// Project Home - http://benalman.com/projects/jquery-dotimeout-plugin/ 4870// GitHub - http://github.com/cowboy/jquery-dotimeout/ 4871// Source - http://github.com/cowboy/jquery-dotimeout/raw/master/jquery.ba-dotimeout.js 4872// (Minified) - http://github.com/cowboy/jquery-dotimeout/raw/master/jquery.ba-dotimeout.min.js (1.0kb) 4873// 4874// About: License 4875// 4876// Copyright (c) 2010 "Cowboy" Ben Alman, 4877// Dual licensed under the MIT and GPL licenses. 4878// http://benalman.com/about/license/ 4879// 4880// About: Examples 4881// 4882// These working examples, complete with fully commented code, illustrate a few 4883// ways in which this plugin can be used. 4884// 4885// Debouncing - http://benalman.com/code/projects/jquery-dotimeout/examples/debouncing/ 4886// Delays, Polling - http://benalman.com/code/projects/jquery-dotimeout/examples/delay-poll/ 4887// Hover Intent - http://benalman.com/code/projects/jquery-dotimeout/examples/hoverintent/ 4888// 4889// About: Support and Testing 4890// 4891// Information about what version or versions of jQuery this plugin has been 4892// tested with, what browsers it has been tested in, and where the unit tests 4893// reside (so you can test it yourself). 4894// 4895// jQuery Versions - 1.3.2, 1.4.2 4896// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1. 4897// Unit Tests - http://benalman.com/code/projects/jquery-dotimeout/unit/ 4898// 4899// About: Release History 4900// 4901// 1.0 - (3/3/2010) Callback can now be a string, in which case it will call 4902// the appropriate $.method or $.fn.method, depending on where .doTimeout 4903// was called. Callback must now return `true` (not just a truthy value) 4904// to poll. 4905// 0.4 - (7/15/2009) Made the "id" argument optional, some other minor tweaks 4906// 0.3 - (6/25/2009) Initial release 4907 4908(function($){ 4909 '$:nomunge'; // Used by YUI compressor. 4910 4911 var cache = {}, 4912 4913 // Reused internal string. 4914 doTimeout = 'doTimeout', 4915 4916 // A convenient shortcut. 4917 aps = Array.prototype.slice; 4918 4919 // Method: jQuery.doTimeout 4920 // 4921 // Initialize, cancel, or force execution of a callback after a delay. 4922 // 4923 // If delay and callback are specified, a doTimeout is initialized. The 4924 // callback will execute, asynchronously, after the delay. If an id is 4925 // specified, this doTimeout will override and cancel any existing doTimeout 4926 // with the same id. Any additional arguments will be passed into callback 4927 // when it is executed. 4928 // 4929 // If the callback returns true, the doTimeout loop will execute again, after 4930 // the delay, creating a polling loop until the callback returns a non-true 4931 // value. 4932 // 4933 // Note that if an id is not passed as the first argument, this doTimeout will 4934 // NOT be able to be manually canceled or forced. (for debouncing, be sure to 4935 // specify an id). 4936 // 4937 // If id is specified, but delay and callback are not, the doTimeout will be 4938 // canceled without executing the callback. If force_mode is specified, the 4939 // callback will be executed, synchronously, but will only be allowed to 4940 // continue a polling loop if force_mode is true (provided the callback 4941 // returns true, of course). If force_mode is false, no polling loop will 4942 // continue, even if the callback returns true. 4943 // 4944 // Usage: 4945 // 4946 // > jQuery.doTimeout( [ id, ] delay, callback [, arg ... ] ); 4947 // > jQuery.doTimeout( id [, force_mode ] ); 4948 // 4949 // Arguments: 4950 // 4951 // id - (String) An optional unique identifier for this doTimeout. If id is 4952 // not specified, the doTimeout will NOT be able to be manually canceled or 4953 // forced. 4954 // delay - (Number) A zero-or-greater delay in milliseconds after which 4955 // callback will be executed. 4956 // callback - (Function) A function to be executed after delay milliseconds. 4957 // callback - (String) A jQuery method to be executed after delay 4958 // milliseconds. This method will only poll if it explicitly returns 4959 // true. 4960 // force_mode - (Boolean) If true, execute that id's doTimeout callback 4961 // immediately and synchronously, continuing any callback return-true 4962 // polling loop. If false, execute the callback immediately and 4963 // synchronously but do NOT continue a callback return-true polling loop. 4964 // If omitted, cancel that id's doTimeout. 4965 // 4966 // Returns: 4967 // 4968 // If force_mode is true, false or undefined and there is a 4969 // yet-to-be-executed callback to cancel, true is returned, but if no 4970 // callback remains to be executed, undefined is returned. 4971 4972 $[doTimeout] = function() { 4973 return p_doTimeout.apply( window, [ 0 ].concat( aps.call( arguments ) ) ); 4974 }; 4975 4976 // Method: jQuery.fn.doTimeout 4977 // 4978 // Initialize, cancel, or force execution of a callback after a delay. 4979 // Operates like <jQuery.doTimeout>, but the passed callback executes in the 4980 // context of the jQuery collection of elements, and the id is stored as data 4981 // on the first element in that collection. 4982 // 4983 // If delay and callback are specified, a doTimeout is initialized. The 4984 // callback will execute, asynchronously, after the delay. If an id is 4985 // specified, this doTimeout will override and cancel any existing doTimeout 4986 // with the same id. Any additional arguments will be passed into callback 4987 // when it is executed. 4988 // 4989 // If the callback returns true, the doTimeout loop will execute again, after 4990 // the delay, creating a polling loop until the callback returns a non-true 4991 // value. 4992 // 4993 // Note that if an id is not passed as the first argument, this doTimeout will 4994 // NOT be able to be manually canceled or forced (for debouncing, be sure to 4995 // specify an id). 4996 // 4997 // If id is specified, but delay and callback are not, the doTimeout will be 4998 // canceled without executing the callback. If force_mode is specified, the 4999 // callback will be executed, synchronously, but will only be allowed to 5000 // continue a polling loop if force_mode is true (provided the callback 5001 // returns true, of course). If force_mode is false, no polling loop will 5002 // continue, even if the callback returns true. 5003 // 5004 // Usage: 5005 // 5006 // > jQuery('selector').doTimeout( [ id, ] delay, callback [, arg ... ] ); 5007 // > jQuery('selector').doTimeout( id [, force_mode ] ); 5008 // 5009 // Arguments: 5010 // 5011 // id - (String) An optional unique identifier for this doTimeout, stored as 5012 // jQuery data on the element. If id is not specified, the doTimeout will 5013 // NOT be able to be manually canceled or forced. 5014 // delay - (Number) A zero-or-greater delay in milliseconds after which 5015 // callback will be executed. 5016 // callback - (Function) A function to be executed after delay milliseconds. 5017 // callback - (String) A jQuery.fn method to be executed after delay 5018 // milliseconds. This method will only poll if it explicitly returns 5019 // true (most jQuery.fn methods return a jQuery object, and not `true`, 5020 // which allows them to be chained and prevents polling). 5021 // force_mode - (Boolean) If true, execute that id's doTimeout callback 5022 // immediately and synchronously, continuing any callback return-true 5023 // polling loop. If false, execute the callback immediately and 5024 // synchronously but do NOT continue a callback return-true polling loop. 5025 // If omitted, cancel that id's doTimeout. 5026 // 5027 // Returns: 5028 // 5029 // When creating a <jQuery.fn.doTimeout>, the initial jQuery collection of 5030 // elements is returned. Otherwise, if force_mode is true, false or undefined 5031 // and there is a yet-to-be-executed callback to cancel, true is returned, 5032 // but if no callback remains to be executed, undefined is returned. 5033 5034 $.fn[doTimeout] = function() { 5035 var args = aps.call( arguments ), 5036 result = p_doTimeout.apply( this, [ doTimeout + args[0] ].concat( args ) ); 5037 5038 return typeof args[0] === 'number' || typeof args[1] === 'number' 5039 ? this 5040 : result; 5041 }; 5042 5043 function p_doTimeout( jquery_data_key ) { 5044 var that = this, 5045 elem, 5046 data = {}, 5047 5048 // Allows the plugin to call a string callback method. 5049 method_base = jquery_data_key ? $.fn : $, 5050 5051 // Any additional arguments will be passed to the callback. 5052 args = arguments, 5053 slice_args = 4, 5054 5055 id = args[1], 5056 delay = args[2], 5057 callback = args[3]; 5058 5059 if ( typeof id !== 'string' ) { 5060 slice_args--; 5061 5062 id = jquery_data_key = 0; 5063 delay = args[1]; 5064 callback = args[2]; 5065 } 5066 5067 // If id is passed, store a data reference either as .data on the first
5068 // element in a jQuery collection, or in the internal cache. 5069 if ( jquery_data_key ) { // Note: key is 'doTimeout' + id 5070 5071 // Get id-object from the first element's data, otherwise initialize it to {}. 5072 elem = that.eq(0); 5073 elem.data( jquery_data_key, data = elem.data( jquery_data_key ) || {} ); 5074 5075 } else if ( id ) { 5076 // Get id-object from the cache, otherwise initialize it to {}. 5077 data = cache[ id ] || ( cache[ id ] = {} ); 5078 } 5079 5080 // Clear any existing timeout for this id. 5081 data.id && clearTimeout( data.id ); 5082 delete data.id; 5083 5084 // Clean up when necessary. 5085 function cleanup() { 5086 if ( jquery_data_key ) { 5087 elem.removeData( jquery_data_key ); 5088 } else if ( id ) { 5089 delete cache[ id ]; 5090 } 5091 }; 5092 5093 // Yes, there actually is a setTimeout call in here! 5094 function actually_setTimeout() { 5095 data.id = setTimeout( function(){ data.fn(); }, delay ); 5096 }; 5097 5098 if ( callback ) { 5099 // A callback (and delay) were specified. Store the callback reference for 5100 // possible later use, and then setTimeout. 5101 data.fn = function( no_polling_loop ) { 5102 5103 // If the callback value is a string, it is assumed to be the name of a 5104 // method on $ or $.fn depending on where doTimeout was executed. 5105 if ( typeof callback === 'string' ) { 5106 callback = method_base[ callback ]; 5107 } 5108 5109 callback.apply( that, aps.call( args, slice_args ) ) === true && !no_polling_loop 5110 5111 // Since the callback returned true, and we're not specifically 5112 // canceling a polling loop, do it again! 5113 ? actually_setTimeout() 5114 5115 // Otherwise, clean up and quit. 5116 : cleanup(); 5117 }; 5118 5119 // Set that timeout! 5120 actually_setTimeout(); 5121 5122 } else if ( data.fn ) { 5123 // No callback passed. If force_mode (delay) is true, execute the data.fn 5124 // callback immediately, continuing any callback return-true polling loop. 5125 // If force_mode is false, execute the data.fn callback immediately but do 5126 // NOT continue a callback return-true polling loop. If force_mode is 5127 // undefined, simply clean up. Since data.fn was still defined, whatever 5128 // was supposed to happen hadn't yet, so return true. 5129 delay === undefined ? cleanup() : data.fn( delay === false ); 5130 return true; 5131 5132 } else { 5133 // Since no callback was passed, and data.fn isn't defined, it looks like 5134 // whatever was supposed to happen already did. Clean up and quit! 5135 cleanup(); 5136 } 5137 5138 }; 5139 5140})(jQuery); 5141;(function($) { 5142 $.fn.gcuiSwfObjEmbed = function(aSwf,aSettings) { 5143 if (aSwf) { 5144 var myConfig = {}; 5145 $.each($.fn.gcuiSwfObjEmbed.defaults,function(k,v) { 5146 // NOTE: jQuery.extend() doesn't copy properties, 5147 // may work in jQuery 1.4, but we're on 1.3.2 5148 // copy default 5149 // http://jquery14.com/day-01/jquery-14 5150 var mySub = {}; 5151 for (var p in v) { 5152 mySub[p] = v[p]; 5153 } 5154 // on the copy overwrite the defaults with the specific settings 5155 for (var p in aSettings[k]) { 5156 mySub[p] = aSettings[k][p]; 5157 } 5158 // assign to myConfig 5159 myConfig[k] = mySub; 5160 }); 5161 this.each(function() { 5162 myConfig.attributes.id = $(this).attr('id'); 5163 if (myConfig.attributes.id == '') { 5164 gcui_log('ID of div missing, cannot embed video'); 5165 gcui_log(this); 5166 gcui_log($(this)); 5167 } 5168 swfobject.embedSWF( 5169 aSwf, myConfig.attributes.id, myConfig.config.width, 5170 myConfig.config.height, myConfig.config.requiredVersion, 5171 myConfig.config.alternativeSwf, 5172 myConfig.flashvars, myConfig.params, myConfig.attributes 5173 ); 5174 }); 5175 } else { 5176 console.log('aSwf not passed in'); 5177 } 5178 return this; 5179 }; 5180 $.fn.gcuiSwfObjEmbed.defaults = { 5181 config : { 5182 height : '360', 5183 width: '640', 5184 requiredVersion : '8.0.0', 5185 alternativeSwf : 'expressInstall.swf' 5186 }, 5187 params :{ 5188 quality: "high", 5189 scale: "noscale", 5190 wmode: "transparent", 5191 allowscriptaccess: "always", 5192 allowFullScreen: "true", 5193 bgcolor: "#000000" 5194 }, 5195 flashvars : { 5196 fullLocale:"en_US", 5197 locale:"en", 5198 cdnPath:"", 5199 localPath:"", 5200 trackerCode:"", 5201 configuration:"production", 5202 sharedAssetPath:"/assets/", 5203 siteAssetPath: "/assets/", 5204 sharedDataPath: "/en/sdata/", 5205 siteDataPath: "/data/", 5206 siteStylesPath: "/data/styles/", 5207 siteRootPath: "/", 5208 infoRequestUrl: "http://contact2.firechrome.org/inquiry.action", 5209 siteXML:"/site.xml", 5210 localePostfix: "", 5211 region: "US", 5212 autoplay: "true" 5213 }, 5214 attributes : {} 5215 }; 5216 5217 $.createElement = function(aEl,innerHtml,aClose,attrs) { 5218 var r = ['<', aEl,' ']; 5219 for(var k in attrs) { 5220 r.push(k); 5221 r.push('="'); 5222 r.push($.isArray(attrs[k]) ? attrs[k].join(' ') : attrs[k]); 5223 r.push('" '); 5224 5225 } 5226 r.push('>'); 5227 r.push(innerHtml); 5228 if(aClose) { 5229 r.push('</'); 5230 r.push(aEl); 5231 r.push('>'); 5232 } 5233 return r.join(''); 5234 }; 5235 5236 $.fn.gcuiSlideShow = function(aId,aImages,aSettings) { 5237 var config = {}; 5238 if (settings) $.extend(config, settings); 5239 this.each(function() {}); 5240 return this; 5241 }; 5242 5243 $.gcuiDataClone = function(aTarget,aSources) { 5244 // NOTE: jQuery.extend() doesn't copy properties we're on 1.3.2 5245 // http://jquery14.com/day-01/jquery-14 5246 var mySources = $.makeArray(aSources) 5247 $.each(mySources,function(i,v) { 5248 for (var p in v) { 5249 aTarget[p] = v[p]; 5250 } 5251 }); 5252 return aTarget; 5253 }; 5254 $.intRange = function(aFrom,aTo,aMin,aMax,aDir) { 5255 var myF = parseInt(aFrom); 5256 var myT = parseInt(aTo); 5257 var myMin = parseInt(aMin); 5258 var myMax = parseInt(aMax); 5259 if(myF==myT) return []; 5260 var r = [myF]; 5261 var myInc = aDir==null?myF < myT:aDir; 5262 var i = myF; 5263 while(i!=myT) { 5264 r.push(i = $.increment(i,myMin,myMax,myInc)); 5265 //if(i) {break;}//Avoid infinite loops 5266 } 5267 return r; 5268 }; 5269 $.increment = function(aFrom,aMin,aMax,aDir) { 5270 var i = aDir ? ++aFrom : --aFrom; 5271 if(i > aMax) return aMin; 5272 if(i < aMin) return aMax; 5273 return i; 5274 }; 5275 $.getAt = function(aObj,aParams) { 5276 var r = null; 5277 $.each(aParams,function(){ 5278 if(aObj[this]) r=aObj[this]; 5279 }); 5280 return r; 5281 }; 5282 5283 $.fn.customFadeIn = function(speed, callback) { 5284 return $(this).fadeIn($.support.opacity ? speed : 1,callback); 5285 }; 5286 $.fn.customFadeOut = function(speed, callback) {
5287 return $(this).fadeOut($.support.opacity ? speed : 1,callback); 5288 }; 5289 5290 $.getHost = function() { 5291 var h = new String(document.location); 5292 return h.replace(/http:\/\/([^\/]*)\/.*/,'$1'); 5293 }; 5294 5295 /** 5296 * Find out if certain support exists 5297 */ 5298 $.gcuiSupports = function(features) { 5299 var ret = true; 5300 if (features.canvas) { 5301 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { 5302 return false; 5303 } 5304 } 5305 if (features.basic_html5) { 5306 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { 5307 return false; 5308 } 5309 if (/Version\/3\.[0-9. ]+ Safari\//.test(navigator.userAgent)) { 5310 return false; 5311 } 5312 if (/Version\/3\.[0-9. ]+ Mobile\//.test(navigator.userAgent)) { 5313 return false; 5314 } 5315 if (/Firefox\/[1-2]\.[0-9]/.test(navigator.userAgent)) { 5316 return false; 5317 } 5318 if (/Firefox\/3\.0/.test(navigator.userAgent)) { 5319 return false; 5320 } 5321 if (/iPad/.test(navigator.userAgent)) { 5322 return false; 5323 } 5324 if (/iPhone/.test(navigator.userAgent)) { 5325 return false; 5326 } 5327 /*if (/Version\/4\.[0-9. ]+ Mobile\//.test(navigator.userAgent)) { 5328 return false; 5329 } */ 5330 } 5331 return ret; 5332 }; 5333 $.gcuiSupportsNativeCanvasText = function(supports) { 5334 var ret = true; 5335 if (supports.supportsCanvasText) { 5336 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { 5337 return false; 5338 } 5339 if (/Version\/3\.[0-9. ]+ Safari\//.test(navigator.userAgent)) { 5340 return false; 5341 } 5342 if (/Version\/3\.[0-9. ]+ Mobile\//.test(navigator.userAgent)) { 5343 return false; 5344 } 5345 if (/Version\/4\.[0-9. ]+ Mobile\//.test(navigator.userAgent)) { 5346 return false; 5347 } 5348 } 5349 return ret; 5350 } 5351 5352 5353})(jQuery); 5354 5355if(!console) { 5356 var console = {log : function(){}}; 5357} 5358 5359if (typeof $.fn.delay != 'function') { 5360 $.fn.delay = function(time, callback){ 5361 jQuery.fx.step.delay = function(){}; 5362 return this.animate({delay:1}, time, callback); 5363 } 5364} 5365 5366 5367 5368 5369;function _slideShowGetDir() { 5370 var myDirVal = $('html').attr('dir') + ''; 5371 if (!myDirVal) { 5372 myDirVal = 'ltr'; 5373 } 5374 return myDirVal; 5375} 5376 5377function SlideShow(aRoot,aImages,aTitle,aLinks,aConfigs) { 5378 this.root = aRoot; 5379 this.images = aImages; 5380 this.title = aTitle; 5381 this.links = aLinks; 5382 this.styles = {}; 5383 this.slideStarted = false; 5384 this.config = $.gcuiDataClone({ 5385 timer: false, 5386 stylePrefix : 'slideshow', 5387 changeSlideAnimation : 'changeSlide_fadeInPlace', 5388 featuredLinksMode : false, 5389 visibleSlides : 5 5390 },aConfigs); 5391 SlideShow.slideshows[this.root] = this; 5392}; 5393SlideShow.slideshows = {}; 5394 5395SlideShow.prototype.stopSlideShow = function(aCallback) { 5396 if(this.slideTimeout) window.clearTimeout(this.slideTimeout); 5397 this.slideStarted = false; 5398 $(this.getCSSCls('active-slide-image')).removeClass(this.getCSS('active-slide-image')).data('slideshow',this).fadeOut('slow',aCallback); 5399} 5400SlideShow.prototype.closeSlideShow = function(aCallback) { 5401 if(this.slideTimeout) window.clearTimeout(this.slideTimeout); 5402 $(this.getCSSCls('active-slide-image')).fadeOut('slow').removeClass(this.getCSS('active-slide-image')); 5403 $(this.getCSSCls('slide-text-pane')).data('slideshow',this).fadeOut('slow',aCallback); 5404 this.slideStarted = true; 5405}; 5406SlideShow.prototype.startSlides = function() {this.changeSlide(0);}; 5407SlideShow.prototype.changeSlide_fadeInPlace = function(aImgIndex) { 5408 var myImgIndex = aImgIndex; 5409 var myActiveSlide = $(this.getCSSCls('active-slide-image')); 5410 if(aImgIndex == '-1') { 5411 myImgIndex = $(this.getCSSCls('active-slide-image')).data('i') -1; 5412 } else if(aImgIndex == '+1') { 5413 myImgIndex = ((myActiveSlide.data('i') > -1)?myActiveSlide.data('i') : 0) +1; 5414 } 5415 5416 if(myImgIndex < 0 || myImgIndex >= this.images.length) return; 5417 5418 var myImgData = this.images[myImgIndex]; 5419 var slideTextPaneCls = this.getCSSCls('slide-text-pane'); 5420 var activeImage = this.getCSS('active-slide-image'); 5421 5422 $(this.getCSSCls('active-slide-image')).customFadeOut('slow').removeClass(activeImage); 5423 $(this.getCSSCls('slide-image')+'-'+myImgIndex).customFadeIn('slow').addClass(activeImage); 5424 $(slideTextPaneCls).customFadeOut('fast',function(e) { 5425 if(myImgData) { 5426 var myText = $.getAt(myImgData,['text','title']); 5427 $(slideTextPaneCls).html(myText).customFadeIn('slow'); // Set the text 5428 } 5429 });
5430}; 5431 5432SlideShow.prototype.changeSlide_carousel = function(aImgIndex) { 5433 // Get active slide 5434 var myActive = $(this.getCSSCls('active-slide-image')); 5435 var mySlideCls = this.getCSSCls('slide-image'); 5436 5437 // Add missing images to stage 5438 function addToStage(aDiv,aUnit,aDir) { 5439 var myCSS = {}; 5440 var myDir = aDir ? -1 : 1; 5441 for(aProp in aUnit) { 5442 myCSS[aProp] = (aUnit[aProp]*2*myDir)+'px'; 5443 } 5444 aDiv.css(myCSS).show(); 5445 } 5446 5447 // Function to move all the given images 5448 function move(aInd,aUnit,aDir,aPre,aNumTimes) { 5449 var myDir = aDir ? '+=' : '-='; 5450 var myAnim = {}; 5451 for(aProp in aUnit) { 5452 myAnim[aProp] = myDir + aUnit[aProp]+'px'; 5453 } 5454 var mySelectors = []; 5455 $.each($.makeArray(aInd),function(i,v) { 5456 mySelectors.push(aPre+'-'+v); 5457 }); 5458 5459 $(mySelectors.join(',')).each(function(v) { 5460 if($(this).css('display') == 'none') { 5461 addToStage($(this),aUnit,aDir) 5462 }; 5463 }); 5464 5465 if(aNumTimes > 1) move(aInd,aUnit,aDir,aPre,(aNumTimes-1)); 5466 mySelection = $(mySelectors.join(',')).animate(myAnim).each(function(e){ 5467 for(aProp in aUnit) { 5468 myCSS[aProp] == (aUnit[aProp]*2*myDir); 5469 } 5470 5471 }); 5472 5473 } 5474 5475 // No image means first time 5476 if(myActive.length == 0) { 5477 if(this.images.length < 5) { 5478 $(this.rootId).hide(); 5479 return; 5480 } 5481 5482 var myUnit = this.config.carousel.unit; 5483 move(0,myUnit,false,mySlideCls); 5484 move(1,myUnit,false,mySlideCls,2).addClass(this.getCSS('active-slide-image')); 5485 move(2,myUnit,false,mySlideCls,3); 5486 return; 5487 } 5488 5489 // Next img to focus on 5490 var myImgIndex = parseInt(aImgIndex); 5491 // The last img 5492 var myImgMax = this.images.length -1; 5493 // Last active index 5494 var myLastIndex = myActive.data('i'); 5495 // The range of indexs to go through 5496 var myChangeRange = $.intRange(myLastIndex,aImgIndex,0,myImgMax,true); 5497 5498 // Get the direction 5499 var myDir = myChangeRange[0] < myChangeRange[1]; 5500 5501 // Go through each image in the range and perform all operations 5502 for(var myImgI in myChangeRange) { 5503 var myL = $.increment(myImgI,0,myImgMax,false); 5504 var myR = $.increment(myImgI,0,myImgMax,true); 5505 var myImgIs = [myL,myImgI,myR]; 5506 var myLastI = null; 5507 if(myDir) { 5508 myLastI=$.increment(myR,0,myImgMax,true) 5509 myImgIs.push(myLastI); 5510 } else { 5511 myLastI=$.increment(myL,0,myImgMax,false); 5512 myImgIs.unshift(myLastI); 5513 } 5514 move(myImgIs,this.config.carousel.unit,myDir,this.getCSSCls('slide-image')); 5515 } 5516 5517 myActive.removeClass(activeImage); 5518 $(this.getCSSCls('slide-image')+'-'+aImgIndex).addClass(activeImage); 5519 5520 var slideTextPaneCls = this.getCSSCls('slide-text-pane'); 5521 var myImgData = this.images[myImgIndex]; 5522 $(slideTextPaneCls).fadeOut('fast',function(e) { 5523 var myText = $.getAt(myImgData,['text','title']); 5524 $(slideTextPaneCls).html(myText).fadeIn('slow'); // Set the text 5525 }); 5526}; 5527 5528SlideShow.prototype.changeSlide = function(aImgIndex) { 5529 if(!this.slideStarted) { 5530 this.slideStarted = true; 5531 this.closeVideoPlayer({'data' : {'slideshow' :this, 'slide' : aImgIndex}}); 5532 return; 5533 }; 5534 this[this.config['changeSlideAnimation']](aImgIndex); 5535 5536 // Handle controls 5537 if(this.images.length > 1) { 5538 // Timer 5539 if(this.config.timer) { 5540 var nextSlide = aImgIndex+1==this.images.length?0:aImgIndex+1; 5541 if(this.slideTimeout) window.clearTimeout(this.slideTimeout); 5542 this.slideTimeout = window.setTimeout('SlideShow.slideshows["' + this.root + '"].changeSlide('+nextSlide+')', 8000); 5543 } 5544 5545 var myActiveSliderI = $(this.getCSSCls('active-slide-image')).data('i'); 5546 var myControls = $(this.getCSSCls('slide-control')); 5547 5548 var focusClass = this.getCSS('slide-control-active'); 5549 $('.'+focusClass).removeClass(focusClass);
5550 var mySize = parseInt(myControls.css('width').replace('px','')); 5551 5552 var myControlsAnim = {'left':(mySize*2 - mySize*myActiveSliderI) + 'px'}; 5553 5554 $(this.getCSSCls('slide-controls-inner-movable')).animate(myControlsAnim); 5555 myControls.each(function(i,it) { 5556 var myIt = $(it); 5557 if(myIt.attr('_index')==String(myActiveSliderI)) myIt.addClass(focusClass); 5558 }); 5559 5560 // Video button only visible on 1st slide 5561 if(this.config.video) { 5562 if(myActiveSliderI > 0) { 5563 $(this.getCSSCls('vidbtn-bar')).fadeOut(); 5564 } else { 5565 $(this.getCSSCls('vidbtn-bar')).fadeIn(); 5566 } 5567 } 5568 } 5569 this.slideStarted = true; 5570 5571}; 5572SlideShow.prototype.startVideo = function(e) { 5573 var mySlideShow = this.slideshows ? this : e.data.slideshow; 5574 if(!mySlideShow.config.video) return; 5575 $(mySlideShow.getCSSCls('hide-for-vid')).fadeOut(); 5576 $(mySlideShow.getCSSCls('vid-pane')).addClass(mySlideShow.getCSS('vid-pane-visible')).append( 5577 $.createElement('div','',true,{ 5578 'id':mySlideShow.getCSS('vidplayer') 5579 }) 5580 ); 5581 5582mySlideShow.stopSlideShow(function() { 5583 var mySlideShow = $(this).data('slideshow'); 5584 if (swfobject.hasFlashPlayerVersion("9.0.115.0")) { 5585 $(mySlideShow.getCSSId('vidplayer')).gcuiSwfObjEmbed(mySlideShow.config.video.swf,mySlideShow.config.video.config); 5586 } else { 5587 document.getElementById($(mySlideShow.getCSSId('vidplayer')).attr('id')).innerHTML = '<video src="' + mySlideShow.config.videoURL + '" preload autoplay="' + mySlideShow.config.video.config.flashvars.autoplay + '" controls height="' + mySlideShow.config.video.config.config.height + '" width="' + mySlideShow.config.video.config.config.width + '" poster="/assets/videos/64
55870_thumbs/' + mySlideShow.config.video.config.flashvars.videoID + '.jpg"></video>'; 5588 } 5589 $(mySlideShow.getCSSCls('vid-controls')).fadeIn('slow'); 5590 }); 5591}; 5592 5593SlideShow.prototype.closeVideoPlayer = function(e) { 5594 var mySlideShow = e.data.slideshow; 5595 var myTargetSlide = e.data.slide ? e.data.slide : 0; 5596 $(mySlideShow.getCSSCls('hide-for-vid')).fadeIn(); 5597 $(mySlideShow.getCSSCls('vid-controls')).data('slideshow',mySlideShow).fadeOut('fast',function(){ 5598 var mySlideShow = $(this).data('slideshow'); 5599 mySlideShow.changeSlide(myTargetSlide); 5600 $(mySlideShow.getCSSId('vidplayer')).data('slideshow',mySlideShow).fadeOut('fast',function() { 5601 var mySlideShow = $(this).data('slideshow'); 5602 $(mySlideShow.getCSSCls('vid-pane')).removeClass(mySlideShow.getCSS('vid-pane-visible')).html(''); 5603 }); 5604 }); 5605}; 5606 5607SlideShow.prototype.getCSS = function(aName) { 5608 return this.config.stylePrefix + '-' + (this.styles[aName]?this.styles[aName] : aName); 5609}; 5610SlideShow.prototype.getCSSCls = function(aName) {return '.' + this.getCSS(aName);}; 5611SlideShow.prototype.getCSSId = function(aName) {return '#' + this.getCSS(aName);}; 5612 5613SlideShow.prototype.init = function() { 5614 var myImgCss = this.getCSS('slide-image'); 5615 var myImgWideImageCss = this.getCSS('slide-image-wide'); 5616 5617 var myRoot = $(this.root); 5618 5619 // Create slides 5620 for(i=0;i<this.images.length;i++) { 5621 var thisImgEl = myImgCss + '-' + i; 5622 var imgData = this.images[i]; 5623 myWideImage = imgData.wideImage ? ' ' + myImgWideImageCss : ''; 5624 myRoot.append('<div class="'+myImgCss+' '+thisImgEl+ myWideImage + '"></div>'); 5625 // output first one with background set 5626 if (i == 0) { 5627 $('.' + thisImgEl).css('background-image','url('+imgData['path'] +')').data('i',i); 5628 } 5629 // subsequent ones don't get background set until the rest of the page loads or a specified 5630 // amount of time has passed 5631 else { 5632 var myElement = $('.' + thisImgEl); 5633 myElement.data('i', i); 5634 myElement.data('background-url',imgData['path']); 5635 // gets call both when document loads and after timeout - whichever is first causes the load 5636 var myLoadFunction = function(t) { 5637 var myThis = null; 5638 if (t && t['data'] && t['data']['element']) myThis = t['data']['element']; 5639 else myThis = $(this); 5640 var myUrl = myThis.data('background-url'); 5641 if (myUrl) { 5642 myThis.css('background-image', 'url('+myUrl+')'); 5643 var myImage = new Image(1,1); 5644 myImage.src = myUrl; 5645 myThis.data('background-url', null); // remove so it doesn't run again 5646 } 5647 }; 5648 myElement.doTimeout(5000, myLoadFunction); 5649 $(window).bind('load', {'element':myElement}, myLoadFunction); 5650 } 5651 } 5652 5653 // Create controls 5654 if(this.images.length > 1) { 5655 var mySlideControl = $(this.getCSSCls('slide-controls')); 5656 var mySlideControlInnerMask = $(this.getCSSCls('slide-controls-inner')); 5657 var mySlideControlInner = $(this.getCSSCls('slide-controls-inner-movable')); 5658 5659 5660 for(i=0;i<this.images.length;i++) { 5661 mySlideControlInner.append( 5662 $.createElement('span',(i+1),true,{ 5663 'class':this.getCSS('slide-control'), 5664 '_index':i 5665 }) 5666 ); 5667 } 5668 5669 var myDir = _slideShowGetDir(); 5670 5671 var myControlWidth = $(this.getCSSCls('slide-control')).css('width').replace('px',''); 5672 mySlideControlInnerMask.css('width',this.config.visibleSlides * myControlWidth +'px'); 5673 5674 // Textual previous and next 5675 if(mySlideControl && this.images.length>3) { 5676 mySlideControl.append( 5677 $.createElement('span','>>',true,{ 5678 'class':[this.getCSS('slide-control'),this.getCSS('slide-control-next')], 5679 '_index':(myDir=='ltr'?'+1':'-1') 5680 }) 5681 ).prepend( 5682 $.createElement('span','<<',true,{ 5683 'class':[this.getCSS('slide-control'),this.getCSS('slide-control-prev')], 5684 '_index':(myDir=='ltr'?'-1':'+1') 5685 }) 5686 ); 5687 } 5688 5689 // Button previous and next 5690 var myInnerPrevBtn = $.createElement('div',null,true,{ 5691 'class':[this.getCSS('slide-control'),this.getCSS('slide-control-btn'),this.getCSS('slide-control-btn-prev')], 5692 '_index':(myDir=='ltr'?'-1':'+1')}); 5693 var myInnerNextBtn = $.createElement('div',null,true,{ 5694 'class':[this.getCSS('slide-control'),this.getCSS('slide-control-btn'),this.getCSS('slide-control-btn-next')], 5695 '_index':(myDir=='ltr'?'+1':'-1')}); 5696 $(this.getCSSCls('controls-pane')).append(myInnerPrevBtn + myInnerNextBtn); 5697 5698 //begin JS edit 05/17/10 5699 //inserting handling for IE6 5700 //modifying hover settings to show nav when hovering over any part of slide 5701 if ($.browser.msie && parseInt($.browser.version) == 6){ 5702 $(".slide-header-slide-control-btn").css({display: "none", height: "325px"});
5703 $(".slide-header-controls-pane").hover(function() { 5704 $(".slide-header-slide-control-btn").show(); 5705 },function(){ 5706 $(".slide-header-slide-control-btn").hide(); 5707 } 5708 ); 5709 }else{ 5710 $(this.getCSSCls('slide-control-btn')).animate({'opacity':0}); 5711 $(".slide-header-controls-pane").hover(function() { 5712 $(".slide-header-slide-control-btn").animate({'opacity' : 0.8}); 5713 },function(){ 5714 $(".slide-header-slide-control-btn").animate({'opacity' : 0}); 5715 } 5716 ); 5717 } 5718 } 5719 5720 // Customizable 'play the video' message 5721 var play_the_video_messsage; 5722 if(this.config.play_the_video_messsage) { 5723 play_the_video_messsage = this.config.play_the_video_messsage; 5724 } else { 5725 play_the_video_messsage = 'play the video'; 5726 } 5727 5728 $(this.getCSSCls('slide-image')).hide(); 5729 $(this.getCSSCls('slide-control')).bind('click', {'slideshow' : this}, function(e) { 5730 e.data.slideshow.changeSlide($(this).attr('_index')); 5731 }); 5732 if(this.config.video) { 5733 $(this.getCSSCls('controls-pane')).append('<div class="' + [this.getCSS('vidbtn-bar'),this.getCSS('hide-for-vid')].join(' ') +'"><div class="'+this.getCSS('vidbtn')+'">' + play_the_video_messsage + ' </div></div>'); 5734 $(this.getCSSCls('vidbtn')).bind('click',{'slideshow' : this},this.startVideo); 5735 $(this.getCSSCls('vid-control-close')).bind('click',{'slideshow' : this},this.closeVideoPlayer); 5736 } 5737 5738 // When there are too many links - this is available 5739 var myHiddenLinks = this.getCSSCls('links-hidden'); 5740 $(this.getCSSCls('more-links')).hover(function(e) { 5741 $(myHiddenLinks).fadeIn(); 5742 },function(e) { 5743 $(myHiddenLinks).stop().fadeOut(); 5744 }); 5745 5746 this.changeSlide(0); 5747};;// JavaScript Document 5748 5749function gcui_displayfact_init(n) { 5750 $('.gcui-displayfact-container-'+n+' .gcui-displayfact-item').hide(); 5751 $('.gcui-displayfact-container-'+n+' .gcui-displayfact-item:first').addClass('active').show(); 5752 5753 var myContainer = $('.gcui-displayfact-container-'+n); 5754 myContainer.hover(function() { 5755 gcui_displayfact_pause_auto(n); 5756 $('.gcui-displayfact-container-'+n+' .gcui-displayfact-controls').fadeIn(250); 5757 },function() { 5758 gcui_displayfact_unpause_auto(n); 5759 $('.gcui-displayfact-container-'+n+' .gcui-displayfact-controls').fadeOut(250); 5760 }); 5761 5762 // attach click events 5763 $('.gcui-displayfact-container-'+n+' .prev').click(function() { 5764 gcui_displayfact_prev(n, true); 5765 }); 5766 $('.gcui-displayfact-container-'+n+' .next').click(function() { 5767 gcui_displayfact_next(n, true); 5768 }); 5769} 5770 5771function gcui_displayfact_next(n, noAnim) { 5772 5773 // get current item 5774 var myCurrentItem = $('.gcui-displayfact-container-'+n+' .active'); 5775 5776 // get next item 5777 var myNextItem = $('.gcui-displayfact-container-'+n+' .active + .gcui-displayfact-item'); 5778 // if this is the last, loop around to first 5779 if (!myNextItem.length) { 5780 myNextItem = $('.gcui-displayfact-container-'+n+' .gcui-displayfact-item:first'); 5781 } 5782 5783 _gcui_displayfact_swap(n, myCurrentItem, myNextItem, noAnim); 5784} 5785 5786function gcui_displayfact_prev(n, noAnim) { 5787 5788 // get current item 5789 var myCurrentItem = $('.gcui-displayfact-container-'+n+' .active'); 5790 5791 // get previous item 5792 var myPrevItem = $('.gcui-displayfact-container-'+n+' .active').prev(); 5793 if (!(myPrevItem && myPrevItem.hasClass('gcui-displayfact-item'))) { 5794 myPrevItem = $('.gcui-displayfact-container-'+n+' .gcui-displayfact-item:last'); 5795 } 5796 5797 _gcui_displayfact_swap(n, myCurrentItem, myPrevItem, noAnim); 5798} 5799 5800function _gcui_displayfact_swap(n, oldItem, newItem, noAnim) { 5801 // remove active flag and stop all animations 5802 $('.gcui-displayfact-container-'+n+' .gcui-displayfact-item') 5803 .removeClass('active') 5804 .stop() 5805 .dequeue(); 5806 5807 // set correct active flag 5808 newItem.addClass('active'); 5809 5810 if (noAnim) { 5811 oldItem.hide(); 5812 newItem.show(); 5813 } 5814 else { 5815 // do animation 5816 oldItem.fadeOut(300, function() { 5817 newItem.fadeIn(300); 5818 }); 5819 } 5820} 5821 5822/** enables automatic rotation */ 5823function gcui_displayfact_set_auto(n) { 5824 var myTimeout = Drupal.settings.gcui_displayfact_timeout; 5825 if (!myTimeout) { myTimeout = 5000; } 5826 var i = setInterval(function() { 5827 gcui_displayfact_next(n); 5828 }, myTimeout); 5829 $('.gcui-displayfact-container-'+n).data('gcui_displayfact_intervalid', i); 5830 $('.gcui-displayfact-container-'+n).data('gcui_displayfact_intervalid_saved', null); 5831} 5832 5833/** disables automatic rotation */ 5834function gcui_displayfact_unset_auto(n) { 5835 var i = $('.gcui-displayfact-container-'+n).data('gcui_displayfact_intervalid'); 5836 if (i) {clearInterval(i);} 5837 $('.gcui-displayfact-container-'+n).data('gcui_displayfact_intervalid', null); 5838 $('.gcui-displayfact-container-'+n).data('gcui_displayfact_intervalid_saved', null); 5839} 5840 5841/** temporarily suspends automatic rotation */ 5842function gcui_displayfact_pause_auto(n) { 5843 5844 var i = $('.gcui-displayfact-container-'+n).data('gcui_displayfact_intervalid'); 5845 5846 // if set, then cancel the interval and save the id so we know it was running 5847 if (i) { 5848 clearInterval(i); 5849 // save interval id 5850 $('.gcui-displayfact-container-'+n).data('gcui_displayfact_intervalid_saved', i); 5851 // nuke the id 5852 $('.gcui-displayfact-container-'+n).data('gcui_displayfact_intervalid', null); 5853 } 5854} 5855 5856/** resumes automatic rotation, if it was previously suspended */ 5857function gcui_displayfact_unpause_auto(n) { 5858 // if there was a saved ID, then call gcui_displayfact_set_auto again to start over 5859 if ($('.gcui-displayfact-container-'+n).data('gcui_displayfact_intervalid_saved')) { 5860 gcui_displayfact_set_auto(n); 5861 } 5862} 5863; 5864// Fixes padding in the top menus. 5865$(document).ready(function() {
5866 $("#nice-menu-1 span li a").each(function(){ 5867 var h = $(this).height(); 5868 var p = $(this).parent("li").height() - h; 5869 $(this).css({paddingTop: parseInt(p/2), paddingBottom: parseInt(p/2)}); 5870 }); 5871}); 5872;
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.