/*!
 * jQuery JavaScript Library v1.4.4
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Thu Nov 11 19:04:53 2010 -0500
 */
(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h=
h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;k<J.length;k++){h=J[k];h.origType.replace(X,"")===a.type?f.push(h.selector):J.splice(k--,1)}f=c(a.target).closest(f,a.currentTarget);o=0;for(x=f.length;o<x;o++){r=f[o];for(k=0;k<J.length;k++){h=J[k];if(r.selector===h.selector&&(!A||A.test(h.namespace))){l=r.elem;e=null;if(h.preType==="mouseenter"||
h.preType==="mouseleave"){a.type=h.preType;e=c(a.relatedTarget).closest(h.selector)[0]}if(!e||e!==l)C.push({elem:l,handleObj:h,level:r.level})}}}o=0;for(x=C.length;o<x;o++){f=C[o];if(d&&f.level>d)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La,
"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,
e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,
"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+
a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,
C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j,
s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,
j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length},
toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j===
-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false;
if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K<Q;K++)if((j=arguments[K])!=null)for(s in j){v=G[s];z=j[s];if(G!==z)if(ga&&z&&(b.isPlainObject(z)||(H=b.isArray(z)))){if(H){H=false;v=v&&b.isArray(v)?v:[]}else v=v&&b.isPlainObject(v)?v:{};G[s]=b.extend(ga,v,z)}else if(z!==B)G[s]=z}return G};b.extend({noConflict:function(j){E.$=e;if(j)E.jQuery=d;return b},isReady:false,readyWait:1,ready:function(j){j===true&&b.readyWait--;
if(!b.readyWait||j!==true&&!b.isReady){if(!t.body)return setTimeout(b.ready,1);b.isReady=true;if(!(j!==true&&--b.readyWait>0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload",
b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&&
!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&
l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H<G;){if(s.apply(j[H++],v)===false)break}else if(K)for(z in j){if(s.call(j[z],
z,j[z])===false)break}else for(v=j[0];H<G&&s.call(v,H,v)!==false;v=j[++H]);return j},trim:O?function(j){return j==null?"":O.call(j)}:function(j){return j==null?"":j.toString().replace(k,"").replace(o,"")},makeArray:function(j,s){var v=s||[];if(j!=null){var z=b.type(j);j.length==null||z==="string"||z==="function"||z==="regexp"||b.isWindow(j)?M.call(v,j):b.merge(v,j)}return v},inArray:function(j,s){if(s.indexOf)return s.indexOf(j);for(var v=0,z=s.length;v<z;v++)if(s[v]===j)return v;return-1},merge:function(j,
s){var v=j.length,z=0;if(typeof s.length==="number")for(var H=s.length;z<H;z++)j[v++]=s[z];else for(;s[z]!==B;)j[v++]=s[z++];j.length=v;return j},grep:function(j,s,v){var z=[],H;v=!!v;for(var G=0,K=j.length;G<K;G++){H=!!s(j[G],G);v!==H&&z.push(j[G])}return z},map:function(j,s,v){for(var z=[],H,G=0,K=j.length;G<K;G++){H=s(j[G],G,v);if(H!=null)z[z.length]=H}return z.concat.apply([],z)},guid:1,proxy:function(j,s,v){if(arguments.length===2)if(typeof s==="string"){v=j;j=v[s];s=B}else if(s&&!b.isFunction(s)){v=
s;s=B}if(!s&&j)s=function(){return j.apply(v||this,arguments)};if(j)s.guid=j.guid=j.guid||s.guid||b.guid++;return s},access:function(j,s,v,z,H,G){var K=j.length;if(typeof s==="object"){for(var Q in s)b.access(j,Q,s[Q],z,H,v);return j}if(v!==B){z=!G&&z&&b.isFunction(v);for(Q=0;Q<K;Q++)H(j[Q],s,z?v.call(j[Q],Q,H(j[Q],s)):v,G);return j}return K?H(j[0],s):B},now:function(){return(new Date).getTime()},uaMatch:function(j){j=j.toLowerCase();j=L.exec(j)||g.exec(j)||i.exec(j)||j.indexOf("compatible")<0&&n.exec(j)||
[];return{browser:j[1]||"",version:j[2]||"0"}},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(j,s){R["[object "+s+"]"]=s.toLowerCase()});m=b.uaMatch(m);if(m.browser){b.browser[m.browser]=true;b.browser.version=m.version}if(b.browser.webkit)b.browser.safari=true;if(D)b.inArray=function(j,s){return D.call(s,j)};if(!/\s/.test("\u00a0")){k=/^[\s\xA0]+/;o=/[\s\xA0]+$/}f=b(t);if(t.addEventListener)u=function(){t.removeEventListener("DOMContentLoaded",u,
false);b.ready()};else if(t.attachEvent)u=function(){if(t.readyState==="complete"){t.detachEvent("onreadystatechange",u);b.ready()}};return E.jQuery=E.$=b}();(function(){c.support={};var a=t.documentElement,b=t.createElement("script"),d=t.createElement("div"),e="script"+c.now();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"),
k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false,
scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent=
false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom=
1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="<div style='width:4px;'></div>";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display=
"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h=
c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);
else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h<l;h++){f=e[h].name;if(f.indexOf("data-")===0){f=f.substr(5);ka(this[0],f,d[f])}}}return d}else if(typeof a==="object")return this.each(function(){c.data(this,
a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(b===B){d=this.triggerHandler("getData"+k[1]+"!",[k[0]]);if(d===B&&this.length){d=c.data(this[0],a);d=ka(this[0],a,d)}return d===B&&k[1]?this.data(k[0]):d}else return this.each(function(){var o=c(this),x=[k[0],b];o.triggerHandler("setData"+k[1]+"!",x);c.data(this,a,b);o.triggerHandler("changeData"+k[1]+"!",x)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=
c.data(a,b);if(!d)return e||[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===B)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,
a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var sa=/[\n\t]/g,ha=/\s+/,Sa=/\r/g,Ta=/^(?:href|src|style)$/,Ua=/^(?:button|input)$/i,Va=/^(?:button|input|object|select|textarea)$/i,Wa=/^a(?:rea)?$/i,ta=/^(?:radio|checkbox)$/i;c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",
colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(x){var r=c(this);r.addClass(a.call(this,x,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===
1)if(f.className){for(var h=" "+f.className+" ",l=f.className,k=0,o=b.length;k<o;k++)if(h.indexOf(" "+b[k]+" ")<0)l+=" "+b[k];f.className=c.trim(l)}else f.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(o){var x=c(this);x.removeClass(a.call(this,o,x.attr("class")))});if(a&&typeof a==="string"||a===B)for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1&&f.className)if(a){for(var h=(" "+f.className+" ").replace(sa," "),
l=0,k=b.length;l<k;l++)h=h.replace(" "+b[l]+" "," ");f.className=c.trim(h)}else f.className=""}return this},toggleClass:function(a,b){var d=typeof a,e=typeof b==="boolean";if(c.isFunction(a))return this.each(function(f){var h=c(this);h.toggleClass(a.call(this,f,h.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var f,h=0,l=c(this),k=b,o=a.split(ha);f=o[h++];){k=e?k:!l.hasClass(f);l[k?"addClass":"removeClass"](f)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,
"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(sa," ").indexOf(a)>-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";
if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h<e;h++){var l=f[h];if(l.selected&&(c.support.optDisabled?!l.disabled:l.getAttribute("disabled")===null)&&(!l.parentNode.disabled||!c.nodeName(l.parentNode,"optgroup"))){a=c(l).val();if(b)return a;d.push(a)}}return d}if(ta.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Sa,"")}return B}var k=c.isFunction(a);return this.each(function(o){var x=c(this),r=a;if(this.nodeType===1){if(k)r=
a.call(this,o,x.val());if(r==null)r="";else if(typeof r==="number")r+="";else if(c.isArray(r))r=c.map(r,function(C){return C==null?"":C+""});if(c.isArray(r)&&ta.test(this.type))this.checked=c.inArray(x.val(),r)>=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},
attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&
b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0};
c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,
arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid=
d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+
c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h<A.length;h++){C=A[h];if(d.guid===C.guid){if(k||x.test(C.namespace)){e==null&&A.splice(h--,1);r.remove&&r.remove.call(a,C)}if(e!=null)break}}if(A.length===0||e!=null&&A.length===1){if(!r.teardown||r.teardown.call(a,o)===false)c.removeEvent(a,f,w.handle);delete I[f]}}else for(h=0;h<A.length;h++){C=A[h];if(k||x.test(C.namespace)){c.event.remove(a,r,C.handler,h);A.splice(h--,1)}}}if(c.isEmptyObject(I)){if(b=
w.handle)b.elem=null;delete w.events;delete w.handle;if(typeof w==="function")c.removeData(a,J);else c.isEmptyObject(w)&&c.removeData(a)}}}}},trigger:function(a,b,d,e){var f=a.type||a;if(!e){a=typeof a==="object"?a[c.expando]?a:c.extend(c.Event(f),a):c.Event(f);if(f.indexOf("!")>=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===
8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k===
"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+
d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f<l;f++){var k=d[f];if(b||e.test(k.namespace)){a.handler=k.handler;a.data=k.data;a.handleObj=k;k=k.handler.apply(this,h);if(k!==B){a.result=k;if(k===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix:function(a){if(a[c.expando])return a;var b=a;a=c.Event(b);for(var d=this.props.length,e;d;){e=this.props[--d];a[e]=b[e]}if(!a.target)a.target=a.srcElement||t;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=t.documentElement;d=t.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==B)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,Y(a.origType,a.selector),c.extend({},a,{handler:Ka,guid:a.handler.guid}))},remove:function(a){c.event.remove(this,
Y(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,d){if(c.isWindow(this))this.onbeforeunload=d},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.removeEvent=t.removeEventListener?function(a,b,d){a.removeEventListener&&a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent&&a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=
c.now();this[c.expando]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=ca;var a=this.originalEvent;if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=ca;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ca;this.stopPropagation()},isDefaultPrevented:U,isPropagationStopped:U,isImmediatePropagationStopped:U};
var va=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},wa=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?wa:va,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?wa:va)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!==
"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=B;return la("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=B;return la("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var V,
xa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired=
B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type===
"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]===
0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h<k;h++)c.event.add(this[h],d,l,e)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var d in a)this.unbind(d,
a[d]);else{d=0;for(var e=this.length;d<e;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,e){return this.live(b,d,e,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var d=c.Event(a);d.preventDefault();d.stopPropagation();c.event.trigger(d,b,this[0]);return d.result}},toggle:function(a){for(var b=arguments,d=
1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(e){var f=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,f+1);e.preventDefault();return b[f].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var ya={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,e,f,h){var l,k=0,o,x,r=h||this.selector;h=h?this:c(this.context);if(typeof d===
"object"&&!d.preventDefault){for(l in d)h[b](l,e,d[l],r);return this}if(c.isFunction(e)){f=e;e=B}for(d=(d||"").split(" ");(l=d[k++])!=null;){o=X.exec(l);x="";if(o){x=o[0];l=l.replace(X,"")}if(l==="hover")d.push("mouseenter"+x,"mouseleave"+x);else{o=l;if(l==="focus"||l==="blur"){d.push(ya[l]+x);l+=x}else l=(ya[l]||l)+x;if(b==="live"){x=0;for(var A=h.length;x<A;x++)c.event.add(h[x],"live."+Y(l,r),{data:e,selector:r,handler:f,origType:l,origHandler:f,preType:o})}else h.unbind("live."+Y(l,r),f)}}return this}});
c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d,e){if(e==null){e=d;d=null}return arguments.length>0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1&&!q){y.sizcache=n;y.sizset=p}if(y.nodeName.toLowerCase()===i){F=y;break}y=y[g]}m[p]=F}}}function b(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1){if(!q){y.sizcache=n;y.sizset=p}if(typeof i!=="string"){if(y===i){F=true;break}}else if(k.filter(i,
[y]).length>0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3];
break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr,
q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h=
l;g.sort(w);if(h)for(var i=1;i<g.length;i++)g[i]===g[i-1]&&g.splice(i--,1)}return g};k.matches=function(g,i){return k(g,null,null,i)};k.matchesSelector=function(g,i){return k(i,null,null,[g]).length>0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p<q;p++){var u,y=o.order[p];if(u=o.leftMatch[y].exec(g)){var F=u[1];u.splice(1,1);if(F.substr(F.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");m=o.find[y](u,i,n);if(m!=null){g=g.replace(o.match[y],"");break}}}}m||(m=i.getElementsByTagName("*"));
return{set:m,expr:g}};k.filter=function(g,i,n,m){for(var p,q,u=g,y=[],F=i,M=i&&i[0]&&k.isXML(i[0]);g&&i.length;){for(var N in o.filter)if((p=o.leftMatch[N].exec(g))!=null&&p[2]){var O,D,R=o.filter[N];D=p[1];q=false;p.splice(1,1);if(D.substr(D.length-1)!=="\\"){if(F===y)y=[];if(o.preFilter[N])if(p=o.preFilter[N](p,F,n,y,m,M)){if(p===true)continue}else q=O=true;if(p)for(var j=0;(D=F[j])!=null;j++)if(D){O=R(D,p,j,F);var s=m^!!O;if(n&&O!=null)if(s)q=true;else F[j]=false;else if(s){y.push(D);q=true}}if(O!==
B){n||(F=y);g=g.replace(o.match[N],"");if(!q)return[];break}}}if(g===u)if(q==null)k.error(g);else break;u=g}return F};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var o=k.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\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,i){var n=typeof i==="string",m=n&&!/\W/.test(i);n=n&&!m;if(m)i=i.toLowerCase();m=0;for(var p=g.length,q;m<p;m++)if(q=g[m]){for(;(q=q.previousSibling)&&q.nodeType!==1;);g[m]=n||q&&q.nodeName.toLowerCase()===
i?q||false:q===i}n&&k.filter(i,g,true)},">":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p<q;p++){if(n=g[p]){n=n.parentNode;g[p]=n.nodeName.toLowerCase()===i?n:false}}else{for(;p<q;p++)if(n=g[p])g[p]=m?n.parentNode:n.parentNode===i;m&&k.filter(i,g,true)}},"":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m=i=i.toLowerCase();q=a}q("parentNode",i,p,g,m,n)},"~":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m=
i=i.toLowerCase();q=a}q("previousSibling",i,p,g,m,n)}},find:{ID:function(g,i,n){if(typeof i.getElementById!=="undefined"&&!n)return(g=i.getElementById(g[1]))&&g.parentNode?[g]:[]},NAME:function(g,i){if(typeof i.getElementsByName!=="undefined"){for(var n=[],m=i.getElementsByName(g[1]),p=0,q=m.length;p<q;p++)m[p].getAttribute("name")===g[1]&&n.push(m[p]);return n.length===0?null:n}},TAG:function(g,i){return i.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,i,n,m,p,q){g=" "+g[1].replace(/\\/g,
"")+" ";if(q)return g;q=0;for(var u;(u=i[q])!=null;q++)if(u)if(p^(u.className&&(" "+u.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n,
m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===
true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===
g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return i<n[3]-0},gt:function(g,i,n){return i>n[3]-0},nth:function(g,i,n){return n[3]-
0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n<m;n++)if(i[n]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+p)},CHILD:function(g,i){var n=i[1],m=g;switch(n){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(n===
"first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":n=i[2];var p=i[3];if(n===1&&p===0)return true;var q=i[0],u=g.parentNode;if(u&&(u.sizcache!==q||!g.nodeIndex)){var y=0;for(m=u.firstChild;m;m=m.nextSibling)if(m.nodeType===1)m.nodeIndex=++y;u.sizcache=q}m=g.nodeIndex-p;return n===0?m===0:m%n===0&&m/n>=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===
i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]];
if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m,
g);else if(typeof g.length==="number")for(var p=g.length;n<p;n++)m.push(g[n]);else for(;g[n];n++)m.push(g[n]);return m}}var w,I;if(t.documentElement.compareDocumentPosition)w=function(g,i){if(g===i){h=true;return 0}if(!g.compareDocumentPosition||!i.compareDocumentPosition)return g.compareDocumentPosition?-1:1;return g.compareDocumentPosition(i)&4?-1:1};else{w=function(g,i){var n,m,p=[],q=[];n=g.parentNode;m=i.parentNode;var u=n;if(g===i){h=true;return 0}else if(n===m)return I(g,i);else if(n){if(!m)return 1}else return-1;
for(;u;){p.unshift(u);u=u.parentNode}for(u=m;u;){q.unshift(u);u=u.parentNode}n=p.length;m=q.length;for(u=0;u<n&&u<m;u++)if(p[u]!==q[u])return I(p[u],q[u]);return u===n?I(g,q[u],-1):I(p[u],i,1)};I=function(g,i,n){if(g===i)return n;for(g=g.nextSibling;g;){if(g===i)return-1;g=g.nextSibling}return 1}}k.getText=function(g){for(var i="",n,m=0;g[m];m++){n=g[m];if(n.nodeType===3||n.nodeType===4)i+=n.nodeValue;else if(n.nodeType!==8)i+=k.getText(n.childNodes)}return i};(function(){var g=t.createElement("div"),
i="script"+(new Date).getTime(),n=t.documentElement;g.innerHTML="<a name='"+i+"'/>";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g);
n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&&
function(){var g=k,i=t.createElement("div");i.innerHTML="<p class='TEST'></p>";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F||
p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g=
t.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition?
function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n<u;n++)k(g,q[n],m);return k.filter(p,m)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=k.getText;c.isXMLDoc=k.isXML;
c.contains=k.contains})();var Za=/Until$/,$a=/^(?:parents|prevUntil|prevAll)/,ab=/,/,Na=/^.[^:#\[\.,]*$/,bb=Array.prototype.slice,cb=c.expr.match.POS;c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,e=0,f=this.length;e<f;e++){d=b.length;c.find(a,this[e],b);if(e>0)for(var h=d;h<b.length;h++)for(var l=0;l<d;l++)if(b[l]===b[h]){b.splice(h--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,e=b.length;d<e;d++)if(c.contains(this,b[d]))return true})},
not:function(a){return this.pushStack(ma(this,a,false),"not",a)},filter:function(a){return this.pushStack(ma(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e<f;e++){l=a[e];k[l]||(k[l]=c.expr.match.POS.test(l)?c(l,b||this.context):l)}for(;h&&h.ownerDocument&&h!==b;){for(l in k){e=k[l];if(e.jquery?e.index(h)>-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h=
h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e<f;e++)for(h=this[e];h;)if(l?l.index(h)>-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):
c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,
2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,
b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&
e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/<tbody/i,eb=/<|&#?\w+;/,Ca=/<(?:script|object|embed|option|style)/i,Da=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/\=([^="'>\s]+\/)>/g,P={option:[1,
"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null;
else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1></$2>");try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(e){this.empty().append(a)}}else c.isFunction(a)?this.each(function(f){var h=c(this);h.html(a.call(this,f,h.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=
c(this),e=d.html();d.replaceWith(a.call(this,b,e))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){var e,f,h,l=a[0],k=[];if(!c.support.checkClone&&arguments.length===3&&typeof l==="string"&&Da.test(l))return this.each(function(){c(this).domManip(a,
b,d,true)});if(c.isFunction(l))return this.each(function(x){var r=c(this);a[0]=l.call(this,x,b?r.html():B);r.domManip(a,b,d)});if(this[0]){e=l&&l.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:c.buildFragment(a,this,k);h=e.fragment;if(f=h.childNodes.length===1?h=h.firstChild:h.firstChild){b=b&&c.nodeName(f,"tr");f=0;for(var o=this.length;f<o;f++)d.call(b?c.nodeName(this[f],"table")?this[f].getElementsByTagName("tbody")[0]||this[f].appendChild(this[f].ownerDocument.createElement("tbody")):
this[f]:this[f],f>0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",
prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f<h;f++){var l=(f>0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument||
b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1></$2>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]==="<table>"&&!x?r.childNodes:[];for(o=k.length-
1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));
d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i,
jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,
zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),
h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b);
if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f=
d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left;
e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b===
"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("<div>").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&
!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})},
getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",
script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data||
!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache=
false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset;
A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type",
b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&&
c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d||
c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]=
encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",
[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),
e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});
if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show",
3),a,b,d);else{d=0;for(var e=this.length;d<e;d++){a=this[d];b=a.style.display;if(!c.data(a,"olddisplay")&&b==="none")b=a.style.display="";b===""&&c.css(a,"display")==="none"&&c.data(a,"olddisplay",qa(a.nodeName))}for(d=0;d<e;d++){a=this[d];b=a.style.display;if(b===""||b==="none")a.style.display=c.data(a,"olddisplay")||""}return this}},hide:function(a,b,d){if(a||a===0)return this.animate(S("hide",3),a,b,d);else{a=0;for(b=this.length;a<b;a++){d=c.css(this[a],"display");d!=="none"&&c.data(this[a],"olddisplay",
d)}for(a=0;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b,d){var e=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||e?this.each(function(){var f=e?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(S("toggle",3),a,b,d);return this},fadeTo:function(a,b,d,e){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d,e)},animate:function(a,b,d,e){var f=c.speed(b,
d,e);if(c.isEmptyObject(a))return this.each(f.complete);return this[f.queue===false?"each":"queue"](function(){var h=c.extend({},f),l,k=this.nodeType===1,o=k&&c(this).is(":hidden"),x=this;for(l in a){var r=c.camelCase(l);if(l!==r){a[r]=a[l];delete a[l];l=r}if(a[l]==="hide"&&o||a[l]==="show"&&!o)return h.complete.call(this);if(k&&(l==="height"||l==="width")){h.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(c.css(this,"display")==="inline"&&c.css(this,"float")==="none")if(c.support.inlineBlockNeedsLayout)if(qa(this.nodeName)===
"inline")this.style.display="inline-block";else{this.style.display="inline";this.style.zoom=1}else this.style.display="inline-block"}if(c.isArray(a[l])){(h.specialEasing=h.specialEasing||{})[l]=a[l][1];a[l]=a[l][0]}}if(h.overflow!=null)this.style.overflow="hidden";h.curAnim=c.extend({},a);c.each(a,function(A,C){var J=new c.fx(x,h,A);if(vb.test(C))J[C==="toggle"?o?"show":"hide":C](a);else{var w=wb.exec(C),I=J.cur()||0;if(w){var L=parseFloat(w[2]),g=w[3]||"px";if(g!=="px"){c.style(x,A,(L||1)+g);I=(L||
1)/J.cur()*I;c.style(x,A,I+g)}if(w[1])L=(w[1]==="-="?-1:1)*L+I;J.custom(I,L,g)}else J.custom(I,C,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var e=d.length-1;e>=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b,
d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a*
Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)}
var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;
this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide||
this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=
c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(ba);ba=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===
b.elem}).length};var xb=/^t(?:able|d|h)$/i,Ia=/^(?:body|html)$/i;c.fn.offset="getBoundingClientRect"in t.documentElement?function(a){var b=this[0],d;if(a)return this.each(function(l){c.offset.setOffset(this,a,l)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,h=f.documentElement;if(!d||!c.contains(h,b))return d||{top:0,left:0};b=f.body;f=fa(f);return{top:d.top+(f.pageYOffset||c.support.boxModel&&
h.scrollTop||b.scrollTop)-(h.clientTop||b.clientTop||0),left:d.left+(f.pageXOffset||c.support.boxModel&&h.scrollLeft||b.scrollLeft)-(h.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(x){c.offset.setOffset(this,a,x)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d,e=b.offsetParent,f=b.ownerDocument,h=f.documentElement,l=f.body;d=(f=f.defaultView)?f.getComputedStyle(b,null):b.currentStyle;
for(var k=b.offsetTop,o=b.offsetLeft;(b=b.parentNode)&&b!==l&&b!==h;){if(c.offset.supportsFixedPosition&&d.position==="fixed")break;d=f?f.getComputedStyle(b,null):b.currentStyle;k-=b.scrollTop;o-=b.scrollLeft;if(b===e){k+=b.offsetTop;o+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&xb.test(b.nodeName))){k+=parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}e=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"){k+=
parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}d=d}if(d.position==="relative"||d.position==="static"){k+=l.offsetTop;o+=l.offsetLeft}if(c.offset.supportsFixedPosition&&d.position==="fixed"){k+=Math.max(h.scrollTop,l.scrollTop);o+=Math.max(h.scrollLeft,l.scrollLeft)}return{top:k,left:o}};c.offset={initialize:function(){var a=t.body,b=t.createElement("div"),d,e,f,h=parseFloat(c.css(a,"marginTop"))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",
height:"1px",visibility:"hidden"});b.innerHTML="<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>";a.insertBefore(b,a.firstChild);d=b.firstChild;e=d.firstChild;f=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells=
f.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==h;a.removeChild(b);c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.css(a,
"marginTop"))||0;d+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");if(e==="static")a.style.position="relative";var f=c(a),h=f.offset(),l=c.css(a,"top"),k=c.css(a,"left"),o=e==="absolute"&&c.inArray("auto",[l,k])>-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a,
e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&&
c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();
c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+
b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window);
;



/*!
 * jQuery UI 1.8.10
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.10",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,
NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,
"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");
if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,
"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,
d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});
c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&
b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;/*!
 * jQuery UI Widget 1.8.10
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*!
 * jQuery UI Mouse 1.8.10
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
(function(c){c.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(b){if(true===c.data(b.target,a.widgetName+".preventClickEvent")){c.removeData(b.target,a.widgetName+".preventClickEvent");b.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent=
a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var b=this,e=a.which==1,f=typeof this.options.cancel=="string"?c(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){b.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}this._mouseMoveDelegate=function(d){return b._mouseMove(d)};this._mouseUpDelegate=function(d){return b._mouseUp(d)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return a.originalEvent.mouseHandled=true}},_mouseMove:function(a){if(c.browser.msie&&!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);
return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;a.target==this._mouseDownEvent.target&&c.data(a.target,this.widgetName+".preventClickEvent",
true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
;
/*
 * jQuery UI Position 1.8.10
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Position
 */
(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
;;



(function($){
	/* hoverIntent by Brian Cherne */
	$.fn.hoverIntent = function(f,g) {
		// default configuration options
		var cfg = {
			sensitivity: 7,
			interval: 10,
			timeout: 0
		};
		// override configuration options with user supplied object
		cfg = $.extend(cfg, g ? { over: f, out: g } : f );

		// instantiate variables
		// cX, cY = current X and Y position of mouse, updated by mousemove event
		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
		var cX, cY, pX, pY;

		// A private function for getting mouse position
		var track = function(ev) {
			cX = ev.pageX;
			cY = ev.pageY;
		};

		// A private function for comparing current and previous mouse position
		var compare = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			// compare mouse positions to see if they've crossed the threshold
			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
				$(ob).unbind("mousemove",track);
				// set hoverIntent state to true (so mouseOut can be called)
				ob.hoverIntent_s = 1;
				return cfg.over.apply(ob,[ev]);
			} else {
				// set previous coordinates for next time
				pX = cX; pY = cY;
				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
			}
		};

		// A private function for delaying the mouseOut function
		var delay = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			ob.hoverIntent_s = 0;
			return cfg.out.apply(ob,[ev]);
		};

		// A private function for handling mouse 'hovering'
		var handleHover = function(e) {
			// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
			while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
			if ( p == this ) { return false; }

			// copy objects to be passed into t (required for event object to be passed in IE)
			var ev = jQuery.extend({},e);
			var ob = this;

			// cancel hoverIntent timer if it exists
			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }

			// else e.type == "onmouseover"
			if (e.type == "mouseover") {
				// set "previous" X and Y position based on initial entry point
				pX = ev.pageX; pY = ev.pageY;
				// update "current" X and Y position based on mousemove
				$(ob).bind("mousemove",track);
				// start polling interval (self-calling timeout) to compare mouse coordinates over time
				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}

			// else e.type == "onmouseout"
			} else {
				// unbind expensive mousemove event
				$(ob).unbind("mousemove",track);
				// if hoverIntent state is true, then call the mouseOut function after the specified delay
				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
			}
		};

		// bind the function to the two event listeners
		return this.mouseover(handleHover).mouseout(handleHover);
	};

})(jQuery);;



/**
 * jQuery Roundabout - v1.1
 * http://fredhq.com/projects/roundabout/
 *
 * Moves list-items of enabled ordered and unordered lists long
 * a chosen path. Includes the default "lazySusan" path, that
 * moves items long a spinning turntable.
 *
 * Terms of Use // jQuery Roundabout
 *
 * Open source under the BSD license
 *
 * Copyright (c) 2010, Fred LeBlanc
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   - Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   - Redistributions in binary form must reproduce the above
 *     copyright notice, this list of conditions and the following
 *     disclaimer in the documentation and/or other materials provided
 *     with the distribution.
 *   - Neither the name of the author nor the names of its contributors
 *     may be used to endorse or promote products derived from this
 *     software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */


// creates a default shape to be used for pathing
jQuery.extend({
	roundabout_shape: {
		def: 'lazySusan',
		lazySusan: function(r, a, t) {
			return {
				x: Math.sin(r + a),
				y: (Math.sin(r + 3*Math.PI/2 + a) / 8) * t,
				z: (Math.cos(r + a) + 1) / 2,
				scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5
			};
		}
	}
});

jQuery.fn.roundabout = function() {
	var options = (typeof arguments[0] != 'object') ? {} : arguments[0];

	// set options and fill in defaults
	options = {
		bearing: (typeof options.bearing == 'undefined') ? 0.0 : jQuery.roundabout_toFloat(options.bearing % 360.0),
		tilt: (typeof options.tilt == 'undefined') ? 0.0 : jQuery.roundabout_toFloat(options.tilt),
		minZ: (typeof options.minZ == 'undefined') ? 100 : parseInt(options.minZ, 10),
		maxZ: (typeof options.maxZ == 'undefined') ? 400 : parseInt(options.maxZ, 10),
		minOpacity: (typeof options.minOpacity == 'undefined') ? 0.40 : jQuery.roundabout_toFloat(options.minOpacity),
		maxOpacity: (typeof options.maxOpacity == 'undefined') ? 1.00 : jQuery.roundabout_toFloat(options.maxOpacity),
		minScale: (typeof options.minScale == 'undefined') ? 0.40 : jQuery.roundabout_toFloat(options.minScale),
		maxScale: (typeof options.maxScale == 'undefined') ? 1.00 : jQuery.roundabout_toFloat(options.maxScale),
		duration: (typeof options.duration == 'undefined') ? 600 : parseInt(options.duration, 10),
		btnNext: options.btnNext || null,
		btnPrev: options.btnPrev || null,
		easing: options.easing || 'swing',
		clickToFocus: (options.clickToFocus !== false),
		focusBearing: (typeof options.focusBearing == 'undefined') ? 0.0 : jQuery.roundabout_toFloat(options.focusBearing % 360.0),
		shape: options.shape || 'lazySusan',
		debug: options.debug || false,
		childSelector: options.childSelector || 'li',
		startingChild: (typeof options.startingChild == 'undefined') ? null : parseInt(options.startingChild, 10),
		reflect: (typeof options.reflect == 'undefined' || options.reflect === false) ? false : true
	};

	// assign things
	this.each(function(i) {
		var ref = jQuery(this);
		var period = jQuery.roundabout_toFloat(360.0 / ref.children(options.childSelector).length);
		var startingBearing = (options.startingChild === null) ? options.bearing : options.startingChild * period;

		// set starting styles
		ref
			.addClass('roundabout-holder')
			.css('padding', 0)
			.css('position', 'relative')
			.css('z-index', options.minZ);

		// set starting options
		ref.data('roundabout', {
			'bearing': startingBearing,
			'tilt': options.tilt,
			'minZ': options.minZ,
			'maxZ': options.maxZ,
			'minOpacity': options.minOpacity,
			'maxOpacity': options.maxOpacity,
			'minScale': options.minScale,
			'maxScale': options.maxScale,
			'duration': options.duration,
			'easing': options.easing,
			'clickToFocus': options.clickToFocus,
			'focusBearing': options.focusBearing,
			'animating': 0,
			'childInFocus': -1,
			'shape': options.shape,
			'period': period,
			'debug': options.debug,
			'childSelector': options.childSelector,
			'reflect': options.reflect
		});

		// bind click events
		if (options.clickToFocus === true) {
			ref.children(options.childSelector).each(function(i) {
				jQuery(this).click(function(e) {
					var degrees = (options.reflect === true) ? 360.0 - (period * i) : period * i;
					degrees = jQuery.roundabout_toFloat(degrees);
					if (!jQuery.roundabout_isInFocus(ref, degrees)) {
						e.preventDefault();
						if (ref.data('roundabout').animating === 0) {
							ref.roundabout_animateAngleToFocus(degrees);
						}
						return false;
					}
				});
			});
		}

		// bind next buttons
		if (options.btnNext) {
			jQuery(options.btnNext).bind('click.roundabout', function(e) {
				e.preventDefault();
				if (ref.data('roundabout').animating === 0) {
					ref.roundabout_animateToNextChild();
				}
				return false;
			});
		}

		// bind previous buttons
		if (options.btnPrev) {
			jQuery(options.btnPrev).bind('click.roundabout', function(e) {
				e.preventDefault();
				if (ref.data('roundabout').animating === 0) {
					ref.roundabout_animateToPreviousChild();
				}
				return false;
			});
		}
	});

	// start children
	this.roundabout_startChildren();

	// callback once ready
	if (typeof arguments[1] === 'function') {
		var callback = arguments[1], ref = this;
		setTimeout(function() { callback(ref); }, 0);
	}

	return this;
};

jQuery.fn.roundabout_startChildren = function() {
	this.each(function(i) {
		var ref = jQuery(this);
		var data = ref.data('roundabout');
		var children = ref.children(data.childSelector);

		children.each(function(i) {
			var degrees = (data.reflect === true) ? 360.0 - (data.period * i) : data.period * i;

			// apply classes and css first
			jQuery(this)
				.addClass('roundabout-moveable-item')
				.css('position', 'absolute');

			// then measure
			jQuery(this).data('roundabout', {
				'startWidth': jQuery(this).width(),
				'startHeight': jQuery(this).height(),
				'startFontSize': parseInt(jQuery(this).css('font-size'), 10),
				'degrees': degrees
			});
		});

		ref.roundabout_updateChildPositions();
	});
	return this;
};

jQuery.fn.roundabout_setTilt = function(newTilt) {
	this.each(function(i) {
		jQuery(this).data('roundabout').tilt = newTilt;
		jQuery(this).roundabout_updateChildPositions();
	});

	if (typeof arguments[1] === 'function') {
		var callback = arguments[1], ref = this;
		setTimeout(function() { callback(ref); }, 0);
	}

	return this;
};

jQuery.fn.roundabout_setBearing = function(newBearing) {
	this.each(function(i) {
		jQuery(this).data('roundabout').bearing = jQuery.roundabout_toFloat(newBearing % 360, 2);
		jQuery(this).roundabout_updateChildPositions();
	});

	if (typeof arguments[1] === 'function') {
		var callback = arguments[1], ref = this;
		setTimeout(function() { callback(ref); }, 0);
	}

	return this;
};

jQuery.fn.roundabout_adjustBearing = function(delta) {
	delta = jQuery.roundabout_toFloat(delta);
	if (delta !== 0) {
		this.each(function(i) {
			jQuery(this).data('roundabout').bearing = jQuery.roundabout_getBearing(jQuery(this)) + delta;
			jQuery(this).roundabout_updateChildPositions();
		});
	}

	if (typeof arguments[1] === 'function') {
		var callback = arguments[1], ref = this;
		setTimeout(function() { callback(ref); }, 0);
	}

	return this;
};

jQuery.fn.roundabout_adjustTilt = function(delta) {
	delta = jQuery.roundabout_toFloat(delta);
	if (delta !== 0) {
		this.each(function(i) {
			jQuery(this).data('roundabout').tilt = jQuery.roundabout_toFloat(jQuery(this).roundabout_get('tilt') + delta);
			jQuery(this).roundabout_updateChildPositions();
		});
	}

	if (typeof arguments[1] === 'function') {
		var callback = arguments[1], ref = this;
		setTimeout(function() { callback(ref); }, 0);
	}

	return this;
};

jQuery.fn.roundabout_animateToBearing = function(bearing) {
	bearing = jQuery.roundabout_toFloat(bearing);
	var currentTime = new Date();
	var duration    = (typeof arguments[1] == 'undefined') ? null : arguments[1];
	var easingType  = (typeof arguments[2] == 'undefined') ? null : arguments[2];
	var passedData  = (typeof arguments[3] !== 'object')   ? null : arguments[3];

	this.each(function(i) {
		var ref = jQuery(this), data = ref.data('roundabout'), timer, easingFn, newBearing;
		var thisDuration = (duration === null) ? data.duration : duration;
		var thisEasingType = (easingType !== null) ? easingType : data.easing || 'swing';

		if (passedData === null) {
			passedData = {
				timerStart: currentTime,
				start: jQuery.roundabout_getBearing(ref),
				totalTime: thisDuration
			};
		}
		timer = currentTime - passedData.timerStart;

		if (timer < thisDuration) {
			data.animating = 1;

			if (typeof jQuery.easing.def == 'string') {
				easingFn = jQuery.easing[thisEasingType] || jQuery.easing[jQuery.easing.def];
				newBearing = easingFn(null, timer, passedData.start, bearing - passedData.start, passedData.totalTime);
			} else {
				newBearing = jQuery.easing[thisEasingType]((timer / passedData.totalTime), timer, passedData.start, bearing - passedData.start, passedData.totalTime);
			}

			ref.roundabout_setBearing(newBearing, function() { ref.roundabout_animateToBearing(bearing, thisDuration, thisEasingType, passedData); });
		} else {
			bearing = (bearing < 0) ? bearing + 360 : bearing % 360;
			data.animating = 0;
			ref.roundabout_setBearing(bearing);
		}
	});
	return this;
};

jQuery.fn.roundabout_animateToDelta = function(delta) {
	var duration = arguments[1], easing = arguments[2];
	this.each(function(i) {
		delta = jQuery.roundabout_getBearing(jQuery(this)) + jQuery.roundabout_toFloat(delta);
		jQuery(this).roundabout_animateToBearing(delta, duration, easing);
	});
	return this;
};

jQuery.fn.roundabout_animateToChild = function(childPos) {
	var duration = arguments[1], easing = arguments[2];
	this.each(function(i) {
		var ref = jQuery(this), data = ref.data('roundabout');
		if (data.childInFocus !== childPos && data.animating === 0) {
			var child = jQuery(ref.children(data.childSelector)[childPos]);
			ref.roundabout_animateAngleToFocus(child.data('roundabout').degrees, duration, easing);
		}
	});
	return this;
};

jQuery.fn.roundabout_animateToNearbyChild = function(passedArgs, which) {
	var duration = passedArgs[0], easing = passedArgs[1];
	this.each(function(i) {
		var data     = jQuery(this).data('roundabout');
		var bearing  = jQuery.roundabout_toFloat(360.0 - jQuery.roundabout_getBearing(jQuery(this)));
		var period   = data.period, j = 0, range;
		var reflect  = data.reflect;
		var length   = jQuery(this).children(data.childSelector).length;

		bearing = (reflect === true) ? bearing % 360.0 : bearing;

		if (data.animating === 0) {
			// if we're not reflecting and we're moving to next or
			//    we are reflecting and we're moving previous
			if ((reflect === false && which === 'next') || (reflect === true && which !== 'next')) {
				bearing = (bearing === 0) ? 360 : bearing;

				// counterclockwise
				while (true && j < length) {
					range = { lower: jQuery.roundabout_toFloat(period * j), upper: jQuery.roundabout_toFloat(period * (j + 1)) };
					range.upper = (j == length - 1) ? 360.0 : range.upper;  // adjust for javascript being bad at floats

					if (bearing <= range.upper && bearing > range.lower) {
						jQuery(this).roundabout_animateToDelta(bearing - range.lower, duration, easing);
						break;
					}
					j++;
				}
			} else {
				// clockwise
				while (true) {
					range = { lower: jQuery.roundabout_toFloat(period * j), upper: jQuery.roundabout_toFloat(period * (j + 1)) };
					range.upper = (j == length - 1) ? 360.0 : range.upper;  // adjust for javascript being bad at floats

					if (bearing >= range.lower && bearing < range.upper) {
						jQuery(this).roundabout_animateToDelta(bearing - range.upper, duration, easing);
						break;
					}
					j++;
				}
			}
		}
	});
	return this;
};

jQuery.fn.roundabout_animateToNextChild = function() {
	return this.roundabout_animateToNearbyChild(arguments, 'next');
};

jQuery.fn.roundabout_animateToPreviousChild = function() {
	return this.roundabout_animateToNearbyChild(arguments, 'previous');
};

// moves a given angle to the focus by the shortest means possible
jQuery.fn.roundabout_animateAngleToFocus = function(target) {
	var duration = arguments[1], easing = arguments[2];
	this.each(function(i) {
		var delta = jQuery.roundabout_getBearing(jQuery(this)) - target;
		delta = (Math.abs(360.0 - delta) < Math.abs(0.0 - delta)) ? 360.0 - delta : 0.0 - delta;
		delta = (delta > 180) ? -(360.0 - delta) : delta;

		if (delta !== 0) {
			jQuery(this).roundabout_animateToDelta(delta, duration, easing);
		}
	});
	return this;
};

jQuery.fn.roundabout_updateChildPositions = function() {
	this.each(function(i) {
		var ref = jQuery(this), data = ref.data('roundabout');
		var inFocus = -1;
		var info = {
			bearing: jQuery.roundabout_getBearing(ref),
			tilt: data.tilt,
			stage: { width: Math.floor(ref.width() * 0.9), height: Math.floor(ref.height() * 0.9) },
			animating: data.animating,
			inFocus: data.childInFocus,
			focusBearingRad: jQuery.roundabout_degToRad(data.focusBearing),
			shape: jQuery.roundabout_shape[data.shape] || jQuery.roundabout_shape[jQuery.roundabout_shape.def]
		};
		info.midStage = { width: info.stage.width / 2, height: info.stage.height / 2 };
		info.nudge = { width: info.midStage.width + info.stage.width * 0.05, height: info.midStage.height + info.stage.height * 0.05 };
		info.zValues = { min: data.minZ, max: data.maxZ, diff: data.maxZ - data.minZ };
		info.opacity = { min: data.minOpacity, max: data.maxOpacity, diff: data.maxOpacity - data.minOpacity };
		info.scale = { min: data.minScale, max: data.maxScale, diff: data.maxScale - data.minScale };

		// update child positions
		ref.children(data.childSelector).each(function(i) {
			if (jQuery.roundabout_updateChildPosition(jQuery(this), ref, info, i) && info.animating === 0) {
				inFocus = i;
				jQuery(this).addClass('roundabout-in-focus');
			} else {
				jQuery(this).removeClass('roundabout-in-focus');
			}
		});

		// update status of who is in focus
		if (inFocus !== info.inFocus) {
			jQuery.roundabout_triggerEvent(ref, info.inFocus, 'blur');

			if (inFocus !== -1) {
				jQuery.roundabout_triggerEvent(ref, inFocus, 'focus');
			}

			data.childInFocus = inFocus;
		}
	});
	return this;
};

//----------------

jQuery.roundabout_getBearing = function(el) {
	return jQuery.roundabout_toFloat(el.data('roundabout').bearing) % 360;
};

jQuery.roundabout_degToRad = function(degrees) {
	return (degrees % 360.0) * Math.PI / 180.0;
};

jQuery.roundabout_isInFocus = function(el, target) {
	return (jQuery.roundabout_getBearing(el) % 360 === (target % 360));
};

jQuery.roundabout_triggerEvent = function(el, child, eventType) {
	return (child < 0) ? this : jQuery(el.children(el.data('roundabout').childSelector)[child]).trigger(eventType);
};

jQuery.roundabout_toFloat = function(number) {
	number = Math.round(parseFloat(number) * 1000) / 1000;
	return parseFloat(number.toFixed(2));
};

jQuery.roundabout_updateChildPosition = function(child, container, info, childPos) {
	var ref = jQuery(child), data = ref.data('roundabout'), out = [];
	var rad = jQuery.roundabout_degToRad((360.0 - ref.data('roundabout').degrees) + info.bearing);

	// adjust radians to be between 0 and Math.PI * 2
	while (rad < 0) {
		rad = rad + Math.PI * 2;
	}
	while (rad > Math.PI * 2) {
		rad = rad - Math.PI * 2;
	}

	var factors = info.shape(rad, info.focusBearingRad, info.tilt); // obj with x, y, z, and scale values

	// correct
	factors.scale = (factors.scale > 1) ? 1 : factors.scale;
	factors.adjustedScale = (info.scale.min + (info.scale.diff * factors.scale)).toFixed(4);
	factors.width = (factors.adjustedScale * data.startWidth).toFixed(4);
	factors.height = (factors.adjustedScale * data.startHeight).toFixed(4);

	// alter item
	ref
		.css('left', ((factors.x * info.midStage.width + info.nudge.width) - factors.width / 2.0).toFixed(1) + 'px')
		.css('top', (((factors.y * info.midStage.height + info.nudge.height) - factors.height / 2.0).toFixed(1)) + 'px')
		.css('width', factors.width + 'px')
		.css('height', factors.height + 'px')
		.css('opacity', (info.opacity.min + (info.opacity.diff * factors.scale)).toFixed(2))
		.css('z-index', Math.round(info.zValues.min + (info.zValues.diff * factors.z)))
		.css('font-size', (factors.adjustedScale * data.startFontSize).toFixed(2) + 'px')
		.attr('current-scale', factors.adjustedScale);

	if (container.data('roundabout').debug === true) {
		out.push('<div style="font-weight: normal; font-size: 10px; padding: 2px; width: ' + ref.css('width') + '; background-color: #ffc;">');
		out.push('<strong style="font-size: 12px; white-space: nowrap;">Child ' + childPos + '</strong><br />');
		out.push('<strong>left:</strong> ' + ref.css('left') + '<br /><strong>top:</strong> ' + ref.css('top') + '<br />');
		out.push('<strong>width:</strong> ' + ref.css('width') + '<br /><strong>opacity:</strong> ' + ref.css('opacity') + '<br />');
		out.push('<strong>z-index:</strong> ' + ref.css('z-index') + '<br /><strong>font-size:</strong> ' + ref.css('font-size') + '<br />');
		out.push('<strong>scale:</strong> ' + ref.attr('current-scale'));
		out.push('</div>');

		ref.html(out.join(''));
	}

	return jQuery.roundabout_isInFocus(container, ref.data('roundabout').degrees);
};;



/*!
 * jCarousel - Riding carousels with jQuery
 *   http://sorgalla.com/jcarousel/
 *
 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Carousel Component" by Bill Scott
 *   http://billwscott.com/carousel/
 */

(function(i){
    var q={
        vertical:false,
        rtl:false,
        start:1,
        offset:1,
        size:null,
        scroll:3,
        visible:null,
        animation:"normal",
        easing:"swing",
        auto:0,
        wrap:null,
        initCallback:null,
        reloadCallback:null,
        itemLoadCallback:null,
        itemFirstInCallback:null,
        itemFirstOutCallback:null,
        itemLastInCallback:null,
        itemLastOutCallback:null,
        itemVisibleInCallback:null,
        itemVisibleOutCallback:null,
        buttonNextHTML:"<div></div>",
        buttonPrevHTML:"<div></div>",
        buttonNextEvent:"click",
        buttonPrevEvent:"click",
        buttonNextCallback:null,
        buttonPrevCallback:null,
        itemFallbackDimension:null
    },r=false;
    i(window).bind("load.jcarousel",function(){
        r=true
        });
    i.jcarousel=function(a,c){
        this.options=i.extend({},q,c||{});
        this.autoStopped=this.locked=false;
        this.buttonPrevState=this.buttonNextState=this.buttonPrev=this.buttonNext=this.list=this.clip=this.container=null;
        if(!c||c.rtl===undefined)this.options.rtl=(i(a).attr("dir")||i("html").attr("dir")||"").toLowerCase()=="rtl";
        this.wh=!this.options.vertical?"width":"height";
        this.lt=!this.options.vertical?this.options.rtl? "right":"left":"top";
        for(var b="",d=a.className.split(" "),f=0;f<d.length;f++)if(d[f].indexOf("jcarousel-skin")!=-1){
            i(a).removeClass(d[f]);
            b=d[f];
            break
        }
        if(a.nodeName.toUpperCase()=="UL"||a.nodeName.toUpperCase()=="OL"){
            this.list=i(a);
            this.container=this.list.parent();
            if(this.container.hasClass("jcarousel-clip")){
                if(!this.container.parent().hasClass("jcarousel-container"))this.container=this.container.wrap("<div></div>");
                this.container=this.container.parent()
                }else if(!this.container.hasClass("jcarousel-container"))this.container= this.list.wrap("<div></div>").parent()
                }else{
            this.container=i(a);
            this.list=this.container.find("ul,ol").eq(0)
            }
            b!==""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1&&this.container.wrap('<div class=" '+b+'"></div>');
        this.clip=this.list.parent();
        if(!this.clip.length||!this.clip.hasClass("jcarousel-clip"))this.clip=this.list.wrap("<div></div>").parent();
        this.buttonNext=i(".jcarousel-next",this.container);
        if(this.buttonNext.size()===0&&this.options.buttonNextHTML!==null)this.buttonNext= this.clip.after(this.options.buttonNextHTML).next();
        this.buttonNext.addClass(this.className("jcarousel-next"));
        this.buttonPrev=i(".jcarousel-prev",this.container);
        if(this.buttonPrev.size()===0&&this.options.buttonPrevHTML!==null)this.buttonPrev=this.clip.after(this.options.buttonPrevHTML).next();
        this.buttonPrev.addClass(this.className("jcarousel-prev"));
        this.clip.addClass(this.className("jcarousel-clip")).css({
            overflow:"hidden",
            position:"relative"
        });
        this.list.addClass(this.className("jcarousel-list")).css({
            overflow:"hidden",
            position:"relative",
            top:0,
            margin:0,
            padding:0
        }).css(this.options.rtl?"right":"left",0);
        this.container.addClass(this.className("jcarousel-container")).css({
            position:"relative"
        });
        !this.options.vertical&&this.options.rtl&&this.container.addClass("jcarousel-direction-rtl").attr("dir","rtl");
        var j=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;
        b=this.list.children("li");
        var e=this;
        if(b.size()>0){
            var g=0,k=this.options.offset;
            b.each(function(){
                e.format(this,k++);
                g+=e.dimension(this, j)
                });
            this.list.css(this.wh,g+100+"px");
            if(!c||c.size===undefined)this.options.size=b.size()
                }
                this.container.css("display","block");
        this.buttonNext.css("display","block");
        this.buttonPrev.css("display","block");
        this.funcNext=function(){
            e.next()
            };

        this.funcPrev=function(){
            e.prev()
            };

        this.funcResize=function(){
            e.reload()
            };

        this.options.initCallback!==null&&this.options.initCallback(this,"init");
        if(!r&&i.browser.safari){
            this.buttons(false,false);
            i(window).bind("load.jcarousel",function(){
                e.setup()
                })
            }else this.setup()
            };
    var h=i.jcarousel;
    h.fn=h.prototype={
        jcarousel:"0.2.7"
    };

    h.fn.extend=h.extend=i.extend;
    h.fn.extend({
        setup:function(){
            this.prevLast=this.prevFirst=this.last=this.first=null;
            this.animating=false;
            this.tail=this.timer=null;
            this.inTail=false;
            if(!this.locked){
                this.list.css(this.lt,this.pos(this.options.offset)+"px");
                var a=this.pos(this.options.start,true);
                this.prevFirst=this.prevLast=null;
                this.animate(a,false);
                i(window).unbind("resize.jcarousel",this.funcResize).bind("resize.jcarousel",this.funcResize)
                }
            },
    reset:function(){
        this.list.empty();
        this.list.css(this.lt,"0px");
        this.list.css(this.wh,"10px");
        this.options.initCallback!==null&&this.options.initCallback(this,"reset");
        this.setup()
        },
    reload:function(){
        this.tail!==null&&this.inTail&&this.list.css(this.lt,h.intval(this.list.css(this.lt))+this.tail);
        this.tail=null;
        this.inTail=false;
        this.options.reloadCallback!==null&&this.options.reloadCallback(this);
        if(this.options.visible!==null){
            var a=this,c=Math.ceil(this.clipping()/this.options.visible),b=0,d=0;
            this.list.children("li").each(function(f){
                b+=a.dimension(this,c);
                if(f+1<a.first)d=b
                    });
            this.list.css(this.wh,b+"px");
            this.list.css(this.lt,-d+"px")
            }
            this.scroll(this.first,false)
        },
    lock:function(){
        this.locked=true;
        this.buttons()
        },
    unlock:function(){
        this.locked=false;
        this.buttons()
        },
    size:function(a){
        if(a!==undefined){
            this.options.size=a;
            this.locked||this.buttons()
            }
            return this.options.size
        },
    has:function(a,c){
        if(c===undefined||!c)c=a;
        if(this.options.size!==null&&c>this.options.size)c=this.options.size;
        for(var b= a;b<=c;b++){
            var d=this.get(b);
            if(!d.length||d.hasClass("jcarousel-item-placeholder"))return false
                }
                return true
        },
    get:function(a){
        return i(".jcarousel-item-"+a,this.list)
        },
    add:function(a,c){
        var b=this.get(a),d=0,f=i(c);
        if(b.length===0){
            var j,e=h.intval(a);
            for(b=this.create(a);;){
                j=this.get(--e);
                if(e<=0||j.length){
                    e<=0?this.list.prepend(b):j.after(b);
                    break
                }
            }
            }else d=this.dimension(b);
    if(f.get(0).nodeName.toUpperCase()=="LI"){
        b.replaceWith(f);
        b=f
        }else b.empty().append(c);
    this.format(b.removeClass(this.className("jcarousel-item-placeholder")), a);
    f=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;
    d=this.dimension(b,f)-d;
    a>0&&a<this.first&&this.list.css(this.lt,h.intval(this.list.css(this.lt))-d+"px");
    this.list.css(this.wh,h.intval(this.list.css(this.wh))+d+"px");
    return b
    },
remove:function(a){
    var c=this.get(a);
    if(!(!c.length||a>=this.first&&a<=this.last)){
        var b=this.dimension(c);
        a<this.first&&this.list.css(this.lt,h.intval(this.list.css(this.lt))+b+"px");
        c.remove();
        this.list.css(this.wh,h.intval(this.list.css(this.wh))- b+"px")
        }
    },
next:function(){
    this.tail!==null&&!this.inTail?this.scrollTail(false):this.scroll((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!==null&&this.last==this.options.size?1:this.first+this.options.scroll)
    },
prev:function(){
    this.tail!==null&&this.inTail?this.scrollTail(true):this.scroll((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!==null&&this.first==1?this.options.size:this.first-this.options.scroll)
    },
scrollTail:function(a){
    if(!(this.locked|| this.animating||!this.tail)){
        this.pauseAuto();
        var c=h.intval(this.list.css(this.lt));
        c=!a?c-this.tail:c+this.tail;
        this.inTail=!a;
        this.prevFirst=this.first;
        this.prevLast=this.last;
        this.animate(c)
        }
    },
scroll:function(a,c){
    if(!(this.locked||this.animating)){
        this.pauseAuto();
        this.animate(this.pos(a),c)
        }
    },
pos:function(a,c){
    var b=h.intval(this.list.css(this.lt));
    if(this.locked||this.animating)return b;
    if(this.options.wrap!="circular")a=a<1?1:this.options.size&&a>this.options.size?this.options.size:a;
    for(var d= this.first>a,f=this.options.wrap!="circular"&&this.first<=1?1:this.first,j=d?this.get(f):this.get(this.last),e=d?f:f-1,g=null,k=0,l=false,m=0;d?--e>=a:++e<a;){
        g=this.get(e);
        l=!g.length;
        if(g.length===0){
            g=this.create(e).addClass(this.className("jcarousel-item-placeholder"));
            j[d?"before":"after"](g);
            if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)){
                j=this.get(this.index(e));
                if(j.length)g=this.add(e,j.clone(true))
                    }
                }
        j=g;
    m=this.dimension(g);
        if(l)k+= m;
        if(this.first!==null&&(this.options.wrap=="circular"||e>=1&&(this.options.size===null||e<=this.options.size)))b=d?b+m:b-m
        }
        f=this.clipping();
var p=[],o=0,n=0;
j=this.get(a-1);
for(e=a;++o;){
    g=this.get(e);
    l=!g.length;
    if(g.length===0){
        g=this.create(e).addClass(this.className("jcarousel-item-placeholder"));
        j.length===0?this.list.prepend(g):j[d?"before":"after"](g);
        if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)){
            j=this.get(this.index(e));
            if(j.length)g= this.add(e,j.clone(true))
                }
            }
    j=g;
m=this.dimension(g);
    if(m===0)throw Error("jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...");
    if(this.options.wrap!="circular"&&this.options.size!==null&&e>this.options.size)p.push(g);
    else if(l)k+=m;
    n+=m;
    if(n>=f)break;
    e++
}
for(g=0;g<p.length;g++)p[g].remove();
if(k>0){
    this.list.css(this.wh,this.dimension(this.list)+k+"px");
    if(d){
        b-=k;
        this.list.css(this.lt,h.intval(this.list.css(this.lt))-k+"px")
        }
    }
k=a+o-1;
if(this.options.wrap!="circular"&& this.options.size&&k>this.options.size)k=this.options.size;
if(e>k){
    o=0;
    e=k;
    for(n=0;++o;){
        g=this.get(e--);
        if(!g.length)break;
        n+=this.dimension(g);
        if(n>=f)break
    }
    }
    e=k-o+1;
if(this.options.wrap!="circular"&&e<1)e=1;
if(this.inTail&&d){
    b+=this.tail;
    this.inTail=false
    }
    this.tail=null;
if(this.options.wrap!="circular"&&k==this.options.size&&k-o+1>=1){
    d=h.margin(this.get(k),!this.options.vertical?"marginRight":"marginBottom");
    if(n-d>f)this.tail=n-f-d
        }
        if(c&&a===this.options.size&&this.tail){
    b-=this.tail;
    this.inTail= true
    }
    for(;a-- >e;)b+=this.dimension(this.get(a));
this.prevFirst=this.first;
this.prevLast=this.last;
this.first=e;
this.last=k;
return b
},
animate:function(a,c){
    if(!(this.locked||this.animating)){
        this.animating=true;
        var b=this,d=function(){
            b.animating=false;
            a===0&&b.list.css(b.lt,0);
            if(!b.autoStopped&&(b.options.wrap=="circular"||b.options.wrap=="both"||b.options.wrap=="last"||b.options.size===null||b.last<b.options.size||b.last==b.options.size&&b.tail!==null&&!b.inTail))b.startAuto();
            b.buttons();
            b.notify("onAfterAnimation");
            if(b.options.wrap=="circular"&&b.options.size!==null)for(var f=b.prevFirst;f<=b.prevLast;f++)if(f!==null&&!(f>=b.first&&f<=b.last)&&(f<1||f>b.options.size))b.remove(f)
                };

        this.notify("onBeforeAnimation");
        if(!this.options.animation||c===false){
            this.list.css(this.lt,a+"px");
            d()
            }else this.list.animate(!this.options.vertical?this.options.rtl?{
            right:a
        }:{
            left:a
        }:{
            top:a
        },this.options.animation,this.options.easing,d)
        }
        },
startAuto:function(a){
    if(a!==undefined)this.options.auto=a;
    if(this.options.auto===0)return this.stopAuto();
    if(this.timer===null){
        this.autoStopped=false;
        var c=this;
        this.timer=window.setTimeout(function(){
            c.next()
            },this.options.auto*1E3)
        }
    },
stopAuto:function(){
    this.pauseAuto();
    this.autoStopped=true
    },
pauseAuto:function(){
    if(this.timer!==null){
        window.clearTimeout(this.timer);
        this.timer=null
        }
    },
buttons:function(a,c){
    if(a==null){
        a=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="first"||this.options.size===null||this.last<this.options.size);
        if(!this.locked&&(!this.options.wrap||this.options.wrap== "first")&&this.options.size!==null&&this.last>=this.options.size)a=this.tail!==null&&!this.inTail
            }
            if(c==null){
        c=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="last"||this.first>1);
        if(!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!==null&&this.first==1)c=this.tail!==null&&this.inTail
            }
            var b=this;
    if(this.buttonNext.size()>0){
        this.buttonNext.unbind(this.options.buttonNextEvent+".jcarousel",this.funcNext);
        a&&this.buttonNext.bind(this.options.buttonNextEvent+ ".jcarousel",this.funcNext);
        this.buttonNext[a?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",a?false:true);
        this.options.buttonNextCallback!==null&&this.buttonNext.data("jcarouselstate")!=a&&this.buttonNext.each(function(){
            b.options.buttonNextCallback(b,this,a)
            }).data("jcarouselstate",a)
        }else this.options.buttonNextCallback!==null&&this.buttonNextState!=a&&this.options.buttonNextCallback(b,null,a);
    if(this.buttonPrev.size()>0){
        this.buttonPrev.unbind(this.options.buttonPrevEvent+ ".jcarousel",this.funcPrev);
        c&&this.buttonPrev.bind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev);
        this.buttonPrev[c?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",c?false:true);
        this.options.buttonPrevCallback!==null&&this.buttonPrev.data("jcarouselstate")!=c&&this.buttonPrev.each(function(){
            b.options.buttonPrevCallback(b,this,c)
            }).data("jcarouselstate",c)
        }else this.options.buttonPrevCallback!==null&&this.buttonPrevState!=c&&this.options.buttonPrevCallback(b, null,c);
    this.buttonNextState=a;
    this.buttonPrevState=c
    },
notify:function(a){
    var c=this.prevFirst===null?"init":this.prevFirst<this.first?"next":"prev";
    this.callback("itemLoadCallback",a,c);
    if(this.prevFirst!==this.first){
        this.callback("itemFirstInCallback",a,c,this.first);
        this.callback("itemFirstOutCallback",a,c,this.prevFirst)
        }
        if(this.prevLast!==this.last){
        this.callback("itemLastInCallback",a,c,this.last);
        this.callback("itemLastOutCallback",a,c,this.prevLast)
        }
        this.callback("itemVisibleInCallback", a,c,this.first,this.last,this.prevFirst,this.prevLast);
    this.callback("itemVisibleOutCallback",a,c,this.prevFirst,this.prevLast,this.first,this.last)
    },
callback:function(a,c,b,d,f,j,e){
    if(!(this.options[a]==null||typeof this.options[a]!="object"&&c!="onAfterAnimation")){
        var g=typeof this.options[a]=="object"?this.options[a][c]:this.options[a];
        if(i.isFunction(g)){
            var k=this;
            if(d===undefined)g(k,b,c);
            else if(f===undefined)this.get(d).each(function(){
                g(k,this,d,b,c)
                });
            else{
                a=function(m){
                    k.get(m).each(function(){
                        g(k, this,m,b,c)
                        })
                    };

                for(var l=d;l<=f;l++)l!==null&&!(l>=j&&l<=e)&&a(l)
                    }
                }
    }
},
create:function(a){
    return this.format("<li></li>",a)
    },
format:function(a,c){
    a=i(a);
    for(var b=a.get(0).className.split(" "),d=0;d<b.length;d++)b[d].indexOf("jcarousel-")!=-1&&a.removeClass(b[d]);
    a.addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+c)).css({
        "float":this.options.rtl?"right":"left",
        "list-style":"none"
    }).attr("jcarouselindex",c);
    return a
    },
className:function(a){
    return a+" "+a+(!this.options.vertical? "-horizontal":"-vertical")
    },
dimension:function(a,c){
    var b=a.jquery!==undefined?a[0]:a,d=!this.options.vertical?(b.offsetWidth||h.intval(this.options.itemFallbackDimension))+h.margin(b,"marginLeft")+h.margin(b,"marginRight"):(b.offsetHeight||h.intval(this.options.itemFallbackDimension))+h.margin(b,"marginTop")+h.margin(b,"marginBottom");
    if(c==null||d==c)return d;
    d=!this.options.vertical?c-h.margin(b,"marginLeft")-h.margin(b,"marginRight"):c-h.margin(b,"marginTop")-h.margin(b,"marginBottom");
    i(b).css(this.wh, d+"px");
    return this.dimension(b)
    },
clipping:function(){
    return!this.options.vertical?this.clip[0].offsetWidth-h.intval(this.clip.css("borderLeftWidth"))-h.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-h.intval(this.clip.css("borderTopWidth"))-h.intval(this.clip.css("borderBottomWidth"))
    },
index:function(a,c){
    if(c==null)c=this.options.size;
    return Math.round(((a-1)/c-Math.floor((a-1)/c))*c)+1
    }
});
h.extend({
    defaults:function(a){
        return i.extend(q,a||{})
        },
    margin:function(a,c){
        if(!a)return 0;
        var b=a.jquery!==undefined?a[0]:a;
        if(c=="marginRight"&&i.browser.safari){
            var d={
                display:"block",
                "float":"none",
                width:"auto"
            },f,j;
            i.swap(b,d,function(){
                f=b.offsetWidth
                });
            d.marginRight=0;
            i.swap(b,d,function(){
                j=b.offsetWidth
                });
            return j-f
            }
            return h.intval(i.css(b,c))
        },
    intval:function(a){
        a=parseInt(a,10);
        return isNaN(a)?0:a
        }
    });
