
/*
* jQuery JavaScript Library v1.3
* http://jquery.com/
*
* Copyright (c) 2009 John Resig
* Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License
*
* Date: 2009-01-13 12:50:31 -0500 (Tue, 13 Jan 2009)
* Revision: 6104
*/
(function(){var l=this,g,x=l.jQuery,o=l.$,n=l.jQuery=l.$=function(D,E){return new n.fn.init(D,E)},C=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;n.fn=n.prototype={init:function(D,G){D=D||document;if(D.nodeType){this[0]=D;this.length=1;this.context=D;return this}if(typeof D==="string"){var F=C.exec(D);if(F&&(F[1]||!G)){if(F[1]){D=n.clean([F[1]],G)}else{var H=document.getElementById(F[3]);if(H){if(H.id!=F[3]){return n().find(D)}var E=n(H);E.context=document;E.selector=D;return E}D=[]}}else{return n(G).find(D)}}else{if(n.isFunction(D)){return n(document).ready(D)}}if(D.selector&&D.context){this.selector=D.selector;this.context=D.context}return this.setArray(n.makeArray(D))},selector:"",jquery:"1.3",size:function(){return this.length},get:function(D){return D===g?n.makeArray(this):this[D]},pushStack:function(E,G,D){var F=n(E);F.prevObject=this;F.context=this.context;if(G==="find"){F.selector=this.selector+(this.selector?" ":"")+D}else{if(G){F.selector=this.selector+"."+G+"("+D+")"}}return F},setArray:function(D){this.length=0;Array.prototype.push.apply(this,D);return this},each:function(E,D){return n.each(this,E,D)},index:function(D){return n.inArray(D&&D.jquery?D[0]:D,this)},attr:function(E,G,F){var D=E;if(typeof E==="string"){if(G===g){return this[0]&&n[F||"attr"](this[0],E)}else{D={};D[E]=G}}return this.each(function(H){for(E in D){n.attr(F?this.style:this,E,n.prop(this,D[E],F,H,E))}})},css:function(D,E){if((D=="width"||D=="height")&&parseFloat(E)<0){E=g}return this.attr(D,E,"curCSS")},text:function(E){if(typeof E!=="object"&&E!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(E))}var D="";n.each(E||this,function(){n.each(this.childNodes,function(){if(this.nodeType!=8){D+=this.nodeType!=1?this.nodeValue:n.fn.text([this])}})});return D},wrapAll:function(D){if(this[0]){var E=n(D,this[0].ownerDocument).clone();if(this[0].parentNode){E.insertBefore(this[0])}E.map(function(){var F=this;while(F.firstChild){F=F.firstChild}return F}).append(this)}return this},wrapInner:function(D){return this.each(function(){n(this).contents().wrapAll(D)})},wrap:function(D){return this.each(function(){n(this).wrapAll(D)})},append:function(){return this.domManip(arguments,true,function(D){if(this.nodeType==1){this.appendChild(D)}})},prepend:function(){return this.domManip(arguments,true,function(D){if(this.nodeType==1){this.insertBefore(D,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(D){this.parentNode.insertBefore(D,this)})},after:function(){return this.domManip(arguments,false,function(D){this.parentNode.insertBefore(D,this.nextSibling)})},end:function(){return this.prevObject||n([])},push:[].push,find:function(D){if(this.length===1&&!/,/.test(D)){var F=this.pushStack([],"find",D);F.length=0;n.find(D,this[0],F);return F}else{var E=n.map(this,function(G){return n.find(D,G)});return this.pushStack(/[^+>] [^+>]/.test(D)?n.unique(E):E,"find",D)}},clone:function(E){var D=this.map(function(){if(!n.support.noCloneEvent&&!n.isXMLDoc(this)){var H=this.cloneNode(true),G=document.createElement("div");G.appendChild(H);return n.clean([G.innerHTML])[0]}else{return this.cloneNode(true)}});var F=D.find("*").andSelf().each(function(){if(this[h]!==g){this[h]=null}});if(E===true){this.find("*").andSelf().each(function(H){if(this.nodeType==3){return}var G=n.data(this,"events");for(var J in G){for(var I in G[J]){n.event.add(F[H],J,G[J][I],G[J][I].data)}}})}return D},filter:function(D){return this.pushStack(n.isFunction(D)&&n.grep(this,function(F,E){return D.call(F,E)})||n.multiFilter(D,n.grep(this,function(E){return E.nodeType===1})),"filter",D)},closest:function(D){var E=n.expr.match.POS.test(D)?n(D):null;return this.map(function(){var F=this;while(F&&F.ownerDocument){if(E?E.index(F)>-1:n(F).is(D)){return F}F=F.parentNode}})},not:function(D){if(typeof D==="string"){if(f.test(D)){return this.pushStack(n.multiFilter(D,this,true),"not",D)}else{D=n.multiFilter(D,this)}}var E=D.length&&D[D.length-1]!==g&&!D.nodeType;return this.filter(function(){return E?n.inArray(this,D)<0:this!=D})},add:function(D){return this.pushStack(n.unique(n.merge(this.get(),typeof D==="string"?n(D):n.makeArray(D))))},is:function(D){return !!D&&n.multiFilter(D,this).length>0},hasClass:function(D){return !!D&&this.is("."+D)},val:function(J){if(J===g){var D=this[0];if(D){if(n.nodeName(D,"option")){return(D.attributes.value||{}).specified?D.value:D.text}if(n.nodeName(D,"select")){var H=D.selectedIndex,K=[],L=D.options,G=D.type=="select-one";if(H<0){return null}for(var E=G?H:0,I=G?H+1:L.length;E<I;E++){var F=L[E];if(F.selected){J=n(F).val();if(G){return J}K.push(J)}}return K}return(D.value||"").replace(/\r/g,"")}return g}if(typeof J==="number"){J+=""}return this.each(function(){if(this.nodeType!=1){return}if(n.isArray(J)&&/radio|checkbox/.test(this.type)){this.checked=(n.inArray(this.value,J)>=0||n.inArray(this.name,J)>=0)}else{if(n.nodeName(this,"select")){var M=n.makeArray(J);n("option",this).each(function(){this.selected=(n.inArray(this.value,M)>=0||n.inArray(this.text,M)>=0)});if(!M.length){this.selectedIndex=-1}}else{this.value=J}}})},html:function(D){return D===g?(this[0]?this[0].innerHTML:null):this.empty().append(D)},replaceWith:function(D){return this.after(D).remove()},eq:function(D){return this.slice(D,+D+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(D){return this.pushStack(n.map(this,function(F,E){return D.call(F,E,F)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=n.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild,D=this.length>1?I.cloneNode(true):I;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),G>0?D.cloneNode(true):I)}}if(F){n.each(F,y)}}return this;function K(N,O){return M&&n.nodeName(N,"table")&&n.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};n.fn.init.prototype=n.fn;function y(D,E){if(E.src){n.ajax({url:E.src,async:false,dataType:"script"})}else{n.globalEval(E.text||E.textContent||E.innerHTML||"")}if(E.parentNode){E.parentNode.removeChild(E)}}function e(){return +new Date}n.extend=n.fn.extend=function(){var I=arguments[0]||{},G=1,H=arguments.length,D=false,F;if(typeof I==="boolean"){D=I;I=arguments[1]||{};G=2}if(typeof I!=="object"&&!n.isFunction(I)){I={}}if(H==G){I=this;--G}for(;G<H;G++){if((F=arguments[G])!=null){for(var E in F){var J=I[E],K=F[E];if(I===K){continue}if(D&&K&&typeof K==="object"&&!K.nodeType){I[E]=n.extend(D,J||(K.length!=null?[]:{}),K)}else{if(K!==g){I[E]=K}}}}}return I};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,p=document.defaultView||{},r=Object.prototype.toString;n.extend({noConflict:function(D){l.$=o;if(D){l.jQuery=x}return n},isFunction:function(D){return r.call(D)==="[object Function]"},isArray:function(D){return r.call(D)==="[object Array]"},isXMLDoc:function(D){return D.documentElement&&!D.body||D.tagName&&D.ownerDocument&&!D.ownerDocument.body},globalEval:function(F){F=n.trim(F);if(F){var E=document.getElementsByTagName("head")[0]||document.documentElement,D=document.createElement("script");D.type="text/javascript";if(n.support.scriptEval){D.appendChild(document.createTextNode(F))}else{D.text=F}E.insertBefore(D,E.firstChild);E.removeChild(D)}},nodeName:function(E,D){return E.nodeName&&E.nodeName.toUpperCase()==D.toUpperCase()},each:function(F,J,E){var D,G=0,H=F.length;if(E){if(H===g){for(D in F){if(J.apply(F[D],E)===false){break}}}else{for(;G<H;){if(J.apply(F[G++],E)===false){break}}}}else{if(H===g){for(D in F){if(J.call(F[D],D,F[D])===false){break}}}else{for(var I=F[0];G<H&&J.call(I,G,I)!==false;I=F[++G]){}}}return F},prop:function(G,H,F,E,D){if(n.isFunction(H)){H=H.call(G,E)}return typeof H==="number"&&F=="curCSS"&&!b.test(D)?H+"px":H},className:{add:function(D,E){n.each((E||"").split(/\s+/),function(F,G){if(D.nodeType==1&&!n.className.has(D.className,G)){D.className+=(D.className?" ":"")+G}})},remove:function(D,E){if(D.nodeType==1){D.className=E!==g?n.grep(D.className.split(/\s+/),function(F){return !n.className.has(E,F)}).join(" "):""}},has:function(E,D){return n.inArray(D,(E.className||E).toString().split(/\s+/))>-1}},swap:function(G,F,H){var D={};for(var E in F){D[E]=G.style[E];G.style[E]=F[E]}H.call(G);for(var E in F){G.style[E]=D[E]}},css:function(F,D,H){if(D=="width"||D=="height"){var J,E={position:"absolute",visibility:"hidden",display:"block"},I=D=="width"?["Left","Right"]:["Top","Bottom"];function G(){J=D=="width"?F.offsetWidth:F.offsetHeight;var L=0,K=0;n.each(I,function(){L+=parseFloat(n.curCSS(F,"padding"+this,true))||0;K+=parseFloat(n.curCSS(F,"border"+this+"Width",true))||0});J-=Math.round(L+K)}if(n(F).is(":visible")){G()}else{n.swap(F,E,G)}return Math.max(0,J)}return n.curCSS(F,D,H)},curCSS:function(H,E,F){var K,D=H.style;if(E=="opacity"&&!n.support.opacity){K=n.attr(D,"opacity");return K==""?"1":K}if(E.match(/float/i)){E=v}if(!F&&D&&D[E]){K=D[E]}else{if(p.getComputedStyle){if(E.match(/float/i)){E="float"}E=E.replace(/([A-Z])/g,"-$1").toLowerCase();var L=p.getComputedStyle(H,null);if(L){K=L.getPropertyValue(E)}if(E=="opacity"&&K==""){K="1"}}else{if(H.currentStyle){var I=E.replace(/\-(\w)/g,function(M,N){return N.toUpperCase()});K=H.currentStyle[E]||H.currentStyle[I];if(!/^\d+(px)?$/i.test(K)&&/^\d/.test(K)){var G=D.left,J=H.runtimeStyle.left;H.runtimeStyle.left=H.currentStyle.left;D.left=K||0;K=D.pixelLeft+"px";D.left=G;H.runtimeStyle.left=J}}}}return K},clean:function(E,J,H){J=J||document;if(typeof J.createElement==="undefined"){J=J.ownerDocument||J[0]&&J[0].ownerDocument||document}if(!H&&E.length===1&&typeof E[0]==="string"){var G=/^<(\w+)\s*\/?>$/.exec(E[0]);if(G){return[J.createElement(G[1])]}}var F=[],D=[],K=J.createElement("div");n.each(E,function(O,Q){if(typeof Q==="number"){Q+=""}if(!Q){return}if(typeof Q==="string"){Q=Q.replace(/(<(\w+)[^>]*?)\/>/g,function(S,T,R){return R.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?S:T+"></"+R+">"});var N=n.trim(Q).toLowerCase();var P=!N.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!N.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||N.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!N.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!N.indexOf("<td")||!N.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!N.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!n.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];K.innerHTML=P[1]+Q+P[2];while(P[0]--){K=K.lastChild}if(!n.support.tbody){var M=!N.indexOf("<table")&&N.indexOf("<tbody")<0?K.firstChild&&K.firstChild.childNodes:P[1]=="<table>"&&N.indexOf("<tbody")<0?K.childNodes:[];for(var L=M.length-1;L>=0;--L){if(n.nodeName(M[L],"tbody")&&!M[L].childNodes.length){M[L].parentNode.removeChild(M[L])}}}if(!n.support.leadingWhitespace&&/^\s/.test(Q)){K.insertBefore(J.createTextNode(Q.match(/^\s*/)[0]),K.firstChild)}Q=n.makeArray(K.childNodes)}if(Q.nodeType){F.push(Q)}else{F=n.merge(F,Q)}});if(H){for(var I=0;F[I];I++){if(n.nodeName(F[I],"script")&&(!F[I].type||F[I].type.toLowerCase()==="text/javascript")){D.push(F[I].parentNode?F[I].parentNode.removeChild(F[I]):F[I])}else{if(F[I].nodeType===1){F.splice.apply(F,[I+1,0].concat(n.makeArray(F[I].getElementsByTagName("script"))))}H.appendChild(F[I])}}return D}return F},attr:function(I,F,J){if(!I||I.nodeType==3||I.nodeType==8){return g}var G=!n.isXMLDoc(I),K=J!==g;F=G&&n.props[F]||F;if(I.tagName){var E=/href|src|style/.test(F);if(F=="selected"&&I.parentNode){I.parentNode.selectedIndex}if(F in I&&G&&!E){if(K){if(F=="type"&&n.nodeName(I,"input")&&I.parentNode){throw"type property can't be changed"}I[F]=J}if(n.nodeName(I,"form")&&I.getAttributeNode(F)){return I.getAttributeNode(F).nodeValue}if(F=="tabIndex"){var H=I.getAttributeNode("tabIndex");return H&&H.specified?H.value:I.nodeName.match(/^(a|area|button|input|object|select|textarea)$/i)?0:g}return I[F]}if(!n.support.style&&G&&F=="style"){return n.attr(I.style,"cssText",J)}if(K){I.setAttribute(F,""+J)}var D=!n.support.hrefNormalized&&G&&E?I.getAttribute(F,2):I.getAttribute(F);return D===null?g:D}if(!n.support.opacity&&F=="opacity"){if(K){I.zoom=1;I.filter=(I.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(J)+""=="NaN"?"":"alpha(opacity="+J*100+")")}return I.filter&&I.filter.indexOf("opacity=")>=0?(parseFloat(I.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}F=F.replace(/-([a-z])/ig,function(L,M){return M.toUpperCase()});if(K){I[F]=J}return I[F]},trim:function(D){return(D||"").replace(/^\s+|\s+$/g,"")},makeArray:function(F){var D=[];if(F!=null){var E=F.length;if(E==null||typeof F==="string"||n.isFunction(F)||F.setInterval){D[0]=F}else{while(E){D[--E]=F[E]}}}return D},inArray:function(F,G){for(var D=0,E=G.length;D<E;D++){if(G[D]===F){return D}}return -1},merge:function(G,D){var E=0,F,H=G.length;if(!n.support.getAll){while((F=D[E++])!=null){if(F.nodeType!=8){G[H++]=F}}}else{while((F=D[E++])!=null){G[H++]=F}}return G},unique:function(J){var E=[],D={};try{for(var F=0,G=J.length;F<G;F++){var I=n.data(J[F]);if(!D[I]){D[I]=true;E.push(J[F])}}}catch(H){E=J}return E},grep:function(E,I,D){var F=[];for(var G=0,H=E.length;G<H;G++){if(!D!=!I(E[G],G)){F.push(E[G])}}return F},map:function(D,I){var E=[];for(var F=0,G=D.length;F<G;F++){var H=I(D[F],F);if(H!=null){E[E.length]=H}}return E.concat.apply([],E)}});var B=navigator.userAgent.toLowerCase();n.browser={version:(B.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(B),opera:/opera/.test(B),msie:/msie/.test(B)&&!/opera/.test(B),mozilla:/mozilla/.test(B)&&!/(compatible|webkit)/.test(B)};n.each({parent:function(D){return D.parentNode},parents:function(D){return n.dir(D,"parentNode")},next:function(D){return n.nth(D,2,"nextSibling")},prev:function(D){return n.nth(D,2,"previousSibling")},nextAll:function(D){return n.dir(D,"nextSibling")},prevAll:function(D){return n.dir(D,"previousSibling")},siblings:function(D){return n.sibling(D.parentNode.firstChild,D)},children:function(D){return n.sibling(D.firstChild)},contents:function(D){return n.nodeName(D,"iframe")?D.contentDocument||D.contentWindow.document:n.makeArray(D.childNodes)}},function(D,E){n.fn[D]=function(F){var G=n.map(this,E);if(F&&typeof F=="string"){G=n.multiFilter(F,G)}return this.pushStack(n.unique(G),D,F)}});n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(D,E){n.fn[D]=function(){var F=arguments;return this.each(function(){for(var G=0,H=F.length;G<H;G++){n(F[G])[E](this)}})}});n.each({removeAttr:function(D){n.attr(this,D,"");if(this.nodeType==1){this.removeAttribute(D)}},addClass:function(D){n.className.add(this,D)},removeClass:function(D){n.className.remove(this,D)},toggleClass:function(E,D){if(typeof D!=="boolean"){D=!n.className.has(this,E)}n.className[D?"add":"remove"](this,E)},remove:function(D){if(!D||n.filter(D,[this]).length){n("*",this).add([this]).each(function(){n.event.remove(this);n.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){n(">*",this).remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(D,E){n.fn[D]=function(){return this.each(E,arguments)}});function j(D,E){return D[0]&&parseInt(n.curCSS(D[0],E,true),10)||0}var h="jQuery"+e(),u=0,z={};n.extend({cache:{},data:function(E,D,F){E=E==l?z:E;var G=E[h];if(!G){G=E[h]=++u}if(D&&!n.cache[G]){n.cache[G]={}}if(F!==g){n.cache[G][D]=F}return D?n.cache[G][D]:G},removeData:function(E,D){E=E==l?z:E;var G=E[h];if(D){if(n.cache[G]){delete n.cache[G][D];D="";for(D in n.cache[G]){break}if(!D){n.removeData(E)}}}else{try{delete E[h]}catch(F){if(E.removeAttribute){E.removeAttribute(h)}}delete n.cache[G]}},queue:function(E,D,G){if(E){D=(D||"fx")+"queue";var F=n.data(E,D);if(!F||n.isArray(G)){F=n.data(E,D,n.makeArray(G))}else{if(G){F.push(G)}}}return F},dequeue:function(G,F){var D=n.queue(G,F),E=D.shift();if(!F||F==="fx"){E=D[0]}if(E!==g){E.call(G)}}});n.fn.extend({data:function(D,F){var G=D.split(".");G[1]=G[1]?"."+G[1]:"";if(F===g){var E=this.triggerHandler("getData"+G[1]+"!",[G[0]]);if(E===g&&this.length){E=n.data(this[0],D)}return E===g&&G[1]?this.data(G[0]):E}else{return this.trigger("setData"+G[1]+"!",[G[0],F]).each(function(){n.data(this,D,F)})}},removeData:function(D){return this.each(function(){n.removeData(this,D)})},queue:function(D,E){if(typeof D!=="string"){E=D;D="fx"}if(E===g){return n.queue(this[0],D)}return this.each(function(){var F=n.queue(this,D,E);if(D=="fx"&&F.length==1){F[0].call(this)}})},dequeue:function(D){return this.each(function(){n.dequeue(this,D)})}});
/*
* Sizzle CSS Selector Engine - v0.9.1
*  Copyright 2009, The Dojo Foundation
*  Released under the MIT, BSD, and GPL Licenses.
*  More information: http://sizzlejs.com/
*/
(function(){var N=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,I=0,F=Object.prototype.toString;var E=function(ae,S,aa,V){aa=aa||[];S=S||document;if(S.nodeType!==1&&S.nodeType!==9){return[]}if(!ae||typeof ae!=="string"){return aa}var ab=[],ac,Y,ah,ag,Z,R,Q=true;N.lastIndex=0;while((ac=N.exec(ae))!==null){ab.push(ac[1]);if(ac[2]){R=RegExp.rightContext;break}}if(ab.length>1&&G.match.POS.exec(ae)){if(ab.length===2&&G.relative[ab[0]]){var U="",X;while((X=G.match.POS.exec(ae))){U+=X[0];ae=ae.replace(G.match.POS,"")}Y=E.filter(U,E(/\s$/.test(ae)?ae+"*":ae,S))}else{Y=G.relative[ab[0]]?[S]:E(ab.shift(),S);while(ab.length){var P=[];ae=ab.shift();if(G.relative[ae]){ae+=ab.shift()}for(var af=0,ad=Y.length;af<ad;af++){E(ae,Y[af],P)}Y=P}}}else{var ai=V?{expr:ab.pop(),set:D(V)}:E.find(ab.pop(),ab.length===1&&S.parentNode?S.parentNode:S);Y=E.filter(ai.expr,ai.set);if(ab.length>0){ah=D(Y)}else{Q=false}while(ab.length){var T=ab.pop(),W=T;if(!G.relative[T]){T=""}else{W=ab.pop()}if(W==null){W=S}G.relative[T](ah,W,M(S))}}if(!ah){ah=Y}if(!ah){throw"Syntax error, unrecognized expression: "+(T||ae)}if(F.call(ah)==="[object Array]"){if(!Q){aa.push.apply(aa,ah)}else{if(S.nodeType===1){for(var af=0;ah[af]!=null;af++){if(ah[af]&&(ah[af]===true||ah[af].nodeType===1&&H(S,ah[af]))){aa.push(Y[af])}}}else{for(var af=0;ah[af]!=null;af++){if(ah[af]&&ah[af].nodeType===1){aa.push(Y[af])}}}}}else{D(ah,aa)}if(R){E(R,S,aa,V)}return aa};E.matches=function(P,Q){return E(P,null,null,Q)};E.find=function(V,S){var W,Q;if(!V){return[]}for(var R=0,P=G.order.length;R<P;R++){var T=G.order[R],Q;if((Q=G.match[T].exec(V))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){Q[1]=(Q[1]||"").replace(/\\/g,"");W=G.find[T](Q,S);if(W!=null){V=V.replace(G.match[T],"");break}}}}if(!W){W=S.getElementsByTagName("*")}return{set:W,expr:V}};E.filter=function(S,ac,ad,T){var Q=S,Y=[],ah=ac,V,ab;while(S&&ac.length){for(var U in G.filter){if((V=G.match[U].exec(S))!=null){var Z=G.filter[U],R=null,X=0,aa,ag;ab=false;if(ah==Y){Y=[]}if(G.preFilter[U]){V=G.preFilter[U](V,ah,ad,Y,T);if(!V){ab=aa=true}else{if(V===true){continue}else{if(V[0]===true){R=[];var W=null,af;for(var ae=0;(af=ah[ae])!==g;ae++){if(af&&W!==af){R.push(af);W=af}}}}}}if(V){for(var ae=0;(ag=ah[ae])!==g;ae++){if(ag){if(R&&ag!=R[X]){X++}aa=Z(ag,V,X,R);var P=T^!!aa;if(ad&&aa!=null){if(P){ab=true}else{ah[ae]=false}}else{if(P){Y.push(ag);ab=true}}}}}if(aa!==g){if(!ad){ah=Y}S=S.replace(G.match[U],"");if(!ab){return[]}break}}}S=S.replace(/\s*,\s*/,"");if(S==Q){if(ab==null){throw"Syntax error, unrecognized expression: "+S}else{break}}Q=S}return ah};var G=E.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\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(P){return P.getAttribute("href")}},relative:{"+":function(T,Q){for(var R=0,P=T.length;R<P;R++){var S=T[R];if(S){var U=S.previousSibling;while(U&&U.nodeType!==1){U=U.previousSibling}T[R]=typeof Q==="string"?U||false:U===Q}}if(typeof Q==="string"){E.filter(Q,T,true)}},">":function(U,Q,V){if(typeof Q==="string"&&!/\W/.test(Q)){Q=V?Q:Q.toUpperCase();for(var R=0,P=U.length;R<P;R++){var T=U[R];if(T){var S=T.parentNode;U[R]=S.nodeName===Q?S:false}}}else{for(var R=0,P=U.length;R<P;R++){var T=U[R];if(T){U[R]=typeof Q==="string"?T.parentNode:T.parentNode===Q}}if(typeof Q==="string"){E.filter(Q,U,true)}}},"":function(S,Q,U){var R="done"+(I++),P=O;if(!Q.match(/\W/)){var T=Q=U?Q:Q.toUpperCase();P=L}P("parentNode",Q,R,S,T,U)},"~":function(S,Q,U){var R="done"+(I++),P=O;if(typeof Q==="string"&&!Q.match(/\W/)){var T=Q=U?Q:Q.toUpperCase();P=L}P("previousSibling",Q,R,S,T,U)}},find:{ID:function(Q,R){if(R.getElementById){var P=R.getElementById(Q[1]);return P?[P]:[]}},NAME:function(P,Q){return Q.getElementsByName?Q.getElementsByName(P[1]):null},TAG:function(P,Q){return Q.getElementsByTagName(P[1])}},preFilter:{CLASS:function(S,Q,R,P,U){S=" "+S[1].replace(/\\/g,"")+" ";for(var T=0;Q[T];T++){if(U^(" "+Q[T].className+" ").indexOf(S)>=0){if(!R){P.push(Q[T])}}else{if(R){Q[T]=false}}}return false},ID:function(P){return P[1].replace(/\\/g,"")},TAG:function(Q,P){for(var R=0;!P[R];R++){}return M(P[R])?Q[1]:Q[1].toUpperCase()},CHILD:function(P){if(P[1]=="nth"){var Q=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(P[2]=="even"&&"2n"||P[2]=="odd"&&"2n+1"||!/\D/.test(P[2])&&"0n+"+P[2]||P[2]);P[2]=(Q[1]+(Q[2]||1))-0;P[3]=Q[3]-0}P[0]="done"+(I++);return P},ATTR:function(Q){var P=Q[1];if(G.attrMap[P]){Q[1]=G.attrMap[P]}if(Q[2]==="~="){Q[4]=" "+Q[4]+" "}return Q},PSEUDO:function(T,Q,R,P,U){if(T[1]==="not"){if(T[3].match(N).length>1){T[3]=E(T[3],null,null,Q)}else{var S=E.filter(T[3],Q,R,true^U);if(!R){P.push.apply(P,S)}return false}}else{if(G.match.POS.test(T[0])){return true}}return T},POS:function(P){P.unshift(true);return P}},filters:{enabled:function(P){return P.disabled===false&&P.type!=="hidden"},disabled:function(P){return P.disabled===true},checked:function(P){return P.checked===true},selected:function(P){P.parentNode.selectedIndex;return P.selected===true},parent:function(P){return !!P.firstChild},empty:function(P){return !P.firstChild},has:function(R,Q,P){return !!E(P[3],R).length},header:function(P){return/h\d/i.test(P.nodeName)},text:function(P){return"text"===P.type},radio:function(P){return"radio"===P.type},checkbox:function(P){return"checkbox"===P.type},file:function(P){return"file"===P.type},password:function(P){return"password"===P.type},submit:function(P){return"submit"===P.type},image:function(P){return"image"===P.type},reset:function(P){return"reset"===P.type},button:function(P){return"button"===P.type||P.nodeName.toUpperCase()==="BUTTON"},input:function(P){return/input|select|textarea|button/i.test(P.nodeName)}},setFilters:{first:function(Q,P){return P===0},last:function(R,Q,P,S){return Q===S.length-1},even:function(Q,P){return P%2===0},odd:function(Q,P){return P%2===1},lt:function(R,Q,P){return Q<P[3]-0},gt:function(R,Q,P){return Q>P[3]-0},nth:function(R,Q,P){return P[3]-0==Q},eq:function(R,Q,P){return P[3]-0==Q}},filter:{CHILD:function(P,S){var V=S[1],W=P.parentNode;var U="child"+W.childNodes.length;if(W&&(!W[U]||!P.nodeIndex)){var T=1;for(var Q=W.firstChild;Q;Q=Q.nextSibling){if(Q.nodeType==1){Q.nodeIndex=T++}}W[U]=T-1}if(V=="first"){return P.nodeIndex==1}else{if(V=="last"){return P.nodeIndex==W[U]}else{if(V=="only"){return W[U]==1}else{if(V=="nth"){var Y=false,R=S[2],X=S[3];if(R==1&&X==0){return true}if(R==0){if(P.nodeIndex==X){Y=true}}else{if((P.nodeIndex-X)%R==0&&(P.nodeIndex-X)/R>=0){Y=true}}return Y}}}}},PSEUDO:function(V,R,S,W){var Q=R[1],T=G.filters[Q];if(T){return T(V,S,R,W)}else{if(Q==="contains"){return(V.textContent||V.innerText||"").indexOf(R[3])>=0}else{if(Q==="not"){var U=R[3];for(var S=0,P=U.length;S<P;S++){if(U[S]===V){return false}}return true}}}},ID:function(Q,P){return Q.nodeType===1&&Q.getAttribute("id")===P},TAG:function(Q,P){return(P==="*"&&Q.nodeType===1)||Q.nodeName===P},CLASS:function(Q,P){return P.test(Q.className)},ATTR:function(T,R){var P=G.attrHandle[R[1]]?G.attrHandle[R[1]](T):T[R[1]]||T.getAttribute(R[1]),U=P+"",S=R[2],Q=R[4];return P==null?false:S==="="?U===Q:S==="*="?U.indexOf(Q)>=0:S==="~="?(" "+U+" ").indexOf(Q)>=0:!R[4]?P:S==="!="?U!=Q:S==="^="?U.indexOf(Q)===0:S==="$="?U.substr(U.length-Q.length)===Q:S==="|="?U===Q||U.substr(0,Q.length+1)===Q+"-":false},POS:function(T,Q,R,U){var P=Q[2],S=G.setFilters[P];if(S){return S(T,R,Q,U)}}}};for(var K in G.match){G.match[K]=RegExp(G.match[K].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var D=function(Q,P){Q=Array.prototype.slice.call(Q);if(P){P.push.apply(P,Q);return P}return Q};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(J){D=function(T,S){var Q=S||[];if(F.call(T)==="[object Array]"){Array.prototype.push.apply(Q,T)}else{if(typeof T.length==="number"){for(var R=0,P=T.length;R<P;R++){Q.push(T[R])}}else{for(var R=0;T[R];R++){Q.push(T[R])}}}return Q}}(function(){var Q=document.createElement("form"),R="script"+(new Date).getTime();Q.innerHTML="<input name='"+R+"'/>";var P=document.documentElement;P.insertBefore(Q,P.firstChild);if(!!document.getElementById(R)){G.find.ID=function(T,U){if(U.getElementById){var S=U.getElementById(T[1]);return S?S.id===T[1]||S.getAttributeNode&&S.getAttributeNode("id").nodeValue===T[1]?[S]:g:[]}};G.filter.ID=function(U,S){var T=U.getAttributeNode&&U.getAttributeNode("id");return U.nodeType===1&&T&&T.nodeValue===S}}P.removeChild(Q)})();(function(){var P=document.createElement("div");P.appendChild(document.createComment(""));if(P.getElementsByTagName("*").length>0){G.find.TAG=function(Q,U){var T=U.getElementsByTagName(Q[1]);if(Q[1]==="*"){var S=[];for(var R=0;T[R];R++){if(T[R].nodeType===1){S.push(T[R])}}T=S}return T}}P.innerHTML="<a href='#'></a>";if(P.firstChild.getAttribute("href")!=="#"){G.attrHandle.href=function(Q){return Q.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var P=E;E=function(T,S,Q,R){S=S||document;if(!R&&S.nodeType===9){try{return D(S.querySelectorAll(T),Q)}catch(U){}}return P(T,S,Q,R)};E.find=P.find;E.filter=P.filter;E.selectors=P.selectors;E.matches=P.matches})()}if(document.documentElement.getElementsByClassName){G.order.splice(1,0,"CLASS");G.find.CLASS=function(P,Q){return Q.getElementsByClassName(P[1])}}function L(Q,W,V,Z,X,Y){for(var T=0,R=Z.length;T<R;T++){var P=Z[T];if(P){P=P[Q];var U=false;while(P&&P.nodeType){var S=P[V];if(S){U=Z[S];break}if(P.nodeType===1&&!Y){P[V]=T}if(P.nodeName===W){U=P;break}P=P[Q]}Z[T]=U}}}function O(Q,V,U,Y,W,X){for(var S=0,R=Y.length;S<R;S++){var P=Y[S];if(P){P=P[Q];var T=false;while(P&&P.nodeType){if(P[U]){T=Y[P[U]];break}if(P.nodeType===1){if(!X){P[U]=S}if(typeof V!=="string"){if(P===V){T=true;break}}else{if(E.filter(V,[P]).length>0){T=P;break}}}P=P[Q]}Y[S]=T}}}var H=document.compareDocumentPosition?function(Q,P){return Q.compareDocumentPosition(P)&16}:function(Q,P){return Q!==P&&(Q.contains?Q.contains(P):true)};var M=function(P){return P.documentElement&&!P.body||P.tagName&&P.ownerDocument&&!P.ownerDocument.body};n.find=E;n.filter=E.filter;n.expr=E.selectors;n.expr[":"]=n.expr.filters;E.selectors.filters.hidden=function(P){return"hidden"===P.type||n.css(P,"display")==="none"||n.css(P,"visibility")==="hidden"};E.selectors.filters.visible=function(P){return"hidden"!==P.type&&n.css(P,"display")!=="none"&&n.css(P,"visibility")!=="hidden"};E.selectors.filters.animated=function(P){return n.grep(n.timers,function(Q){return P===Q.elem}).length};n.multiFilter=function(R,P,Q){if(Q){R=":not("+R+")"}return E.matches(R,P)};n.dir=function(R,Q){var P=[],S=R[Q];while(S&&S!=document){if(S.nodeType==1){P.push(S)}S=S[Q]}return P};n.nth=function(T,P,R,S){P=P||1;var Q=0;for(;T;T=T[R]){if(T.nodeType==1&&++Q==P){break}}return T};n.sibling=function(R,Q){var P=[];for(;R;R=R.nextSibling){if(R.nodeType==1&&R!=Q){P.push(R)}}return P};return;l.Sizzle=E})();n.event={add:function(H,E,G,J){if(H.nodeType==3||H.nodeType==8){return}if(H.setInterval&&H!=l){H=l}if(!G.guid){G.guid=this.guid++}if(J!==g){var F=G;G=this.proxy(F);G.data=J}var D=n.data(H,"events")||n.data(H,"events",{}),I=n.data(H,"handle")||n.data(H,"handle",function(){return typeof n!=="undefined"&&!n.event.triggered?n.event.handle.apply(arguments.callee.elem,arguments):g});I.elem=H;n.each(E.split(/\s+/),function(L,M){var N=M.split(".");M=N.shift();G.type=N.slice().sort().join(".");var K=D[M];if(n.event.specialAll[M]){n.event.specialAll[M].setup.call(H,J,N)}if(!K){K=D[M]={};if(!n.event.special[M]||n.event.special[M].setup.call(H,J,N)===false){if(H.addEventListener){H.addEventListener(M,I,false)}else{if(H.attachEvent){H.attachEvent("on"+M,I)}}}}K[G.guid]=G;n.event.global[M]=true});H=null},guid:1,global:{},remove:function(J,G,I){if(J.nodeType==3||J.nodeType==8){return}var F=n.data(J,"events"),E,D;if(F){if(G===g||(typeof G==="string"&&G.charAt(0)==".")){for(var H in F){this.remove(J,H+(G||""))}}else{if(G.type){I=G.handler;G=G.type}n.each(G.split(/\s+/),function(L,N){var P=N.split(".");N=P.shift();var M=RegExp("(^|\\.)"+P.slice().sort().join(".*\\.")+"(\\.|$)");if(F[N]){if(I){delete F[N][I.guid]}else{for(var O in F[N]){if(M.test(F[N][O].type)){delete F[N][O]}}}if(n.event.specialAll[N]){n.event.specialAll[N].teardown.call(J,P)}for(E in F[N]){break}if(!E){if(!n.event.special[N]||n.event.special[N].teardown.call(J,P)===false){if(J.removeEventListener){J.removeEventListener(N,n.data(J,"handle"),false)}else{if(J.detachEvent){J.detachEvent("on"+N,n.data(J,"handle"))}}}E=null;delete F[N]}}})}for(E in F){break}if(!E){var K=n.data(J,"handle");if(K){K.elem=null}n.removeData(J,"events");n.removeData(J,"handle")}}},trigger:function(H,J,G,D){var F=H.type||H;if(!D){H=typeof H==="object"?H[h]?H:n.extend(n.Event(F),H):n.Event(F);if(F.indexOf("!")>=0){H.type=F=F.slice(0,-1);H.exclusive=true}if(!G){H.stopPropagation();if(this.global[F]){n.each(n.cache,function(){if(this.events&&this.events[F]){n.event.trigger(H,J,this.handle.elem)}})}}if(!G||G.nodeType==3||G.nodeType==8){return g}H.result=g;H.target=G;J=n.makeArray(J);J.unshift(H)}H.currentTarget=G;var I=n.data(G,"handle");if(I){I.apply(G,J)}if((!G[F]||(n.nodeName(G,"a")&&F=="click"))&&G["on"+F]&&G["on"+F].apply(G,J)===false){H.result=false}if(!D&&G[F]&&!H.isDefaultPrevented()&&!(n.nodeName(G,"a")&&F=="click")){this.triggered=true;try{G[F]()}catch(K){}}this.triggered=false;if(!H.isPropagationStopped()){var E=G.parentNode||G.ownerDocument;if(E){n.event.trigger(H,J,E,true)}}},handle:function(J){var I,D;J=arguments[0]=n.event.fix(J||l.event);var K=J.type.split(".");J.type=K.shift();I=!K.length&&!J.exclusive;var H=RegExp("(^|\\.)"+K.slice().sort().join(".*\\.")+"(\\.|$)");D=(n.data(this,"events")||{})[J.type];for(var F in D){var G=D[F];if(I||H.test(G.type)){J.handler=G;J.data=G.data;var E=G.apply(this,arguments);if(E!==g){J.result=E;if(E===false){J.preventDefault();J.stopPropagation()}}if(J.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode 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(G){if(G[h]){return G}var E=G;G=n.Event(E);for(var F=this.props.length,I;F;){I=this.props[--F];G[I]=E[I]}if(!G.target){G.target=G.srcElement||document}if(G.target.nodeType==3){G.target=G.target.parentNode}if(!G.relatedTarget&&G.fromElement){G.relatedTarget=G.fromElement==G.target?G.toElement:G.fromElement}if(G.pageX==null&&G.clientX!=null){var H=document.documentElement,D=document.body;G.pageX=G.clientX+(H&&H.scrollLeft||D&&D.scrollLeft||0)-(H.clientLeft||0);G.pageY=G.clientY+(H&&H.scrollTop||D&&D.scrollTop||0)-(H.clientTop||0)}if(!G.which&&((G.charCode||G.charCode===0)?G.charCode:G.keyCode)){G.which=G.charCode||G.keyCode}if(!G.metaKey&&G.ctrlKey){G.metaKey=G.ctrlKey}if(!G.which&&G.button){G.which=(G.button&1?1:(G.button&2?3:(G.button&4?2:0)))}return G},proxy:function(E,D){D=D||function(){return E.apply(this,arguments)};D.guid=E.guid=E.guid||D.guid||this.guid++;return D},special:{ready:{setup:A,teardown:function(){}}},specialAll:{live:{setup:function(D,E){n.event.add(this,E[0],c)},teardown:function(F){if(F.length){var D=0,E=RegExp("(^|\\.)"+F[0]+"(\\.|$)");n.each((n.data(this,"events").live||{}),function(){if(E.test(this.type)){D++}});if(D<1){n.event.remove(this,F[0],c)}}}}}};n.Event=function(D){if(!this.preventDefault){return new n.Event(D)}if(D&&D.type){this.originalEvent=D;this.type=D.type;this.timeStamp=D.timeStamp}else{this.type=D}if(!this.timeStamp){this.timeStamp=e()}this[h]=true};function k(){return false}function t(){return true}n.Event.prototype={preventDefault:function(){this.isDefaultPrevented=t;var D=this.originalEvent;if(!D){return}if(D.preventDefault){D.preventDefault()}D.returnValue=false},stopPropagation:function(){this.isPropagationStopped=t;var D=this.originalEvent;if(!D){return}if(D.stopPropagation){D.stopPropagation()}D.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=t;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(E){var D=E.relatedTarget;while(D&&D!=this){try{D=D.parentNode}catch(F){D=this}}if(D!=this){E.type=E.data;n.event.handle.apply(this,arguments)}};n.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(E,D){n.event.special[D]={setup:function(){n.event.add(this,E,a,D)},teardown:function(){n.event.remove(this,E,a)}}});n.fn.extend({bind:function(E,F,D){return E=="unload"?this.one(E,F,D):this.each(function(){n.event.add(this,E,D||F,D&&F)})},one:function(F,G,E){var D=n.event.proxy(E||G,function(H){n(this).unbind(H,D);return(E||G).apply(this,arguments)});return this.each(function(){n.event.add(this,F,D,E&&G)})},unbind:function(E,D){return this.each(function(){n.event.remove(this,E,D)})},trigger:function(D,E){return this.each(function(){n.event.trigger(D,E,this)})},triggerHandler:function(D,F){if(this[0]){var E=n.Event(D);E.preventDefault();E.stopPropagation();n.event.trigger(E,F,this[0]);return E.result}},toggle:function(F){var D=arguments,E=1;while(E<D.length){n.event.proxy(F,D[E++])}return this.click(n.event.proxy(F,function(G){this.lastToggle=(this.lastToggle||0)%E;G.preventDefault();return D[this.lastToggle++].apply(this,arguments)||false}))},hover:function(D,E){return this.mouseenter(D).mouseleave(E)},ready:function(D){A();if(n.isReady){D.call(document,n)}else{n.readyList.push(D)}return this},live:function(F,E){var D=n.event.proxy(E);D.guid+=this.selector+F;n(document).bind(i(F,this.selector),this.selector,D);return this},die:function(E,D){n(document).unbind(i(E,this.selector),D?{guid:D.guid+this.selector+E}:null);return this}});function c(G){var D=RegExp("(^|\\.)"+G.type+"(\\.|$)"),F=true,E=[];n.each(n.data(this,"events").live||[],function(H,I){if(D.test(I.type)){var J=n(G.target).closest(I.data)[0];if(J){E.push({elem:J,fn:I})}}});n.each(E,function(){if(!G.isImmediatePropagationStopped()&&this.fn.call(this.elem,G,this.fn.data)===false){F=false}});return F}function i(E,D){return["live",E,D.replace(/\./g,"`").replace(/ /g,"|")].join(".")}n.extend({isReady:false,readyList:[],ready:function(){if(!n.isReady){n.isReady=true;if(n.readyList){n.each(n.readyList,function(){this.call(document,n)});n.readyList=null}n(document).triggerHandler("ready")}}});var w=false;function A(){if(w){return}w=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);n.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);n.ready()}});if(document.documentElement.doScroll&&!l.frameElement){(function(){if(n.isReady){return}try{document.documentElement.doScroll("left")}catch(D){setTimeout(arguments.callee,0);return}n.ready()})()}}}n.event.add(l,"load",n.ready)}n.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(E,D){n.fn[D]=function(F){return F?this.bind(D,F):this.trigger(D)}});n(l).bind("unload",function(){for(var D in n.cache){if(D!=1&&n.cache[D].handle){n.event.remove(n.cache[D].handle.elem)}}});(function(){n.support={};var E=document.documentElement,F=document.createElement("script"),J=document.createElement("div"),I="script"+(new Date).getTime();J.style.display="none";J.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 G=J.getElementsByTagName("*"),D=J.getElementsByTagName("a")[0];if(!G||!G.length||!D){return}n.support={leadingWhitespace:J.firstChild.nodeType==3,tbody:!J.getElementsByTagName("tbody").length,objectAll:!!J.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!J.getElementsByTagName("link").length,style:/red/.test(D.getAttribute("style")),hrefNormalized:D.getAttribute("href")==="/a",opacity:D.style.opacity==="0.5",cssFloat:!!D.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};F.type="text/javascript";try{F.appendChild(document.createTextNode("window."+I+"=1;"))}catch(H){}E.insertBefore(F,E.firstChild);if(l[I]){n.support.scriptEval=true;delete l[I]}E.removeChild(F);if(J.attachEvent&&J.fireEvent){J.attachEvent("onclick",function(){n.support.noCloneEvent=false;J.detachEvent("onclick",arguments.callee)});J.cloneNode(true).fireEvent("onclick")}n(function(){var K=document.createElement("div");K.style.width="1px";K.style.paddingLeft="1px";document.body.appendChild(K);n.boxModel=n.support.boxModel=K.offsetWidth===2;document.body.removeChild(K)})})();var v=n.support.cssFloat?"cssFloat":"styleFloat";n.props={"for":"htmlFor","class":"className","float":v,cssFloat:v,styleFloat:v,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};n.fn.extend({_load:n.fn.load,load:function(F,I,J){if(typeof F!=="string"){return this._load(F)}var H=F.indexOf(" ");if(H>=0){var D=F.slice(H,F.length);F=F.slice(0,H)}var G="GET";if(I){if(n.isFunction(I)){J=I;I=null}else{if(typeof I==="object"){I=n.param(I);G="POST"}}}var E=this;n.ajax({url:F,type:G,dataType:"html",data:I,complete:function(L,K){if(K=="success"||K=="notmodified"){E.html(D?n("<div/>").append(L.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(D):L.responseText)}if(J){E.each(J,[L.responseText,K,L])}}});return this},serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?n.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type))}).map(function(D,E){var F=n(this).val();return F==null?null:n.isArray(F)?n.map(F,function(H,G){return{name:E.name,value:H}}):{name:E.name,value:F}}).get()}});n.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(D,E){n.fn[E]=function(F){return this.bind(E,F)}});var q=e();n.extend({get:function(D,F,G,E){if(n.isFunction(F)){G=F;F=null}return n.ajax({type:"GET",url:D,data:F,success:G,dataType:E})},getScript:function(D,E){return n.get(D,null,E,"script")},getJSON:function(D,E,F){return n.get(D,E,F,"json")},post:function(D,F,G,E){if(n.isFunction(F)){G=F;F={}}return n.ajax({type:"POST",url:D,data:F,success:G,dataType:E})},ajaxSetup:function(D){n.extend(n.ajaxSettings,D)},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(L){L=n.extend(true,L,n.extend(true,{},n.ajaxSettings,L));var V,E=/=\?(&|$)/g,Q,U,F=L.type.toUpperCase();if(L.data&&L.processData&&typeof L.data!=="string"){L.data=n.param(L.data)}if(L.dataType=="jsonp"){if(F=="GET"){if(!L.url.match(E)){L.url+=(L.url.match(/\?/)?"&":"?")+(L.jsonp||"callback")+"=?"}}else{if(!L.data||!L.data.match(E)){L.data=(L.data?L.data+"&":"")+(L.jsonp||"callback")+"=?"}}L.dataType="json"}if(L.dataType=="json"&&(L.data&&L.data.match(E)||L.url.match(E))){V="jsonp"+q++;if(L.data){L.data=(L.data+"").replace(E,"="+V+"$1")}L.url=L.url.replace(E,"="+V+"$1");L.dataType="script";l[V]=function(W){U=W;H();K();l[V]=g;try{delete l[V]}catch(X){}if(G){G.removeChild(S)}}}if(L.dataType=="script"&&L.cache==null){L.cache=false}if(L.cache===false&&F=="GET"){var D=e();var T=L.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+D+"$2");L.url=T+((T==L.url)?(L.url.match(/\?/)?"&":"?")+"_="+D:"")}if(L.data&&F=="GET"){L.url+=(L.url.match(/\?/)?"&":"?")+L.data;L.data=null}if(L.global&&!n.active++){n.event.trigger("ajaxStart")}var P=/^(\w+:)?\/\/([^\/?#]+)/.exec(L.url);if(L.dataType=="script"&&F=="GET"&&P&&(P[1]&&P[1]!=location.protocol||P[2]!=location.host)){var G=document.getElementsByTagName("head")[0];var S=document.createElement("script");S.src=L.url;if(L.scriptCharset){S.charset=L.scriptCharset}if(!V){var N=false;S.onload=S.onreadystatechange=function(){if(!N&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){N=true;H();K();G.removeChild(S)}}}G.appendChild(S);return g}var J=false;var I=L.xhr();if(L.username){I.open(F,L.url,L.async,L.username,L.password)}else{I.open(F,L.url,L.async)}try{if(L.data){I.setRequestHeader("Content-Type",L.contentType)}if(L.ifModified){I.setRequestHeader("If-Modified-Since",n.lastModified[L.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}I.setRequestHeader("X-Requested-With","XMLHttpRequest");I.setRequestHeader("Accept",L.dataType&&L.accepts[L.dataType]?L.accepts[L.dataType]+", */*":L.accepts._default)}catch(R){}if(L.beforeSend&&L.beforeSend(I,L)===false){if(L.global&&!--n.active){n.event.trigger("ajaxStop")}I.abort();return false}if(L.global){n.event.trigger("ajaxSend",[I,L])}var M=function(W){if(I.readyState==0){if(O){clearInterval(O);O=null;if(L.global&&!--n.active){n.event.trigger("ajaxStop")}}}else{if(!J&&I&&(I.readyState==4||W=="timeout")){J=true;if(O){clearInterval(O);O=null}Q=W=="timeout"?"timeout":!n.httpSuccess(I)?"error":L.ifModified&&n.httpNotModified(I,L.url)?"notmodified":"success";if(Q=="success"){try{U=n.httpData(I,L.dataType,L)}catch(Y){Q="parsererror"}}if(Q=="success"){var X;try{X=I.getResponseHeader("Last-Modified")}catch(Y){}if(L.ifModified&&X){n.lastModified[L.url]=X}if(!V){H()}}else{n.handleError(L,I,Q)}K();if(L.async){I=null}}}};if(L.async){var O=setInterval(M,13);if(L.timeout>0){setTimeout(function(){if(I){if(!J){M("timeout")}if(I){I.abort()}}},L.timeout)}}try{I.send(L.data)}catch(R){n.handleError(L,I,null,R)}if(!L.async){M()}function H(){if(L.success){L.success(U,Q)}if(L.global){n.event.trigger("ajaxSuccess",[I,L])}}function K(){if(L.complete){L.complete(I,Q)}if(L.global){n.event.trigger("ajaxComplete",[I,L])}if(L.global&&!--n.active){n.event.trigger("ajaxStop")}}return I},handleError:function(E,G,D,F){if(E.error){E.error(G,D,F)}if(E.global){n.event.trigger("ajaxError",[G,E,F])}},active:0,httpSuccess:function(E){try{return !E.status&&location.protocol=="file:"||(E.status>=200&&E.status<300)||E.status==304||E.status==1223}catch(D){}return false},httpNotModified:function(F,D){try{var G=F.getResponseHeader("Last-Modified");return F.status==304||G==n.lastModified[D]}catch(E){}return false},httpData:function(I,G,F){var E=I.getResponseHeader("content-type"),D=G=="xml"||!G&&E&&E.indexOf("xml")>=0,H=D?I.responseXML:I.responseText;if(D&&H.documentElement.tagName=="parsererror"){throw"parsererror"}if(F&&F.dataFilter){H=F.dataFilter(H,G)}if(typeof H==="string"){if(G=="script"){n.globalEval(H)}if(G=="json"){H=l["eval"]("("+H+")")}}return H},param:function(D){var F=[];function G(H,I){F[F.length]=encodeURIComponent(H)+"="+encodeURIComponent(I)}if(n.isArray(D)||D.jquery){n.each(D,function(){G(this.name,this.value)})}else{for(var E in D){if(n.isArray(D[E])){n.each(D[E],function(){G(E,this)})}else{G(E,n.isFunction(D[E])?D[E]():D[E])}}}return F.join("&").replace(/%20/g,"+")}});var m={},d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function s(E,D){var F={};n.each(d.concat.apply([],d.slice(0,D)),function(){F[this]=E});return F}n.fn.extend({show:function(I,K){if(I){return this.animate(s("show",3),I,K)}else{for(var G=0,E=this.length;G<E;G++){var D=n.data(this[G],"olddisplay");this[G].style.display=D||"";if(n.css(this[G],"display")==="none"){var F=this[G].tagName,J;if(m[F]){J=m[F]}else{var H=n("<"+F+" />").appendTo("body");J=H.css("display");if(J==="none"){J="block"}H.remove();m[F]=J}this[G].style.display=n.data(this[G],"olddisplay",J)}}return this}},hide:function(G,H){if(G){return this.animate(s("hide",3),G,H)}else{for(var F=0,E=this.length;F<E;F++){var D=n.data(this[F],"olddisplay");if(!D&&D!=="none"){n.data(this[F],"olddisplay",n.css(this[F],"display"))}this[F].style.display="none"}return this}},_toggle:n.fn.toggle,toggle:function(F,E){var D=typeof F==="boolean";return n.isFunction(F)&&n.isFunction(E)?this._toggle.apply(this,arguments):F==null||D?this.each(function(){var G=D?F:n(this).is(":hidden");n(this)[G?"show":"hide"]()}):this.animate(s("toggle",3),F,E)},fadeTo:function(D,F,E){return this.animate({opacity:F},D,E)},animate:function(H,E,G,F){var D=n.speed(E,G,F);return this[D.queue===false?"each":"queue"](function(){var J=n.extend({},D),L,K=this.nodeType==1&&n(this).is(":hidden"),I=this;for(L in H){if(H[L]=="hide"&&K||H[L]=="show"&&!K){return J.complete.call(this)}if((L=="height"||L=="width")&&this.style){J.display=n.css(this,"display");J.overflow=this.style.overflow}}if(J.overflow!=null){this.style.overflow="hidden"}J.curAnim=n.extend({},H);n.each(H,function(N,R){var Q=new n.fx(I,J,N);if(/toggle|show|hide/.test(R)){Q[R=="toggle"?K?"show":"hide":R](H)}else{var P=R.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),S=Q.cur(true)||0;if(P){var M=parseFloat(P[2]),O=P[3]||"px";if(O!="px"){I.style[N]=(M||1)+O;S=((M||1)/Q.cur(true))*S;I.style[N]=S+O}if(P[1]){M=((P[1]=="-="?-1:1)*M)+S}Q.custom(S,M,O)}else{Q.custom(S,R,"")}}});return true})},stop:function(E,D){var F=n.timers;if(E){this.queue([])}this.each(function(){for(var G=F.length-1;G>=0;G--){if(F[G].elem==this){if(D){F[G](true)}F.splice(G,1)}}});if(!D){this.dequeue()}return this}});n.each({slideDown:s("show",1),slideUp:s("hide",1),slideToggle:s("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(D,E){n.fn[D]=function(F,G){return this.animate(E,F,G)}});n.extend({speed:function(F,G,E){var D=typeof F==="object"?F:{complete:E||!E&&G||n.isFunction(F)&&F,duration:F,easing:E&&G||G&&!n.isFunction(G)&&G};D.duration=n.fx.off?0:typeof D.duration==="number"?D.duration:n.fx.speeds[D.duration]||n.fx.speeds._default;D.old=D.complete;D.complete=function(){if(D.queue!==false){n(this).dequeue()}if(n.isFunction(D.old)){D.old.call(this)}};return D},easing:{linear:function(F,G,D,E){return D+E*F},swing:function(F,G,D,E){return((-Math.cos(F*Math.PI)/2)+0.5)*E+D}},timers:[],timerId:null,fx:function(E,D,F){this.options=D;this.elem=E;this.prop=F;if(!D.orig){D.orig={}}}});n.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(n.fx.step[this.prop]||n.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(E){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var D=parseFloat(n.css(this.elem,this.prop,E));return D&&D>-10000?D:parseFloat(n.curCSS(this.elem,this.prop))||0},custom:function(H,G,F){this.startTime=e();this.start=H;this.end=G;this.unit=F||this.unit||"px";this.now=this.start;this.pos=this.state=0;var D=this;function E(I){return D.step(I)}E.elem=this.elem;n.timers.push(E);if(E()&&n.timerId==null){n.timerId=setInterval(function(){var J=n.timers;for(var I=0;I<J.length;I++){if(!J[I]()){J.splice(I--,1)}}if(!J.length){clearInterval(n.timerId);n.timerId=null}},13)}},show:function(){this.options.orig[this.prop]=n.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());n(this.elem).show()},hide:function(){this.options.orig[this.prop]=n.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(G){var F=e();if(G||F>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var D=true;for(var E in this.options.curAnim){if(this.options.curAnim[E]!==true){D=false}}if(D){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(n.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){n(this.elem).hide()}if(this.options.hide||this.options.show){for(var H in this.options.curAnim){n.attr(this.elem.style,H,this.options.orig[H])}}}if(D){this.options.complete.call(this.elem)}return false}else{var I=F-this.startTime;this.state=I/this.options.duration;this.pos=n.easing[this.options.easing||(n.easing.swing?"swing":"linear")](this.state,I,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};n.extend(n.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(D){n.attr(D.elem.style,"opacity",D.now)},_default:function(D){if(D.elem.style&&D.elem.style[D.prop]!=null){D.elem.style[D.prop]=D.now+D.unit}else{D.elem[D.prop]=D.now}}}});if(document.documentElement.getBoundingClientRect){n.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return n.offset.bodyOffset(this[0])}var F=this[0].getBoundingClientRect(),I=this[0].ownerDocument,E=I.body,D=I.documentElement,K=D.clientTop||E.clientTop||0,J=D.clientLeft||E.clientLeft||0,H=F.top+(self.pageYOffset||n.boxModel&&D.scrollTop||E.scrollTop)-K,G=F.left+(self.pageXOffset||n.boxModel&&D.scrollLeft||E.scrollLeft)-J;return{top:H,left:G}}}else{n.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return n.offset.bodyOffset(this[0])}n.offset.initialized||n.offset.initialize();var I=this[0],F=I.offsetParent,E=I,N=I.ownerDocument,L,G=N.documentElement,J=N.body,K=N.defaultView,D=K.getComputedStyle(I,null),M=I.offsetTop,H=I.offsetLeft;while((I=I.parentNode)&&I!==J&&I!==G){L=K.getComputedStyle(I,null);M-=I.scrollTop,H-=I.scrollLeft;if(I===F){M+=I.offsetTop,H+=I.offsetLeft;if(n.offset.doesNotAddBorder&&!(n.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(I.tagName))){M+=parseInt(L.borderTopWidth,10)||0,H+=parseInt(L.borderLeftWidth,10)||0}E=F,F=I.offsetParent}if(n.offset.subtractsBorderForOverflowNotVisible&&L.overflow!=="visible"){M+=parseInt(L.borderTopWidth,10)||0,H+=parseInt(L.borderLeftWidth,10)||0}D=L}if(D.position==="relative"||D.position==="static"){M+=J.offsetTop,H+=J.offsetLeft}if(D.position==="fixed"){M+=Math.max(G.scrollTop,J.scrollTop),H+=Math.max(G.scrollLeft,J.scrollLeft)}return{top:M,left:H}}}n.offset={initialize:function(){if(this.initialized){return}var K=document.body,E=document.createElement("div"),G,F,M,H,L,D,I=K.style.marginTop,J='<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>';L={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(D in L){E.style[D]=L[D]}E.innerHTML=J;K.insertBefore(E,K.firstChild);G=E.firstChild,F=G.firstChild,H=G.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(F.offsetTop!==5);this.doesAddBorderForTableAndCells=(H.offsetTop===5);G.style.overflow="hidden",G.style.position="relative";this.subtractsBorderForOverflowNotVisible=(F.offsetTop===-5);K.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(K.offsetTop===0);K.style.marginTop=I;K.removeChild(E);this.initialized=true},bodyOffset:function(D){n.offset.initialized||n.offset.initialize();var F=D.offsetTop,E=D.offsetLeft;if(n.offset.doesNotIncludeMarginInBodyOffset){F+=parseInt(n.curCSS(D,"marginTop",true),10)||0,E+=parseInt(n.curCSS(D,"marginLeft",true),10)||0}return{top:F,left:E}}};n.fn.extend({position:function(){var H=0,G=0,E;if(this[0]){var F=this.offsetParent(),I=this.offset(),D=/^body|html$/i.test(F[0].tagName)?{top:0,left:0}:F.offset();I.top-=j(this,"marginTop");I.left-=j(this,"marginLeft");D.top+=j(F,"borderTopWidth");D.left+=j(F,"borderLeftWidth");E={top:I.top-D.top,left:I.left-D.left}}return E},offsetParent:function(){var D=this[0].offsetParent||document.body;while(D&&(!/^body|html$/i.test(D.tagName)&&n.css(D,"position")=="static")){D=D.offsetParent}return n(D)}});n.each(["Left","Top"],function(E,D){var F="scroll"+D;n.fn[F]=function(G){if(!this[0]){return null}return G!==g?this.each(function(){this==l||this==document?l.scrollTo(!E?G:n(l).scrollLeft(),E?G:n(l).scrollTop()):this[F]=G}):this[0]==l||this[0]==document?self[E?"pageYOffset":"pageXOffset"]||n.boxModel&&document.documentElement[F]||document.body[F]:this[0][F]}});n.each(["Height","Width"],function(G,E){var D=G?"Left":"Top",F=G?"Right":"Bottom";n.fn["inner"+E]=function(){return this[E.toLowerCase()]()+j(this,"padding"+D)+j(this,"padding"+F)};n.fn["outer"+E]=function(I){return this["inner"+E]()+j(this,"border"+D+"Width")+j(this,"border"+F+"Width")+(I?j(this,"margin"+D)+j(this,"margin"+F):0)};var H=E.toLowerCase();n.fn[H]=function(I){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+E]||document.body["client"+E]:this[0]==document?Math.max(document.documentElement["client"+E],document.body["scroll"+E],document.documentElement["scroll"+E],document.body["offset"+E],document.documentElement["offset"+E]):I===g?(this.length?n.css(this[0],H):null):this.css(H,typeof I==="string"?I:I+"px")}})})();

/**
* jQuery.ScrollTo - Easy element scrolling using jQuery.
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 3/9/2009
* @author Ariel Flesler
* @version 1.4.1
*
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
*/

;(function($){var m=$.scrollTo=function(b,h,f){$(window).scrollTo(b,h,f)};m.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1};m.window=function(b){return $(window).scrollable()};$.fn.scrollable=function(){return this.map(function(){var b=this,h=!b.nodeName||$.inArray(b.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!h)return b;var f=(b.contentWindow||b).document||b.ownerDocument||b;return $.browser.safari||f.compatMode=='BackCompat'?f.body:f.documentElement})};$.fn.scrollTo=function(l,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};if(l=='max')l=9e9;a=$.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=$(k),d=l,p,g={},q=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px)?$/.test(d)){d=n(d);break}d=$(d,this);case'object':if(d.is||d.style)p=(d=$(d)).offset()}$.each(a.axis.split(''),function(b,h){var f=h=='x'?'Left':'Top',i=f.toLowerCase(),c='scroll'+f,r=k[c],s=h=='x'?'Width':'Height';if(p){g[c]=p[i]+(q?0:r-o.offset()[i]);if(a.margin){g[c]-=parseInt(d.css('margin'+f))||0;g[c]-=parseInt(d.css('border'+f+'Width'))||0}g[c]+=a.offset[i]||0;if(a.over[i])g[c]+=d[s.toLowerCase()]()*a.over[i]}else g[c]=d[i];if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],u(s));if(!b&&a.queue){if(r!=g[c])t(a.onAfterFirst);delete g[c]}});t(a.onAfter);function t(b){o.animate(g,j,a.easing,b&&function(){b.call(this,l,a)})};function u(b){var h='scroll'+b;if(!q)return k[h];var f='client'+b,i=k.ownerDocument.documentElement,c=k.ownerDocument.body;return Math.max(i[h],c[h])-Math.min(i[f],c[f])}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);

/**
* jQuery.LocalScroll - Animated scrolling navigation, using anchors.
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 3/11/2009
* @author Ariel Flesler
* @version 1.2.7
**/
;(function($){var l=location.href.replace(/#.*/,'');var g=$.localScroll=function(a){$('body').localScroll(a)};g.defaults={duration:1e3,axis:'y',event:'click',stop:true,target:window,reset:true};g.hash=function(a){if(location.hash){a=$.extend({},g.defaults,a);a.hash=false;if(a.reset){var e=a.duration;delete a.duration;$(a.target).scrollTo(0,a);a.duration=e}i(0,location,a)}};$.fn.localScroll=function(b){b=$.extend({},g.defaults,b);return b.lazy?this.bind(b.event,function(a){var e=$([a.target,a.target.parentNode]).filter(d)[0];if(e)i(a,e,b)}):this.find('a,area').filter(d).bind(b.event,function(a){i(a,this,b)}).end().end();function d(){return!!this.href&&!!this.hash&&this.href.replace(this.hash,'')==l&&(!b.filter||$(this).is(b.filter))}};function i(a,e,b){var d=e.hash.slice(1),f=document.getElementById(d)||document.getElementsByName(d)[0];if(!f)return;if(a)a.preventDefault();var h=$(b.target);if(b.lock&&h.is(':animated')||b.onBefore&&b.onBefore.call(b,a,f,h)===false)return;if(b.stop)h.stop(true);if(b.hash){var j=f.id==d?'id':'name',k=$('<a> </a>').attr(j,d).css({position:'absolute',top:$(window).scrollTop(),left:$(window).scrollLeft()});f[j]='';$('body').prepend(k);location=e.hash;k.remove();f[j]=d}h.scrollTo(f,b).trigger('notify.serialScroll',[f])}})(jQuery);

/**
* Favicons 1.0
*
* Prepends or appends a favicon image to all external links
*
* Usage: jQuery.favicons();
* 
* @class favicons
* @param {Object} conf, custom config-object
*
* Copyright (c) 2008 Andreas Lagerkvist (andreaslagerkvist.com)
* Released under a GNU General Public License v3 (http://creativecommons.org/licenses/by/3.0/)
*/
jQuery.favicons = function(conf) {
  var config = {
    insert: 'prepend', 
    defaultIco: 'favicon.png'
  };

  config = jQuery.extend(config, conf);

  jQuery('a.favicon').each(function() {
    var link = jQuery(this);
    var faviconURL = link.attr('href').replace(/^(http:\/\/[^\/]+).*$/, '$1') +'/favicon.ico';
    var faviconIMG = jQuery('<img class="faviconlink" width="16" height="16" src="' +config.defaultIco +'" alt="" /> ')[config.insert +'To'](link);
    var extImg = new Image();

    extImg.src = faviconURL;

    if(extImg.complete) {
      faviconIMG.attr('src', faviconURL);
    }
    else {
      extImg.onload = function() {
        faviconIMG.attr('src', faviconURL);
      };
    }
  });
};

function makeGlosses()
{
  var as = document.getElementsByTagName('a')
  for( var i = 0; i < as.length; i++)
  {
    if (as[i].className == "gloss")
    {
      g = as[i];
      g.glossTitle = g.title;
      g.title = "";
      g.glossElement = makeGloss("Begriffserklärung", g.glossTitle);

      g.onmouseover = glossover;
      g.onmouseout = glossout;
      g.onmousemove = glossmove;
    }
  }
}

function makeGloss(caption, text)
{
  var div = document.createElement('div');
  div.className = "glossPopup";
  div.style.position = "absolute";
  div.style.display = "none";

  var strong = document.createElement('strong');
  div.appendChild(strong);
  strong.appendChild(document.createTextNode(caption));

  var span = document.createElement('span');
  div.appendChild(span);
  span.appendChild(document.createTextNode(text));

  document.body.appendChild(div);
  return div;
}

function glossover(ev)
{
  if (!ev) ev = window.event;
  var el = document.all ? ev.srcElement.glossElement : ev.target.glossElement;       
  el.style.display = "";

  glossmove(ev);
}

function glossmove(ev)
{
  if (!ev) ev = window.event;
  var el = document.all ? ev.srcElement.glossElement : ev.target.glossElement;

  // get current absolute mouseposition
  var x = (ev.clientX + document.documentElement.scrollLeft);
  var y = (ev.clientY + document.documentElement.scrollTop);

  // get size of our page
  var w = (window.innerWidth ? window.innerWidth : document.documentElement.offsetWidth) + document.documentElement.scrollLeft;
  var h = (window.innerHeight ? window.innerHeight : document.documentElement.offsetHeight) + document.documentElement.scrollTop;

  // get the size of our element to be displayed
  var elw = el.offsetWidth;
  var elh = el.offsetHeight

  var xOffset = 10;
  var yOffset = 10;

  if ( (y + el.offsetHeight + yOffset) > h )
  {
    y -= el.offsetHeight;
    yOffset *= -1;
  }

  if ( (x + el.offsetWidth + xOffset) > w )
  {
    x -= el.offsetWidth;
    xOffset *= -1;
  }

  el.style.top = y + yOffset + "px"; 
  el.style.left = x + xOffset + "px"; 
}

function glossout(ev)
{ 
  if (!ev) ev = window.event;
  var el = document.all ? ev.srcElement.glossElement : ev.target.glossElement;

  el.style.display = "none"; 
}

/**
* SyntaxHighlighter
* http://alexgorbatchev.com/
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
*
* @version
* 2.0.296 (March 01 2009)
* 
* @copyright
* Copyright (C) 2004-2009 Alex Gorbatchev.
*
* @license
* This file is part of SyntaxHighlighter.
* 
* SyntaxHighlighter is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 
* SyntaxHighlighter is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with SyntaxHighlighter.  If not, see <http://www.gnu.org/licenses/>.
*/
//
// Begin anonymous function. This is used to contain local scope variables without polutting global scope.
//
if (!window.SyntaxHighlighter) var SyntaxHighlighter = function() { 

// Shortcut object which will be assigned to the SyntaxHighlighter variable.
// This is a shorthand for local reference in order to avoid long namespace 
// references to SyntaxHighlighter.whatever...
var sh = {
defaults : {
  /** Additional CSS class names to be added to highlighter elements. */
  'class-name' : '',
  
  /** First line number. */
  'first-line' : 1,
  
  /** Font size of the SyntaxHighlighter block. */
  'font-size' : null,
  
  /** Lines to highlight. */
  'highlight' : null,
  
  /** Enables or disables smart tabs. */
  'smart-tabs' : true,
  
  /** Gets or sets tab size. */
  'tab-size' : 4,
  
  /** Enables or disables ruler. */
  'ruler' : false,
  
  /** Enables or disables gutter. */
  'gutter' : true,
  
  /** Enables or disables toolbar. */
  'toolbar' : true,
  
  /** Forces code view to be collapsed. */
  'collapse' : false,
  
  /** Enables or disables automatic links. */
  'auto-links' : true,
  
  /** Gets or sets light mode. Equavalent to turning off gutter and toolbar. */
  'light' : false
},

config : {
  /** Path to the copy to clipboard SWF file. */
  clipboardSwf : null,

  /** Width of an item in the toolbar. */
  toolbarItemWidth : 16,

  /** Height of an item in the toolbar. */
  toolbarItemHeight : 16,
  
  /** Blogger mode flag. */
  bloggerMode : false,
  
  /** Name of the tag that SyntaxHighlighter will automatically look for. */
  tagName : 'pre',
  
  strings : {
   expandSource : 'expand source',
   viewSource : 'view source',
   copyToClipboard : 'copy to clipboard',
   copyToClipboardConfirmation : 'The code is in your clipboard now',
   print : 'print',
   help : '?',
   alert: 'SyntaxHighlighter\n\n',
   noBrush : 'Can\'t find brush for: ',
   brushNotHtmlScript : 'Brush wasn\'t configured for html-script option: ',
   
   // this is populated by the build script
   aboutDialog : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>About SyntaxHighlighter</title></head><body style="font-family:Georgia,\'Times New Roman\',Times,serif;background-color:#fff;color:#000;font-size:1em;text-align:center;"><div style="text-align:center;margin-top:3em;"><div style="font-family:Geneva,Arial,Helvetica,sans-serif;font-size:xx-large;">SyntaxHighlighter</div><div style="font-size:.75em;margin-bottom:4em;"><div>version 2.0.296 (March 01 2009)</div><div><a href="http://alexgorbatchev.com" target="_blank" style="color:#0099FF;text-decoration:none;">http://alexgorbatchev.com</a></div></div><div>JavaScript code syntax highlighter.</div><div>Copyright 2004-2009 Alex Gorbatchev.</div></div></body></html>'
  },

  /** If true, output will show HTML produces instead. */
  debug : false
},

/** Internal 'global' variables. */
vars : {
  discoveredBrushes : null,
  spaceWidth : null,
  printFrame : null,
  highlighters : {}
},

/** This object is populated by user included external brush files. */  
brushes : {},

/** Common regular expressions. */
regexLib : {
  multiLineCComments   : /\/\*[\s\S]*?\*\//gm,
  singleLineCComments   : /\/\/.*$/gm,
  singleLinePerlComments  : /#.*$/gm,
  doubleQuotedString   : /"(?:\.|(\\\")|[^\""\n])*"/g,
  singleQuotedString   : /'(?:\.|(\\\')|[^\''\n])*'/g,
  multiLineDoubleQuotedString : /"(?:\.|(\\\")|[^\""])*"/g,
  multiLineSingleQuotedString : /'(?:\.|(\\\')|[^\''])*'/g,
  url       : /\w+:\/\/[\w-.\/?%&=]*/g,
  
  /** <?= ?> tags. */
  phpScriptTags     : { left: /(&lt;|<)\?=?/g, right: /\?(&gt;|>)/g },
  
  /** <%= %> tags. */
  aspScriptTags    : { left: /(&lt;|<)%=?/g, right: /%(&gt;|>)/g },
  
  /** <script></script> tags. */
  scriptScriptTags   : { left: /(&lt;|<)\s*script.*?(&gt;|>)/gi, right: /(&lt;|<)\/\s*script\s*(&gt;|>)/gi }
},

toolbar : {
  /**
   * Creates new toolbar for a highlighter.
   * @param {Highlighter} highlighter    Target highlighter.
   */
  create : function(highlighter)
  {
   var div = document.createElement('DIV'),
    items = sh.toolbar.items
    ;
   
   div.className = 'toolbar';
   
   for (var name in items) 
   {
    var constructor = items[name],
     command = new constructor(highlighter),
     element = command.create()
     ;
    
    highlighter.toolbarCommands[name] = command;
    
    if (element == null)
     continue;
     
    if (typeof(element) == 'string')
     element = sh.toolbar.createButton(element, highlighter.id, name);
    
    element.className += 'item ' + name;
    div.appendChild(element);
   }
   
   return div;
  },
  
  /**
   * Create a standard anchor button for the toolbar.
   * @param {String} label   Label text to display.
   * @param {String} highlighterId Highlighter ID that this button would belong to.
   * @param {String} commandName  Command name that would be executed.
   * @return {Element}    Returns an 'A' element.
   */
  createButton : function(label, highlighterId, commandName)
  {
   var a = document.createElement('a'),
    style = a.style,
    config = sh.config,
    width = config.toolbarItemWidth,
    height = config.toolbarItemHeight
    ;
   
   a.href = '#' + commandName;
   a.title = label;
   a.highlighterId = highlighterId;
   a.commandName = commandName;
   a.innerHTML = label;
   
   if (isNaN(width) == false)
    style.width = width + 'px';

   if (isNaN(height) == false)
    style.height = height + 'px';
   
   a.onclick = function(e)
   {
    try
    {
     sh.toolbar.executeCommand(
      this, 
      e || window.event,
      this.highlighterId, 
      this.commandName
     );
    }
    catch(e)
    {
     sh.utils.alert(e.message);
    }
    
    return false;
   };
   
   return a;
  },
  
  /**
   * Executes a toolbar command.
   * @param {Element}  sender    Sender element.
   * @param {MouseEvent} event   Original mouse event object.
   * @param {String}  highlighterId Highlighter DIV element ID.
   * @param {String}  commandName  Name of the command to execute.
   * @return {Object} Passes out return value from command execution.
   */
  executeCommand : function(sender, event, highlighterId, commandName, args)
  {
   var highlighter = sh.vars.highlighters[highlighterId], 
    command
    ;

   if (highlighter == null || (command = highlighter.toolbarCommands[commandName]) == null) 
    return null;

   return command.execute(sender, event, args);
  },
  
  /** Collection of toolbar items. */
  items : {
   expandSource : function(highlighter)
   {
    this.create = function()
    {
     if (highlighter.getParam('collapse') != true)
      return;
     
     return sh.config.strings.expandSource;
    };
   
    this.execute = function(sender, event, args)
    {
     var div = highlighter.div;
     
     sender.parentNode.removeChild(sender);
     div.className = div.className.replace('collapsed', '');
    };
   },
  
   /** 
    * Command to open a new window and display the original unformatted source code inside.
    */
   viewSource : function(highlighter)
   {
    this.create = function()
    {
     return sh.config.strings.viewSource;
    };
    
    this.execute = function(sender, event, args)
    {
     var code = sh.utils.fixForBlogger(highlighter.originalCode).replace(/</g, '&lt;'),
      wnd = sh.utils.popup('', '_blank', 750, 400, 'location=0, resizable=1, menubar=0, scrollbars=1')
      ;
     
     code = sh.utils.unindent(code);
     
     wnd.document.write('<pre>' + code + '</pre>');
     wnd.document.close();
    };
   },
   
   /**
    * Command to copy the original source code in to the clipboard.
    * Uses Flash method if <code>clipboardSwf</code> is configured.
    */
   copyToClipboard : function(highlighter)
   {
    var flashDiv, flashSwf,
     highlighterId = highlighter.id
     ;
    
    this.create = function()
    {
     var config = sh.config;
     
     // disable functionality if running locally
     if (config.clipboardSwf == null)
      return null;

     function params(list)
     {
      var result = '';
      
      for (var name in list)
       result += "<param name='" + name + "' value='" + list[name] + "'/>";
       
      return result;
     };
     
     function attributes(list)
     {
      var result = '';
      
      for (var name in list)
       result += " " + name + "='" + list[name] + "'";
       
      return result;
     };
     
     var args1 = {
       width    : config.toolbarItemWidth,
       height    : config.toolbarItemHeight,
       id     : highlighterId + '_clipboard',
       type    : 'application/x-shockwave-flash',
       title    : sh.config.strings.copyToClipboard
      },
      
      // these arguments are used in IE's <param /> collection
      args2 = {
       allowScriptAccess : 'always',
       wmode    : 'transparent',
       flashVars   : 'highlighterId=' + highlighterId,
       menu    : 'false'
      },
      swf = config.clipboardSwf,
      html
     ;

     if (/msie/i.test(navigator.userAgent))
     {
      html = '<object'
       + attributes({
        classid : 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',
        codebase : 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'
       })
       + attributes(args1)
       + '>'
       + params(args2)
       + params({ movie : swf })
       + '</object>'
      ;
     }
     else
     {
      html = '<embed'
       + attributes(args1)
       + attributes(args2)
       + attributes({ src : swf })
       + '/>'
      ;
     }

     flashDiv = document.createElement('div');
     flashDiv.innerHTML = html;
     
     return flashDiv;
    };
    
    this.execute = function(sender, event, args)
    {
     var command = args.command;

     switch (command)
     {
      case 'get':
       var code = sh.utils.unindent(
        sh.utils.fixForBlogger(highlighter.originalCode)
         .replace(/&lt;/g, '<')
         .replace(/&gt;/g, '>')
         .replace(/&amp;/g, '&')
        );

       if(window.clipboardData)
        // will fall through to the confirmation because there isn't a break
        window.clipboardData.setData('text', code);
       else
        return sh.utils.unindent(code);
       
      case 'ok':
       sh.utils.alert(sh.config.strings.copyToClipboardConfirmation);
       break;
       
      case 'error':
       sh.utils.alert(args.message);
       break;
     }
    };
   },
   
   /** Command to print the colored source code. */
   printSource : function(highlighter)
   {
    this.create = function()
    {
     return sh.config.strings.print;
    };
    
    this.execute = function(sender, event, args)
    {
     var iframe = document.createElement('IFRAME'),
      doc = null
      ;
     
     // make sure there is never more than one hidden iframe created by SH
     if (sh.vars.printFrame != null)
      document.body.removeChild(sh.vars.printFrame);
     
     sh.vars.printFrame = iframe;
     
     // this hides the iframe
     iframe.style.cssText = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';
    
     document.body.appendChild(iframe);
     doc = iframe.contentWindow.document;
     
     copyStyles(doc, window.document);
     doc.write('<div class="' + highlighter.div.className.replace('collapsed', '') + ' printing">' + highlighter.div.innerHTML + '</div>');
     doc.close();
     
     iframe.contentWindow.focus();
     iframe.contentWindow.print();
     
     function copyStyles(destDoc, sourceDoc)
     {
      var links = sourceDoc.getElementsByTagName('link');
     
      for(var i = 0; i < links.length; i++)
       if(links[i].rel.toLowerCase() == 'stylesheet' && /shCore\.css$/.test(links[i].href))
        destDoc.write('<link type="text/css" rel="stylesheet" href="' + links[i].href + '"></link>');
     };
    };
   },

   /** Command to display the about dialog window. */
   about : function(highlighter)
   {
    this.create = function()
    { 
     return sh.config.strings.help;
    };

    this.execute = function(sender, event)
    { 
     var wnd = sh.utils.popup('', '_blank', 500, 250, 'scrollbars=0'),
      doc = wnd.document
      ;
     
     doc.write(sh.config.strings.aboutDialog);
     doc.close();
     wnd.focus();
    };
   }
  }
},