i.fn.jcarousel=function(a){
    if(typeof a=="string"){
        var c=i(this).data("jcarousel"),b=Array.prototype.slice.call(arguments,1);
        return c[a].apply(c,b)
        }else return this.each(function(){
        i(this).data("jcarousel", new h(this,a))
        })
    }
    })(jQuery);
;



/* ------------------------------------------------------------------------
	Class: prettyPhoto
	Use: Lightbox clone for jQuery
	Author: Stephane Caron (http://www.no-margin-for-errors.com)
	Version: 3.0
------------------------------------------------------------------------- */

(function($) {
    $.prettyPhoto = {
        version: '3.0'
    };
	
    $.fn.prettyPhoto = function(pp_settings) {
        pp_settings = jQuery.extend({
            animationSpeed: 'fast', /* fast/slow/normal */
            slideshow: false, /* false OR interval time in ms */
            autoplay_slideshow: false, /* true/false */
            opacity: 0.80, /* Value between 0 and 1 */
            showTitle: true, /* true/false */
            allowresize: true, /* true/false */
            default_width: 500,
            default_height: 344,
            counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
            theme: 'facebook', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
            hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
            wmode: 'opaque', /* Set the flash wmode attribute */
            autoplay: true, /* Automatically start videos: True/False */
            modal: false, /* If set to true, only the close button will close the window */
            overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
            changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
            callback: function(){}, /* Called when prettyPhoto is closed */
            markup: '<div class="pp_pic_holder"> \
						<div class="ppt">&nbsp;</div> \
						<div class="pp_top"> \
							<div class="pp_left"></div> \
							<div class="pp_middle"></div> \
							<div class="pp_right"></div> \
						</div> \
						<div class="pp_content_container"> \
							<div class="pp_left"> \
							<div class="pp_right"> \
								<div class="pp_content"> \
									<div class="pp_loaderIcon"></div> \
									<div class="pp_fade"> \
										<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
										<div class="pp_hoverContainer"> \
											<a class="pp_next" href="#">next</a> \
											<a class="pp_previous" href="#">previous</a> \
										</div> \
										<div id="pp_full_res"></div> \
										<div class="pp_details clearfix"> \
											<a class="pp_close" href="#">Close</a> \
											<p class="pp_description"></p> \
											<div class="pp_nav"> \
												<a href="#" class="pp_arrow_previous">Previous</a> \
												<p class="currentTextHolder">0/0</p> \
												<a href="#" class="pp_arrow_next">Next</a> \
											</div> \
										</div> \
									</div> \
								</div> \
							</div> \
							</div> \
						</div> \
						<div class="pp_bottom"> \
							<div class="pp_left"></div> \
							<div class="pp_middle"></div> \
							<div class="pp_right"></div> \
						</div> \
					</div> \
					<div class="pp_overlay"></div>',
            gallery_markup: '<div class="pp_gallery"> \
								<a href="#" class="pp_arrow_previous">Previous</a> \
								<ul> \
									{gallery} \
								</ul> \
								<a href="#" class="pp_arrow_next">Next</a> \
							</div>',
            image_markup: '<img id="fullResImage" src="" />',
            flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
            quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
            iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
            inline_markup: '<div class="pp_inline clearfix">{content}</div>'
        }, pp_settings);
		
        // Global variables accessible only by prettyPhoto
        var matchedObjects = this, percentBased = false, correctSizes,
		
        // prettyPhoto container specific
        pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth,
		
        // Window size
        windowHeight = $(window).height(), windowWidth = $(window).width(),

        // Global elements
        pp_slideshow;
		
        doresize = true, scrollPos = _getScroll();
	
        // Window/Keyboard events
        $(window).unbind('scroll').scroll(function(){
            scrollPos = _getScroll();
            _centerOverlay();
        });
        $(window).unbind('resize').resize(function(){
            _centerOverlay();
            _resizeOverlay();
        });
        $(document).unbind('keydown').keydown(function(e){
            if(typeof $pp_pic_holder != 'undefined'){
                if($pp_pic_holder.is(':visible')){
                    switch(e.keyCode){
                        case 37:
                            $.prettyPhoto.changePage('previous');
                            break;
                        case 39:
                            $.prettyPhoto.changePage('next');
                            break;
                        case 27:
                            if(!settings.modal)
                                $.prettyPhoto.close();
                            break;
                    };
                    return false;
                };
            };
        });
		
		
        /**
		* Initialize prettyPhoto.
		*/
        $.prettyPhoto.initialize = function() {
            settings = pp_settings;
			
            if($.browser.msie && parseInt($.browser.version) == 6) settings.theme = "light_square"; // Fallback to a supported theme for IE6
			
            _buildOverlay(this); // Build the overlay {this} being the caller
			
            setItem = (_getFileType($(this).attr('href')) != 'youtube') ? $(this).attr('href').toLowerCase() : $(this).attr('href');
			
            setPosition = jQuery.inArray(setItem, pp_images); // Define where in the array the clicked item is positionned

            $.prettyPhoto.open();
			
            return false;
        }


        /**
		* Opens the prettyPhoto modal box.
		* @param image {String,Array} Full path to the image to be open, can also be an array containing full images paths.
		* @param title {String,Array} The title to be displayed with the picture, can also be an array containing all the titles.
		* @param description {String,Array} The description to be displayed with the picture, can also be an array containing all the descriptions.
		*/
        $.prettyPhoto.open = function() {
            if(typeof settings == "undefined"){ // Means it's an API call, need to manually get the settings and set the variables
                settings = pp_settings;
                _buildOverlay(this); // Build the overlay {this} being the caller
                pp_images = $.makeArray(arguments[0]);
                pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
                pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray("");
                isSet = (pp_images.length > 1) ? true : false;
                setPosition = 0;
            }

            if($.browser.msie && $.browser.version == 6) $('select').css('visibility','hidden'); // To fix the bug with IE select boxes
			
            if(settings.hideflash) $('object,embed').css('visibility','hidden'); // Hide the flash

            _checkPosition($(pp_images).size()); // Hide the next/previous links if on first or last images.
		
            $('.pp_loaderIcon').show();
		
            // Fade the content in
            if($ppt.is(':hidden')) $ppt.css('opacity',0).show();
            $pp_overlay.show().fadeTo(settings.animationSpeed,settings.opacity);

            // Display the current position
            $pp_pic_holder.find('.currentTextHolder').text((setPosition+1) + settings.counter_separator_label + $(pp_images).size());

            // Set the description
            $pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[setPosition]));

            // Set the title
            (settings.showTitle && pp_titles[setPosition] != "") ? $ppt.html(unescape(pp_titles[setPosition])) : $ppt.html('&nbsp;');
			
            // Get the dimensions
            movie_width = ( parseFloat(grab_param('width',pp_images[setPosition])) ) ? grab_param('width',pp_images[setPosition]) : settings.default_width.toString();
            movie_height = ( parseFloat(grab_param('height',pp_images[setPosition])) ) ? grab_param('height',pp_images[setPosition]) : settings.default_height.toString();
			
            // If the size is % based, calculate according to window dimensions
            if(movie_width.indexOf('%') != -1 || movie_height.indexOf('%') != -1){
                movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 100);
                movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 100);
                percentBased = true;
            };
			
            // Fade the holder
            $pp_pic_holder.fadeIn(function(){
                imgPreloader = "";
				
                // Inject the proper content
                switch(_getFileType(pp_images[setPosition])){
                    case 'image':
                        imgPreloader = new Image();

                        // Preload the neighbour images
                        nextImage = new Image();
                        if(isSet && setPosition > $(pp_images).size()) nextImage.src = pp_images[setPosition + 1];
                        prevImage = new Image();
                        if(isSet && pp_images[setPosition - 1]) prevImage.src = pp_images[setPosition - 1];

                        $pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup;
                        $pp_pic_holder.find('#fullResImage').attr('src',pp_images[setPosition]);

                        imgPreloader.onload = function(){
                            // Fit item to viewport
                            correctSizes = _fitToViewport(imgPreloader.width,imgPreloader.height);

                            _showContent();
                        };

                        imgPreloader.onerror = function(){
                            alert_error(get_string('image-incorrect'));
                            $.prettyPhoto.close();
                        };
					
                        imgPreloader.src = pp_images[setPosition];
                        break;
				
                    case 'youtube':
                        correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport

                        movie = 'http://www.youtube.com/v/'+grab_param('v',pp_images[setPosition]);
                        if(settings.autoplay) movie += "&autoplay=1";
					
                        toInject = settings.flash_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
                        break;
				
                    case 'vimeo':
                        correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
					
                        movie_id = pp_images[setPosition];
                        movie = 'http://vimeo.com/moogaloop.swf?clip_id='+ movie_id.replace('http://vimeo.com/','');
                        if(settings.autoplay) movie += "&autoplay=1";
				
                        toInject = settings.flash_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
                        break;
				
                    case 'quicktime':
                        correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
                        correctSizes['height']+=15;
                        correctSizes['contentHeight']+=15;
                        correctSizes['containerHeight']+=15; // Add space for the control bar
				
                        toInject = settings.quicktime_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[setPosition]).replace(/{autoplay}/g,settings.autoplay);
                        break;
				
                    case 'flash':
                        correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
					
                        flash_vars = pp_images[setPosition];
                        flash_vars = flash_vars.substring(pp_images[setPosition].indexOf('flashvars') + 10,pp_images[setPosition].length);

                        filename = pp_images[setPosition];
                        filename = filename.substring(0,filename.indexOf('?'));
					
                        toInject =  settings.flash_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
                        break;
				
                    case 'iframe':
                        correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
				
                        frame_url = pp_images[setPosition];
                        frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
				
                        toInject = settings.iframe_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{path}/g,frame_url);
                        break;
				
                    case 'inline':
                        // to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
                        myClone = $(pp_images[setPosition]).clone().css({
                            'width':settings.default_width
                            }).wrapInner('<div id="pp_full_res"><div class="pp_inline clearfix"></div></div>').appendTo($('body'));
                        correctSizes = _fitToViewport($(myClone).width(),$(myClone).height());
                        $(myClone).remove();
                        toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[setPosition]).html());
                        break;
                };

                if(!imgPreloader){
                    $pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
				
                    // Show content
                    _showContent();
                };
            });

            return false;
        };

	
        /**
		* Change page in the prettyPhoto modal box
		* @param direction {String} Direction of the paging, previous or next.
		*/
        $.prettyPhoto.changePage = function(direction){
            currentGalleryPage = 0;
			
            if(direction == 'previous') {
                setPosition--;
                if (setPosition < 0){
                    setPosition = 0;
                    return;
                };
            }else if(direction == 'next'){
                if(pp_slideshow && $('.pp_arrow_next').is('.disabled')) {
                    setPosition = -1;
                }else if($('.pp_arrow_next').is('.disabled')){
                    return;
                }
                setPosition++;
            }else{
                setPosition=direction;
            };

            if(!doresize) doresize = true; // Allow the resizing of the images

            _hideContent(function(){
                $.prettyPhoto.open();
            });
        };


        /**
		* Change gallery page in the prettyPhoto modal box
		* @param direction {String} Direction of the paging, previous or next.
		*/
        $.prettyPhoto.changeGalleryPage = function(direction){
            if(direction=='next'){
                currentGalleryPage ++;

                if(currentGalleryPage > totalPage){
                    currentGalleryPage = 0;
                };
            }else if(direction=='previous'){
                currentGalleryPage --;

                if(currentGalleryPage < 0){
                    currentGalleryPage = totalPage;
                };
            };
			
            // Slide the pages, logic ++
            $pp_pic_holder.find('.pp_gallery li').each(function(i){
                $(this).animate({
                    'left': (i * itemWidth) - ((itemsPerPage * itemWidth) * currentGalleryPage)
                });
            });
        };


        /**
		* Start the slideshow...
		*/
        $.prettyPhoto.startSlideshow = function(){
            if(typeof pp_slideshow == 'undefined'){
                $pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){
                    $.prettyPhoto.stopSlideshow();
                    return false;
                });
            }else{
                $.prettyPhoto.changePage('next');
            };
			
            pp_slideshow = setTimeout($.prettyPhoto.startSlideshow,settings.slideshow);
        }


        /**
		* Stop the slideshow...
		*/
        $.prettyPhoto.stopSlideshow = function(){
            $pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){
                $.prettyPhoto.startSlideshow();
                return false;
            });
            clearTimeout(pp_slideshow);
        }


        /**
		* Closes the prettyPhoto modal box.
		*/
        $.prettyPhoto.close = function(){
            clearTimeout(pp_slideshow);
			
            $pp_pic_holder.find('object,embed').css('visibility','hidden');
			
            $('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animationSpeed,function(){
                $(this).remove();
            });
			
            $pp_overlay.fadeOut(settings.animationSpeed, function(){
                if($.browser.msie && $.browser.version == 6) $('select').css('visibility','visible'); // To fix the bug with IE select boxes
				
                if(settings.hideflash) $('object,embed').css('visibility','visible'); // Show the flash
				
                $(this).remove(); // No more need for the prettyPhoto markup
				
                settings.callback();
				
                doresize = true;
				
                delete settings;
            });
        };
	
        /**
		* Set the proper sizes on the containers and animate the content in.
		*/
        _showContent = function(){
            $('.pp_loaderIcon').hide();
			
            $ppt.fadeTo(settings.animationSpeed,1);

            // Calculate the opened top position of the pic holder
            projectedTop = scrollPos['scrollTop'] + ((windowHeight/2) - (correctSizes['containerHeight']/2));
            if(projectedTop < 0) projectedTop = 0;

            // Resize the content holder
            $pp_pic_holder.find('.pp_content').animate({
                'height':correctSizes['contentHeight']
                },settings.animationSpeed);
			
            // Resize picture the holder
            $pp_pic_holder.animate({
                'top': projectedTop,
                'left': (windowWidth/2) - (correctSizes['containerWidth']/2),
                'width': correctSizes['containerWidth']
            },settings.animationSpeed,function(){
                $pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(correctSizes['height']).width(correctSizes['width']);

                $pp_pic_holder.find('.pp_fade').fadeIn(settings.animationSpeed); // Fade the new content

                // Show the nav
                if(isSet && _getFileType(pp_images[setPosition])=="image") {
                    $pp_pic_holder.find('.pp_hoverContainer').show();
                }else{
                    $pp_pic_holder.find('.pp_hoverContainer').hide();
                }
			
                if(correctSizes['resized']) $('a.pp_expand,a.pp_contract').fadeIn(settings.animationSpeed); // Fade the resizing link if the image is resized
				
                settings.changepicturecallback(); // Callback!
            });
			
            if(isSet && settings.overlay_gallery && _getFileType(pp_images[setPosition])=="image") {
                itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
                navWidth = (settings.theme == "facebook") ? 58 : 38; // Define the arrow width depending on the theme
				
                itemsPerPage = Math.floor((correctSizes['containerWidth'] - 100 - navWidth) / itemWidth);
                itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length;
                totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1;

                // Hide the nav in the case there's no need for links
                if(totalPage == 0){
                    navWidth = 0; // No nav means no width!
                    $pp_pic_holder.find('.pp_gallery .pp_arrow_next,.pp_gallery .pp_arrow_previous').hide();
                }else{
                    navWidth = (settings.theme == "facebook") ? 58 : 38; // Define the arrow width
					
                    $pp_pic_holder.find('.pp_gallery .pp_arrow_next,.pp_gallery .pp_arrow_previous').show();
                };

                galleryWidth = itemsPerPage * itemWidth + navWidth;
				
                // Set the proper width to the gallery items
                $pp_pic_holder.find('.pp_gallery')
                .width(galleryWidth)
                .css('margin-left',-(galleryWidth/2));
					
                $pp_pic_holder.find('.pp_gallery ul').width(itemsPerPage * itemWidth);
				
                // Reposition the LIs
                $pp_pic_holder.find('.pp_gallery ul li').each(function(i){
                    $(this).css({
                        'position':'absolute',
                        'left': i * itemWidth
                    });
                });
            }else{
                $pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');
                $pp_pic_holder.find('.pp_gallery').hide();
            };
            $pp_pic_holder.find('.pp_gallery').hide();
			
            if(settings.autoplay_slideshow) {
                pp_slideshow = clearTimeout(pp_slideshow);
                $.prettyPhoto.startSlideshow();
                settings.autoplay_slideshow = false; // Because we only want it to autostart on the first opening.
            };
        };
		
        /**
		* Hide the content...DUH!
		*/
        function _hideContent(callback){
            // Fade out the current picture
            $pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');
            $pp_pic_holder.find('.pp_fade').fadeOut(settings.animationSpeed,function(){
                $('.pp_loaderIcon').show();
				
                callback();
            });
        };
	
        /**
		* Check the item position in the gallery array, hide or show the navigation links
		* @param setCount {integer} The total number of items in the set
		*/
        function _checkPosition(setCount){
            // If at the end, hide the next link
            if(setPosition == setCount-1) {
                $pp_pic_holder.find('a.pp_next').css('visibility','hidden');
                $pp_pic_holder.find('.pp_nav a.pp_arrow_next').addClass('disabled').unbind('click');
            }else{ 
                $pp_pic_holder.find('a.pp_next').css('visibility','visible');
                $pp_pic_holder.find('.pp_nav a.pp_arrow_next.disabled').removeClass('disabled').bind('click',function(){
                    $.prettyPhoto.changePage('next');
                    return false;
                });
            };
		
            // If at the beginning, hide the previous link
            if(setPosition == 0) {
                $pp_pic_holder.find('a.pp_previous').css('visibility','hidden');
                $pp_pic_holder.find('.pp_nav a.pp_arrow_previous').addClass('disabled').unbind('click');
            }else{
                $pp_pic_holder.find('a.pp_previous').css('visibility','visible');
                $pp_pic_holder.find('.pp_nav a.pp_arrow_previous.disabled').removeClass('disabled').bind('click',function(){
                    $.prettyPhoto.changePage('previous');
                    return false;
                });
            };
			
            (setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide(); // Hide the bottom nav if it's not a set.
        };
	
        /**
		* Resize the item dimensions if it's bigger than the viewport
		* @param width {integer} Width of the item to be opened
		* @param height {integer} Height of the item to be opened
		* @return An array containin the "fitted" dimensions
		*/
        function _fitToViewport(width,height){
            resized = false;

            _getDimensions(width,height);
			
            // Define them in case there's no resize needed
            imageWidth = width, imageHeight = height;

            if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allowresize && !percentBased) {
                resized = true, fitting = false;
			
                while (!fitting){
                    if((pp_containerWidth > windowWidth)){
                        imageWidth = (windowWidth - 200);
                        imageHeight = (height/width) * imageWidth;
                    }else if((pp_containerHeight > windowHeight)){
                        imageHeight = (windowHeight - 200);
                        imageWidth = (width/height) * imageHeight;
                    }else{
                        fitting = true;
                    };

                    pp_containerHeight = imageHeight, pp_containerWidth = imageWidth;
                };
			
                _getDimensions(imageWidth,imageHeight);
            };

            return {
                width:Math.floor(imageWidth),
                height:Math.floor(imageHeight),
                containerHeight:Math.floor(pp_containerHeight),
                containerWidth:Math.floor(pp_containerWidth) + 40, // 40 behind the side padding
                contentHeight:Math.floor(pp_contentHeight),
                contentWidth:Math.floor(pp_contentWidth),
                resized:resized
            };
        };
		
        /**
		* Get the containers dimensions according to the item size
		* @param width {integer} Width of the item to be opened
		* @param height {integer} Height of the item to be opened
		*/
        function _getDimensions(width,height){
            width = parseFloat(width);
            height = parseFloat(height);
			
            // Get the details height, to do so, I need to clone it since it's invisible
            $pp_details = $pp_pic_holder.find('.pp_details');
            $pp_details.width(width);
            detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
            $pp_details = $pp_details.clone().appendTo($('body')).css({
                'position':'absolute',
                'top':-10000
            });
            detailsHeight += $pp_details.height();
            detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; // Min-height for the details
            if($.browser.msie && $.browser.version==7) detailsHeight+=8;
            $pp_details.remove();
			
            // Get the container size, to resize the holder to the right dimensions
            pp_contentHeight = height + detailsHeight;
            pp_contentWidth = width;
            pp_containerHeight = pp_contentHeight + $ppt.height() + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
            pp_containerWidth = width;
        }
	
        function _getFileType(itemSrc){
            if (itemSrc.match(/youtube\.com\/watch/i)) {
                return 'youtube';
            }else if (itemSrc.match(/vimeo\.com/i)) {
                return 'vimeo';
            }else if(itemSrc.indexOf('.mov') != -1){ 
                return 'quicktime';
            }else if(itemSrc.indexOf('.swf') != -1){
                return 'flash';
            }else if(itemSrc.indexOf('iframe') != -1){
                return 'iframe'
            }else if(itemSrc.substr(0,1) == '#'){
                return 'inline';
            }else{
                return 'image';
            };
        };
	
        function _centerOverlay(){
            if(doresize && typeof $pp_pic_holder != 'undefined') {
                titleHeight = $ppt.height(), contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();
				
                projectedTop = (windowHeight/2) + scrollPos['scrollTop'] - (contentHeight/2);
				
                $pp_pic_holder.css({
                    'top': projectedTop,
                    'left': (windowWidth/2) + scrollPos['scrollLeft'] - (contentwidth/2)
                });
            };
        };
	
        function _getScroll(){
            if (self.pageYOffset) {
                return {
                    scrollTop:self.pageYOffset,
                    scrollLeft:self.pageXOffset
                    };
            } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
                return {
                    scrollTop:document.documentElement.scrollTop,
                    scrollLeft:document.documentElement.scrollLeft
                    };
            } else if (document.body) {// all other Explorers
                return {
                    scrollTop:document.body.scrollTop,
                    scrollLeft:document.body.scrollLeft
                    };
            };
        };
	
        function _resizeOverlay() {
            windowHeight = $(window).height(), windowWidth = $(window).width();
			
            if(typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height());
        };
	
        function _buildOverlay(caller){
            // Find out if the picture is part of a set
            theRel = $(caller).attr('rel');
            galleryRegExp = /\[(?:.*)\]/;
            isSet = (galleryRegExp.exec(theRel)) ? true : false;
			
            // Put the SRCs, TITLEs, ALTs into an array.
            pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i){
                if($(n).attr('rel').indexOf(theRel) != -1) return $(n).attr('href');
            }) : $.makeArray($(caller).attr('href'));
            pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i){
                if($(n).attr('rel').indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : "";
            }) : $.makeArray($(caller).find('img').attr('alt'));
            pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){
                if($(n).attr('rel').indexOf(theRel) != -1) return ($(n).attr('title')) ? $(n).attr('title') : "";
            }) : $.makeArray($(caller).attr('title'));
			
            $('body').append(settings.markup); // Inject the markup
			
            $pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay = $('div.pp_overlay'); // Set my global selectors
			
            // Inject the inline gallery!
            if(isSet && settings.overlay_gallery) {
                currentGalleryPage = 0;
                toInject = "";
                for (var i=0; i < pp_images.length; i++) {
                    var regex = new RegExp("(.*?)\.(jpg|jpeg|png|gif)$");
                    pp_images[i] = pp_images[i].toLowerCase();
                    var results = regex.exec( pp_images[i] );
                    if(!results){
                        classname = 'default';
                    }else{
                        classname = '';
                    }
                    toInject += "<li class='"+classname+"'><a href='#'><img src='" + pp_images[i] + "' width='50' alt='' /></a></li>";
                };
				
                toInject = settings.gallery_markup.replace(/{gallery}/g,toInject);
				
                $pp_pic_holder.find('#pp_full_res').after(toInject);
				
                $pp_pic_holder.find('.pp_gallery .pp_arrow_next').click(function(){
                    $.prettyPhoto.changeGalleryPage('next');
                    $.prettyPhoto.stopSlideshow();
                    return false;
                });
				
                $pp_pic_holder.find('.pp_gallery .pp_arrow_previous').click(function(){
                    $.prettyPhoto.changeGalleryPage('previous');
                    $.prettyPhoto.stopSlideshow();
                    return false;
                });
				
                $pp_pic_holder.find('.pp_content').hover(
                    function(){
                        $pp_pic_holder.find('.pp_gallery').fadeIn();
                    },
                    function(){
                        $pp_pic_holder.find('.pp_gallery').fadeOut();
                    });

                itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
                $pp_pic_holder.find('.pp_gallery ul li').each(function(i){
                    $(this).css({
                        'position':'absolute',
                        'left': i * itemWidth
                    });

                    $(this).find('a').unbind('click').click(function(){
                        $.prettyPhoto.changePage(i);
                        $.prettyPhoto.stopSlideshow();
                        return false;
                    });
                });
            };
			
			
            // Inject the play/pause if it's a slideshow
            if(settings.slideshow){
                $pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
                $pp_pic_holder.find('.pp_nav .pp_play').click(function(){
                    $.prettyPhoto.startSlideshow();
                    return false;
                });
            }
			
            $pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme
			
            $pp_overlay
            .css({
                'opacity':0,
                'height':$(document).height(),
                'width':$(document).width()
            })
            .bind('click',function(){
                if(!settings.modal) $.prettyPhoto.close();
            });

            $('a.pp_close').bind('click',function(){
                $.prettyPhoto.close();
                return false;
            });

            $('a.pp_expand').bind('click',function(e){
                // Expand the image
                if($(this).hasClass('pp_expand')){
                    $(this).removeClass('pp_expand').addClass('pp_contract');
                    doresize = false;
                }else{
                    $(this).removeClass('pp_contract').addClass('pp_expand');
                    doresize = true;
                };
			
                _hideContent(function(){
                    $.prettyPhoto.open();
                });
		
                return false;
            });
		
            $pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){
                $.prettyPhoto.changePage('previous');
                $.prettyPhoto.stopSlideshow();
                return false;
            });
		
            $pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){
                $.prettyPhoto.changePage('next');
                $.prettyPhoto.stopSlideshow();
                return false;
            });                        
			
            _centerOverlay(); // Center it
        };
		
        return this.unbind('click').click($.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
    };
	
    function grab_param(name,url){
        name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
        var regexS = "[\\?&]"+name+"=([^&#]*)";
        var regex = new RegExp( regexS );
        var results = regex.exec( url );
        return ( results == null ) ? "" : results[1];
    }
	
})(jQuery);;



/*!
 * slideViewer 1.2
 * Examples and documentation at: 
 * http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html
 * 2007-2010 Gian Carlo Mingati
 * Version: 1.2.3 (9-JULY-2010)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Requires:
 * jQuery v1.4.1 or later, jquery.easing.1.2
 * 
 */

jQuery(function(){
   jQuery("div.svw").prepend("<img src='spinner.gif' class='ldrgif' alt='loading...'/ >"); 
});
var j = 0;
var quantofamo = 0;
jQuery.fn.slideView = function(settings) {
	settings = jQuery.extend({
		easeFunc: "easeInOutExpo",
		easeTime: 750,
		uiBefore: false,
		toolTip: false,
		ttOpacity: 0.9
	}, settings);
	return this.each(function(){
		var container = jQuery(this);
		container.find("img.ldrgif").remove();
		container.removeClass("svw").addClass("stripViewer");		
		var pictWidth = container.find("img").width();
		var pictHeight = container.find("img").height();
		var pictEls = container.find("li").size();
		var stripViewerWidth = pictWidth*pictEls;
		container.find("ul").css("width" , stripViewerWidth);
		container.css("width" , pictWidth);
		container.css("height" , pictHeight);
		container.each(function(i) {
    (!settings.uiBefore) ? jQuery(this).after("<div class='stripTransmitter' id='stripTransmitter" + (j) + "'><ul><\/ul><\/div>") : jQuery(this).before("<div class='stripTransmitter' id='stripTransmitter" + (j) + "'><ul><\/ul><\/div>");			
		jQuery(this).find("li").each(function(n) {
		jQuery("div#stripTransmitter" + j + " ul").append("<li><a title='" + jQuery(this).find("img").attr("alt") + "' href='#'>"+(n+1)+"<\/a><\/li>");												
		});
		jQuery("div#stripTransmitter" + j + " a").each(function(z) {
		jQuery(this).bind("click", function(){		
		jQuery(this).addClass("current").parent().parent().find("a").not(jQuery(this)).removeClass("current"); // wow!
		var cnt = -(pictWidth*z);
		container.find("ul").animate({ left: cnt}, settings.easeTime, settings.easeFunc);
		return false;
		});
		});
		
		
		container.bind("click", function(e){
			var ui = (!settings.uiBefore) ? jQuery(this).next().find("a.current") : jQuery(this).prev().find("a.current");
			var bTotal = parseFloat(jQuery(this).css('borderLeftWidth').replace("px", "")) +  parseFloat(jQuery(this).css('borderRightWidth').replace("px", ""));
			var dOs = jQuery(this).offset();
			var zeroLeft = (bTotal/2 + pictWidth) - (e.pageX - dOs.left);
			if(zeroLeft >= pictWidth/2) { 
				var uiprev = ui.parent().prev().find("a");	
				(jQuery(uiprev).length != 0)? uiprev.trigger("click") : ui.parent().parent().find("a:last").trigger("click");							
			} 
			else {
				var uinext = ui.parent().next().find("a");
			  (jQuery(uinext).length != 0)? uinext.trigger("click") : ui.parent().parent().find("a:first").trigger("click");
			}
		});
		
		
		jQuery("div#stripTransmitter" + j).css("width" , pictWidth);
		jQuery("div#stripTransmitter" + j + " a:first").addClass("current");
		jQuery('body').append('<div class="tooltip" style="display:none;"><\/div>');
		

		if(settings.toolTip){
		var aref = jQuery("div#stripTransmitter" + j + " a");

		aref.live('mousemove', function(e) {
		var att = jQuery(this).attr('title');
		posX=e.pageX+10;
		posY=e.pageY+10;
		jQuery('.tooltip').html(att).css({'position': 'absolute', 'top': posY+'px', 'left': posX+'px', 'display': 'block', 'opacity': settings.ttOpacity});
		});
		aref.live('mouseout', function() {
		jQuery('.tooltip').hide();
		});				
		}
		});
		j++;
	});	
};;