utils : {
  guid : function(prefix)
  {
   return prefix + Math.round(Math.random() * 1000000).toString();
  },
  
  /**
   * Merges two objects. Values from obj2 override values in obj1.
   * Function is NOT recursive and works only for one dimensional objects.
   * @param {Object} obj1 First object.
   * @param {Object} obj2 Second object.
   * @return {Object} Returns combination of both objects.
   */
  merge: function(obj1, obj2)
  {
   var result = {}, name;

   for (name in obj1) 
    result[name] = obj1[name];
   
   for (name in obj2) 
    result[name] = obj2[name];
    
   return result;
  },
  
  /**
   * Attempts to convert string to boolean.
   * @param {String} value Input string.
   * @return {Boolean} Returns true if input was "true", false if input was "false" and value otherwise.
   */
  toBoolean: function(value)
  {
   switch (value)
   {
    case "true":
     return true;
     
    case "false":
     return false;
   }
   
   return value;
  },
  
  /**
   * Opens up a centered popup window.
   * @param {String} url  URL to open in the window.
   * @param {String} name  Popup name.
   * @param {int} width  Popup width.
   * @param {int} height  Popup height.
   * @param {String} options window.open() options.
   * @return {Window}   Returns window instance.
   */
  popup: function(url, name, width, height, options)
  {
   var x = (screen.width - width) / 2,
    y = (screen.height - height) / 2
    ;
    
   options += ', left=' + x + 
      ', top=' + y +
      ', width=' + width +
      ', height=' + height
    ;
   options = options.replace(/^,/, '');

   var win = window.open(url, name, options);
   win.focus();
   return win;
  },
  
  /**
   * Adds event handler to the target object.
   * @param {Object} obj  Target object.
   * @param {String} type  Name of the event.
   * @param {Function} func Handling function.
   */
  addEvent: function(obj, type, func)
  {
   if (obj.attachEvent) 
   {
    obj['e' + type + func] = func;
    obj[type + func] = function()
    {
     obj['e' + type + func](window.event);
    }
    obj.attachEvent('on' + type, obj[type + func]);
   }
   else 
   {
    obj.addEventListener(type, func, false);
   }
  },
  
  /**
   * Displays an alert.
   * @param {String} str String to display.
   */
  alert: function(str)
  {
   alert(sh.config.strings.alert + str)
  },
  
  /**
   * Finds a brush by its alias.
   *
   * @param {String} alias Brush alias.
   * @param {Boolean} alert Suppresses the alert if false.
   * @return {Brush}   Returns bursh constructor if found, null otherwise.
   */
  findBrush: function(alias, alert)
  {
   var brushes = sh.vars.discoveredBrushes,
    result = null
    ;
   
   if (brushes == null) 
   {
    brushes = {};
    
    // Find all brushes
    for (var brush in sh.brushes) 
    {
     var aliases = sh.brushes[brush].aliases;
     
     if (aliases == null) 
      continue;
     
     for (var i = 0; i < aliases.length; i++) 
      brushes[aliases[i]] = brush;
    }
    
    sh.vars.discoveredBrushes = brushes;
   }
   
   result = sh.brushes[brushes[alias]];

   if (result == null && alert != false)
    sh.utils.alert(sh.config.strings.noBrush + alias);
   
   return result;
  },
  
  /**
   * Executes a callback on each line and replaces each line with result from the callback.
   * @param {Object} str   Input string.
   * @param {Object} callback  Callback function taking one string argument and returning a string.
   */
  eachLine: function(str, callback)
  {
   var lines = str.split('\n');
   
   for (var i = 0; i < lines.length; i++)
    lines[i] = callback(lines[i]);
    
   return lines.join('\n');
  },
  
  /**
   * Creates rules looking div.
   */
  createRuler: function()
  {
   var div = document.createElement('div'),
    ruler = document.createElement('div'),
    showEvery = 10,
    i = 1
    ;
   
   while (i <= 150) 
   {
    if (i % showEvery === 0) 
    {
     div.innerHTML += i;
     i += (i + '').length;
    }
    else 
    {
     div.innerHTML += '&middot;';
     i++;
    }
   }
   
   ruler.className = 'ruler line';
   ruler.appendChild(div);

   return ruler;
  },

  /**
   * This is a special trim which only removes first and last empty lines
   * and doesn't affect valid leading space on the first line.
   * 
   * @param {String} str   Input string
   * @return {String}      Returns string without empty first and last lines.
   */
  trimFirstAndLastLines: function(str)
  {
   return str.replace(/^[ ]*[\n]+|[\n]*[ ]*$/g, '');
  },
  
  /**
   * Parses key/value pairs into hash object.
   * 
   * Understands the following formats:
   * - name: word;
   * - name: [word, word];
   * - name: "string";
   * - name: 'string';
   * 
   * For example:
   *   name1: value; name2: [value, value]; name3: 'value'
   *   
   * @param {String} str    Input string.
   * @return {Object}       Returns deserialized object.
   */
  parseParams: function(str)
  {
   var match, 
    result = {},
    arrayRegex = new XRegExp("^\\[(?<values>(.*?))\\]$"),
    regex = new XRegExp(
     "(?<name>[\\w-]+)" +
     "\\s*:\\s*" +
     "(?<value>" +
      "[\\w-%#]+|" +  // word
      "\\[.*?\\]|" +  // [] array
      '".*?"|' +   // "" string
      "'.*?'" +   // '' string
     ")\\s*;?",
     "g"
    )
    ;

   while ((match = regex.exec(str)) != null) 
   {
    var value = match.value
     .replace(/^['"]|['"]$/g, '') // strip quotes from end of strings
     ;
    
    // try to parse array value
    if (value != null && arrayRegex.test(value))
    {
     var m = arrayRegex.exec(value);
     value = m.values.length > 0 ? m.values.split(/\s*,\s*/) : [];
    }
    
    result[match.name] = value;
   }
   
   return result;
  },

  /**
   * Wraps each line of the string into <code/> tag with given style applied to it.
   * 
   * @param {String} str   Input string.
   * @param {String} css   Style name to apply to the string.
   * @return {String}      Returns input string with each line surrounded by <span/> tag.
   */
  decorate: function(str, css)
  {
   if (str == null || str.length == 0 || str == '\n') 
    return str;

   str = str.replace(/</g, '&lt;');

   // Replace two or more sequential spaces with &nbsp; leaving last space untouched.
   str = str.replace(/ {2,}/g, function(m)
   {
    var spaces = '';
    
    for (var i = 0; i < m.length - 1; i++)
     spaces += '&nbsp;';
    
    return spaces + ' ';
   });

   // Split each line and apply <span class="...">...</span> to them so that
   // leading spaces aren't included.
   if (css != null) 
    str = sh.utils.eachLine(str, function(line)
    {
     if (line.length == 0) 
      return '';
     
     var spaces = '';
     
     line = line.replace(/^(&nbsp;| )+/, function(s)
     {
      spaces = s;
      return '';
     });
     
     if (line.length == 0) 
      return spaces;
     
     return spaces + '<code class="' + css + '">' + line + '</code>';
    });

   return str;
  },

  /**
   * Pads number with zeros until it's length is the same as given length.
   * 
   * @param {Number} number Number to pad.
   * @param {Number} length Max string length with.
   * @return {String}   Returns a string padded with proper amount of '0'.
   */
  padNumber : function(number, length)
  {
   var result = number.toString();
   
   while (result.length < length)
    result = '0' + result;
   
   return result;
  },
  
  /**
   * Measures width of a single space character.
   * @return {Number} Returns width of a single space character.
   */
  measureSpace : function()
  {
   var container = document.createElement('div'),
    span,
    result = 0,
    body = document.body,
    id = sh.utils.guid('measureSpace'),
    
    // variable names will be compressed, so it's better than a plain string
    divOpen = '<div class="',
    closeDiv = '</div>',
    closeSpan = '</span>'
    ;

   // we have to duplicate highlighter nested structure in order to get an acurate space measurment
   container.innerHTML = 
    divOpen + 'syntaxhighlighter">' 
     + divOpen + 'lines">' 
      + divOpen + 'line">' 
       + divOpen + 'content'
        + '"><span class="block"><span id="' + id + '">&nbsp;' + closeSpan + closeSpan
       + closeDiv 
      + closeDiv 
     + closeDiv 
    + closeDiv
    ;
   
   body.appendChild(container);
   span = document.getElementById(id);
   
   if (/opera/i.test(navigator.userAgent))
   {
    var style = window.getComputedStyle(span, null);
    result = parseInt(style.getPropertyValue("width"));
   }
   else
   {
    result = span.offsetWidth;
   }

   body.removeChild(container);

   return result;
  },
  
  /**
   * Replaces tabs with spaces.
   * 
   * @param {String} code  Source code.
   * @param {Number} tabSize Size of the tab.
   * @return {String}   Returns code with all tabs replaces by spaces.
   */
  processTabs : function(code, tabSize)
  {
   var tab = '';
   
   for (var i = 0; i < tabSize; i++)
    tab += ' ';

   return code.replace(/\t/g, tab);
  },
  
  /**
   * Replaces tabs with smart spaces.
   * 
   * @param {String} code    Code to fix the tabs in.
   * @param {Number} tabSize Number of spaces in a column.
   * @return {String}        Returns code with all tabs replaces with roper amount of spaces.
   */
  processSmartTabs : function(code, tabSize)
  {
   var lines = code.split('\n'),
    tab = '\t',
    spaces = ''
    ;
   
   // Create a string with 1000 spaces to copy spaces from... 
   // It's assumed that there would be no indentation longer than that.
   for (var i = 0; i < 50; i++) 
    spaces += '                    '; // 20 spaces * 50
     
   // This function inserts specified amount of spaces in the string
   // where a tab is while removing that given tab.
   function insertSpaces(line, pos, count)
   {
    return line.substr(0, pos)
     + spaces.substr(0, count)
     + line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab
     ;
   };

   // Go through all the lines and do the 'smart tabs' magic.
   code = sh.utils.eachLine(code, function(line)
   {
    if (line.indexOf(tab) == -1) 
     return line;
    
    var pos = 0;
    
    while ((pos = line.indexOf(tab)) != -1) 
    {
     // This is pretty much all there is to the 'smart tabs' logic.
     // Based on the position within the line and size of a tab,
     // calculate the amount of spaces we need to insert.
     var spaces = tabSize - pos % tabSize;
     line = insertSpaces(line, pos, spaces);
    }
    
    return line;
   });
   
   return code;
  },
  
  fixForBlogger : function(str)
  {
   return (sh.config.bloggerMode == true) ? str.replace(/<br\s*\/?>|&lt;br\s*\/?&gt;/gi, '\n') : str;
  },
  
  /**
   * Removes all white space at the begining and end of a string.
   * 
   * @param {String} str   String to trim.
   * @return {String}      Returns string without leading and following white space characters.
   */
  trim: function(str)
  {
   return str.replace(/\s*$/g, '').replace(/^\s*/, '');
  },
  
  /**
   * Unindents a block of text by the lowest common indent amount.
   * @param {String} str   Text to unindent.
   * @return {String}      Returns unindented text block.
   */
  unindent: function(str)
  {
   var lines = sh.utils.fixForBlogger(str).split('\n'),
    indents = new Array(),
    regex = /^\s*/,
    min = 1000
    ;
   
   // go through every line and check for common number of indents
   for (var i = 0; i < lines.length && min > 0; i++) 
   {
    var line = lines[i];
    
    if (sh.utils.trim(line).length == 0) 
     continue;
    
    var matches = regex.exec(line);
    
    // In the event that just one line doesn't have leading white space
    // we can't unindent anything, so bail completely.
    if (matches == null) 
     return str;
     
    min = Math.min(matches[0].length, min);
   }
   
   // trim minimum common number of white space from the begining of every line
   if (min > 0) 
    for (var i = 0; i < lines.length; i++) 
     lines[i] = lines[i].substr(min);
   
   return lines.join('\n');
  },

  /**
   * Callback method for Array.sort() which sorts matches by
   * index position and then by length.
   * 
   * @param {Match} m1 Left object.
   * @param {Match} m2    Right object.
   * @return {Number}     Returns -1, 0 or -1 as a comparison result.
   */
  matchesSortCallback: function(m1, m2)
  {
   // sort matches by index first
   if(m1.index < m2.index)
    return -1;
   else if(m1.index > m2.index)
    return 1;
   else
   {
    // if index is the same, sort by length
    if(m1.length < m2.length)
     return -1;
    else if(m1.length > m2.length)
     return 1;
   }
   
   return 0;
  },

  /**
   * Executes given regular expression on provided code and returns all
   * matches that are found.
   * 
   * @param {String} code    Code to execute regular expression on.
   * @param {Object} regex   Regular expression item info from <code>regexList</code> collection.
   * @return {Array}         Returns a list of Match objects.
   */ 
  getMatches: function(code, regexInfo)
  {
   function defaultAdd(match, regexInfo)
   {
    return [new sh.Match(match[0], match.index, regexInfo.css)];
   };
   
   var index = 0,
    match = null,
    result = [],
    func = regexInfo.func ? regexInfo.func : defaultAdd
    ;
   
   while((match = regexInfo.regex.exec(code)) != null)
    result = result.concat(func(match, regexInfo));
    
   return result;
  },
  
  processUrls: function(code)
  {
   return code.replace(sh.regexLib.url, function(m)
   {
    return '<a href="' + m + '">' + m + '</a>';
   });
  }
}, // end of utils

/**
  * Shorthand to highlight all elements on the page that are marked as 
  * SyntaxHighlighter source code.
  * 
  * @param {Object} globalParams  Optional parameters which override element's 
  *          parameters. Only used if element is specified.
  * 
  * @param {Object} element Optional element to highlight. If none is
  *        provided, all elements in the current document 
  *        are highlighted.
  */ 
highlight : function(globalParams, element)
{
  function toArray(source)
  {
   var result = [];
   
   for (var i = 0; i < source.length; i++) 
    result.push(source[i]);
    
   return result;
  };
  
  var elements = element ? [element] : toArray(document.getElementsByTagName(sh.config.tagName)), 
   propertyName = 'innerHTML', 
   highlighter = null
   ;

  if (elements.length === 0) 
   return;

  for (var i = 0; i < elements.length; i++) 
  {
   var target = elements[i], 
    params = sh.utils.parseParams(target.className),
    brushName
    ;

   // local params take precedence over globals
   params = sh.utils.merge(globalParams, params);
   brushName = params['brush'];

   if (brushName == null)
    continue;

   // Instantiate a brush
   if (params['html-script'] == 'true') 
   {
    highlighter = new sh.HtmlScript(brushName);
   }
   else
   {
    var brush = sh.utils.findBrush(brushName);
    
    if (brush)
     highlighter = new brush();
    else
     continue;
   }
   
   highlighter.highlight(target[propertyName], params);
   
   var result = highlighter.div;
   
   if (sh.config.debug) 
   {
    result = document.createElement('textarea');
    result.value = highlighter.div.innerHTML;
    result.style.width = '70em';
    result.style.height = '30em';
   }
   
   target.parentNode.replaceChild(result, target);
  }
},

/**
  * Main entry point for the SyntaxHighlighter.
  * @param {Object} params Optional params to apply to all highlighted elements.
  */
all : function(params)
{
  sh.utils.addEvent(
   window,
   'load',
   function() { sh.highlight(params); }
  );
}
}; // end of sh

/** Match object */
sh.Match = function(value, index, css)
{
this.value = value;
this.index = index;
this.length = value.length;
this.css = css;
};

sh.Match.prototype.toString = function()
{
return this.value;
};

/**
* Simulates HTML code with a scripting language embedded.
* 
* @param {String} scriptBrushName Brush name of the scripting language.
*/
sh.HtmlScript = function(scriptBrushName)
{
var scriptBrush = sh.utils.findBrush(scriptBrushName),
  xmlBrush = new sh.brushes.Xml(),
  bracketsRegex = null
  ;

if (scriptBrush == null)
  return;

scriptBrush = new scriptBrush(); 
this.xmlBrush = xmlBrush;

if (scriptBrush.htmlScript == null)
{
  sh.utils.alert(sh.config.strings.brushNotHtmlScript + scriptBrushName);
  return;
}

xmlBrush.regexList.push(
  { regex: scriptBrush.htmlScript.code, func: process }
);

function offsetMatches(matches, offset)
{
  for (var j = 0; j < matches.length; j++) 
   matches[j].index += offset;
}

function process(match, info)
{
  var code = match.code,
   matches = [],
   regexList = scriptBrush.regexList,
   offset = match.index + match.left.length,
   htmlScript = scriptBrush.htmlScript,
   result
   ;

  for (var i = 0; i < regexList.length; i++)
  {
   result = sh.utils.getMatches(code, regexList[i]);
   offsetMatches(result, offset);
   matches = matches.concat(result);
  }
  
  if (htmlScript.left != null && match.left != null)
  {
   result = sh.utils.getMatches(match.left, htmlScript.left);
   offsetMatches(result, match.index);
   matches = matches.concat(result);
  }
  
  if (htmlScript.right != null && match.right != null)
  {
   result = sh.utils.getMatches(match.right, htmlScript.right);
   offsetMatches(result, match.index + match[0].lastIndexOf(match.right));
   matches = matches.concat(result);
  }
  
  return matches;
}
};

sh.HtmlScript.prototype.highlight = function(code, params)
{
this.xmlBrush.highlight(code, params);
this.div = this.xmlBrush.div;
}

/**
* Main Highlither class.
* @constructor
*/
sh.Highlighter = function()
{
};

sh.Highlighter.prototype = {
/**
  * Returns value of the parameter passed to the highlighter.
  * @param {String} name    Name of the parameter.
  * @param {Object} defaultValue  Default value.
  * @return {Object}     Returns found value or default value otherwise.
  */
getParam : function(name, defaultValue)
{
  var result = this.params[name];
  return sh.utils.toBoolean(result == null ? defaultValue : result);
},

/**
  * Shortcut to document.createElement().
  * @param {String} name  Name of the element to create (DIV, A, etc).
  * @return {HTMLElement} Returns new HTML element.
  */
create: function(name)
{
  return document.createElement(name);
},

/**
  * Checks if one match is inside another.
  * @param {Match} match   Match object to check.
  * @return {Boolean}      Returns true if given match was inside another, false otherwise.
  */
isMatchNested: function(match)
{
  for (var i = 0; i < this.matches.length; i++)
  {
   var item = this.matches[i];
   
   if (item === null)
    continue;
   
   if ((match.index > item.index) && (match.index < item.index + item.length))
    return true;
  }
  
  return false;
},

/**
  * Applies all regular expression to the code and stores all found
  * matches in the `this.matches` array.
  * @param {Array} regexList  List of regular expressions.
  * @param {String} code   Source code.
  * @return {Array}    Returns list of matches.
  */
findMatches: function(regexList, code)
{
  var result = [];
  
  if (regexList != null)
   for (var i = 0; i < regexList.length; i++) 
    result = result.concat(sh.utils.getMatches(code, regexList[i]));
  
  // sort the matches
  result = result.sort(sh.utils.matchesSortCallback);

  return result;
},

/**
  * Checks to see if any of the matches are inside of other matches. 
  * This process would get rid of highligted strings inside comments, 
  * keywords inside strings and so on.
  */
removeNestedMatches: function()
{
  for (var i = 0; i < this.matches.length; i++)
   if (this.isMatchNested(this.matches[i]))
    this.matches[i] = null;
},

/**
  * Splits block of text into individual DIV lines.
  * @param {String} code     Code to highlight.
  * @return {String}         Returns highlighted code in HTML form.
  */
createDisplayLines : function(code)
{
  var lines = code.split(/\n/g),
   firstLine = parseInt(this.getParam('first-line')),
   padLength = (firstLine + lines.length).toString().length,
   highlightedLines = this.getParam('highlight', [])
   ;
  
  code = '';

  for (var i = 0; i < lines.length; i++)
  {
   var line = lines[i],
    indent = /^(&nbsp;|\s)+/.exec(line),
    lineClass = 'line alt' + (i % 2 == 0 ? 1 : 2),
    lineNumber = sh.utils.padNumber(firstLine + i, padLength),
    highlighted = highlightedLines.indexOf((firstLine + i).toString()) != -1,
    spaces = null
    ;

   if (indent != null)
   {
    spaces = indent[0].toString();
    line = line.substr(spaces.length);
    spaces = spaces.replace(/&nbsp;/g, ' ');
    indent = sh.vars.spaceWidth * spaces.length;
   }
   else
   {
    indent = 0;
   }

   line = sh.utils.trim(line);
   
   if (line.length == 0)
    line = '&nbsp;';
   
   if (highlighted)
    lineClass += ' highlighted';
    
   code += 
    '<div class="' + lineClass + '">'
     + '<code class="number">' + lineNumber + '.</code>'
     + '<span class="content">'
      + (spaces != null ? '<code class="spaces">' + spaces.replace(/\s/g, '&nbsp;') + '</code>' : '')
      + '<span class="block" style="margin-left: ' + indent + 'px !important;">' + line + '</span>'
     + '</span>'
    + '</div>'
   ;
  }
  
  return code;
},

/**
  * Finds all matches in the source code.
  * @param {String} code  Source code to process matches in.
  * @param {Array} matches Discovered regex matches.
  * @return {String} Returns formatted HTML with processed mathes.
  */
processMatches: function(code, matches)
{
  var pos = 0, 
   result = '',
   decorate = sh.utils.decorate // make an alias to save some bytes
   ;
  
  // Finally, go through the final list of matches and pull the all
  // together adding everything in between that isn't a match.
  for (var i = 0; i < matches.length; i++) 
  {
   var match = matches[i];
   
   if (match === null || match.length === 0) 
    continue;
   
   result += decorate(code.substr(pos, match.index - pos), 'plain')
    + decorate(match.value, match.css)
    ;

   pos = match.index + match.length;
  }

  // don't forget to add whatever's remaining in the string
  result += decorate(code.substr(pos), 'plain');

  return result;
},

/**
  * Highlights the code and returns complete HTML.
  * @param {String} code     Code to highlight.
  * @param {Object} params   Parameters object.
  */
highlight: function(code, params)
{
  var conf = sh.config,
   vars = sh.vars,
   div,
   tabSize
   ;

  this.params = {};
  this.div = null;
  this.lines = null;
  this.code = null;
  this.bar = null;
  this.toolbarCommands = {};
  this.id = sh.utils.guid('highlighter_');

  // register this instance in the highlighters list
  vars.highlighters[this.id] = this;

  if (code === null) 
   code = '';

  // Measure width of a single space.
  if (vars.spaceWidth === null)
   vars.spaceWidth = sh.utils.measureSpace();
  
  // local params take precedence over defaults
  this.params = sh.utils.merge(sh.defaults, params || {});

  // process light mode
  if (this.getParam('light') == true)
   this.params.toolbar = this.params.gutter = false;
  
  this.div = div = this.create('DIV');
  this.lines = this.create('DIV');
  this.lines.className = 'lines';

  div.className = 'syntaxhighlighter';
  div.id = this.id;
  
  if (this.getParam('collapse'))
   div.className += ' collapsed';
  
  if (this.getParam('gutter') == false)
   div.className += ' nogutter';

  div.className += ' ' + this.getParam('class-name');
  div.style.fontSize = this.getParam('font-size', ''); // IE7 can't take null
     
  this.originalCode = code;
  this.code = sh.utils.trimFirstAndLastLines(code)
   .replace(/\r/g, ' ') // IE lets these buggers through
   ;
  
  tabSize = this.getParam('tab-size');
  
  // replace tabs with spaces
  this.code = this.getParam('smart-tabs') == true
   ? sh.utils.processSmartTabs(this.code, tabSize)
   : sh.utils.processTabs(this.code, tabSize)
   ;

  this.code = sh.utils.unindent(this.code);

  // add controls toolbar
  if (this.getParam('toolbar')) 
  {
   this.bar = this.create('DIV');
   this.bar.className = 'bar';
   this.bar.appendChild(sh.toolbar.create(this));
   div.appendChild(this.bar);
  }
  
  // add columns ruler
  if (this.getParam('ruler'))
   div.appendChild(sh.utils.createRuler());

  div.appendChild(this.lines);

  this.matches = this.findMatches(this.regexList, this.code);
  this.removeNestedMatches();
  
  code = this.processMatches(this.code, this.matches);
  
  // finally, split all lines so that they wrap well
  code = this.createDisplayLines(sh.utils.trim(code));
  
  // finally, process the links
  if (this.getParam('auto-links'))
   code = sh.utils.processUrls(code);

  this.lines.innerHTML = code;
},

/**
  * Converts space separated list of keywords into a regular expression string.
  * @param {String} str    Space separated keywords.
  * @return {String}       Returns regular expression string.
  */ 
getKeywords: function(str)
{
  str = str
   .replace(/^\s+|\s+$/g, '')
   .replace(/\s+/g, '\\b|\\b')
   ;
  
  return '\\b' + str + '\\b';
},

/**
  * Makes a brush compatible with the `html-script` functionality.
  * @param {Object} regexGroup Object containing `left` and `right` regular expressions.
  */
forHtmlScript: function(regexGroup)
{
  this.htmlScript = {
   left : { regex: regexGroup.left, css: 'script' },
   right : { regex: regexGroup.right, css: 'script' },
   code : new XRegExp(
    "(?<left>" + regexGroup.left.source + ")" +
    "(?<code>.*?)" +
    "(?<right>" + regexGroup.right.source + ")",
    "sgi"
    )
  };
}
}; // end of Highlighter

return sh;
}(); // end of anonymous function

if (!Array.indexOf)
/**
  * Finds an index of element in the array.
  * @ignore
  * @param {Object} searchElement
  * @param {Number} fromIndex
  * @return {Number} Returns index of element if found; -1 otherwise.
  */
Array.prototype.indexOf = function (searchElement, fromIndex)
{
  fromIndex = Math.max(fromIndex || 0, 0);
  
  for (var i = fromIndex; i < this.length; i++)
   if(this[i] == searchElement)
    return i;
    
  return -1;
};

/**
* XRegExp 0.6.1
* (c) 2007-2008 Steven Levithan
* <http://stevenlevithan.com/regex/xregexp/>
* MIT License
* 
* provides an augmented, cross-browser implementation of regular expressions
* including support for additional modifiers and syntax. several convenience
* methods and a recursive-construct parser are also included.
*/

// prevent running twice, which would break references to native globals
if (!window.XRegExp) {
// anonymous function to avoid global variables
(function () {
// copy various native globals for reference. can't use the name ``native``
// because it's a reserved JavaScript keyword.
var real = {
        exec:    RegExp.prototype.exec,
        match:   String.prototype.match,
        replace: String.prototype.replace,
        split:   String.prototype.split
    },
    /* regex syntax parsing with support for all the necessary cross-
       browser and context issues (escapings, character classes, etc.) */
    lib = {
        part:       /(?:[^\\([#\s.]+|\\(?!k<[\w$]+>|[pP]{[^}]+})[\S\s]?|\((?=\?(?!#|<[\w$]+>)))+|(\()(?:\?(?:(#)[^)]*\)|<([$\w]+)>))?|\\(?:k<([\w$]+)>|[pP]{([^}]+)})|(\[\^?)|([\S\s])/g,
        replaceVar: /(?:[^$]+|\$(?![1-9$&`']|{[$\w]+}))+|\$(?:([1-9]\d*|[$&`'])|{([$\w]+)})/g,
        extended:   /^(?:\s+|#.*)+/,
        quantifier: /^(?:[?*+]|{\d+(?:,\d*)?})/,
        classLeft:  /&&\[\^?/g,
        classRight: /]/g
    },
    indexOf = function (array, item, from) {
        for (var i = from || 0; i < array.length; i++)
            if (array[i] === item) return i;
        return -1;
    },
    brokenExecUndef = /()??/.exec("")[1] !== undefined,
    plugins = {};

/**
* Accepts a pattern and flags, returns a new, extended RegExp object.
* differs from a native regex in that additional flags and syntax are
* supported and browser inconsistencies are ameliorated.
* @ignore
*/
XRegExp = function (pattern, flags) {
    if (pattern instanceof RegExp) {
        if (flags !== undefined)
            throw TypeError("can't supply flags when constructing one RegExp from another");
        return pattern.addFlags(); // new copy
    }

    var flags           = flags || "",
        singleline      = flags.indexOf("s") > -1,
        extended        = flags.indexOf("x") > -1,
        hasNamedCapture = false,
        captureNames    = [],
        output          = [],
        part            = lib.part,
        match, cc, len, index, regex;

    part.lastIndex = 0; // in case the last XRegExp compilation threw an error (unbalanced character class)

    while (match = real.exec.call(part, pattern)) {
        // comment pattern. this check must come before the capturing group check,
        // because both match[1] and match[2] will be non-empty.
        if (match[2]) {
            // keep tokens separated unless the following token is a quantifier
            if (!lib.quantifier.test(pattern.slice(part.lastIndex)))
                output.push("(?:)");
        // capturing group
        } else if (match[1]) {
            captureNames.push(match[3] || null);
            if (match[3])
                hasNamedCapture = true;
            output.push("(");
        // named backreference
        } else if (match[4]) {
            index = indexOf(captureNames, match[4]);
            // keep backreferences separate from subsequent literal numbers
            // preserve backreferences to named groups that are undefined at this point as literal strings
            output.push(index > -1 ?
                "\\" + (index + 1) + (isNaN(pattern.charAt(part.lastIndex)) ? "" : "(?:)") :
                match[0]
            );
        // unicode element (requires plugin)
        } else if (match[5]) {
            output.push(plugins.unicode ?
                plugins.unicode.get(match[5], match[0].charAt(1) === "P") :
                match[0]
            );
        // character class opening delimiter ("[" or "[^")
        // (non-native unicode elements are not supported within character classes)
        } else if (match[6]) {
            if (pattern.charAt(part.lastIndex) === "]") {
                // for cross-browser compatibility with ECMA-262 v3 behavior,
                // convert [] to (?!) and [^] to [\S\s].
                output.push(match[6] === "[" ? "(?!)" : "[\\S\\s]");
                part.lastIndex++;
            } else {
                // parse the character class with support for inner escapes and
                // ES4's infinitely nesting intersection syntax ([&&[^&&[]]]).
                cc = XRegExp.matchRecursive("&&" + pattern.slice(match.index), lib.classLeft, lib.classRight, "", {escapeChar: "\\"})[0];
                output.push(match[6] + cc + "]");
                part.lastIndex += cc.length + 1;
            }
        // dot ("."), pound sign ("#"), or whitespace character
        } else if (match[7]) {
            if (singleline && match[7] === ".") {
                output.push("[\\S\\s]");
            } else if (extended && lib.extended.test(match[7])) {
                len = real.exec.call(lib.extended, pattern.slice(part.lastIndex - 1))[0].length;
                // keep tokens separated unless the following token is a quantifier
                if (!lib.quantifier.test(pattern.slice(part.lastIndex - 1 + len)))
                    output.push("(?:)");
                part.lastIndex += len - 1;
            } else {
                output.push(match[7]);
            }
        } else {
            output.push(match[0]);
        }
    }

    regex = RegExp(output.join(""), real.replace.call(flags, /[sx]+/g, ""));
    regex._x = {
        source:       pattern,
        captureNames: hasNamedCapture ? captureNames : null
    };
    return regex;
};

/**
* Barebones plugin support for now (intentionally undocumented)
* @ignore
* @param {Object} name
* @param {Object} o
*/
XRegExp.addPlugin = function (name, o) {
    plugins[name] = o;
};

/**
* Adds named capture support, with values returned as ``result.name``.
* 
* Also fixes two cross-browser issues, following the ECMA-262 v3 spec:
*  - captured values for non-participating capturing groups should be returned
*    as ``undefined``, rather than the empty string.
*  - the regex's ``lastIndex`` should not be incremented after zero-length
*    matches.
* @ignore
*/
RegExp.prototype.exec = function (str) {
    var match = real.exec.call(this, str),
        name, i, r2;
    if (match) {
        // fix browsers whose exec methods don't consistently return
        // undefined for non-participating capturing groups
        if (brokenExecUndef && match.length > 1) {
            // r2 doesn't need /g or /y, but they shouldn't hurt
            r2 = new RegExp("^" + this.source + "$(?!\\s)", this.getNativeFlags());
            real.replace.call(match[0], r2, function () {
                for (i = 1; i < arguments.length - 2; i++) {
                    if (arguments[i] === undefined) match[i] = undefined;
                }
            });
        }
        // attach named capture properties
        if (this._x && this._x.captureNames) {
            for (i = 1; i < match.length; i++) {
                name = this._x.captureNames[i - 1];
                if (name) match[name] = match[i];
            }
        }
        // fix browsers that increment lastIndex after zero-length matches
        if (this.global && this.lastIndex > (match.index + match[0].length))
            this.lastIndex--;
    }
    return match;
};
})(); // end anonymous function
} // end if(!window.XRegExp)

/**
* intentionally undocumented
* @ignore
*/
RegExp.prototype.getNativeFlags = function () {
    return (this.global     ? "g" : "") +
           (this.ignoreCase ? "i" : "") +
           (this.multiline  ? "m" : "") +
           (this.extended   ? "x" : "") +
           (this.sticky     ? "y" : "");
};

/**
* Accepts flags; returns a new XRegExp object generated by recompiling
* the regex with the additional flags (may include non-native flags).
* The original regex object is not altered.
* @ignore
*/
RegExp.prototype.addFlags = function (flags) {
    var regex = new XRegExp(this.source, (flags || "") + this.getNativeFlags());
    if (this._x) {
        regex._x = {
            source:       this._x.source,
            captureNames: this._x.captureNames ? this._x.captureNames.slice(0) : null
        };
    }
    return regex;
};

/**
* Accepts a context object and string; returns the result of calling
* ``exec`` with the provided string. the context is ignored but is
* accepted for congruity with ``Function.prototype.call``.
* @ignore
*/
RegExp.prototype.call = function (context, str) {
    return this.exec(str);
};

/**
* Accepts a context object and arguments array; returns the result of
* calling ``exec`` with the first value in the arguments array. the context
* is ignored but is accepted for congruity with ``Function.prototype.apply``.
* @ignore
*/
RegExp.prototype.apply = function (context, args) {
    return this.exec(args[0]);
};

/**
* Accepts a pattern and flags; returns an XRegExp object. if the pattern
* and flag combination has previously been cached, the cached copy is
* returned, otherwise the new object is cached.
* @ignore
*/
XRegExp.cache = function (pattern, flags) {
    var key = "/" + pattern + "/" + (flags || "");
    return XRegExp.cache[key] || (XRegExp.cache[key] = new XRegExp(pattern, flags));
};

/**
* Accepts a string; returns the string with regex metacharacters escaped.
* the returned string can safely be used within a regex to match a literal
* string. escaped characters are [, ], {, }, (, ), -, *, +, ?, ., \, ^, $,
* |, #, [comma], and whitespace.
* @ignore
*/
XRegExp.escape = function (str) {
    return str.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, "\\$&");
};

/**
* Accepts a string to search, left and right delimiters as regex pattern
* strings, optional regex flags (may include non-native s, x, and y flags),
* and an options object which allows setting an escape character and changing
* the return format from an array of matches to a two-dimensional array of
* string parts with extended position data. returns an array of matches
* (optionally with extended data), allowing nested instances of left and right
* delimiters. use the g flag to return all matches, otherwise only the first
* is returned. if delimiters are unbalanced within the subject data, an error
* is thrown.
* 
* This function admittedly pushes the boundaries of what can be accomplished
* sensibly without a "real" parser. however, by doing so it provides flexible
* and powerful recursive parsing capabilities with minimal code weight.
* 
* Warning: the ``escapeChar`` option is considered experimental and might be
* changed or removed in future versions of XRegExp.
* 
* unsupported features:
*  - backreferences within delimiter patterns when using ``escapeChar``.
*  - although providing delimiters as regex objects adds the minor feature of
*    independent delimiter flags, it introduces other limitations and is only
*    intended to be done by the ``XRegExp`` constructor (which can't call
*    itself while building a regex).
* 
* @ignore
*/
XRegExp.matchRecursive = function (str, left, right, flags, options) {
    var options      = options || {},
        escapeChar   = options.escapeChar,
        vN           = options.valueNames,
        flags        = flags || "",
        global       = flags.indexOf("g") > -1,
        ignoreCase   = flags.indexOf("i") > -1,
        multiline    = flags.indexOf("m") > -1,
        sticky       = flags.indexOf("y") > -1,
        /* sticky mode has its own handling in this function, which means you
           can use flag "y" even in browsers which don't support it natively */
        flags        = flags.replace(/y/g, ""),
        left         = left  instanceof RegExp ? (left.global  ? left  : left.addFlags("g"))  : new XRegExp(left,  "g" + flags),
        right        = right instanceof RegExp ? (right.global ? right : right.addFlags("g")) : new XRegExp(right, "g" + flags),
        output       = [],
        openTokens   = 0,
        delimStart   = 0,
        delimEnd     = 0,
        lastOuterEnd = 0,
        outerStart, innerStart, leftMatch, rightMatch, escaped, esc;

    if (escapeChar) {
        if (escapeChar.length > 1) throw SyntaxError("can't supply more than one escape character");
        if (multiline)             throw TypeError("can't supply escape character when using the multiline flag");
        escaped = XRegExp.escape(escapeChar);
        /* Escape pattern modifiers:
            /g - not needed here
            /i - included
            /m - **unsupported**, throws error
            /s - handled by XRegExp when delimiters are provided as strings
            /x - handled by XRegExp when delimiters are provided as strings
            /y - not needed here; supported by other handling in this function
        */
        esc = new RegExp(
            "^(?:" + escaped + "[\\S\\s]|(?:(?!" + left.source + "|" + right.source + ")[^" + escaped + "])+)+",
            ignoreCase ? "i" : ""
        );
    }

    while (true) {
        /* advance the starting search position to the end of the last delimiter match.
           a couple special cases are also covered:
            - if using an escape character, advance to the next delimiter's starting position,
              skipping any escaped characters
            - first time through, reset lastIndex in case delimiters were provided as regexes
        */
        left.lastIndex = right.lastIndex = delimEnd +
            (escapeChar ? (esc.exec(str.slice(delimEnd)) || [""])[0].length : 0);

        leftMatch  = left.exec(str);
        rightMatch = right.exec(str);

        // only keep the result which matched earlier in the string
        if (leftMatch && rightMatch) {
            if (leftMatch.index <= rightMatch.index)
                 rightMatch = null;
            else leftMatch  = null;
        }

        /* paths*:
        leftMatch | rightMatch | openTokens | result
        1         | 0          | 1          | ...
        1         | 0          | 0          | ...
        0         | 1          | 1          | ...
        0         | 1          | 0          | throw
        0         | 0          | 1          | throw
        0         | 0          | 0          | break
        * - does not include the sticky mode special case
          - the loop ends after the first completed match if not in global mode
        */

        if (leftMatch || rightMatch) {
            delimStart = (leftMatch || rightMatch).index;
            delimEnd   = (leftMatch ? left : right).lastIndex;
        } else if (!openTokens) {
            break;
        }

        if (sticky && !openTokens && delimStart > lastOuterEnd)
            break;

        if (leftMatch) {
            if (!openTokens++) {
                outerStart = delimStart;
                innerStart = delimEnd;
            }
        } else if (rightMatch && openTokens) {
            if (!--openTokens) {
                if (vN) {
                    if (vN[0] && outerStart > lastOuterEnd)
                               output.push([vN[0], str.slice(lastOuterEnd, outerStart), lastOuterEnd, outerStart]);
                    if (vN[1]) output.push([vN[1], str.slice(outerStart,   innerStart), outerStart,   innerStart]);
                    if (vN[2]) output.push([vN[2], str.slice(innerStart,   delimStart), innerStart,   delimStart]);
                    if (vN[3]) output.push([vN[3], str.slice(delimStart,   delimEnd),   delimStart,   delimEnd]);
                } else {
                    output.push(str.slice(innerStart, delimStart));
                }
                lastOuterEnd = delimEnd;
                if (!global)
                    break;
            }
        } else {
            // reset lastIndex in case delimiters were provided as regexes
            left.lastIndex = right.lastIndex = 0;
            throw Error("subject data contains unbalanced delimiters");
        }

        // if the delimiter matched an empty string, advance delimEnd to avoid an infinite loop
        if (delimStart === delimEnd)
            delimEnd++;
    }

    if (global && !sticky && vN && vN[0] && str.length > lastOuterEnd)
        output.push([vN[0], str.slice(lastOuterEnd), lastOuterEnd, str.length]);

    // reset lastIndex in case delimiters were provided as regexes
    left.lastIndex = right.lastIndex = 0;

    return output;
};

/**
 * SyntaxHighlighter
 * http://alexgorbatchev.com/
 *
 * SyntaxHighlighter is donationware. If you are using it, please donate.
 * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
 *
 * @version
 * 2.0.296 (March 01 2009)
 * 
 * @copyright
 * Copyright (C) 2004-2009 Alex Gorbatchev.
 *
 * @license
 * This file is part of SyntaxHighlighter.
 * 
 * SyntaxHighlighter is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * SyntaxHighlighter is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with SyntaxHighlighter.  If not, see <http://www.gnu.org/licenses/>.
 */
SyntaxHighlighter.brushes.Bash = function()
{
 var keywords = 'if fi then elif else for do done until while break continue case function return in eq ne gt lt ge le';
 var commands =  'alias apropos awk bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' +
     'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' +
     'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' +
     'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' +
     'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' +
     'import install join kill less let ln local locate logname logout look lpc lpr lprint ' +
     'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' +
     'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' +
     'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' +
     'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' +
     'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' +
     'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' +
     'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' +
     'vi watch wc whereis which who whoami Wget xargs yes'
     ;
    
 this.regexList = [
  { regex: SyntaxHighlighter.regexLib.singleLinePerlComments,  css: 'comments' },  // one line comments
  { regex: SyntaxHighlighter.regexLib.doubleQuotedString,   css: 'string' },  // double quoted strings
  { regex: new RegExp(this.getKeywords(keywords), 'gm'),   css: 'keyword' },  // keywords
  { regex: new RegExp(this.getKeywords(commands), 'gm'),   css: 'functions' }  // commands
  ];
}

SyntaxHighlighter.brushes.Bash.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.Bash.aliases  = ['bash', 'shell'];

/**
 * SyntaxHighlighter
 * http://alexgorbatchev.com/
 *
 * SyntaxHighlighter is donationware. If you are using it, please donate.
 * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
 *
 * @version
 * 2.0.296 (March 01 2009)
 * 
 * @copyright
 * Copyright (C) 2004-2009 Alex Gorbatchev.
 *
 * @license
 * This file is part of SyntaxHighlighter.
 * 
 * SyntaxHighlighter is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * SyntaxHighlighter is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with SyntaxHighlighter.  If not, see <http://www.gnu.org/licenses/>.
 */
SyntaxHighlighter.brushes.CSS = function()
{
 function getKeywordsCSS(str)
 {
  return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
 };
 
 function getValuesCSS(str)
 {
  return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b';
 };

 var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' +
     'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' +
     'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' +
     'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' +
     'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' +
     'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' +
     'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' +
     'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' +
     'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' +
     'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' +
     'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' +
     'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' +
     'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' +
     'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index';

 var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+
     'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+
     'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+
     'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+
     'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+
     'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+
     'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+
     'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+
     'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+
     'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+
     'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+
     'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+
     'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+
     'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow';

 var fonts =  '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif';
 
 this.regexList = [
  { regex: SyntaxHighlighter.regexLib.multiLineCComments,  css: 'comments' }, // multiline comments
  { regex: SyntaxHighlighter.regexLib.doubleQuotedString,  css: 'string' }, // double quoted strings
  { regex: SyntaxHighlighter.regexLib.singleQuotedString,  css: 'string' }, // single quoted strings
  { regex: /\#[a-fA-F0-9]{3,6}/g,        css: 'value' },  // html colors
  { regex: /(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)/g,    css: 'value' },  // sizes
  { regex: /!important/g,          css: 'color3' }, // !important
  { regex: new RegExp(getKeywordsCSS(keywords), 'gm'),  css: 'keyword' }, // keywords
  { regex: new RegExp(getValuesCSS(values), 'g'),    css: 'value' },  // values
  { regex: new RegExp(this.getKeywords(fonts), 'g'),   css: 'color1' }  // fonts
  ];

 this.forHtmlScript({ 
  left: /(&lt;|<)\s*style.*?(&gt;|>)/gi, 
  right: /(&lt;|<)\/\s*style\s*(&gt;|>)/gi 
  });
};

SyntaxHighlighter.brushes.CSS.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.CSS.aliases = ['css'];

/**
 * SyntaxHighlighter
 * http://alexgorbatchev.com/
 *
 * SyntaxHighlighter is donationware. If you are using it, please donate.
 * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
 *
 * @version
 * 2.0.296 (March 01 2009)
 * 
 * @copyright
 * Copyright (C) 2004-2009 Alex Gorbatchev.
 *
 * @license
 * This file is part of SyntaxHighlighter.
 * 
 * SyntaxHighlighter is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * SyntaxHighlighter is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with SyntaxHighlighter.  If not, see <http://www.gnu.org/licenses/>.
 */
SyntaxHighlighter.brushes.Java = function()
{
 var keywords = 'abstract assert boolean break byte case catch char class const ' +
     'continue default do double else enum extends ' +
     'false final finally float for goto if implements import ' +
     'instanceof int interface long native new null ' +
     'package private protected public return ' +
     'short static strictfp super switch synchronized this throw throws true ' +
     'transient try void volatile while';

 this.regexList = [
  { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' },  // one line comments
  { regex: SyntaxHighlighter.regexLib.multiLineCComments,  css: 'comments' },  // multiline comments
  { regex: SyntaxHighlighter.regexLib.doubleQuotedString,  css: 'string' },  // strings
  { regex: SyntaxHighlighter.regexLib.singleQuotedString,  css: 'string' },  // strings
  { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi,    css: 'value' },   // numbers
  { regex: /(?!\@interface\b)\@[\$\w]+\b/g,     css: 'color1' },  // annotation @anno
  { regex: /\@interface\b/g,         css: 'color2' },  // @interface keyword
  { regex: new RegExp(this.getKeywords(keywords), 'gm'),  css: 'keyword' }  // java keyword
  ];

 this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
};

SyntaxHighlighter.brushes.Java.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.Java.aliases  = ['java'];

/**
 * SyntaxHighlighter
 * http://alexgorbatchev.com/
 *
 * SyntaxHighlighter is donationware. If you are using it, please donate.
 * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
 *
 * @version
 * 2.0.296 (March 01 2009)
 * 
 * @copyright
 * Copyright (C) 2004-2009 Alex Gorbatchev.
 *
 * @license
 * This file is part of SyntaxHighlighter.
 * 
 * SyntaxHighlighter is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * SyntaxHighlighter is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with SyntaxHighlighter.  If not, see <http://www.gnu.org/licenses/>.
 */
SyntaxHighlighter.brushes.JScript = function()
{
 var keywords = 'abstract boolean break byte case catch char class const continue debugger ' +
     'default delete do double else enum export extends false final finally float ' +
     'for function goto if implements import in instanceof int interface long native ' +
     'new null package private protected public return short static super switch ' +
     'synchronized this throw throws transient true try typeof var void volatile while with';

 this.regexList = [
  { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' },   // one line comments
  { regex: SyntaxHighlighter.regexLib.multiLineCComments,  css: 'comments' },   // multiline comments
  { regex: SyntaxHighlighter.regexLib.doubleQuotedString,  css: 'string' },   // double quoted strings
  { regex: SyntaxHighlighter.regexLib.singleQuotedString,  css: 'string' },   // single quoted strings
  { regex: /\s*#.*/gm,          css: 'preprocessor' },  // preprocessor tags like #region and #endregion
  { regex: new RegExp(this.getKeywords(keywords), 'gm'),  css: 'keyword' }   // keywords
  ];
 
 this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags);
};

SyntaxHighlighter.brushes.JScript.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.JScript.aliases = ['js', 'jscript', 'javascript'];

/**
 * SyntaxHighlighter
 * http://alexgorbatchev.com/
 *
 * SyntaxHighlighter is donationware. If you are using it, please donate.
 * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
 *
 * @version
 * 2.0.296 (March 01 2009)
 * 
 * @copyright
 * Copyright (C) 2004-2009 Alex Gorbatchev.
 *
 * @license
 * This file is part of SyntaxHighlighter.
 * 
 * SyntaxHighlighter is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * SyntaxHighlighter is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with SyntaxHighlighter.  If not, see <http://www.gnu.org/licenses/>.
 */
SyntaxHighlighter.brushes.Php = function()
{
 var funcs = 'abs acos acosh addcslashes addslashes ' +
     'array_change_key_case array_chunk array_combine array_count_values array_diff '+
     'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
     'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+
     'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+
     'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+
     'array_push array_rand array_reduce array_reverse array_search array_shift '+
     'array_slice array_splice array_sum array_udiff array_udiff_assoc '+
     'array_udiff_uassoc array_uintersect array_uintersect_assoc '+
     'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+
     'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+
     'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+
     'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+
     'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+
     'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+
     'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+
     'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+
     'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+
     'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+
     'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+
     'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+
     'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+
     'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+
     'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+
     'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+
     'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+
     'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+
     'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+
     'parse_ini_file parse_str parse_url passthru pathinfo readlink realpath rewind rewinddir rmdir '+
     'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+
     'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+
     'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+
     'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+
     'strtoupper strtr strval substr substr_compare';

 var keywords = 'and or xor array as break case ' +
     'cfunction class const continue declare default die do else ' +
     'elseif enddeclare endfor endforeach endif endswitch endwhile ' +
     'extends for foreach function include include_once global if ' +
     'new old_function return static switch use require require_once ' +
     'var while abstract interface public implements extends private protected throw';
 
 var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__';

 this.regexList = [
  { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' },   // one line comments
  { regex: SyntaxHighlighter.regexLib.multiLineCComments,  css: 'comments' },   // multiline comments
  { regex: SyntaxHighlighter.regexLib.doubleQuotedString,  css: 'string' },   // double quoted strings
  { regex: SyntaxHighlighter.regexLib.singleQuotedString,  css: 'string' },   // single quoted strings
  { regex: /\$\w+/g,           css: 'variable' },   // variables
  { regex: new RegExp(this.getKeywords(funcs), 'gmi'),  css: 'functions' },   // common functions
  { regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' },   // constants
  { regex: new RegExp(this.getKeywords(keywords), 'gm'),  css: 'keyword' }   // keyword
  ];

 this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
};

SyntaxHighlighter.brushes.Php.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.Php.aliases = ['php'];

/**
 * SyntaxHighlighter
 * http://alexgorbatchev.com/
 *
 * SyntaxHighlighter is donationware. If you are using it, please donate.
 * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
 *
 * @version
 * 2.0.296 (March 01 2009)
 * 
 * @copyright
 * Copyright (C) 2004-2009 Alex Gorbatchev.
 *
 * @license
 * This file is part of SyntaxHighlighter.
 * 
 * SyntaxHighlighter is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * SyntaxHighlighter is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with SyntaxHighlighter.  If not, see <http://www.gnu.org/licenses/>.
 */
SyntaxHighlighter.brushes.Plain = function()
{
};

SyntaxHighlighter.brushes.Plain.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.Plain.aliases = ['text', 'plain'];

/**
 * SyntaxHighlighter
 * http://alexgorbatchev.com/
 *
 * SyntaxHighlighter is donationware. If you are using it, please donate.
 * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
 *
 * @version
 * 2.0.296 (March 01 2009)
 * 
 * @copyright
 * Copyright (C) 2004-2009 Alex Gorbatchev.
 *
 * @license
 * This file is part of SyntaxHighlighter.
 * 
 * SyntaxHighlighter is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * SyntaxHighlighter is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with SyntaxHighlighter.  If not, see <http://www.gnu.org/licenses/>.
 */
SyntaxHighlighter.brushes.Xml = function()
{
 function process(match, regexInfo)
 {
  var constructor = SyntaxHighlighter.Match,
   code = match[0],
   tag = new XRegExp('(&lt;|<)[\\s\\/\\?]*(?<name>[:\\w-\\.]+)', 'xg').exec(code),
   result = []
   ;
  
  if (match.attributes != null) 
  {
   var attributes,
    regex = new XRegExp('(?<name> [\\w:\\-\\.]+)' +
         '\\s*=\\s*' +
         '(?<value> ".*?"|\'.*?\'|\\w+)',
         'xg');

   while ((attributes = regex.exec(code)) != null) 
   {
    result.push(new constructor(attributes.name, match.index + attributes.index, 'color1'));
    result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string'));
   }
  }

  if (tag != null)
   result.push(
    new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword')
   );

  return result;
 }
 
 this.regexList = [
  { regex: new XRegExp('(\\&lt;|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\&gt;|>)', 'gm'),   css: 'color2' }, // <![ ... [ ... ]]>
  { regex: new XRegExp('(\\&lt;|<)!--\\s*.*?\\s*--(\\&gt;|>)', 'gm'),        css: 'comments' }, // <!-- ... -->
  { regex: new XRegExp('(&lt;|<)[\\s\\/\\?]*(\\w+)(?<attributes>.*?)[\\s\\/\\?]*(&gt;|>)', 'sg'), func: process }
 ];
};

SyntaxHighlighter.brushes.Xml.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.Xml.aliases = ['xml', 'xhtml', 'xslt', 'html', 'xhtml'];

/******************************************************************************
Name:    Highslide JS
Version: 4.1.0 (March 12 2009)
Config:  default +events +unobtrusive +imagemap +slideshow +positioning +transitions +viewport +thumbstrip +inline +ajax +iframe +flash
Author:  Torstein Hønsi
Support: http://highslide.com/support

Licence:
Highslide JS is licensed under a Creative Commons Attribution-NonCommercial 2.5
License (http://creativecommons.org/licenses/by-nc/2.5/).

You are free:
* to copy, distribute, display, and perform the work
* to make derivative works

Under the following conditions:
* Attribution. You must attribute the work in the manner  specified by  the
   author or licensor.
* Noncommercial. You may not use this work for commercial purposes.

* For  any  reuse  or  distribution, you  must make clear to others the license
  terms of this work.
* Any  of  these  conditions  can  be  waived  if  you  get permission from the 
  copyright holder.

Your fair use and other rights are in no way affected by the above.
******************************************************************************/
var hs = {
// Language strings
lang : {
cssDirection: 'ltr',
loadingText : 'Loading...',
loadingTitle : 'Click to cancel',
focusTitle : 'Click to bring to front',
fullExpandTitle : 'Expand to actual size (f)',
creditsText : 'Powered by <i>Highslide JS</i>',
creditsTitle : 'Go to the Highslide JS homepage',
previousText : 'Previous',
nextText : 'Next', 
moveText : 'Move',
closeText : 'Close', 
closeTitle : 'Close (esc)', 
resizeTitle : 'Resize',
playText : 'Play',
playTitle : 'Play slideshow (spacebar)',
pauseText : 'Pause',
pauseTitle : 'Pause slideshow (spacebar)',
previousTitle : 'Previous (arrow left)',
nextTitle : 'Next (arrow right)',
moveTitle : 'Move',
fullExpandText : '1:1',
number: 'Image %1 of %2',
restoreTitle : 'Click to close image, click and drag to move. Use arrow keys for next and previous.'
},
// See http://highslide.com/ref for examples of settings  
graphicsDir : 'http://files.jendryschik.de/highslide4/graphics/',
expandCursor : 'zoomin.cur', // null disables
restoreCursor : 'zoomout.cur', // null disables
expandDuration : 250, // milliseconds
restoreDuration : 250,
marginLeft : 15,
marginRight : 15,
marginTop : 15,
marginBottom : 15,
zIndexCounter : 1001, // adjust to other absolutely positioned elements
loadingOpacity : 0.75,
allowMultipleInstances: true,
numberOfImagesToPreload : 5,
outlineWhileAnimating : 2, // 0 = never, 1 = always, 2 = HTML only 
outlineStartOffset : 3, // ends at 10
padToMinWidth : false, // pad the popup width to make room for wide caption
fullExpandPosition : 'bottom right',
fullExpandOpacity : 1,
showCredits : true, // you can set this to false if you want
creditsHref : 'http://highslide.com/',
enableKeyListener : true,
openerTagNames : ['a', 'area'], // Add more to allow slideshow indexing
transitions : [],
transitionDuration: 250,
dimmingOpacity: 0, // Lightbox style dimming background
dimmingDuration: 50, // 0 for instant dimming

allowWidthReduction : false,
allowHeightReduction : true,
preserveContent : true, // Preserve changes made to the content and position of HTML popups.
objectLoadTime : 'before', // Load iframes 'before' or 'after' expansion.
cacheAjax : true, // Cache ajax popups for instant display. Can be overridden for each popup.
anchor : 'auto', // where the image expands from
align : 'auto', // position in the client (overrides anchor)
targetX: null, // the id of a target element
targetY: null,
dragByHeading: true,
minWidth: 200,
minHeight: 200,
allowSizeReduction: true, // allow the image to reduce to fit client size. If false, this overrides minWidth and minHeight
outlineType : 'drop-shadow', // set null to disable outlines
wrapperClassName : 'highslide-wrapper', // for enhanced css-control
skin : {
controls:
  '<div class="highslide-controls"><ul>'+
   '<li class="highslide-previous">'+
    '<a href="#" title="{hs.lang.previousTitle}">'+
    '<span>{hs.lang.previousText}</span></a>'+
   '</li>'+
   '<li class="highslide-play">'+
    '<a href="#" title="{hs.lang.playTitle}">'+
    '<span>{hs.lang.playText}</span></a>'+
   '</li>'+
   '<li class="highslide-pause">'+
    '<a href="#" title="{hs.lang.pauseTitle}">'+
    '<span>{hs.lang.pauseText}</span></a>'+
   '</li>'+
   '<li class="highslide-next">'+
    '<a href="#" title="{hs.lang.nextTitle}">'+
    '<span>{hs.lang.nextText}</span></a>'+
   '</li>'+
   '<li class="highslide-move">'+
    '<a href="#" title="{hs.lang.moveTitle}">'+
    '<span>{hs.lang.moveText}</span></a>'+
   '</li>'+
   '<li class="highslide-full-expand">'+
    '<a href="#" title="{hs.lang.fullExpandTitle}">'+
    '<span>{hs.lang.fullExpandText}</span></a>'+
   '</li>'+
   '<li class="highslide-close">'+
    '<a href="#" title="{hs.lang.closeTitle}" >'+
    '<span>{hs.lang.closeText}</span></a>'+
   '</li>'+
  '</ul></div>'
,
contentWrapper:
  '<div class="highslide-header"><ul>'+
   '<li class="highslide-previous">'+
    '<a href="#" title="{hs.lang.previousTitle}" onclick="return hs.previous(this)">'+
    '<span>{hs.lang.previousText}</span></a>'+
   '</li>'+
   '<li class="highslide-next">'+
    '<a href="#" title="{hs.lang.nextTitle}" onclick="return hs.next(this)">'+
    '<span>{hs.lang.nextText}</span></a>'+
   '</li>'+
   '<li class="highslide-move">'+
    '<a href="#" title="{hs.lang.moveTitle}" onclick="return false">'+
    '<span>{hs.lang.moveText}</span></a>'+
   '</li>'+
   '<li class="highslide-close">'+
    '<a href="#" title="{hs.lang.closeTitle}" onclick="return hs.close(this)">'+
    '<span>{hs.lang.closeText}</span></a>'+
   '</li>'+
  '</ul></div>'+
  '<div class="highslide-body"></div>'+
  '<div class="highslide-footer"><div>'+
   '<span class="highslide-resize" title="{hs.lang.resizeTitle}"><span></span></span>'+
  '</div></div>'
},
// END OF YOUR SETTINGS


// declare internal properties
preloadTheseImages : [],
continuePreloading: true,
expanders : [],
overrides : [
'allowSizeReduction',
'useBox',
'anchor',
'align',
'targetX',
'targetY',
'outlineType',
'outlineWhileAnimating',
'captionId',
'captionText',
'captionEval',
'captionOverlay',
'headingId',
'headingText',
'headingEval',
'headingOverlay',
'dragByHeading',
'autoplay',
'numberPosition',
'transitions',
'dimmingOpacity',

'width',
'height',

'contentId',
'allowWidthReduction',
'allowHeightReduction',
'preserveContent',
'maincontentId',
'maincontentText',
'maincontentEval',
'objectType', 
'cacheAjax', 
'objectWidth',
'objectHeight',
'objectLoadTime', 
'swfOptions',
'wrapperClassName',
'minWidth',
'minHeight',
'maxWidth',
'maxHeight',
'slideshowGroup',
'easing',
'easingClose',
'fadeInOut',
'src'
],
overlays : [],
idCounter : 0,
oPos : {
x: ['leftpanel', 'left', 'center', 'right', 'rightpanel'],
y: ['above', 'top', 'middle', 'bottom', 'below']
},
mouse: {},
headingOverlay: {},
captionOverlay: {},
swfOptions: { flashvars: {}, params: {}, attributes: {} },
timers : [],

slideshows : [],

pendingOutlines : {},
sleeping : [],
preloadTheseAjax : [],
cacheBindings : [],
cachedGets : {},
clones : {},
uaVersion: parseFloat((navigator.userAgent.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1]),
ie : (document.all && !window.opera),
safari : /Safari/.test(navigator.userAgent),
geckoMac : /Macintosh.+rv:1\.[0-8].+Gecko/.test(navigator.userAgent),

$ : function (id) {
if (id) return document.getElementById(id);
},

push : function (arr, val) {
arr[arr.length] = val;
},

createElement : function (tag, attribs, styles, parent, nopad) {
var el = document.createElement(tag);
if (attribs) hs.extend(el, attribs);
if (nopad) hs.setStyles(el, {padding: 0, border: 'none', margin: 0});
if (styles) hs.setStyles(el, styles);
if (parent) parent.appendChild(el); 
return el;
},

extend : function (el, attribs) {
for (var x in attribs) el[x] = attribs[x];
return el;
},

setStyles : function (el, styles) {
for (var x in styles) {
  if (hs.ie && x == 'opacity') {
   if (styles[x] > 0.99) el.style.removeAttribute('filter');
   else el.style.filter = 'alpha(opacity='+ (styles[x] * 100) +')';
  }
  else el.style[x] = styles[x];
}
},
animate: function(el, prop, dur, easing, callback) {
var rate = 25,
  from = {},
  to = {},
  units = {},
  timers = hs.timers,
  timer = [],
  step;
if (typeof dur == 'object' && dur != null) {
  easing = dur.easing;
  callback = dur.callback;
  step = dur.step;
  dur = dur.duration;
}

if (typeof dur != 'number') dur = 250;
dur = Math.floor(dur / rate) * rate + rate;
easing = Math[easing] || Math.easeInQuad;
for (var x in prop) {
  from[x] = parseFloat(hs.css(el, x)) || 0;
  to[x] = parseFloat(prop[x]);
  units[x] = x != 'opacity' ? 'px' : '';
}
for (var time = rate; time <= dur; time += rate) {
  (function(){
   var inter = {}, steps = [];
   
   for (var x in prop) {
    inter[x] = easing(time, from[x], to[x] - from[x], dur);
    if (isNaN(inter[x])) inter[x] = to[x];
    if (units[x]) inter[x] = Math.round(inter[x]);
    if (step) (function() {
     var val = inter[x],
      pX = x;
     hs.push(steps, function() {
      step(val, { prop: pX } ) 
     });
    })();
    inter[x] += units[x];
    
   }
   timer.push(function() {
    hs.setStyles(el, inter);
    if (steps) for (var i = 0; i < steps.length; i++) steps[i]();
   });
  })();
}
for (var i = 0; i < timers.length; i++) {
  if (timers[i].el == el) {
   timers.splice(i--, 1);
  }
}
timer.el = el;
timer.callback = callback;
timer.shift()();
if (timer.length) timers.push(timer);
else if (callback) callback();
if (hs.timerId == null) {
  hs.timerId = setInterval( function() {
   for ( var i = 0; i < timers.length; i++ ) {
    timers[i].shift()();
    if (!timers[i].length) {
     if (timers[i].callback) timers[i].callback();
     timers.splice(i--, 1);
    }
   }

   if ( !timers.length ) {
    clearInterval( hs.timerId );
    hs.timerId = null;
   }
  }, rate);
}
},
css: function(el, prop) {
if (document.defaultView) {
  return document.defaultView.getComputedStyle(el, null).getPropertyValue(prop);

} else {
  if (prop == 'opacity') prop = 'filter';
  var val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b){ return b.toUpperCase(); })];
  if (prop == 'filter') 
   val = val.replace(/alpha\(opacity=([0-9]+)\)/, 
    function (a, b) { return b / 100 });
  return val === '' ? 1 : val;
} 
},

getPageSize : function () {
var d = document, w = window, iebody = d.compatMode && d.compatMode != 'BackCompat' 
  ? d.documentElement : d.body; 


var b = d.body;
var xScroll = (w.innerWidth && w.scrollMaxX) 
   ? w.innerWidth + w.scrollMaxX : Math.max(b.scrollWidth, b.offsetWidth),
  yScroll = (w.innerHeight && window.scrollMaxY) 
   ? w.innerHeight + w.scrollMaxY : Math.max(b.scrollHeight, b.offsetHeight),
  pageWidth = hs.ie ? iebody.scrollWidth :
   (d.documentElement.clientWidth || self.innerWidth),
       pageHeight = hs.ie ? Math.max(iebody.scrollHeight, iebody.clientHeight) : 
   (d.documentElement.clientHeight || self.innerHeight);

var width = hs.ie ? iebody.clientWidth : 
   (d.documentElement.clientWidth || self.innerWidth),
  height = hs.ie ? iebody.clientHeight : self.innerHeight;

return {
  pageWidth: Math.max(pageWidth, xScroll),
  pageHeight: Math.max(pageHeight, yScroll),
  width: width,
  height: height,  
  scrollLeft: hs.ie ? iebody.scrollLeft : pageXOffset,
  scrollTop: hs.ie ? iebody.scrollTop : pageYOffset
}
},

getPosition : function(el) {
if (/area/i.test(el.tagName)) {
  var imgs = document.getElementsByTagName('img');
  for (var i = 0; i < imgs.length; i++) {
   var u = imgs[i].useMap;
   if (u && u.replace(/^.*?#/, '') == el.parentNode.name) {
    el = imgs[i];
    break;
   }
  }
}
var p = { x: el.offsetLeft, y: el.offsetTop };
while (el.offsetParent) {
  el = el.offsetParent;
  p.x += el.offsetLeft;
  p.y += el.offsetTop;
  if (el != document.body && el != document.documentElement) {
   p.x -= el.scrollLeft;
   p.y -= el.scrollTop;
  }
}
return p;
},

expand : function(a, params, custom, type) {
if (!a) a = hs.createElement('a', null, { display: 'none' }, hs.container);
if (typeof a.getParams == 'function') return params;
if (type == 'html') {
  for (var i = 0; i < hs.sleeping.length; i++) {
   if (hs.sleeping[i] && hs.sleeping[i].a == a) {
    hs.sleeping[i].awake();
    hs.sleeping[i] = null;
    return false;
   }
  }
  hs.hasHtmlExpanders = true;
} 
try { 
  new hs.Expander(a, params, custom, type);
  return false;
} catch (e) { return true; }
},

htmlExpand : function(a, params, custom) {
return hs.expand(a, params, custom, 'html');
},

getSelfRendered : function() {
return hs.createElement('div', { 
  className: 'highslide-html-content', 
  innerHTML: hs.replaceLang(hs.skin.contentWrapper) 
});
},
getElementByClass : function (el, tagName, className) {
var els = el.getElementsByTagName(tagName);
for (var i = 0; i < els.length; i++) {
     if ((new RegExp(className)).test(els[i].className)) {
   return els[i];
  }
}
return null;
},
replaceLang : function(s) {
s = s.replace(/\s/g, ' ');
var re = /{hs\.lang\.([^}]+)\}/g,
  matches = s.match(re),
  lang;
if (matches) for (var i = 0; i < matches.length; i++) {
  lang = matches[i].replace(re, "$1");
  if (typeof hs.lang[lang] != 'undefined') s = s.replace(matches[i], hs.lang[lang]);
}
return s;
},


setClickEvents : function () {
var els = document.getElementsByTagName('a');
for (var i = 0; i < els.length; i++) {
  var type = hs.isUnobtrusiveAnchor(els[i]);
  if (type && !els[i].hsHasSetClick) {
   (function(){
    var t = type;
    if (hs.fireEvent(hs, 'onSetClickEvent', { element: els[i], type: t })) {
     els[i].onclick =(type == 'image') ?function() { return hs.expand(this) }:
      function() { return hs.htmlExpand(this, { objectType: t } );};
    }
   })();
   els[i].hsHasSetClick = true; 
  }
}
if (!hs.pageLoaded) setTimeout( hs.setClickEvents, 50);
else if (i) hs.updateAnchors();
},
isUnobtrusiveAnchor: function(el) {
if (el.rel == 'highslide') return 'image';
else if (el.rel == 'highslide-ajax') return 'ajax';
else if (el.rel == 'highslide-iframe') return 'iframe';
else if (el.rel == 'highslide-swf') return 'swf';
},

getCacheBinding : function (a) {
for (var i = 0; i < hs.cacheBindings.length; i++) {
  if (hs.cacheBindings[i][0] == a) {
   var c = hs.cacheBindings[i][1];
   hs.cacheBindings[i][1] = c.cloneNode(1);
   return c;
  }
}
return null;
},

preloadAjax : function (e) {
var arr = hs.getAnchors();
for (var i = 0; i < arr.htmls.length; i++) {
  var a = arr.htmls[i];
  if (hs.getParam(a, 'objectType') == 'ajax' && hs.getParam(a, 'cacheAjax'))
   hs.push(hs.preloadTheseAjax, a);
}

hs.preloadAjaxElement(0);
},

preloadAjaxElement : function (i) {
if (!hs.preloadTheseAjax[i]) return;
var a = hs.preloadTheseAjax[i];
var cache = hs.getNode(hs.getParam(a, 'contentId'));
if (!cache) cache = hs.getSelfRendered();
var ajax = new hs.Ajax(a, cache, 1); 
    ajax.onError = function () { };
    ajax.onLoad = function () {
     hs.push(hs.cacheBindings, [a, cache]);
     hs.preloadAjaxElement(i + 1);
    };
    ajax.run();
},

focusTopmost : function() {
var topZ = 0, 
  topmostKey = -1,
  expanders = hs.expanders,
  exp,
  zIndex;
for (var i = 0; i < expanders.length; i++) {
  exp = expanders[i];
  if (exp) {
   zIndex = exp.wrapper.style.zIndex;
   if (zIndex && zIndex > topZ) {
    topZ = zIndex;    
    topmostKey = i;
   }
  }
}
if (topmostKey == -1) hs.focusKey = -1;
else expanders[topmostKey].focus();
},

getParam : function (a, param) {
a.getParams = a.onclick;
var p = a.getParams ? a.getParams() : null;
a.getParams = null;

return (p && typeof p[param] != 'undefined') ? p[param] : 
  (typeof hs[param] != 'undefined' ? hs[param] : null);
},

getSrc : function (a) {
var src = hs.getParam(a, 'src');
if (src) return src;
return a.href;
},

getNode : function (id) {
var node = hs.$(id), clone = hs.clones[id], a = {};
if (!node && !clone) return null;
if (!clone) {
  clone = node.cloneNode(true);
  clone.id = '';
  hs.clones[id] = clone;
  return node;
} else {
  return clone.cloneNode(true);
}
},

discardElement : function(d) {
hs.garbageBin.appendChild(d);
hs.garbageBin.innerHTML = '';
},
dim : function(exp) {
if (!hs.dimmer) {
  hs.dimmer = hs.createElement ('div', 
   { 
    className: 'highslide-dimming',
    owner: '',
    onclick: function() {
     if (hs.fireEvent(hs, 'onDimmerClick'))
      
      hs.close();
    }
   }, { 
    position: 'absolute',
    visibility: 'visible',
    left: 0,
    opacity: 0 
   }, hs.container, true);
  hs.addEventListener(window, 'resize', hs.setDimmerSize);
}
hs.dimmer.style.display = '';
hs.setDimmerSize();
hs.dimmer.owner += '|'+ exp.key;
if (hs.geckoMac && hs.dimmingGeckoFix) 
  hs.dimmer.style.background = 'url('+ hs.graphicsDir + 'geckodimmer.png)';  
else
  hs.animate(hs.dimmer, { opacity: exp.dimmingOpacity }, hs.dimmingDuration); 
},
undim : function(key) {
if (!hs.dimmer) return;
if (typeof key != 'undefined') hs.dimmer.owner = hs.dimmer.owner.replace('|'+ key, '');

if (
  (typeof key != 'undefined' && hs.dimmer.owner != '')
  || (hs.upcoming && hs.getParam(hs.upcoming, 'dimmingOpacity'))
) return;
if (hs.geckoMac && hs.dimmingGeckoFix) 
  hs.setStyles(hs.dimmer, { background: 'none', width: 0, height: 0 });
else hs.animate(hs.dimmer, { opacity: 0 }, hs.dimmingDuration, null, function() {
  hs.setStyles(hs.dimmer, { display: 'none', width: 0, height: 0 });
});
},
setDimmerSize : function(exp) {
if (!hs.dimmer) return;
var h = (hs.ie && exp && exp.wrapper) ? 
  parseInt(exp.wrapper.style.top) + parseInt(exp.wrapper.style.height)+ (exp.outline ? exp.outline.offset : 0) : 0; 
hs.setStyles(hs.dimmer, { 
  width: hs.page.pageWidth +'px', 
  height: Math.max(hs.page.pageHeight, h) +'px'
});
},
transit : function (adj, exp) {
var last = exp = exp || hs.getExpander();
if (hs.upcoming) return false;
else hs.last = last;
try {
  hs.upcoming = adj;
  adj.onclick();   
} catch (e){
  hs.last = hs.upcoming = null;
}
try {
  if (!adj || exp.transitions[1] != 'crossfade')
  exp.close();
} catch (e) {}
return false;
},

previousOrNext : function (el, op) {
var exp = hs.getExpander(el);
if (exp) {
  adj = exp.getAdjacentAnchor(op);
  return hs.transit(adj, exp);
} else return false;
},

previous : function (el) {
return hs.previousOrNext(el, -1);
},

next : function (el) {
return hs.previousOrNext(el, 1); 
},

keyHandler : function(e) {
if (!e) e = window.event;
if (!e.target) e.target = e.srcElement; // ie
if (typeof e.target.form != 'undefined') return true; // form element has focus
if (!hs.fireEvent(hs, 'onKeyDown', e)) return true;
var exp = hs.getExpander();

var op = null;
switch (e.keyCode) {
  case 70: // f
   if (exp) exp.doFullExpand();
   return true;
  case 32: // Space
   op = 2;
   break;
  case 34: // Page Down
  case 39: // Arrow right
  case 40: // Arrow down
   op = 1;
   break;
  case 8:  // Backspace
  case 33: // Page Up
  case 37: // Arrow left
  case 38: // Arrow up
   op = -1;
   break;
  case 27: // Escape
  case 13: // Enter
   op = 0;
}
if (op !== null) {if (op != 2)hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
  if (!hs.enableKeyListener) return true;
  
  if (e.preventDefault) e.preventDefault();
     else e.returnValue = false;
     if (exp) {
   if (op == 0) {
    exp.close();
   } else if (op == 2) {
    if (exp.slideshow) exp.slideshow.hitSpace();
   } else {
    if (exp.slideshow) exp.slideshow.pause();
    hs.previousOrNext(exp.key, op);
   }
   return false;
  }
}
return true;
},


registerOverlay : function (overlay) {
hs.push(hs.overlays, overlay);
},


addSlideshow : function (options) {
var sg = options.slideshowGroup;
if (typeof sg == 'object') {
  for (var i = 0; i < sg.length; i++) {
   var o = {};
   for (var x in options) o[x] = options[x];
   o.slideshowGroup = sg[i];
   hs.push(hs.slideshows, o);
  }
} else {
  hs.push(hs.slideshows, options);
}
},

getWrapperKey : function (element, expOnly) {
var el, re = /^highslide-wrapper-([0-9]+)$/;
// 1. look in open expanders
el = element;
while (el.parentNode) {
  if (el.hsKey !== undefined) return el.hsKey;
  if (el.id && re.test(el.id)) return el.id.replace(re, "$1");
  el = el.parentNode;
}
// 2. look in thumbnail
if (!expOnly) {
  el = element;
  while (el.parentNode) {
   if (el.tagName && hs.isHsAnchor(el)) {
    for (var key = 0; key < hs.expanders.length; key++) {
     var exp = hs.expanders[key];
     if (exp && exp.a == el) return key;
    }
   }
   el = el.parentNode;
  }
}
return null; 
},

getExpander : function (el, expOnly) {
if (typeof el == 'undefined') return hs.expanders[hs.focusKey] || null;
if (typeof el == 'number') return hs.expanders[el] || null;
if (typeof el == 'string') el = hs.$(el);
return hs.expanders[hs.getWrapperKey(el, expOnly)] || null;
},

isHsAnchor : function (a) {
return (a.onclick && a.onclick.toString().replace(/\s/g, ' ').match(/hs.(htmlE|e)xpand/));
},

reOrder : function () {
for (var i = 0; i < hs.expanders.length; i++)
  if (hs.expanders[i] && hs.expanders[i].isExpanded) hs.focusTopmost();
},
fireEvent : function (obj, evt, args) {
return obj && obj[evt] ? (obj[evt](obj, args) !== false) : true;
},

mouseClickHandler : function(e) 
{ 
if (!e) e = window.event;
if (e.button > 1) return true;
if (!e.target) e.target = e.srcElement;

var el = e.target;
while (el.parentNode
  && !(/highslide-(image|move|html|resize)/.test(el.className)))
{
  el = el.parentNode;
}
var exp = hs.getExpander(el);
if (exp && (exp.isClosing || !exp.isExpanded)) return true;
  
if (exp && e.type == 'mousedown') {
  if (e.target.form) return true;
  var match = el.className.match(/highslide-(image|move|resize)/);
  if (match) {
   hs.dragArgs = { exp: exp , type: match[1], left: exp.x.pos, width: exp.x.size, top: exp.y.pos, 
    height: exp.y.size, clickX: e.clientX, clickY: e.clientY };
   
   
   hs.addEventListener(document, 'mousemove', hs.dragHandler);
   if (e.preventDefault) e.preventDefault(); // FF
   
   if (/highslide-(image|html)-blur/.test(exp.content.className)) {
    exp.focus();
    hs.hasFocused = true;
   }
   return false;
  }
  else if (/highslide-html/.test(el.className) && hs.focusKey != exp.key) {
   exp.focus();
   exp.doShowHide('hidden');
  }
} else if (e.type == 'mouseup') {
  
  hs.removeEventListener(document, 'mousemove', hs.dragHandler);
  
  if (hs.dragArgs) {
   if (hs.styleRestoreCursor && hs.dragArgs.type == 'image') 
    hs.dragArgs.exp.content.style.cursor = hs.styleRestoreCursor;
   var hasDragged = hs.dragArgs.hasDragged;
   
   if (!hasDragged &&!hs.hasFocused && !/(move|resize)/.test(hs.dragArgs.type)) {
    if (hs.fireEvent(exp, 'onImageClick'))
    exp.close();
   } 
   else if (hasDragged || (!hasDragged && hs.hasHtmlExpanders)) {
    hs.dragArgs.exp.doShowHide('hidden');
   }
   
   if (hs.dragArgs.exp.releaseMask) 
    hs.dragArgs.exp.releaseMask.style.display = 'none';
   
   if (hasDragged) hs.fireEvent(hs.dragArgs.exp, 'onDrop', hs.dragArgs);
   if (hasDragged) hs.setDimmerSize(exp);
   
   hs.hasFocused = false;
   hs.dragArgs = null;
  
  } else if (/highslide-image-blur/.test(el.className)) {
   el.style.cursor = hs.styleRestoreCursor;  
  }
}
return false;
},

dragHandler : function(e)
{
if (!hs.dragArgs) return true;
if (!e) e = window.event;
var a = hs.dragArgs, exp = a.exp;
if (exp.iframe) {  
  if (!exp.releaseMask) exp.releaseMask = hs.createElement('div', null, 
   { position: 'absolute', width: exp.x.size+'px', height: exp.y.size+'px', 
    left: exp.x.cb+'px', top: exp.y.cb+'px', zIndex: 4, background: (hs.ie ? 'white' : 'none'), 
    opacity: .01 }, 
   exp.wrapper, true);
  if (exp.releaseMask.style.display == 'none')
   exp.releaseMask.style.display = '';
}

a.dX = e.clientX - a.clickX;
a.dY = e.clientY - a.clickY; 

var distance = Math.sqrt(Math.pow(a.dX, 2) + Math.pow(a.dY, 2));
if (!a.hasDragged) a.hasDragged = (a.type != 'image' && distance > 0)
  || (distance > (hs.dragSensitivity || 5));

if (a.hasDragged && e.clientX > 5 && e.clientY > 5) {
  if (!hs.fireEvent(exp, 'onDrag', a)) return false;
  
  if (a.type == 'resize') exp.resize(a);
  else {
   exp.moveTo(a.left + a.dX, a.top + a.dY);
   if (a.type == 'image') exp.content.style.cursor = 'move';
  }
}
return false;
},

wrapperMouseHandler : function (e) {
try {
  if (!e) e = window.event;
  var over = /mouseover/i.test(e.type); 
  if (!e.target) e.target = e.srcElement; // ie
  if (hs.ie) e.relatedTarget = 
   over ? e.fromElement : e.toElement; // ie
  var exp = hs.getExpander(e.target);
  if (!exp.isExpanded) return;
  if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget, true) == exp 
   || hs.dragArgs) return;
  hs.fireEvent(exp, over ? 'onMouseOver' : 'onMouseOut', e);
  for (var i = 0; i < exp.overlays.length; i++) (function() {
   var o = hs.$('hsId'+ exp.overlays[i]);
   if (o && o.hideOnMouseOut) {
    if (over) hs.setStyles(o, { visibility: 'visible' });
    hs.animate(o, { opacity: over ? o.opacity : 0 }, o.dur, null, 
     over ? null : function() { hs.setStyles(o, { visibility: 'hidden' })});
   }
  })(); 
} catch (e) {}
},
addEventListener : function (el, event, func) {
try {
  el.addEventListener(event, func, false);
} catch (e) {
  try {
   el.detachEvent('on'+ event, func);
   el.attachEvent('on'+ event, func);
  } catch (e) {
   el['on'+ event] = func;
  }
} 
},

removeEventListener : function (el, event, func) {
try {
  el.removeEventListener(event, func, false);
} catch (e) {
  try {
   el.detachEvent('on'+ event, func);
  } catch (e) {
   el['on'+ event] = null;
  }
}
},

preloadFullImage : function (i) {
if (hs.continuePreloading && hs.preloadTheseImages[i] && hs.preloadTheseImages[i] != 'undefined') {
  var img = document.createElement('img');
  img.onload = function() { 
   img = null;
   hs.preloadFullImage(i + 1);
  };
  img.src = hs.preloadTheseImages[i];
}
},
preloadImages : function (number) {
if (number && typeof number != 'object') hs.numberOfImagesToPreload = number;

var arr = hs.getAnchors();
for (var i = 0; i < arr.images.length && i < hs.numberOfImagesToPreload; i++) {
  hs.push(hs.preloadTheseImages, hs.getSrc(arr.images[i]));
}

// preload outlines
if (hs.outlineType) new hs.Outline(hs.outlineType, function () { hs.preloadFullImage(0)} );
else

hs.preloadFullImage(0);

// preload cursor
if (hs.restoreCursor) var cur = hs.createElement('img', { src: hs.graphicsDir + hs.restoreCursor });
},


init : function () {
if (!hs.container) {

  hs.page = hs.getPageSize();
  hs.ieLt7 = hs.ie && hs.uaVersion < 7;
  hs.ie6SSL = hs.ieLt7 && location.protocol == 'https:';
  for (var x in hs.langDefaults) {
   if (typeof hs[x] != 'undefined') hs.lang[x] = hs[x];
   else if (typeof hs.lang[x] == 'undefined' && typeof hs.langDefaults[x] != 'undefined') 
    hs.lang[x] = hs.langDefaults[x];
  }
  
  hs.container = hs.createElement('div', {
    className: 'highslide-container'
   }, {
    position: 'absolute', 
    left: 0, 
    top: 0, 
    width: '100%', 
    zIndex: hs.zIndexCounter,
    direction: 'ltr'
   }, 
   document.body,
   true
  );
  hs.loading = hs.createElement('a', {
    className: 'highslide-loading',
    title: hs.lang.loadingTitle,
    innerHTML: hs.lang.loadingText,
    href: 'javascript:;'
   }, {
    position: 'absolute',
    top: '-9999px',
    opacity: hs.loadingOpacity,
    zIndex: 1
   }, hs.container
  );
  hs.garbageBin = hs.createElement('div', null, { display: 'none' }, hs.container);
  hs.viewport = hs.createElement('div', {
    className: 'highslide-viewport'
   }, null, hs.container, 1
  );
  hs.clearing = hs.createElement('div', null, 
   { clear: 'both', paddingTop: '1px' }, null, true);
  
  // http://www.robertpenner.com/easing/ 
  Math.linearTween = function (t, b, c, d) {
   return c*t/d + b;
  };
  Math.easeInQuad = function (t, b, c, d) {
   return c*(t/=d)*t + b;
  };
  Math.easeOutQuad = function (t, b, c, d) {
   return -c *(t/=d)*(t-2) + b;
  };
  
  hs.hideSelects = hs.ieLt7;
  hs.hideIframes = ((window.opera && hs.uaVersion < 9) || navigator.vendor == 'KDE' 
   || (hs.ie && hs.uaVersion < 5.5));
  hs.fireEvent(this, 'onActivate');
}
},
domReady : function() {
hs.isDomReady = true;
if (hs.onDomReady) hs.onDomReady();
},

updateAnchors : function() {
var el, els, all = [], images = [], htmls = [],groups = {}, re;
  
for (var i = 0; i < hs.openerTagNames.length; i++) {
  els = document.getElementsByTagName(hs.openerTagNames[i]);
  for (var j = 0; j < els.length; j++) {
   el = els[j];
   re = hs.isHsAnchor(el);
   if (re) {
    hs.push(all, el);
    if (re[0] == 'hs.expand') hs.push(images, el);
    else if (re[0] == 'hs.htmlExpand') hs.push(htmls, el);
    var g = hs.getParam(el, 'slideshowGroup') || 'none';
    if (!groups[g]) groups[g] = [];
    hs.push(groups[g], el);
   }
  }
}
hs.anchors = { all: all, groups: groups, images: images, htmls: htmls };
return hs.anchors;

},

getAnchors : function() {
return hs.anchors || hs.updateAnchors();
},


close : function(el) {
var exp = hs.getExpander(el);
if (exp) exp.close();
return false;
}
}; // end hs object


hs.Outline =  function (outlineType, onLoad) {
this.onLoad = onLoad;
this.outlineType = outlineType;
var v = hs.uaVersion, tr;

this.hasAlphaImageLoader = hs.ie && v >= 5.5 && v < 7;
if (!outlineType) {
  if (onLoad) onLoad();
  return;
}

hs.init();
this.table = hs.createElement(
  'table', { 
   cellSpacing: 0 
  }, {
   visibility: 'hidden',
   position: 'absolute',
   borderCollapse: 'collapse',
   width: 0
  },
  hs.container,
  true
);
var tbody = hs.createElement('tbody', null, null, this.table, 1);

this.td = [];
for (var i = 0; i <= 8; i++) {
  if (i % 3 == 0) tr = hs.createElement('tr', null, { height: 'auto' }, tbody, true);
  this.td[i] = hs.createElement('td', null, null, tr, true);
  var style = i != 4 ? { lineHeight: 0, fontSize: 0} : { position : 'relative' };
  hs.setStyles(this.td[i], style);
}
this.td[4].className = outlineType +' highslide-outline';

this.preloadGraphic(); 
};

hs.Outline.prototype = {
preloadGraphic : function () {
var src = hs.graphicsDir + (hs.outlinesDir || "outlines/")+ this.outlineType +".png";
    
var appendTo = hs.safari ? hs.container : null;
this.graphic = hs.createElement('img', null, { position: 'absolute', 
  top: '-9999px' }, appendTo, true); // for onload trigger

var pThis = this;
this.graphic.onload = function() { pThis.onGraphicLoad(); };

this.graphic.src = src;
},

onGraphicLoad : function () {
var o = this.offset = this.graphic.width / 4,
  pos = [[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]],
  dim = { height: (2*o) +'px', width: (2*o) +'px' };
for (var i = 0; i <= 8; i++) {
  if (pos[i]) {
   if (this.hasAlphaImageLoader) {
    var w = (i == 1 || i == 7) ? '100%' : this.graphic.width +'px';
    var div = hs.createElement('div', null, { width: '100%', height: '100%', position: 'relative', overflow: 'hidden'}, this.td[i], true);
    hs.createElement ('div', null, { 
      filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')", 
      position: 'absolute',
      width: w, 
      height: this.graphic.height +'px',
      left: (pos[i][0]*o)+'px',
      top: (pos[i][1]*o)+'px'
     }, 
    div,
    true);
   } else {
    hs.setStyles(this.td[i], { background: 'url('+ this.graphic.src +') '+ (pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'});
   }
   
   if (window.opera && (i == 3 || i ==5)) 
    hs.createElement('div', null, dim, this.td[i], true);
   
   hs.setStyles (this.td[i], dim);
  }
}
this.graphic = null;
if (hs.pendingOutlines[this.outlineType]) hs.pendingOutlines[this.outlineType].destroy();
hs.pendingOutlines[this.outlineType] = this;
if (this.onLoad) this.onLoad();
},

setPosition : function (parse, offset, vis, dur, easing) {
var exp = this.exp,
  stl = exp.wrapper.style,
  offset = offset || 0,
  pos = parse ? {
   x: parseInt(stl.left),
   y: parseInt(stl.top),
   w: parseInt(stl.width),
   h: parseInt(stl.height)
  } : {
   x: exp.x.pos + offset,
   y: exp.y.pos + offset,
   w: exp.x.get('wsize') - 2 * offset,
   h: exp.y.get('wsize') - 2 * offset
  };
if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset) 
  ? 'visible' : 'hidden';
hs.setStyles(this.table, {
  left: (pos.x - this.offset) +'px',
  top: (pos.y - this.offset) +'px',
  width: (pos.w + 2 * this.offset) +'px'
});

pos.w -= 2 * this.offset;
pos.h -= 2 * this.offset;
hs.setStyles (this.td[4], {
  width: pos.w >= 0 ? pos.w +'px' : 0,
  height: pos.h >= 0 ? pos.h +'px' : 0
});
if (this.hasAlphaImageLoader) this.td[3].style.height 
  = this.td[5].style.height = this.td[4].style.height; 

},

destroy : function(hide) {
if (hide) this.table.style.visibility = 'hidden';
else hs.discardElement(this.table);
}
};

hs.Dimension = function(exp, dim) {
this.exp = exp;
this.dim = dim;
this.ucwh = dim == 'x' ? 'Width' : 'Height';
this.wh = this.ucwh.toLowerCase();
this.uclt = dim == 'x' ? 'Left' : 'Top';
this.lt = this.uclt.toLowerCase();
this.ucrb = dim == 'x' ? 'Right' : 'Bottom';
this.rb = this.ucrb.toLowerCase();
this.p1 = this.p2 = 0;
};
hs.Dimension.prototype = {
get : function(key) {
switch (key) {
  case 'loadingPos':
   return this.tpos + this.tb + (this.t - hs.loading['offset'+ this.ucwh]) / 2;
  case 'loadingPosXfade':
   return this.pos + this.cb+ this.p1 + (this.size - hs.loading['offset'+ this.ucwh]) / 2;
  case 'wsize':
   return this.size + 2 * this.cb + this.p1 + this.p2;
  case 'fitsize':
   return this.clientSize - this.marginMin - this.marginMax;
  case 'opos':
   return this.pos - (this.exp.outline ? this.exp.outline.offset : 0);
  case 'osize':
   return this.get('wsize') + (this.exp.outline ? 2*this.exp.outline.offset : 0);
  case 'imgPad':
   return this.imgSize ? Math.round((this.size - this.imgSize) / 2) : 0;
  
}
},
calcBorders: function() {
// correct for borders
this.cb = (this.exp.content['offset'+ this.ucwh] - this.t) / 2;
this.marginMax = hs['margin'+ this.ucrb] + 2 * this.cb;
},
calcThumb: function() {
this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) : 
  this.exp.el['offset'+ this.ucwh];
this.tpos = this.exp.tpos[this.dim];
this.tb = (this.exp.el['offset'+ this.ucwh] - this.t) / 2;
if (this.tpos == 0) {
  this.tpos = (hs.page[this.wh] / 2) + hs.page['scroll'+ this.uclt];  
};
},
calcExpanded: function() {
var exp = this.exp;
this.justify = 'auto';

// get alignment
if (exp.align == 'center') this.justify = 'center';
else if (new RegExp(this.lt).test(exp.anchor)) this.justify = null;
else if (new RegExp(this.rb).test(exp.anchor)) this.justify = 'max';


// size and position
this.pos = this.tpos - this.cb + this.tb;
this.size = Math.min(this.full, exp['max'+ this.ucwh] || this.full);
this.minSize = exp.allowSizeReduction ? 
  Math.min(exp['min'+ this.ucwh], this.full) :this.full;
if (exp.isImage && exp.useBox) {
  this.size = exp[this.wh];
  this.imgSize = this.full;
}
if (this.dim == 'x' && hs.padToMinWidth) this.minSize = exp.minWidth;
this.target = exp['target'+ this.dim.toUpperCase()];
this.marginMin = hs['margin'+ this.uclt];
this.scroll = hs.page['scroll'+ this.uclt];
this.clientSize = hs.page[this.wh];
},
setSize: function(i) {
var exp = this.exp;
if (exp.isImage && (exp.useBox || hs.padToMinWidth)) {
  this.imgSize = i;
  this.size = Math.max(this.size, this.imgSize);
  exp.content.style[this.lt] = this.get('imgPad')+'px';
} else
this.size = i;

exp.content.style[this.wh] = i +'px';
exp.wrapper.style[this.wh] = this.get('wsize') +'px';
if (exp.outline) exp.outline.setPosition();
if (exp.releaseMask) exp.releaseMask.style[this.wh] = i +'px';
if (exp.isHtml) {
  var d = exp.scrollerDiv;
  if (this.sizeDiff === undefined)
   this.sizeDiff = exp.innerContent['offset'+ this.ucwh] - d['offset'+ this.ucwh];
  d.style[this.wh] = (this.size - this.sizeDiff) +'px';
   
  if (this.dim == 'x') exp.mediumContent.style.width = 'auto';
  if (exp.body) exp.body.style[this.wh] = 'auto';  
}
if (this.dim == 'x' && exp.overlayBox) exp.sizeOverlayBox(true);
if (this.dim == 'x' && exp.slideshow && exp.isImage) {
  if (i == this.full) exp.slideshow.disable('full-expand');
  else exp.slideshow.enable('full-expand');
}
},
setPos: function(i) {
this.pos = i;
this.exp.wrapper.style[this.lt] = i +'px'; 

if (this.exp.outline) this.exp.outline.setPosition();

}
};

hs.Expander = function(a, params, custom, contentType) {
if (document.readyState && hs.ie && !hs.isDomReady) {
  hs.onDomReady = function() {
   new hs.Expander(a, params, custom, contentType);
  };
  return;
} 
this.a = a;
this.custom = custom;
this.contentType = contentType || 'image';
this.isHtml = (contentType == 'html');
this.isImage = !this.isHtml;

hs.continuePreloading = false;
this.overlays = [];
this.last = hs.last;
hs.last = null;
hs.init();
var key = this.key = hs.expanders.length;

// override inline parameters
for (var i = 0; i < hs.overrides.length; i++) {
  var name = hs.overrides[i];
  this[name] = params && typeof params[name] != 'undefined' ?
   params[name] : hs[name];
}
if (!this.src) this.src = a.href;

// get thumb
var el = (params && params.thumbnailId) ? hs.$(params.thumbnailId) : a;
el = this.thumb = el.getElementsByTagName('img')[0] || el;
this.thumbsUserSetId = el.id || a.id;
if (!hs.fireEvent(this, 'onInit')) return true;

// check if already open
for (var i = 0; i < hs.expanders.length; i++) {
  if (hs.expanders[i] && hs.expanders[i].a == a 
   && !(this.last && this.transitions[1] == 'crossfade')) {
   hs.expanders[i].focus();
   return false;
  }
} 

// cancel other
for (var i = 0; i < hs.expanders.length; i++) {
  if (hs.expanders[i] && hs.expanders[i].thumb != el && !hs.expanders[i].onLoadStarted) {
   hs.expanders[i].cancelLoading();
  }
}
hs.expanders[this.key] = this;
if (!hs.allowMultipleInstances && !hs.upcoming) {
  if (hs.expanders[key-1]) hs.expanders[key-1].close();
  if (typeof hs.focusKey != 'undefined' && hs.expanders[hs.focusKey])
   hs.expanders[hs.focusKey].close();
}

// initiate metrics
this.el = el;
this.tpos = hs.getPosition(el);
hs.page = hs.getPageSize();
var x = this.x = new hs.Dimension(this, 'x');
x.calcThumb();
var y = this.y = new hs.Dimension(this, 'y');
y.calcThumb();
if (/area/i.test(el.tagName)) this.getImageMapAreaCorrection(el);
this.wrapper = hs.createElement(
  'div', {
   id: 'highslide-wrapper-'+ this.key,
   className: this.wrapperClassName
  }, {
   visibility: 'hidden',
   position: 'absolute',
   zIndex: hs.zIndexCounter++
  }, null, true );

this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHandler;
if (this.contentType == 'image' && this.outlineWhileAnimating == 2)
  this.outlineWhileAnimating = 0;

// get the outline
if (!this.outlineType 
  || (this.last && this.isImage && this.transitions[1] == 'crossfade')) {
  this[this.contentType +'Create']();

} else if (hs.pendingOutlines[this.outlineType]) {
  this.connectOutline();
  this[this.contentType +'Create']();

} else {
  this.showLoading();
  var exp = this;
  new hs.Outline(this.outlineType, 
   function () {
    exp.connectOutline();
    exp[exp.contentType +'Create']();
   } 
  );
}
return true;
};

hs.Expander.prototype = {
error : function(e) {
// alert ('Line '+ e.lineNumber +': '+ e.message);
window.location.href = this.src;
},

connectOutline : function() {
var outline = this.outline = hs.pendingOutlines[this.outlineType];
outline.exp = this;
outline.table.style.zIndex = this.wrapper.style.zIndex;
hs.pendingOutlines[this.outlineType] = null;
},

showLoading : function() {
if (this.onLoadStarted || this.loading) return;

this.loading = hs.loading;
var exp = this;
this.loading.onclick = function() {
  exp.cancelLoading();
};


if (!hs.fireEvent(this, 'onShowLoading')) return;
var exp = this, 
  l = this.x.get('loadingPos') +'px',
  t = this.y.get('loadingPos') +'px';
if (!tgt && this.last && this.transitions[1] == 'crossfade') 
  var tgt = this.last; 
if (tgt) {
  l = tgt.x.get('loadingPosXfade') +'px';
  t = tgt.y.get('loadingPosXfade') +'px';
  this.loading.style.zIndex = hs.zIndexCounter++;
}
setTimeout(function () { 
  if (exp.loading) hs.setStyles(exp.loading, { left: l, top: t, zIndex: hs.zIndexCounter++ })}
, 100);
},

imageCreate : function() {
var exp = this;

var img = document.createElement('img');
    this.content = img;
    img.onload = function () {
     if (hs.expanders[exp.key]) exp.contentLoaded(); 
};
    if (hs.blockRightClick) img.oncontextmenu = function() { return false; };
    img.className = 'highslide-image';
    hs.setStyles(img, {
     visibility: 'hidden',
     display: 'block',
     position: 'absolute',
  maxWidth: '9999px',
  zIndex: 3
});
    img.title = hs.lang.restoreTitle;
    if (hs.safari) hs.container.appendChild(img);
    if (hs.ie && hs.flushImgSize) img.src = null;
img.src = this.src;

this.showLoading();
},

htmlCreate : function () {
if (!hs.fireEvent(this, 'onBeforeGetContent')) return;

this.content = hs.getCacheBinding(this.a);
if (!this.content) 
  this.content = hs.getNode(this.contentId);
if (!this.content) 
  this.content = hs.getSelfRendered();
this.getInline(['maincontent']);
if (this.maincontent) {
  var body = hs.getElementByClass(this.content, 'div', 'highslide-body');
  if (body) body.appendChild(this.maincontent);
  this.maincontent.style.display = 'block';
}
hs.fireEvent(this, 'onAfterGetContent');

this.innerContent = this.content;

if (/(swf|iframe)/.test(this.objectType)) this.setObjContainerSize(this.innerContent);

// the content tree
hs.container.appendChild(this.wrapper);
hs.setStyles( this.wrapper, { 
  position: 'static',
  padding: '0 '+ hs.marginRight +'px 0 '+ hs.marginLeft +'px'
});
this.content = hs.createElement(
     'div', {
      className: 'highslide-html' 
     }, {
   position: 'relative',
   zIndex: 3,
   overflow: 'hidden'
  },
  this.wrapper
);
this.mediumContent = hs.createElement('div', null, null, this.content, 1);
this.mediumContent.appendChild(this.innerContent);

hs.setStyles (this.innerContent, { 
  position: 'relative',
  display: 'block',
  direction: hs.lang.cssDirection || ''
});
if (this.width) this.innerContent.style.width = this.width+'px';
if (this.height) this.innerContent.style.height = this.height+'px';
if (this.innerContent.offsetWidth < this.minWidth)
  this.innerContent.style.width = this.minWidth +'px';

    
if (this.objectType == 'ajax' && !hs.getCacheBinding(this.a)) {
  this.showLoading();
     var ajax = new hs.Ajax(this.a, this.innerContent);
     var exp = this;
     ajax.onLoad = function () { if (hs.expanders[exp.key]) exp.contentLoaded(); };
     ajax.onError = function () { location.href = exp.src; };
     ajax.run();
}
    else
    
    if (this.objectType == 'iframe' && this.objectLoadTime == 'before') {
  this.writeExtendedContent();
}
    else
     this.contentLoaded();
},

contentLoaded : function() {
try { 
  if (!this.content) return;
  this.content.onload = null;
  if (this.onLoadStarted) return;
  else this.onLoadStarted = true;
  
  var x = this.x, y = this.y;
  
  if (this.loading) {
   hs.setStyles(this.loading, { top: '-9999px' });
   this.loading = null;
   hs.fireEvent(this, 'onHideLoading');
  }
  if (this.isImage) { 
   x.full = this.content.width;
   y.full = this.content.height;
   
   hs.setStyles(this.content, {
    width: x.t +'px',
    height: y.t +'px'
   });
   this.wrapper.appendChild(this.content);
   hs.container.appendChild(this.wrapper);
  } else if (this.htmlGetSize) this.htmlGetSize();
  
  x.calcBorders();
  y.calcBorders();
  
  hs.setStyles (this.wrapper, {
   left: (x.tpos + x.tb - x.cb) +'px',
   top: (y.tpos + x.tb - y.cb) +'px'
  });  
  
  
  this.initSlideshow();
  this.getOverlays();
  
  var ratio = x.full / y.full;
  
  x.calcExpanded();
  this.justify(x);
  
  y.calcExpanded();
  this.justify(y);
  if (this.isHtml) this.htmlSizeOperations();
  if (this.overlayBox) this.sizeOverlayBox(0, 1);
  
  if (this.allowSizeReduction) {
   if (this.isImage)
    this.correctRatio(ratio);
   else this.fitOverlayBox();
   var ss = this.slideshow;   
   if (ss && this.last && ss.controls && ss.fixedControls) {
    var pos = ss.overlayOptions.position || '', p;
    for (var dim in hs.oPos) for (var i = 0; i < 5; i++) {
     p = this[dim];
     if (pos.match(hs.oPos[dim][i])) {
      p.pos = this.last[dim].pos 
       + (this.last[dim].p1 - p.p1)
       + (this.last[dim].size - p.size) * [0, 0, .5, 1, 1][i];
      if (ss.fixedControls == 'fit') {
       if (p.pos + p.size + p.p1 + p.p2 > p.scroll + p.clientSize - p.marginMax)
        p.pos = p.scroll + p.clientSize - p.size - p.marginMin - p.marginMax - p.p1 - p.p2;
       if (p.pos < p.scroll + p.marginMin) p.pos = p.scroll + p.marginMin; 
      } 
     }
    }
   }
   if (this.isImage && this.x.full > (this.x.imgSize || this.x.size)) {
    this.createFullExpand();
    if (this.overlays.length == 1) this.sizeOverlayBox();
   }
  }
  this.show();
  
} catch (e) {
  this.error(e);
}
},


setObjContainerSize : function(parent, auto) {
var c = hs.getElementByClass(parent, 'DIV', 'highslide-body');
if (/(iframe|swf)/.test(this.objectType)) {
  if (this.objectWidth) c.style.width = this.objectWidth +'px';
  if (this.objectHeight) c.style.height = this.objectHeight +'px';
}
},

writeExtendedContent : function () {
if (this.hasExtendedContent) return;
var exp = this;
this.body = hs.getElementByClass(this.innerContent, 'DIV', 'highslide-body');
if (this.objectType == 'iframe') {
  this.showLoading();
  var ruler = hs.clearing.cloneNode(1);
  this.body.appendChild(ruler);
  this.newWidth = this.innerContent.offsetWidth;
  if (!this.objectWidth) this.objectWidth = ruler.offsetWidth;
  var hDiff = this.innerContent.offsetHeight - this.body.offsetHeight,
   h = this.objectHeight || hs.page.height - hDiff - hs.marginTop - hs.marginBottom,
   onload = this.objectLoadTime == 'before' ? 
    ' onload="if (hs.expanders['+ this.key +']) hs.expanders['+ this.key +'].contentLoaded()" ' : '';
  
  this.body.innerHTML += '<iframe name="hs'+ (new Date()).getTime() +'" frameborder="0" key="'+ this.key +'" '
   +' allowtransparency="true" style="width:'+ this.objectWidth +'px; height:'+ h +'px" '
   + onload +' src="'+ this.src +'"></iframe>';
  this.ruler = this.body.getElementsByTagName('div')[0];
  this.iframe = this.body.getElementsByTagName('iframe')[0];
  
  if (this.objectLoadTime == 'after') this.correctIframeSize();
  
}
if (this.objectType == 'swf') {
  this.body.id = this.body.id || 'hs-flash-id-' + this.key;
  var a = this.swfOptions;
  if (typeof a.params.wmode == 'undefined') a.params.wmode = 'transparent';
  if (swfobject) swfobject.embedSWF(this.src, this.body.id, this.objectWidth, this.objectHeight, 
   a.version || '7', a.expressInstallSwfurl, a.flashvars, a.params, a.attributes);
}
this.hasExtendedContent = true;
},
htmlGetSize : function() {
if (this.iframe && !this.objectHeight) { // loadtime before  
  this.iframe.style.height = this.body.style.height = this.getIframePageHeight() +'px';
}
this.innerContent.appendChild(hs.clearing);
if (!this.x.full) this.x.full = this.innerContent.offsetWidth;
    this.y.full = this.innerContent.offsetHeight;
    this.innerContent.removeChild(hs.clearing);
    if (hs.ie && this.newHeight > parseInt(this.innerContent.currentStyle.height)) { // ie css bug
  this.newHeight = parseInt(this.innerContent.currentStyle.height);
}
hs.setStyles( this.wrapper, { position: 'absolute', padding: '0'});
hs.setStyles( this.content, { width: this.x.t +'px', height: this.y.t +'px'});
},

getIframePageHeight : function() {
var h;
try {
  var doc = this.iframe.contentDocument || this.iframe.contentWindow.document;
  var clearing = doc.createElement('div');
  clearing.style.clear = 'both';
  doc.body.appendChild(clearing);
  h = clearing.offsetTop;
  if (hs.ie) h += parseInt(doc.body.currentStyle.marginTop) 
   + parseInt(doc.body.currentStyle.marginBottom) - 1;
} catch (e) { // other domain
  h = 300;
}
return h;
},
correctIframeSize : function () {
var wDiff = this.innerContent.offsetWidth - this.ruler.offsetWidth;
if (wDiff < 0) wDiff = 0;

var hDiff = this.innerContent.offsetHeight - this.iframe.offsetHeight;
hs.setStyles(this.iframe, { width: (this.x.size - wDiff) +'px', 
  height: (this.y.size - hDiff) +'px' });
    hs.setStyles(this.body, { width: this.iframe.style.width, 
     height: this.iframe.style.height });
     
    this.scrollingContent = this.iframe;
    this.scrollerDiv = this.scrollingContent;
},
htmlSizeOperations : function () {

this.setObjContainerSize(this.innerContent);


if (this.objectType == 'swf' && this.objectLoadTime == 'before') this.writeExtendedContent(); 

    // handle minimum size
    if (this.x.size < this.x.full && !this.allowWidthReduction) this.x.size = this.x.full;
    if (this.y.size < this.y.full && !this.allowHeightReduction) this.y.size = this.y.full;
this.scrollerDiv = this.innerContent;
    hs.setStyles(this.mediumContent, { 
  position: 'relative',
  width: this.x.size +'px'
});
    hs.setStyles(this.innerContent, { 
     border: 'none',
     width: 'auto',
     height: 'auto'
    });
var node = hs.getElementByClass(this.innerContent, 'DIV', 'highslide-body');
    if (node && !/(iframe|swf)/.test(this.objectType)) {
     var cNode = node; // wrap to get true size
     node = hs.createElement(cNode.nodeName, null, {overflow: 'hidden'}, null, true);
     cNode.parentNode.insertBefore(node, cNode);
     node.appendChild(hs.clearing); // IE6
     node.appendChild(cNode);
     
     var wDiff = this.innerContent.offsetWidth - node.offsetWidth;
     var hDiff = this.innerContent.offsetHeight - node.offsetHeight;
  node.removeChild(hs.clearing);
     
     var kdeBugCorr = hs.safari || navigator.vendor == 'KDE' ? 1 : 0; // KDE repainting bug
     hs.setStyles(node, { 
       width: (this.x.size - wDiff - kdeBugCorr) +'px', 
       height: (this.y.size - hDiff) +'px',
       overflow: 'auto', 
       position: 'relative' 
      } 
     );
  if (kdeBugCorr && cNode.offsetHeight > node.offsetHeight) {
      node.style.width = (parseInt(node.style.width) + kdeBugCorr) + 'px';
  }
     this.scrollingContent = node;
     this.scrollerDiv = this.scrollingContent;
}
    if (this.iframe && this.objectLoadTime == 'before') this.correctIframeSize();
    if (!this.scrollingContent && this.y.size < this.mediumContent.offsetHeight) this.scrollerDiv = this.content;

if (this.scrollerDiv == this.content && !this.allowWidthReduction && !/(iframe|swf)/.test(this.objectType)) {
  this.x.size += 17; // room for scrollbars
}
if (this.scrollerDiv && this.scrollerDiv.offsetHeight > this.scrollerDiv.parentNode.offsetHeight) {
  setTimeout("try { hs.expanders["+ this.key +"].scrollerDiv.style.overflow = 'auto'; } catch(e) {}",
    hs.expandDuration);
}
},

getImageMapAreaCorrection : function(area) {
var c = area.coords.split(',');
for (var i = 0; i < c.length; i++) c[i] = parseInt(c[i]);

if (area.shape.toLowerCase() == 'circle') {
  this.x.tpos += c[0] - c[2];
  this.y.tpos += c[1] - c[2];
  this.x.t = this.y.t = 2 * c[2];
} else {
  var maxX, maxY, minX = maxX = c[0], minY = maxY = c[1];
  for (var i = 0; i < c.length; i++) {
   if (i % 2 == 0) {
    minX = Math.min(minX, c[i]);
    maxX = Math.max(maxX, c[i]);
   } else {
    minY = Math.min(minY, c[i]);
    maxY = Math.max(maxY, c[i]);
   }
  }
  this.x.tpos += minX;
  this.x.t = maxX - minX;
  this.y.tpos += minY;
  this.y.t = maxY - minY;
}
},
justify : function (p, moveOnly) {
var tgtArr, tgt = p.target, dim = p == this.x ? 'x' : 'y';

if (tgt && tgt.match(/ /)) {
  tgtArr = tgt.split(' ');
  tgt = tgtArr[0];
}
if (tgt && hs.$(tgt)) {
  p.pos = hs.getPosition(hs.$(tgt))[dim];
  if (tgtArr && tgtArr[1] && tgtArr[1].match(/^[-]?[0-9]+px$/)) 
   p.pos += parseInt(tgtArr[1]);
  if (p.size < p.minSize) p.size = p.minSize;
  
} else if (p.justify == 'auto' || p.justify == 'center') {

  var hasMovedMin = false;
  
  var allowReduce = p.exp.allowSizeReduction;
  if (p.justify == 'center')
   p.pos = Math.round(p.scroll + (p.clientSize + p.marginMin - p.marginMax - p.get('wsize')) / 2);
  else
   p.pos = Math.round(p.pos - ((p.get('wsize') - p.t) / 2));
  if (p.pos < p.scroll + p.marginMin) {
   p.pos = p.scroll + p.marginMin;
   hasMovedMin = true;  
  }
  if (!moveOnly && p.size < p.minSize) {
   p.size = p.minSize;
   allowReduce = false;
  }
  if (p.pos + p.get('wsize') > p.scroll + p.clientSize - p.marginMax) {
   if (!moveOnly && hasMovedMin && allowReduce) {
    p.size = p.get('fitsize'); // can't expand more
   } else if (p.get('wsize') < p.get('fitsize')) {
    p.pos = p.scroll + p.clientSize - p.marginMax - p.get('wsize');
   } else { // image larger than viewport
    p.pos = p.scroll + p.marginMin;
    if (!moveOnly && allowReduce) p.size = p.get('fitsize');
   }   
  }
  
  if (!moveOnly && p.size < p.minSize) {
   p.size = p.minSize;
   allowReduce = false;
  }
  

} else if (p.justify == 'max') {
  p.pos = Math.floor(p.pos - p.size + p.t);
}

  
if (p.pos < p.marginMin) {
  var tmpMin = p.pos;
  p.pos = p.marginMin; 
  
  if (allowReduce && !moveOnly) p.size = p.size - (p.pos - tmpMin);
  
}
},

correctRatio : function(ratio) {
var x = this.x, 
  y = this.y,
  changed = false,
  xSize = Math.min(x.full, x.size),
  ySize = Math.min(y.full, y.size),
  useBox = (this.useBox || hs.padToMinWidth);

if (xSize / ySize > ratio) { // width greater
  xSize = ySize * ratio;
  if (xSize < x.minSize) { // below minWidth
   xSize = x.minSize;
   ySize = xSize / ratio;
  }
  changed = true;

} else if (xSize / ySize < ratio) { // height greater
  ySize = xSize / ratio;
  changed = true;
}

if (hs.padToMinWidth && x.full < x.minSize) {
  x.imgSize = x.full;
  y.size = y.imgSize = y.full;
} else if (this.useBox) {
  x.imgSize = xSize;
  y.imgSize = ySize;
} else {
  x.size = xSize;
  y.size = ySize;
}
this.fitOverlayBox(useBox ? null : ratio);
if (useBox && y.size < y.imgSize) {
  y.imgSize = y.size;
  x.imgSize = y.size * ratio;
}
if (changed || useBox) {
  x.pos = x.tpos - x.cb + x.tb;
  x.minSize = x.size;
  this.justify(x, true);

  y.pos = y.tpos - y.cb + y.tb;
  y.minSize = y.size;
  this.justify(y, true);
  if (this.overlayBox) this.sizeOverlayBox();
}
},
fitOverlayBox : function(ratio) {
var x = this.x, y = this.y;
if (this.overlayBox) {
  while (y.size > this.minHeight && x.size > this.minWidth 
    &&  y.get('wsize') > y.get('fitsize')) {
   y.size -= 10;
   if (ratio) x.size = y.size * ratio;
   this.sizeOverlayBox(0, 1);
  }
}
},

reflow : function () {
if (this.scrollerDiv) {
  var h = /iframe/i.test(this.scrollerDiv.tagName) ? this.getIframePageHeight() + 1 +'px' : 'auto';
  if (this.body) this.body.style.height = h;
  this.scrollerDiv.style.height = h;
  this.y.setSize(this.innerContent.offsetHeight);
  hs.setDimmerSize(this);
}
},

show : function () {
var x = this.x, y = this.y;
this.doShowHide('hidden');
hs.fireEvent(this, 'onBeforeExpand');
if (this.slideshow && this.slideshow.thumbstrip) this.slideshow.thumbstrip.selectThumb();

// Apply size change
this.changeSize(
  1, {
   wrapper: {
    width : x.get('wsize'),
    height : y.get('wsize'),
    left: x.pos,
    top: y.pos
   },
   content: {
    left: x.p1 + x.get('imgPad'),
    top: y.p1 + y.get('imgPad'),
    width:x.imgSize ||x.size,
    height:y.imgSize ||y.size
   }
  },
  hs.expandDuration
);
},

changeSize : function(up, to, dur) {
// transition
var trans = this.transitions,
other = up ? (this.last ? this.last.a : null) : hs.upcoming,
t = (trans[1] && other 
   && hs.getParam(other, 'transitions')[1] == trans[1]) ?
  trans[1] : trans[0];
  
if (this[t] && t != 'expand') {
  this[t](up, to);
  return;
}

if (this.outline && !this.outlineWhileAnimating) {
  if (up) this.outline.setPosition();
  else this.outline.destroy(
    (this.isHtml && this.preserveContent));
}


if (!up) this.destroyOverlays();

var exp = this,
  x = exp.x,
  y = exp.y,
  easing = this.easing;
if (!up) easing = this.easingClose || easing;
var after = up ?
  function() {
    
   if (exp.outline) exp.outline.table.style.visibility = "visible";
   setTimeout(function() {
    exp.afterExpand();
   }, 50);
  } :
  function() {
   exp.afterClose();
  };
if (up) hs.setStyles( this.wrapper, {
  width: x.t +'px',
  height: y.t +'px'
});
if (this.isHtml) {
  var mcPos = {
   left: (x.pos - x.tpos + x.cb - x.tb) +'px',
   top: (y.pos - y.tpos + y.cb - y.tb) +'px'
  };
  if (up) {
   hs.setStyles(this.wrapper, {
    left: (x.tpos - x.cb + x.tb) +'px',
    top: (y.tpos - y.cb + y.tb) +'px'
   });
   hs.setStyles(this.mediumContent, mcPos);
   mcPos = { left: 0, top: 0 };
  }
  
  hs.animate(this.mediumContent, mcPos, dur, easing);
}
if (this.fadeInOut) {
  hs.setStyles(this.wrapper, { opacity: up ? 0 : 1 });
  hs.extend(to.wrapper, { opacity: up });
}
if (this.outline && this.outlineWhileAnimating) {
  var wrapStep =  function(val, args) {
   if (args.prop == 'height') exp.outline.setPosition(1, 0, 1);
  }
}
hs.animate( this.wrapper, to.wrapper, {
  duration: dur,
  easing: easing,
  step: wrapStep
});
hs.animate( this.content, to.content, dur, easing, after);
if (up) {
  this.wrapper.style.visibility = 'visible';
  this.content.style.visibility = 'visible';
  if (this.isHtml) this.innerContent.style.visibility = 'visible';
  this.a.className += ' highslide-active-anchor';
}
},



fade : function(up, to) {
this.outlineWhileAnimating = false;
var exp = this, t = up ? hs.expandDuration : 0;

if (up) {
  hs.animate(this.wrapper, to.wrapper, 0);
  hs.setStyles(this.wrapper, { opacity: 0, visibility: 'visible' });
  hs.animate(this.content, to.content, 0);
  this.content.style.visibility = 'visible';

  hs.animate(this.wrapper, { opacity: 1 }, t, null, 
   function() { exp.afterExpand(); });
}

if (this.outline) {
  this.outline.table.style.zIndex = this.wrapper.style.zIndex;
  var dir = up || -1, 
   offset = this.outline.offset,
   startOff = up ? 3 : offset,
   endOff = up? offset : 3;
  for (var i = startOff; dir * i <= dir * endOff; i += dir, t += 25) {
   (function() {
    var o = up ? endOff - i : startOff - i;
    setTimeout(function() {
     exp.outline.setPosition(0, o, 1);
    }, t);
   })();
  }
}


if (up) {}//setTimeout(function() { exp.afterExpand(); }, t+50);
else {
  setTimeout( function() {
   if (exp.outline) exp.outline.destroy(exp.preserveContent);
   
   exp.destroyOverlays();

   hs.animate( exp.wrapper, { opacity: 0 }, null, null, function(){
    exp.afterClose();
   });
  }, t);  
}
},

crossfade : function (up, to) {
if (!up) return;
var exp = this, 
  dur = hs.transitionDuration, 
  last = exp.last,
  x = exp.x, 
  y = exp.y,
  lastX = last.x,
  lastY = last.y,
  overlayBox = exp.overlayBox,
  wrapper = this.wrapper,
  content = this.content;
hs.removeEventListener(document, 'mousemove', hs.dragHandler);
this.outline = last.outline;
if (this.outline) this.outline.exp = exp;
last.outline = null;
last.wrapper.style.overflow = 'hidden';
hs.setStyles(wrapper, {
  left: lastX.pos +'px',
  top: lastY.pos +'px',
  width: lastX.get('wsize') +'px',
  height: lastY.get('wsize') +'px'
});
hs.setStyles(content, {
  display: 'none',
  width: (x.imgSize || x.size) +'px', 
  height: (y.imgSize || y.size) +'px',
  left: (x.p1 + x.get('imgPad')) +'px',
  top: (y.p1 + y.get('imgPad')) + 'px'
});
var fadeBox = hs.createElement('div', {
  className: 'highslide-image'
}, { 
  position: 'absolute', 
  zIndex: 4,
  overflow: 'hidden',
  display: 'none',
  left: (lastX.p1 + lastX.get('imgPad')) +'px',
  top: (lastY.p1 + lastY.get('imgPad')) +'px',
  width: (lastX.imgSize || lastX.size) +'px',
  height: (lastY.imgSize || lastY.size) +'px'
});
if (this.isHtml) hs.setStyles(this.mediumContent, { 
  left: 0,
  top: 0
});
if (overlayBox) hs.setStyles(overlayBox, {
  overflow: 'visible',
  left: (lastX.p1 + lastX.cb) +'px',
  top: (lastY.p1 + lastY.cb) +'px',
  width: lastX.size +'px',
  height: lastY.size +'px'
});
var names = { oldImg: last, newImg: this };
for (var n in names) {  
  this[n] = names[n].content.cloneNode(1);
  hs.setStyles(this[n], {
   position: 'absolute',
   border: 0,
   visibility: 'visible'
  });
  fadeBox.appendChild(this[n]);
}
hs.setStyles(this.oldImg, {
  left: 0,
  top: 0
}); 
hs.setStyles(this.newImg, {
  display: 'block',
  opacity: 0,
  left: (x.pos - lastX.pos + x.p1 - lastX.p1 + x.get('imgPad') - lastX.get('imgPad')) +'px',
  top: (y.pos - lastY.pos + y.p1 - lastY.p1 + y.get('imgPad') - lastY.get('imgPad')) +'px'
});
wrapper.appendChild(fadeBox);
if (overlayBox) {
  overlayBox.className = '';
  wrapper.appendChild(overlayBox);
}
fadeBox.style.display = '';
last.content.style.display = 'none';

if (hs.safari) {
  var match = navigator.userAgent.match(/Safari\/([0-9]{3})/);
  if (match && parseInt(match[1]) < 525) wrapper.style.visibility = 'visible';
}
function end() {  
  wrapper.style.visibility = content.style.visibility = 'visible';
  content.style.display = 'block';
  fadeBox.style.display = 'none';
  exp.a.className += ' highslide-active-anchor';
  exp.afterExpand();
  last.afterClose();
}

hs.animate(last.wrapper, { 
  left: x.pos,
  top: y.pos,
  width: x.get('wsize'),
  height: y.get('wsize')
}, dur);

hs.animate(fadeBox, {
  width: x.imgSize || x.size,
  height: y.imgSize || y.size,
  left: x.p1 + x.get('imgPad'),
  top: y.p1 + y.get('imgPad')
}, dur);

hs.animate(this.oldImg, {
  left: (lastX.pos - x.pos + lastX.p1 - x.p1 + lastX.get('imgPad') - x.get('imgPad')),
  top: (lastY.pos - y.pos + lastY.p1 - y.p1 + lastY.get('imgPad') - y.get('imgPad'))
}, dur);  

hs.animate(this.newImg, {
  opacity: 1,
  left: 0,
  top: 0
}, dur);
if (overlayBox) hs.animate(overlayBox, {
  left: x.p1 + x.cb,
  top: y.p1 + y.cb,
  width: x.size,
  height: y.size
}, dur);
if (this.outline) var wrapStep =  function(val, args) {  
  if (args.prop == 'height') exp.outline.setPosition(1);
};
hs.animate(wrapper, to.wrapper, {
  duration: dur, 
  callback: end,
  step: wrapStep
});

fadeBox.style.visibility = 'visible';
},
reuseOverlay : function(o, el) {
if (!this.last) return false;
for (var i = 0; i < this.last.overlays.length; i++) {
  var oDiv = hs.$('hsId'+ this.last.overlays[i]);
  if (oDiv && oDiv.hsId == o.hsId) {
   this.genOverlayBox();
   oDiv.reuse = this.key;
   hs.push(this.overlays, this.last.overlays[i]);
   return true;
  }
}
return false;
},


afterExpand : function() {
this.isExpanded = true; 
this.focus();

if (this.isHtml && this.objectLoadTime == 'after') this.writeExtendedContent();
if (this.iframe) {
  try {
   var exp = this,
    doc = this.iframe.contentDocument || this.iframe.contentWindow.document;
   hs.addEventListener(doc, 'mousedown', function () {
    if (hs.focusKey != exp.key) exp.focus();
   });
  } catch(e) {}
  if (hs.ie && typeof this.isClosing != 'boolean') // first open 
   this.iframe.style.width = (this.objectWidth - 1) +'px'; // hasLayout
}
if (this.dimmingOpacity) hs.dim(this);
if (hs.upcoming && hs.upcoming == this.a) hs.upcoming = null;
this.prepareNextOutline();
var p = hs.page, mX = hs.mouse.x + p.scrollLeft, mY = hs.mouse.y + p.scrollTop;
this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize')
  && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize'); 
if (this.overlayBox) this.showOverlays();
hs.fireEvent(this, 'onAfterExpand');

},


prepareNextOutline : function() {
var key = this.key;
var outlineType = this.outlineType;
new hs.Outline(outlineType, 
  function () { try { hs.expanders[key].preloadNext(); } catch (e) {} });
},


preloadNext : function() {
var next = this.getAdjacentAnchor(1);
if (next && next.onclick.toString().match(/hs\.expand/)) 
  var img = hs.createElement('img', { src: hs.getSrc(next) });
},


getAdjacentAnchor : function(op) {
var current = this.getAnchorIndex(), as = hs.anchors.groups[this.slideshowGroup || 'none'];

/*< ? if ($cfg->slideshow) : ?>s*/
if (!as[current + op] && this.slideshow && this.slideshow.repeat) {
  if (op == 1) return as[0];
  else if (op == -1) return as[as.length-1];
}
/*< ? endif ?>s*/
return as[current + op] || null;
},

getAnchorIndex : function() {
var arr = hs.getAnchors().groups[this.slideshowGroup || 'none'];
for (var i = 0; i < arr.length; i++) {
  if (arr[i] == this.a) return i; 
}
return null;
},


getNumber : function() {
if (this[this.numberPosition]) {
  var arr = hs.anchors.groups[this.slideshowGroup || 'none'];
  var s = hs.lang.number.replace('%1', this.getAnchorIndex() + 1).replace('%2', arr.length);
  this[this.numberPosition].innerHTML = 
   '<div class="highslide-number">'+ s +'</div>'+ this[this.numberPosition].innerHTML;
}
},
initSlideshow : function() {
if (!this.last) {
  for (var i = 0; i < hs.slideshows.length; i++) {
   var ss = hs.slideshows[i], sg = ss.slideshowGroup;
   if (typeof sg == 'undefined' || sg === null || sg === this.slideshowGroup) 
    this.slideshow = new hs.Slideshow(this, ss);
  } 
} else {
  this.slideshow = this.last.slideshow;
}
var ss = this.slideshow;
if (!ss) return;
var exp = ss.exp = this;

ss.checkFirstAndLast();
ss.disable('full-expand');
if (ss.controls) {
  var o = ss.overlayOptions || {};
  o.overlayId = ss.controls;
  o.hsId = 'controls';  
  this.createOverlay(o);
}
if (ss.thumbstrip) ss.thumbstrip.add(this);
if (!this.last && this.autoplay) ss.play(true);
if (ss.autoplay) {
  ss.autoplay = setTimeout(function() {
   hs.next(exp.key);
  }, (ss.interval || 500));
}
},

cancelLoading : function() { 
hs.expanders[this.key] = null;
if (hs.upcoming == this.a) hs.upcoming = null;
hs.undim(this.key);
if (this.loading) hs.loading.style.left = '-9999px';
hs.fireEvent(this, 'onHideLoading');
},

writeCredits : function () {
if (this.credits) return;
this.credits = hs.createElement('a', {
  href: hs.creditsHref,
  className: 'highslide-credits',
  innerHTML: hs.lang.creditsText,
  title: hs.lang.creditsTitle
});
this.createOverlay({ 
  overlayId: this.credits, 
  position: 'top left', 
  hsId: 'credits' 
});
},

getInline : function(types, addOverlay) {
for (var i = 0; i < types.length; i++) {
  var type = types[i], s = null;
  if (type == 'caption' && !hs.fireEvent(this, 'onBeforeGetCaption')) return;
  else if (type == 'heading' && !hs.fireEvent(this, 'onBeforeGetHeading')) return;
  if (!this[type +'Id'] && this.thumbsUserSetId)  
   this[type +'Id'] = type +'-for-'+ this.thumbsUserSetId;
  if (this[type +'Id']) this[type] = hs.getNode(this[type +'Id']);
  if (!this[type] && !this[type +'Text'] && this[type +'Eval']) try {
   s = eval(this[type +'Eval']);
  } catch (e) {}
  if (!this[type] && this[type +'Text']) {
   s = this[type +'Text'];
  }
  if (!this[type] && !s) {
   var next = this.a.nextSibling;
   while (next && !hs.isHsAnchor(next)) {
    if ((new RegExp('highslide-'+ type)).test(next.className || null)) {
     this[type] = next.cloneNode(1);
     break;
    }
    next = next.nextSibling;
   }
  }
  if (!this[type] && !s && this.numberPosition == type) s = '\n';
  
  if (!this[type] && s) this[type] = hs.createElement('div', 
    { className: 'highslide-'+ type, innerHTML: s } );
  
  if (addOverlay && this[type]) {
   var o = { position: (type == 'heading') ? 'above' : 'below' };
   for (var x in this[type+'Overlay']) o[x] = this[type+'Overlay'][x];
   o.overlayId = this[type];
   this.createOverlay(o);
  }
}
},


// on end move and resize
doShowHide : function(visibility) {
if (hs.hideSelects) this.showHideElements('SELECT', visibility);
if (hs.hideIframes) this.showHideElements('IFRAME', visibility);
if (hs.geckoMac) this.showHideElements('*', visibility);
},
showHideElements : function (tagName, visibility) {
var els = document.getElementsByTagName(tagName);
var prop = tagName == '*' ? 'overflow' : 'visibility';
for (var i = 0; i < els.length; i++) {
  if (prop == 'visibility' || (document.defaultView.getComputedStyle(
    els[i], "").getPropertyValue('overflow') == 'auto'
    || els[i].getAttribute('hidden-by') != null)) {
   var hiddenBy = els[i].getAttribute('hidden-by');
   if (visibility == 'visible' && hiddenBy) {
    hiddenBy = hiddenBy.replace('['+ this.key +']', '');
    els[i].setAttribute('hidden-by', hiddenBy);
    if (!hiddenBy) els[i].style[prop] = els[i].origProp;
   } else if (visibility == 'hidden') { // hide if behind
    var elPos = hs.getPosition(els[i]);
    elPos.w = els[i].offsetWidth;
    elPos.h = els[i].offsetHeight;
    if (!this.dimmingOpacity) { // hide all if dimming
    
     var clearsX = (elPos.x + elPos.w < this.x.get('opos') 
      || elPos.x > this.x.get('opos') + this.x.get('osize'));
     var clearsY = (elPos.y + elPos.h < this.y.get('opos') 
      || elPos.y > this.y.get('opos') + this.y.get('osize'));
    }
    var wrapperKey = hs.getWrapperKey(els[i]);
    if (!clearsX && !clearsY && wrapperKey != this.key) { // element falls behind image
     if (!hiddenBy) {
      els[i].setAttribute('hidden-by', '['+ this.key +']');
      els[i].origProp = els[i].style[prop];
      els[i].style[prop] = 'hidden';
      
     } else if (hiddenBy.indexOf('['+ this.key +']') == -1) {
      els[i].setAttribute('hidden-by', hiddenBy + '['+ this.key +']');
     }
    } else if ((hiddenBy == '['+ this.key +']' || hs.focusKey == wrapperKey)
      && wrapperKey != this.key) { // on move
     els[i].setAttribute('hidden-by', '');
     els[i].style[prop] = els[i].origProp || '';
    } else if (hiddenBy && hiddenBy.indexOf('['+ this.key +']') > -1) {
     els[i].setAttribute('hidden-by', hiddenBy.replace('['+ this.key +']', ''));
    }
      
   }
  }
}
},

focus : function() {
this.wrapper.style.zIndex = hs.zIndexCounter++;
// blur others
for (var i = 0; i < hs.expanders.length; i++) {
  if (hs.expanders[i] && i == hs.focusKey) {
   var blurExp = hs.expanders[i];
   blurExp.content.className += ' highslide-'+ blurExp.contentType +'-blur';
   if (blurExp.isImage) {
    blurExp.content.style.cursor = hs.ie ? 'hand' : 'pointer';
    blurExp.content.title = hs.lang.focusTitle; 
   } 
   hs.fireEvent(this, 'onBlur');
  }
}

// focus this
if (this.outline) this.outline.table.style.zIndex 
  = this.wrapper.style.zIndex;
this.content.className = 'highslide-'+ this.contentType;
if (this.isImage) {
  this.content.title = hs.lang.restoreTitle;
  
  if (hs.restoreCursor) {
   hs.styleRestoreCursor = window.opera ? 'pointer' : 'url('+ hs.graphicsDir + hs.restoreCursor +'), pointer';
   if (hs.ie && hs.uaVersion < 6) hs.styleRestoreCursor = 'hand';
   this.content.style.cursor = hs.styleRestoreCursor;
  }
}
hs.focusKey = this.key; 
hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 
hs.fireEvent(this, 'onFocus'); 
},
moveTo: function(x, y) {
this.x.setPos(x);
this.y.setPos(y);
},
resize : function (e) {
var w, h, r = e.width / e.height;
w = Math.max(e.width + e.dX, Math.min(this.minWidth, this.x.full));
if (this.isImage && Math.abs(w - this.x.full) < 12) w = this.x.full;
h = this.isHtml ? e.height + e.dY : w / r;
if (h < Math.min(this.minHeight, this.y.full)) {
  h = Math.min(this.minHeight, this.y.full);
  if (this.isImage) w = h * r;
}
this.resizeTo(w, h);
},
resizeTo: function(w, h) {
this.y.setSize(h);
this.x.setSize(w);
},

close : function() {
if (this.isClosing || !this.isExpanded) return;
if (this.transitions[1] == 'crossfade' && hs.upcoming) {
  hs.getExpander(hs.upcoming).cancelLoading();
  hs.upcoming = null;
}
if (!hs.fireEvent(this, 'onBeforeClose')) return;
this.isClosing = true;
if (this.slideshow && !hs.upcoming) this.slideshow.pause();

hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);

try {
  if (this.isHtml) this.htmlPrepareClose();
  this.content.style.cursor = 'default';
  this.changeSize(
   0, {
    wrapper: {
     width : this.x.t,
     height : this.y.t,
     left: this.x.tpos - this.x.cb + this.x.tb,
     top: this.y.tpos - this.y.cb + this.y.tb
    },
    content: {
     left: 0,
     top: 0,
     width: this.x.t,
     height: this.y.t
    }
   }, hs.restoreDuration
  );
} catch (e) { this.afterClose(); }
},

htmlPrepareClose : function() {
if (hs.geckoMac) { // bad redraws
  if (!hs.mask) hs.mask = hs.createElement('div', null, 
   { position: 'absolute' }, hs.container);
  hs.setStyles(hs.mask, { width: this.x.size +'px', height: this.y.size +'px', 
   left: this.x.pos +'px', top: this.y.pos +'px', display: 'block' });   
}
if (this.objectType == 'swf') try { hs.$(this.body.id).StopPlay(); } catch (e) {}

if (this.objectLoadTime == 'after' && !this.preserveContent) this.destroyObject();  
if (this.scrollerDiv && this.scrollerDiv != this.scrollingContent) 
  this.scrollerDiv.style.overflow = 'hidden';
},

destroyObject : function () {
if (hs.ie && this.iframe)
  try { this.iframe.contentWindow.document.body.innerHTML = ''; } catch (e) {}
if (this.objectType == 'swf') swfobject.removeSWF(this.body.id);
this.body.innerHTML = '';
},

sleep : function() {
if (this.outline) this.outline.table.style.display = 'none';
this.releaseMask = null;
this.wrapper.style.display = 'none';
hs.push(hs.sleeping, this);
},

awake : function() {try {

hs.expanders[this.key] = this;

if (!hs.allowMultipleInstances &&hs.focusKey != this.key) { 
  try { hs.expanders[hs.focusKey].close(); } catch (e){}
}

var z = hs.zIndexCounter++, stl = { display: '', zIndex: z };
hs.setStyles (this.wrapper, stl);
this.isClosing = false;

var o = this.outline || 0;
if (o) {
  if (!this.outlineWhileAnimating) stl.visibility = 'hidden';
  hs.setStyles (o.table, stl);  
}
if (this.slideshow) {
  this.initSlideshow();
}
  
this.show();
} catch (e) {}


},

createOverlay : function (o) {
var el = o.overlayId, 
  relToVP = (o.relativeTo == 'viewport' && !/panel$/.test(o.position));
if (typeof el == 'string') el = hs.getNode(el);
if (o.html) el = hs.createElement('div', { innerHTML: o.html });
if (!el || typeof el == 'string') return;
if (!hs.fireEvent(this, 'onCreateOverlay', { overlay: el })) return;
el.style.display = 'block';
o.hsId = o.hsId || o.overlayId; 
if (this.transitions[1] == 'crossfade' && this.reuseOverlay(o, el)) return;
this.genOverlayBox();
var width = o.width && /^[0-9]+(px|%)$/.test(o.width) ? o.width : 'auto';
if (/^(left|right)panel$/.test(o.position) && !/^[0-9]+px$/.test(o.width)) width = '200px';
var overlay = hs.createElement(
  'div', {
   id: 'hsId'+ hs.idCounter++,
   hsId: o.hsId
  }, {
   position: 'absolute',
   visibility: 'hidden',
   width: width,
   direction: hs.lang.cssDirection || '',
   opacity: 0
  },
  relToVP ? hs.viewport :this.overlayBox,
  true
);
if (relToVP) overlay.hsKey = this.key;

overlay.appendChild(el);
hs.extend(overlay, {
  opacity: 1,
  offsetX: 0,
  offsetY: 0,
  dur: (o.fade === 0 || o.fade === false || (o.fade == 2 && hs.ie)) ? 0 : 250
});
hs.extend(overlay, o);
  
if (this.gotOverlays) {
  this.positionOverlay(overlay);
  if (!overlay.hideOnMouseOut || this.mouseIsOver) 
   hs.animate(overlay, { opacity: overlay.opacity }, overlay.dur);
}
hs.push(this.overlays, hs.idCounter - 1);
},
positionOverlay : function(overlay) {
var p = overlay.position || 'middle center',
  relToVP = (overlay.relativeTo == 'viewport'),
  offX = overlay.offsetX,
  offY = overlay.offsetY;
if (relToVP) {
  hs.viewport.style.display = 'block';
  overlay.hsKey = this.key;
  if (overlay.offsetWidth > overlay.parentNode.offsetWidth)
   overlay.style.width = '100%';
} else
if (overlay.parentNode != this.overlayBox) this.overlayBox.appendChild(overlay);
if (/left$/.test(p)) overlay.style.left = offX +'px'; 

if (/center$/.test(p)) hs.setStyles (overlay, { 
  left: '50%',
  marginLeft: (offX - Math.round(overlay.offsetWidth / 2)) +'px'
}); 

if (/right$/.test(p)) overlay.style.right = - offX +'px';
  
if (/^leftpanel$/.test(p)) { 
  hs.setStyles(overlay, {
   right: '100%',
   marginRight: this.x.cb +'px',
   top: - this.y.cb +'px',
   bottom: - this.y.cb +'px',
   overflow: 'auto'
  });   
  this.x.p1 = overlay.offsetWidth;

} else if (/^rightpanel$/.test(p)) {
  hs.setStyles(overlay, {
   left: '100%',
   marginLeft: this.x.cb +'px',
   top: - this.y.cb +'px',
   bottom: - this.y.cb +'px',
   overflow: 'auto'
  });
  this.x.p2 = overlay.offsetWidth;
}
var parOff = overlay.parentNode.offsetHeight;
overlay.style.height = 'auto';
if (relToVP && overlay.offsetHeight > parOff)
  overlay.style.height = hs.ieLt7 ? parOff +'px' : '100%';

if (/^top/.test(p)) overlay.style.top = offY +'px'; 
if (/^middle/.test(p)) hs.setStyles (overlay, { 
  top: '50%', 
  marginTop: (offY - Math.round(overlay.offsetHeight / 2)) +'px'
}); 
if (/^bottom/.test(p)) overlay.style.bottom = - offY +'px';
if (/^above$/.test(p)) {
  hs.setStyles(overlay, {
   left: (- this.x.p1 - this.x.cb) +'px',
   right: (- this.x.p2 - this.x.cb) +'px',
   bottom: '100%',
   marginBottom: this.y.cb +'px',
   width: 'auto'
  });
  this.y.p1 = overlay.offsetHeight;

} else if (/^below$/.test(p)) {
  hs.setStyles(overlay, {
   position: 'relative',
   left: (- this.x.p1 - this.x.cb) +'px',
   right: (- this.x.p2 - this.x.cb) +'px',
   top: '100%',
   marginTop: this.y.cb +'px',
   width: 'auto'
  });
  this.y.p2 = overlay.offsetHeight;
  overlay.style.position = 'absolute';
}
},

getOverlays : function() { 
this.getInline(['heading', 'caption'], true);
this.getNumber();
if (this.caption) hs.fireEvent(this, 'onAfterGetCaption');
if (this.heading) hs.fireEvent(this, 'onAfterGetHeading');
if (this.heading && this.dragByHeading) this.heading.className += ' highslide-move';
if (hs.showCredits) this.writeCredits();
for (var i = 0; i < hs.overlays.length; i++) {
  var o = hs.overlays[i], tId = o.thumbnailId, sg = o.slideshowGroup;
  if ((!tId && !sg) || (tId && tId == this.thumbsUserSetId)
    || (sg && sg === this.slideshowGroup)) {
   if (this.isImage || (this.isHtml && o.useOnHtml))
   this.createOverlay(o);
  }
}
var os = [];
for (var i = 0; i < this.overlays.length; i++) {
  var o = hs.$('hsId'+ this.overlays[i]);
  if (/panel$/.test(o.position)) this.positionOverlay(o);
  else hs.push(os, o);
}
for (var i = 0; i < os.length; i++) this.positionOverlay(os[i]);
this.gotOverlays = true;
},
genOverlayBox : function() {
if (!this.overlayBox) this.overlayBox = hs.createElement (
  'div', {
   className: this.wrapperClassName
  }, {
   position : 'absolute',
   width: (this.x.size || this.x.full) +'px',
   height: (this.y.size || this.y.full) +'px',
   visibility : 'hidden',
   overflow : 'hidden',
   zIndex : hs.ie ? 4 : null
  },
  hs.container,
  true
);
},
sizeOverlayBox : function(doWrapper, doPanels) {
var overlayBox = this.overlayBox, 
  x = this.x,
  y = this.y;
hs.setStyles( overlayBox, {
  width: x.size +'px', 
  height: y.size +'px'
});
if (doWrapper || doPanels) {
  for (var i = 0; i < this.overlays.length; i++) {
   var o = hs.$('hsId'+ this.overlays[i]);
   var ie6 = (hs.ieLt7 || document.compatMode == 'BackCompat');
   if (o && /^(above|below)$/.test(o.position)) {
    if (ie6) {
     o.style.width = (overlayBox.offsetWidth + 2 * x.cb
      + x.p1 + x.p2) +'px';
    }
    y[o.position == 'above' ? 'p1' : 'p2'] = o.offsetHeight;
   }
   if (o && ie6 && /^(left|right)panel$/.test(o.position)) {
    o.style.height = (overlayBox.offsetHeight + 2* y.cb) +'px';
   }
  }
}
if (doWrapper) {
  hs.setStyles(this.content, {
   top: y.p1 +'px'
  });
  hs.setStyles(overlayBox, {
   top: (y.p1 + y.cb) +'px'
  });
}
},

showOverlays : function() {
var b = this.overlayBox;
b.className = '';
hs.setStyles(b, {
  top: (this.y.p1 + this.y.cb) +'px',
  left: (this.x.p1 + this.x.cb) +'px',
  overflow : 'visible'
});
if (hs.safari) b.style.visibility = 'visible';
this.wrapper.appendChild (b);
for (var i = 0; i < this.overlays.length; i++) {
  var o = hs.$('hsId'+ this.overlays[i]);
  o.style.zIndex = o.hsId == 'controls' ? 5 : 4;
  if (!o.hideOnMouseOut || this.mouseIsOver) {
   o.style.visibility = 'visible';
   hs.animate(o, { opacity: o.opacity }, o.dur);
  }
}
},

destroyOverlays : function() {
if (!this.overlays.length) return;
for (var i = 0; i < this.overlays.length; i++) {
  var o = hs.$('hsId'+ this.overlays[i]);
  if (o.parentNode == hs.viewport) hs.discardElement(o);
}
if (this.slideshow) {
  var c = this.slideshow.controls;
  if (c && hs.getExpander(c) == this) c.parentNode.removeChild(c);
}
if (this.isHtml && this.preserveContent) {
  this.overlayBox.style.top = '-9999px';
  hs.container.appendChild(this.overlayBox);
} else
hs.discardElement(this.overlayBox);
},



createFullExpand : function () {
if (this.slideshow && this.slideshow.controls) {
  this.slideshow.enable('full-expand');
  return;
}
this.fullExpandLabel = hs.createElement(
  'a', {
   href: 'javascript:hs.expanders['+ this.key +'].doFullExpand();',
   title: hs.lang.fullExpandTitle,
   className: 'highslide-full-expand'
  }
);
if (!hs.fireEvent(this, 'onCreateFullExpand')) return;

this.createOverlay({ 
  overlayId: this.fullExpandLabel, 
  position: hs.fullExpandPosition, 
  hideOnMouseOut: true, 
  opacity: hs.fullExpandOpacity
});
},

doFullExpand : function () {
try {
  if (!hs.fireEvent(this, 'onDoFullExpand')) return;
  if (this.fullExpandLabel) hs.discardElement(this.fullExpandLabel);
  
  this.focus();
  var xSize = this.x.size;
  this.resizeTo(this.x.full, this.y.full);
  
  var xpos = this.x.pos - (this.x.size - xSize) / 2;
  if (xpos < hs.marginLeft) xpos = hs.marginLeft;
  
  this.moveTo(xpos, this.y.pos);
  this.doShowHide('hidden');
  hs.setDimmerSize(this);

} catch (e) {
  this.error(e);
}
},


afterClose : function () {
this.a.className = this.a.className.replace('highslide-active-anchor', '');

this.doShowHide('visible'); 

if (this.isHtml && this.preserveContent
    && this.transitions[1] != 'crossfade') {
  this.sleep();
} else {
  if (this.outline && this.outlineWhileAnimating) this.outline.destroy();

  hs.discardElement(this.wrapper);
}
if (hs.mask) hs.mask.style.display = 'none';
if (!hs.viewport.childNodes.length) hs.viewport.style.display = 'none';

if (this.dimmingOpacity) hs.undim(this.key);
hs.fireEvent(this, 'onAfterClose');
hs.expanders[this.key] = null;  
hs.reOrder();
}

};


// hs.Ajax object prototype
hs.Ajax = function (a, content, pre) {
this.a = a;
this.content = content;
this.pre = pre;
};

hs.Ajax.prototype = {
run : function () {
if (!this.src) this.src = hs.getSrc(this.a);
if (this.src.match('#')) {
  var arr = this.src.split('#');
  this.src = arr[0];
  this.id = arr[1];
}
if (hs.cachedGets[this.src]) {
  this.cachedGet = hs.cachedGets[this.src];
  if (this.id) this.getElementContent();
  else this.loadHTML();
  return;
}
try { this.xmlHttp = new XMLHttpRequest(); }
catch (e) {
  try { this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) {
   try { this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }
   catch (e) { this.onError(); }
  }
}
var pThis = this; 
this.xmlHttp.onreadystatechange = function() {
  if(pThis.xmlHttp.readyState == 4) {
   if (pThis.id) pThis.getElementContent();
   else pThis.loadHTML();
  }
};
this.xmlHttp.open("GET", this.src+ '?dummy='+ (new Date()).getTime(), true);
this.xmlHttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
this.xmlHttp.send(null);
},

getElementContent : function() {
hs.init();
var attribs = window.opera || hs.ie6SSL ? { src: 'about:blank' } : null;

this.iframe = hs.createElement('iframe', attribs, 
  { position: 'absolute', top: '-9999px' }, hs.container);
  
this.loadHTML();
},

loadHTML : function() {
var s = this.cachedGet || this.xmlHttp.responseText;
if (this.pre) hs.cachedGets[this.src] = s;
if (!hs.ie || hs.uaVersion >= 5.5) {
  s = s.replace(/\s/g, ' ').replace(
   new RegExp('<link[^>]*>', 'gi'), '').replace(
   new RegExp('<script[^>]*>.*?</script>', 'gi'), '');

  if (this.iframe) {
   var doc = this.iframe.contentDocument;
   if (!doc && this.iframe.contentWindow) doc = this.iframe.contentWindow.document;
   if (!doc) { // Opera
    var pThis = this;
    setTimeout(function() { pThis.loadHTML(); }, 25);
    return;
   }
   doc.open();
   doc.write(s);
   doc.close();
   try { s = doc.getElementById(this.id).innerHTML; } catch (e) {
    try { s = this.iframe.document.getElementById(this.id).innerHTML; } catch (e) {} // opera
   }
  } else {
   s = s.replace(new RegExp('^.*?<body[^>]*>(.*?)</body>.*?$', 'i'), '$1');
  }
}
hs.getElementByClass(this.content, 'DIV', 'highslide-body').innerHTML = s;
this.onLoad();
for (var x in this) this[x] = null;
}
};


hs.Slideshow = function (exp, options) {
if (hs.dynamicallyUpdateAnchors !== false) hs.updateAnchors();
this.exp = exp;
for (var x in options) this[x] = options[x];
if (this.useControls) this.getControls();
if (this.thumbstrip) this.thumbstrip = hs.Thumbstrip(this);
};
hs.Slideshow.prototype = {
getControls: function() {
this.controls = hs.createElement('div', { innerHTML: hs.replaceLang(hs.skin.controls) }, 
  null, hs.container);

var buttons = ['play', 'pause', 'previous', 'next', 'move', 'full-expand', 'close'];
this.btn = {};
var pThis = this;
for (var i = 0; i < buttons.length; i++) {
  this.btn[buttons[i]] = hs.getElementByClass(this.controls, 'li', 'highslide-'+ buttons[i]);
  this.enable(buttons[i]);
}
this.btn.pause.style.display = 'none';
//this.disable('full-expand');
},
checkFirstAndLast: function() {
if (this.repeat || !this.controls) return;
var cur = this.exp.getAnchorIndex(), re = /disabled$/;
if (cur == 0) 
  this.disable('previous');
else if (re.test(this.btn.previous.getElementsByTagName('a')[0].className))
  this.enable('previous');
if (cur + 1 == hs.anchors.groups[this.exp.slideshowGroup || 'none'].length) {
  this.disable('next');
  this.disable('play');
} else if (re.test(this.btn.next.getElementsByTagName('a')[0].className)) {
  this.enable('next');
  this.enable('play');
}
},
enable: function(btn) {
if (!this.btn) return;
var sls = this, a = this.btn[btn].getElementsByTagName('a')[0], re = /disabled$/;
a.onclick = function() {
  sls[btn]();
  return false;
};
if (re.test(a.className)) a.className = a.className.replace(re, '');
},
disable: function(btn) {
if (!this.btn) return;
var a = this.btn[btn].getElementsByTagName('a')[0];
a.onclick = function() { return false; };
if (!/disabled$/.test(a.className)) a.className += ' disabled';
},
hitSpace: function() {
if (this.autoplay) this.pause();
else this.play();
},
play: function(wait) {
if (this.btn) {
  this.btn.play.style.display = 'none';
  this.btn.pause.style.display = '';
}

this.autoplay = true; 
if (!wait) hs.next(this.exp.key);
},
pause: function() {
if (this.btn) {
  this.btn.pause.style.display = 'none';
  this.btn.play.style.display = '';
}

clearTimeout(this.autoplay);
this.autoplay = null;
},
previous: function() {
this.pause();
hs.previous(this.btn.previous);
},
next: function() {
this.pause();
hs.next(this.btn.next);
},
move: function() {},
'full-expand': function() {
hs.getExpander().doFullExpand();
},
close: function() {
hs.close(this.btn.close);
}

};
hs.Thumbstrip = function(slideshow) {
function add (exp) {
  hs.extend(options || {}, {
   overlayId: dom,
   hsId: 'thumbstrip'
  });
  if (hs.ieLt7) options.fade = 0;
  exp.createOverlay(options);
  hs.setStyles(dom.parentNode, { overflow: 'hidden' });
};

function scroll (delta) { 
  selectThumb(undefined, Math.round(delta * dom[isX ? 'offsetWidth' : 'offsetHeight'] * 0.7));
};

function selectThumb (i, scrollBy) {
  if (i === undefined) for (var j = 0; j < group.length; j++) {
   if (group[j] == slideshow.exp.a) {
    i = j;
    break;
   }
  }
  var as = dom.getElementsByTagName('a'),
   active = as[i],
   cell = active.parentNode,
   left = isX ? 'Left' : 'Top',
   right = isX ? 'Right' : 'Bottom',
   width = isX ? 'Width' : 'Height',
   offsetLeft = 'offset' + left,
   offsetWidth = 'offset' + width,
   minTblPos = div.parentNode.parentNode[offsetWidth] - table[offsetWidth],
   curTblPos = parseInt(table.style[isX ? 'left' : 'top']) || 0,
   tblPos = curTblPos,
   mgnRight = 20;
  if (scrollBy !== undefined) {
   tblPos = curTblPos - scrollBy;
   if (tblPos > 0) tblPos = 0;
   if (tblPos < minTblPos) tblPos = minTblPos;

  } else {
   for (var j = 0; j < as.length; j++) as[j].className = '';
   active.className = 'highslide-active-anchor';
   var activeLeft = i > 0 ? as[i - 1].parentNode[offsetLeft] : cell[offsetLeft],
    activeRight = cell[offsetLeft] + cell[offsetWidth] + 
     (as[i + 1] ? as[i + 1].parentNode[offsetWidth] : 0);
   if (activeRight > div[offsetWidth] - curTblPos) tblPos = div[offsetWidth] - activeRight;
   else if (activeLeft < -curTblPos) tblPos = -activeLeft;
  }
  var markerPos = cell[offsetLeft] + (cell[offsetWidth] - marker[offsetWidth]) / 2 + tblPos;
  hs.animate(table, isX ? { left: tblPos } : { top: tblPos }, null, 'easeOutQuad');
  hs.animate(marker, isX ? { left: markerPos } : { top: markerPos }, null, 'easeOutQuad');
  scrollUp.style.display = tblPos < 0 ? 'block' : 'none';
  scrollDown.style.display = (tblPos > minTblPos)  ? 'block' : 'none';
};


// initialize
var group = hs.anchors.groups[slideshow.exp.slideshowGroup || 'none'],
  options = slideshow.thumbstrip,
  mode = options.mode || 'horizontal',
  floatMode = (mode == 'float'),
  tree = floatMode ? ['div', 'ul', 'li', 'span'] : ['table', 'tbody', 'tr', 'td'],
  isX = (mode == 'horizontal'),
  dom = hs.createElement('div', {
    className: 'highslide-thumbstrip highslide-thumbstrip-'+ mode,
    innerHTML:
     '<div class="highslide-thumbstrip-inner">'+
     '<'+ tree[0] +'><'+ tree[1] +'></'+ tree[1] +'></'+ tree[0] +'></div>'+
     '<div class="highslide-scroll-up"><div></div></div>'+
     '<div class="highslide-scroll-down"><div></div></div>'+
     '<div class="highslide-marker"><div></div></div>'
   }, {
    display: 'none'
   }, hs.container),
  domCh = dom.childNodes,
  div = domCh[0],
  scrollUp = domCh[1],
  scrollDown = domCh[2],
  marker = domCh[3],
  table = div.firstChild,
  tbody = dom.getElementsByTagName(tree[1])[0],
  tr;
for (var i = 0; i < group.length; i++) {
  if (i == 0 || !isX) tr = hs.createElement(tree[2], null, null, tbody);
  (function(){
   var a = group[i],
    cell = hs.createElement(tree[3], null, null, tr),
    pI = i;
   hs.createElement('a', {
    href: a.href,
    onclick: function() {
     return hs.transit(a);
    },
    innerHTML: hs.stripItemFormatter ? hs.stripItemFormatter(a) : a.innerHTML
   }, null, cell);
  })();
}

if (!floatMode) {
  scrollUp.onclick = function () { scroll(-1); };
  scrollDown.onclick = function() { scroll(1); };
  hs.addEventListener(tbody, document.onmousewheel !== undefined ? 
    'mousewheel' : 'DOMMouseScroll', function(e) {        
   var delta = 0;
         e = e || window.event;
         if (e.wheelDelta) {
    delta = e.wheelDelta/120;
    if (hs.opera) delta = -delta;
         } else if (e.detail) {
    delta = -e.detail/3;
         }
         if (delta) scroll(-delta * 0.2);
         if (e.preventDefault) e.preventDefault();
   e.returnValue = false;
  });
}

return {
  add: add,
  selectThumb: selectThumb
}
};
if (document.readyState && hs.ie) {
(function () {
  try {
   document.documentElement.doScroll('left');
  } catch (e) {
   setTimeout(arguments.callee, 50);
   return;
  }
  hs.domReady();
})();
}
hs.langDefaults = hs.lang;
// history
var HsExpander = hs.Expander;

// set handlers
hs.addEventListener(window, 'load', function() {
if (hs.expandCursor) {
  var sel = '.highslide img', 
   dec = 'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), pointer !important;';
   
  var style = hs.createElement('style', { type: 'text/css' }, null, 
   document.getElementsByTagName('HEAD')[0]);

  if (!hs.ie) {
   style.appendChild(document.createTextNode(sel + " {" + dec + "}"));
  } else {
   var last = document.styleSheets[document.styleSheets.length - 1];
   if (typeof(last.addRule) == "object") last.addRule(sel, dec);
  }
}
});
hs.addEventListener(window, 'resize', function() {
hs.page = hs.getPageSize();
if (hs.viewport) for (var i = 0; i < hs.viewport.childNodes.length; i++) {
  var node = hs.viewport.childNodes[i],
   exp = hs.getExpander(node);
  exp.positionOverlay(node);
  if (node.hsId == 'thumbstrip') exp.slideshow.thumbstrip.selectThumb();
}
});
hs.addEventListener(document, 'mousemove', function(e) {
hs.mouse = { x: e.clientX, y: e.clientY };
});
hs.addEventListener(document, 'mousedown', hs.mouseClickHandler);
hs.addEventListener(document, 'mouseup', hs.mouseClickHandler);
hs.addEventListener(window, 'load', hs.preloadImages);
hs.addEventListener(window, 'load', hs.preloadAjax);
hs.addEventListener(window, 'load', function() { hs.pageLoaded = true; });
hs.setClickEvents();

jQuery(document).ready(function(){
  
  // local scroll
  $.localScroll({
    duration: 400,
    hash: true
  });
  
  makeGlosses();
  $.favicons();
  
  $('a.media').media( { width: 300, height: 20 } );
});

/* Zeilenumbrüche in pre-Elementen durch span.br ersetzen (Debugging) */
$('pre br').after('<span class="br"></span>').remove();