/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright ÂŠ 2008 George McGinley Smith
 * All rights reserved.

*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});;



/**
 * jQuery Galleriffic plugin
 *
 * Copyright (c) 2008 Trent Foley (http://trentacular.com)
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Much thanks to primary contributer Ponticlaro (http://www.ponticlaro.com)
 */
;(function($) {
	// Globally keep track of all images by their unique hash.  Each item is an image data object.
	var allImages = {};
	var imageCounter = 0;

	// Galleriffic static class
	$.galleriffic = {
		version: '2.0.1',

		// Strips invalid characters and any leading # characters
		normalizeHash: function(hash) {
			return hash.replace(/^.*#/, '').replace(/\?.*$/, '');
		},

		getImage: function(hash) {
			if (!hash)
				return undefined;

			hash = $.galleriffic.normalizeHash(hash);
			return allImages[hash];
		},

		// Global function that looks up an image by its hash and displays the image.
		// Returns false when an image is not found for the specified hash.
		// @param {String} hash This is the unique hash value assigned to an image.
		gotoImage: function(hash) {
			var imageData = $.galleriffic.getImage(hash);
			if (!imageData)
				return false;

			var gallery = imageData.gallery;
			gallery.gotoImage(imageData);
			
			return true;
		},

		// Removes an image from its respective gallery by its hash.
		// Returns false when an image is not found for the specified hash or the
		// specified owner gallery does match the located images gallery.
		// @param {String} hash This is the unique hash value assigned to an image.
		// @param {Object} ownerGallery (Optional) When supplied, the located images
		// gallery is verified to be the same as the specified owning gallery before
		// performing the remove operation.
		removeImageByHash: function(hash, ownerGallery) {
			var imageData = $.galleriffic.getImage(hash);
			if (!imageData)
				return false;

			var gallery = imageData.gallery;
			if (ownerGallery && ownerGallery != gallery)
				return false;

			return gallery.removeImageByIndex(imageData.index);
		}
	};

	var defaults = {
		delay:                     3000,
		numThumbs:                 20,
		preloadAhead:              40, // Set to -1 to preload all images
		enableTopPager:            false,
		enableBottomPager:         true,
		maxPagesToShow:            7,
		imageContainerSel:         '',
		captionContainerSel:       '',
		controlsContainerSel:      '',
		loadingContainerSel:       '',
		renderSSControls:          true,
		renderNavControls:         true,
		playLinkText:              'Play',
		pauseLinkText:             'Pause',
		prevLinkText:              'Previous',
		nextLinkText:              'Next',
		nextPageLinkText:          'Next &rsaquo;',
		prevPageLinkText:          '&lsaquo; Prev',
		enableHistory:             false,
		enableKeyboardNavigation:  true,
		autoStart:                 false,
		syncTransitions:           false,
		defaultTransitionDuration: 1000,
		onSlideChange:             undefined, // accepts a delegate like such: function(prevIndex, nextIndex) { ... }
		onTransitionOut:           undefined, // accepts a delegate like such: function(slide, caption, isSync, callback) { ... }
		onTransitionIn:            undefined, // accepts a delegate like such: function(slide, caption, isSync) { ... }
		onPageTransitionOut:       undefined, // accepts a delegate like such: function(callback) { ... }
		onPageTransitionIn:        undefined, // accepts a delegate like such: function() { ... }
		onImageAdded:              undefined, // accepts a delegate like such: function(imageData, $li) { ... }
		onImageRemoved:            undefined  // accepts a delegate like such: function(imageData, $li) { ... }
	};

	// Primary Galleriffic initialization function that should be called on the thumbnail container.
	$.fn.galleriffic = function(settings) {
		//  Extend Gallery Object
		$.extend(this, {
			// Returns the version of the script
			version: $.galleriffic.version,

			// Current state of the slideshow
			isSlideshowRunning: false,
			slideshowTimeout: undefined,

			// This function is attached to the click event of generated hyperlinks within the gallery
			clickHandler: function(e, link) {
				this.pause();

				if (!this.enableHistory) {
					// The href attribute holds the unique hash for an image
					var hash = $.galleriffic.normalizeHash($(link).attr('href'));
					$.galleriffic.gotoImage(hash);
					e.preventDefault();
				}
			},

			// Appends an image to the end of the set of images.  Argument listItem can be either a jQuery DOM element or arbitrary html.
			// @param listItem Either a jQuery object or a string of html of the list item that is to be added to the gallery.
			appendImage: function(listItem) {
				this.addImage(listItem, false, false);
				return this;
			},

			// Inserts an image into the set of images.  Argument listItem can be either a jQuery DOM element or arbitrary html.
			// @param listItem Either a jQuery object or a string of html of the list item that is to be added to the gallery.
			// @param {Integer} position The index within the gallery where the item shouold be added.
			insertImage: function(listItem, position) {
				this.addImage(listItem, false, true, position);
				return this;
			},

			// Adds an image to the gallery and optionally inserts/appends it to the DOM (thumbExists)
			// @param listItem Either a jQuery object or a string of html of the list item that is to be added to the gallery.
			// @param {Boolean} thumbExists Specifies whether the thumbnail already exists in the DOM or if it needs to be added.
			// @param {Boolean} insert Specifies whether the the image is appended to the end or inserted into the gallery.
			// @param {Integer} position The index within the gallery where the item shouold be added.
			addImage: function(listItem, thumbExists, insert, position) {
				var $li = ( typeof listItem === "string" ) ? $(listItem) : listItem;				
				var $aThumb = $li.find('a.thumb');
				var slideUrl = $aThumb.attr('href');
				var title = $aThumb.attr('title');
				var $caption = $li.find('.caption').remove();
				var hash = $aThumb.attr('name');

				// Increment the image counter
				imageCounter++;

				// Autogenerate a hash value if none is present or if it is a duplicate
				if (!hash || allImages[''+hash]) {
					hash = imageCounter;
				}

				// Set position to end when not specified
				if (!insert)
					position = this.data.length;
				
				var imageData = {
					title:title,
					slideUrl:slideUrl,
					caption:$caption,
					hash:hash,
					gallery:this,
					index:position
				};

				// Add the imageData to this gallery's array of images
				if (insert) {
					this.data.splice(position, 0, imageData);

					// Reset index value on all imageData objects
					this.updateIndices(position);
				}
				else {
					this.data.push(imageData);
				}

				var gallery = this;

				// Add the element to the DOM
				if (!thumbExists) {
					// Update thumbs passing in addition post transition out handler
					this.updateThumbs(function() {
						var $thumbsUl = gallery.find('ul.thumbs');
						if (insert)
							$thumbsUl.children(':eq('+position+')').before($li);
						else
							$thumbsUl.append($li);
						
						if (gallery.onImageAdded)
							gallery.onImageAdded(imageData, $li);
					});
				}

				// Register the image globally
				allImages[''+hash] = imageData;

				// Setup attributes and click handler
				$aThumb.attr('rel', 'history')
					.attr('href', '#'+hash)
					.removeAttr('name')
					.click(function(e) {
						gallery.clickHandler(e, this);
					});

				return this;
			},

			// Removes an image from the gallery based on its index.
			// Returns false when the index is out of range.
			removeImageByIndex: function(index) {
				if (index < 0 || index >= this.data.length)
					return false;
				
				var imageData = this.data[index];
				if (!imageData)
					return false;
				
				this.removeImage(imageData);
				
				return true;
			},

			// Convenience method that simply calls the global removeImageByHash method.
			removeImageByHash: function(hash) {
				return $.galleriffic.removeImageByHash(hash, this);
			},

			// Removes an image from the gallery.
			removeImage: function(imageData) {
				var index = imageData.index;
				
				// Remove the image from the gallery data array
				this.data.splice(index, 1);
				
				// Remove the global registration
				delete allImages[''+imageData.hash];
				
				// Remove the image's list item from the DOM
				this.updateThumbs(function() {
					var $li = gallery.find('ul.thumbs')
						.children(':eq('+index+')')
						.remove();

					if (gallery.onImageRemoved)
						gallery.onImageRemoved(imageData, $li);
				});

				// Update each image objects index value
				this.updateIndices(index);

				return this;
			},

			// Updates the index values of the each of the images in the gallery after the specified index
			updateIndices: function(startIndex) {
				for (i = startIndex; i < this.data.length; i++) {
					this.data[i].index = i;
				}
				
				return this;
			},

			// Scraped the thumbnail container for thumbs and adds each to the gallery
			initializeThumbs: function() {
				this.data = [];
				var gallery = this;

				this.find('ul.thumbs > li').each(function(i) {
					gallery.addImage($(this), true, false);
				});

				return this;
			},

			isPreloadComplete: false,

			// Initalizes the image preloader
			preloadInit: function() {
				if (this.preloadAhead == 0) return this;
				
				this.preloadStartIndex = this.currentImage.index;
				var nextIndex = this.getNextIndex(this.preloadStartIndex);
				return this.preloadRecursive(this.preloadStartIndex, nextIndex);
			},

			// Changes the location in the gallery the preloader should work
			// @param {Integer} index The index of the image where the preloader should restart at.
			preloadRelocate: function(index) {
				// By changing this startIndex, the current preload script will restart
				this.preloadStartIndex = index;
				return this;
			},

			// Recursive function that performs the image preloading
			// @param {Integer} startIndex The index of the first image the current preloader started on.
			// @param {Integer} currentIndex The index of the current image to preload.
			preloadRecursive: function(startIndex, currentIndex) {
				// Check if startIndex has been relocated
				if (startIndex != this.preloadStartIndex) {
					var nextIndex = this.getNextIndex(this.preloadStartIndex);
					return this.preloadRecursive(this.preloadStartIndex, nextIndex);
				}

				var gallery = this;

				// Now check for preloadAhead count
				var preloadCount = currentIndex - startIndex;
				if (preloadCount < 0)
					preloadCount = this.data.length-1-startIndex+currentIndex;
				if (this.preloadAhead >= 0 && preloadCount > this.preloadAhead) {
					// Do this in order to keep checking for relocated start index
					setTimeout(function() { gallery.preloadRecursive(startIndex, currentIndex); }, 500);
					return this;
				}

				var imageData = this.data[currentIndex];
				if (!imageData)
					return this;

				// If already loaded, continue
				if (imageData.image)
					return this.preloadNext(startIndex, currentIndex); 
				
				// Preload the image
				var image = new Image();
				
				image.onload = function() {
					imageData.image = this;
					gallery.preloadNext(startIndex, currentIndex);
				};

				image.alt = imageData.title;
				image.src = imageData.slideUrl;

				return this;
			},
			
			// Called by preloadRecursive in order to preload the next image after the previous has loaded.
			// @param {Integer} startIndex The index of the first image the current preloader started on.
			// @param {Integer} currentIndex The index of the current image to preload.
			preloadNext: function(startIndex, currentIndex) {
				var nextIndex = this.getNextIndex(currentIndex);
				if (nextIndex == startIndex) {
					this.isPreloadComplete = true;
				} else {
					// Use setTimeout to free up thread
					var gallery = this;
					setTimeout(function() { gallery.preloadRecursive(startIndex, nextIndex); }, 100);
				}

				return this;
			},

			// Safe way to get the next image index relative to the current image.
			// If the current image is the last, returns 0
			getNextIndex: function(index) {
				var nextIndex = index+1;
				if (nextIndex >= this.data.length)
					nextIndex = 0;
				return nextIndex;
			},

			// Safe way to get the previous image index relative to the current image.
			// If the current image is the first, return the index of the last image in the gallery.
			getPrevIndex: function(index) {
				var prevIndex = index-1;
				if (prevIndex < 0)
					prevIndex = this.data.length-1;
				return prevIndex;
			},

			// Pauses the slideshow
			pause: function() {
				this.isSlideshowRunning = false;
				if (this.slideshowTimeout) {
					clearTimeout(this.slideshowTimeout);
					this.slideshowTimeout = undefined;
				}

				if (this.$controlsContainer) {
					this.$controlsContainer
						.find('div.ss-controls a').removeClass().addClass('play')
						.attr('title', this.playLinkText)
						.attr('href', '#play')
						.html(this.playLinkText);
				}
				
				return this;
			},

			// Plays the slideshow
			play: function() {
				this.isSlideshowRunning = true;

				if (this.$controlsContainer) {
					this.$controlsContainer
						.find('div.ss-controls a').removeClass().addClass('pause')
						.attr('title', this.pauseLinkText)
						.attr('href', '#pause')
						.html(this.pauseLinkText);
				}

				if (!this.slideshowTimeout) {
					var gallery = this;
					this.slideshowTimeout = setTimeout(function() { gallery.ssAdvance(); }, this.delay);
				}

				return this;
			},

			// Toggles the state of the slideshow (playing/paused)
			toggleSlideshow: function() {
				if (this.isSlideshowRunning)
					this.pause();
				else
					this.play();

				return this;
			},

			// Advances the slideshow to the next image and delegates navigation to the
			// history plugin when history is enabled
			// enableHistory is true
			ssAdvance: function() {
				if (this.isSlideshowRunning)
					this.next(true);

				return this;
			},

			// Advances the gallery to the next image.
			// @param {Boolean} dontPause Specifies whether to pause the slideshow.
			// @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled.  
			next: function(dontPause, bypassHistory) {
				this.gotoIndex(this.getNextIndex(this.currentImage.index), dontPause, bypassHistory);
				return this;
			},

			// Navigates to the previous image in the gallery.
			// @param {Boolean} dontPause Specifies whether to pause the slideshow.
			// @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled.
			previous: function(dontPause, bypassHistory) {
				this.gotoIndex(this.getPrevIndex(this.currentImage.index), dontPause, bypassHistory);
				return this;
			},

			// Navigates to the next page in the gallery.
			// @param {Boolean} dontPause Specifies whether to pause the slideshow.
			// @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled.
			nextPage: function(dontPause, bypassHistory) {
				var page = this.getCurrentPage();
				var lastPage = this.getNumPages() - 1;
				if (page < lastPage) {
					var startIndex = page * this.numThumbs;
					var nextPage = startIndex + this.numThumbs;
					this.gotoIndex(nextPage, dontPause, bypassHistory);
				}

				return this;
			},

			// Navigates to the previous page in the gallery.
			// @param {Boolean} dontPause Specifies whether to pause the slideshow.
			// @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled.
			previousPage: function(dontPause, bypassHistory) {
				var page = this.getCurrentPage();
				if (page > 0) {
					var startIndex = page * this.numThumbs;
					var prevPage = startIndex - this.numThumbs;				
					this.gotoIndex(prevPage, dontPause, bypassHistory);
				}
				
				return this;
			},

			// Navigates to the image at the specified index in the gallery
			// @param {Integer} index The index of the image in the gallery to display.
			// @param {Boolean} dontPause Specifies whether to pause the slideshow.
			// @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled.
			gotoIndex: function(index, dontPause, bypassHistory) {
				if (!dontPause)
					this.pause();
				
				if (index < 0) index = 0;
				else if (index >= this.data.length) index = this.data.length-1;
				
				var imageData = this.data[index];
				
				if (!bypassHistory && this.enableHistory)
					$.historyLoad(String(imageData.hash));  // At the moment, historyLoad only accepts string arguments
				else
					this.gotoImage(imageData);

				return this;
			},

			// This function is garaunteed to be called anytime a gallery slide changes.
			// @param {Object} imageData An object holding the image metadata of the image to navigate to.
			gotoImage: function(imageData) {
				var index = imageData.index;

				if (this.onSlideChange)
					this.onSlideChange(this.currentImage.index, index);
				
				this.currentImage = imageData;
				this.preloadRelocate(index);
				
				this.refresh();
				
				return this;
			},

			// Returns the default transition duration value.  The value is halved when not
			// performing a synchronized transition.
			// @param {Boolean} isSync Specifies whether the transitions are synchronized.
			getDefaultTransitionDuration: function(isSync) {
				if (isSync)
					return this.defaultTransitionDuration;
				return this.defaultTransitionDuration / 2;
			},

			// Rebuilds the slideshow image and controls and performs transitions
			refresh: function() {
				var imageData = this.currentImage;
				if (!imageData)
					return this;

				var index = imageData.index;

				// Update Controls
				if (this.$controlsContainer) {
					this.$controlsContainer
						.find('div.nav-controls a.prev').attr('href', '#'+this.data[this.getPrevIndex(index)].hash).end()
						.find('div.nav-controls a.next').attr('href', '#'+this.data[this.getNextIndex(index)].hash);
				}

				var previousSlide = this.$imageContainer.find('span.current').addClass('previous').removeClass('current');
				var previousCaption = 0;

				if (this.$captionContainer) {
					previousCaption = this.$captionContainer.find('span.current').addClass('previous').removeClass('current');
				}

				// Perform transitions simultaneously if syncTransitions is true and the next image is already preloaded
				var isSync = this.syncTransitions && imageData.image;

				// Flag we are transitioning
				var isTransitioning = true;
				var gallery = this;

				var transitionOutCallback = function() {
					// Flag that the transition has completed
					isTransitioning = false;

					// Remove the old slide
					previousSlide.remove();

					// Remove old caption
					if (previousCaption)
						previousCaption.remove();

					if (!isSync) {
						if (imageData.image && imageData.hash == gallery.data[gallery.currentImage.index].hash) {
							gallery.buildImage(imageData, isSync);
						} else {
							// Show loading container
							if (gallery.$loadingContainer) {
								gallery.$loadingContainer.show();
							}
						}
					}
				};

				if (previousSlide.length == 0) {
					// For the first slide, the previous slide will be empty, so we will call the callback immediately
					transitionOutCallback();
				} else {
					if (this.onTransitionOut) {
						this.onTransitionOut(previousSlide, previousCaption, isSync, transitionOutCallback);
					} else {
						previousSlide.fadeTo(this.getDefaultTransitionDuration(isSync), 0.0, transitionOutCallback);
						if (previousCaption)
							previousCaption.fadeTo(this.getDefaultTransitionDuration(isSync), 0.0);
					}
				}

				// Go ahead and begin transitioning in of next image
				if (isSync)
					this.buildImage(imageData, isSync);

				if (!imageData.image) {
					var image = new Image();
					
					// Wire up mainImage onload event
					image.onload = function() {
						imageData.image = this;

						// Only build image if the out transition has completed and we are still on the same image hash
						if (!isTransitioning && imageData.hash == gallery.data[gallery.currentImage.index].hash) {
							gallery.buildImage(imageData, isSync);
						}
					};

					// set alt and src
					image.alt = imageData.title;
					image.src = imageData.slideUrl;
				}

				// This causes the preloader (if still running) to relocate out from the currentIndex
				this.relocatePreload = true;

				return this.syncThumbs();
			},

			// Called by the refresh method after the previous image has been transitioned out or at the same time
			// as the out transition when performing a synchronous transition.
			// @param {Object} imageData An object holding the image metadata of the image to build.
			// @param {Boolean} isSync Specifies whether the transitions are synchronized.
			buildImage: function(imageData, isSync) {
				var gallery = this;
				var nextIndex = this.getNextIndex(imageData.index);

				// Construct new hidden span for the image
				var newSlide = this.$imageContainer
					.append('<span class="image-wrapper current"><a class="advance-link" rel="history" href="#'+this.data[nextIndex].hash+'" title="'+imageData.title+'">&nbsp;</a></span>')
					.find('span.current').css('opacity', '0');
				
				newSlide.find('a')
					.append(imageData.image)
					.click(function(e) {
						gallery.clickHandler(e, this);
					});
				
				var newCaption = 0;
				if (this.$captionContainer) {
					// Construct new hidden caption for the image
					newCaption = this.$captionContainer
						.append('<span class="image-caption current"></span>')
						.find('span.current').css('opacity', '0')
						.append(imageData.caption);
				}

				// Hide the loading conatiner
				if (this.$loadingContainer) {
					this.$loadingContainer.hide();
				}

				// Transition in the new image
				if (this.onTransitionIn) {
					this.onTransitionIn(newSlide, newCaption, isSync);
				} else {
					newSlide.fadeTo(this.getDefaultTransitionDuration(isSync), 1.0);
					if (newCaption)
						newCaption.fadeTo(this.getDefaultTransitionDuration(isSync), 1.0);
				}
				
				if (this.isSlideshowRunning) {
					if (this.slideshowTimeout)
						clearTimeout(this.slideshowTimeout);

					this.slideshowTimeout = setTimeout(function() { gallery.ssAdvance(); }, this.delay);
				}

				return this;
			},

			// Returns the current page index that should be shown for the currentImage
			getCurrentPage: function() {
				return Math.floor(this.currentImage.index / this.numThumbs);
			},

			// Applies the selected class to the current image's corresponding thumbnail.
			// Also checks if the current page has changed and updates the displayed page of thumbnails if necessary.
			syncThumbs: function() {
				var page = this.getCurrentPage();
				if (page != this.displayedPage)
					this.updateThumbs();

				// Remove existing selected class and add selected class to new thumb
				var $thumbs = this.find('ul.thumbs').children();
				$thumbs.filter('.selected').removeClass('selected');
				$thumbs.eq(this.currentImage.index).addClass('selected');

				return this;
			},

			// Performs transitions on the thumbnails container and updates the set of
			// thumbnails that are to be displayed and the navigation controls.
			// @param {Delegate} postTransitionOutHandler An optional delegate that is called after
			// the thumbnails container has transitioned out and before the thumbnails are rebuilt.
			updateThumbs: function(postTransitionOutHandler) {
				var gallery = this;
				var transitionOutCallback = function() {
					// Call the Post-transition Out Handler
					if (postTransitionOutHandler)
						postTransitionOutHandler();
					
					gallery.rebuildThumbs();

					// Transition In the thumbsContainer
					if (gallery.onPageTransitionIn)
						gallery.onPageTransitionIn();
					else
						gallery.show();
				};

				// Transition Out the thumbsContainer
				if (this.onPageTransitionOut) {
					this.onPageTransitionOut(transitionOutCallback);
				} else {
					this.hide();
					transitionOutCallback();
				}

				return this;
			},

			// Updates the set of thumbnails that are to be displayed and the navigation controls.
			rebuildThumbs: function() {
				var needsPagination = this.data.length > this.numThumbs;

				// Rebuild top pager
				if (this.enableTopPager) {
					var $topPager = this.find('div.top');
					if ($topPager.length == 0)
						$topPager = this.prepend('<div class="top pagination"></div>').find('div.top');
					else
						$topPager.empty();

					if (needsPagination)
						this.buildPager($topPager);
				}

				// Rebuild bottom pager
				if (this.enableBottomPager) {
					var $bottomPager = this.find('div.bottom');
					if ($bottomPager.length == 0)
						$bottomPager = this.append('<div class="bottom pagination"></div>').find('div.bottom');
					else
						$bottomPager.empty();

					if (needsPagination)
						this.buildPager($bottomPager);
				}

				var page = this.getCurrentPage();
				var startIndex = page*this.numThumbs;
				var stopIndex = startIndex+this.numThumbs-1;
				if (stopIndex >= this.data.length)
					stopIndex = this.data.length-1;

				// Show/Hide thumbs
				var $thumbsUl = this.find('ul.thumbs');
				$thumbsUl.find('li').each(function(i) {
					var $li = $(this);
					if (i >= startIndex && i <= stopIndex) {
						$li.show();
					} else {
						$li.hide();
					}
				});

				this.displayedPage = page;

				// Remove the noscript class from the thumbs container ul
				$thumbsUl.removeClass('noscript');
				
				return this;
			},

			// Returns the total number of pages required to display all the thumbnails.
			getNumPages: function() {
				return Math.ceil(this.data.length/this.numThumbs);
			},

			// Rebuilds the pager control in the specified matched element.
			// @param {jQuery} pager A jQuery element set matching the particular pager to be rebuilt.
			buildPager: function(pager) {
				var gallery = this;
				var numPages = this.getNumPages();
				var page = this.getCurrentPage();
				var startIndex = page * this.numThumbs;
				var pagesRemaining = this.maxPagesToShow - 1;
				
				var pageNum = page - Math.floor((this.maxPagesToShow - 1) / 2) + 1;
				if (pageNum > 0) {
					var remainingPageCount = numPages - pageNum;
					if (remainingPageCount < pagesRemaining) {
						pageNum = pageNum - (pagesRemaining - remainingPageCount);
					}
				}

				if (pageNum < 0) {
					pageNum = 0;
				}

				// Prev Page Link
				if (page > 0) {
					var prevPage = startIndex - this.numThumbs;
					pager.append('<a rel="history" href="#'+this.data[prevPage].hash+'" title="'+this.prevPageLinkText+'">'+this.prevPageLinkText+'</a>');
				}

				// Create First Page link if needed
				if (pageNum > 0) {
					this.buildPageLink(pager, 0, numPages);
					if (pageNum > 1)
						pager.append('<span class="ellipsis">&hellip;</span>');
					
					pagesRemaining--;
				}

				// Page Index Links
				while (pagesRemaining > 0) {
					this.buildPageLink(pager, pageNum, numPages);
					pagesRemaining--;
					pageNum++;
				}

				// Create Last Page link if needed
				if (pageNum < numPages) {
					var lastPageNum = numPages - 1;
					if (pageNum < lastPageNum)
						pager.append('<span class="ellipsis">&hellip;</span>');

					this.buildPageLink(pager, lastPageNum, numPages);
				}

				// Next Page Link
				var nextPage = startIndex + this.numThumbs;
				if (nextPage < this.data.length) {
					pager.append('<a rel="history" href="#'+this.data[nextPage].hash+'" title="'+this.nextPageLinkText+'">'+this.nextPageLinkText+'</a>');
				}

				pager.find('a').click(function(e) {
					gallery.clickHandler(e, this);
				});

				return this;
			},

			// Builds a single page link within a pager.  This function is called by buildPager
			// @param {jQuery} pager A jQuery element set matching the particular pager to be rebuilt.
			// @param {Integer} pageNum The page number of the page link to build.
			// @param {Integer} numPages The total number of pages required to display all thumbnails.
			buildPageLink: function(pager, pageNum, numPages) {
				var pageLabel = pageNum + 1;
				var currentPage = this.getCurrentPage();
				if (pageNum == currentPage)
					pager.append('<span class="current">'+pageLabel+'</span>');
				else if (pageNum < numPages) {
					var imageIndex = pageNum*this.numThumbs;
					pager.append('<a rel="history" href="#'+this.data[imageIndex].hash+'" title="'+pageLabel+'">'+pageLabel+'</a>');
				}
				
				return this;
			}
		});

		// Now initialize the gallery
		$.extend(this, defaults, settings);
		
		// Verify the history plugin is available
		if (this.enableHistory && !$.historyInit)
			this.enableHistory = false;
		
		// Select containers
		if (this.imageContainerSel) this.$imageContainer = $(this.imageContainerSel);
		if (this.captionContainerSel) this.$captionContainer = $(this.captionContainerSel);
		if (this.loadingContainerSel) this.$loadingContainer = $(this.loadingContainerSel);

		// Initialize the thumbails
		this.initializeThumbs();
		
		if (this.maxPagesToShow < 3)
			this.maxPagesToShow = 3;

		this.displayedPage = -1;
		this.currentImage = this.data[0];
		var gallery = this;

		// Hide the loadingContainer
		if (this.$loadingContainer)
			this.$loadingContainer.hide();

		// Setup controls
		if (this.controlsContainerSel) {
			this.$controlsContainer = $(this.controlsContainerSel).empty();
			
			if (this.renderSSControls) {
				if (this.autoStart) {
					this.$controlsContainer
						.append('<div class="ss-controls"><a href="#pause" class="pause" title="'+this.pauseLinkText+'">'+this.pauseLinkText+'</a></div>');
				} else {
					this.$controlsContainer
						.append('<div class="ss-controls"><a href="#play" class="play" title="'+this.playLinkText+'">'+this.playLinkText+'</a></div>');
				}

				this.$controlsContainer.find('div.ss-controls a')
					.click(function(e) {
						gallery.toggleSlideshow();
						e.preventDefault();
						return false;
					});
			}
		
			if (this.renderNavControls) {
				this.$controlsContainer
					.append('<div class="nav-controls"><a class="prev" rel="history" title="'+this.prevLinkText+'">'+this.prevLinkText+'</a><a class="next" rel="history" title="'+this.nextLinkText+'">'+this.nextLinkText+'</a></div>')
					.find('div.nav-controls a')
					.click(function(e) {
						gallery.clickHandler(e, this);
					});
			}
		}

		var initFirstImage = !this.enableHistory || !location.hash;
		if (this.enableHistory && location.hash) {
			var hash = $.galleriffic.normalizeHash(location.hash);
			var imageData = allImages[hash];
			if (!imageData)
				initFirstImage = true;
		}

		// Setup gallery to show the first image
		if (initFirstImage)
			this.gotoIndex(0, false, true);

		// Setup Keyboard Navigation
		if (this.enableKeyboardNavigation) {
			$(document).keydown(function(e) {
				var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
				switch(key) {
					case 32: // space
						gallery.next();
						e.preventDefault();
						break;
					case 33: // Page Up
						gallery.previousPage();
						e.preventDefault();
						break;
					case 34: // Page Down
						gallery.nextPage();
						e.preventDefault();
						break;
					case 35: // End
						gallery.gotoIndex(gallery.data.length-1);
						e.preventDefault();
						break;
					case 36: // Home
						gallery.gotoIndex(0);
						e.preventDefault();
						break;
					case 37: // left arrow
						gallery.previous();
						e.preventDefault();
						break;
					case 39: // right arrow
						gallery.next();
						e.preventDefault();
						break;
				}
			});
		}

		// Auto start the slideshow
		if (this.autoStart)
			this.play();

		// Kickoff Image Preloader after 1 second
		setTimeout(function() { gallery.preloadInit(); }, 1000);

		return this;
	};
})(jQuery);;



/**
 * jQuery Opacity Rollover plugin
 *
 * Copyright (c) 2009 Trent Foley (http://trentacular.com)
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */
;(function($) {
	var defaults = {
		mouseOutOpacity:   0.67,
		mouseOverOpacity:  1.0,
		fadeSpeed:         'fast',
		exemptionSelector: '.selected'
	};

	$.fn.opacityrollover = function(settings) {
		// Initialize the effect
		$.extend(this, defaults, settings);

		var config = this;

		function fadeTo(element, opacity) {
			var $target = $(element);
			
			if (config.exemptionSelector)
				$target = $target.not(config.exemptionSelector);	
			
			$target.fadeTo(config.fadeSpeed, opacity);
		}

		this.css('opacity', this.mouseOutOpacity)
			.hover(
				function () {
					fadeTo(this, config.mouseOverOpacity);
				},
				function () {
					fadeTo(this, config.mouseOutOpacity);
				});

		return this;
	};
})(jQuery);;



/******************************************************************************
Name:    Highslide JS
Version: 4.1.5 (June 26 2009)
Config:  default +slideshow +positioning +transitions +viewport +thumbstrip
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.
******************************************************************************/
window.hs = {
    // Language strings
    lang : {
        cssDirection:       'ltr',
        loadingText:        get_string('loadingText'),
        loadingTitle:       get_string('loadingTitle'),
        focusTitle:         get_string('focusTitle'),
        fullExpandTitle:    get_string('fullExpandTitle'),
        creditsText:        get_string('creditsText'),
        creditsTitle:       get_string('creditsTitle'),
        previousText:       get_string('previousText'),
        nextText:           get_string('nextText'),
        moveText:           get_string('moveText'),
        closeText:          get_string('closeText'),
        closeTitle:         get_string('closeTitle'),
        resizeTitle:        get_string('resizeTitle'),
        playText:           get_string('playText'),
        playTitle:          get_string('playTitle'),
        pauseText:          get_string('pauseText'),
        pauseTitle:         get_string('pauseTitle'),
        previousTitle:      get_string('previousTitle'),
        nextTitle:          get_string('nextTitle'),
        moveTitle:          get_string('moveTitle'),
        fullExpandText:     get_string('fullExpandText'),
        number:             get_string('number'),
        restoreTitle:       get_string('restoreTitle')
    },
    // See http://highslide.com/ref for examples of settings  
    graphicsDir : '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/',
    creditsTarget : '_self',
    enableKeyListener : true,
    openerTagNames : ['a'], // Add more to allow slideshow indexing
    transitions : [],
    transitionDuration: 250,
    dimmingOpacity: 0, // Lightbox style dimming background
    dimmingDuration: 50, // 0 for instant dimming

    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
    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>'
    },
    // 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',
    'creditsPosition',
    'dragByHeading',
    'autoplay',
    'numberPosition',
    'transitions',
    'dimmingOpacity',
	
    'width',
    'height',
	
    '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: {},
    timers : [],

    slideshows : [],

    pendingOutlines : {},
    clones : {},
    onReady: [],
    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, opt) {
        var start,
        end,
        unit;
        if (typeof opt != 'object' || opt === null) {
            var args = arguments;
            opt = {
                duration: args[2],
                easing: args[3],
                complete: args[4]
            };
        }
        if (typeof opt.duration != 'number') opt.duration = 250;
        opt.easing = Math[opt.easing] || Math.easeInQuad;
        opt.curAnim = hs.extend({}, prop);
        for (var name in prop) {
            var e = new hs.fx(el, opt , name );
		
            start = parseFloat(hs.css(el, name)) || 0;
            end = parseFloat(prop[name]);
            unit = name != 'opacity' ? 'px' : '';
		
            e.custom( start, end, unit );
        }	
    },
    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;
	
        hs.page = {
            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)	{
        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;	
        try {	
            new hs.Expander(a, params, custom);
            return false;
        } catch (e) {
            return true;
        }
    },
    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;
    },


    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) {
        if (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() {
					 
                    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.setStyles(hs.dimmer, {
                background: 'url('+ hs.graphicsDir + 'geckodimmer.png)',
                opacity: 1
            });
        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) {
        hs.getPageSize();
        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
        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, hs.extend(overlay, {
            hsId: 'hsId'+ hs.idCounter++
        } ));
    },


    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();
    },

    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 (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)) {
                    exp.close();
                } 
                else if (hasDragged || (!hasDragged && hs.hasHtmlExpanders)) {
                    hs.dragArgs.exp.doShowHide('hidden');
                }
                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;
	
        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 (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;
            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', 
                        display: ''
                    });
                    hs.animate(o, {
                        opacity: over ? o.opacity : 0
                    }, o.dur);
                }
            })();	
        } catch (e) {}
    },
    addEventListener : function (el, event, func) {
        if (el == document && event == 'ready') hs.push(hs.onReady, 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.getPageSize();
            hs.ieLt7 = hs.ie && hs.uaVersion < 7;
            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'
            }, {
                visibility: (hs.safari && hs.uaVersion < 525) ? 'visible' : 'hidden'
            }, hs.container, 1
            );
		
            // 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));
        }
    },
    ready : function() {
        if (hs.isReady) return;
        hs.isReady = true;
	
        for (var i = 0; i < hs.onReady.length; i++) hs.onReady[i]();
    },

    updateAnchors : function() {
        var el, els, all = [], images = [],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);
                    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
        };
        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.fx = function( elem, options, prop ){
    this.options = options;
    this.elem = elem;
    this.prop = prop;

    if (!options.orig) options.orig = {};
};
hs.fx.prototype = {
    update: function(){
        (hs.fx.step[this.prop] || hs.fx.step._default)(this);
		
        if (this.options.step)
            this.options.step.call(this.elem, this.now, this);

    },
    custom: function(from, to, unit){
        this.startTime = (new Date()).getTime();
        this.start = from;
        this.end = to;
        this.unit = unit;// || this.unit || "px";
        this.now = this.start;
        this.pos = this.state = 0;

        var self = this;
        function t(gotoEnd){
            return self.step(gotoEnd);
        }

        t.elem = this.elem;

        if ( t() && hs.timers.push(t) == 1 ) {
            hs.timerId = setInterval(function(){
                var timers = hs.timers;

                for ( var i = 0; i < timers.length; i++ )
                    if ( !timers[i]() )
                        timers.splice(i--, 1);

                if ( !timers.length ) {
                    clearInterval(hs.timerId);
                }
            }, 13);
        }
    },
    step: function(gotoEnd){
        var t = (new Date()).getTime();
        if ( gotoEnd || t >= this.options.duration + this.startTime ) {
            this.now = this.end;
            this.pos = this.state = 1;
            this.update();

            this.options.curAnim[ this.prop ] = true;

            var done = true;
            for ( var i in this.options.curAnim )
                if ( this.options.curAnim[i] !== true )
                    done = false;

            if ( done ) {
                if (this.options.complete) this.options.complete.call(this.elem);
            }
            return false;
        } else {
            var n = t - this.startTime;
            this.state = n / this.options.duration;
            this.pos = this.options.easing(n, 0, 1, this.options.duration);
            this.now = this.start + ((this.end - this.start) * this.pos);
            this.update();
        }
        return true;
    }

};

hs.extend( hs.fx, {
    step: {

        opacity: function(fx){
            hs.setStyles(fx.elem, {
                opacity: fx.now
            });
        },

        _default: function(fx){
            if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
                fx.elem.style[ fx.prop ] = fx.now + fx.unit;
            else
                fx.elem[ fx.prop ] = fx.now;
        }
    }
});

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 (pos, offset, vis, dur, easing) {
        var exp = this.exp,
        stl = exp.wrapper.style,
        offset = offset || 0,
        pos = pos || {
            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 'maxsize':
                return this.get('fitsize') - 2 * this.cb - this.p1 - this.p2 ;
            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];
    },
    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 < 1) {
            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 (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.isReady) {
        hs.addEventListener(document, 'ready', function() {
            new hs.Expander(a, params, custom, contentType);
        });
        return;
    } 
    this.a = a;
    this.custom = custom;
    this.contentType = contentType || 'image';
    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;
	
    // 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
    if (!hs.allowSimultaneousLoading) 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[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.getPageSize();
    var x = this.x = new hs.Dimension(this, 'x');
    x.calcThumb();
    var y = this.y = new hs.Dimension(this, 'y');
    y.calcThumb();
    this.wrapper = hs.createElement(
        'div', {
            id: 'highslide-wrapper-'+ this.key,
            className: 'highslide-wrapper '+ this.wrapperClassName
        }, {
            visibility: 'hidden',
            position: 'absolute',
            zIndex: hs.zIndexCounter += 2
        }, 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 - 1;
        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();
        };
        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();
    },

    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;
            }	
            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);
		
            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.overlayBox) this.sizeOverlayBox(0, 1);
		
            if (this.allowSizeReduction) {
                this.correctRatio(ratio);
                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);
        }
    },

    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(dim == 'y' ? 'fitsize' : 'maxsize');
                } 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(dim == 'y' ? 'fitsize' : 'maxsize');
                }			
            }
		
            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);
            }
        }
    },

    show : function () {
        var x = this.x, y = this.y;
        this.doShowHide('hidden');
        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();
        }
	
	
        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.fadeInOut) {
            hs.setStyles(this.wrapper, {
                opacity: up ? 0 : 1
            });
            hs.extend(to.wrapper, {
                opacity: up
            });
        }
        hs.animate( this.wrapper, to.wrapper, {
            duration: dur,
            easing: easing,
            step: function(val, args) {
                if (exp.outline && exp.outlineWhileAnimating && args.prop == 'top') {
                    var fac = up ? args.pos : 1 - args.pos;
                    var pos = {
                        w: x.t + (x.get('wsize') - x.t) * fac,
                        h: y.t + (y.get('wsize') - y.t) * fac,
                        x: x.tpos + (x.pos - x.tpos) * fac,
                        y: y.tpos + (y.pos - y.tpos) * fac
                    };
                    exp.outline.setPosition(pos, 0, 1);				
                }
            }
        });
        hs.animate( this.content, to.content, dur, easing, after);
        if (up) {
            this.wrapper.style.visibility = 'visible';
            this.content.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
                }, hs.restoreDuration, 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'
        });
        for (var i = 0; i < this.overlays.length; i++) {
            var o = hs.$('hsId'+ this.overlays[i]);
            if (o.style.visibility == 'hidden') o.style.display = 'none';
        }
        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();
            exp.last = null;
        }
        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 == 'top') {
                var stl = exp.wrapper.style;
                var pos = {
                    w: parseInt(stl.width),
                    h: parseInt(stl.height),
                    x: parseInt(stl.left),
                    y: parseInt(stl.top)
                };
                exp.outline.setPosition(pos);
            }
        };
        hs.animate(wrapper, to.wrapper, {
            duration: dur, 
            complete: 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.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();
	
    },


    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'];
        if (arr) 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'];
            if (arr) {
                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.key, ss);
            } 
        } else {
            this.slideshow = this.last.slideshow;
        }
        var ss = this.slideshow;
        if (!ss) return;
        var key = ss.expKey = this.key;
	
        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(key);
            }, (ss.interval || 500));
        }
    },

    cancelLoading : function() {
        hs.discardElement (this.wrapper);
        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';
    },

    writeCredits : function () {
        if (this.credits) return;
        this.credits = hs.createElement('a', {
            href: hs.creditsHref,
            target: hs.creditsTarget,
            className: 'highslide-credits',
            innerHTML: hs.lang.creditsText,
            title: hs.lang.creditsTitle
        });
        this.createOverlay({ 
            overlayId: this.credits, 
            position: this.creditsPosition || 'top left', 
            hsId: 'credits' 
        });
    },

    getInline : function(types, addOverlay) {
        for (var i = 0; i < types.length; i++) {
            var type = types[i], s = null;
            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 += 2;
        // 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';
                blurExp.content.style.cursor = hs.ie ? 'hand' : 'pointer';
                blurExp.content.title = hs.lang.focusTitle;
            }
        }
	
        // focus this
        if (this.outline) this.outline.table.style.zIndex 
            = this.wrapper.style.zIndex - 1;
        this.content.className = 'highslide-'+ this.contentType;
        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);	
    },
    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 = 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;
        }
        this.isClosing = true;
        if (this.slideshow && !hs.upcoming) this.slideshow.pause();
	
        hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
	
        try {
            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();
        }
    },

    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;
        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.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)) {
                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.useBox ? this.width : null) 
                    || 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.setStyles(o, {
                    visibility: 'visible', 
                    display: ''
                });
                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);
        }
        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'
            }
            );
	
        this.createOverlay({ 
            overlayId: this.fullExpandLabel, 
            position: hs.fullExpandPosition, 
            hideOnMouseOut: true, 
            opacity: hs.fullExpandOpacity
        });
    },

    doFullExpand : function () {
        try {
            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.outline && this.outlineWhileAnimating) this.outline.destroy();
	
        hs.discardElement(this.wrapper);
        if (!hs.viewport.childNodes.length) hs.viewport.style.display = 'none';
	
        if (this.dimmingOpacity) hs.undim(this.key);
        hs.expanders[this.key] = null;		
        hs.reOrder();
    }

};


hs.Slideshow = function (expKey, options) {
    if (hs.dynamicallyUpdateAnchors !== false) hs.updateAnchors();
    this.expKey = expKey;
    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 exp = hs.expanders[this.expKey],
        cur = 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[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.expKey);
    },
    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] == hs.expanders[slideshow.expKey].a) {
                i = j;
                break;
            }
        }
        if (i === undefined) return;
        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,
        overlayWidth = div.parentNode.parentNode[offsetWidth],
        minTblPos = overlayWidth - 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 > overlayWidth - curTblPos) tblPos = overlayWidth - 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[hs.expanders[slideshow.expKey].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() {
                    hs.getExpander(this).focus();
                    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 (hs.ie) {
    (function () {
        try {
            document.documentElement.doScroll('left');
        } catch (e) {
            setTimeout(arguments.callee, 50);
            return;
        }
        hs.ready();
    })();
}
hs.addEventListener(document, 'DOMContentLoaded', hs.ready);
hs.addEventListener(window, 'load', hs.ready);
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.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(document, 'ready', hs.getAnchors);
hs.addEventListener(window, 'load', hs.preloadImages);;



//#starotvacie nastavenia
var IE=document.all ? true : false;
var ajaxFront=new Array();
var ajaxProgress=new Array();
var ajaxRequest=getAjax();
var popupId=new Array();
var popupDelay=new Array();
var GET=new Array();
var JVAR=new Array();
var IHELP=new Array();
var IINFO=new Array();
var BUFFER=new Array();
var PROGRESS=new Array();
PROGRESS['delay']=1;
PROGRESS['step']=5;
PROGRESS['count']=0;
PROGRESS['front']=new Array();
PROGRESS['front_count']=0;
PROGRESS['stop']=false;
var DELAY=new Array();
DELAY['alert']=3000;
DELAY['fade']=1000;
DELAY['slide']=500;
DELAY['gallery']=5000;
DELAY['checkMail']=30000;
DELAY['checkIINFO']=30000;
//#starotvacie nastavenia

//#nacitanie premennej GET
var loc=location.href.replace(URL['root'],'').split('?');
var action=loc[0].split('/');
if(loc[1])
{
    var params=loc[1].split('&');
}
if(loc[0][0]=='/')
{
    GET['location']=loc[0];
}
else
{
    GET['location']='/' + loc[0];
}
GET['item']=0;
GET['module']='';
GET['submodule']='';
switch(action[0])
{
    case 'admin':
    case 'install':
    case 'webmail':GET['section']='admin';break;
    default:GET['section']='client';break;

}
for(var i in action)
{
    if(action[i]!='admin')
    {
        if(GET['module']=='')
        {
            GET['module']=action[i];
        }
        else if(GET['submodule']=='')
        {
            GET['submodule']=action[i];
        }
        else if(GET['item']==0)
        {
            if(IsNumeric(action[i]))
            {
                GET['item']=action[i];
            }
        }
    }
    else
    {
        GET['section']='admin';
    }
}
if(params)
{
    for(var j in params)
    {
        v=params[j].split('=');
        if(v[0] && v[1] && v[0]!='module' && v[0]!='submodule' && v[0]!='item')
        {
            GET[v[0]]=v[1];
        }
    }
}
//#nacitanie premennej GET

//#vykonanie akcii po nacitani stranky
$(function(){
    $(document).ready(function(){
        //#nacitanie premennej jvar
        $('input[type="hidden"]').each(function(){
            if($(this).attr('class')=='jvar')
            {
                JVAR[$(this).attr('name')]=$(this).attr('value');
            }
        });
        
        //#nacitanie cookie form
        if(GET['take'])
        {
            var buffer=readCookie(GET['location'] + ':form');
            $('form input[type="text"], form input[type="hidden"], form textarea, form select').each(function(){
                if(buffer[$(this).attr('name')])
                {
                    $(this).val(buffer[$(this).attr('name')]);
                }
            });
        }
        
        //#zobrazenie errorov
        $('#error div').dblclick(function() {
            $(this).fadeOut();
        });
        $('.foot-fixed div.infobtn').click(function() {
            $('.foot-fixed div.infobtn').css('display','none');
            $('.foot-fixed div.info').css('display','block');
        });
        $('.foot-fixed div.info').click(function() {
            $('.foot-fixed div.info').css('display','none');
            $('.foot-fixed div.infobtn').css('display','block');
        });
    });
});
//#vykonanie akcii po nacitani stranky

function getAjax()
{
    if(window.XMLHttpRequest)
    {
        return new XMLHttpRequest();
    }
    else if(window.ActiveXObject)
    {
        return new ActiveXObject('Microsoft.XMLHTTP');
    }
    return null;
}

//#return values
//#inicializacia ajaxu

function sendRequest(url,cursor)
{
    if(url.length>0)
    {
        ajaxFront[ajaxFront.length]=url;
        ajaxProgress[ajaxFront.length-1]=cursor;
        sendRequest_send();
    }
}

//#return values
//#nacitanie requestu do fronty

function sendRequest_front()
{
    if(!ajaxFront)
    {
        return '';
    }
    for(var j=0;j<ajaxFront.length;j++)
    {
        if(ajaxFront[j].length>0)
        {
            ret=Array();
            ret['url']=ajaxFront[j];
            ret['cursor']=ajaxProgress[j];
            ajaxFront[j]='';
            ajaxProgress[j]='';
            return ret;
        }
    }
    return '';
}

//#return values
//#nacitanie requestu z fronty

function sendRequest_clear()
{
    ajaxFront=Array();
    ajaxRequest=false;
}

//#return values
//#vynulovanie fronty

function sendRequest_send()
{
    if(!ajaxRequest)
    {
        return;
    }
    if(ajaxRequest.readyState==4 || ajaxRequest.readyState==0)
    {
        var data=sendRequest_front();
        if(data['url'] && data['url'].length>0)
        {
            if(data['cursor']!=false)
            {
                $('html,a,.icon').css('cursor','wait');
            }
            $('#pageLoader').css('display','block');
            var url;
            url =URL['root_getdata'];
            url+='ajax.php';
            url+='?section=' + GET['section'];
            url+='&' + data['url'];
            url+='&anticache=' + new Date().getTime();
            ajaxRequest.open('GET',url,true);
            ajaxRequest.onreadystatechange=sendRequestOK;
            ajaxRequest.send(null);
        }
    }
}

//#return values
//#vykonanie samotneho requestu

function uid()
{
    return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}

//#return values
//#vygeneruje nahodny retazec

function alert_ok(data)
{
    var id=uid();
    create_popup_sound('alert-ok',data,id);
    window.setTimeout("destruct('p-" + id + "')",DELAY['alert']);
}

function alert_ok_delay(data)
{
    alert_ok(data);
}
function alert_error(data){
    create_popup_sound('alert-error',data);
}
function alert_error_delay(data)
{
    popupDelay[popupDelay.length]=(popupDelay.length + 1) * 150;
    window.setTimeout("alert_error('" + data + "');",popupDelay[popupDelay.length-1]);
}
function alert_info(data){
    create_popup_sound('alert-info',data);
}
function alert_info_delay(data)
{
    alert_info(data);
}
function alert_help(data){
    create_popup_sound('alert-help',data);
}
function alert_progress(data)
{
    PROGRESS['front'][PROGRESS['front'].length]=data;
    create_popup('alert-progress',data,'alert-progress');
}

//#return values
//#zakladne hlasky

function ajax_removes(what,id)
{
    close_popup(id);
    $('.item-' + what).each(function()
    {
        if($(this).find('.checkbox input[type=checkbox]').is(':checked'))
        {
            var request='';
            request+='action=remove';
            request+='&id=' + $(this).attr('id');
            sendRequest(request);
        }
    });
}

//#return values
//#request pre vymazanie poloziek

function ajax_remove(id)
{
    var request='';
    request+='action=remove';
    request+='&id=' + id;
    sendRequest(request);
    close_popup(id);
}

//#return values
//#request pre vymazanie polozky

function ajax_empty(id)
{
    var request='';
    request+='action=empty';
    request+='&id=' + id;
    sendRequest(request);
    close_popup(id);
}

//#return values
//#request pre vyprazdnenie polozky

function ajax_copy()
{
    $('.item-content').each(function()
    {
        if($(this).find('.checkbox input[type=checkbox]').is(':checked'))
        {
            var request='';
            request+='action=main';
            request+='&request=copy';
            request+='&id=' + $(this).attr('rel');
            sendRequest(request);
        }
    });
}

//#return values
//#request pre skopyrovanie poloziek

function ajax_pack()
{
    var items='';
    $('.item-content').each(function()
    {
        if($(this).find('.checkbox input[type=checkbox]').is(':checked'))
        {
            items+=$(this).attr('id') + '|';
        }
    });
    var request='';
    request+='action=gallery';
    request+='&request=pack';
    request+='&id=' + items;
    sendRequest(request);
    startProgress(request,'slow',true);
}

//#return values
//#request pre zbalenie poloziek

function ajax(type,id)
{
    var request='';
    switch(type)
    {
        //#newslatters
        case 'newslatters-bulletin-send':
            request ='action=newslatters';
            request+='&request=bulletin-send';
            request+='&id=' + id;
            break;
        //#users
        case 'users-contact-convert':
            request ='action=users';
            request+='&request=contact-convert';
            request+='&id=' + id;
            break;
        //#system
        case 'update':
            request ='action=update';
            request+='&request=update';
            break;
        case 'generate-project':
            request ='action=install';
            request+='&request=generate';
            request+='&id=' + id;
            alert_progress(get_string('exporting-project'));
            startProgress('','slow',true);
            break;
        //#eshop
        case 'eshop-cart-remove':
            request ='action=eshop';
            request+='&request=cart-remove';
            request+='&id=' + id;
            break;
        case 'eshop-cart-clear':
            request ='action=eshop';
            request+='&request=cart-clear';
            break;
        case 'eshop-product-send-offer':
            request ='action=eshop';
            request+='&request=product-send-offer';
            request+='&id=' + id;
            break;
        //#transfer
        case 'transfer-import':
            request ='action=transfer';
            request+='&request=import';
            request+='&id=' + id;
            alert_progress(get_string('importing'));
            startProgress(request,'slow',true);
            break;
        //#gallery
        case 'gallery-download':
            request ='action=gallery';
            request+='&request=download';
            request+='&value=' + get_input('popupGalleryUrl');
            request+='&id=' + GET['item'];
            alert_progress(get_string('downloading'));
            startProgress(false,'slow',true);
            break;
        //#crm
        case 'crm-calendar-event-set':
            request ='action=crm';
            request+='&request=calendar-event-set';
            request+='&id=' + id;
            request+='&value=';
            request+=get_text('#dialogCrmCalendarEventAdd #add-name') + '|';
            request+=get_text('#dialogCrmCalendarEventAdd #add-where') + '|';
            request+=get_text('#dialogCrmCalendarEventAdd #add-description') + '|';
            request+=get_radio('add_permissions') + '|';
            request+=get_text('#dialogCrmCalendarEventAdd #add-from') + '|';
            request+=get_text('#dialogCrmCalendarEventAdd #add-to') + '|';
            request+=get_text('#dialogCrmCalendarEventAdd #add-group');
            break;
        case 'crm-calendar-event-get':
            request ='action=crm';
            request+='&request=calendar-event-get';
            request+='&id=' + id;
            break;
        case 'crm-calendar-event-view':
            request ='action=crm';
            request+='&request=calendar-event-view';
            request+='&id=' + id;
            break;
        //business
        case 'business-order-status':
            request ='action=business';
            request+='&request=order-status-set';
            request+='&id=' + id;
            request+='&value=' + get_radio('order-status-' + id);
            break;
        //game
        case 'game-reason-get':
            request ='action=game';
            request+='&request=reason-get';
            request+='&id=' + id;
            break;
        case 'game-player-kick-add':
            request ='action=game';
            request+='&request=player-kick-add';
            request+='&value=' + GET['item'];
            request+='&id=' + id;
            break;
        case 'game-player-ban-add':
            request ='action=game';
            request+='&request=player-ban-add';
            request+='&id=' + id;
            request+='&value=';
            request+=GET['item'] + '|';
            request+=get_text('#dialogGamePlayerBanAdd #add-reason') + '|';
            request+=get_text('#dialogGamePlayerBanAdd #add-time') + '|';
            request+=get_checkbox('add-time-forever');
            break;
        case 'game-player-unban':
            request ='action=game';
            request+='&request=player-unban';
            request+='&id=' + id;
            break;
        case 'game-server-maps-get':
            request ='action=game';
            request+='&request=server-maps-get';
            request+='&id=' + id;
            break;
        case 'game-server-map-change':
            request ='action=game';
            request+='&request=server-map-change';
            request+='&value=' + get_radio('add-map');
            request+='&id=' + id;
            break;
        case 'game-server-start':
            if(!action){var action='start';}
        case 'game-server-restart':
            if(!action){var action='restart';}
        case 'game-server-stop':
            if(!action){var action='stop';}
            request ='action=game';
            request+='&request=server-' + action;
            request+='&id=' + id;
            break;
        //restaurant
        case 'restaurant-cart-clear':
            request ='action=restaurant';
            request+='&request=cart-clear';
            break;
        case 'restaurant-cart-remove':
            request ='action=restaurant';
            request+='&request=cart-remove';
            request+='&id=' + id;
            break;
        default:
            alert_error(get_string('undefined-request'));
            break;
    }
    if(request.length>0)
    {
        sendRequest(request);
    }
    close_popup(id);
}

//#return values
//#pomocna funkcia pred poslanim poziadavku (koli zavretiu popup okienka)

function readCookie(name)
{
    var buffer=new Array();
    var cookie=$.cookie(name);
    if(cookie && cookie.length>0)
    {
        var varr='';
        var vall='';
        var actt='var';
        for(var i=0;i<cookie.length;i++)
        {
            if(cookie[i]==':' && cookie[i-1]!=='\\')
            {
                actt='val';
            }
            else if(cookie[i]==';' && cookie[i-1]!=='\\')
            {
                buffer[varr]=vall;
                actt='var';
                varr='';
                vall='';
            }
            else
            {
                if(!(cookie[i]=='\\' && (cookie[i+1]==':' || cookie[i+1]==';')))
                {
                    switch(actt)
                    {
                        case 'var':varr+=cookie[i];break;
                        case 'val':vall+=cookie[i];break;
                    }
                }
            }
        }
    }
    return buffer;
}

//#return values
//#nacita obsah daneho cookie

function setCookie(name,array)
{
    var buffer='';
    for(var j in array)
    {
        var buf='';
        var val=array[j];
        for(var i=0;i<val.length;i++)
        {
            if(val[i]==':' || val[i]==';')
            {
                buf+='\\' + val[i];
            }
            else
            {
                buf+=val[i];
            }
        }
        buffer+=j + ':' + buf + ';';
    }

    $.cookie(
        name,
        buffer,
        {
            expires:    7,
            path:       '/',
            domain:     URL['root'].replace('http://','').replace('/',''),
            secure:     false
        }
    );
}

//#return values
//#nastavi cookie

function clearCookie()
{
    $.cookie('cookie',null);
}

//#return values
//#odstrani vsetky cookie

function get_checkbox(id)
{
    return document.getElementById(id).checked;
}

//#return values
//#ziska hodnotu checkbox

function set_checkbox(id,setting)
{
    if(setting==1)
    {
        document.getElementById(id).checked=true;
    }
    else
    {
        document.getElementById(id).checked=false;
    }
}

//#return values
//#nastavit checkbox

function get_radio(name)
{
    var radio=document.getElementsByName(name);
    for(var i=0;i<radio.length;i++)
    {
        if(radio[i].checked)
        {
            return radio[i].value;
        }
    }
    return false;
}

//#return values
//#ziskat hodnotu radia

function set_radio(name,value)
{
    var radio=document.getElementsByName(name);
    for(var i=0;i<radio.length;i++)
    {
        radio[i].checked=false;
        if(radio[i].value==value)
        {
            radio[i].checked=true;
        }
    }
}

//#return values
//#nastavit radio

function set_select(id,value)
{
    var select=document.getElementById(id);
    for(var i=0;i<select.length;i++)
    {
        if(select[i].value==value)
        {
            select.selectedIndex=i;
        }
    }
}

//#return values
//#nastavit hodnotu selektu

function set_select_class(cls,val)
{
    $(cls).each(function()
    {
        if($(this).val()==val)
        {
            $(this).attr('selected','selected')
        }
        else
        {
            $(this).attr('selected','')
        }
    });
}

function get_select(id)
{
    var select=document.getElementById(id);
    for(var i=0;i<select.length;i++)
    {
        if(select.selectedIndex==i)
        {
            return select[i].value;
        }
    }
    return false;
}

//#return values
//#ziskat hodnotu selektu

function get_input(id)
{
    return document.getElementById(id).value;
}

//#return values
//#ziska hodnotu z inputu

function set_input(id,value)
{
    document.getElementById(id).value=value;
}

//#return values
//#ziska hodnotu z inputu

function get_string(string)
{
    if(LANG[string])
    {
        return LANG[string];
    }
    else
    {
        return '[' + string + ']';
    }
}

//#return values
//#ziska hodnotu z premennej LANG

function set_color(id,code)
{
    if(id=='chat')
    {
        if(window.setColor)
        {
            setColor(code);
        }
    }
    else if(code!='close')
    {
        if(code!='transparent')
        {
            code='#' + code;
            $('#' + id).css('color',code);
        }
        $('#' + id).val(code);
    }
    $('#boxcolor-' + id).remove();
}

//##return values
//##nastavi farbu

function set_smille(code)
{
    $('#add_message').val($('#add_message').val() + ' ' + code);
    $('#add_message').focus();
    close_popup('smilles');
}

//#return values
//#nastavi smajla

function debug(object)
{
//    if(object.constructor==Array)
//    {
//        var tmp="\n";
//        for(var i in object)
//        {
//            tmp+=object[i] + "\n";
//        }
//        tmp+="\n";
//        object=tmp;
//    }
    alert($.dump(object));
}

//#return values
//#vypise objekt pomocou alertu

function create_popup_sound(type,data,id)
{
    //create_popup(type,data,id);
    //return;
    switch(type)
    {
        case 'file-url':    sound('info');  break;
        case 'remove':      sound('info');  break;
        case 'removes':     sound('info');  break;
        case 'empty':       sound('info');  break;
        case 'alert-error': sound('error'); break;
        case 'alert-info':  sound('info');  break;
        case 'alert-help':  sound('info');  break;
        case 'alert-ok':    sound('info');  break;
    }
    create_popup(type,data,id);
    //window.setTimeout("create_popup('" + type + "','" + data + "','" + id + "');",500);
}

//#return values
//#vytvori popup so zvukom

function create_popup(type,data,id,width,height)
{
    if(!data){data='';}
    if(!id || id==''){id=uid();}
    if(!width || width==''){width=400;}
    if(!height || height==''){height=130;}
    var tpl;
    switch(type)
    {
        case 'remove':                  tpl=get_p_remove(id,data);          break;
        case 'removes':                 tpl=get_p_removes(id,data);         break;
        case 'bulletin-send':           tpl=get_p_bulletin_send(id);        break;
        case 'order-status':            tpl=get_p_order_status(id);         break;
        case 'cart-remove':             tpl=get_p_cart_remove(id,data);     break;
        case 'cart-clear':              tpl=get_p_cart_clear(id,data);      break;
        case 'cart-add':                tpl=get_p_cart_add(id,data);        break;
        case 'alert-ok':                tpl=get_p_ok_alert(id,data);        break;
        case 'alert-error':             tpl=get_p_error_alert(id,data);     break;
        case 'alert-info':              tpl=get_p_info_alert(id,data);      break;
        case 'alert-help':              tpl=get_p_help_alert(id,data);      break;
        case 'alert-progress':          tpl=get_p_progress_alert(id,data);  break;
        case 'filter':                  tpl=get_p_filter(id,data);          break;
        case 'update':                  tpl=get_p_update(id);               break;
        case 'import':                  tpl=get_p_import(id);               break;
        case 'generate-project':        tpl=get_p_project_generate(id);     break;
        case 'generate-pack':           tpl=get_p_pack_generate(id);        break;
        case 'smilles':                 tpl=get_p_smilles(id,data);         break;
        case 'friend-add':              tpl=get_p_friend_add(id);           break;
        case 'store-cart':              tpl=get_p_store_cart(id,data);      break;
        case 'file-url':                tpl=get_p_file_url(id);             break;
        case 'contact-convert':         tpl=get_p_contact_convert(id);      break;
        case 'product-send-offer':      tpl=get_p_send_offer(id);           break;
        case 'player-kick':             tpl=get_p_player_kick(id);          break;
        case 'player-unban':            tpl=get_p_player_unban(id);         break;
        case 'server-start':            tpl=get_p_server_start(id);         break;
        case 'server-restart':          tpl=get_p_server_restart(id);       break;
        case 'server-stop':             tpl=get_p_server_stop(id);          break;
        case 'empty':                   tpl=get_p_empty(id,data);           break;
        default:                        tpl=get_p_undefined(id,type);       break;
    }
    var extra_A=0;
    var extra_L=0;
    var extra_T=0;
    extra_A=popupId.length;
    while(extra_A>10)
    {
        extra_A=extra_A-10;
        extra_L=extra_L + 50;
        extra_T=extra_T + 0;
    }
    var left=(($(window).width()-width)/2 + extra_L) + extra_A * 15;
    var top=(($(window).height()-height)/2 + extra_T) + extra_A * 15;
    var div=document.createElement('div');
    div.setAttribute('id','p-' + id);
    div.style.left=left + 'px';
    div.style.top=top + 'px';
    div.style.width=width + 'px';
    div.style.height=height + 'px';
    div.style.display='none';
    div.className='report';
    div.innerHTML=tpl;
    $('body').append(div);
    if(type=='alert-error' || type=='alert-info' || type=='alert-help')
    {
        popupId[popupId.length]=id;
    }
    $('#p-' + id).css('display','block');
    if(window.open_disappear)
    {
        open_disappear();
    }
    if(window.open_autocomplete)
    {
        open_autocomplete();
    }
}

//#return values
//#konstruktor okna
//#id - ID popup elementu
//#flag - 1 alebo 0, otvorit resp. zavriet popup
//#type - vyber sablony
//#data - volitelny argument ak je potrebne prenasat udaje
//#width_b - sirka okna
//#height_b -vyska okna

function close_popup(id)
{
    popupId=removeVal(id,popupId);
    $('#p-' + id).remove();
}

//#return values
//#zavretie popupu

function destruct(id)
{
    $('#' + id).fadeOut();
    $('#' + id).delay(DELAY['fade']).remove();
}

//#return values
//#odstranenie elementu na zaklade id

function clear_flybox(id)
{
    $('#' + id).parent().find('div.flybox').remove();
}

//#return values
//#zrusi flybox

function trim(str)
{
    return str.replace(/^\s+|\s+$/g,'');
}

//#return values
//#undefined :)

function get_position(tooltip,kmouse)
{
    var border_top=$(window).scrollTop();
    var border_right=$(window).width();
    var left_pos;
    var top_pos;
    var offset=15;
    if(border_right-(offset*2)>=tooltip.width()+kmouse.pageX)
    {
        left_pos=kmouse.pageX+offset;
    }
    else
    {
        left_pos=border_right-tooltip.width()-offset;
    }
    if(border_top+(offset*2)>=kmouse.pageY-tooltip.height())
    {
        top_pos=border_top+offset;
    }
    else
    {
        top_pos=kmouse.pageY-tooltip.height()-offset;
    }
    return Array(
        left_pos,
        top_pos
    );
}

//#return values
//#vypocita poziciu mysky a vrati ju

function ReplaceAll(Source,stringToFind,stringToReplace)
{
    var temp=Source;
    var index=temp.indexOf(stringToFind);
    while(index != -1)
    {
        temp=temp.replace(stringToFind,stringToReplace);
        index = temp.indexOf(stringToFind);
    }
    return temp;
}

//#return values
//#zameni vsetky vyskyty retazca

function IsNumeric(value)
{
   return (value - 0) == value && value.length > 0;
}

//#return values
//#true - ak je hodnota cislo
//#false - ak hodnota nie je cislo

function isEmpty(obj)
{
    for(var prop in obj)
    {
        if(obj.hasOwnProperty(prop))
        {
            return false;
        }
    }
    return true;
}

//#return values
//#true - ak je premenna prazdna
//#false - ak nie je premenna prazdna

function inArray(string,array)
{
    for(var key in array)
    {
        if(array[key]==string)
        {
            return true;
        }
    }
    return false;
}

//#return values
//#true - ak sa string v poli nachadza
//#false - ak sa string v poli nenachadza

function arrayColumn(array,column)
{
    var ret=Array();
    for(var key in array)
    {
        ret[key]=array[key][column];
    }
    return ret;
}

//#return values
//#vrati stlpec z viacrozmerneho pola

function arraySearch(string,array)
{
    for(var key in array)
    {
        if(array[key]==string)
        {
            return key;
        }
    }
    return false;
}

//#return values
//#key - ak sa string v poli nachadza
//#false - ak sa string v poli nenachadza

function removeKey(key,array)
{
    var r=new Array();
    for(var k in array)
    {
        if(k!=key)
        {
            r[k]=array[k];
        }
    }
    return r;
}

//#return values
//#odstrani prvok z pola na zaklade kluca

function removeVal(val,array)
{
    var ret=new Array();
    for(var key in array)
    {
        if(array[key]!=val)
        {
            ret[key]=array[key];
        }
    }
    return ret;
}

//#return values
//#odstrani prvok z pola

function cloneItem(pattern,insert)
{
    $(pattern).clone(true).insertAfter(insert);
}

function cloneItemId(pattern,id,insert)
{
    $(pattern).clone(true).attr('id',id).insertAfter(insert);
}

//#return values
//#vyklonuje prvok

function value_select(data,id,empty)
{
    var tpl='';
    if(id)
    {
        if(id.substring(0,1)!='.')
        {
            id='#' + id;
        }
        if(empty==true)
        {
            $(id + ' option').remove();
        }
        for(var i in data)
        {
            tpl='<option value="' + data[i]['id'] + '">';
            tpl+=data[i]['name'];
            tpl+='</option>';
            $(id).append(tpl);
        }
    }
    else
    {
        for(var i in data)
        {
            tpl+='<option value="' + data[i]['id'] + '">';
            tpl+=data[i]['name'];
            tpl+='</option>';
        }
    }
    return tpl;
}

//#return values
//#naplni select datami

function stripslashes(str)
{
    return (str+'').replace(/\\(.?)/g, function (s, n1)
    {
        switch(n1)
        {
            case '\\':  return '\\';    break;
            case '0':   return '\u0000';break;
            case '':    return '';       break;
            default:    return n1;       break;
        }
    });
}

//#return values
//#odstrani spatne lomitka z retazca

function keyPress(e)
{
    var code=0;
    if(window.event)
    {
        code=e.keyCode;
    }
    else if(e.which)
    {
        code=e.which;
    }
    return code;
}

//#return values
//#vrati znak nacitany z klavesnice

function get_text(id)
{
    if($(id).length>0)
    {
        var value=$(id).val();
        value=escape(value);
        value=trim(value);
        return value;
    }
    return '';
}

//#return values
//#vrati text z inputu

function get_cover(action)
{
    if(action==true && $('#p-cover').length==0)
    {
        $('body').append('<div id="p-cover"></div>');
        $('#p-cover').css({
            width:          $('body').width(),
            height:         $('body').height(),
            backgroundColor:'blue',
            position:       'fixed',
            top:            '0px',
            left:           '0px',
            opacity:        0.1            
        })
    }
    else if(action==false)
    {
        $('#p-cover').remove();
    }
}

//#return values
//#vytvori cover

function get_params(identifier)
{
    parts=identifier.split('-');
    return parts[parts.length-1];
}

function sound(sound)
{
    var id='sound-' + sound + '-' + uid();
    if($('#' + id).length==0)
    {
        var tpl;
        tpl ='<audio id="' + id + '" controls="controls" preload="auto">';
        tpl+='<source src="' + URL['root_public'] + 'sounds/' + sound + '.wav"></source>';
        tpl+='<source src="' + URL['root_public'] + 'sounds/' + sound + '.ogg"></source>';
        tpl+='</audio>';
        $('body').append(tpl);
    }
    $('#' + id)[0].play();
    window.setTimeout("$('#" + id + "').remove();",3000);
    
    //tpl='<embed ';
    //tpl+='id="' + id + '"';
    //tpl+='class="sound"';
    //tpl+='src="' + URL['root_public'] + 'sounds/' + sound + '"';
    //tpl+='hidden="true" ';
    //tpl+='autostart="true" ';
    //tpl+='loop="false"';
    //tpl+='/>'
    //$('body').append(tpl);
    //window.setTimeout("$('#" + id + "').remove();",3000);
}

function html_entity_decode(string)
{
    return $('<div />').html(string).text();
}

//#return values
//#dekoduje html entity na platne znaky

function string_to_float(value)
{
    return parseFloat(value.replace(',','.'));
}

//#return avlues
//#prevedie retazec na float

function row_click(url,arg_1,arg_2)
{
    if($('#add_media').length>0 && $('#view_media').length>0 && arg_1.length>0 && arg_2.length>0)
    {
        $('#add_media').val(arg_2);
        if(arg_1.length>0)
        {
            $('#view_media').html(arg_1);
        }
    }
    if($('#add_image').length>0 && arg_1.length>0)
    {
        $('#add_image').val(arg_1);
        $('#view_image').attr('src',URL['root_img'] + arg_1 + '/size/~xl/');
    }
    if($('#add_images').length>0 && url.length>0 && arg_1.length>0 && arg_2.length>0)
    {
        if($('#add_images #gallery-image-' + arg_1).length==0)
        {
            var i=$('#add_images > div').size();
            var tmp='';
            tmp+='<div id="gallery-image-' + arg_1 + '">';
            tmp+='<span class="img">';
            tmp+='<a href="javascript:void(0)" class="expansion-a" rel="' + URL['root_img'] + arg_1 + '/size/~x/">';
            tmp+='<img src="' + URL['root_img'] + arg_1 + '/size/~s/' + '" alt="" />';
            tmp+='</a>';
            tmp+='</span>';
            tmp+='<span class="text">' + arg_2 + '</span>';
            tmp+='<span class="remove">';
            tmp+='<a href="javascript:destruct(\'gallery-image-' + arg_1 + '\');" title="' + get_string('clear') + '">';
            tmp+='<img src="' + URL['root_admin_img'] + 'ico-remove.png" alt="' + get_string('clear') + '" />';
            tmp+='</a>';
            tmp+='</span>';
            tmp+='<input type="hidden" name="add_images[' + i + '][id_image]" value="' + arg_1 + '" />';
            tmp+='<input type="hidden" name="add_images[' + i + '][name]" value="' + arg_2.replace('"',"'") + '" />';
            tmp+='</div>';
            $('#add_images').append(tmp);

            a_expansion();
        }
        else
        {
            alert_info(get_string('galley-image-exist'));
        }
    }
}

//##return values
//##vyber fotografie z iframu

//#return values
//#pripravi hodnotu pre odoslanie metodou ajax

//#safe-mode
//#$(window).unload(function()
//#{
    //#alert('hmm');
    //#window.stop();
    //#alert_progress('Server je pravdepodobne zaneprazdneny');
    //#sendRequest('action=load');
    //#alert('hmm2');
//#});
//#safe-mode;



//##input preddefined text show/hide
function open_disappear()
{
    $(function()
    {
        BUFFER['input']=Array();
        $('.disappear input[type="text"],.disappear input[type="password"]').each(function() {
            BUFFER['input'][$(this).attr('name')]=$(this).val();
        });
    });
    $(function() {
        $('.disappear input[type="text"],.disappear input[type="password"]').click(function() {
           if(BUFFER['input'][$(this).attr('name')] == $(this).val()) {
               $(this).val('');
           }
        });

        $('.disappear input[type="text"],.disappear input[type="password"]').blur(function() {
           if($(this).val() == '') {
               $(this).val(BUFFER['input'][$(this).attr('name')]);
           }
        });
    });
}
//##input preddefined text show/hide

//#show/hide
function open_wrapper()
{
    $('.wrapper-box .items').each(function() {
        if($(this).css('display')!='none')
        {
            $(this).parent().find('h4 a').addClass('open');
        }
    });
    $('.wrapper').click(function()
    {
        if($(this).hasClass('open'))
        {
            $(this).removeClass();
            $(this).addClass('wrapper');
            $($(this).attr('rel')).css('display','none');
        }
        else
        {
            $(this).addClass('open');
            $($(this).attr('rel')).css('display','block');
        }
    });
}
//#show/hide

//##tabs
function open_tabs()
{
    var tabContainers=$('div.tabs > div');
    tabContainers.hide().filter(':first').show();

    $('div.tabs ul.navigation a').click(function ()
    {
        tabContainers.hide();
        tabContainers.filter(this.hash).show();
        $('div.tabs ul.navigation a').removeClass('selected');
        $(this).addClass('selected');
        return false;
    }).filter(':first').click();

    var tabContainersB=$('div.tabsB > div');
    tabContainersB.hide().filter(':first').show();

    $('div.tabsB ul.navigation a').click(function ()
    {
        tabContainersB.hide();
        tabContainersB.filter(this.hash).show();
        $('div.tabsB ul.navigation a').removeClass('selected');
        $(this).addClass('selected');
        return false;
    }).filter(':first').click();
}
//##tabs

//#auto-submit
function open_autosubmit()
{
    $('.submit-box input[type="checkbox"]').change(function(){
        $('.submit-box form').submit();
    });
    $('.submit-box select').change(function(){
        $('.submit-box form').submit();
    });
}
//#auto-submit

function open_options()
{
    //#remove
    $('.remove-a').click(function(){
        var name=null;
        if($('#' + $(this).attr('rel') + ' .flag').length>0)
        {
            name=$('#' + $(this).attr('rel') + ' .flag').html();
        }
        if(name==null)
        {
            name='';
        }
        create_popup('remove',name,$(this).attr('rel'));
    });
}

//#return values
//#engine pre akcne tlacidla ako napr remove

//##menu tree
function open_menu_treeview()
{
    $('.treeview').treeview({
         collapsed:     true,
         animated:      'medium',
         prerendered:   false,
         persist:       'location',
         unique:        true,
         urlshort:      true
    });
}
//##menu tree

//##menu horizontal/vertical
function open_menu_sf()
{
    $('.menu ul.sf-menu').superfish({
        animation:  {height: 'show'},
        speed:      400,
        delay:      600,
        autoArrows: false,
        dropShadows:false
    });
}
//##menu horizontal/vertical

function open_print()
{
     $('.printPage').click(function(){
         window.print();

         //#$('html').printElement({
         //#    //printMode:         'popup',
         //#    pageTitle:         '',
         //#    overrideElementCSS:null,
         //#    leaveOpen:         false
         //#});
     });
}

function open_colorbox()
{
    //##colorbox
    $('.showColors').click(function(){
        if($('#boxcolor-' + $(this).attr('id')).length==0)
        {
            var div=document.createElement('div');
            div.innerHTML=get_p_ColorBox($(this).attr('id'));
            div.id='boxcolor-' + $(this).attr('id');
            div.className='box-color';
            $($(this).parent().find('span')).append(div);
        }
    });
    //##colorbox
}
//##########
//##########

//#nacitanie funkcii pri starte
$(function()
{
    if($('.menu .treeview').length!=0)
    {
        //##nastavenie menu typu treeview
        open_menu_treeview();
    }
    if($('.menu ul.sf-menu').length!=0)
    {
        //##nastavenie menu typu sf
        open_menu_sf();
    }
    if($('#add_image').length>0)
    {
        //##nastavenie iframov od cuteeditora
        row_click('',$('#add_image').val());
    }
    $('.smilles-a').click(function(){
        var request='';
        request+='action=main';
        request+='&request=get-smilles';
        sendRequest(request);
    });
    $('.place-box').each(function() {
        var tpl='';
        tpl+=$(this).html();
        tpl+='<br />';
        tpl+=$(this).width() + 14;
        tpl+='x';
        tpl+=$(this).height() + 14;
        $(this).html(tpl);
    });
    
    $(document).ready(function()
    {
        //##nastavenie aktivneho inputs
        $('#inputFirstPoint, .inputFirstPoint').focus();
        
        //##load dalsich funkcii
        if(window.open_colorbox){open_colorbox();}
        if(window.open_print){open_print();}
        if(window.open_autosubmit){open_autosubmit();}
        if(window.open_options){open_options();}
        if(window.open_disappear){open_disappear();}
        if(window.open_wrapper){open_wrapper();}
        if(window.open_tabs){open_tabs();}
        if(window.open_autocomplete){open_autocomplete();}
        if(window.open_datepicker){open_datepicker();}
        if(window.open_calendar){open_calendar();}
        if(window.open_sortable){open_sortable();}
        if(window.open_uploadify){open_uploadify();}

        //##load socialnych funkcii
        if(window.check_glass){check_glass();}
        if(window.check_panel){check_panel();}
        if(window.check_resize)
        {
            check_resize();
            resizeTimer=setTimeout("check_resize();",resizeTimerLimit);
        }
        if(window.check_online && !window.check_glass)
        {
            check_online();
        }
    });
});
//#nacitanie funkcii pri starte;



//##ajax response
function sendRequestOK()
{
    if(ajaxRequest.readyState==4 && ajaxRequest.responseText!='')
    {
        $('html').css('cursor','default');
        $('a').css('cursor','pointer');
        $('.icon').css('cursor','move');
        var return_value=eval("(" + ajaxRequest.responseText + ")");
        if(return_value.result==1)
        {
            switch(return_value.action)
            {
                //#requests
                case 'requests-request-confirm':
                    switch(return_value.ret)
                    {
                        case '1':   destruct(return_value.id);
                                    alert_ok(get_string('request-confirm-success'));         break;
                        case '3':   alert_info(get_string('request-confirm-confirmed'));   break;
                        case '4':   alert_error(get_string('request-confirm-error'));     break;
                    }
                    break;
                case 'requests-request-add':
                    switch(return_value.ret)
                    {
                        case '1':   alert_ok(get_string('request-add-success'));     break;
                        case '2':   alert_info(get_string('request-add-exist'));   break;
                        case '4':   alert_error(get_string('request-add-error')); break;
                    }
                    break;
                //#friends
                case 'friend-add':
                    switch(return_value.ret)
                    {
                        case '1':   close_popup('friend-add');
                                    alert_ok(get_string('friend-add-success'));      break;
                        case '2':   alert_info(get_string('friend-add-exist'));    break;
                        case '4':   close_popup('friend-add');
                                    alert_error(get_string('friend-add-error'));  break;
                    }
                    break;
                case 'friend-groups-get':
                    switch(return_value.ret)
                    {
                        case '1':   value_select(return_value.values,'friendGroup');            break;
                        case '4':   alert_error(get_string('groups-get-error'));  break;
                    }
                    break;
                //restaurant
                case 'restaurant-cart-add':
                    switch(return_value.ret)
                    {
                        case '1':   restaurantCartUpdate(return_value.price);
                                    alert_ok(get_string('cart-add-successfully'));   break;
                        case '4':   alert_error(get_string('cart-add-error'));    break;
                    }
                    break;
                case 'restaurant-cart-clear':
                    switch(return_value.ret)
                    {
                        case '1':   restaurantCartClear();
                                    restaurantCartUpdate('0 ' + get_string('currency'));        break;
                        case '4':   alert_error(get_string('cart-clear-error'));  break;
                    }
                    break;
                case 'restaurant-cart-remove':
                    switch(return_value.ret)
                    {
                        case '1':   restaurantCartUpdate(return_value.price);
                                    destruct(return_value.id);                                  break;
                        case '4':   alert_error(get_string('cart-remove-error')); break;
                    }
                    break;
                case 'restaurant-ingredient-get':
                    switch(return_value.ret)
                    {
                        case '1':   if(isEmpty(return_value.ingredients))
                                    {
                                        create_popup('cart-add',null,return_value.id);
                                    }
                                    else
                                    {
                                        restaurantIngredientsAddDialog(return_value.id);
                                        for(var i in return_value.ingredients)
                                        {
                                            restaurantIngredientsAdd(return_value.ingredients[i]);
                                        }
                                    }                                                               break;
                        case '4':   alert_error(get_string('ingredient-get-error'));  break;
                    }
                    break;
                //eshop
                case 'eshop-favourite-add':
                    switch(return_value.ret)
                    {
                        case '1':   alert_ok(get_string('add-product-favourite-success'));       break;
                        case '2':   alert_info(get_string('add-product-favourite-exist'));     break;
                        case '4':   alert_error(get_string('add-product-favourite-error'));   break;
                    }
                    break;
                case 'eshop-compare-add':
                    switch(return_value.ret)
                    {
                        case '1':   alert_ok(get_string('add-product-compare-success'));     break;
                        case '2':   alert_info(get_string('add-product-compare-exist'));   break;
                        case '3':   alert_info(get_string('add-product-compare-overflow'));break;
                        case '4':   alert_error(get_string('add-product-compare-error')); break;
                    }
                    break;
                case 'eshop-compare-remove':
                    switch(return_value.ret)
                    {
                        case '1':   eshopCompareRemove(return_value.id);                                    break;
                        case '3':   alert_info(get_string('remove-product-compare-noexist'));  break;
                        case '4':   alert_error(get_string('remove-product-compare-error'));  break;
                    }
                    break;
                //#eshop
                case 'eshop-cart-add':
                    switch(return_value.ret)
                    {
                        case '1':   eshopCartUpdate(
                                        return_value.price_current_with_tax,
                                        return_value.price_current_without_tax,
                                        return_value.amount,
                                        return_value.amount_total,
                                        return_value.id
                                    );
                                    alert_ok(get_string('cart-add-success'));    break;
                        case '4':   alert_error(get_string('cart-add-error'));break;
                    }
                    break;
                case 'eshop-cart-clear':
                    switch(return_value.ret)
                    {
                        case '1':   eshopCartUpdate(
                                        '0 ' + get_string('currency'),
                                        '0 ' + get_string('currency'),
                                        0,
                                        0,
                                        0
                                    );
                                    eshopCartClear();
                                    alert_ok(get_string('cart-clear-succes'));       break;
                        case '4':   alert_error(get_string('cart-clear-error'));  break;
                    }
                    break;
                case 'eshop-cart-remove':
                    switch(return_value.ret)
                    {
                        case '1':   eshopCartUpdate(
                                        return_value.price_current_with_tax,
                                        return_value.price_current_without_tax,
                                        return_value.amount,
                                        return_value.amount_total,
                                        return_value.id
                                    );
                                    destruct(return_value.id);                                  break;
                        case '4':   alert_error(get_string('cart-clear-error'));  break;
                    }
                    break;
                case 'eshop-cart-calculate':
                    switch(return_value.ret)
                    {
                        case '1':   eshopCartUpdate(
                                        return_value.price_current_with_tax,
                                        return_value.price_current_without_tax,
                                        return_value.amount,
                                        return_value.amount_total,
                                        return_value.id
                                    );                                                              break;
                        case '4':   alert_error(get_string('cart-calculate-error'));  break;
                    }
                    break;
                //#profile
                case 'profile-report-add':
                    $('#add_profileReport').val('');
                    switch(return_value.ret)
                    {
                        case '1':   profileReportAdd(return_value);                             break;
                        case '4':   alert_error(get_string('add-report-error'));  break;
                    }
                    break;
                //#logout
                case 'logout':
                    sendRequest_clear();
                    alert_info(get_string('unsubscribed'));
                    break;
                //###############################################################################################################################
                //#urobit poriadok druhe kolo####################################################################################################
                //#remove
                case 'remove':
                    switch(return_value.status)
                    {
                        case '1':destruct(return_value.id);                                 break;
                        case '2':alert_info(get_string(return_value.alert));   break;
                        case '3':alert_error(get_string(return_value.alert)); break;
                    }
                    break;
                //#eshop
                case 'eshop-categories-get':
                    i=1;
                    $('#' + return_value.id_parent).parent().find('select').each(function() {
                        if(i>(return_value.level-1) && i>1)
                        {
                            $(this).remove();
                        }
                        i++;
                    });
                    if(return_value.values.length>1)
                    {
                        cloneItemId('#' + return_value.id_parent,return_value.id_child,'#' + return_value.id_parent);
                        $('#' + return_value.id_child + ' option').remove();
                        value_select(return_value.values,return_value.id_child);
                    }
                    break;
                //#location
                case 'location':
                    value_select(return_value.values,return_value.id);
                    break;
                //smilles
                case 'smilles':
                    create_popup('smilles',return_value.value,null,800,250);
                    break;
                case 'polls':
                    switch(return_value.vote)
                    {
                        case '1':
                            var answers=return_value.answers.split('|');
                            for(var i in answers)
                            {
                                answer=answers[i].split(':');
                                $('#poll-answer-' + answer[0]).html('(' + answer[1] + ' %)');
                                $('#poll-bar-' + answer[0]).css('width',answer[1] + '%');
                            }
                            $('#poll-count-' + return_value.id).html(return_value.count);
                            break;
                        case '0':
                            alert_info(get_string('poll-already-voted'));
                            break;
                    }
                    break;
                //#urobit poriadok//####################################################################################################
                case 'no-alert':
                    break;
                default:
                    alert(get_string('ajax-error-4') + "\n\n" + ajaxRequest.responseText);
                    break;
            }
        }
        else
        {
            switch(return_value.action)
            {
                case 'wrong-section':       alert(get_string('ajax-error-2') + "\n" + 'wrong-section');     break;
                case 'wrong-request':       alert(get_string('ajax-error-2') + "\n" + 'wrong-request');     break;
                case 'wrong-action':        alert(get_string('ajax-error-2') + "\n" + 'wrong-action');      break;
                case 'wrong-parameters':    alert(get_string('ajax-error-2') + "\n" + 'wrong-parameters');  break;
                case 'wrong-atribute':      alert(get_string('ajax-error-2') + "\n" + 'wrong-atribute');    break;
                case 'access-denied':       alert(get_string('ajax-error-2') + "\n" + 'access-denied');     break;
                case 'no-permissions':      alert_info(get_string('no-permissions'));                       break;
                case 'system-resources':    alert_info(get_string('ajax-error-5'));                         break;
                case 'system-time':         alert_info(get_string('ajax-error-6'));                         break;
                case 'system-error':        alert_error(get_string('ajax-error-7'));                        break;
                default:                    alert_error(get_string('ajax-error-result'));                   break;
            }
        }
        sendRequest_send();
    }
}
//##ajax response;




function get_p_filter(id,data)
{
    var tmp='';
    var request;
    request ='action=main';
    request+='&request=filter-data';
    sendRequest(request);
    tmp+='<div>';
    tmp+='<div class="report_in">';
    tmp+='<form method="post" action="' + URL['root'] + 'admin/' + (GET['module']!='' ? GET['module'] + '/' + (GET['submodule']!='' ? GET['submodule'] + '/' + (GET['item']!=0 ? GET['item'] + '/' : '') : '') : '') + '">';
    tmp+='<div>';
    tmp+='<div><input type="checkbox" name="filter_hidden" id="filter_display" onchange="filter_change(\'display\');" /><label for="filter_display">' + get_string('display-hidden-items') + '</label></div>';
    tmp+='<div><input type="checkbox" name="filter_clickable" id="filter_clickable" onchange="filter_change(\'clickable\');" /><label for="filter_clickable">' + get_string('display-noclickable-items') + '</label></div>';
    tmp+='<div>';
    tmp+='<br /><input type="radio" name="filter_icons" class="content_items_display" value="large-icons" onchange="filter_change(\'icons\');" id="large-icons" /><label for="large-icons">' + get_string('big-icons') + '</label>';
    tmp+='<br /><input type="radio" name="filter_icons" class="content_items_display" value="small-icons" onchange="filter_change(\'icons\');" id="small-icons" /><label for="small-icons">' + get_string('small-icons') + '</label>';
    tmp+='<br /><input type="radio" name="filter_icons" class="content_items_display" value="list" onchange="filter_change(\'icons\');" id="list" /><label for="list">' + get_string('list-icons') + '</label>';
    tmp+='</div>';
    if(data=='eshop')
    {
        tmp+='<div>';
        tmp+='<br /><input type="radio" name="filter_eshop" class="content_items_display" value="categories" onchange="filter_change(\'eshop\');" id="categories" /><label for="categories">' + get_string('categories') + '</label>';
        tmp+='<br /><input type="radio" name="filter_eshop" class="content_items_display" value="producers" onchange="filter_change(\'eshop\');" id="producers" /><label for="producers">' + get_string('producers') + '</label>';
        tmp+='</div>';
    }
    tmp+='</div>';
    tmp+='<div class="buttons">';
    tmp+='<input type="submit" id="filterSubmitButton" value="' + get_string('set') + '" />';
    tmp+='<input type="button" id="filterCancelButton" class="cancel" value="' + get_string('cancel') + '" onclick="close_popup(\'' + id + '\');" />';
    tmp+='</div>';
    tmp+='</form>';
    tmp+='</div>';
    return tmp;
}

function get_p_ok_alert(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_OK">' + data + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_OK">' + get_string('ok') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_error_alert(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_ERROR">' + data + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_ERROR">' + get_string('ok') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_info_alert(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_INFO">' + data + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_INFO">' + get_string('ok') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_help_alert(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + data + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_HELP">' + get_string('ok') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_progress_alert(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_PROGRESS">' + data + '</div>';
    tmp+='<div id="progressbar"></div>';
    tmp+='</div>';
    return tmp;
}

function get_p_remove(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('remove-item') + '<br /><strong>' + data + '</strong></div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax_remove(\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_removes(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('remove-items') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax_removes(\'' + data + '\',\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}


function get_p_undefined(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('undefined-popup') + '<br />' + data + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('cancel') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_bulletin_send(id)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('send-bulletins') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'newslatters-bulletin-send\',\'' + id + '\');" class="report_btn_ok btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_order_status(id)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div><h2>' + get_string('order-status') + '</h2></div>';
    tmp+='<div class="report_in">';
    tmp+='<input type="radio" name="order-status-' + id + '" value="new" id="order-new" /><label for="order-new">' + get_string('new-order') + '</label><br />';
    tmp+='<input type="radio" name="order-status-' + id + '" value="processing" id="order-processing" /><label for="order-processing">' + get_string('processed-order') + '</label><br />';
    tmp+='<input type="radio" name="order-status-' + id + '" value="canceled" id="order-canceled" /><label for="order-canceled">' + get_string('canceled-order') + '</label><br />';
    tmp+='</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'business-order-status\',\'' + id + '\');" class="btn_HELP">' + get_string('save') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('cancel') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_cart_remove(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('remove-item') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'' + data + '-cart-remove\',\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_cart_clear(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('cart-empty') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'' + data + '-cart-clear\',\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_cart_add(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('cart-add') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:restaurantCartAdd(\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_update(id)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('system-update') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'update\',\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_import(id)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('import') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'transfer-import\',\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_project_generate(id)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('project') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'generate-project\',\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_smilles(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="in">' + data + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('close') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_ColorBox(id)
{
    var k=3;
    var tmp='';
    var color='';
    var num=Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');

    tmp+='<div class="close">';
    tmp+='<a href="javascript:set_color(\'' + id + '\',\'close\');">';
    tmp+='<img src="' + URL['root_standard'] + 'clear.png" alt="' + get_string('close') + '" title="' + get_string('close') + '" />';
    tmp+='</a>';
    tmp+='</div>';
    tmp+='<div class="colors">'
    for(var r=0;r<num.length;r=r+k)
    {
        for(var g=0;g<num.length;g=g+k)
        {
            for(var b=0;b<num.length;b=b+k)
            {
                color=num[r] + num[r] + num[g] + num[g] + num[b] + num[b];
                tmp+='<a href="javascript:set_color(\'' + id + '\',\'' + color + '\');">';
                tmp+='<div style="background-color:#' + color + ';"></div>';
                tmp+='</a>';
            }
        }
    }
    tmp+='<a href="javascript:set_color(\'' + id + '\',\'transparent\');">';
    tmp+='<div class="transparent">Transparent</div>';
    tmp+='</a>';
    tmp+='</div>';
    tmp+='<div class="clear"></div>';
    return tmp;
}

function get_p_friend_add(id)
{
    var tmp='';
    tmp+='<div class="report-friend">';
    tmp+='<div class="report_in">';
    tmp+='<h2>' + get_string('find-friend') + '</h2>';
    tmp+='<div class="disappear">';
    tmp+='<input type="text" name="friendUserName" id="friendUserName" value="' + get_string('enter-login-forename-surname') + '" class="autocomplete value" />';
    tmp+='<input type="hidden" name="friendUserId" value="" id="friendUserId" class="id" />';
    tmp+='</div>';
    tmp+='<div class="photo">';
    tmp+='<img src="' + URL['root_img'] + '~undefined/size/~sss" alt="" class="src" id="friendPhoto" />';
    tmp+='</div>';
    tmp+='<div class="clear"></div>';
    tmp+='<div>&nbsp;</div>';
    tmp+='<h3>' + get_string('message-for-user') + '</h3>';
    tmp+='<div><textarea name="friendMessage" colls="10" rows="10" id="friendMessage"></textarea></div>';
    tmp+='<div>&nbsp;</div>';
    tmp+='<h3>' + get_string('include-in-group') + '</h3>';
    tmp+='<div><select name="friendGroup" id="friendGroup"></select></div></div>';
    tmp+='</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:friendsFriendAdd();" class="btn_OK">' + get_string('create') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('close') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_store_cart(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div><h2>' + get_string('store-cart') + '</h2></div>';
    tmp+='<div class="report_in">';
    for(var i in data)
    {
        tmp+='<span>' + get_string('store') + ':</span>&nbsp;<a href="' + URL['root_admin'] + 'eshop/edit-store-cart/' + data[i]['id'] + '/">' + data[i]['name'] + '</a><br />';
    }
    tmp+='</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('cancel') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_empty(id,data)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('empty-item') + '<br /><strong>' + data + '</strong></div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax_empty(\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_file_url(id)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div><h2>' + get_string('download-file-from-url') + '</h2></div>';
    tmp+='<div class="report_in padding">';
    tmp+='<label>' + get_string('url') + ': </label>';
    tmp+='<input type="text" name="url" id="popupGalleryUrl" value="" />';
    tmp+='</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'gallery-download\',\'' + id + '\');" class="btn_HELP">' + get_string('download') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('cancel') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_contact_convert(id)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('contact-convert') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'users-contact-convert\',\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_send_offer(id)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('send-offer') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'eshop-product-send-offer\',\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_player_kick(id)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('kick-player') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'game-player-kick-add\',\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_server_start(id)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('server-start') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'game-server-start\',\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_server_restart(id)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('server-restart') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'game-server-restart\',\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_server_stop(id)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('server-stop') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'game-server-stop\',\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

function get_p_player_unban(id)
{
    var tmp='';
    tmp+='<div>';
    tmp+='<div class="report_in in_HELP">' + get_string('unban-player') + '</div>';
    tmp+='<div class="btns">';
    tmp+='<a href="javascript:ajax(\'game-player-unban\',\'' + id + '\');" class="btn_HELP">' + get_string('yes') + '</a>';
    tmp+='<a href="javascript:close_popup(\'' + id + '\');" class="btn_CANCEL">' + get_string('no') + '</a>';
    tmp+='</div>';
    tmp+='</div>';
    return tmp;
}

//##generatory popupov;



$(function() {
    $('.poll-answer').click(function()
    {
        var request;
        request ='action=polls';
        request+='&id=' + $(this).attr('rel');
        sendRequest(request);
    });
});

//##praca s anketami;



$(function() {
    $('.pricelist-item').click(function(){
         if($(this).find('input[type="checkbox"]').attr('checked'))
         {
             $(this).find('input[type="checkbox"]').attr('checked',false);
         }
         else
         {
             $(this).find('input[type="checkbox"]').attr('checked',true);
         }
         pricelist_calculate($(this).parent().parent().parent().attr('id'));
    });
});

function pricelist_calculate(id)
{
    var sum=0;
    $('#' + id + ' table tbody tr').each(function()
    {
        if($(this).find('input[type=checkbox]').is(':checked'))
        {
            sum=sum + parseInt($(this).find('input[type=checkbox]').val());
        }
    });
    $('#' + id + ' .pricelist-sum span').html(sum);
}

$(function()
{
    $(document).ready(function() {
        open_tooltip('.pricelist .item', 'tooltip');
    });
});

//##praca s cennikom;



function open_tooltip(items,name)
{
    $(items).each(function(i)
    {
        var title=$(this).attr('title');
        if(title!='' && title!='undefined')
        {
            var tmp='<p>' + title + '</p>';
            var div=document.createElement('div');
            div.className=name;
            div.id=name + i;
            div.innerHTML=tmp;
            $('body').append(div);
            var tooltip=$('#'+name+i);
            $(this).removeAttr('title')
            .mouseover(function(kmouse)
            {
                var position=get_position(tooltip,kmouse);
                tooltip.css({left:position[0], top:position[1]});
                tooltip.css({opacity:0.8}).fadeIn(400);
            })
            .mousemove(function(kmouse)
            {
                var position=get_position(tooltip,kmouse);
                tooltip.css({left:position[0], top:position[1]});
            })
            .mouseout(function()
            {
                tooltip.css({left:'-9999px',display:'none'});
            });
        }
    });
}

//#return values
//#tooltip;



$(function()
{
    $(document).ready(function(){
        //#prettyphoto
        if($.fn.prettyPhoto)
        {
            $("a[rel^='galleries']").prettyPhoto({
                animationSpeed:         'fast',
                slideshow:              3000,
                autoplay_slideshow:     false,
                opacity:                0.80,
                showTitle:              true,
                allowResize:            true,
                default_width:          500,
                default_height:         344,
                counter_separator_label:'/',
                theme:                  'facebook',
                hideflash:              false,
                wmode:                  'opaque',
                autoplay:               true,
                modal:                  false,
                overlay_gallery:        true
            });
        }

        //#slideViewer
        if($.fn.slideView)
        {
            $('.slideViewer').slideView();
        }

        //#carousel
        if($.fn.jcarousel)
        {
            $('.carousel').jcarousel({
                vertical:   true,
                scroll:     3
                //#itemFallbackDimension:'20x50'
            });
        }

        //#roundabout
        if($.fn.roundabout)
        {
            $('.roundabout').roundabout({
                startingChild:  0,
                duration:       1200,
                minOpacity:     0.1,
                minScale:       0.1,
                btnNext:        '#roundabout-next',
                btnPrev:        '#roundabout-previous',
                clickToFocus:   true,
                focusBearing:   0.0,
                childSelector:  'div.img',
                //#debug:          true,
                reflect:        false,
                shape:          'lazySusan'
                //#tilt:           90.0
            });
            //#$('.roundabout ul').roundabout_setTilt(100.10);
            //#$('.roundabout ul').roundabout_setBearing(20.20);
            //#$('.roundabout ul').roundabout_adjustTilt(100.10);
            //#$('.roundabout ul').roundabout_adjustBearing(-20.20);
        }

        //#galleriffic
        if($.fn.galleriffic && $('.galleriffic').length!=0)
        {
            $('.galleriffic').galleriffic({
                delay:                     3000,                        //#in milliseconds
                numThumbs:                 40,                          //#The number of thumbnails to show page
                preloadAhead:              40,                          //#Set to -1 to preload all images
                enableTopPager:            false,
                enableBottomPager:         true,
                maxPagesToShow:            7,                           //#The maximum number of pages to display in either the top or bottom pager
                imageContainerSel:         '.gallery-box .slideshow',
                controlsContainerSel:      '.gallery-box .controls',
                captionContainerSel:       '.gallery-box .caption',
                loadingContainerSel:       '.gallery-box .loading',
                renderSSControls:          true,                        //#Specifies whether the slideshow's Play and Pause links should be rendered
                renderNavControls:         true,                        //#Specifies whether the slideshow's Next and Previous links should be rendered
                playLinkText:              get_string('play'),
                pauseLinkText:             get_string('pause'),
                prevLinkText:              get_string('previous'),
                nextLinkText:              get_string('next'),
                nextPageLinkText:          get_string('next'),
                prevPageLinkText:          get_string('previous'),
                enableHistory:             false,                       //#Specifies whether the url's hash and the browser's history cache should update when the current slideshow image changes
                enableKeyboardNavigation:  true,                        //#Specifies whether keyboard navigation is enabled
                autoStart:                 false,                       //#Specifies whether the slideshow should be playing or paused when the page first loads
                syncTransitions:           false,                       //#Specifies whether the out and in transitions occur simultaneously or distinctly
                defaultTransitionDuration: 1000,                        //#If using the default transitions, specifies the duration of the transitions
                onSlideChange:             undefined,                   //#accepts a delegate like such: function(prevIndex, nextIndex) { ... }
                onTransitionOut:           undefined,                   //#accepts a delegate like such: function(slide, caption, isSync, callback) { ... }
                onTransitionIn:            undefined,                   //#accepts a delegate like such: function(slide, caption, isSync) { ... }
                onPageTransitionOut:       undefined,                   //#accepts a delegate like such: function(callback) { ... }
                onPageTransitionIn:        undefined,                   //#accepts a delegate like such: function() { ... }
                onImageAdded:              undefined,                   //#accepts a delegate like such: function(imageData, $li) { ... }
                onImageRemoved:            undefined                    //#accepts a delegate like such: function(imageData, $li) { ... }
            });
        }
        
        //#canvas
        if($('#galleryCanvas').length!=0)
        {
            $('.galleryCanvas').click(function(){
                var src;
                var img;
                var a;
                var href;

                //#nahlad
                img=$('#galleryCanvas');
                if(img.length!==0)
                {
                    src=img.attr('src').split('/');
                    src[5]=$(this).attr('rel');
                    src=src.join('/');
                    img.attr('src',src);
                }

                //#obrazok
                a=$('#galleryCanvas').parent();
                if(a.length!==0)
                {
                    href=a.attr('href').split('/');
                    href[5]=$(this).attr('rel');
                    href=href.join('/');
                    a.attr('href',href);
                }
            });
        }
        
        //#highslide
        if(window.hs)
        {
            hs.graphicsDir=URL['root_public'] + 'css/gallery/highslide/';
            hs.align='center';
            hs.transitions=['expand','crossfade'];
            hs.outlineType='rounded-white';
            hs.fadeInOut=true;
            hs.addSlideshow({
                interval:       DELAY['gallery'],
                repeat:         false,
                useControls:    true,
                fixedControls:  'fit',
                overlayOptions: {
                    opacity:        .75,
                    position:       'bottom center',
                    hideOnMouseOut: true
                }
            });
        }
    });
});;



/*
 * Treeview 1.4 - jQuery plugin to hide and show branches of a tree
 * 
 * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
 * http://docs.jquery.com/Plugins/Treeview
 *
 * Copyright (c) 2007 JĂ¶rn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.treeview.js 4684 2008-02-07 19:08:06Z joern.zaefferer $
 *
 */

;(function($) {

	$.extend($.fn, {
		swapClass: function(c1, c2) {
			var c1Elements = this.filter('.' + c1);
			this.filter('.' + c2).removeClass(c2).addClass(c1);
			c1Elements.removeClass(c1).addClass(c2);
			return this;
		},
		replaceClass: function(c1, c2) {
			return this.filter('.' + c1).removeClass(c1).addClass(c2).end();
		},
		hoverClass: function(className) {
			className = className || "hover";
			return this.hover(function() {
				$(this).addClass(className);
			}, function() {
				$(this).removeClass(className);
			});
		},
		heightToggle: function(animated, callback) {
			animated ?
				this.animate({ height: "toggle" }, animated, callback) :
				this.each(function(){
					jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
					if(callback)
						callback.apply(this, arguments);
				});
		},
		heightHide: function(animated, callback) {
			if (animated) {
				this.animate({ height: "hide" }, animated, callback);
			} else {
				this.hide();
				if (callback)
					this.each(callback);				
			}
		},
		prepareBranches: function(settings) {
			if (!settings.prerendered) {
				// mark last tree items
				this.filter(":last-child:not(ul)").addClass(CLASSES.last);
				// collapse whole tree, or only those marked as closed, anyway except those marked as open
				this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide();
			}
			// return all items with sublists
			return this.filter(":has(>ul)");
		},
		applyClasses: function(settings, toggler) {
			this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) {
				toggler.apply($(this).next());
			}).add( $("a", this) ).hoverClass();
			if (!settings.prerendered) {
				// handle closed ones first
				this.filter(":has(>ul:hidden)")
						.addClass(CLASSES.expandable)
						.replaceClass(CLASSES.last, CLASSES.lastExpandable);
						
				// handle open ones
				this.not(":has(>ul:hidden)")
						.addClass(CLASSES.collapsable)
						.replaceClass(CLASSES.last, CLASSES.lastCollapsable);
						
	            // create hitarea
				this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea).each(function() {
					var classes = "";
					$.each($(this).parent().attr("class").split(" "), function() {
						classes += this + "-hitarea ";
					});
					$(this).addClass( classes );
				});
			}
			
			// apply event to hitarea
			this.find("div." + CLASSES.hitarea).click( toggler );
                        this.find('a.buttonnn').click( toggler );
		},
		treeview: function(settings) {
			
			settings = $.extend({
				cookieId: "treeview"
			}, settings);
			
			if (settings.add) {
				return this.trigger("add", [settings.add]);
			}
			
			if ( settings.toggle ) {
				var callback = settings.toggle;
				settings.toggle = function() {
					return callback.apply($(this).parent()[0], arguments);
				};
			}
		
			// factory for treecontroller
			function treeController(tree, control) {
				// factory for click handlers
				function handler(filter) {
					return function() {
						// reuse toggle event handler, applying the elements to toggle
						// start searching for all hitareas
						toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() {
							// for plain toggle, no filter is provided, otherwise we need to check the parent element
							return filter ? $(this).parent("." + filter).length : true;
						}) );
						return false;
					};
				}
				// click on first element to collapse tree
				$("a:eq(0)", control).click( handler(CLASSES.collapsable) );
				// click on second to expand tree
				$("a:eq(1)", control).click( handler(CLASSES.expandable) );
				// click on third to toggle tree
				$("a:eq(2)", control).click( handler() ); 
			}
		
			// handle toggle event
			function toggler(type) {
                        
                            if ($(this).hasClass('buttonnn')==true)
                            {
                                $(this)
					.parent().parent().parent().parent()
					// swap classes for hitarea
					.find(">.hitarea")
						.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
						.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
					.end()
					// swap classes for parent li
					.swapClass( CLASSES.collapsable, CLASSES.expandable )
					.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
					// find child lists
					.find( ">ul" )
					// toggle them
					.heightToggle( settings.animated, settings.toggle );
                            }
                            else
                            {
				$(this)
					.parent()
					// swap classes for hitarea
					.find(">.hitarea")
						.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
						.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
					.end()
					// swap classes for parent li
					.swapClass( CLASSES.collapsable, CLASSES.expandable )
					.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
					// find child lists
					.find( ">ul" )
					// toggle them
					.heightToggle( settings.animated, settings.toggle );
                            }
				if ( settings.unique ) {
					$(this).parent()
						.siblings()
						// swap classes for hitarea
						.find(">.hitarea")
							.replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
							.replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
						.end()
						.replaceClass( CLASSES.collapsable, CLASSES.expandable )
						.replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
						.find( ">ul" )
						.heightHide( settings.animated, settings.toggle );
				}
			}

			
			function serialize() {
				function binary(arg) {
					return arg ? 1 : 0;
				}
				var data = [];
				branches.each(function(i, e) {
					data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0;
				});
				$.cookie(settings.cookieId, data.join("") );
			}
			
			function deserialize() {
				var stored = $.cookie(settings.cookieId);
				if ( stored ) {
					var data = stored.split("");
					branches.each(function(i, e) {
						$(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ]();
					});
				}
			}
			
			// add treeview class to activate styles
			this.addClass("treeview");
			
			// prepare branches and find all tree items with child lists
			var branches = this.find("li").prepareBranches(settings);
			
			switch(settings.persist) {
			case "cookie":
				var toggleCallback = settings.toggle;
				settings.toggle = function() {
					serialize();
					if (toggleCallback) {
						toggleCallback.apply(this, arguments);
					}
				};
				deserialize();
				break;
			case "location":
				var current = this.find("a").filter(function()
                                {
                                    var urlCompare=URL['root'];
                                    if(settings.urlshort==true)
                                    {
                                        //##vypocet adresy
                                        var url=location.href.toLowerCase();
                                        $('.navigation-box a').each(function()
                                        {
                                            url=$(this).attr('href');
                                        });
                                        url=url.replace(URL['root'],'');
                                        url=url.split('?');
                                        url=url[0].split('/');
                                        for(var i in url)
                                        {
                                            if(url[i]=='polozka' || url[i]=='produkt')
                                            {
                                                break;
                                            }
                                            if(url[i].length>0)
                                            {
                                                urlCompare+=url[i] + '/';
                                            }
                                        }
                                        //##vypocet adresy
                                    }
                                    else
                                    {
                                        urlCompare=location.href.toLowerCase();
                                    }
                                    return this.href.toLowerCase() == urlCompare;
                                });
				if ( current.length ) {
					current.addClass("selected").parents("ul, li").add( current.next() ).show();
                                        current.parent().parent().parent().parent('li').find(' > ul, ul > li').show();
				}
				break;
                        case "item":
                                var currentid = this.find("a").filter(function() {
                                    
                                    if(this.href != 'javascript:void(0);') {
                                        var variables = this.href.split('?');
                                        var test = $.parseQuery(variables[1]);
                                        return test.ItemID == q.ItemID;
                                    } else {
                                        return false;
                                    }
                                });
				if ( currentid.length ) {
					currentid.addClass("selected").parents("ul, li").add( currentid.next() ).show();
                                        currentid.parent().parent().parent().parent('li').find(' > ul, ul > li').show();
				}
                            break;
			}
			
			branches.applyClasses(settings, toggler);
				
			// if control option is set, create the treecontroller and show it
			if ( settings.control ) {
				treeController(this, settings.control);
				$(settings.control).show();
			}
			
			return this.bind("add", function(event, branches) {
				$(branches).prev()
					.removeClass(CLASSES.last)
					.removeClass(CLASSES.lastCollapsable)
					.removeClass(CLASSES.lastExpandable)
				.find(">.hitarea")
					.removeClass(CLASSES.lastCollapsableHitarea)
					.removeClass(CLASSES.lastExpandableHitarea);
				$(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, toggler);
			});
		}
	});
	
	// classes used by the plugin
	// need to be styled via external stylesheet, see first example
	var CLASSES = $.fn.treeview.classes = {
		open:                   "open",
		closed:                 "closed",
		expandable:             "expandable",
		expandableHitarea:      "expandable-hitarea",
		lastExpandableHitarea:  "lastExpandable-hitarea",
		collapsable:            "collapsable",
		collapsableHitarea:     "collapsable-hitarea",
		lastCollapsableHitarea: "lastCollapsable-hitarea",
		lastCollapsable:        "lastCollapsable",
		lastExpandable:         "lastExpandable",
		last:                   "last",
		hitarea:                "hitarea"
	};
	
	// provide backwards compability
	$.fn.Treeview = $.fn.treeview;
	
})(jQuery);;



/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */

;(function($){
	$.fn.superfish = function(op){
		var sf = $.fn.superfish,
			c = sf.c,
			$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
			over = function(){
				var $$ = $(this), menu = getMenu($$);
				clearTimeout(menu.sfTimer);
				$$.showSuperfishUl().siblings().hideSuperfishUl();
			},
			out = function(){
				var $$ = $(this), menu = getMenu($$), o = sf.op;
				clearTimeout(menu.sfTimer);
				menu.sfTimer=setTimeout(function(){
					o.retainPath=($.inArray($$[0],o.$path)>-1);
					$$.hideSuperfishUl();
					if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
				},o.delay);
			},
			getMenu = function($menu){
				var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
				sf.op = sf.o[menu.serial];
				return menu;
			},
			addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };

		return this.each(function() {
			var s = this.serial = sf.o.length;
			var o = $.extend({},sf.defaults,op);
			o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
				$(this).addClass([o.hoverClass,c.bcClass].join(' '))
					.filter('li:has(ul)').removeClass(o.pathClass);
			});
			sf.o[s] = sf.op = o;

			$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
				if (o.autoArrows) addArrow( $('>a:first-child',this) );
			})
			.not('.'+c.bcClass)
				.hideSuperfishUl();

			var $a = $('a',this);
			$a.each(function(i){
				var $li = $a.eq(i).parents('li');
				$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
			});
			o.onInit.call(this);

		}).each(function() {
			var menuClasses = [c.menuClass];
			if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
			$(this).addClass(menuClasses.join(' '));
		});
	};

	var sf = $.fn.superfish;
	sf.o = [];
	sf.op = {};
	sf.IE7fix = function(){
		var o = sf.op;
		if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
			this.toggleClass(sf.c.shadowClass+'-off');
		};
	sf.c = {
		bcClass     : 'sf-breadcrumb',
		menuClass   : 'sf-js-enabled',
		anchorClass : 'sf-with-ul',
		arrowClass  : 'sf-sub-indicator',
		shadowClass : 'sf-shadow'
	};
	sf.defaults = {
		hoverClass	: 'sfHover',
		pathClass	: 'overideThisToUse',
		pathLevels	: 1,
		delay		: 800,
		animation	: {opacity:'show'},
		speed		: 'normal',
		autoArrows	: true,
		dropShadows : true,
		disableHI	: false,		// true disables hoverIntent detection
		onInit		: function(){}, // callback functions
		onBeforeShow: function(){},
		onShow		: function(){},
		onHide		: function(){}
	};
	$.fn.extend({
		hideSuperfishUl : function(){
			var o = sf.op,
				not = (o.retainPath===true) ? o.$path : '';
			o.retainPath = false;
			var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
					.find('>ul').not(".sf-vertical > li > ul").hide().css('visibility','hidden');
			o.onHide.call($ul);
			return this;
		},
		showSuperfishUl : function(){
			var o = sf.op,
				sh = sf.c.shadowClass+'-off',
				$ul = this.addClass(o.hoverClass)
					.find('>ul:hidden').css('visibility','visible');
			sf.IE7fix.call($ul);
			o.onBeforeShow.call($ul);
			$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
			return this;
		}
	});

})(jQuery);;



;




