/*!
 * jQuery JavaScript Library v1.5.1
 * http://jquery.com/
 *
 * Copyright 2011, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2011, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Wed Feb 23 13:55:29 2011 -0500
 */
(function(a,b){function cg(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cd(a){if(!bZ[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";bZ[a]=c}return bZ[a]}function cc(a,b){var c={};d.each(cb.concat.apply([],cb.slice(0,b)),function(){c[this]=a});return c}function bY(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bX(){try{return new a.XMLHttpRequest}catch(b){}}function bW(){d(a).unload(function(){for(var a in bU)bU[a](0,1)})}function bQ(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h==="string"&&(f[h.toLowerCase()]=a.converters[h]);l=k,k=e[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=f[m]||f["* "+k];if(!n){p=b;for(o in f){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=f[j[1]+" "+k];if(p){o=f[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&d.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bP(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bO(a,b,c,e){if(d.isArray(b)&&b.length)d.each(b,function(b,f){c||bq.test(a)?e(a,f):bO(a+"["+(typeof f==="object"||d.isArray(f)?b:"")+"]",f,c,e)});else if(c||b==null||typeof b!=="object")e(a,b);else if(d.isArray(b)||d.isEmptyObject(b))e(a,"");else for(var f in b)bO(a+"["+f+"]",b[f],c,e)}function bN(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bH,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l==="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bN(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bN(a,c,d,e,"*",g));return l}function bM(a){return function(b,c){typeof b!=="string"&&(c=b,b="*");if(d.isFunction(c)){var e=b.toLowerCase().split(bB),f=0,g=e.length,h,i,j;for(;f<g;f++)h=e[f],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bo(a,b,c){var e=b==="width"?bi:bj,f=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return f;d.each(e,function(){c||(f-=parseFloat(d.css(a,"padding"+this))||0),c==="margin"?f+=parseFloat(d.css(a,"margin"+this))||0:f-=parseFloat(d.css(a,"border"+this+"Width"))||0});return f}function ba(a,b){b.src?d.ajax({url:b.src,async:!1,dataType:"script"}):d.globalEval(b.text||b.textContent||b.innerHTML||""),b.parentNode&&b.parentNode.removeChild(b)}function _(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function $(a,b){if(b.nodeType===1){var c=b.nodeName.toLowerCase();b.clearAttributes(),b.mergeAttributes(a);if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(d.expando)}}function Z(a,b){if(b.nodeType===1&&d.hasData(a)){var c=d.expando,e=d.data(a),f=d.data(b,e);if(e=e[c]){var g=e.events;f=f[c]=d.extend({},e);if(g){delete f.handle,f.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)d.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function Y(a,b){return d.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function O(a,b,c){if(d.isFunction(b))return d.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return d.grep(a,function(a,d){return a===b===c});if(typeof b==="string"){var e=d.grep(a,function(a){return a.nodeType===1});if(J.test(b))return d.filter(b,e,!c);b=d.filter(b,e)}return d.grep(a,function(a,e){return d.inArray(a,b)>=0===c})}function N(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function F(a,b){return(a&&a!=="*"?a+".":"")+b.replace(r,"`").replace(s,"&")}function E(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,q=[],r=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;i<t.length;i++)g=t[i],g.origType.replace(p,"")===a.type?r.push(g.selector):t.splice(i--,1);f=d(a.target).closest(r,a.currentTarget);for(j=0,k=f.length;j<k;j++){m=f[j];for(i=0;i<t.length;i++){g=t[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,e=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,e=d(a.relatedTarget).closest(g.selector)[0];(!e||e!==h)&&q.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=q.length;j<k;j++){f=q[j];if(c&&f.level>c)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function C(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function w(){return!0}function v(){return!1}function g(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function f(a,c,f){if(f===b&&a.nodeType===1){f=a.getAttribute("data-"+c);if(typeof f==="string"){try{f=f==="true"?!0:f==="false"?!1:f==="null"?null:d.isNaN(f)?e.test(f)?d.parseJSON(f):f:parseFloat(f)}catch(g){}d.data(a,c,f)}else f=b}return f}var c=a.document,d=function(){function I(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(I,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x=!1,y,z="then done fail isResolved isRejected promise".split(" "),A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,G=Array.prototype.indexOf,H={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.1",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){e=i[c],f=a[c];if(i===f)continue;l&&f&&(d.isPlainObject(f)||(g=d.isArray(f)))?(g?(g=!1,h=e&&d.isArray(e)?e:[]):h=e&&d.isPlainObject(e)?e:{},i[c]=d.extend(l,h,f)):f!==b&&(i[c]=f)}return i},d.extend({noConflict:function(b){a.$=f,b&&(a.jQuery=e);return d},isReady:!1,readyWait:1,ready:function(a){a===!0&&d.readyWait--;if(!d.readyWait||a!==!0&&!d.isReady){if(!c.body)return setTimeout(d.ready,1);d.isReady=!0;if(a!==!0&&--d.readyWait>0)return;y.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=!0;if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&I()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):H[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||C.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g<h;)if(c.apply(a[g++],e)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(var j=a[0];g<h&&c.call(j,g,j)!==!1;j=a[++g]){}return a},trim:F?function(a){return a==null?"":F.call(a)}:function(a){return a==null?"":(a+"").replace(j,"").replace(k,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var e=d.type(a);a.length==null||e==="string"||e==="function"||e==="regexp"||d.isWindow(a)?D.call(c,a):d.merge(c,a)}return c},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length==="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,b,c){var d=[],e;for(var f=0,g=a.length;f<g;f++)e=b(a[f],f,c),e!=null&&(d[d.length]=e);return d.concat.apply([],d)},guid:1,proxy:function(a,c,e){arguments.length===2&&(typeof c==="string"?(e=a,a=e[c],c=b):c&&!d.isFunction(c)&&(e=c,c=b)),!c&&a&&(c=function(){return a.apply(e||this,arguments)}),a&&(c.guid=a.guid=a.guid||c.guid||d.guid++);return c},access:function(a,c,e,f,g,h){var i=a.length;if(typeof c==="object"){for(var j in c)d.access(a,j,c[j],f,g,e);return a}if(e!==b){f=!h&&f&&d.isFunction(e);for(var k=0;k<i;k++)g(a[k],c,f?e.call(a[k],k,g(a[k],c)):e,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},_Deferred:function(){var a=[],b,c,e,f={done:function(){if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this},resolveWith:function(d,f){if(!e&&!b&&!c){c=1;try{while(a[0])a.shift().apply(d,f)}catch(g){throw g}finally{b=[d,f],c=0}}return this},resolve:function(){f.resolveWith(d.isFunction(this.promise)?this.promise():this,arguments);return this},isResolved:function(){return c||b},cancel:function(){e=1,a=[];return this}};return f},Deferred:function(a){var b=d._Deferred(),c=d._Deferred(),e;d.extend(b,{then:function(a,c){b.done(a).fail(c);return this},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,promise:function(a){if(a==null){if(e)return e;e=a={}}var c=z.length;while(c--)a[z[c]]=b[z[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){var b=arguments.length,c=b<=1&&a&&d.isFunction(a.promise)?a:d.Deferred(),e=c.promise();if(b>1){var f=E.call(arguments,0),g=b,h=function(a){return function(b){f[a]=arguments.length>1?E.call(arguments,0):b,--g||c.resolveWith(e,f)}};while(b--)a=f[b],a&&d.isFunction(a.promise)?a.promise().then(h(b),c.reject):--g;g||c.resolveWith(e,f)}else c!==a&&c.resolve(a);return e},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),y=d._Deferred(),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){H["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),G&&(d.inArray=function(a,b){return G.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?A=function(){c.removeEventListener("DOMContentLoaded",A,!1),d.ready()}:c.attachEvent&&(A=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",A),d.ready())});return d}();(function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e),b=e=f=null}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function"),b=null;return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}})();var e=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!g(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,h=b.nodeType,i=h?d.cache:b,j=h?b[d.expando]:d.expando;if(!i[j])return;if(c){var k=e?i[j][f]:i[j];if(k){delete k[c];if(!g(k))return}}if(e){delete i[j][f];if(!g(i[j]))return}var l=i[j][f];d.support.deleteExpando||i!=a?delete i[j]:i[j]=null,l?(i[j]={},h||(i[j].toJSON=d.noop),i[j][f]=l):h&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var g=this[0].attributes,h;for(var i=0,j=g.length;i<j;i++)h=g[i].name,h.indexOf("data-")===0&&(h=h.substr(5),f(this[0],h,e[h]))}}return e}if(typeof a==="object")return this.each(function(){d.data(this,a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(c===b){e=this.triggerHandler("getData"+k[1]+"!",[k[0]]),e===b&&this.length&&(e=d.data(this[0],a),e=f(this[0],a,e));return e===b&&k[1]?this.data(k[0]):e}return this.each(function(){var b=d(this),e=[k[0],c];b.triggerHandler("setData"+k[1]+"!",e),d.data(this,a,c),b.triggerHandler("changeData"+k[1]+"!",e)})},removeData:function(a){return this.each(function(){d.removeData(this,a)})}}),d.extend({queue:function(a,b,c){if(a){b=(b||"fx")+"queue";var e=d._data(a,b);if(!c)return e||[];!e||d.isArray(c)?e=d._data(a,b,d.makeArray(c)):e.push(c);return e}},dequeue:function(a,b){b=b||"fx";var c=d.queue(a,b),e=c.shift();e==="inprogress"&&(e=c.shift()),e&&(b==="fx"&&c.unshift("inprogress"),e.call(a,function(){d.dequeue(a,b)})),c.length||d.removeData(a,b+"queue",!0)}}),d.fn.extend({queue:function(a,c){typeof a!=="string"&&(c=a,a="fx");if(c===b)return d.queue(this[0],a);return this.each(function(b){var e=d.queue(this,a,c);a==="fx"&&e[0]!=="inprogress"&&d.dequeue(this,a)})},dequeue:function(a){return this.each(function(){d.dequeue(this,a)})},delay:function(a,b){a=d.fx?d.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){d.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var h=/[\n\t\r]/g,i=/\s+/,j=/\r/g,k=/^(?:href|src|style)$/,l=/^(?:button|input)$/i,m=/^(?:button|input|object|select|textarea)$/i,n=/^a(?:rea)?$/i,o=/^(?:radio|checkbox)$/i;d.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"},d.fn.extend({attr:function(a,b){return d.access(this,a,b,!0,d.attr)},removeAttr:function(a,b){return this.each(function(){d.attr(this,a,""),this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.addClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"){var b=(a||"").split(i);for(var c=0,e=this.length;c<e;c++){var f=this[c];if(f.nodeType===1)if(f.className){var g=" "+f.className+" ",h=f.className;for(var j=0,k=b.length;j<k;j++)g.indexOf(" "+b[j]+" ")<0&&(h+=" "+b[j]);f.className=d.trim(h)}else f.className=a}}return this},removeClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"||a===b){var c=(a||"").split(i);for(var e=0,f=this.length;e<f;e++){var g=this[e];if(g.nodeType===1&&g.className)if(a){var j=(" "+g.className+" ").replace(h," ");for(var k=0,l=c.length;k<l;k++)j=j.replace(" "+c[k]+" "," ");g.className=d.trim(j)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,e=typeof b==="boolean";if(d.isFunction(a))return this.each(function(c){var e=d(this);e.toggleClass(a.call(this,c,e.attr("class"),b),b)});return this.each(function(){if(c==="string"){var f,g=0,h=d(this),j=b,k=a.split(i);while(f=k[g++])j=e?j:!h.hasClass(f),h[j?"addClass":"removeClass"](f)}else if(c==="undefined"||c==="boolean")this.className&&d._data(this,"__className__",this.className),this.className=this.className||a===!1?"":d._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(h," ").indexOf(b)>-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var k=i?f:0,l=i?f+1:h.length;k<l;k++){var m=h[k];if(m.selected&&(d.support.optDisabled?!m.disabled:m.getAttribute("disabled")===null)&&(!m.parentNode.disabled||!d.nodeName(m.parentNode,"optgroup"))){a=d(m).val();if(i)return a;g.push(a)}}if(i&&!g.length&&h.length)return d(h[f]).val();return g}if(o.test(c.type)&&!d.support.checkOn)return c.getAttribute("value")===null?"on":c.value;return(c.value||"").replace(j,"")}return b}var n=d.isFunction(a);return this.each(function(b){var c=d(this),e=a;if(this.nodeType===1){n&&(e=a.call(this,b,c.val())),e==null?e="":typeof e==="number"?e+="":d.isArray(e)&&(e=d.map(e,function(a){return a==null?"":a+""}));if(d.isArray(e)&&o.test(this.type))this.checked=d.inArray(c.val(),e)>=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=k.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&l.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var o=a.getAttributeNode("tabIndex");return o&&o.specified?o.value:m.test(a.nodeName)||n.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var p=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return p===null?b:p}h&&(a[c]=e);return a[c]}});var p=/\.(.*)$/,q=/^(?:textarea|input|select)$/i,r=/\./g,s=/ /g,t=/[^\w\s.|`]/g,u=function(a){return a.replace(t,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=v;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(){return typeof d!=="undefined"&&!d.event.triggered?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=v);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),u).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))d.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=d.event.special[h]||{};for(j=f||0;j<p.length;j++){q=p[j];if(e.guid===q.guid){if(l||n.test(q.namespace))f==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(f!=null)break}}if(p.length===0||f!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&d.removeEvent(a,h,s.handle),g=null,delete t[h]}if(d.isEmptyObject(t)){var w=s.handle;w&&(w.elem=null),delete s.events,delete s.handle,d.isEmptyObject(s)&&d.removeData(a,b,!0)}}},trigger:function(a,c,e){var f=a.type||a,g=arguments[3];if(!g){a=typeof a==="object"?a[d.expando]?a:d.extend(d.Event(f),a):d.Event(f),f.indexOf("!")>=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(p,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=!0,l[m]())}catch(q){}k&&(l["on"+m]=k),d.event.triggered=!1}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l<m;l++){var n=f[l];if(e||h.test(n.namespace)){c.handler=n.handler,c.data=n.data,c.handleObj=n;var o=n.handler.apply(this,k);o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}}return c.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[d.expando])return a;var e=a;a=d.Event(e);for(var f=this.props.length,g;f;)g=this.props[--f],a[g]=e[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=c.documentElement,i=c.body;a.pageX=a.clientX+(h&&h.scrollLeft||i&&i.scrollLeft||0)-(h&&h.clientLeft||i&&i.clientLeft||0),a.pageY=a.clientY+(h&&h.scrollTop||i&&i.scrollTop||0)-(h&&h.clientTop||i&&i.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!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:d.proxy,special:{ready:{setup:d.bindReady,teardown:d.noop},live:{add:function(a){d.event.add(this,F(a.origType,a.selector),d.extend({},a,{handler:E,guid:a.handler.guid}))},remove:function(a){d.event.remove(this,F(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){d.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},d.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},d.Event=function(a){if(!this.preventDefault)return new d.Event(a);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?w:v):this.type=a,this.timeStamp=d.now(),this[d.expando]=!0},d.Event.prototype={preventDefault:function(){this.isDefaultPrevented=w;var a=this.originalEvent;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=w;var a=this.originalEvent;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=w,this.stopPropagation()},isDefaultPrevented:v,isPropagationStopped:v,isImmediatePropagationStopped:v};var x=function(a){var b=a.relatedTarget;try{if(b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&(a.type=a.data,d.event.handle.apply(this,arguments))}catch(e){}},y=function(a){a.type=a.data,d.event.handle.apply(this,arguments)};d.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){d.event.special[a]={setup:function(c){d.event.add(this,b,c&&c.selector?y:x,a)},teardown:function(a){d.event.remove(this,b,a&&a.selector?y:x)}}}),d.support.submitBubbles||(d.event.special.submit={setup:function(a,b){if(this.nodeName&&this.nodeName.toLowerCase()!=="form")d.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&d(b).closest("form").length&&C("submit",this,arguments)}),d.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&d(b).closest("form").length&&a.keyCode===13&&C("submit",this,arguments)});else return!1},teardown:function(a){d.event.remove(this,".specialSubmit")}});if(!d.support.changeBubbles){var z,A=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},B=function B(a){var c=a.target,e,f;if(q.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=A(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:B,beforedeactivate:B,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&B.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&B.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",A(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in z)d.event.add(this,c+".specialChange",z[c]);return q.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return q.test(this.nodeName)}},z=d.event.special.change.filters,z.focus=z.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function c(a){a=d.event.fix(a),a.type=b;return d.event.handle.call(this,a)}d.event.special[b]={setup:function(){this.addEventListener(a,c,!0)},teardown:function(){this.removeEventListener(a,c,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i<j;i++)d.event.add(this[i],a,h,e);return this}}),d.fn.extend({unbind:function(a,b){if(typeof a!=="object"||a.preventDefault)for(var e=0,f=this.length;e<f;e++)d.event.remove(this[e],a,b);else for(var c in a)this.unbind(c,a[c]);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){d.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var c=d.Event(a);c.preventDefault(),c.stopPropagation(),d.event.trigger(c,b,this[0]);return c.result}},toggle:function(a){var b=arguments,c=1;while(c<b.length)d.proxy(a,b[c++]);return this.click(d.proxy(a,function(e){var f=(d._data(this,"lastToggle"+a.guid)||0)%c;d._data(this,"lastToggle"+a.guid,f+1),e.preventDefault();return b[f].apply(this,arguments)||!1}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var D={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};d.each(["live","die"],function(a,c){d.fn[c]=function(a,e,f,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:d(this.context);if(typeof a==="object"&&!a.preventDefault){for(var o in a)n[c](o,e,a[o],m);return this}d.isFunction(e)&&(f=e,e=b),a=(a||"").split(" ");while((h=a[i++])!=null){j=p.exec(h),k="",j&&(k=j[0],h=h.replace(p,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,h==="focus"||h==="blur"?(a.push(D[h]+k),h=h+k):h=(D[h]||h)+k;if(c==="live")for(var q=0,r=n.length;q<r;q++)d.event.add(n[q],"live."+F(h,m),{data:e,selector:m,handler:f,origType:h,origHandler:f,preType:l});else n.unbind("live."+F(h,m),f)}return this}}),d.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){d.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!=="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!=="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(f){if(f===!0)continue}else g=o=!0}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=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|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b==="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1){}a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!=="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!=="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.getAttribute("type")},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(a===b){g=!0;return 0}if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector,d=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(e){d=!0}b&&(k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(d||!l.match.PSEUDO.test(c)&&!/!=/.test(c))return b.call(a,c)}catch(e){}return k(c,null,null,[a]).length>0})}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};d.find=k,d.expr=k.selectors,d.expr[":"]=d.expr.filters,d.unique=k.uniqueSort,d.text=k.getText,d.isXMLDoc=k.isXML,d.contains=k.contains}();var G=/Until$/,H=/^(?:parents|prevUntil|prevAll)/,I=/,/,J=/^.[^:#\[\.,]*$/,K=Array.prototype.slice,L=d.expr.match.POS,M={children:!0,contents:!0,next:!0,prev:!0};d.fn.extend({find:function(a){var b=this.pushStack("","find",a),c=0;for(var e=0,f=this.length;e<f;e++){c=b.length,d.find(a,this[e],b);if(e>0)for(var g=c;g<b.length;g++)for(var h=0;h<c;h++)if(b[h]===b[g]){b.splice(g--,1);break}}return b},has:function(a){var b=d(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(d.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(O(this,a,!1),"not",a)},filter:function(a){return this.pushStack(O(this,a,!0),"filter",a)},is:function(a){return!!a&&d.filter(a,this).length>0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e<f;e++)i=a[e],j[i]||(j[i]=d.expr.match.POS.test(i)?d(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=L.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e<f;e++){g=this[e];while(g){if(l?l.index(g)>-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(N(c[0])||N(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=K.call(arguments);G.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!M[a]?d.unique(f):f,(this.length>1||I.test(e))&&H.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var P=/ jQuery\d+="(?:\d+|null)"/g,Q=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,S=/<([\w:]+)/,T=/<tbody/i,U=/<|&#?\w+;/,V=/<(?:script|object|embed|option|style)/i,W=/checked\s*(?:[^=]|=\s*.checked.)/i,X={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,"",""]};X.optgroup=X.option,X.tbody=X.tfoot=X.colgroup=X.caption=X.thead,X.th=X.td,d.support.htmlSerialize||(X._default=[1,"div<div>","</div>"]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(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,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(P,""):null;if(typeof a!=="string"||V.test(a)||!d.support.leadingWhitespace&&Q.test(a)||X[(S.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(R,"<$1></$2>");try{for(var c=0,e=this.length;c<e;c++)this[c].nodeType===1&&(d.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(f){this.empty().append(a)}}return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(d.isFunction(a))return this.each(function(b){var c=d(this),e=c.html();c.replaceWith(a.call(this,b,e))});typeof a!=="string"&&(a=d(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;d(this).remove(),b?d(b).before(a):d(c).append(a)})}return this.pushStack(d(d.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,e){var f,g,h,i,j=a[0],k=[];if(!d.support.checkClone&&arguments.length===3&&typeof j==="string"&&W.test(j))return this.each(function(){d(this).domManip(a,c,e,!0)});if(d.isFunction(j))return this.each(function(f){var g=d(this);a[0]=j.call(this,f,c?g.html():b),g.domManip(a,c,e)});if(this[0]){i=j&&j.parentNode,d.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?f={fragment:i}:f=d.buildFragment(a,this,k),h=f.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&d.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)e.call(c?Y(this[l],g):this[l],f.cacheable||m>1&&l<n?d.clone(h,!0,!0):h)}k.length&&d.each(k,ba)}return this}}),d.buildFragment=function(a,b,e){var f,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]==="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!V.test(a[0])&&(d.support.checkClone||!W.test(a[0]))&&(g=!0,h=d.fragments[a[0]],h&&(h!==1&&(f=h))),f||(f=i.createDocumentFragment(),d.clean(a,i,f,e)),g&&(d.fragments[a[0]]=h?f:1);return{fragment:f,cacheable:g}},d.fragments={},d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(c){var e=[],f=d(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&f.length===1){f[b](this[0]);return this}for(var h=0,i=f.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){$(a,e),f=_(a),g=_(e);for(h=0;f[h];++h)$(f[h],g[h])}if(b){Z(a,e);if(c){f=_(a),g=_(e);for(h=0;f[h];++h)Z(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||U.test(i)){if(typeof i==="string"){i=i.replace(R,"<$1></$2>");var j=(S.exec(i)||["",""])[1].toLowerCase(),k=X[j]||X._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=T.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]==="<table>"&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&Q.test(i)&&m.insertBefore(b.createTextNode(Q.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bb=/alpha\([^)]*\)/i,bc=/opacity=([^)]*)/,bd=/-([a-z])/ig,be=/([A-Z])/g,bf=/^-?\d+(?:px)?$/i,bg=/^-?\d/,bh={position:"absolute",visibility:"hidden",display:"block"},bi=["Left","Right"],bj=["Top","Bottom"],bk,bl,bm,bn=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bk(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bk)return bk(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bd,bn)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bo(a,b,e):d.swap(a,bh,function(){f=bo(a,b,e)});if(f<=0){f=bk(a,b,b),f==="0px"&&bm&&(f=bm(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bf.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return bc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bb.test(f)?f.replace(bb,e):c.filter+" "+e}}),c.defaultView&&c.defaultView.getComputedStyle&&(bl=function(a,c,e){var f,g,h;e=e.replace(be,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bm=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bf.test(d)&&bg.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bk=bl||bm,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var bp=/%20/g,bq=/\[\]$/,br=/\r?\n/g,bs=/#.*$/,bt=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bu=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bv=/(?:^file|^widget|\-extension):$/,bw=/^(?:GET|HEAD)$/,bx=/^\/\//,by=/\?/,bz=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bA=/^(?:select|textarea)/i,bB=/\s+/,bC=/([?&])_=[^&]*/,bD=/(^|\-)([a-z])/g,bE=function(a,b,c){return b+c.toUpperCase()},bF=/^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,bG=d.fn.load,bH={},bI={},bJ,bK;try{bJ=c.location.href}catch(bL){bJ=c.createElement("a"),bJ.href="",bJ=bJ.href}bK=bF.exec(bJ.toLowerCase()),d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bG)return bG.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("<div>").append(c.replace(bz,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bA.test(this.nodeName)||bu.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(br,"\r\n")}}):{name:b.name,value:c.replace(br,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bJ,isLocal:bv.test(bK[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bM(bH),ajaxTransport:bM(bI),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bP(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bQ(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bD,bE)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bt.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bs,"").replace(bx,bK[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bB),e.crossDomain||(q=bF.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bK[1]||q[2]!=bK[2]||(q[3]||(q[1]==="http:"?80:443))!=(bK[3]||(bK[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bN(bH,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!bw.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(by.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bC,"$1_="+w);e.url=x+(x===e.url?(by.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bN(bI,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bO(g,a[g],c,f);return e.join("&").replace(bp,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bR=d.now(),bS=/(\=)\?(&|$)|()\?\?()/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bR++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bS.test(b.url)||f&&bS.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bS,l),b.url===j&&(f&&(k=k.replace(bS,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bT=d.now(),bU,bV;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bX()||bY()}:bX,bV=d.ajaxSettings.xhr(),d.support.ajax=!!bV,d.support.cors=bV&&"withCredentials"in bV,bV=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),(!a.crossDomain||a.hasContent)&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bU[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bU||(bU={},bW()),h=bT++,g.onreadystatechange=bU[h]=c):c()},abort:function(){c&&c(0,1)}}}});var bZ={},b$=/^(?:toggle|show|hide)$/,b_=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,ca,cb=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(cc("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)e=this[g],f=e.style.display,!d._data(e,"olddisplay")&&f==="none"&&(f=e.style.display=""),f===""&&d.css(e,"display")==="none"&&d._data(e,"olddisplay",cd(e.nodeName));for(g=0;g<h;g++){e=this[g],f=e.style.display;if(f===""||f==="none")e.style.display=d._data(e,"olddisplay")||""}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cc("hide",3),a,b,c);for(var e=0,f=this.length;e<f;e++){var g=d.css(this[e],"display");g!=="none"&&!d._data(this[e],"olddisplay")&&d._data(this[e],"olddisplay",g)}for(e=0;e<f;e++)this[e].style.display="none";return this},_toggle:d.fn.toggle,toggle:function(a,b,c){var e=typeof a==="boolean";d.isFunction(a)&&d.isFunction(b)?this._toggle.apply(this,arguments):a==null||e?this.each(function(){var b=e?a:d(this).is(":hidden");d(this)[b?"show":"hide"]()}):this.animate(cc("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,e){var f=d.speed(b,c,e);if(d.isEmptyObject(a))return this.each(f.complete);return this[f.queue===!1?"each":"queue"](function(){var b=d.extend({},f),c,e=this.nodeType===1,g=e&&d(this).is(":hidden"),h=this;for(c in a){var i=d.camelCase(c);c!==i&&(a[i]=a[c],delete a[c],c=i);if(a[c]==="hide"&&g||a[c]==="show"&&!g)return b.complete.call(this);if(e&&(c==="height"||c==="width")){b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(d.css(this,"display")==="inline"&&d.css(this,"float")==="none")if(d.support.inlineBlockNeedsLayout){var j=cd(this.nodeName);j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)}else this.style.display="inline-block"}d.isArray(a[c])&&((b.specialEasing=b.specialEasing||{})[c]=a[c][1],a[c]=a[c][0])}b.overflow!=null&&(this.style.overflow="hidden"),b.curAnim=d.extend({},a),d.each(a,function(c,e){var f=new d.fx(h,b,c);if(b$.test(e))f[e==="toggle"?g?"show":"hide":e](a);else{var i=b_.exec(e),j=f.cur();if(i){var k=parseFloat(i[2]),l=i[3]||(d.cssNumber[c]?"":"px");l!=="px"&&(d.style(h,c,(k||1)+l),j=(k||1)/f.cur()*j,d.style(h,c,j+l)),i[1]&&(k=(i[1]==="-="?-1:1)*k+j),f.custom(j,k,l)}else f.custom(j,e,"")}});return!0})},stop:function(a,b){var c=d.timers;a&&this.queue([]),this.each(function(){for(var a=c.length-1;a>=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:cc("show",1),slideUp:cc("hide",1),slideToggle:cc("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.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,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!ca&&(ca=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||d.fx.stop()},interval:13,stop:function(){clearInterval(ca),ca=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){d.style(a.elem,"opacity",a.now)},_default:function(a){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:a.elem[a.prop]=a.now}}}),d.expr&&d.expr.filters&&(d.expr.filters.animated=function(a){return d.grep(d.timers,function(b){return a===b.elem}).length});var ce=/^t(?:able|d|h)$/i,cf=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?d.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;if(!c||!d.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=f.body,i=cg(f),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||d.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||d.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:d.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);d.offset.initialize();var c,e=b.offsetParent,f=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(d.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===e&&(l+=b.offsetTop,m+=b.offsetLeft,d.offset.doesNotAddBorder&&(!d.offset.doesAddBorderForTableAndCells||!ce.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),f=e,e=b.offsetParent),d.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;d.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},d.offset={initialize:function(){var a=c.body,b=c.createElement("div"),e,f,g,h,i=parseFloat(d.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),a=b=e=f=g=h=null,d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=e==="absolute"&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=cf.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!cf.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=cg(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=cg(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window);document.onclick = function (e) {
    e = window.event || e;
    var lluSourceElem = e.target || e.srcElement;
    var dropDownClicked = false;
    var datePickerClicked = false;
    if (lluSourceElem.className) {
        if (lluSourceElem.className.indexOf("lluDropDown") > -1 || lluSourceElem.className.indexOf("lluScroll") > -1) {
            dropDownClicked = true;
        }
        if (lluSourceElem.className.indexOf("datePicker") > -1) {
            datePickerClicked = true;
        }
    }
    if (lluSourceElem.id) {
        if (lluSourceElem.id.indexOf("datePicker") > -1) {
            datePickerClicked = true;
        }
    }
    if (!dropDownClicked) {
        for (var lluDD = 0; lluDD < dropDownArray.length; lluDD++) {
            var tempLluDropDown = dropDownArray[lluDD];
            tempLluDropDown.hideLLUDropDown();
        }
    }
    if (!datePickerClicked) {
        if (lluSourceElem.tagName.toLowerCase() != "input") {
            for (var lluDD2 = 0; lluDD2 < datePickerArray.length; lluDD2++) {
                var tempLluDatePicker = datePickerArray[lluDD2];
                tempLluDatePicker.hideDatePickerPanel();
            }
        }
    }
};

/* #region Drop Down Combo Box */

var dropDownArray = new Array();

function DropDownBox(panelToAddTo, defaultText, dropDownWidth, resultPanelWidth, resultPanelHeight, resultPanelOffset, isInput, autoFill, callBackFunction, mouseOverCallBack, mouseOutCallBack, themeColour) {
    var newDropDown = new Object();
    if (typeof panelToAddTo == "string") {
        newDropDown.parentPanel = document.getElementById(panelToAddTo);
    }
    else {
        newDropDown.parentPanel = panelToAddTo;
    }
    newDropDown.dropDownPanelHeight = resultPanelHeight;
    newDropDown.selectedIndex = -1;
    newDropDown.itemCount = 0;
    newDropDown.autoFill = autoFill;
    newDropDown.arrayIndex = dropDownArray.length;
    newDropDown.isInput = isInput;
    newDropDown.isMultiSelect = false;
    newDropDown.defaultText = defaultText;
    newDropDown.ajaxCallFunction = "";
    newDropDown.countBeforeCall = 0;
    newDropDown.lastTextVal = "";
    newDropDown.callBackFunction = callBackFunction;
    newDropDown.enabled = true;
    newDropDown.showSampleText = false;
    newDropDown.listDirection = "down";
    newDropDown.themeColour = "";
    newDropDown.sampleTextArray = new Array();
    if (mouseOverCallBack) {
        if (mouseOverCallBack != "") {
            newDropDown.mouseOverCallBack = mouseOverCallBack;
            newDropDown.mouseOutCallBack = mouseOutCallBack;
        }
    }
    if (themeColour) {
        newDropDown.themeColour = themeColour;
    }

    newDropDown.lluDropDownMain = document.createElement("div");
    newDropDown.lluDropDownMain.className = "lluDropDownMain" + newDropDown.themeColour;

    if (!newDropDown.isInput) {
        newDropDown.lluDropDownMain.style.width = dropDownWidth + 6 + "px";
    }
    else {
        newDropDown.lluDropDownMain.style.width = dropDownWidth + "px";
    }
    newDropDown.parentPanel.appendChild(newDropDown.lluDropDownMain);

    newDropDown.lluDropDownLeftPanel = document.createElement("div");
    newDropDown.lluDropDownLeftPanel.className = "lluDropDownLeftPanel" + newDropDown.themeColour;
    newDropDown.lluDropDownMain.appendChild(newDropDown.lluDropDownLeftPanel);

    newDropDown.lluDropDownSampleTextPanel = document.createElement("div");
    newDropDown.lluDropDownSampleTextPanel.id = "lluDropDownSampleTextPanel" + newDropDown.themeColour;
    newDropDown.lluDropDownSampleTextPanel.style.display = "none";
    newDropDown.lluDropDownSampleTextPanel.style.left = resultPanelWidth + "px";
    newDropDown.lluDropDownSampleTextPanel.innerHTML = "Aa";
    newDropDown.lluDropDownMain.appendChild(newDropDown.lluDropDownSampleTextPanel);

    if (newDropDown.isInput) {
        newDropDown.lluDropDownCentrePanel = document.createElement("input");
        newDropDown.lluDropDownCentrePanel.setAttribute("type", "text");
        newDropDown.lluDropDownCentrePanel.onclick = function () { setDropDownDefaultText('set', newDropDown.arrayIndex); };
        newDropDown.lluDropDownCentrePanel.onblur = function () { setDropDownDefaultText('clear', newDropDown.arrayIndex); };
        newDropDown.lluDropDownCentrePanel.onkeyup = function () { checkDropDownText(newDropDown.arrayIndex); };
        newDropDown.lluDropDownCentrePanel.style.width = (dropDownWidth - 6) + "px";
        newDropDown.lluDropDownCentrePanel.value = newDropDown.defaultText;
    }
    else {
        newDropDown.lluDropDownCentrePanel = document.createElement("div");
        newDropDown.lluDropDownCentrePanel.innerHTML = newDropDown.defaultText;
        newDropDown.lluDropDownCentrePanel.style.width = (dropDownWidth - 6) + "px";
        newDropDown.lluDropDownCentrePanel.onclick = function () { showLLUDropDown(newDropDown.arrayIndex); };
    }
    newDropDown.lluDropDownCentrePanel.onkeydown = function (e) { e = window.event || e; setDropDownKeyDown(e, newDropDown.arrayIndex); };
    newDropDown.lluDropDownCentrePanel.className = "lluDropDownCentrePanel" + newDropDown.themeColour;
    newDropDown.lluDropDownMain.appendChild(newDropDown.lluDropDownCentrePanel);

    newDropDown.lluDropDownRightPanel = document.createElement("div");
    newDropDown.lluDropDownRightPanel.className = "lluDropDownRightPanel" + newDropDown.themeColour;
    newDropDown.lluDropDownMain.appendChild(newDropDown.lluDropDownRightPanel);

    if (!newDropDown.isInput) {
        newDropDown.lluDropDownArrow = document.createElement("div");
        newDropDown.lluDropDownArrow.className = "lluDropDownArrow" + newDropDown.themeColour;
        newDropDown.lluDropDownArrow.onclick = function () { showLLUDropDown(newDropDown.arrayIndex); };
        newDropDown.lluDropDownMain.appendChild(newDropDown.lluDropDownArrow);
    }

    newDropDown.lluDropDownListAnimatePanel = document.createElement("div");
    newDropDown.lluDropDownListAnimatePanel.className = "lluDropDownListAnimatePanel" + newDropDown.themeColour;
    newDropDown.lluDropDownListAnimatePanel.style.width = resultPanelWidth + "px";
    newDropDown.lluDropDownListAnimatePanel.style.marginLeft = resultPanelOffset + "px";
    newDropDown.lluDropDownListAnimatePanel.style.height = "0px";
    newDropDown.lluDropDownMain.appendChild(newDropDown.lluDropDownListAnimatePanel);

    newDropDown.lluDropDownListPanel = document.createElement("div");
    newDropDown.lluDropDownListPanel.className = "lluDropDownListPanel" + newDropDown.themeColour;
    newDropDown.lluDropDownListPanel.style.width = resultPanelWidth + "px";
    newDropDown.lluDropDownListPanel.style.height = resultPanelHeight + "px";
    newDropDown.lluDropDownListPanel.style.zIndex = "1";
    newDropDown.lluDropDownListAnimatePanel.appendChild(newDropDown.lluDropDownListPanel);

    newDropDown.lluDropDownList = document.createElement("div");
    newDropDown.lluDropDownList.className = "lluDropDownList" + newDropDown.themeColour;
    newDropDown.lluDropDownList.style.width = (resultPanelWidth - 20) + "px";
    newDropDown.lluDropDownListPanel.appendChild(newDropDown.lluDropDownList);

    newDropDown.lluDropDownList.onkeydown = function (e) { e = window.event || e; setDropDownKeyDown(e, newDropDown.arrayIndex); };

    newDropDown.lluScroller = new Scroller(newDropDown.lluDropDownListPanel, newDropDown.lluDropDownList, -20, newDropDown.themeColour);
    newDropDown.lluScroller.setScrollVisible("none");
    newDropDown.lluScroller.scrollPanel.style.zIndex = "2";

    newDropDown.setAjaxCallFunction = function (functionName, countBeforeCall) {
        newDropDown.ajaxCallFunction = functionName + "();";
        newDropDown.countBeforeCall = countBeforeCall;
    }

    newDropDown.setDropDownDirection = function (direction) {
        newDropDown.listDirection = direction;
    }

    newDropDown.setMultiSelect = function (onOff) {
        newDropDown.isMultiSelect = onOff;
    }

    newDropDown.setScrollList = function (content) {
        newDropDown.lluDropDownList.innerHTML = "";
        newDropDown.lluDropDownListPanel.style.top = "0px";
        var dataArray = content.split("^^");
        newDropDown.itemCount = dataArray.length;
        var scrollListText = "";
        for (var iTemp = 0; iTemp < dataArray.length; iTemp++) {
            var loopArray = dataArray[iTemp];
            var tagValue = loopArray.split("**")[0];
            var textValue = loopArray.split("**")[2];
            var textValueEncoded = escape(loopArray.split("**")[2]);
            var dropDownFunctions = "";
            if (newDropDown.autoFill == true && !newDropDown.isMultiSelect) {
                dropDownFunctions += "setDropDownText('" + textValueEncoded + "', '" + newDropDown.arrayIndex + "');";
                if (iTemp == 0) {
                    if (!newDropDown.isInput) {
                        newDropDown.lluDropDownCentrePanel.innerHTML = loopArray.split("**")[2];
                    }
                }
            }
            dropDownFunctions += " setDropDownSelectedindex('" + iTemp + "', '" + newDropDown.arrayIndex + "');";
            if (!newDropDown.isMultiSelect) {
                dropDownFunctions += newDropDown.callBackFunction + "('" + tagValue + "," + textValueEncoded + "');";
            }
            var newItem = "<div id=\"lluDropDownItem" + iTemp + "\" class=\"lluDropDownItem" + newDropDown.themeColour + "\" onclick=\"" + dropDownFunctions + "\"";
            if (newDropDown.mouseOverCallBack) {
                newItem += " onmouseover=\"" + newDropDown.mouseOverCallBack + "('" + tagValue + "," + textValueEncoded + "');\"";
            }
            if (newDropDown.mouseOverCallBack) {
                newItem += " onmouseout=\"" + newDropDown.mouseOutCallBack + "();\"";
            }
            newItem += " style=\"width:" + (resultPanelWidth - 24) + "px;\">" +
                            loopArray.split("**")[2];

            if (newDropDown.isMultiSelect) {
                if (iTemp == 0) {
                    newItem += "<div class=\"lluDropDownCheckOn\" onclick=\"toggleDropDownCheckBox(this, '" + tagValue + "," + textValueEncoded + "', '" + newDropDown.arrayIndex + "');\"></div>";
                    newDropDown.lluDropDownCentrePanel.innerHTML = "Select Options";
                }
                else {
                    newItem += "<div class=\"lluDropDownCheckOff\" onclick=\"toggleDropDownCheckBox(this, '" + tagValue + "," + textValueEncoded + "', '" + newDropDown.arrayIndex + "');\"></div>";
                }
            }

            newItem += "</div>";
            scrollListText += newItem;
        }
        newDropDown.lluDropDownList.innerHTML = scrollListText;
        if (newDropDown.lluDropDownList.offsetHeight > newDropDown.lluDropDownListPanel.offsetHeight) {
            newDropDown.lluScroller.setScrollVisible("inline");
            newDropDown.lluScroller.setScrollHeight();
        }
        else {
            newDropDown.lluScroller.setScrollVisible("none");
        }
        if (newDropDown.isInput) {
            showLLUDropDown(newDropDown.arrayIndex);
        }
    }

    newDropDown.hideLLUDropDown = function () {
        newDropDown.lluDropDownSampleTextPanel.style.display = "none";
        $(newDropDown.lluDropDownListAnimatePanel).animate({ height: "0px" }, 250);
        newDropDown.lluScroller.mouseOver = false;
    }

    newDropDown.showLLUDropDown = function () {
        showLLUDropDown(newDropDown.arrayIndex);
    }

    newDropDown.showSamplePanel = function (status, text) {
        newDropDown.showSampleText = status;
        newDropDown.sampleTextArray = text.split("^^");
        newDropDown.lluDropDownSampleTextPanel.className = newDropDown.sampleTextArray[0];
    }

    newDropDown.setEnabled = function (status) {
        newDropDown.enabled = status;
    }

    dropDownArray[dropDownArray.length] = newDropDown;
    return newDropDown;
}

function toggleDropDownCheckBox(elem, tagVal, dropDownIndex) {
    var currDropDown = dropDownArray[dropDownIndex];
    var ddFuncts = "";
    if (elem.className == "lluDropDownCheckOff") {
        elem.className = "lluDropDownCheckOn";
        ddFuncts = currDropDown.callBackFunction + "('" + tagVal + ",on')";
    }
    else {
        elem.className = "lluDropDownCheckOff";
        ddFuncts = currDropDown.callBackFunction + "('" + tagVal + ",off')";
    }
    eval(ddFuncts);
}

function setSampleText(index, dropDownIndex) {
    var currDropDown = dropDownArray[dropDownIndex];
    currDropDown.lluDropDownSampleTextPanel.className = currDropDown.sampleTextArray[index];
}

function evaluateDropDownFunctions(functs) {
    eval(functs);
}

function setDropDownDefaultText(type, dropDownIndex) {
    var currDropDown = dropDownArray[dropDownIndex];
    if (type == "set") {
        currDropDown.lluDropDownCentrePanel.value = "";
    }
    else {
        if (currDropDown.lluDropDownCentrePanel.value == "") {
            currDropDown.lluDropDownCentrePanel.value = currDropDown.defaultText;
        }
    }
}

function checkDropDownText(dropDownIndex) {
    var currDropDown = dropDownArray[dropDownIndex];
    if (currDropDown.ajaxCallFunction != "") {
        var currDropDownText = currDropDown.lluDropDownCentrePanel.value;
        if (currDropDownText != currDropDown.defaultText) {
            if (currDropDownText.length > currDropDown.countBeforeCall) {
                if (currDropDownText != currDropDown.lastTextVal) {
                    eval(currDropDown.ajaxCallFunction);
                    currDropDown.lastTextVal = currDropDownText;
                }
            }
        }
    }
}

function setDropDownText(selectedText, dropDownIndex) {
    var currDropDown = dropDownArray[dropDownIndex];
    if (currDropDown.isInput) {
        currDropDown.lluDropDownCentrePanel.value = unescape(selectedText);
    }
    else {
        currDropDown.lluDropDownCentrePanel.innerHTML = unescape(selectedText);
    }
}

function setDropDownSelectedindex(elemIndex, dropDownIndex) {
    var currDropDown = dropDownArray[dropDownIndex];
    try {
        currDropDown.lluDropDownList.childNodes[currDropDown.selectedIndex].style.borderStyle = "solid";
    }
    catch (err) { }
    currDropDown.selectedIndex = elemIndex;
    var currElement = currDropDown.lluDropDownList.childNodes[elemIndex];
    currElement.style.borderStyle = "dashed";
    if (!currDropDown.isMultiSelect) {
        currDropDown.hideLLUDropDown();
    }
}

function setDropDownKeyDown(event, index) {
    var elem2;
    if (event.srcElement) {
        elem2 = event.srcElement;
    }
    if (event.target) {
        elem2 = event.target;
    }
    var currDropDown = dropDownArray[index];
    var actioned = false;
    if (elem2.className.indexOf("lluDropDownCentrePanel") == 0) {
        if (event.keyCode == 9) {
            var firstElement = currDropDown.lluDropDownList.firstChild;
            if (firstElement) {
                firstElement.focus();
                firstElement.style.borderStyle = "dashed";
                currDropDown.selectedIndex = 0;
            }
            actioned = true;
        }
    }
    else {
        if (currDropDown.selectedIndex > -1) {
            if (event.keyCode == 32) {
                var selectedElement2 = currDropDown.lluDropDownList.childNodes[currDropDown.selectedIndex];
                setDropDownSelectedindex(currDropDown.selectedIndex, index);
                setDropDownText(selectedElement2.innerHTML, index);
                var temp = selectedElement2.getAttribute("onclick").split(";")[0] + ";";
                eval(temp);
                actioned = true;
            }
            else {
                var selectedElement = currDropDown.lluDropDownList.childNodes[currDropDown.selectedIndex];
                var selectedElementTop = selectedElement.offsetTop;
                var selectedElementHeight = selectedElement.offsetHeight;
                var selectedElementBottom = selectedElementTop + selectedElementHeight;
                var contentTop = selectedElement.parentNode.offsetTop;
                var contentHeight = selectedElement.parentNode.offsetHeight;
                var contentBottom = contentTop + contentHeight;
                var containerHeight = currDropDown.dropDownPanelHeight;
                var moveBy = 0;
                var multiplier = 0;
                if (event.keyCode == 40) {
                    if (contentBottom > containerHeight && selectedElementBottom >= containerHeight) {
                        multiplier = (contentHeight - selectedElementBottom) / 22;
                        if ((contentHeight - selectedElementBottom) % 22 == 0) {
                            moveBy = -22;
                        }
                        else {
                            moveBy = ((contentBottom - selectedElementBottom) % 22) * -1;
                        }
                        currDropDown.lluScroller.scrollToElement(moveBy, multiplier);
                    }
                    if (currDropDown.selectedIndex < (currDropDown.itemCount - 1)) {
                        try {
                            selectedElement.nextSibling.style.borderStyle = "dashed";
                        }
                        catch (err) { }
                        selectedElement.style.borderStyle = "solid";
                        currDropDown.selectedIndex++;
                    }
                    actioned = true;
                }
                else if (event.keyCode == 38) {
                    if (contentTop < 0 && selectedElementTop <= (contentTop * -1)) {
                        multiplier = selectedElementTop / 22;
                        if (contentTop + selectedElementTop == 0) {
                            moveBy = 22;
                        }
                        else {
                            moveBy = (contentTop + selectedElementTop) * -1;
                        }
                        currDropDown.lluScroller.scrollToElement(moveBy, multiplier);
                    }
                    if (currDropDown.selectedIndex > 0) {
                        try {
                            selectedElement.previousSibling.style.borderStyle = "dashed";
                        }
                        catch (err) { }
                        selectedElement.style.borderStyle = "solid";
                        currDropDown.selectedIndex--;
                    }
                    actioned = true;
                }
            }
        }
    }
    if (actioned) {
        if (event.preventDefault) event.preventDefault();
        if (event.stopPropagation) event.stopPropagation();
        if (event.returnValue) event.returnValue = false;
        return false;
    }
}

function showLLUDropDown(index) {
    var currDropDown = dropDownArray[index];
    if (currDropDown.enabled) {
        if (currDropDown.lluDropDownListAnimatePanel.offsetHeight == 0) {
            var newDropDownListActualHeight = currDropDown.lluDropDownList.offsetHeight;
            var newDropDownListHeight = newDropDownListActualHeight + "px";
            if (newDropDownListActualHeight > currDropDown.dropDownPanelHeight) {
                newDropDownListHeight = currDropDown.dropDownPanelHeight + "px";
            }

            if (currDropDown.listDirection == "down") {
                currDropDown.lluDropDownListAnimatePanel.style.top = "24px";
                currDropDown.lluDropDownListAnimatePanel.style.bottom = "";
            }
            else {
                currDropDown.lluDropDownListAnimatePanel.style.top = "";
                currDropDown.lluDropDownListAnimatePanel.style.bottom = "24px";
            }
            $(currDropDown.lluDropDownListAnimatePanel).animate({ height: newDropDownListHeight }, 250);
            if (currDropDown.showSampleText) {
                currDropDown.lluDropDownSampleTextPanel.style.display = "inline";
            }
        }
        else {
            currDropDown.hideLLUDropDown();
        }
    }
}

/* #endregion */

/* #region Scroller */

var scrollerArray = new Array();

function Scroller(S1, S2, offset, themeColour) {
    var newScroller = new Object();
    if (S1.tagName != null) {
        newScroller.container = S1;
        newScroller.content = S2;
    }
    else {
        newScroller.container = document.getElementById(S1);
        newScroller.content = document.getElementById(S2);
    }
    newScroller.contentOver = newScroller.container.offsetHeight - newScroller.content.offsetHeight;
    newScroller.scrollOver = 0;
    newScroller.scrollDiff = 0.0;
    newScroller.scrollTop = 0.0;
    newScroller.overPercent = 0.0;
    newScroller.mouseDown = false;
    newScroller.mouseOver = false;
    newScroller.arrayIndex = scrollerArray.length;
    newScroller.themeColour = "";
    if (themeColour) {
        newScroller.themeColour = themeColour;
    }

    if (window.attachEvent) {
        document.attachEvent("onmousewheel", scrollerMouseWheel);
    }
    else if (window.addEventListener) {
        /** DOMMouseScroll is for mozilla. */
        document.addEventListener("DOMMouseScroll", scrollerMouseWheel, false);
    }
    else {
        /** IE/Opera. */
        window.onmousewheel = document.onmousewheel = scrollerMouseWheel;
    }

    newScroller.content.onmouseover = function () { setScrollerMouseOver(newScroller.arrayIndex, true); };
    newScroller.content.onmouseout = function (e) { e = window.event || e; scrollerFixOnMouseOut(this, e, newScroller.arrayIndex); };

    newScroller.scrollPanel = document.createElement("div");
    newScroller.scrollPanel.id = "scroller" + newScroller.arrayIndex;
    newScroller.scrollPanel.className = "lluScrollPanel" + newScroller.themeColour;

    newScroller.scrollPanelTop = document.createElement("div");
    newScroller.scrollPanelTop.className = "lluScrollPanelTop" + newScroller.themeColour;
    newScroller.scrollPanelTop.onmousedown = function () { setScrollerMouseDown(newScroller.arrayIndex, true, 'up'); };
    newScroller.scrollPanelTop.onmouseout = function () { setScrollerMouseDown(newScroller.arrayIndex, false, ''); };

    newScroller.scrollPanelMid = document.createElement("div");
    newScroller.scrollPanelMid.className = "lluScrollPanelSlice" + newScroller.themeColour;

    newScroller.scrollPanelBot = document.createElement("div");
    newScroller.scrollPanelBot.className = "lluScrollPanelBot" + newScroller.themeColour;
    newScroller.scrollPanelBot.onmousedown = function () { setScrollerMouseDown(newScroller.arrayIndex, true, 'down'); };
    newScroller.scrollPanelBot.onmouseout = function () { setScrollerMouseDown(newScroller.arrayIndex, false, ''); };

    newScroller.scroller = document.createElement("div");
    newScroller.scroller.className = "lluScroller" + newScroller.themeColour;
    newScroller.scroller.style.top = "0px";
    newScroller.scroller.onmouseover = function () { setScrollerRollOver(this, 'over', newScroller.arrayIndex); };
    newScroller.scroller.onmouseout = function () { setScrollerRollOver(this, 'out', newScroller.arrayIndex); };

    newScroller.scrollerTop = document.createElement("div");
    newScroller.scrollerTop.className = "lluScrollerTop" + newScroller.themeColour;

    newScroller.scrollerMid = document.createElement("div");
    newScroller.scrollerMid.className = "lluScrollerSliceOff" + newScroller.themeColour;

    newScroller.scrollerBot = document.createElement("div");
    newScroller.scrollerBot.className = "lluScrollerBot" + newScroller.themeColour;

    newScroller.scrollPanel.appendChild(newScroller.scrollPanelTop);
    newScroller.scrollPanel.appendChild(newScroller.scrollPanelMid);
    newScroller.scrollPanel.appendChild(newScroller.scrollPanelBot);
    newScroller.scroller.appendChild(newScroller.scrollerTop);
    newScroller.scroller.appendChild(newScroller.scrollerMid);
    newScroller.scroller.appendChild(newScroller.scrollerBot);

    newScroller.scrollPanel.appendChild(newScroller.scroller);

    newScroller.container.parentNode.appendChild(newScroller.scrollPanel);
    newScroller.setScrollerDraggable = function () {
        var currScroller = newScroller;
        $(newScroller.scroller).draggable({ containment: newScroller.scrollPanel,
            drag: function () {
                if (this.offsetTop > 0) {
                    newScroller.scrollTop = this.offsetTop;
                    if (this.offsetTop > this.parentNode.offsetHeight - this.offsetHeight) {
                        currScroller.content.style.top = (this.parentNode.offsetHeight - this.offsetHeight) + "px";
                    }
                    else {
                        currScroller.content.style.top = (currScroller.contentOver * (this.offsetTop / currScroller.scrollOver)) + "px";
                    }
                }
                else {
                    newScroller.scrollTop = 0.0;
                    currScroller.content.style.top = "0px";
                }
            }
        });
    }
    newScroller.scrollToElement = function (scrollBy, multi) {
        var top = parseInt(newScroller.scroller.style.top.replace("px", ""), 10);
        var difference = 0;
        if (scrollBy < 0) {
            difference = newScroller.scrollPanel.offsetHeight - (newScroller.scroller.offsetTop + newScroller.scroller.offsetHeight);
        }
        else {
            difference = newScroller.scroller.offsetTop;
        }
        if (difference != 0) {
            if (scrollBy < 0) {
                newScroller.scroller.style.top = (top + parseInt(difference / multi, 10)) + "px";
            }
            else {
                newScroller.scroller.style.top = (top - parseInt(difference / multi, 10)) + "px";
            }
        }
        newScroller.content.style.top = (newScroller.content.offsetTop + scrollBy) + "px";
    }
    newScroller.setScrollVisible = function (hideShow) {
        newScroller.scrollPanel.style.display = hideShow;
        newScroller.mouseDown = false;
        newScroller.mouseOver = false;
    }
    newScroller.setScrollFullHeight = function () {
        newScroller.scroller.style.top = "0px";
        if (newScroller.container.offsetHeight > 24) {
            newScroller.scrollPanel.style.top = newScroller.container.offsetTop + "px";
            newScroller.scrollPanel.style.left = ((newScroller.container.offsetLeft + newScroller.container.offsetWidth) + offset) + "px";
            newScroller.scrollPanel.style.height = newScroller.content.offsetHeight + "px";
            newScroller.scrollPanelMid.style.height = newScroller.content.offsetHeight + "px";
            if (newScroller.content.offsetHeight > 27) {
                newScroller.scrollerMid.style.height = (newScroller.content.offsetHeight - 28) + "px";
            }
            else {
                newScroller.scrollerMid.style.height = newScroller.content.offsetHeight + "px";
            }
        }
    }
    scrollerArray[newScroller.arrayIndex] = newScroller;
    newScroller.removeScroller = function () {
        for (var iScroll = 0; iScroll < scrollerArray.length; iScroll++) {
            if (scrollerArray[iScroll] == newScroller) {
                scrollerArray.splice(iScroll, 1);
                newScroller.container.parentNode.removeChild(newScroller.scrollPanel);
            }
        }
    }
    newScroller.setScrollHeight = function (reset) {
        if (reset) {
            if (reset == "top") {
                newScroller.scroller.style.top = "0px";
            }
        }
        if (newScroller.container.offsetHeight > 24) {
            newScroller.scrollPanel.style.top = newScroller.container.offsetTop + "px";
            newScroller.scrollPanel.style.left = ((newScroller.container.offsetLeft + newScroller.container.offsetWidth) + offset) + "px";
            newScroller.scrollPanel.style.height = newScroller.container.offsetHeight + "px";
            newScroller.scrollPanelMid.style.height = (newScroller.container.offsetHeight - 24) + "px";
            newScroller.contentOver = newScroller.container.offsetHeight - newScroller.content.offsetHeight;
            if (newScroller.contentOver < 0) {
                newScroller.setScrollVisible("inline");
            }
            else {
                newScroller.setScrollVisible("none");
            }
            newScroller.overPercent = newScroller.container.offsetHeight / newScroller.content.offsetHeight;
            if (newScroller.overPercent > 1) {
                newScroller.overPercent = 1;
            }
            var tempHeight = (parseInt(newScroller.scrollPanel.offsetHeight * newScroller.overPercent, 10) - 28);
            if (tempHeight < 1) {
                tempHeight = 1;
            }
            newScroller.scroller.style.height = (tempHeight + 28) + "px";
            newScroller.scrollerMid.style.height = tempHeight + "px";
            newScroller.scrollOver = newScroller.scrollPanel.offsetHeight - newScroller.scroller.offsetHeight;
            newScroller.scrollDiff = newScroller.scrollOver / (newScroller.contentOver * -1);
        }
        if (reset) {
            if (reset == "bot") {
                newScroller.scroller.style.top = newScroller.scrollPanel.offsetHeight - newScroller.scroller.offsetHeight + "px";
            }
        }
    }
    newScroller.setScrollerDraggable();
    return newScroller;
}

function scrollerMouseWheel(event) {
    for (var iScroll = 0; iScroll < scrollerArray.length; iScroll++) {
        var currScroller = scrollerArray[iScroll];
        if (currScroller.scrollOver > 0) {
            if (currScroller.mouseOver) {
                var delta = 0;
                if (!event) /* For IE. */
                    event = window.event;
                if (event.wheelDelta) { /* IE/Opera. */
                    delta = event.wheelDelta / 120;
                    /** In Opera 9, delta differs in sign as compared to IE.
                    */
                    if (window.opera)
                        delta = -delta;
                } else if (event.detail) { /** Mozilla case. */
                    /** In Mozilla, sign of delta is different than in IE.
                    * Also, delta is multiple of 3.
                    */
                    delta = -event.detail / 3;
                }
                /** If delta is nonzero, handle it.
                * Basically, delta is now positive if wheel was scrolled up,
                * and negative, if wheel was scrolled down.
                */
                if (delta) {
                    var contTop = parseInt(currScroller.content.offsetTop, 10);
                    if (delta < 0) {
                        if (contTop > ((currScroller.content.offsetHeight - currScroller.container.offsetHeight) * -1)) {
                            currScroller.scrollTop += (10 * currScroller.scrollDiff);
                            currScroller.scroller.style.top = currScroller.scrollTop + "px";
                            currScroller.content.style.top = (contTop - 10) + "px";
                        }
                        else {
                            currScroller.content.style.top = ((currScroller.content.offsetHeight - currScroller.container.offsetHeight) * -1) + "px";
                            currScroller.scroller.style.top = (currScroller.scrollPanel.offsetHeight - currScroller.scroller.offsetHeight) + "px";
                        }
                    }
                    else {
                        if (contTop < 0) {
                            currScroller.scrollTop -= (10 * currScroller.scrollDiff);
                            currScroller.scroller.style.top = currScroller.scrollTop + "px";
                            currScroller.content.style.top = (contTop + 10) + "px";
                        }
                        else {
                            currScroller.content.style.top = "0px";
                            currScroller.scroller.style.top = "0px";
                        }
                    }
                }
                /** Prevent default actions caused by mouse wheel.
                * That might be ugly, but we handle scrolls somehow
                * anyway, so don't bother here..
                */
                if (event.preventDefault) event.preventDefault();
                if (event.stopPropagation) event.stopPropagation();
                if (event.returnValue) event.returnValue = false;
                return false;
            }
        }
    }
}

function setScrollerKeyUp(event, index) {
    var currScroller = scrollerArray[index];
    if (event.keyCode == 40 || event.keyCode == 38) {
        currScroller.keyDown = 0;
    }
    if (event.preventDefault) event.preventDefault();
    if (event.stopPropagation) event.stopPropagation();
    if (event.returnValue) event.returnValue = false;
    return false;
}

function setScrollerMouseDown(index, status, dir) {
    var currScroller = scrollerArray[index];
    currScroller.mouseDown = status;
    if (status) {
        manualScroll1(index, dir);
    }
}

function setScrollerMouseOver(index, status) {
    var currScroller = scrollerArray[index];
    currScroller.mouseOver = status;
}

function scrollerFixOnMouseOut(element, event, index) {
    var current_mouse_target = null;
    if (event.toElement) {
        current_mouse_target = event.toElement;
    } else if (event.relatedTarget) {
        current_mouse_target = event.relatedTarget;
    }
    if (!scrollerIsChildOf(element, current_mouse_target) && element != current_mouse_target) {
        setScrollerMouseOver(index, false);
    }
}

function scrollerIsChildOf(parent, child) {
    if (child != null) {
        while (child.parentNode) {
            if ((child = child.parentNode) == parent) {
                return true;
            }
        }
    }
    return false;
}

function manualScroll1(index, dir) {
    var currScroller = scrollerArray[index];
    if (currScroller.mouseDown) {
        var top = parseInt(currScroller.scroller.offsetTop, 10);
        if (dir == "up") {
            if (top > 0) {
                currScroller.scrollTop = top - 1;
                currScroller.scroller.style.top = currScroller.scrollTop + "px";
                currScroller.content.style.top = (currScroller.contentOver * (top / currScroller.scrollOver)) + "px";
                setTimeout("manualScroll1('" + index + "', 'up')", 10);
            }
            else {
                currScroller.content.style.top = "0px";
            }
        }
        if (dir == "down") {
            if (top < (currScroller.scrollPanel.offsetHeight - currScroller.scroller.offsetHeight)) {
                currScroller.scrollTop = top + 1;
                currScroller.scroller.style.top = currScroller.scrollTop + "px";
                currScroller.content.style.top = (currScroller.contentOver * (top / currScroller.scrollOver)) + "px";
                setTimeout("manualScroll1('" + index + "', 'down')", 10);
            }
            else {
                currScroller.content.style.top = (currScroller.container.offsetHeight - currScroller.content.offsetHeight) + "px";
            }
        }
    }
}

function manualScroll2(index, dir) {
    var currScroller = scrollerArray[index];
    if (currScroller.mouseOver) {
        var top = parseInt(currScroller.scroller.offsetTop, 10);
        if (dir == "up") {
            if (top > 0) {
                currScroller.scrollTop = top - 1;
                currScroller.scroller.style.top = currScroller.scrollTop + "px";
                currScroller.content.style.top = (currScroller.contentOver * (top / currScroller.scrollOver)) + "px";
                setTimeout("manualScroll1('" + index + "', 'up')", 10);
            }
            else {
                currScroller.content.style.top = "0px";
            }
        }
        if (dir == "down") {
            if (top < (currScroller.scrollPanel.offsetHeight - currScroller.scroller.offsetHeight)) {
                currScroller.scrollTop = top + 1;
                currScroller.scroller.style.top = currScroller.scrollTop + "px";
                currScroller.content.style.top = (currScroller.contentOver * (top / currScroller.scrollOver)) + "px";
                setTimeout("manualScroll1('" + index + "', 'down')", 10);
            }
            else {
                currScroller.content.style.top = (currScroller.container.offsetHeight - currScroller.content.offsetHeight) + "px";
            }
        }
    }
}

function setScrollerRollOver(element, status, index) {
    var currScroller = scrollerArray[index];
    if (status == "over") {
        for (var i = 0; i < element.childNodes.length; i++) {
            var tempElem = element.childNodes[i];
            if (tempElem.className != null) {
                if (tempElem.className.indexOf("lluScrollerTop") == 0) {
                    tempElem.style.backgroundPosition = "-126px 12px";
                }
                if (tempElem.className.indexOf("lluScrollerSlice") > -1) {
                    tempElem.className = "lluScrollerSliceOn" + currScroller.themeColour;
                }
                if (tempElem.className.indexOf("lluScrollerBot") == 0) {
                    tempElem.style.backgroundPosition = "-210px 0px";
                }
            }
        }
    }
    if (status == "out") {
        for (var i = 0; i < element.childNodes.length; i++) {
            var tempElem = element.childNodes[i];
            if (tempElem.className != null) {
                if (tempElem.className.indexOf("lluScrollerTop") == 0) {
                    tempElem.style.backgroundPosition = "-105px 12px";
                }
                if (tempElem.className.indexOf("lluScrollerSlice") > -1) {
                    tempElem.className = "lluScrollerSliceOff" + currScroller.themeColour;
                }
                if (tempElem.className.indexOf("lluScrollerBot") == 0) {
                    tempElem.style.backgroundPosition = "-189px 0px";
                }
            }
        }
    }
}

/* #endregion */

/* #region Time Picker */

var timePickerArray = new Array();

function TimePicker() {
    var newTimePicker = new Object();
    newTimePicker.selectedInputField;
    newTimePicker.offset = 0;
    newTimePicker.arrayIndex = timePickerArray.length;

    newTimePicker.TimePickerPanel = document.createElement("div");
    newTimePicker.TimePickerPanel.className = "TimePickerPanel";

    newTimePicker.TimePickerHeaderPanel = document.createElement("div");
    newTimePicker.TimePickerHeaderPanel.className = "TimePickerHeaderPanel";
    newTimePicker.TimePickerHeaderPanel.innerHTML = "Choose Time";
    newTimePicker.TimePickerPanel.appendChild(newTimePicker.TimePickerHeaderPanel);

    newTimePicker.TimePickerTimeLabel = document.createElement("div");
    newTimePicker.TimePickerTimeLabel.className = "TimePickerTimeLabel";
    newTimePicker.TimePickerTimeLabel.innerHTML = "Time";
    newTimePicker.TimePickerPanel.appendChild(newTimePicker.TimePickerTimeLabel);

    newTimePicker.TimePickerTimePanel = document.createElement("div");
    newTimePicker.TimePickerTimePanel.className = "TimePickerTimePanel";
    newTimePicker.TimePickerPanel.appendChild(newTimePicker.TimePickerTimePanel);

    newTimePicker.TimePickerTimePanelHours = document.createElement("div");
    newTimePicker.TimePickerTimePanelHours.className = "TimePickerTimePanelHours";
    newTimePicker.TimePickerTimePanel.appendChild(newTimePicker.TimePickerTimePanelHours);

    newTimePicker.TimePickerTimePanelColon = document.createElement("div");
    newTimePicker.TimePickerTimePanelColon.className = "TimePickerTimePanelColon";
    newTimePicker.TimePickerTimePanelColon.innerHTML = ":";
    newTimePicker.TimePickerTimePanel.appendChild(newTimePicker.TimePickerTimePanelColon);

    newTimePicker.TimePickerTimePanelMins = document.createElement("div");
    newTimePicker.TimePickerTimePanelMins.className = "TimePickerTimePanelMins";
    newTimePicker.TimePickerTimePanel.appendChild(newTimePicker.TimePickerTimePanelMins);

    newTimePicker.TimePickerTimePanelAmPm = document.createElement("div");
    newTimePicker.TimePickerTimePanelAmPm.className = "TimePickerTimePanelAmPm";
    newTimePicker.TimePickerTimePanel.appendChild(newTimePicker.TimePickerTimePanelAmPm);

    newTimePicker.TimePickerHoursLabel = document.createElement("div");
    newTimePicker.TimePickerHoursLabel.className = "TimePickerHoursLabel";
    newTimePicker.TimePickerHoursLabel.innerHTML = "Hour";
    newTimePicker.TimePickerPanel.appendChild(newTimePicker.TimePickerHoursLabel);

    newTimePicker.TimePickerHoursPanel = document.createElement("div");
    newTimePicker.TimePickerHoursPanel.className = "TimePickerHoursPanel";
    newTimePicker.TimePickerPanel.appendChild(newTimePicker.TimePickerHoursPanel);

    newTimePicker.TimePickerMinutesLabel = document.createElement("div");
    newTimePicker.TimePickerMinutesLabel.className = "TimePickerMinutesLabel";
    newTimePicker.TimePickerMinutesLabel.innerHTML = "Minute";
    newTimePicker.TimePickerPanel.appendChild(newTimePicker.TimePickerMinutesLabel);

    newTimePicker.TimePickerMinutesPanel = document.createElement("div");
    newTimePicker.TimePickerMinutesPanel.className = "TimePickerMinutesPanel";
    newTimePicker.TimePickerPanel.appendChild(newTimePicker.TimePickerMinutesPanel);

    newTimePicker.TimePickerDoneButton = document.createElement("div");
    newTimePicker.TimePickerDoneButton.className = "TimePickerDoneButton";
    newTimePicker.TimePickerDoneButton.innerHTML = "Done";
    newTimePicker.TimePickerDoneButton.onclick = function () { newTimePicker.hideTimePickerPanel(); };
    newTimePicker.TimePickerPanel.appendChild(newTimePicker.TimePickerDoneButton);

    newTimePicker.TimePickerNowButton = document.createElement("div");
    newTimePicker.TimePickerNowButton.className = "TimePickerNowButton";
    newTimePicker.TimePickerNowButton.innerHTML = "Now";
    newTimePicker.TimePickerNowButton.onclick = function () { newTimePicker.setTimePickerToNow(); };
    newTimePicker.TimePickerPanel.appendChild(newTimePicker.TimePickerNowButton);

    newTimePicker.hoursSlider = new Slider(newTimePicker.TimePickerHoursPanel, "hrs", "TimePickerUpdateHours", newTimePicker.arrayIndex);
    newTimePicker.minutesSlider = new Slider(newTimePicker.TimePickerMinutesPanel, "mns", "TimePickerUpdateMinutes", newTimePicker.arrayIndex);

    newTimePicker.showTimePicker = function (inputField, offset) {
        if (inputField.tagName != null) {
            newTimePicker.selectedInputField = inputField;
        }
        else {
            newTimePicker.selectedInputField = document.getElementById(inputField);
        }
        var currTime = "";
        if (newTimePicker.selectedInputField.tagName.toLowerCase() == "div") {
            currTime = newTimePicker.selectedInputField.innerHTML;
        }
        else {
            currTime = newTimePicker.selectedInputField.value;
        }
        if (currTime != "") {
            var currHour = parseInt(currTime.split(":")[0], 10);
            var currMins = parseInt(currTime.split(":")[1], 10);
            var currAmPm = "am";
            if (currTime.indexOf("am") > -1 || currTime.indexOf("pm") > -1) {
                if (currTime.indexOf("am") > -1) {
                    currAmPm = "am";
                }
                if (currTime.indexOf("pm") > -1) {
                    currAmPm = "pm";
                }
            }
            else {
                if (currHour > 12) {
                    currHour -= 12;
                    if (currHour == 12) {
                        currHour = 0;
                    }
                    else {
                        amPm = "pm";
                    }
                }
                else {
                    if (currHour == 12) {
                        amPm = "pm";
                    }
                }
                currMins = (currMins - (currMins % 5));
            }
            if (currMins < 10) {
                currMins = "0" + currMins;
            }
            if (currMins == 60) {
                currMins = "00";
            }
            newTimePicker.setTime(currHour, currMins, currAmPm);
        }
        else {
            newTimePicker.setTimePickerToNow();
        }
        newTimePicker.offset = offset;
        newTimePicker.selectedInputField.parentNode.appendChild(newTimePicker.TimePickerPanel);
        newTimePicker.TimePickerPanel.style.top = newTimePicker.selectedInputField.offsetTop + newTimePicker.selectedInputField.offsetHeight + "px";
        newTimePicker.TimePickerPanel.style.left = newTimePicker.selectedInputField.offsetLeft + newTimePicker.selectedInputField.offsetWidth - newTimePicker.offset + "px";
        newTimePicker.TimePickerPanel.style.display = "block";
    }

    newTimePicker.hideTimePickerPanel = function () {
        newTimePicker.TimePickerPanel.style.display = "none";
    }

    newTimePicker.setTime = function (hour, minutes, amPm) {
        newTimePicker.TimePickerTimePanelHours.innerHTML = hour;
        newTimePicker.TimePickerTimePanelMins.innerHTML = minutes;
        newTimePicker.TimePickerTimePanelAmPm.innerHTML = amPm;
        if (amPm == "pm") {
            hour = hour + 12;
        }
        newTimePicker.minutesSlider.setPos(parseInt(minutes, 10));
        newTimePicker.hoursSlider.setPos(parseInt(hour, 10));
    }

    newTimePicker.setTimePickerToNow = function () {
        var date = new Date();
        var amPm = "am";
        var hours = date.getHours();
        var mins = date.getMinutes();
        if (hours > 12) {
            hours -= 12;
            if (hours == 12) {
                hours = 0;
            }
            else {
                amPm = "pm";
            }
        }
        else {
            if (hours == 12) {
                amPm = "pm";
            }
        }
        mins = (mins - (mins % 5));
        if (mins < 10) {
            mins = "0" + mins;
        }
        if (mins == 60) {
            mins = "00";
        }
        newTimePicker.TimePickerTimePanelHours.innerHTML = hours;
        newTimePicker.TimePickerTimePanelMins.innerHTML = mins;
        newTimePicker.TimePickerTimePanelAmPm.innerHTML = amPm;
        var returnTime = hours + ":" + mins + amPm;
        if (newTimePicker.selectedInputField.tagName.toLowerCase() == "div") {
            newTimePicker.selectedInputField.innerHTML = returnTime;
        }
        else {
            newTimePicker.selectedInputField.value = returnTime;
        }
        newTimePicker.minutesSlider.setPos(parseInt(mins, 10));
        newTimePicker.hoursSlider.setPos(parseInt(hours, 10));
    }

    timePickerArray.push(newTimePicker);
    return newTimePicker;
}

function TimePickerUpdateHours(retval, index) {
    var currTimePicker = timePickerArray[index];
    currTimePicker.TimePickerTimePanelHours.innerHTML = retval.split("^")[0];
    currTimePicker.TimePickerTimePanelAmPm.innerHTML = retval.split("^")[1];
    var returnTime = currTimePicker.TimePickerTimePanelHours.innerHTML + currTimePicker.TimePickerTimePanelColon.innerHTML +
            currTimePicker.TimePickerTimePanelMins.innerHTML + currTimePicker.TimePickerTimePanelAmPm.innerHTML;
    if (currTimePicker.selectedInputField.tagName.toLowerCase() == "div") {
        currTimePicker.selectedInputField.innerHTML = returnTime;
    }
    else {
        currTimePicker.selectedInputField.value = returnTime;
    }
}

function TimePickerUpdateMinutes(retval, index) {
    var currTimePicker = timePickerArray[index];
    currTimePicker.TimePickerTimePanelMins.innerHTML = retval;
    var returnTime = currTimePicker.TimePickerTimePanelHours.innerHTML + currTimePicker.TimePickerTimePanelColon.innerHTML +
            currTimePicker.TimePickerTimePanelMins.innerHTML + currTimePicker.TimePickerTimePanelAmPm.innerHTML;
    if (currTimePicker.selectedInputField.tagName.toLowerCase() == "div") {
        currTimePicker.selectedInputField.innerHTML = returnTime;
    }
    else {
        currTimePicker.selectedInputField.value = returnTime;
    }
}

/* #endregion */

/* #region Slider */

function Slider(panel, type, callBackFunction, args) {
    var newSlider = new Object();
    newSlider.callBackFunction = callBackFunction;
    newSlider.callBackFunction.args = args;
    newSlider.increment = 15;
    newSlider.width = "198px";
    newSlider.margin = "1px 0 0 0";
    newSlider.type = type;
    if (panel.tagName != null) {
        newSlider.field = panel;
    }
    else {
        newSlider.field = document.getElementById(panel);
    }
    if (type == "hrs") {
        newSlider.increment = 7;
        newSlider.width = "186px";
        newSlider.margin = "1px 0 0 6px";
    }

    newSlider.mainPanel = document.createElement("div");
    newSlider.mainPanel.className = "lluSliderMainPanel";
    newSlider.field.appendChild(newSlider.mainPanel);

    newSlider.slidePanel = document.createElement("div");
    newSlider.slidePanel.className = "lluSlidePanel";
    newSlider.slidePanel.style.margin = newSlider.margin;
    newSlider.slidePanel.style.width = newSlider.width;
    newSlider.mainPanel.appendChild(newSlider.slidePanel);

    newSlider.sliderPanel = document.createElement("div");
    newSlider.sliderPanel.className = "lluSlider";
    newSlider.slidePanel.appendChild(newSlider.sliderPanel);

    $(newSlider.sliderPanel).draggable({ containment: newSlider.slidePanel, grid: [newSlider.increment, newSlider.increment],
        drag: function () {
            var newVal = this.offsetLeft / newSlider.increment;
            if (newSlider.type == "hrs") {
                if (newVal > 12) {
                    newVal -= 12;
                    if (newVal == 12) {
                        newVal = "0^am";
                    }
                    else {
                        newVal = newVal + "^pm";
                    }
                }
                else {
                    if (newVal == 12) {
                        newVal = newVal + "^pm";
                    }
                    else {
                        newVal = newVal + "^am";
                    }
                }
            }
            else if (newSlider.type == "mns") {
                newVal *= 5;
                if (newVal < 10) {
                    newVal = "0" + newVal;
                }
                if (newVal == 60) {
                    newVal = "00";
                }
            }
            eval(newSlider.callBackFunction + "('" + newVal + "'," + args + ");");
        }
    });

    newSlider.setPos = function (pos) {
        if (newSlider.type == "hrs") {
            pos = pos * newSlider.increment;
        }
        else {
            pos = pos * 3;
        }
        this.sliderPanel.style.left = pos;
    }
    return newSlider;
}

/* #endregion */

/* #region Menu */

function LLUMenu() {
    this.lluMenuBar = document.getElementById('menuBar');
    this.isVertical = (this.lluMenuBar.firstChild.getAttribute("orient") == "vertical");
    this.rootHeight = this.lluMenuBar.offsetHeight;
    this.rootWidth = this.lluMenuBar.offsetWidth;
    this.subLevelOneWidth = 0;
    if (this.isVertical) {
        this.lluMenuBar.firstChild.style.width = "100%";
    }
    for (var i = 0; i < this.lluMenuBar.firstChild.childNodes.length; i++) {
        var elem = this.lluMenuBar.firstChild.childNodes[i];
        if (elem.nodeType != 3) {
            if (elem.tagName.toLowerCase() == "li") {
                if (this.rootHeight == 0) {
                    if (this.isVertical) {
                        this.rootHeight = elem.parentNode.offsetHeight;
                    }
                    else {
                        this.rootWidth = elem.offsetWidth;
                    }
                }
                if (this.isVertical) {
                    elem.style.width = "100%"; ;
                    for (var k = 0; k < elem.childNodes.length; k++) {
                        if (elem.childNodes[k].nodeType != 3) {
                            if (elem.childNodes[k].tagName.toLowerCase() == "a") {
                                elem.childNodes[k].style.padding = "0px";
                                elem.childNodes[k].style.width = "100%";
                            }
                        }
                    }
                }
                if (elem.innerHTML.indexOf("lluNavGroupSub") > -1) {
                    for (var m = 0; m < elem.childNodes.length; m++) {
                        var nextLevel = elem.childNodes[m];
                        if (nextLevel.nodeType != 3) {
                            if (nextLevel.tagName.toLowerCase() == "ul") {
                                if (this.isVertical) {
                                    nextLevel.style.top = "0px";
                                    nextLevel.style.left = this.rootWidth + "px";
                                }
                                else {
                                    nextLevel.style.top = this.rootHeight + "px";
                                    nextLevel.style.left = "0px";
                                }
                                if (this.subLevelOneWidth == 0) {
                                    this.subLevelOneWidth = nextLevel.offsetWidth;
                                }
                                lluMenuBuilder(this, nextLevel);
                            }
                        }
                    }
                }
            }
        }
    }
}

function lluMenuBuilder(menu, elem) {
    var panelWidth = elem.offsetWidth + "px";
    for (var j = 0; j < elem.childNodes.length; j++) {
        var elem2 = elem.childNodes[j];
        if (elem2.nodeType != 3) {
            if (elem2.tagName.toLowerCase() == "li") {
                for (var l = 0; l < elem2.childNodes.length; l++) {
                    if (elem2.childNodes[l].nodeType != 3) {
                        if (elem2.childNodes[l].tagName.toLowerCase() == "a") {
                            elem2.childNodes[l].style.width = "100%";
                        }
                    }
                }
                if (elem2.innerHTML.indexOf("lluNavGroupSub") > -1) {
                    for (var n = 0; n < elem2.childNodes.length; n++) {
                        var nextLevel2 = elem2.childNodes[n];
                        if (nextLevel2.nodeType != 3) {
                            if (nextLevel2.tagName.toLowerCase() == "ul") {
                                nextLevel2.style.top = "0px";
                                nextLevel2.style.left = menu.subLevelOneWidth + "px";
                                lluMenuBuilder(menu, nextLevel2);
                            }
                        }
                    }
                }
            }
        }
    }
}

function showSubMenu(elem) {
    elem.style.overflow = "visible";
}

function fixOnMouseOutNav(element, event) {
    var current_mouse_target = null;
    if (event.toElement) {
        current_mouse_target = event.toElement;
    } else if (event.relatedTarget) {
        current_mouse_target = event.relatedTarget;
    }
    if (!isChildOfNav(element, current_mouse_target) && element != current_mouse_target) {
        element.style.overflow = "hidden";
    }
}

function isChildOfNav(parent, child) {
    if (child != null) {
        while (child.parentNode) {
            if ((child = child.parentNode) == parent) {
                return true;
            }
        }
    }
    return false;
}

/* #endregion */

/* #region Image Viewer */

var viewerIndex = 0;
var viewerReference;

function LLUImageViewer(cont) {
    this.container = cont;
    this.imageUrls;
    this.imageName;
    this.imageDesc;
    this.imageSize;
    this.top = 0;

    if (document.body.offsetHeight > GetHeight()) {
        this.top = document.body.offsetHeight;
    }
    else {
        this.top = GetHeight();
    }

    this.modalPanel = document.createElement("div");
    this.modalPanel.setAttribute("id", "viewerModalPanel");
    this.modalPanel.style.top = "-" + (this.top + 20) + "px";
    this.modalPanel.style.height = this.top + "px";

    this.mainPanel = document.createElement("div");
    this.mainPanel.setAttribute("id", "viewerMainPanel");

    this.countPanel = document.createElement("div");
    this.countPanel.setAttribute("id", "viewerCountPanel");
    this.countPanel.innerHTML = "Image 1 of 5";
    this.mainPanel.appendChild(this.countPanel);

    this.closePanel = document.createElement("div");
    this.closePanel.setAttribute("id", "viewerClosePanel");
    this.closePanel.onclick = function () { hideViewer(); };
    this.mainPanel.appendChild(this.closePanel);

    this.imagePanel = document.createElement("img");
    this.imagePanel.setAttribute("id", "viewerImagePanel");
    this.mainPanel.appendChild(this.imagePanel);

    this.nextPanelOff = document.createElement("div");
    this.nextPanelOff.setAttribute("id", "viewerNextPanelOff");
    this.mainPanel.appendChild(this.nextPanelOff);

    this.nextHoverPanel = document.createElement("div");
    this.nextHoverPanel.onmouseout = function (e) { e = window.event || e; fixViewerMouseOut(this, e, 'next'); };
    this.nextHoverPanel.onmouseover = function () { showViewerButton('next') };
    this.nextHoverPanel.setAttribute("id", "viewerNextHoverPanel");
    this.mainPanel.appendChild(this.nextHoverPanel);

    this.nextPanel = document.createElement("div");
    this.nextPanel.setAttribute("id", "viewerNextPanel");
    this.nextPanel.onclick = function () { changeImage('up'); };
    this.nextHoverPanel.appendChild(this.nextPanel);

    this.prevPanelOff = document.createElement("div");
    this.prevPanelOff.setAttribute("id", "viewerPreviousPanelOff");
    this.mainPanel.appendChild(this.prevPanelOff);

    this.prevHoverPanel = document.createElement("div");
    this.prevHoverPanel.onmouseout = function (e) { e = window.event || e; fixViewerMouseOut(this, e, 'prev'); };
    this.prevHoverPanel.onmouseover = function () { showViewerButton('prev') };
    this.prevHoverPanel.setAttribute("id", "viewerPreviousHoverPanel");
    this.mainPanel.appendChild(this.prevHoverPanel);

    this.prevPanel = document.createElement("div");
    this.prevPanel.setAttribute("id", "viewerPreviousPanel");
    this.prevPanel.onclick = function () { changeImage('down'); };
    this.prevHoverPanel.appendChild(this.prevPanel);

    this.namePanel = document.createElement("div");
    this.namePanel.setAttribute("id", "viewerNamePanel");
    this.mainPanel.appendChild(this.namePanel);

    this.descPanel = document.createElement("div");
    this.descPanel.setAttribute("id", "viewerDescriptionPanel");
    this.mainPanel.appendChild(this.descPanel);

    this.modalPanel.appendChild(this.mainPanel);
    this.container.parentNode.appendChild(this.modalPanel);

    this.showViewer = function (id, urls, names, descr, sizes) {
        $('html, body').animate({ scrollTop: 0 }, 'slow');
        this.imageUrls = urls;
        this.imageName = names;
        this.imageDesc = descr;
        this.imageSize = sizes;
        $(this.modalPanel).animate({ top: "0px" }, 500, "linear");
        viewerIndex = parseInt(id, 10);
        changeImage("");
    }
    viewerReference = this;
}

function hideViewer() {
    var viewerHidePos = "-" + (viewerReference.top + 1000) + "px";
    $(viewerReference.modalPanel).animate({ top: viewerHidePos }, 500, "linear");
}

function isChildOf(parent, child) {
    if (child != null) {
        while (child.parentNode) {
            if ((child = child.parentNode) == parent) {
                return true;
            }
        }
    }
    return false;
}

function fixViewerMouseOut(element, event, id) {

    var current_mouse_target = null;
    if (event.toElement) {
        current_mouse_target = event.toElement;
    } else if (event.relatedTarget) {
        current_mouse_target = event.relatedTarget;
    }
    if (!isChildOf(element, current_mouse_target) && element != current_mouse_target) {
        if (id == "next") {
            viewerReference.nextPanel.style.display = "none";
        }
        else {
            viewerReference.prevPanel.style.display = "none";
        }
    }
}

function showViewerButton(id) {
    if (id == "next") {
        if (viewerIndex < viewerReference.imageUrls.length - 1) {
            viewerReference.nextPanel.style.display = "inline";
        }
    }
    else {
        if (viewerIndex > 0) {
            viewerReference.prevPanel.style.display = "inline";
        }
    }
}

function changeImage(dir) {
    if (dir == "up") {
        if (viewerIndex != viewerReference.imageUrls.length - 1) {
            viewerIndex++;
        }
    }
    if (dir == "down") {
        if (viewerIndex != 0) {
            viewerIndex--;
        }
    }
    if (viewerIndex == 0) {
        viewerReference.prevPanelOff.style.display = "none";
    }
    else {
        viewerReference.prevPanelOff.style.display = "inline";
    }
    if (viewerIndex == viewerReference.imageUrls.length - 1) {
        viewerReference.nextPanelOff.style.display = "none";
    }
    else {
        viewerReference.nextPanelOff.style.display = "inline";
    }
    if (document.body.offsetHeight > GetHeight()) {
        viewerReference.top = document.body.offsetHeight;
    }
    else {
        viewerReference.top = GetHeight();
    }
    viewerReference.modalPanel.style.height = viewerReference.top + "px";
    var imgWidth = parseInt(viewerReference.imageSize[viewerIndex].split("~~")[0], 10);
    var imgHeight = parseInt(viewerReference.imageSize[viewerIndex].split("~~")[1], 10);
    if (imgWidth == 0) {
        imgWidth = 400;
        imgHeight = 300;
    }
    viewerReference.nextHoverPanel.style.height = imgHeight + "px";
    viewerReference.prevHoverPanel.style.height = imgHeight + "px";
    $(viewerReference.mainPanel).animate({ top: "10px",
        width: (imgWidth + 60) + "px", height: (imgHeight + 120) + "px",
        left: ((document.body.offsetWidth - (imgWidth + 60)) / 2) + "px"
    }, 500, "linear");
    $(viewerReference.nextPanel).animate({ top: ((imgHeight - 45) / 2) + "px" }, 500, "linear");
    $(viewerReference.prevPanel).animate({ top: ((imgHeight - 45) / 2) + "px" }, 500, "linear");
    $(viewerReference.nextPanelOff).animate({ top: (((imgHeight - 45) / 2) + 30) + "px" }, 500, "linear");
    $(viewerReference.prevPanelOff).animate({ top: (((imgHeight - 45) / 2) + 30) + "px" }, 500, "linear");
    viewerReference.countPanel.innerHTML = "Image " + parseInt(viewerIndex + 1, 10) + " of " + viewerReference.imageUrls.length;
    viewerReference.namePanel.innerHTML = viewerReference.imageName[viewerIndex];
    $(viewerReference.namePanel).animate({ width: imgWidth + "px" }, 500, "linear");
    viewerReference.descPanel.innerHTML = viewerReference.imageDesc[viewerIndex];
    viewerReference.imagePanel.style.display = 'none';
    viewerReference.imagePanel.src = viewerReference.imageUrls[viewerIndex];
    viewerReference.imagePanel.alt = viewerReference.imageDesc[viewerIndex];
    $(viewerReference.descPanel).animate({ width: imgWidth + "px" }, 500, "linear", function () {
        viewerReference.imagePanel.style.display = "block";
    });
}

function GetHeight() {
    var y = 0;
    if (self.innerHeight) {
        y = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight) {
        y = document.documentElement.clientHeight;
    }
    else if (document.body) {
        y = document.body.clientHeight;
    }
    return y;
}

/* #endregion */

/* #region Basic Scroller */

var basicScrollerArray = new Array();

function BasicScroller(S1, S2, offset) {
    var newBasicScroller = new Object();
    if (S1.tagName != null) {
        newBasicScroller.container = S1;
        newBasicScroller.content = S2;
    }
    else {
        newBasicScroller.container = document.getElementById(S1);
        newBasicScroller.content = document.getElementById(S2);
    }
    newBasicScroller.contentOver = newBasicScroller.container.offsetHeight - newBasicScroller.content.offsetHeight;
    newBasicScroller.basicScrollOver = 0;
    newBasicScroller.overPercent = 0.0;
    newBasicScroller.mouseDown = false;
    newBasicScroller.mouseOver = false;
    newBasicScroller.scrolling = false;
    newBasicScroller.arrayIndex = basicScrollerArray.length;

    if (window.addEventListener) {
        /** DOMMouseScroll is for mozilla. */
        window.addEventListener('DOMMouseScroll', basicScrollerMouseWheel, false);
    }
    else {
        /** IE/Opera. */
        window.onmousewheel = document.onmousewheel = basicScrollerMouseWheel;
    }

    newBasicScroller.content.onmouseover = function () { setBasicScrollerMouseOver(newBasicScroller.arrayIndex, true); };
    newBasicScroller.content.onmouseout = function (e) { e = window.event || e; basicScrollerFixOnMouseOut(this, e, newBasicScroller.arrayIndex); };

    newBasicScroller.basicScrollPanel = document.createElement("div");
    newBasicScroller.basicScrollPanel.id = "basicScroller" + newBasicScroller.arrayIndex;
    newBasicScroller.basicScrollPanel.className = "lluBasicScrollPanel";

    newBasicScroller.basicScrollPanelTop = document.createElement("div");
    newBasicScroller.basicScrollPanelTop.className = "lluBasicScrollPanelTop";
    newBasicScroller.basicScrollPanelTop.onmousedown = function () { setBasicScrollerMouseDown(newBasicScroller.arrayIndex, true, 'up'); };
    newBasicScroller.basicScrollPanelTop.onmouseup = function () { setBasicScrollerMouseDown(newBasicScroller.arrayIndex, false, ''); };

    newBasicScroller.basicScrollPanelBot = document.createElement("div");
    newBasicScroller.basicScrollPanelBot.className = "lluBasicScrollPanelBot";
    newBasicScroller.basicScrollPanelBot.onmousedown = function () { setBasicScrollerMouseDown(newBasicScroller.arrayIndex, true, 'down'); };
    newBasicScroller.basicScrollPanelBot.onmouseup = function () { setBasicScrollerMouseDown(newBasicScroller.arrayIndex, false, ''); };

    newBasicScroller.basicScroller = document.createElement("div");
    newBasicScroller.basicScroller.className = "lluBasicScroller";
    newBasicScroller.basicScroller.onmousedown = function () { setBasicScrollerScrolling(newBasicScroller.arrayIndex, true, 'down'); };
    newBasicScroller.basicScroller.onmouseup = function () { setBasicScrollerScrolling(newBasicScroller.arrayIndex, false, ''); };
    newBasicScroller.basicScroller.style.top = "0px";

    newBasicScroller.basicScrollPanel.appendChild(newBasicScroller.basicScrollPanelTop);
    newBasicScroller.basicScrollPanel.appendChild(newBasicScroller.basicScrollPanelBot);
    newBasicScroller.basicScrollPanel.appendChild(newBasicScroller.basicScroller);

    newBasicScroller.container.appendChild(newBasicScroller.basicScrollPanel);
    newBasicScroller.setBasicScrollerDraggable = function () {
        var currBasicScroller = newBasicScroller;
        $(newBasicScroller.basicScroller).draggable({ containment: newBasicScroller.basicScrollPanel,
            drag: function () {
                if (this.offsetTop > 0) {
                    currBasicScroller.content.style.top = (currBasicScroller.contentOver * (this.offsetTop / currBasicScroller.basicScrollOver)) + "px";
                }
                else {
                    currBasicScroller.content.style.top = "0px";
                }
                if (this.offsetTop == (currBasicScroller.basicScrollPanel.offsetHeight - currBasicScroller.basicScroller.offsetHeight)) {
                    currBasicScroller.content.style.top = (currBasicScroller.container.offsetHeight - currBasicScroller.content.offsetHeight) + "px";
                }
            }
        });
    }
    newBasicScroller.basicScrollToElement = function (basicScrollBy, multi) {
        var top = parseInt(newBasicScroller.basicScroller.style.top.replace("px", ""), 10);
        var difference = 0;
        if (basicScrollBy < 0) {
            difference = newBasicScroller.basicScrollPanel.offsetHeight - (newBasicScroller.basicScroller.offsetTop + newBasicScroller.basicScroller.offsetHeight);
        }
        else {
            difference = newBasicScroller.basicScroller.offsetTop;
        }
        if (difference != 0) {
            if (basicScrollBy < 0) {
                newBasicScroller.basicScroller.style.top = (top + parseInt(difference / multi, 10)) + "px";
            }
            else {
                newBasicScroller.basicScroller.style.top = (top - parseInt(difference / multi, 10)) + "px";
            }
        }
        newBasicScroller.content.style.top = (newBasicScroller.content.offsetTop + basicScrollBy) + "px";
    }
    newBasicScroller.setScrollVisible = function (hideShow) {
        newBasicScroller.basicScrollPanel.style.display = hideShow;
        newBasicScroller.mouseDown = false;
        newBasicScroller.mouseOver = false;
    }
    newBasicScroller.setScrollHeight = function () {
        newBasicScroller.basicScroller.style.top = "0px";
        if (newBasicScroller.container.offsetHeight > 24) {
            newBasicScroller.basicScrollPanel.style.left = ((newBasicScroller.content.offsetLeft + newBasicScroller.content.offsetWidth) + offset) + "px";
            newBasicScroller.basicScrollPanel.style.height = newBasicScroller.container.offsetHeight + "px";
            newBasicScroller.contentOver = newBasicScroller.container.offsetHeight - newBasicScroller.content.offsetHeight;
            if (newBasicScroller.contentOver < 0) {
                newBasicScroller.setScrollVisible("inline");
            }
            else {
                newBasicScroller.setScrollVisible("none");
            }
            newBasicScroller.overPercent = newBasicScroller.container.offsetHeight / newBasicScroller.content.offsetHeight;
            if (newBasicScroller.overPercent > 1) {
                newBasicScroller.overPercent = 1;
            }
            newBasicScroller.basicScroller.style.height = parseInt(newBasicScroller.basicScrollPanel.offsetHeight * newBasicScroller.overPercent, 10) + "px";
            var tempHeight = (parseInt(newBasicScroller.basicScrollPanel.offsetHeight * newBasicScroller.overPercent, 10) - 28);
            if (tempHeight < 1) {
                tempHeight = 1;
            }
            newBasicScroller.basicScrollOver = newBasicScroller.basicScrollPanel.offsetHeight - newBasicScroller.basicScroller.offsetHeight;
        }
    }
    basicScrollerArray[newBasicScroller.arrayIndex] = newBasicScroller;
    newBasicScroller.removeBasicScroller = function () {
        for (var iScroll = 0; iScroll < basicScrollerArray.length; iScroll++) {
            if (basicScrollerArray[iScroll] == newBasicScroller) {
                basicScrollerArray.splice(iScroll, 1);
                newBasicScroller.container.parentNode.removeChild(newBasicScroller.basicScrollPanel);
            }
        }
    }
    newBasicScroller.setBasicScrollerDraggable();
    return newBasicScroller;
}

function setBasicScrollerKeyUp(event, index) {
    var currBasicScroller = basicScrollerArray[index];
    if (event.keyCode == 40 || event.keyCode == 38) {
        currScroller.keyDown = 0;
    }
    if (event.preventDefault) event.preventDefault();
    if (event.stopPropagation) event.stopPropagation();
    if (event.returnValue) event.returnValue = false;
    return false;
}

function setBasicScrollerMouseDown(index, status, dir) {
    var currBasicScroller = basicScrollerArray[index];
    currBasicScroller.mouseDown = status;
    if (status) {
        manualBasicScroll1(index, dir);
    }
}

function setBasicScrollerScrolling(index, status, dir) {
    var currBasicScroller = basicScrollerArray[index];
    currBasicScroller.scrolling = status;
}

function setBasicScrollerMouseOver(index, status) {
    var currBasicScroller = basicScrollerArray[index];
    currBasicScroller.mouseOver = status;
}

function basicScrollerFixOnMouseOut(element, event, index) {
    var current_mouse_target = null;
    if (event.toElement) {
        current_mouse_target = event.toElement;
    } else if (event.relatedTarget) {
        current_mouse_target = event.relatedTarget;
    }
    if (!basicScrollerIsChildOf(element, current_mouse_target) && element != current_mouse_target) {
        setBasicScrollerMouseOver(index, false);
    }
}

function basicScrollerIsChildOf(parent, child) {
    if (child != null) {
        while (child.parentNode) {
            if ((child = child.parentNode) == parent) {
                return true;
            }
        }
    }
    return false;
}

function basicScrollerMouseWheel(event) {
    for (var iScroll = 0; iScroll < basicScrollerArray.length; iScroll++) {
        var currBasicScroller = basicScrollerArray[iScroll];
        if (currBasicScroller.basicScrollPanel.style.display == "inline") {
            if (currBasicScroller.mouseOver) {
                var delta = 0;
                if (!event) /* For IE. */
                    event = window.event;
                if (event.wheelDelta) { /* IE/Opera. */
                    delta = event.wheelDelta / 120;
                    if (window.opera)
                        delta = -delta;
                } else if (event.detail) { /** Mozilla case. */
                    delta = -event.detail / 3;
                }
                if (delta)
                    var top = parseInt(currBasicScroller.basicScroller.offsetTop, 10);
                if (delta > 0) {
                    if (top > 0) {
                        currBasicScroller.basicScroller.style.top = (top - 11) + "px";
                        currBasicScroller.content.style.top = (currBasicScroller.contentOver * (top / currBasicScroller.basicScrollOver)) + "px";
                    }
                    else {
                        currBasicScroller.content.style.top = "0px";
                    }
                }
                else {
                    if (top < (currBasicScroller.basicScrollPanel.offsetHeight - currBasicScroller.basicScroller.offsetHeight)) {
                        currBasicScroller.basicScroller.style.top = (top + 11) + "px";
                        currBasicScroller.content.style.top = (currBasicScroller.contentOver * (top / currBasicScroller.basicScrollOver)) + "px";
                    }
                    else {
                        currBasicScroller.content.style.top = (currBasicScroller.container.offsetHeight - currBasicScroller.content.offsetHeight) + "px";
                    }
                }
                if (event.preventDefault) event.preventDefault();
                if (event.stopPropagation) event.stopPropagation();
                if (event.returnValue) event.returnValue = false;
                return false;
            }
        }
    }
}

function manualBasicScroll1(index, dir) {
    var currBasicScroller = basicScrollerArray[index];
    if (currBasicScroller.mouseDown) {
        var top = parseInt(currBasicScroller.basicScroller.offsetTop, 10);
        if (dir == "up") {
            if (top > 0) {
                currBasicScroller.basicScroller.style.top = (top - 1) + "px";
                currBasicScroller.content.style.top = (currBasicScroller.contentOver * (top / currBasicScroller.basicScrollOver)) + "px";
                setTimeout("manualBasicScroll1('" + index + "', 'up')", 10);
            }
            else {
                currBasicScroller.content.style.top = "0px";
            }
        }
        if (dir == "down") {
            if (top < (currBasicScroller.basicScrollPanel.offsetHeight - currBasicScroller.basicScroller.offsetHeight)) {
                currBasicScroller.basicScroller.style.top = (top + 1) + "px";
                currBasicScroller.content.style.top = (currBasicScroller.contentOver * (top / currBasicScroller.basicScrollOver)) + "px";
                setTimeout("manualBasicScroll1('" + index + "', 'down')", 10);
            }
            else {
                currBasicScroller.content.style.top = (currBasicScroller.container.offsetHeight - currBasicScroller.content.offsetHeight) + "px";
            }
        }
    }
}

function manualBasicScroll2(index, dir) {
    var currBasicScroller = basicScrollerArray[index];
    if (currBasicScroller.mouseOver) {
        var top = parseInt(currBasicScroller.basicScroller.offsetTop, 10);
        if (dir == "up") {
            if (top > 0) {
                currBasicScroller.basicScroller.style.top = (top - 1) + "px";
                currBasicScroller.content.style.top = (currBasicScroller.contentOver * (top / currBasicScroller.basicScrollOver)) + "px";
                setTimeout("manualBasicScroll1('" + index + "', 'up')", 10);
            }
            else {
                currBasicScroller.content.style.top = "0px";
            }
        }
        if (dir == "down") {
            if (top < (currBasicScroller.basicScrollPanel.offsetHeight - currBasicScroller.basicScroller.offsetHeight)) {
                currBasicScroller.basicScroller.style.top = (top + 1) + "px";
                currBasicScroller.content.style.top = (currBasicScroller.contentOver * (top / currBasicScroller.basicScrollOver)) + "px";
                setTimeout("manualBasicScroll1('" + index + "', 'down')", 10);
            }
            else {
                currBasicScroller.content.style.top = (currBasicScroller.container.offsetHeight - currBasicScroller.content.offsetHeight) + "px";
            }
        }
    }
}

/* #endregion */

/* #region DatePicker */

var datePickerArray = new Array();

function DatePicker(format) {
    var newDatePicker = new Object();
    newDatePicker.shortDayArray = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
    newDatePicker.shortMonthArray = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
    newDatePicker.monthArray = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
    newDatePicker.selectedInputField;
    newDatePicker.selectedDate = new Date();
    newDatePicker.arrayIndex = datePickerArray.length;
    newDatePicker.format = "";
    newDatePicker.callback = "";
    if (format) {
        newDatePicker.format = format;
    }

    newDatePicker.DatePickerPanel = document.createElement("div");
    newDatePicker.DatePickerPanel.setAttribute("id", "datePickerPanel");

    newDatePicker.DatePickerMonthPanel = document.createElement("div");
    newDatePicker.DatePickerMonthPanel.setAttribute("id", "datePickerMonthPanel");
    newDatePicker.DatePickerPanel.appendChild(newDatePicker.DatePickerMonthPanel);

    newDatePicker.DatePickerLeftMonthPanel = document.createElement("div");
    newDatePicker.DatePickerLeftMonthPanel.setAttribute("id", "datePickerLeftMonthPanel");
    newDatePicker.DatePickerLeftMonthPanel.onclick = function () { setDatePickerMonth('down', newDatePicker.arrayIndex); };
    newDatePicker.DatePickerMonthPanel.appendChild(newDatePicker.DatePickerLeftMonthPanel);

    newDatePicker.DatePickerMonthTextPanel = document.createElement("div");
    newDatePicker.DatePickerMonthTextPanel.setAttribute("id", "datePickerMonthTextPanel");
    newDatePicker.DatePickerMonthPanel.appendChild(newDatePicker.DatePickerMonthTextPanel);

    newDatePicker.DatePickerRightMonthPanel = document.createElement("div");
    newDatePicker.DatePickerRightMonthPanel.setAttribute("id", "datePickerRightMonthPanel");
    newDatePicker.DatePickerRightMonthPanel.onclick = function () { setDatePickerMonth('up', newDatePicker.arrayIndex); };
    newDatePicker.DatePickerMonthPanel.appendChild(newDatePicker.DatePickerRightMonthPanel);

    newDatePicker.DatePickerDayPanel = document.createElement("div");
    newDatePicker.DatePickerDayPanel.setAttribute("id", "datePickerDayPanel");
    newDatePicker.DatePickerPanel.appendChild(newDatePicker.DatePickerDayPanel);

    for (var i = 0; i < 7; i++) {
        newDatePicker.DatePickerDay = document.createElement("div");
        newDatePicker.DatePickerDay.setAttribute("class", "datePickerDay");
        newDatePicker.DatePickerDay.innerHTML = newDatePicker.shortDayArray[i];
        newDatePicker.DatePickerDayPanel.appendChild(newDatePicker.DatePickerDay);
    }

    newDatePicker.DatePickerDatePanel = document.createElement("div");
    newDatePicker.DatePickerDatePanel.setAttribute("id", "datePickerDatePanel");
    newDatePicker.DatePickerPanel.appendChild(newDatePicker.DatePickerDatePanel);

    newDatePicker.daysInMonth = function (month, year) {
        var m = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
        if (month != 2) return m[month - 1];
        if (year % 4 != 0) return m[1];
        if (year % 100 == 0 && year % 400 != 0) return m[1];
        return m[1] + 1;
    }

    newDatePicker.setMonth = function () {
        newDatePicker.DatePickerDatePanel.innerHTML = "";
        var dayCount = newDatePicker.daysInMonth(newDatePicker.selectedDate.getMonth() + 1, newDatePicker.selectedDate.getYear());
        newDatePicker.selectedDate.setDate(1);
        var dayOfWeek = newDatePicker.selectedDate.getDay();
        var dayCounter = 1;
        for (var j = 0; j < 42; j++) {
            newDatePicker.DatePickerDate = document.createElement("div");
            if (j >= dayOfWeek && dayCounter <= dayCount) {
                newDatePicker.DatePickerDate.setAttribute("class", "datePickerDate2");
                newDatePicker.DatePickerDate.onclick = function () { setDatePickerDate(this, newDatePicker.arrayIndex); };
                newDatePicker.DatePickerDate.innerHTML = dayCounter;
                dayCounter++;
            }
            else {
                newDatePicker.DatePickerDate.setAttribute("class", "datePickerDate1");
            }
            newDatePicker.DatePickerDatePanel.appendChild(newDatePicker.DatePickerDate);
        }
        newDatePicker.DatePickerMonthTextPanel.innerHTML = newDatePicker.monthArray[newDatePicker.selectedDate.getMonth()] + " " + newDatePicker.selectedDate.getFullYear();
    }

    newDatePicker.showDatePicker = function (elem, format2) {
        if (format2) {
            newDatePicker.format = format2;
        }
        newDatePicker.selectedInputField = elem;
        elem.parentNode.appendChild(newDatePicker.DatePickerPanel);
        newDatePicker.DatePickerPanel.style.top = elem.offsetTop + elem.offsetHeight + "px";
        newDatePicker.DatePickerPanel.style.left = elem.offsetLeft + elem.offsetWidth - 182 + "px";
        newDatePicker.DatePickerPanel.style.display = "inline";
    }

    newDatePicker.hideDatePickerPanel = function () {
        newDatePicker.DatePickerPanel.style.display = "none";
    }

    newDatePicker.setMonth();

    newDatePicker.setCallback = function (call) {
        newDatePicker.callback = call;
    }

    datePickerArray.push(newDatePicker);
    return newDatePicker;
}

function setDatePickerDate(elem, index) {
    var currentDatePicker = datePickerArray[index];
    currentDatePicker.selectedDate.setDate(elem.innerHTML);
    var newDateString = "";
    if (currentDatePicker.format != "") {
        newDateString = currentDatePicker.selectedDate.format(currentDatePicker.format);
    }
    else {
        newDateString = currentDatePicker.selectedDate.getDate() + "/" +
                        (currentDatePicker.selectedDate.getMonth() + 1) + "/" +
                        currentDatePicker.selectedDate.getFullYear();
    }
    if (currentDatePicker.selectedInputField.tagName.toLowerCase() == "input") {
        currentDatePicker.selectedInputField.value = newDateString;
    }
    else {
        currentDatePicker.selectedInputField.innerHTML = newDateString;
    }
    currentDatePicker.hideDatePickerPanel();
    if (currentDatePicker.callback != "") {
        var fnctns = currentDatePicker.callback + "('" + newDateString + "');";
        if (currentDatePicker.selectedInputField.id) {
            fnctns = currentDatePicker.callback + "('" + newDateString + "', '" + currentDatePicker.selectedInputField.id + "');";
        }
        eval(fnctns);
    }
}

function setDatePickerMonth(dir, index) {
    var currentDatePicker = datePickerArray[index];
    var currMonthValue = currentDatePicker.selectedDate.getMonth();
    if (dir == "up") {
        currMonthValue++;
    }
    else {
        currMonthValue--;
    }
    currentDatePicker.selectedDate.setMonth(currMonthValue);
    currentDatePicker.setMonth();
}

// Simulates PHP's date function 
Date.prototype.format = function (format) {
    var returnStr = '';
    var replace = Date.replaceChars;
    for (var i = 0; i < format.length; i++) {
        var curChar = format.charAt(i); if (i - 1 >= 0 && format.charAt(i - 1) == "\\") {
            returnStr += curChar;
        }
        else if (replace[curChar]) {
            returnStr += replace[curChar].call(this);
        } else if (curChar != "\\") {
            returnStr += curChar;
        }
    }
    return returnStr;
};

Date.replaceChars = {
    shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
    longMonths: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
    shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
    longDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],

    // Day
    d: function () { return (this.getDate() < 10 ? '0' : '') + this.getDate(); },
    D: function () { return Date.replaceChars.shortDays[this.getDay()]; },
    j: function () { return this.getDate(); },
    l: function () { return Date.replaceChars.longDays[this.getDay()]; },
    N: function () { return this.getDay() + 1; },
    S: function () { return (this.getDate() % 10 == 1 && this.getDate() != 11 ? 'st' : (this.getDate() % 10 == 2 && this.getDate() != 12 ? 'nd' : (this.getDate() % 10 == 3 && this.getDate() != 13 ? 'rd' : 'th'))); },
    w: function () { return this.getDay(); },
    z: function () { var d = new Date(this.getFullYear(), 0, 1); return Math.ceil((this - d) / 86400000); }, // Fixed now 
    // Week 
    W: function () { var d = new Date(this.getFullYear(), 0, 1); return Math.ceil((((this - d) / 86400000) + d.getDay() + 1) / 7); }, // Fixed now 
    // Month 
    F: function () { return Date.replaceChars.longMonths[this.getMonth()]; },
    m: function () { return (this.getMonth() < 9 ? '0' : '') + (this.getMonth() + 1); },
    M: function () { return Date.replaceChars.shortMonths[this.getMonth()]; },
    n: function () { return this.getMonth() + 1; },
    t: function () { var d = new Date(); return new Date(d.getFullYear(), d.getMonth(), 0).getDate() }, // Fixed now, gets #days of date 
    // Year 
    L: function () { var year = this.getFullYear(); return (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)); },   // Fixed now 
    o: function () { var d = new Date(this.valueOf()); d.setDate(d.getDate() - ((this.getDay() + 6) % 7) + 3); return d.getFullYear(); }, //Fixed now 
    Y: function () { return this.getFullYear(); },
    y: function () { return ('' + this.getFullYear()).substr(2); },
    // Time 
    a: function () { return this.getHours() < 12 ? 'am' : 'pm'; },
    A: function () { return this.getHours() < 12 ? 'AM' : 'PM'; },
    B: function () { return Math.floor((((this.getUTCHours() + 1) % 24) + this.getUTCMinutes() / 60 + this.getUTCSeconds() / 3600) * 1000 / 24); }, // Fixed now 
    g: function () { return this.getHours() % 12 || 12; },
    G: function () { return this.getHours(); },
    h: function () { return ((this.getHours() % 12 || 12) < 10 ? '0' : '') + (this.getHours() % 12 || 12); },
    H: function () { return (this.getHours() < 10 ? '0' : '') + this.getHours(); },
    i: function () { return (this.getMinutes() < 10 ? '0' : '') + this.getMinutes(); },
    s: function () { return (this.getSeconds() < 10 ? '0' : '') + this.getSeconds(); },
    u: function () {
        var m = this.getMilliseconds(); return (m < 10 ? '00' : (m < 100 ?
'0' : '')) + m;
    },
    // Timezone 
    e: function () { return "Not Yet Supported"; },
    I: function () { return "Not Yet Supported"; },
    O: function () { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + '00'; },
    P: function () { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + ':00'; }, // Fixed now 
    T: function () { var m = this.getMonth(); this.setMonth(0); var result = this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/, '$1'); this.setMonth(m); return result; },
    Z: function () { return -this.getTimezoneOffset() * 60; },
    // Full Date/Time 
    c: function () { return this.format("Y-m-d\\TH:i:sP"); }, // Fixed now 
    r: function () { return this.toString(); },
    U: function () { return this.getTime() / 1000; }
};

/* #endregion *//*
Copyright (c) Copyright (c) 2007, Carl S. Yestrau All rights reserved.
Code licensed under the BSD License: http://www.featureblend.com/license.txt
Version: 1.0.4
*/
var FlashDetect = new function(){
    var self = this;
    self.installed = false;
    self.raw = "";
    self.major = -1;
    self.minor = -1;
    self.revision = -1;
    self.revisionStr = "";
    var activeXDetectRules = [
        {
            "name":"ShockwaveFlash.ShockwaveFlash.7",
            "version":function(obj){
                return getActiveXVersion(obj);
            }
        },
        {
            "name":"ShockwaveFlash.ShockwaveFlash.6",
            "version":function(obj){
                var version = "6,0,21";
                try{
                    obj.AllowScriptAccess = "always";
                    version = getActiveXVersion(obj);
                }catch(err){}
                return version;
            }
        },
        {
            "name":"ShockwaveFlash.ShockwaveFlash",
            "version":function(obj){
                return getActiveXVersion(obj);
            }
        }
    ];
    /**
     * Extract the ActiveX version of the plugin.
     * 
     * @param {Object} The flash ActiveX object.
     * @type String
     */
    var getActiveXVersion = function(activeXObj){
        var version = -1;
        try{
            version = activeXObj.GetVariable("$version");
        }catch(err){}
        return version;
    };
    /**
     * Try and retrieve an ActiveX object having a specified name.
     * 
     * @param {String} name The ActiveX object name lookup.
     * @return One of ActiveX object or a simple object having an attribute of activeXError with a value of true.
     * @type Object
     */
    var getActiveXObject = function(name){
        var obj = -1;
        try{
            obj = new ActiveXObject(name);
        }catch(err){
            obj = {activeXError:true};
        }
        return obj;
    };
    /**
     * Parse an ActiveX $version string into an object.
     * 
     * @param {String} str The ActiveX Object GetVariable($version) return value. 
     * @return An object having raw, major, minor, revision and revisionStr attributes.
     * @type Object
     */
    var parseActiveXVersion = function(str){
        var versionArray = str.split(",");//replace with regex
        return {
            "raw":str,
            "major":parseInt(versionArray[0].split(" ")[1], 10),
            "minor":parseInt(versionArray[1], 10),
            "revision":parseInt(versionArray[2], 10),
            "revisionStr":versionArray[2]
        };
    };
    /**
     * Parse a standard enabledPlugin.description into an object.
     * 
     * @param {String} str The enabledPlugin.description value.
     * @return An object having raw, major, minor, revision and revisionStr attributes.
     * @type Object
     */
    var parseStandardVersion = function(str){
        var descParts = str.split(/ +/);
        var majorMinor = descParts[2].split(/\./);
        var revisionStr = descParts[3];
        return {
            "raw":str,
            "major":parseInt(majorMinor[0], 10),
            "minor":parseInt(majorMinor[1], 10), 
            "revisionStr":revisionStr,
            "revision":parseRevisionStrToInt(revisionStr)
        };
    };
    /**
     * Parse the plugin revision string into an integer.
     * 
     * @param {String} The revision in string format.
     * @type Number
     */
    var parseRevisionStrToInt = function(str){
        return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
    };
    /**
     * Is the major version greater than or equal to a specified version.
     * 
     * @param {Number} version The minimum required major version.
     * @type Boolean
     */
    self.majorAtLeast = function(version){
        return self.major >= version;
    };
    /**
     * Is the minor version greater than or equal to a specified version.
     * 
     * @param {Number} version The minimum required minor version.
     * @type Boolean
     */
    self.minorAtLeast = function(version){
        return self.minor >= version;
    };
    /**
     * Is the revision version greater than or equal to a specified version.
     * 
     * @param {Number} version The minimum required revision version.
     * @type Boolean
     */
    self.revisionAtLeast = function(version){
        return self.revision >= version;
    };
    /**
     * Is the version greater than or equal to a specified major, minor and revision.
     * 
     * @param {Number} major The minimum required major version.
     * @param {Number} (Optional) minor The minimum required minor version.
     * @param {Number} (Optional) revision The minimum required revision version.
     * @type Boolean
     */
    self.versionAtLeast = function(major){
        var properties = [self.major, self.minor, self.revision];
        var len = Math.min(properties.length, arguments.length);
        for(i=0; i<len; i++){
            if(properties[i]>=arguments[i]){
                if(i+1<len && properties[i]==arguments[i]){
                    continue;
                }else{
                    return true;
                }
            }else{
                return false;
            }
        }
    };
    /**
     * Constructor, sets raw, major, minor, revisionStr, revision and installed public properties.
     */
    self.FlashDetect = function(){
        if(navigator.plugins && navigator.plugins.length>0){
            var type = 'application/x-shockwave-flash';
            var mimeTypes = navigator.mimeTypes;
            if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){
                var version = mimeTypes[type].enabledPlugin.description;
                var versionObj = parseStandardVersion(version);
                self.raw = versionObj.raw;
                self.major = versionObj.major;
                self.minor = versionObj.minor; 
                self.revisionStr = versionObj.revisionStr;
                self.revision = versionObj.revision;
                self.installed = true;
            }
        }else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){
            var version = -1;
            for(var i=0; i<activeXDetectRules.length && version==-1; i++){
                var obj = getActiveXObject(activeXDetectRules[i].name);
                if(!obj.activeXError){
                    self.installed = true;
                    version = activeXDetectRules[i].version(obj);
                    if(version!=-1){
                        var versionObj = parseActiveXVersion(version);
                        self.raw = versionObj.raw;
                        self.major = versionObj.major;
                        self.minor = versionObj.minor; 
                        self.revision = versionObj.revision;
                        self.revisionStr = versionObj.revisionStr;
                    }
                }
            }
        }
    }();
};
FlashDetect.JS_RELEASE = "1.0.4";if(typeof jwplayer=="undefined"){var jwplayer=function(a){if(jwplayer.api){return jwplayer.api.selectPlayer(a)}};var $jw=jwplayer;jwplayer.version="5.7.1864";jwplayer.vid=document.createElement("video");jwplayer.audio=document.createElement("audio");jwplayer.source=document.createElement("source");(function(b){b.utils=function(){};b.utils.typeOf=function(d){var c=typeof d;if(c==="object"){if(d){if(d instanceof Array){c="array"}}else{c="null"}}return c};b.utils.extend=function(){var c=b.utils.extend["arguments"];if(c.length>1){for(var e=1;e<c.length;e++){for(var d in c[e]){c[0][d]=c[e][d]}}return c[0]}return null};b.utils.clone=function(f){var c;var d=b.utils.clone["arguments"];if(d.length==1){switch(b.utils.typeOf(d[0])){case"object":c={};for(var e in d[0]){c[e]=b.utils.clone(d[0][e])}break;case"array":c=[];for(var e in d[0]){c[e]=b.utils.clone(d[0][e])}break;default:return d[0];break}}return c};b.utils.extension=function(c){if(!c){return""}c=c.substring(c.lastIndexOf("/")+1,c.length);c=c.split("?")[0];if(c.lastIndexOf(".")>-1){return c.substr(c.lastIndexOf(".")+1,c.length).toLowerCase()}return};b.utils.html=function(c,d){c.innerHTML=d};b.utils.wrap=function(c,d){if(c.parentNode){c.parentNode.replaceChild(d,c)}d.appendChild(c)};b.utils.ajax=function(g,f,c){var e;if(window.XMLHttpRequest){e=new XMLHttpRequest()}else{e=new ActiveXObject("Microsoft.XMLHTTP")}e.onreadystatechange=function(){if(e.readyState===4){if(e.status===200){if(f){f(e)}}else{if(c){c(g)}}}};try{e.open("GET",g,true);e.send(null)}catch(d){if(c){c(g)}}return e};b.utils.load=function(d,e,c){d.onreadystatechange=function(){if(d.readyState===4){if(d.status===200){if(e){e()}}else{if(c){c()}}}}};b.utils.find=function(d,c){return d.getElementsByTagName(c)};b.utils.append=function(c,d){c.appendChild(d)};b.utils.isIE=function(){return((!+"\v1")||(typeof window.ActiveXObject!="undefined"))};b.utils.isLegacyAndroid=function(){var c=navigator.userAgent.toLowerCase();return(c.match(/android 2.[012]/i)!==null)};b.utils.isIOS=function(d){if(typeof d=="undefined"){d=/iP(hone|ad|od)/i}var c=navigator.userAgent.toLowerCase();return(c.match(d)!==null)};b.utils.isIPad=function(){return b.utils.isIOS(/iPad/i)};b.utils.isIPod=function(){return b.utils.isIOS(/iP(hone|od)/i)};b.utils.getFirstPlaylistItemFromConfig=function(c){var d={};var e;if(c.playlist&&c.playlist.length){e=c.playlist[0]}else{e=c}d.file=e.file;d.levels=e.levels;d.streamer=e.streamer;d.playlistfile=e.playlistfile;d.provider=e.provider;if(!d.provider){if(d.file&&(d.file.toLowerCase().indexOf("youtube.com")>-1||d.file.toLowerCase().indexOf("youtu.be")>-1)){d.provider="youtube"}if(d.streamer&&d.streamer.toLowerCase().indexOf("rtmp://")==0){d.provider="rtmp"}if(e.type){d.provider=e.type.toLowerCase()}}if(d.provider=="audio"){d.provider="sound"}return d};b.utils.getOuterHTML=function(c){if(c.outerHTML){return c.outerHTML}else{try{return new XMLSerializer().serializeToString(c)}catch(d){return""}}};b.utils.setOuterHTML=function(f,e){if(f.outerHTML){f.outerHTML=e}else{var g=document.createElement("div");g.innerHTML=e;var c=document.createRange();c.selectNodeContents(g);var d=c.extractContents();f.parentNode.insertBefore(d,f);f.parentNode.removeChild(f)}};b.utils.hasFlash=function(){if(typeof navigator.plugins!="undefined"&&typeof navigator.plugins["Shockwave Flash"]!="undefined"){return true}if(typeof window.ActiveXObject!="undefined"){try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash");return true}catch(c){}}return false};b.utils.getPluginName=function(c){if(c.lastIndexOf("/")>=0){c=c.substring(c.lastIndexOf("/")+1,c.length)}if(c.lastIndexOf("-")>=0){c=c.substring(0,c.lastIndexOf("-"))}if(c.lastIndexOf(".swf")>=0){c=c.substring(0,c.lastIndexOf(".swf"))}if(c.lastIndexOf(".js")>=0){c=c.substring(0,c.lastIndexOf(".js"))}return c};b.utils.getPluginVersion=function(c){if(c.lastIndexOf("-")>=0){if(c.lastIndexOf(".js")>=0){return c.substring(c.lastIndexOf("-")+1,c.lastIndexOf(".js"))}else{if(c.lastIndexOf(".swf")>=0){return c.substring(c.lastIndexOf("-")+1,c.lastIndexOf(".swf"))}else{return c.substring(c.lastIndexOf("-")+1)}}}return""};b.utils.getAbsolutePath=function(j,h){if(!b.utils.exists(h)){h=document.location.href}if(!b.utils.exists(j)){return undefined}if(a(j)){return j}var k=h.substring(0,h.indexOf("://")+3);var g=h.substring(k.length,h.indexOf("/",k.length+1));var d;if(j.indexOf("/")===0){d=j.split("/")}else{var e=h.split("?")[0];e=e.substring(k.length+g.length+1,e.lastIndexOf("/"));d=e.split("/").concat(j.split("/"))}var c=[];for(var f=0;f<d.length;f++){if(!d[f]||!b.utils.exists(d[f])||d[f]=="."){continue}else{if(d[f]==".."){c.pop()}else{c.push(d[f])}}}return k+g+"/"+c.join("/")};function a(d){if(!b.utils.exists(d)){return}var e=d.indexOf("://");var c=d.indexOf("?");return(e>0&&(c<0||(c>e)))}b.utils.pluginPathType={ABSOLUTE:"ABSOLUTE",RELATIVE:"RELATIVE",CDN:"CDN"};b.utils.getPluginPathType=function(d){if(typeof d!="string"){return}d=d.split("?")[0];var e=d.indexOf("://");if(e>0){return b.utils.pluginPathType.ABSOLUTE}var c=d.indexOf("/");var f=b.utils.extension(d);if(e<0&&c<0&&(!f||!isNaN(f))){return b.utils.pluginPathType.CDN}return b.utils.pluginPathType.RELATIVE};b.utils.mapEmpty=function(c){for(var d in c){return false}return true};b.utils.mapLength=function(d){var c=0;for(var e in d){c++}return c};b.utils.log=function(d,c){if(typeof console!="undefined"&&typeof console.log!="undefined"){if(c){console.log(d,c)}else{console.log(d)}}};b.utils.css=function(d,g,c){if(b.utils.exists(d)){for(var e in g){try{if(typeof g[e]==="undefined"){continue}else{if(typeof g[e]=="number"&&!(e=="zIndex"||e=="opacity")){if(isNaN(g[e])){continue}if(e.match(/color/i)){g[e]="#"+b.utils.strings.pad(g[e].toString(16),6)}else{g[e]=Math.ceil(g[e])+"px"}}}d.style[e]=g[e]}catch(f){}}}};b.utils.isYouTube=function(c){return(c.indexOf("youtube.com")>-1||c.indexOf("youtu.be")>-1)};b.utils.transform=function(c,d){c.style.webkitTransform=d;c.style.MozTransform=d;c.style.OTransform=d};b.utils.stretch=function(h,n,m,f,l,g){if(typeof m=="undefined"||typeof f=="undefined"||typeof l=="undefined"||typeof g=="undefined"){return}var d=m/l;var e=f/g;var k=0;var j=0;n.style.overflow="hidden";b.utils.transform(n,"");var c={};switch(h.toUpperCase()){case b.utils.stretching.NONE:c.width=l;c.height=g;break;case b.utils.stretching.UNIFORM:if(d>e){c.width=l*e;c.height=g*e}else{c.width=l*d;c.height=g*d}break;case b.utils.stretching.FILL:if(d>e){c.width=l*d;c.height=g*d}else{c.width=l*e;c.height=g*e}break;case b.utils.stretching.EXACTFIT:b.utils.transform(n,["scale(",d,",",e,")"," translate(0px,0px)"].join(""));c.width=l;c.height=g;break;default:break}c.top=(f-c.height)/2;c.left=(m-c.width)/2;b.utils.css(n,c)};b.utils.stretching={NONE:"NONE",FILL:"FILL",UNIFORM:"UNIFORM",EXACTFIT:"EXACTFIT"};b.utils.deepReplaceKeyName=function(h,e,c){switch(b.utils.typeOf(h)){case"array":for(var g=0;g<h.length;g++){h[g]=b.utils.deepReplaceKeyName(h[g],e,c)}break;case"object":for(var f in h){var d=f.replace(new RegExp(e,"g"),c);h[d]=b.utils.deepReplaceKeyName(h[f],e,c);if(f!=d){delete h[f]}}break}return h};b.utils.isInArray=function(e,d){if(!(e)||!(e instanceof Array)){return false}for(var c=0;c<e.length;c++){if(d===e[c]){return true}}return false};b.utils.exists=function(c){switch(typeof(c)){case"string":return(c.length>0);break;case"object":return(c!==null);case"undefined":return false}return true};b.utils.empty=function(c){if(typeof c.hasChildNodes=="function"){while(c.hasChildNodes()){c.removeChild(c.firstChild)}}};b.utils.parseDimension=function(c){if(typeof c=="string"){if(c===""){return 0}else{if(c.lastIndexOf("%")>-1){return c}else{return parseInt(c.replace("px",""),10)}}}return c};b.utils.getDimensions=function(c){if(c&&c.style){return{x:b.utils.parseDimension(c.style.left),y:b.utils.parseDimension(c.style.top),width:b.utils.parseDimension(c.style.width),height:b.utils.parseDimension(c.style.height)}}else{return{}}};b.utils.timeFormat=function(c){str="00:00";if(c>0){str=Math.floor(c/60)<10?"0"+Math.floor(c/60)+":":Math.floor(c/60)+":";str+=Math.floor(c%60)<10?"0"+Math.floor(c%60):Math.floor(c%60)}return str}})(jwplayer);(function(a){a.events=function(){};a.events.COMPLETE="COMPLETE";a.events.ERROR="ERROR"})(jwplayer);(function(jwplayer){jwplayer.events.eventdispatcher=function(debug){var _debug=debug;var _listeners;var _globallisteners;this.resetEventListeners=function(){_listeners={};_globallisteners=[]};this.resetEventListeners();this.addEventListener=function(type,listener,count){try{if(!jwplayer.utils.exists(_listeners[type])){_listeners[type]=[]}if(typeof(listener)=="string"){eval("listener = "+listener)}_listeners[type].push({listener:listener,count:count})}catch(err){jwplayer.utils.log("error",err)}return false};this.removeEventListener=function(type,listener){if(!_listeners[type]){return}try{for(var listenerIndex=0;listenerIndex<_listeners[type].length;listenerIndex++){if(_listeners[type][listenerIndex].listener.toString()==listener.toString()){_listeners[type].splice(listenerIndex,1);break}}}catch(err){jwplayer.utils.log("error",err)}return false};this.addGlobalListener=function(listener,count){try{if(typeof(listener)=="string"){eval("listener = "+listener)}_globallisteners.push({listener:listener,count:count})}catch(err){jwplayer.utils.log("error",err)}return false};this.removeGlobalListener=function(listener){if(!_globallisteners[type]){return}try{for(var globalListenerIndex=0;globalListenerIndex<_globallisteners.length;globalListenerIndex++){if(_globallisteners[globalListenerIndex].listener.toString()==listener.toString()){_globallisteners.splice(globalListenerIndex,1);break}}}catch(err){jwplayer.utils.log("error",err)}return false};this.sendEvent=function(type,data){if(!jwplayer.utils.exists(data)){data={}}if(_debug){jwplayer.utils.log(type,data)}if(typeof _listeners[type]!="undefined"){for(var listenerIndex=0;listenerIndex<_listeners[type].length;listenerIndex++){try{_listeners[type][listenerIndex].listener(data)}catch(err){jwplayer.utils.log("There was an error while handling a listener: "+err.toString(),_listeners[type][listenerIndex].listener)}if(_listeners[type][listenerIndex]){if(_listeners[type][listenerIndex].count===1){delete _listeners[type][listenerIndex]}else{if(_listeners[type][listenerIndex].count>0){_listeners[type][listenerIndex].count=_listeners[type][listenerIndex].count-1}}}}}for(var globalListenerIndex=0;globalListenerIndex<_globallisteners.length;globalListenerIndex++){try{_globallisteners[globalListenerIndex].listener(data)}catch(err){jwplayer.utils.log("There was an error while handling a listener: "+err.toString(),_globallisteners[globalListenerIndex].listener)}if(_globallisteners[globalListenerIndex]){if(_globallisteners[globalListenerIndex].count===1){delete _globallisteners[globalListenerIndex]}else{if(_globallisteners[globalListenerIndex].count>0){_globallisteners[globalListenerIndex].count=_globallisteners[globalListenerIndex].count-1}}}}}}})(jwplayer);(function(a){var b={};a.utils.animations=function(){};a.utils.animations.transform=function(c,d){c.style.webkitTransform=d;c.style.MozTransform=d;c.style.OTransform=d;c.style.msTransform=d};a.utils.animations.transformOrigin=function(c,d){c.style.webkitTransformOrigin=d;c.style.MozTransformOrigin=d;c.style.OTransformOrigin=d;c.style.msTransformOrigin=d};a.utils.animations.rotate=function(c,d){a.utils.animations.transform(c,["rotate(",d,"deg)"].join(""))};a.utils.cancelAnimation=function(c){delete b[c.id]};a.utils.fadeTo=function(m,f,e,j,h,d){if(b[m.id]!=d&&a.utils.exists(d)){return}if(m.style.opacity==f){return}var c=new Date().getTime();if(d>c){setTimeout(function(){a.utils.fadeTo(m,f,e,j,0,d)},d-c)}if(m.style.display=="none"){m.style.display="block"}if(!a.utils.exists(j)){j=m.style.opacity===""?1:m.style.opacity}if(m.style.opacity==f&&m.style.opacity!==""&&a.utils.exists(d)){if(f===0){m.style.display="none"}return}if(!a.utils.exists(d)){d=c;b[m.id]=d}if(!a.utils.exists(h)){h=0}var k=(e>0)?((c-d)/(e*1000)):0;k=k>1?1:k;var l=f-j;var g=j+(k*l);if(g>1){g=1}else{if(g<0){g=0}}m.style.opacity=g;if(h>0){b[m.id]=d+h*1000;a.utils.fadeTo(m,f,e,j,0,b[m.id]);return}setTimeout(function(){a.utils.fadeTo(m,f,e,j,0,d)},10)}})(jwplayer);(function(a){a.utils.arrays=function(){};a.utils.arrays.indexOf=function(c,d){for(var b=0;b<c.length;b++){if(c[b]==d){return b}}return -1};a.utils.arrays.remove=function(c,d){var b=a.utils.arrays.indexOf(c,d);if(b>-1){c.splice(b,1)}}})(jwplayer);(function(a){a.utils.extensionmap={"3gp":{html5:"video/3gpp",flash:"video"},"3gpp":{html5:"video/3gpp"},"3g2":{html5:"video/3gpp2",flash:"video"},"3gpp2":{html5:"video/3gpp2"},flv:{flash:"video"},f4a:{html5:"audio/mp4"},f4b:{html5:"audio/mp4",flash:"video"},f4v:{html5:"video/mp4",flash:"video"},mov:{html5:"video/quicktime",flash:"video"},m4a:{html5:"audio/mp4",flash:"video"},m4b:{html5:"audio/mp4"},m4p:{html5:"audio/mp4"},m4v:{html5:"video/mp4",flash:"video"},mp4:{html5:"video/mp4",flash:"video"},rbs:{flash:"sound"},aac:{html5:"audio/aac",flash:"video"},mp3:{html5:"audio/mp3",flash:"sound"},ogg:{html5:"audio/ogg"},oga:{html5:"audio/ogg"},ogv:{html5:"video/ogg"},webm:{html5:"video/webm"},m3u8:{html5:"audio/x-mpegurl"},gif:{flash:"image"},jpeg:{flash:"image"},jpg:{flash:"image"},swf:{flash:"image"},png:{flash:"image"},wav:{html5:"audio/x-wav"}}})(jwplayer);(function(e){e.utils.mediaparser=function(){};var g={element:{width:"width",height:"height",id:"id","class":"className",name:"name"},media:{src:"file",preload:"preload",autoplay:"autostart",loop:"repeat",controls:"controls"},source:{src:"file",type:"type",media:"media","data-jw-width":"width","data-jw-bitrate":"bitrate"},video:{poster:"image"}};var f={};e.utils.mediaparser.parseMedia=function(j){return d(j)};function c(k,j){if(!e.utils.exists(j)){j=g[k]}else{e.utils.extend(j,g[k])}return j}function d(n,j){if(f[n.tagName.toLowerCase()]&&!e.utils.exists(j)){return f[n.tagName.toLowerCase()](n)}else{j=c("element",j);var o={};for(var k in j){if(k!="length"){var m=n.getAttribute(k);if(e.utils.exists(m)){o[j[k]]=m}}}var l=n.style["#background-color"];if(l&&!(l=="transparent"||l=="rgba(0, 0, 0, 0)")){o.screencolor=l}return o}}function h(n,k){k=c("media",k);var l=[];var j=e.utils.selectors("source",n);for(var m in j){if(!isNaN(m)){l.push(a(j[m]))}}var o=d(n,k);if(e.utils.exists(o.file)){l[0]={file:o.file}}o.levels=l;return o}function a(l,k){k=c("source",k);var j=d(l,k);j.width=j.width?j.width:0;j.bitrate=j.bitrate?j.bitrate:0;return j}function b(l,k){k=c("video",k);var j=h(l,k);return j}f.media=h;f.audio=h;f.source=a;f.video=b})(jwplayer);(function(a){a.utils.loaderstatus={NEW:"NEW",LOADING:"LOADING",ERROR:"ERROR",COMPLETE:"COMPLETE"};a.utils.scriptloader=function(c){var d=a.utils.loaderstatus.NEW;var b=new a.events.eventdispatcher();a.utils.extend(this,b);this.load=function(){if(d==a.utils.loaderstatus.NEW){d=a.utils.loaderstatus.LOADING;var e=document.createElement("script");e.onload=function(f){d=a.utils.loaderstatus.COMPLETE;b.sendEvent(a.events.COMPLETE)};e.onerror=function(f){d=a.utils.loaderstatus.ERROR;b.sendEvent(a.events.ERROR)};e.onreadystatechange=function(){if(e.readyState=="loaded"||e.readyState=="complete"){d=a.utils.loaderstatus.COMPLETE;b.sendEvent(a.events.COMPLETE)}};document.getElementsByTagName("head")[0].appendChild(e);e.src=c}};this.getStatus=function(){return d}}})(jwplayer);(function(a){a.utils.selectors=function(b,e){if(!a.utils.exists(e)){e=document}b=a.utils.strings.trim(b);var c=b.charAt(0);if(c=="#"){return e.getElementById(b.substr(1))}else{if(c=="."){if(e.getElementsByClassName){return e.getElementsByClassName(b.substr(1))}else{return a.utils.selectors.getElementsByTagAndClass("*",b.substr(1))}}else{if(b.indexOf(".")>0){var d=b.split(".");return a.utils.selectors.getElementsByTagAndClass(d[0],d[1])}else{return e.getElementsByTagName(b)}}}return null};a.utils.selectors.getElementsByTagAndClass=function(e,h,g){var j=[];if(!a.utils.exists(g)){g=document}var f=g.getElementsByTagName(e);for(var d=0;d<f.length;d++){if(a.utils.exists(f[d].className)){var c=f[d].className.split(" ");for(var b=0;b<c.length;b++){if(c[b]==h){j.push(f[d])}}}}return j}})(jwplayer);(function(a){a.utils.strings=function(){};a.utils.strings.trim=function(b){return b.replace(/^\s*/,"").replace(/\s*$/,"")};a.utils.strings.pad=function(c,d,b){if(!b){b="0"}while(c.length<d){c=b+c}return c};a.utils.strings.serialize=function(b){if(b==null){return null}else{if(b=="true"){return true}else{if(b=="false"){return false}else{if(isNaN(Number(b))||b.length>5||b.length==0){return b}else{return Number(b)}}}}};a.utils.strings.seconds=function(d){d=d.replace(",",".");var b=d.split(":");var c=0;if(d.substr(-1)=="s"){c=Number(d.substr(0,d.length-1))}else{if(d.substr(-1)=="m"){c=Number(d.substr(0,d.length-1))*60}else{if(d.substr(-1)=="h"){c=Number(d.substr(0,d.length-1))*3600}else{if(b.length>1){c=Number(b[b.length-1]);c+=Number(b[b.length-2])*60;if(b.length==3){c+=Number(b[b.length-3])*3600}}else{c=Number(d)}}}}return c};a.utils.strings.xmlAttribute=function(b,c){for(var d in b.attributes){if(b.attributes[d].name&&b.attributes[d].name.toLowerCase()==c.toLowerCase()){return b.attributes[d].value.toString()}}return""};a.utils.strings.jsonToString=function(f){var h=h||{};if(h&&h.stringify){return h.stringify(f)}var c=typeof(f);if(c!="object"||f===null){if(c=="string"){f='"'+f+'"'}else{return String(f)}}else{var g=[],b=(f&&f.constructor==Array);for(var d in f){var e=f[d];switch(typeof(e)){case"string":e='"'+e+'"';break;case"object":if(a.utils.exists(e)){e=a.utils.strings.jsonToString(e)}break}if(b){if(typeof(e)!="function"){g.push(String(e))}}else{if(typeof(e)!="function"){g.push('"'+d+'":'+String(e))}}}if(b){return"["+String(g)+"]"}else{return"{"+String(g)+"}"}}}})(jwplayer);(function(c){var d=new RegExp(/^(#|0x)[0-9a-fA-F]{3,6}/);c.utils.typechecker=function(g,f){f=!c.utils.exists(f)?b(g):f;return e(g,f)};function b(f){var g=["true","false","t","f"];if(g.toString().indexOf(f.toLowerCase().replace(" ",""))>=0){return"boolean"}else{if(d.test(f)){return"color"}else{if(!isNaN(parseInt(f,10))&&parseInt(f,10).toString().length==f.length){return"integer"}else{if(!isNaN(parseFloat(f))&&parseFloat(f).toString().length==f.length){return"float"}}}}return"string"}function e(g,f){if(!c.utils.exists(f)){return g}switch(f){case"color":if(g.length>0){return a(g)}return null;case"integer":return parseInt(g,10);case"float":return parseFloat(g);case"boolean":if(g.toLowerCase()=="true"){return true}else{if(g=="1"){return true}}return false}return g}function a(f){switch(f.toLowerCase()){case"blue":return parseInt("0000FF",16);case"green":return parseInt("00FF00",16);case"red":return parseInt("FF0000",16);case"cyan":return parseInt("00FFFF",16);case"magenta":return parseInt("FF00FF",16);case"yellow":return parseInt("FFFF00",16);case"black":return parseInt("000000",16);case"white":return parseInt("FFFFFF",16);default:f=f.replace(/(#|0x)?([0-9A-F]{3,6})$/gi,"$2");if(f.length==3){f=f.charAt(0)+f.charAt(0)+f.charAt(1)+f.charAt(1)+f.charAt(2)+f.charAt(2)}return parseInt(f,16)}return parseInt("000000",16)}})(jwplayer);(function(a){a.utils.parsers=function(){}})(jwplayer);(function(a){a.utils.parsers.jwparser=function(){};a.utils.parsers.jwparser.PREFIX="jwplayer";a.utils.parsers.jwparser.parseEntry=function(c,d){for(var b in c.childNodes){if(c.childNodes[b].prefix==a.utils.parsers.jwparser.PREFIX){d[c.childNodes[b].localName]=a.utils.strings.serialize(c.childNodes[b].textContent)}if(!d.file&&String(d.link).toLowerCase().indexOf("youtube")>-1){d.file=d.link}}return d};a.utils.parsers.jwparser.getProvider=function(c){if(c.type){return c.type}else{if(c.file.indexOf("youtube.com/w")>-1||c.file.indexOf("youtube.com/v")>-1||c.file.indexOf("youtu.be/")>-1){return"youtube"}else{if(c.streamer&&c.streamer.indexOf("rtmp")==0){return"rtmp"}else{if(c.streamer&&c.streamer.indexOf("http")==0){return"http"}else{var b=a.utils.strings.extension(c.file);if(extensions.hasOwnProperty(b)){return extensions[b]}}}}}return""}})(jwplayer);(function(a){a.utils.parsers.mediaparser=function(){};a.utils.parsers.mediaparser.PREFIX="media";a.utils.parsers.mediaparser.parseGroup=function(d,f){var e=false;for(var c in d.childNodes){if(d.childNodes[c].prefix==a.utils.parsers.mediaparser.PREFIX){if(!d.childNodes[c].localName){continue}switch(d.childNodes[c].localName.toLowerCase()){case"content":if(!e){f.file=a.utils.strings.xmlAttribute(d.childNodes[c],"url")}if(d.childNodes[c].attributes.duration){f.duration=a.utils.strings.seconds(a.utils.strings.xmlAttribute(d.childNodes[c],"duration"))}if(d.childNodes[c].attributes.start){f.start=a.utils.strings.seconds(a.utils.strings.xmlAttribute(d.childNodes[c],"start"))}if(d.childNodes[c].childNodes&&d.childNodes[c].childNodes.length>0){f=a.utils.parsers.mediaparser.parseGroup(d.childNodes[c],f)}if(d.childNodes[c].attributes.width||d.childNodes[c].attributes.bitrate||d.childNodes[c].attributes.url){if(!f.levels){f.levels=[]}f.levels.push({width:a.utils.strings.xmlAttribute(d.childNodes[c],"width"),bitrate:a.utils.strings.xmlAttribute(d.childNodes[c],"bitrate"),file:a.utils.strings.xmlAttribute(d.childNodes[c],"url")})}break;case"title":f.title=d.childNodes[c].textContent;break;case"description":f.description=d.childNodes[c].textContent;break;case"keywords":f.tags=d.childNodes[c].textContent;break;case"thumbnail":f.image=a.utils.strings.xmlAttribute(d.childNodes[c],"url");break;case"credit":f.author=d.childNodes[c].textContent;break;case"player":var b=d.childNodes[c].url;if(b.indexOf("youtube.com")>=0||b.indexOf("youtu.be")>=0){e=true;f.file=a.utils.strings.xmlAttribute(d.childNodes[c],"url")}break;case"group":a.utils.parsers.mediaparser.parseGroup(d.childNodes[c],f);break}}}return f}})(jwplayer);(function(b){b.utils.parsers.rssparser=function(){};b.utils.parsers.rssparser.parse=function(f){var c=[];for(var e in f.childNodes){if(f.childNodes[e].localName&&f.childNodes[e].localName.toLowerCase()=="channel"){for(var d in f.childNodes[e].childNodes){if(f.childNodes[e].childNodes[d].localName&&f.childNodes[e].childNodes[d].localName.toLowerCase()=="item"){c.push(a(f.childNodes[e].childNodes[d]))}}}}return c};function a(d){var e={};for(var c in d.childNodes){if(!d.childNodes[c].localName){continue}switch(d.childNodes[c].localName.toLowerCase()){case"enclosure":e.file=b.utils.strings.xmlAttribute(d.childNodes[c],"url");break;case"title":e.title=d.childNodes[c].textContent;break;case"pubdate":e.date=d.childNodes[c].textContent;break;case"description":e.description=d.childNodes[c].textContent;break;case"link":e.link=d.childNodes[c].textContent;break;case"category":if(e.tags){e.tags+=d.childNodes[c].textContent}else{e.tags=d.childNodes[c].textContent}break}}e=b.utils.parsers.mediaparser.parseGroup(d,e);e=b.utils.parsers.jwparser.parseEntry(d,e);return new b.html5.playlistitem(e)}})(jwplayer);(function(a){var c={};var b={};a.plugins=function(){};a.plugins.loadPlugins=function(e,d){b[e]=new a.plugins.pluginloader(new a.plugins.model(c),d);return b[e]};a.plugins.registerPlugin=function(h,f,e){var d=a.utils.getPluginName(h);if(c[d]){c[d].registerPlugin(h,f,e)}else{a.utils.log("A plugin ("+h+") was registered with the player that was not loaded. Please check your configuration.");for(var g in b){b[g].pluginFailed()}}}})(jwplayer);(function(a){a.plugins.model=function(b){this.addPlugin=function(c){var d=a.utils.getPluginName(c);if(!b[d]){b[d]=new a.plugins.plugin(c)}return b[d]}}})(jwplayer);(function(a){a.plugins.pluginmodes={FLASH:"FLASH",JAVASCRIPT:"JAVASCRIPT",HYBRID:"HYBRID"};a.plugins.plugin=function(b){var d="http://plugins.longtailvideo.com";var j=a.utils.loaderstatus.NEW;var k;var h;var l;var c=new a.events.eventdispatcher();a.utils.extend(this,c);function e(){switch(a.utils.getPluginPathType(b)){case a.utils.pluginPathType.ABSOLUTE:return b;case a.utils.pluginPathType.RELATIVE:return a.utils.getAbsolutePath(b,window.location.href);case a.utils.pluginPathType.CDN:var n=a.utils.getPluginName(b);var m=a.utils.getPluginVersion(b);return d+"/"+a.version.split(".")[0]+"/"+n+"/"+n+(m!==""?("-"+m):"")+".js"}}function g(m){l=setTimeout(function(){j=a.utils.loaderstatus.COMPLETE;c.sendEvent(a.events.COMPLETE)},1000)}function f(m){j=a.utils.loaderstatus.ERROR;c.sendEvent(a.events.ERROR)}this.load=function(){if(j==a.utils.loaderstatus.NEW){if(b.lastIndexOf(".swf")>0){k=b;j=a.utils.loaderstatus.COMPLETE;c.sendEvent(a.events.COMPLETE);return}j=a.utils.loaderstatus.LOADING;var m=new a.utils.scriptloader(e());m.addEventListener(a.events.COMPLETE,g);m.addEventListener(a.events.ERROR,f);m.load()}};this.registerPlugin=function(o,n,m){if(l){clearTimeout(l);l=undefined}if(n&&m){k=m;h=n}else{if(typeof n=="string"){k=n}else{if(typeof n=="function"){h=n}else{if(!n&&!m){k=o}}}}j=a.utils.loaderstatus.COMPLETE;c.sendEvent(a.events.COMPLETE)};this.getStatus=function(){return j};this.getPluginName=function(){return a.utils.getPluginName(b)};this.getFlashPath=function(){if(k){switch(a.utils.getPluginPathType(k)){case a.utils.pluginPathType.ABSOLUTE:return k;case a.utils.pluginPathType.RELATIVE:if(b.lastIndexOf(".swf")>0){return a.utils.getAbsolutePath(k,window.location.href)}return a.utils.getAbsolutePath(k,e());case a.utils.pluginPathType.CDN:if(k.indexOf("-")>-1){return k+"h"}return k+"-h"}}return null};this.getJS=function(){return h};this.getPluginmode=function(){if(typeof k!="undefined"&&typeof h!="undefined"){return a.plugins.pluginmodes.HYBRID}else{if(typeof k!="undefined"){return a.plugins.pluginmodes.FLASH}else{if(typeof h!="undefined"){return a.plugins.pluginmodes.JAVASCRIPT}}}};this.getNewInstance=function(n,m,o){return new h(n,m,o)};this.getURL=function(){return b}}})(jwplayer);(function(a){a.plugins.pluginloader=function(h,e){var g={};var k=a.utils.loaderstatus.NEW;var d=false;var b=false;var c=new a.events.eventdispatcher();a.utils.extend(this,c);function f(){if(!b){b=true;k=a.utils.loaderstatus.COMPLETE;c.sendEvent(a.events.COMPLETE)}}function j(){if(!b){var m=0;for(plugin in g){var l=g[plugin].getStatus();if(l==a.utils.loaderstatus.LOADING||l==a.utils.loaderstatus.NEW){m++}}if(m==0){f()}}}this.setupPlugins=function(n,l,s){var m={length:0,plugins:{}};var p={length:0,plugins:{}};for(var o in g){var q=g[o].getPluginName();if(g[o].getFlashPath()){m.plugins[g[o].getFlashPath()]=l.plugins[o];m.plugins[g[o].getFlashPath()].pluginmode=g[o].getPluginmode();m.length++}if(g[o].getJS()){var r=document.createElement("div");r.id=n.id+"_"+q;r.style.position="absolute";r.style.zIndex=p.length+10;p.plugins[q]=g[o].getNewInstance(n,l.plugins[o],r);p.length++;if(typeof p.plugins[q].resize!="undefined"){n.onReady(s(p.plugins[q],r,true));n.onResize(s(p.plugins[q],r))}}}n.plugins=p.plugins;return m};this.load=function(){k=a.utils.loaderstatus.LOADING;d=true;for(var l in e){if(a.utils.exists(l)){g[l]=h.addPlugin(l);g[l].addEventListener(a.events.COMPLETE,j);g[l].addEventListener(a.events.ERROR,j)}}for(l in g){g[l].load()}d=false;j()};this.pluginFailed=function(){f()};this.getStatus=function(){return k}}})(jwplayer);(function(b){var a=[];b.api=function(d){this.container=d;this.id=d.id;var n={};var s={};var q={};var c=[];var h=undefined;var l=false;var j=[];var p=b.utils.getOuterHTML(d);var r={};var k={};this.getBuffer=function(){return this.callInternal("jwGetBuffer")};this.getContainer=function(){return this.container};function e(u,t){return function(z,v,w,x){if(this.renderingMode=="flash"||this.renderingMode=="html5"){var y;if(v){k[z]=v;y="jwplayer('"+u.id+"').callback('"+z+"')"}else{if(!v&&k[z]){delete k[z]}}h.jwDockSetButton(z,y,w,x)}return t}}this.getPlugin=function(t){var v=this;var u={};if(t=="dock"){return b.utils.extend(u,{setButton:e(v,u),show:function(){v.callInternal("jwDockShow");return u},hide:function(){v.callInternal("jwDockHide");return u},onShow:function(w){v.componentListener("dock",b.api.events.JWPLAYER_COMPONENT_SHOW,w);return u},onHide:function(w){v.componentListener("dock",b.api.events.JWPLAYER_COMPONENT_HIDE,w);return u}})}else{if(t=="controlbar"){return b.utils.extend(u,{show:function(){v.callInternal("jwControlbarShow");return u},hide:function(){v.callInternal("jwControlbarHide");return u},onShow:function(w){v.componentListener("controlbar",b.api.events.JWPLAYER_COMPONENT_SHOW,w);return u},onHide:function(w){v.componentListener("controlbar",b.api.events.JWPLAYER_COMPONENT_HIDE,w);return u}})}else{if(t=="display"){return b.utils.extend(u,{show:function(){v.callInternal("jwDisplayShow");return u},hide:function(){v.callInternal("jwDisplayHide");return u},onShow:function(w){v.componentListener("display",b.api.events.JWPLAYER_COMPONENT_SHOW,w);return u},onHide:function(w){v.componentListener("display",b.api.events.JWPLAYER_COMPONENT_HIDE,w);return u}})}else{return this.plugins[t]}}}};this.callback=function(t){if(k[t]){return k[t]()}};this.getDuration=function(){return this.callInternal("jwGetDuration")};this.getFullscreen=function(){return this.callInternal("jwGetFullscreen")};this.getHeight=function(){return this.callInternal("jwGetHeight")};this.getLockState=function(){return this.callInternal("jwGetLockState")};this.getMeta=function(){return this.getItemMeta()};this.getMute=function(){return this.callInternal("jwGetMute")};this.getPlaylist=function(){var u=this.callInternal("jwGetPlaylist");if(this.renderingMode=="flash"){b.utils.deepReplaceKeyName(u,"__dot__",".")}for(var t=0;t<u.length;t++){if(!b.utils.exists(u[t].index)){u[t].index=t}}return u};this.getPlaylistItem=function(t){if(!b.utils.exists(t)){t=this.getCurrentItem()}return this.getPlaylist()[t]};this.getPosition=function(){return this.callInternal("jwGetPosition")};this.getRenderingMode=function(){return this.renderingMode};this.getState=function(){return this.callInternal("jwGetState")};this.getVolume=function(){return this.callInternal("jwGetVolume")};this.getWidth=function(){return this.callInternal("jwGetWidth")};this.setFullscreen=function(t){if(!b.utils.exists(t)){this.callInternal("jwSetFullscreen",!this.callInternal("jwGetFullscreen"))}else{this.callInternal("jwSetFullscreen",t)}return this};this.setMute=function(t){if(!b.utils.exists(t)){this.callInternal("jwSetMute",!this.callInternal("jwGetMute"))}else{this.callInternal("jwSetMute",t)}return this};this.lock=function(){return this};this.unlock=function(){return this};this.load=function(t){this.callInternal("jwLoad",t);return this};this.playlistItem=function(t){this.callInternal("jwPlaylistItem",t);return this};this.playlistPrev=function(){this.callInternal("jwPlaylistPrev");return this};this.playlistNext=function(){this.callInternal("jwPlaylistNext");return this};this.resize=function(u,t){if(this.renderingMode=="html5"){h.jwResize(u,t)}else{this.container.width=u;this.container.height=t}return this};this.play=function(t){if(typeof t=="undefined"){t=this.getState();if(t==b.api.events.state.PLAYING||t==b.api.events.state.BUFFERING){this.callInternal("jwPause")}else{this.callInternal("jwPlay")}}else{this.callInternal("jwPlay",t)}return this};this.pause=function(t){if(typeof t=="undefined"){t=this.getState();if(t==b.api.events.state.PLAYING||t==b.api.events.state.BUFFERING){this.callInternal("jwPause")}else{this.callInternal("jwPlay")}}else{this.callInternal("jwPause",t)}return this};this.stop=function(){this.callInternal("jwStop");return this};this.seek=function(t){this.callInternal("jwSeek",t);return this};this.setVolume=function(t){this.callInternal("jwSetVolume",t);return this};this.onBufferChange=function(t){return this.eventListener(b.api.events.JWPLAYER_MEDIA_BUFFER,t)};this.onBufferFull=function(t){return this.eventListener(b.api.events.JWPLAYER_MEDIA_BUFFER_FULL,t)};this.onError=function(t){return this.eventListener(b.api.events.JWPLAYER_ERROR,t)};this.onFullscreen=function(t){return this.eventListener(b.api.events.JWPLAYER_FULLSCREEN,t)};this.onMeta=function(t){return this.eventListener(b.api.events.JWPLAYER_MEDIA_META,t)};this.onMute=function(t){return this.eventListener(b.api.events.JWPLAYER_MEDIA_MUTE,t)};this.onPlaylist=function(t){return this.eventListener(b.api.events.JWPLAYER_PLAYLIST_LOADED,t)};this.onPlaylistItem=function(t){return this.eventListener(b.api.events.JWPLAYER_PLAYLIST_ITEM,t)};this.onReady=function(t){return this.eventListener(b.api.events.API_READY,t)};this.onResize=function(t){return this.eventListener(b.api.events.JWPLAYER_RESIZE,t)};this.onComplete=function(t){return this.eventListener(b.api.events.JWPLAYER_MEDIA_COMPLETE,t)};this.onSeek=function(t){return this.eventListener(b.api.events.JWPLAYER_MEDIA_SEEK,t)};this.onTime=function(t){return this.eventListener(b.api.events.JWPLAYER_MEDIA_TIME,t)};this.onVolume=function(t){return this.eventListener(b.api.events.JWPLAYER_MEDIA_VOLUME,t)};this.onBuffer=function(t){return this.stateListener(b.api.events.state.BUFFERING,t)};this.onPause=function(t){return this.stateListener(b.api.events.state.PAUSED,t)};this.onPlay=function(t){return this.stateListener(b.api.events.state.PLAYING,t)};this.onIdle=function(t){return this.stateListener(b.api.events.state.IDLE,t)};this.remove=function(){n={};j=[];if(b.utils.getOuterHTML(this.container)!=p){b.api.destroyPlayer(this.id,p)}};this.setup=function(u){if(b.embed){var t=this.id;this.remove();var v=b(t);v.config=u;return new b.embed(v)}return this};this.registerPlugin=function(v,u,t){b.plugins.registerPlugin(v,u,t)};this.setPlayer=function(t,u){h=t;this.renderingMode=u};this.stateListener=function(t,u){if(!s[t]){s[t]=[];this.eventListener(b.api.events.JWPLAYER_PLAYER_STATE,g(t))}s[t].push(u);return this};function g(t){return function(v){var u=v.newstate,x=v.oldstate;if(u==t){var w=s[u];if(w){for(var y=0;y<w.length;y++){if(typeof w[y]=="function"){w[y].call(this,{oldstate:x,newstate:u})}}}}}}this.componentListener=function(t,u,v){if(!q[t]){q[t]={}}if(!q[t][u]){q[t][u]=[];this.eventListener(u,m(t,u))}q[t][u].push(v);return this};function m(t,u){return function(w){if(t==w.component){var v=q[t][u];if(v){for(var x=0;x<v.length;x++){if(typeof v[x]=="function"){v[x].call(this,w)}}}}}}this.addInternalListener=function(t,u){t.jwAddEventListener(u,'function(dat) { jwplayer("'+this.id+'").dispatchEvent("'+u+'", dat); }')};this.eventListener=function(t,u){if(!n[t]){n[t]=[];if(h&&l){this.addInternalListener(h,t)}}n[t].push(u);return this};this.dispatchEvent=function(v){if(n[v]){var u=f(v,arguments[1]);for(var t=0;t<n[v].length;t++){if(typeof n[v][t]=="function"){n[v][t].call(this,u)}}}};function f(v,t){var x=b.utils.extend({},t);if(v==b.api.events.JWPLAYER_FULLSCREEN&&!x.fullscreen){x.fullscreen=x.message=="true"?true:false;delete x.message}else{if(typeof x.data=="object"){x=b.utils.extend(x,x.data);delete x.data}}var u=["position","duration","offset"];for(var w in u){if(x[u[w]]){x[u[w]]=Math.round(x[u[w]]*1000)/1000}}return x}this.callInternal=function(u,t){if(l){if(typeof h!="undefined"&&typeof h[u]=="function"){if(b.utils.exists(t)){return(h[u])(t)}else{return(h[u])()}}return null}else{j.push({method:u,parameters:t})}};this.playerReady=function(v){l=true;if(!h){this.setPlayer(document.getElementById(v.id))}this.container=document.getElementById(this.id);for(var t in n){this.addInternalListener(h,t)}this.eventListener(b.api.events.JWPLAYER_PLAYLIST_ITEM,function(w){r={}});this.eventListener(b.api.events.JWPLAYER_MEDIA_META,function(w){b.utils.extend(r,w.metadata)});this.dispatchEvent(b.api.events.API_READY);while(j.length>0){var u=j.shift();this.callInternal(u.method,u.parameters)}};this.getItemMeta=function(){return r};this.getCurrentItem=function(){return this.callInternal("jwGetPlaylistIndex")};function o(v,x,w){var t=[];if(!x){x=0}if(!w){w=v.length-1}for(var u=x;u<=w;u++){t.push(v[u])}return t}return this};b.api.selectPlayer=function(d){var c;if(!b.utils.exists(d)){d=0}if(d.nodeType){c=d}else{if(typeof d=="string"){c=document.getElementById(d)}}if(c){var e=b.api.playerById(c.id);if(e){return e}else{return b.api.addPlayer(new b.api(c))}}else{if(typeof d=="number"){return b.getPlayers()[d]}}return null};b.api.events={API_READY:"jwplayerAPIReady",JWPLAYER_READY:"jwplayerReady",JWPLAYER_FULLSCREEN:"jwplayerFullscreen",JWPLAYER_RESIZE:"jwplayerResize",JWPLAYER_ERROR:"jwplayerError",JWPLAYER_COMPONENT_SHOW:"jwplayerComponentShow",JWPLAYER_COMPONENT_HIDE:"jwplayerComponentHide",JWPLAYER_MEDIA_BUFFER:"jwplayerMediaBuffer",JWPLAYER_MEDIA_BUFFER_FULL:"jwplayerMediaBufferFull",JWPLAYER_MEDIA_ERROR:"jwplayerMediaError",JWPLAYER_MEDIA_LOADED:"jwplayerMediaLoaded",JWPLAYER_MEDIA_COMPLETE:"jwplayerMediaComplete",JWPLAYER_MEDIA_SEEK:"jwplayerMediaSeek",JWPLAYER_MEDIA_TIME:"jwplayerMediaTime",JWPLAYER_MEDIA_VOLUME:"jwplayerMediaVolume",JWPLAYER_MEDIA_META:"jwplayerMediaMeta",JWPLAYER_MEDIA_MUTE:"jwplayerMediaMute",JWPLAYER_PLAYER_STATE:"jwplayerPlayerState",JWPLAYER_PLAYLIST_LOADED:"jwplayerPlaylistLoaded",JWPLAYER_PLAYLIST_ITEM:"jwplayerPlaylistItem"};b.api.events.state={BUFFERING:"BUFFERING",IDLE:"IDLE",PAUSED:"PAUSED",PLAYING:"PLAYING"};b.api.playerById=function(d){for(var c=0;c<a.length;c++){if(a[c].id==d){return a[c]}}return null};b.api.addPlayer=function(c){for(var d=0;d<a.length;d++){if(a[d]==c){return c}}a.push(c);return c};b.api.destroyPlayer=function(g,d){var f=-1;for(var j=0;j<a.length;j++){if(a[j].id==g){f=j;continue}}if(f>=0){var c=document.getElementById(a[f].id);if(document.getElementById(a[f].id+"_wrapper")){c=document.getElementById(a[f].id+"_wrapper")}if(c){if(d){b.utils.setOuterHTML(c,d)}else{var h=document.createElement("div");var e=c.id;if(c.id.indexOf("_wrapper")==c.id.length-8){newID=c.id.substring(0,c.id.length-8)}h.setAttribute("id",e);c.parentNode.replaceChild(h,c)}}a.splice(f,1)}return null};b.getPlayers=function(){return a.slice(0)}})(jwplayer);var _userPlayerReady=(typeof playerReady=="function")?playerReady:undefined;playerReady=function(b){var a=jwplayer.api.playerById(b.id);if(a){a.playerReady(b)}else{jwplayer.api.selectPlayer(b.id).playerReady(b)}if(_userPlayerReady){_userPlayerReady.call(this,b)}};(function(a){a.embed=function(g){var j={width:400,height:300,components:{controlbar:{position:"over"}}};var f=a.utils.mediaparser.parseMedia(g.container);var e=new a.embed.config(a.utils.extend(j,f,g.config),this);var h=a.plugins.loadPlugins(g.id,e.plugins);function c(m,l){for(var k in l){if(typeof m[k]=="function"){(m[k]).call(m,l[k])}}}function d(){if(h.getStatus()==a.utils.loaderstatus.COMPLETE){for(var m=0;m<e.modes.length;m++){if(e.modes[m].type&&a.embed[e.modes[m].type]){var k=e;if(e.modes[m].config){k=a.utils.extend(a.utils.clone(e),e.modes[m].config)}var l=new a.embed[e.modes[m].type](document.getElementById(g.id),e.modes[m],k,h,g);if(l.supportsConfig()){l.embed();c(g,e.events);return g}}}a.utils.log("No suitable players found");new a.embed.logo(a.utils.extend({hide:true},e.components.logo),"none",g.id)}}h.addEventListener(a.events.COMPLETE,d);h.addEventListener(a.events.ERROR,d);h.load();return g};function b(){if(!document.body){return setTimeout(b,15)}var c=a.utils.selectors.getElementsByTagAndClass("video","jwplayer");for(var d=0;d<c.length;d++){var e=c[d];a(e.id).setup({})}}b()})(jwplayer);(function(e){function h(){return[{type:"flash",src:"/jwplayer/player.swf"},{type:"html5"},{type:"download"}]}var a={players:"modes",autoplay:"autostart"};function b(n){var m=n.toLowerCase();var l=["left","right","top","bottom"];for(var k=0;k<l.length;k++){if(m==l[k]){return true}}return false}function c(l){var k=false;k=(l instanceof Array)||(typeof l=="object"&&!l.position&&!l.size);return k}function j(k){if(typeof k=="string"){if(parseInt(k).toString()==k||k.toLowerCase().indexOf("px")>-1){return parseInt(k)}}return k}var g=["playlist","dock","controlbar","logo","display"];function f(k){var n={};switch(e.utils.typeOf(k.plugins)){case"object":for(var m in k.plugins){n[e.utils.getPluginName(m)]=m}break;case"string":var o=k.plugins.split(",");for(var l=0;l<o.length;l++){n[e.utils.getPluginName(o[l])]=o[l]}break}return n}function d(o,n,m,k){if(e.utils.typeOf(o[n])!="object"){o[n]={}}var l=o[n][m];if(e.utils.typeOf(l)!="object"){o[n][m]=l={}}if(k){if(n=="plugins"){var p=e.utils.getPluginName(m);l[k]=o[p+"."+k];delete o[p+"."+k]}else{l[k]=o[m+"."+k];delete o[m+"."+k]}}}e.embed.deserialize=function(l){var m=f(l);for(var k in m){d(l,"plugins",m[k])}for(var p in l){if(p.indexOf(".")>-1){var o=p.split(".");var n=o[0];var p=o[1];if(e.utils.isInArray(g,n)){d(l,"components",n,p)}else{if(m[n]){d(l,"plugins",m[n],p)}}}}return l};e.embed.config=function(k,u){var t=e.utils.extend({},k);var r;if(c(t.playlist)){r=t.playlist;delete t.playlist}t=e.embed.deserialize(t);t.height=j(t.height);t.width=j(t.width);if(typeof t.plugins=="string"){var l=t.plugins.split(",");if(typeof t.plugins!="object"){t.plugins={}}for(var p=0;p<l.length;p++){var q=e.utils.getPluginName(l[p]);if(typeof t[q]=="object"){t.plugins[l[p]]=t[q];delete t[q]}else{t.plugins[l[p]]={}}}}for(var s=0;s<g.length;s++){var o=g[s];if(e.utils.exists(t[o])){if(typeof t[o]!="object"){if(!t.components[o]){t.components[o]={}}if(o=="logo"){t.components[o].file=t[o]}else{t.components[o].position=t[o]}delete t[o]}else{if(!t.components[o]){t.components[o]={}}e.utils.extend(t.components[o],t[o]);delete t[o]}}if(typeof t[o+"size"]!="undefined"){if(!t.components[o]){t.components[o]={}}t.components[o].size=t[o+"size"];delete t[o+"size"]}}if(typeof t.icons!="undefined"){if(!t.components.display){t.components.display={}}t.components.display.icons=t.icons;delete t.icons}for(var n in a){if(t[n]){if(!t[a[n]]){t[a[n]]=t[n]}delete t[n]}}var m;if(t.flashplayer&&!t.modes){m=h();m[0].src=t.flashplayer;delete t.flashplayer}else{if(t.modes){if(typeof t.modes=="string"){m=h();m[0].src=t.modes}else{if(t.modes instanceof Array){m=t.modes}else{if(typeof t.modes=="object"&&t.modes.type){m=[t.modes]}}}delete t.modes}else{m=h()}}t.modes=m;if(r){t.playlist=r}return t}})(jwplayer);(function(a){a.embed.download=function(c,g,b,d,f){this.embed=function(){var k=a.utils.extend({},b);var q={};var j=b.width?b.width:480;if(typeof j!="number"){j=parseInt(j,10)}var m=b.height?b.height:320;if(typeof m!="number"){m=parseInt(m,10)}var u,o,n;var s={};if(b.playlist&&b.playlist.length){s.file=b.playlist[0].file;o=b.playlist[0].image;s.levels=b.playlist[0].levels}else{s.file=b.file;o=b.image;s.levels=b.levels}if(s.file){u=s.file}else{if(s.levels&&s.levels.length){u=s.levels[0].file}}n=u?"pointer":"auto";var l={display:{style:{cursor:n,width:j,height:m,backgroundColor:"#000",position:"relative",textDecoration:"none",border:"none",display:"block"}},display_icon:{style:{cursor:n,position:"absolute",display:u?"block":"none",top:0,left:0,border:0,margin:0,padding:0,zIndex:3,width:50,height:50,backgroundImage:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAALdJREFUeNrs18ENgjAYhmFouDOCcQJGcARHgE10BDcgTOIosAGwQOuPwaQeuFRi2p/3Sb6EC5L3QCxZBgAAAOCorLW1zMn65TrlkH4NcV7QNcUQt7Gn7KIhxA+qNIR81spOGkL8oFJDyLJRdosqKDDkK+iX5+d7huzwM40xptMQMkjIOeRGo+VkEVvIPfTGIpKASfYIfT9iCHkHrBEzf4gcUQ56aEzuGK/mw0rHpy4AAACAf3kJMACBxjAQNRckhwAAAABJRU5ErkJggg==)"}},display_iconBackground:{style:{cursor:n,position:"absolute",display:u?"block":"none",top:((m-50)/2),left:((j-50)/2),border:0,width:50,height:50,margin:0,padding:0,zIndex:2,backgroundImage:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEpJREFUeNrszwENADAIA7DhX8ENoBMZ5KR10EryckCJiIiIiIiIiIiIiIiIiIiIiIh8GmkRERERERERERERERERERERERGRHSPAAPlXH1phYpYaAAAAAElFTkSuQmCC)"}},display_image:{style:{width:j,height:m,display:o?"block":"none",position:"absolute",cursor:n,left:0,top:0,margin:0,padding:0,textDecoration:"none",zIndex:1,border:"none"}}};var h=function(v,x,y){var w=document.createElement(v);if(y){w.id=y}else{w.id=c.id+"_jwplayer_"+x}a.utils.css(w,l[x].style);return w};q.display=h("a","display",c.id);if(u){q.display.setAttribute("href",a.utils.getAbsolutePath(u))}q.display_image=h("img","display_image");q.display_image.setAttribute("alt","Click to download...");if(o){q.display_image.setAttribute("src",a.utils.getAbsolutePath(o))}if(true){q.display_icon=h("div","display_icon");q.display_iconBackground=h("div","display_iconBackground");q.display.appendChild(q.display_image);q.display_iconBackground.appendChild(q.display_icon);q.display.appendChild(q.display_iconBackground)}_css=a.utils.css;_hide=function(v){_css(v,{display:"none"})};function r(v){_imageWidth=q.display_image.naturalWidth;_imageHeight=q.display_image.naturalHeight;t()}function t(){a.utils.stretch(a.utils.stretching.UNIFORM,q.display_image,j,m,_imageWidth,_imageHeight)}q.display_image.onerror=function(v){_hide(q.display_image)};q.display_image.onload=r;c.parentNode.replaceChild(q.display,c);var p=(b.plugins&&b.plugins.logo)?b.plugins.logo:{};q.display.appendChild(new a.embed.logo(b.components.logo,"download",c.id));f.container=document.getElementById(f.id);f.setPlayer(q.display,"download")};this.supportsConfig=function(){if(b){var j=a.utils.getFirstPlaylistItemFromConfig(b);if(typeof j.file=="undefined"&&typeof j.levels=="undefined"){return true}else{if(j.file){return e(j.file,j.provider,j.playlistfile)}else{if(j.levels&&j.levels.length){for(var h=0;h<j.levels.length;h++){if(j.levels[h].file&&e(j.levels[h].file,j.provider,j.playlistfile)){return true}}}}}}else{return true}};function e(j,l,h){if(h){return false}var k=["image","sound","youtube","http"];if(l&&(k.toString().indexOf(l)>-1)){return true}if(!l||(l&&l=="video")){var m=a.utils.extension(j);if(m&&a.utils.extensionmap[m]){return true}}return false}}})(jwplayer);(function(a){a.embed.flash=function(f,g,l,e,j){function m(o,n,p){var q=document.createElement("param");q.setAttribute("name",n);q.setAttribute("value",p);o.appendChild(q)}function k(o,p,n){return function(q){if(n){document.getElementById(j.id+"_wrapper").appendChild(p)}var s=document.getElementById(j.id).getPluginConfig("display");o.resize(s.width,s.height);var r={left:s.x,top:s.y};a.utils.css(p,r)}}function d(p){if(!p){return{}}var r={};for(var o in p){var n=p[o];for(var q in n){r[o+"."+q]=n[q]}}return r}function h(q,p){if(q[p]){var s=q[p];for(var o in s){var n=s[o];if(typeof n=="string"){if(!q[o]){q[o]=n}}else{for(var r in n){if(!q[o+"."+r]){q[o+"."+r]=n[r]}}}}delete q[p]}}function b(q){if(!q){return{}}var t={},s=[];for(var n in q){var p=a.utils.getPluginName(n);var o=q[n];s.push(n);for(var r in o){t[p+"."+r]=o[r]}}t.plugins=s.join(",");return t}function c(p){var n=p.netstreambasepath?"":"netstreambasepath="+encodeURIComponent(window.location.href.split("#")[0])+"&";for(var o in p){if(typeof(p[o])=="object"){n+=o+"="+encodeURIComponent("[[JSON]]"+a.utils.strings.jsonToString(p[o]))+"&"}else{n+=o+"="+encodeURIComponent(p[o])+"&"}}return n.substring(0,n.length-1)}this.embed=function(){l.id=j.id;var y;var q=a.utils.extend({},l);var n=q.width;var w=q.height;if(f.id+"_wrapper"==f.parentNode.id){y=document.getElementById(f.id+"_wrapper")}else{y=document.createElement("div");y.id=f.id+"_wrapper";a.utils.wrap(f,y);a.utils.css(y,{position:"relative",width:n,height:w})}var o=e.setupPlugins(j,q,k);if(o.length>0){a.utils.extend(q,b(o.plugins))}else{delete q.plugins}var r=["height","width","modes","events"];for(var u=0;u<r.length;u++){delete q[r[u]]}var p="opaque";if(q.wmode){p=q.wmode}h(q,"components");h(q,"providers");if(typeof q["dock.position"]!="undefined"){if(q["dock.position"].toString().toLowerCase()=="false"){q.dock=q["dock.position"];delete q["dock.position"]}}var x="#000000";var t;if(a.utils.isIE()){var v='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" bgcolor="'+x+'" width="100%" height="100%" id="'+f.id+'" name="'+f.id+'" tabindex=0"">';v+='<param name="movie" value="'+g.src+'">';v+='<param name="allowfullscreen" value="true">';v+='<param name="allowscriptaccess" value="always">';v+='<param name="seamlesstabbing" value="true">';v+='<param name="wmode" value="'+p+'">';v+='<param name="flashvars" value="'+c(q)+'">';v+="</object>";a.utils.setOuterHTML(f,v);t=document.getElementById(f.id)}else{var s=document.createElement("object");s.setAttribute("type","application/x-shockwave-flash");s.setAttribute("data",g.src);s.setAttribute("width","100%");s.setAttribute("height","100%");s.setAttribute("bgcolor","#000000");s.setAttribute("id",f.id);s.setAttribute("name",f.id);s.setAttribute("tabindex",0);m(s,"allowfullscreen","true");m(s,"allowscriptaccess","always");m(s,"seamlesstabbing","true");m(s,"wmode",p);m(s,"flashvars",c(q));f.parentNode.replaceChild(s,f);t=s}j.container=t;j.setPlayer(t,"flash")};this.supportsConfig=function(){if(a.utils.hasFlash()){if(l){var o=a.utils.getFirstPlaylistItemFromConfig(l);if(typeof o.file=="undefined"&&typeof o.levels=="undefined"){return true}else{if(o.file){return flashCanPlay(o.file,o.provider)}else{if(o.levels&&o.levels.length){for(var n=0;n<o.levels.length;n++){if(o.levels[n].file&&flashCanPlay(o.levels[n].file,o.provider)){return true}}}}}}else{return true}}return false};flashCanPlay=function(n,p){var o=["video","http","sound","image"];if(p&&(o.toString().indexOf(p<0))){return true}var q=a.utils.extension(n);if(!q){return true}if(a.utils.exists(a.utils.extensionmap[q])&&!a.utils.exists(a.utils.extensionmap[q].flash)){return false}return true}}})(jwplayer);(function(a){a.embed.html5=function(c,g,b,d,f){function e(j,k,h){return function(l){var m=document.getElementById(c.id+"_displayarea");if(h){m.appendChild(k)}var n=m.style;j.resize(parseInt(n.width.replace("px","")),parseInt(n.height.replace("px","")));k.left=n.left;k.top=n.top}}this.embed=function(){if(a.html5){d.setupPlugins(f,b,e);c.innerHTML="";var j=a.utils.extend({screencolor:"0x000000"},b);var h=["plugins","modes","events"];for(var k=0;k<h.length;k++){delete j[h[k]]}if(j.levels&&!j.sources){j.sources=b.levels}if(j.skin&&j.skin.toLowerCase().indexOf(".zip")>0){j.skin=j.skin.replace(/\.zip/i,".xml")}var l=new (a.html5(c)).setup(j);f.container=document.getElementById(f.id);f.setPlayer(l,"html5")}else{return null}};this.supportsConfig=function(){var h=document.createElement("video");if(!!h.canPlayType){if(b){var k=a.utils.getFirstPlaylistItemFromConfig(b);if(typeof k.file=="undefined"&&typeof k.levels=="undefined"){return true}else{if(k.file){return html5CanPlay(h,k.file,k.provider,k.playlistfile)}else{if(k.levels&&k.levels.length){for(var j=0;j<k.levels.length;j++){if(k.levels[j].file&&html5CanPlay(h,k.levels[j].file,k.provider,k.playlistfile)){return true}}}}}}else{return true}}return false};html5CanPlay=function(k,j,l,h){if(h){return false}if(l&&l=="youtube"){return true}if(l&&l!="video"&&l!="http"&&l!="sound"){return false}var m=a.utils.extension(j);if(!a.utils.exists(m)||!a.utils.exists(a.utils.extensionmap[m])){return true}if(!a.utils.exists(a.utils.extensionmap[m].html5)){return false}if(a.utils.isLegacyAndroid()&&m.match(/m4v|mp4/)){return true}return browserCanPlay(k,a.utils.extensionmap[m].html5)};browserCanPlay=function(j,h){if(!h){return true}if(j.canPlayType(h)){return true}else{if(h=="audio/mp3"&&navigator.userAgent.match(/safari/i)){return j.canPlayType("audio/mpeg")}else{return false}}}}})(jwplayer);(function(a){a.embed.logo=function(m,l,d){var j={prefix:"http://l.longtailvideo.com/"+l+"/",file:"logo.png",link:"http://www.longtailvideo.com/players/jw-flv-player/",margin:8,out:0.5,over:1,timeout:5,hide:false,position:"bottom-left"};_css=a.utils.css;var b;var h;k();function k(){o();c();f()}function o(){if(j.prefix){var q=a.version.split(/\W/).splice(0,2).join("/");if(j.prefix.indexOf(q)<0){j.prefix+=q+"/"}}h=a.utils.extend({},j)}function p(){var s={border:"none",textDecoration:"none",position:"absolute",cursor:"pointer",zIndex:10};s.display=h.hide?"none":"block";var r=h.position.toLowerCase().split("-");for(var q in r){s[r[q]]=h.margin}return s}function c(){b=document.createElement("img");b.id=d+"_jwplayer_logo";b.style.display="none";b.onload=function(q){_css(b,p());e()};if(!h.file){return}if(h.file.indexOf("http://")===0){b.src=h.file}else{b.src=h.prefix+h.file}}if(!h.file){return}function f(){if(h.link){b.onmouseover=g;b.onmouseout=e;b.onclick=n}else{this.mouseEnabled=false}}function n(q){if(typeof q!="undefined"){q.preventDefault();q.stopPropagation()}if(h.link){window.open(h.link,"_blank")}return}function e(q){if(h.link){b.style.opacity=h.out}return}function g(q){if(h.hide){b.style.opacity=h.over}return}return b}})(jwplayer);(function(a){a.html5=function(b){var c=b;this.setup=function(d){a.utils.extend(this,new a.html5.api(c,d));return this};return this}})(jwplayer);(function(b){var d=b.utils;var c=d.css;b.html5.view=function(r,q,f){var u=r;var n=q;var x=f;var w;var g;var C;var s;var D;var p;var A;function z(){w=document.createElement("div");w.id=n.id;w.className=n.className;_videowrapper=document.createElement("div");_videowrapper.id=w.id+"_video_wrapper";n.id=w.id+"_video";c(w,{position:"relative",height:x.height,width:x.width,padding:0,backgroundColor:E(),zIndex:0});function E(){if(u.skin.getComponentSettings("display")&&u.skin.getComponentSettings("display").backgroundcolor){return u.skin.getComponentSettings("display").backgroundcolor}return parseInt("000000",16)}c(n,{width:x.width,height:x.height,top:0,left:0,zIndex:1,margin:"auto",display:"block"});c(_videowrapper,{overflow:"hidden",position:"absolute",top:0,left:0,bottom:0,right:0});d.wrap(n,w);d.wrap(n,_videowrapper);s=document.createElement("div");s.id=w.id+"_displayarea";w.appendChild(s)}function k(){for(var E=0;E<x.plugins.order.length;E++){var F=x.plugins.order[E];if(d.exists(x.plugins.object[F].getDisplayElement)){x.plugins.object[F].height=d.parseDimension(x.plugins.object[F].getDisplayElement().style.height);x.plugins.object[F].width=d.parseDimension(x.plugins.object[F].getDisplayElement().style.width);x.plugins.config[F].currentPosition=x.plugins.config[F].position}}v()}function m(E){c(s,{display:x.getMedia().hasChrome()?"none":"block"})}function v(F){var H=x.getMedia()?x.getMedia().getDisplayElement():null;if(d.exists(H)){if(A!=H){if(A&&A.parentNode){A.parentNode.replaceChild(H,A)}A=H}for(var E=0;E<x.plugins.order.length;E++){var G=x.plugins.order[E];if(d.exists(x.plugins.object[G].getDisplayElement)){if(x.getMedia().hasChrome()){x.plugins.config[G].currentPosition=b.html5.view.positions.NONE}else{x.plugins.config[G].currentPosition=x.plugins.config[G].position}}}}j(x.width,x.height)}this.setup=function(){if(x&&x.getMedia()){n=x.getMedia().getDisplayElement()}z();k();u.jwAddEventListener(b.api.events.JWPLAYER_PLAYER_STATE,m);u.jwAddEventListener(b.api.events.JWPLAYER_MEDIA_LOADED,v);u.jwAddEventListener(b.api.events.JWPLAYER_MEDIA_META,function(){y()});var E;if(d.exists(window.onresize)){E=window.onresize}window.onresize=function(F){if(d.exists(E)){try{E(F)}catch(H){}}if(u.jwGetFullscreen()){var G=document.body.getBoundingClientRect();x.width=Math.abs(G.left)+Math.abs(G.right);x.height=window.innerHeight}j(x.width,x.height)}};function h(E){switch(E.keyCode){case 27:if(u.jwGetFullscreen()){u.jwSetFullscreen(false)}break;case 32:if(u.jwGetState()!=b.api.events.state.IDLE&&u.jwGetState()!=b.api.events.state.PAUSED){u.jwPause()}else{u.jwPlay()}break}}function j(H,E){if(w.style.display=="none"){return}var G=[].concat(x.plugins.order);G.reverse();D=G.length+2;if(!x.fullscreen){x.width=H;x.height=E;g=H;C=E;c(s,{top:0,bottom:0,left:0,right:0,width:H,height:E,position:"relative"});c(w,{height:C,width:g});var F=o(t,G);if(F.length>0){D+=F.length;var J=F.indexOf("playlist"),I=F.indexOf("controlbar");if(J>=0&&I>=0){F[J]=F.splice(I,1,F[J])[0]}o(l,F,true)}}else{if(navigator.vendor.indexOf("Apple")!==0){o(B,G,true)}}y()}function o(J,G,H){var F=[];for(var E=0;E<G.length;E++){var K=G[E];if(d.exists(x.plugins.object[K].getDisplayElement)){if(x.plugins.config[K].currentPosition!=b.html5.view.positions.NONE){var I=J(K,D--);if(!I){F.push(K)}else{x.plugins.object[K].resize(I.width,I.height);if(H){delete I.width;delete I.height}c(x.plugins.object[K].getDisplayElement(),I)}}else{c(x.plugins.object[K].getDisplayElement(),{display:"none"})}}}return F}function t(F,G){if(d.exists(x.plugins.object[F].getDisplayElement)){if(x.plugins.config[F].position&&a(x.plugins.config[F].position)){if(!d.exists(x.plugins.object[F].getDisplayElement().parentNode)){w.appendChild(x.plugins.object[F].getDisplayElement())}var E=e(F);E.zIndex=G;return E}}return false}function l(G,H){if(!d.exists(x.plugins.object[G].getDisplayElement().parentNode)){s.appendChild(x.plugins.object[G].getDisplayElement())}var E=x.width,F=x.height;if(typeof x.width=="string"&&x.width.lastIndexOf("%")>-1){percentage=parseFloat(x.width.substring(0,x.width.lastIndexOf("%")))/100;E=Math.round(window.innerWidth*percentage)}if(typeof x.height=="string"&&x.height.lastIndexOf("%")>-1){percentage=parseFloat(x.height.substring(0,x.height.lastIndexOf("%")))/100;F=Math.round(window.innerHeight*percentage)}return{position:"absolute",width:(E-d.parseDimension(s.style.left)-d.parseDimension(s.style.right)),height:(F-d.parseDimension(s.style.top)-d.parseDimension(s.style.bottom)),zIndex:H}}function B(E,F){return{position:"fixed",width:x.width,height:x.height,zIndex:F}}function y(){if(!d.exists(x.getMedia())){return}s.style.position="absolute";var G=x.getMedia().getDisplayElement();if(G&&G.tagName.toLowerCase()=="video"){G.style.position="absolute";var E,H;if(s.style.width.toString().lastIndexOf("%")>-1||s.style.width.toString().lastIndexOf("%")>-1){var F=s.getBoundingClientRect();E=Math.abs(F.left)+Math.abs(F.right);H=Math.abs(F.top)+Math.abs(F.bottom)}else{E=d.parseDimension(s.style.width);H=d.parseDimension(s.style.height)}if(G.parentNode){G.parentNode.style.left=s.style.left;G.parentNode.style.top=s.style.top}d.stretch(u.jwGetStretching(),G,E,H,G.videoWidth?G.videoWidth:400,G.videoHeight?G.videoHeight:300)}else{x.getMedia().resize(d.parseDimension(s.style.width),d.parseDimension(s.style.height))}}function e(F){var G={position:"absolute",margin:0,padding:0,top:null};var E=x.plugins.config[F].currentPosition.toLowerCase();switch(E.toUpperCase()){case b.html5.view.positions.TOP:G.top=d.parseDimension(s.style.top);G.left=d.parseDimension(s.style.left);G.width=g-d.parseDimension(s.style.left)-d.parseDimension(s.style.right);G.height=x.plugins.object[F].height;s.style[E]=d.parseDimension(s.style[E])+x.plugins.object[F].height+"px";s.style.height=d.parseDimension(s.style.height)-G.height+"px";break;case b.html5.view.positions.RIGHT:G.top=d.parseDimension(s.style.top);G.right=d.parseDimension(s.style.right);G.width=x.plugins.object[F].width;G.height=C-d.parseDimension(s.style.top)-d.parseDimension(s.style.bottom);s.style[E]=d.parseDimension(s.style[E])+x.plugins.object[F].width+"px";s.style.width=d.parseDimension(s.style.width)-G.width+"px";break;case b.html5.view.positions.BOTTOM:G.bottom=d.parseDimension(s.style.bottom);G.left=d.parseDimension(s.style.left);G.width=g-d.parseDimension(s.style.left)-d.parseDimension(s.style.right);G.height=x.plugins.object[F].height;s.style[E]=d.parseDimension(s.style[E])+x.plugins.object[F].height+"px";s.style.height=d.parseDimension(s.style.height)-G.height+"px";break;case b.html5.view.positions.LEFT:G.top=d.parseDimension(s.style.top);G.left=d.parseDimension(s.style.left);G.width=x.plugins.object[F].width;G.height=C-d.parseDimension(s.style.top)-d.parseDimension(s.style.bottom);s.style[E]=d.parseDimension(s.style[E])+x.plugins.object[F].width+"px";s.style.width=d.parseDimension(s.style.width)-G.width+"px";break;default:break}return G}this.resize=j;this.fullscreen=function(H){if(navigator&&navigator.vendor&&navigator.vendor.indexOf("Apple")===0){if(x.getMedia().getDisplayElement().webkitSupportsFullscreen){if(H){try{x.getMedia().getDisplayElement().webkitEnterFullscreen()}catch(G){}}else{try{x.getMedia().getDisplayElement().webkitExitFullscreen()}catch(G){}}}}else{if(H){document.onkeydown=h;clearInterval(p);var F=document.body.getBoundingClientRect();x.width=Math.abs(F.left)+Math.abs(F.right);x.height=window.innerHeight;var E={position:"fixed",width:"100%",height:"100%",top:0,left:0,zIndex:2147483000};c(w,E);E.zIndex=1;c(x.getMedia().getDisplayElement(),E);E.zIndex=2;c(s,E)}else{document.onkeydown="";x.width=g;x.height=C;c(w,{position:"relative",height:x.height,width:x.width,zIndex:0})}j(x.width,x.height)}}};function a(e){return([b.html5.view.positions.TOP,b.html5.view.positions.RIGHT,b.html5.view.positions.BOTTOM,b.html5.view.positions.LEFT].toString().indexOf(e.toUpperCase())>-1)}b.html5.view.positions={TOP:"TOP",RIGHT:"RIGHT",BOTTOM:"BOTTOM",LEFT:"LEFT",OVER:"OVER",NONE:"NONE"}})(jwplayer);(function(a){var b={backgroundcolor:"",margin:10,font:"Arial,sans-serif",fontsize:10,fontcolor:parseInt("000000",16),fontstyle:"normal",fontweight:"bold",buttoncolor:parseInt("ffffff",16),position:a.html5.view.positions.BOTTOM,idlehide:false,layout:{left:{position:"left",elements:[{name:"play",type:"button"},{name:"divider",type:"divider"},{name:"prev",type:"button"},{name:"divider",type:"divider"},{name:"next",type:"button"},{name:"divider",type:"divider"},{name:"elapsed",type:"text"}]},center:{position:"center",elements:[{name:"time",type:"slider"}]},right:{position:"right",elements:[{name:"duration",type:"text"},{name:"blank",type:"button"},{name:"divider",type:"divider"},{name:"mute",type:"button"},{name:"volume",type:"slider"},{name:"divider",type:"divider"},{name:"fullscreen",type:"button"}]}}};_utils=a.utils;_css=_utils.css;_hide=function(c){_css(c,{display:"none"})};_show=function(c){_css(c,{display:"block"})};a.html5.controlbar=function(l,V){var k=l;var D=_utils.extend({},b,k.skin.getComponentSettings("controlbar"),V);if(D.position==a.html5.view.positions.NONE||typeof a.html5.view.positions[D.position]=="undefined"){return}if(_utils.mapLength(k.skin.getComponentLayout("controlbar"))>0){D.layout=k.skin.getComponentLayout("controlbar")}var ac;var P;var ab;var E;var v="none";var g;var j;var ad;var f;var e;var y;var Q={};var p=false;var c={};var Y;var h=false;var o;var d;var S=false;var G=false;var W=new a.html5.eventdispatcher();_utils.extend(this,W);function J(){if(!Y){Y=k.skin.getSkinElement("controlbar","background");if(!Y){Y={width:0,height:0,src:null}}}return Y}function N(){ab=0;E=0;P=0;if(!p){var ak={height:J().height,backgroundColor:D.backgroundcolor};ac=document.createElement("div");ac.id=k.id+"_jwplayer_controlbar";_css(ac,ak)}var aj=(k.skin.getSkinElement("controlbar","capLeft"));var ai=(k.skin.getSkinElement("controlbar","capRight"));if(aj){x("capLeft","left",false,ac)}var al={position:"absolute",height:J().height,left:(aj?aj.width:0),zIndex:0};Z("background",ac,al,"img");if(J().src){Q.background.src=J().src}al.zIndex=1;Z("elements",ac,al);if(ai){x("capRight","right",false,ac)}}this.getDisplayElement=function(){return ac};this.resize=function(ak,ai){_utils.cancelAnimation(ac);document.getElementById(k.id).onmousemove=A;e=ak;y=ai;if(G!=k.jwGetFullscreen()){G=k.jwGetFullscreen();d=undefined}var aj=w();A();I({id:k.id,duration:ad,position:j});u({id:k.id,bufferPercent:f});return aj};this.show=function(){if(h){h=false;_show(ac);T()}};this.hide=function(){if(!h){h=true;_hide(ac);aa()}};function q(){var aj=["timeSlider","volumeSlider","timeSliderRail","volumeSliderRail"];for(var ak in aj){var ai=aj[ak];if(typeof Q[ai]!="undefined"){c[ai]=Q[ai].getBoundingClientRect()}}}function A(ai){if(h){return}if(D.position==a.html5.view.positions.OVER||k.jwGetFullscreen()){clearTimeout(o);switch(k.jwGetState()){case a.api.events.state.PAUSED:case a.api.events.state.IDLE:if(!D.idlehide||_utils.exists(ai)){U()}if(D.idlehide){o=setTimeout(function(){z()},2000)}break;default:if(ai){U()}o=setTimeout(function(){z()},2000);break}}}function z(ai){aa();_utils.cancelAnimation(ac);_utils.fadeTo(ac,0,0.1,1,0)}function U(){T();_utils.cancelAnimation(ac);_utils.fadeTo(ac,1,0,1,0)}function H(ai){return function(){if(S&&d!=ai){d=ai;W.sendEvent(ai,{component:"controlbar",boundingRect:O()})}}}var T=H(a.api.events.JWPLAYER_COMPONENT_SHOW);var aa=H(a.api.events.JWPLAYER_COMPONENT_HIDE);function O(){if(D.position==a.html5.view.positions.OVER||k.jwGetFullscreen()){return _utils.getDimensions(ac)}else{return{x:0,y:0,width:0,height:0}}}function Z(am,al,ak,ai){var aj;if(!p){if(!ai){ai="div"}aj=document.createElement(ai);Q[am]=aj;aj.id=ac.id+"_"+am;al.appendChild(aj)}else{aj=document.getElementById(ac.id+"_"+am)}if(_utils.exists(ak)){_css(aj,ak)}return aj}function M(){ah(D.layout.left);ah(D.layout.right,-1);ah(D.layout.center)}function ah(al,ai){var am=al.position=="right"?"right":"left";var ak=_utils.extend([],al.elements);if(_utils.exists(ai)){ak.reverse()}for(var aj=0;aj<ak.length;aj++){C(ak[aj],am)}}function K(){return P++}function C(am,ao){var al,aj,ak,ai,aq;if(am.type=="divider"){x("divider"+K(),ao,true,undefined,undefined,am.width,am.element);return}switch(am.name){case"play":x("playButton",ao,false);x("pauseButton",ao,true);R("playButton","jwPlay");R("pauseButton","jwPause");break;case"prev":x("prevButton",ao,true);R("prevButton","jwPlaylistPrev");break;case"stop":x("stopButton",ao,true);R("stopButton","jwStop");break;case"next":x("nextButton",ao,true);R("nextButton","jwPlaylistNext");break;case"elapsed":x("elapsedText",ao,true);break;case"time":aj=!_utils.exists(k.skin.getSkinElement("controlbar","timeSliderCapLeft"))?0:k.skin.getSkinElement("controlbar","timeSliderCapLeft").width;ak=!_utils.exists(k.skin.getSkinElement("controlbar","timeSliderCapRight"))?0:k.skin.getSkinElement("controlbar","timeSliderCapRight").width;al=ao=="left"?aj:ak;ai=k.skin.getSkinElement("controlbar","timeSliderRail").width+aj+ak;aq={height:J().height,position:"absolute",top:0,width:ai};aq[ao]=ao=="left"?ab:E;var an=Z("timeSlider",Q.elements,aq);x("timeSliderCapLeft",ao,true,an,ao=="left"?0:al);x("timeSliderRail",ao,false,an,al);x("timeSliderBuffer",ao,false,an,al);x("timeSliderProgress",ao,false,an,al);x("timeSliderThumb",ao,false,an,al);x("timeSliderCapRight",ao,true,an,ao=="right"?0:al);X("time");break;case"fullscreen":x("fullscreenButton",ao,false);x("normalscreenButton",ao,true);R("fullscreenButton","jwSetFullscreen",true);R("normalscreenButton","jwSetFullscreen",false);break;case"volume":aj=!_utils.exists(k.skin.getSkinElement("controlbar","volumeSliderCapLeft"))?0:k.skin.getSkinElement("controlbar","volumeSliderCapLeft").width;ak=!_utils.exists(k.skin.getSkinElement("controlbar","volumeSliderCapRight"))?0:k.skin.getSkinElement("controlbar","volumeSliderCapRight").width;al=ao=="left"?aj:ak;ai=k.skin.getSkinElement("controlbar","volumeSliderRail").width+aj+ak;aq={height:J().height,position:"absolute",top:0,width:ai};aq[ao]=ao=="left"?ab:E;var ap=Z("volumeSlider",Q.elements,aq);x("volumeSliderCapLeft",ao,true,ap,ao=="left"?0:al);x("volumeSliderRail",ao,true,ap,al);x("volumeSliderProgress",ao,false,ap,al);x("volumeSliderCapRight",ao,true,ap,ao=="right"?0:al);X("volume");break;case"mute":x("muteButton",ao,false);x("unmuteButton",ao,true);R("muteButton","jwSetMute",true);R("unmuteButton","jwSetMute",false);break;case"duration":x("durationText",ao,true);break}}function x(al,ao,aj,ar,am,ai,ak){if(_utils.exists(k.skin.getSkinElement("controlbar",al))||al.indexOf("Text")>0||al.indexOf("divider")===0){var an={height:J().height,position:"absolute",display:"block",top:0};if((al.indexOf("next")===0||al.indexOf("prev")===0)&&k.jwGetPlaylist().length<2){aj=false;an.display="none"}var at;if(al.indexOf("Text")>0){al.innerhtml="00:00";an.font=D.fontsize+"px/"+(J().height+1)+"px "+D.font;an.color=D.fontcolor;an.textAlign="center";an.fontWeight=D.fontweight;an.fontStyle=D.fontstyle;an.cursor="default";at=14+3*D.fontsize}else{if(al.indexOf("divider")===0){if(ai){if(!isNaN(parseInt(ai))){at=parseInt(ai)}}else{if(ak){var ap=k.skin.getSkinElement("controlbar",ak);if(ap){an.background="url("+ap.src+") repeat-x center left";at=ap.width}}else{an.background="url("+k.skin.getSkinElement("controlbar","divider").src+") repeat-x center left";at=k.skin.getSkinElement("controlbar","divider").width}}}else{an.background="url("+k.skin.getSkinElement("controlbar",al).src+") repeat-x center left";at=k.skin.getSkinElement("controlbar",al).width}}if(ao=="left"){an.left=isNaN(am)?ab:am;if(aj){ab+=at}}else{if(ao=="right"){an.right=isNaN(am)?E:am;if(aj){E+=at}}}if(_utils.typeOf(ar)=="undefined"){ar=Q.elements}an.width=at;if(p){_css(Q[al],an)}else{var aq=Z(al,ar,an);if(_utils.exists(k.skin.getSkinElement("controlbar",al+"Over"))){aq.onmouseover=function(au){aq.style.backgroundImage=["url(",k.skin.getSkinElement("controlbar",al+"Over").src,")"].join("")};aq.onmouseout=function(au){aq.style.backgroundImage=["url(",k.skin.getSkinElement("controlbar",al).src,")"].join("")}}}}}function F(){k.jwAddEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,B);k.jwAddEventListener(a.api.events.JWPLAYER_PLAYLIST_ITEM,s);k.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_BUFFER,u);k.jwAddEventListener(a.api.events.JWPLAYER_PLAYER_STATE,r);k.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_TIME,I);k.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_MUTE,ag);k.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_VOLUME,m);k.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_COMPLETE,L)}function B(){N();M();w();ae()}function s(ai){ad=k.jwGetPlaylist()[ai.index].duration;I({id:k.id,duration:ad,position:0});u({id:k.id,bufferProgress:0})}function ae(){I({id:k.id,duration:k.jwGetDuration(),position:0});u({id:k.id,bufferProgress:0});ag({id:k.id,mute:k.jwGetMute()});r({id:k.id,newstate:a.api.events.state.IDLE});m({id:k.id,volume:k.jwGetVolume()})}function R(ak,al,aj){if(p){return}if(_utils.exists(k.skin.getSkinElement("controlbar",ak))){var ai=Q[ak];if(_utils.exists(ai)){_css(ai,{cursor:"pointer"});if(al=="fullscreen"){ai.onmouseup=function(am){am.stopPropagation();k.jwSetFullscreen(!k.jwGetFullscreen())}}else{ai.onmouseup=function(am){am.stopPropagation();if(_utils.exists(aj)){k[al](aj)}else{k[al]()}}}}}}function X(ai){if(p){return}var aj=Q[ai+"Slider"];_css(Q.elements,{cursor:"pointer"});_css(aj,{cursor:"pointer"});aj.onmousedown=function(ak){v=ai};aj.onmouseup=function(ak){ak.stopPropagation();af(ak.pageX)};aj.onmousemove=function(ak){if(v=="time"){g=true;var al=ak.pageX-c[ai+"Slider"].left-window.pageXOffset;_css(Q.timeSliderThumb,{left:al})}}}function af(aj){g=false;var ai;if(v=="time"){ai=aj-c.timeSliderRail.left+window.pageXOffset;var al=ai/c.timeSliderRail.width*ad;if(al<0){al=0}else{if(al>ad){al=ad-3}}if(k.jwGetState()==a.api.events.state.PAUSED||k.jwGetState()==a.api.events.state.IDLE){k.jwPlay()}k.jwSeek(al)}else{if(v=="volume"){ai=aj-c.volumeSliderRail.left-window.pageXOffset;var ak=Math.round(ai/c.volumeSliderRail.width*100);if(ak<0){ak=0}else{if(ak>100){ak=100}}if(k.jwGetMute()){k.jwSetMute(false)}k.jwSetVolume(ak)}}v="none"}function u(aj){if(_utils.exists(aj.bufferPercent)){f=aj.bufferPercent}if(c.timeSliderRail){var ak=c.timeSliderRail.width;var ai=isNaN(Math.round(ak*f/100))?0:Math.round(ak*f/100);_css(Q.timeSliderBuffer,{width:ai})}}function ag(ai){if(ai.mute){_hide(Q.muteButton);_show(Q.unmuteButton);_hide(Q.volumeSliderProgress)}else{_show(Q.muteButton);_hide(Q.unmuteButton);_show(Q.volumeSliderProgress)}}function r(ai){if(ai.newstate==a.api.events.state.BUFFERING||ai.newstate==a.api.events.state.PLAYING){_show(Q.pauseButton);_hide(Q.playButton)}else{_hide(Q.pauseButton);_show(Q.playButton)}A();if(ai.newstate==a.api.events.state.IDLE){_hide(Q.timeSliderBuffer);_hide(Q.timeSliderProgress);_hide(Q.timeSliderThumb);I({id:k.id,duration:k.jwGetDuration(),position:0})}else{_show(Q.timeSliderBuffer);if(ai.newstate!=a.api.events.state.BUFFERING){_show(Q.timeSliderProgress);_show(Q.timeSliderThumb)}}}function L(ai){u({bufferPercent:0});I(_utils.extend(ai,{position:0,duration:ad}))}function I(al){if(_utils.exists(al.position)){j=al.position}if(_utils.exists(al.duration)){ad=al.duration}var aj=(j===ad===0)?0:j/ad;var am=c.timeSliderRail;if(am){var ai=isNaN(Math.round(am.width*aj))?0:Math.round(am.width*aj);var ak=ai;if(Q.timeSliderProgress){Q.timeSliderProgress.style.width=ai+"px";if(!g){if(Q.timeSliderThumb){Q.timeSliderThumb.style.left=ak+"px"}}}}if(Q.durationText){Q.durationText.innerHTML=_utils.timeFormat(ad)}if(Q.elapsedText){Q.elapsedText.innerHTML=_utils.timeFormat(j)}}function n(){var am,aj;var ak=document.getElementById(ac.id+"_elements");if(!ak){return}var al=ak.childNodes;for(var ai in ak.childNodes){if(isNaN(parseInt(ai,10))){continue}if(al[ai].id.indexOf(ac.id+"_divider")===0&&aj&&aj.id.indexOf(ac.id+"_divider")===0&&al[ai].style.backgroundImage==aj.style.backgroundImage){al[ai].style.display="none"}else{if(al[ai].id.indexOf(ac.id+"_divider")===0&&am&&am.style.display!="none"){al[ai].style.display="block"}}if(al[ai].style.display!="none"){aj=al[ai]}am=al[ai]}}function w(){n();if(k.jwGetFullscreen()){_show(Q.normalscreenButton);_hide(Q.fullscreenButton)}else{_hide(Q.normalscreenButton);_show(Q.fullscreenButton)}var aj={width:e};var ai={};if(D.position==a.html5.view.positions.OVER||k.jwGetFullscreen()){aj.left=D.margin;aj.width-=2*D.margin;aj.top=y-J().height-D.margin;aj.height=J().height}var al=k.skin.getSkinElement("controlbar","capLeft");var ak=k.skin.getSkinElement("controlbar","capRight");ai.left=al?al.width:0;ai.width=aj.width-ai.left-(ak?ak.width:0);var am=!_utils.exists(k.skin.getSkinElement("controlbar","timeSliderCapLeft"))?0:k.skin.getSkinElement("controlbar","timeSliderCapLeft").width;_css(Q.timeSliderRail,{width:(ai.width-ab-E),left:am});if(_utils.exists(Q.timeSliderCapRight)){_css(Q.timeSliderCapRight,{left:am+(ai.width-ab-E)})}_css(ac,aj);_css(Q.elements,ai);_css(Q.background,ai);q();return aj}function m(am){if(_utils.exists(Q.volumeSliderRail)){var ak=isNaN(am.volume/100)?1:am.volume/100;var al=_utils.parseDimension(Q.volumeSliderRail.style.width);var ai=isNaN(Math.round(al*ak))?0:Math.round(al*ak);var an=_utils.parseDimension(Q.volumeSliderRail.style.right);var aj=(!_utils.exists(k.skin.getSkinElement("controlbar","volumeSliderCapLeft")))?0:k.skin.getSkinElement("controlbar","volumeSliderCapLeft").width;_css(Q.volumeSliderProgress,{width:ai,left:aj});if(_utils.exists(Q.volumeSliderCapLeft)){_css(Q.volumeSliderCapLeft,{left:0})}}}function t(){N();M();q();p=true;F();D.idlehide=(D.idlehide.toString().toLowerCase()=="true");if(D.position==a.html5.view.positions.OVER&&D.idlehide){ac.style.opacity=0;S=true}else{setTimeout((function(){S=true;T()}),1)}ae()}t();return this}})(jwplayer);(function(b){var a=["width","height","state","playlist","item","position","buffer","duration","volume","mute","fullscreen"];var c=b.utils;b.html5.controller=function(z,w,h,v){var C=z;var G=h;var g=v;var o=w;var J=true;var e=-1;var A=c.exists(G.config.debug)&&(G.config.debug.toString().toLowerCase()=="console");var m=new b.html5.eventdispatcher(o.id,A);c.extend(this,m);var E=[];var d=false;function r(M){if(d){m.sendEvent(M.type,M)}else{E.push(M)}}function K(M){if(!d){f(G.item);m.sendEvent(b.api.events.JWPLAYER_READY,M);if(b.utils.exists(window.playerReady)){playerReady(M)}if(b.utils.exists(window[h.config.playerReady])){window[h.config.playerReady](M)}while(E.length>0){var O=E.shift();m.sendEvent(O.type,O)}if(h.config.autostart&&!b.utils.isIOS()){controller.item(h.item)}while(p.length>0){var N=p.shift();x(N.method,N.arguments)}d=true}}G.addGlobalListener(r);G.addEventListener(b.api.events.JWPLAYER_MEDIA_BUFFER_FULL,function(){G.getMedia().play()});G.addEventListener(b.api.events.JWPLAYER_MEDIA_TIME,function(M){if(M.position>=G.playlist[G.item].start&&e>=0){G.playlist[G.item].start=e;e=-1}});G.addEventListener(b.api.events.JWPLAYER_MEDIA_COMPLETE,function(M){setTimeout(s,25)});G.addEventListener(b.api.events.JWPLAYER_PLAYLIST_ITEM,function(M){f(G.item)});function u(){try{if(G.playlist[G.item].levels[0].file.length>0){if(J||G.state==b.api.events.state.IDLE){G.getMedia().load(G.playlist[G.item]);J=false}else{if(G.state==b.api.events.state.PAUSED){G.getMedia().play()}}}return true}catch(M){m.sendEvent(b.api.events.JWPLAYER_ERROR,M)}return false}function I(){try{if(G.playlist[G.item].levels[0].file.length>0){switch(G.state){case b.api.events.state.PLAYING:case b.api.events.state.BUFFERING:G.getMedia().pause();break}}return true}catch(M){m.sendEvent(b.api.events.JWPLAYER_ERROR,M)}return false}function D(M){try{if(G.playlist[G.item].levels[0].file.length>0){if(typeof M!="number"){M=parseFloat(M)}switch(G.state){case b.api.events.state.IDLE:if(e<0){e=G.playlist[G.item].start;G.playlist[G.item].start=M}u();break;case b.api.events.state.PLAYING:case b.api.events.state.PAUSED:case b.api.events.state.BUFFERING:G.seek(M);break}}return true}catch(N){m.sendEvent(b.api.events.JWPLAYER_ERROR,N)}return false}function n(M){if(!c.exists(M)){M=true}try{G.getMedia().stop(M);return true}catch(N){m.sendEvent(b.api.events.JWPLAYER_ERROR,N)}return false}function k(){try{if(G.playlist[G.item].levels[0].file.length>0){if(G.config.shuffle){f(y())}else{if(G.item+1==G.playlist.length){f(0)}else{f(G.item+1)}}}if(G.state!=b.api.events.state.IDLE){var N=G.state;G.state=b.api.events.state.IDLE;m.sendEvent(b.api.events.JWPLAYER_PLAYER_STATE,{oldstate:N,newstate:b.api.events.state.IDLE})}u();return true}catch(M){m.sendEvent(b.api.events.JWPLAYER_ERROR,M)}return false}function j(){try{if(G.playlist[G.item].levels[0].file.length>0){if(G.config.shuffle){f(y())}else{if(G.item===0){f(G.playlist.length-1)}else{f(G.item-1)}}}if(G.state!=b.api.events.state.IDLE){var N=G.state;G.state=b.api.events.state.IDLE;m.sendEvent(b.api.events.JWPLAYER_PLAYER_STATE,{oldstate:N,newstate:b.api.events.state.IDLE})}u();return true}catch(M){m.sendEvent(b.api.events.JWPLAYER_ERROR,M)}return false}function y(){var M=null;if(G.playlist.length>1){while(!c.exists(M)){M=Math.floor(Math.random()*G.playlist.length);if(M==G.item){M=null}}}else{M=0}return M}function t(N){if(!G.playlist||!G.playlist[N]){return false}try{if(G.playlist[N].levels[0].file.length>0){var O=G.state;if(O!==b.api.events.state.IDLE){if(G.playlist[G.item].provider==G.playlist[N].provider){n(false)}else{n()}}f(N);u()}return true}catch(M){m.sendEvent(b.api.events.JWPLAYER_ERROR,M)}return false}function f(M){if(!G.playlist[M]){return}G.setActiveMediaProvider(G.playlist[M]);if(G.item!=M){G.item=M;J=true;m.sendEvent(b.api.events.JWPLAYER_PLAYLIST_ITEM,{index:M})}}function H(N){try{switch(typeof(N)){case"number":G.getMedia().volume(N);break;case"string":G.getMedia().volume(parseInt(N,10));break}return true}catch(M){m.sendEvent(b.api.events.JWPLAYER_ERROR,M)}return false}function q(N){try{if(typeof N=="undefined"){G.getMedia().mute(!G.mute)}else{if(N.toString().toLowerCase()=="true"){G.getMedia().mute(true)}else{G.getMedia().mute(false)}}return true}catch(M){m.sendEvent(b.api.events.JWPLAYER_ERROR,M)}return false}function l(N,M){try{G.width=N;G.height=M;g.resize(N,M);m.sendEvent(b.api.events.JWPLAYER_RESIZE,{width:G.width,height:G.height});return true}catch(O){m.sendEvent(b.api.events.JWPLAYER_ERROR,O)}return false}function B(N){try{if(typeof N=="undefined"){G.fullscreen=!G.fullscreen;g.fullscreen(!G.fullscreen)}else{if(N.toString().toLowerCase()=="true"){G.fullscreen=true;g.fullscreen(true)}else{G.fullscreen=false;g.fullscreen(false)}}m.sendEvent(b.api.events.JWPLAYER_RESIZE,{width:G.width,height:G.height});m.sendEvent(b.api.events.JWPLAYER_FULLSCREEN,{fullscreen:N});return true}catch(M){m.sendEvent(b.api.events.JWPLAYER_ERROR,M)}return false}function L(M){try{n();G.loadPlaylist(M);f(G.item);return true}catch(N){m.sendEvent(b.api.events.JWPLAYER_ERROR,N)}return false}b.html5.controller.repeatoptions={LIST:"LIST",ALWAYS:"ALWAYS",SINGLE:"SINGLE",NONE:"NONE"};function s(){switch(G.config.repeat.toUpperCase()){case b.html5.controller.repeatoptions.SINGLE:u();break;case b.html5.controller.repeatoptions.ALWAYS:if(G.item==G.playlist.length-1&&!G.config.shuffle){t(0)}else{k()}break;case b.html5.controller.repeatoptions.LIST:if(G.item==G.playlist.length-1&&!G.config.shuffle){n();f(0)}else{k()}break;default:n();break}}var p=[];function F(M){return function(){if(d){x(M,arguments)}else{p.push({method:M,arguments:arguments})}}}function x(O,N){var M=[];for(i=0;i<N.length;i++){M.push(N[i])}O.apply(this,M)}this.play=F(u);this.pause=F(I);this.seek=F(D);this.stop=F(n);this.next=F(k);this.prev=F(j);this.item=F(t);this.setVolume=F(H);this.setMute=F(q);this.resize=F(l);this.setFullscreen=F(B);this.load=F(L);this.playerReady=K}})(jwplayer);(function(a){a.html5.defaultSkin=function(){this.text='<?xml version="1.0" ?><skin author="LongTail Video" name="Five" version="1.0"><settings><setting name="backcolor" value="0xFFFFFF"/><setting name="frontcolor" value="0x000000"/><setting name="lightcolor" value="0x000000"/><setting name="screencolor" value="0x000000"/></settings><components><component name="controlbar"><settings><setting name="margin" value="20"/><setting name="fontsize" value="11"/></settings><elements><element name="background" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFJJREFUeNrslLENwAAIwxLU/09j5AiOgD5hVQzNAVY8JK4qEfHMIKBnd2+BQlBINaiRtL/aV2rdzYBsM6CIONbI1NZENTr3RwdB2PlnJgJ6BRgA4hwu5Qg5iswAAAAASUVORK5CYII="/><element name="capLeft" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAYCAIAAAC0rgCNAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAD5JREFUeNosi8ENACAMAgnuv14H0Z8asI19XEjhOiKCMmibVgJTUt7V6fe9KXOtSQCfctJHu2q3/ot79hNgANc2OTz9uTCCAAAAAElFTkSuQmCC"/><element name="capRight" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAYCAIAAAC0rgCNAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAD5JREFUeNosi8ENACAMAgnuv14H0Z8asI19XEjhOiKCMmibVgJTUt7V6fe9KXOtSQCfctJHu2q3/ot79hNgANc2OTz9uTCCAAAAAElFTkSuQmCC"/><element name="divider" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAYCAIAAAC0rgCNAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAD5JREFUeNosi8ENACAMAgnuv14H0Z8asI19XEjhOiKCMmibVgJTUt7V6fe9KXOtSQCfctJHu2q3/ot79hNgANc2OTz9uTCCAAAAAElFTkSuQmCC"/><element name="playButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAYCAYAAAAVibZIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEhJREFUeNpiYqABYBo1dNRQ+hr6H4jvA3E8NS39j4SpZvh/LJig4YxEGEqy3kET+w+AOGFQRhTJhrEQkGcczfujhg4CQwECDADpTRWU/B3wHQAAAABJRU5ErkJggg=="/><element name="pauseButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAYCAYAAAAVibZIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAChJREFUeNpiYBgFo2DwA0YC8v/R1P4nRu+ooaOGUtnQUTAKhgIACDAAFCwQCfAJ4gwAAAAASUVORK5CYII="/><element name="prevButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAYCAYAAAAVibZIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEtJREFUeNpiYBgFo2Dog/9QDAPyQHweTYwiQ/2B+D0Wi8g2tB+JTdBQRiIMJVkvEy0iglhDF9Aq9uOpHVEwoE+NJDUKRsFgAAABBgDe2hqZcNNL0AAAAABJRU5ErkJggg=="/><element name="nextButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAYCAYAAAAVibZIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAElJREFUeNpiYBgFo2Dog/9AfB6I5dHE/lNqKAi/B2J/ahsKw/3EGMpIhKEk66WJoaR6fz61IyqemhEFSlL61ExSo2AUDAYAEGAAiG4hj+5t7M8AAAAASUVORK5CYII="/><element name="timeSliderRail" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADxJREFUeNpiYBgFo2AU0Bwwzluw+D8tLWARFhKiqQ9YuLg4aWsBGxs7bS1gZ6e5BWyjSX0UjIKhDgACDABlYQOGh5pYywAAAABJRU5ErkJggg=="/><element name="timeSliderBuffer" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAD1JREFUeNpiYBgFo2AU0Bww1jc0/aelBSz8/Pw09QELOzs7bS1gY2OjrQWsrKy09gHraFIfBaNgqAOAAAMAvy0DChXHsZMAAAAASUVORK5CYII="/><element name="timeSliderProgress" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAClJREFUeNpiYBgFo2AU0BwwAvF/WlrARGsfjFow8BaMglEwCugAAAIMAOHfAQunR+XzAAAAAElFTkSuQmCC"/><element name="timeSliderThumb" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAICAYAAAA870V8AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABZJREFUeNpiZICA/yCCiQEJUJcDEGAAY0gBD1/m7Q0AAAAASUVORK5CYII="/><element name="muteButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAYCAYAAADKx8xXAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiYBgFIw3MB+L/5Gj8j6yRiRTFyICJXHfTXyMLAXlGati4YDRFDj8AEGAABk8GSqqS4CoAAAAASUVORK5CYII="/><element name="unmuteButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAYCAYAAADKx8xXAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAD1JREFUeNpiYBgFgxz8p7bm+cQa+h8LHy7GhEcjIz4bmAjYykiun/8j0fakGPIfTfPgiSr6aB4FVAcAAQYAWdwR1G1Wd2gAAAAASUVORK5CYII="/><element name="volumeSliderRail" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAYCAYAAADkgu3FAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAGpJREFUeNpi/P//PwM9ABMDncCoRYPfIqqDZcuW1UPp/6AUDcNM1DQYKtRAlaAj1mCSLSLXYIIWUctgDItoZfDA5aOoqKhGEANIM9LVR7SymGDQUctikuOIXkFNdhHEOFrDjlpEd4sAAgwAriRMub95fu8AAAAASUVORK5CYII="/><element name="volumeSliderProgress" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAYCAYAAADkgu3FAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFtJREFUeNpi/P//PwM9ABMDncCoRYPfIlqAeij9H5SiYZiqBqPTlFqE02BKLSLaYFItIttgQhZRzWB8FjENiuRJ7aAbsMQwYMl7wDIsWUUQ42gNO2oR3S0CCDAAKhKq6MLLn8oAAAAASUVORK5CYII="/><element name="fullscreenButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAE5JREFUeNpiYBgFo2DQA0YC8v/xqP1PjDlMRDrEgUgxkgHIlfZoriVGjmzLsLFHAW2D6D8eA/9Tw7L/BAwgJE90PvhPpNgoGAVDEQAEGAAMdhTyXcPKcAAAAABJRU5ErkJggg=="/><element name="normalscreenButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEZJREFUeNpiYBgFo2DIg/9UUkOUAf8JiFFsyX88fJyAkcQgYMQjNkzBoAgiezyRbE+tFGSPxQJ7auYBmma0UTAKBhgABBgAJAEY6zON61sAAAAASUVORK5CYII="/></elements></component><component name="display"><elements><element name="background" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEpJREFUeNrszwENADAIA7DhX8ENoBMZ5KR10EryckCJiIiIiIiIiIiIiIiIiIiIiIh8GmkRERERERERERERERERERERERGRHSPAAPlXH1phYpYaAAAAAElFTkSuQmCC"/><element name="playIcon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAALdJREFUeNrs18ENgjAYhmFouDOCcQJGcARHgE10BDcgTOIosAGwQOuPwaQeuFRi2p/3Sb6EC5L3QCxZBgAAAOCorLW1zMn65TrlkH4NcV7QNcUQt7Gn7KIhxA+qNIR81spOGkL8oFJDyLJRdosqKDDkK+iX5+d7huzwM40xptMQMkjIOeRGo+VkEVvIPfTGIpKASfYIfT9iCHkHrBEzf4gcUQ56aEzuGK/mw0rHpy4AAACAf3kJMACBxjAQNRckhwAAAABJRU5ErkJggg=="/><element name="muteIcon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNrs1jEOgCAMBVAg7t5/8qaoIy4uoobyXsLCxA+0NCUAAADGUWvdQoQ41x4ixNBB2hBvBskdD3w5ZCkl3+33VqI0kjBBlh9rp+uTcyOP33TnolfsU85XX3yIRpQph8ZQY3wTZtU5AACASA4BBgDHoVuY1/fvOQAAAABJRU5ErkJggg=="/><element name="errorIcon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWlJREFUeNrsl+1twjAQhsHq/7BBYQLYIBmBDcoGMAIjtBPQTcII2SDtBDBBwrU6pGsUO7YbO470PtKJkz9iH++d4ywWAAAAAABgljRNsyWr2bZzDuJG1rLdZhcMbTjrBCGDyUKsqQLFciJb9bSvuG/WagRVRUVUI6gqy5HVeKWfSgRyJruKIU//TrZTSn2nmlaXThrloi/v9F2STC1W4+Aw5cBzkquRc09bofFNc6YLxEON0VUZS5FPTftO49vMjRsIF3RhOGr7/D/pJw+FKU+q0vDyq8W42jCunDqI3LC5XxNj2wHLU1XjaRnb0Lhykhqhhd8MtSF5J9tbjCv4mXGvKJz/65FF/qJryyaaIvzP2QRxZTX2nTuXjvV/VPFSwyLnW7mpH99yTh1FEVro6JBSd40/pMrRdV8vPtcKl28T2pT8TnFZ4yNosct3Q0io6JfBiz1FlGdqVQH3VHnepAEAAAAAADDzEGAAcTwB10jWgxcAAAAASUVORK5CYII="/><element name="bufferIcon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAuhJREFUeNrsWr9rU1EUznuNGqvFQh1ULOhiBx0KDtIuioO4pJuik3FxFfUPaAV1FTdx0Q5d2g4FFxehTnEpZHFoBy20tCIWtGq0TZP4HfkeHB5N8m6Sl/sa74XDybvv3vvOd8/Pe4lXrVZT3dD8VJc0B8QBcUAcEAfESktHGeR5XtMfqFQq/f92zPe/NbtGlKTdCY30kuxrpMGO94BlQCXs+rbh3ONgA6BlzP1p20d80gEI5hmA2A92Qua1Q2PtAFISM+bvjMG8U+Q7oA3rQGASwrYCU6WpNdLGYbA+Pq5jjXIiwi8EEa2UDbQSaKOIuV+SlkcCrfjY8XTI9EpKGwP0C2kru2hLtHqa4zoXtZRWyvi4CLwv9Opr6Hkn6A9HKgEANsQ1iqC3Ub/vRUk2JgmRkatK36kVrnt0qObunwUdUUMXMWYpakJsO5Am8tAw2GBIgwWA+G2S2dMpiw0gDioQRQJoKhRb1QiDwlHZUABYbaXWsm5ae6loTE4ZDxN4CZar8foVzOJ2iyZ2kWF3t7YIevffaMT5yJ70kQb2fQ1sE5SHr2wazs2wgMxgbsEKEAgxAvZUJbQLBGTSBMgNrncJbA6AljtS/eKDJ0Ez+DmrQEzXS2h1Ck25kAg0IZcUOaydCy4sYnN2fOA+2AP16gNoHALlQ+fwH7XO4CxLenUpgj4xr6ugY2roPMbMx+Xs18m/E8CVEIhxsNeg83XWOAN6grG3lGbk8uE5fr4B/WH3cJw+co/l9nTYsSGYCJ/lY5/qv0thn6nrIWmjeJcPSnWOeY++AkF8tpJHIMAUs/MaBBpj3znZfQo5psY+ZrG4gv5HickjEOymKjEeRpgyST6IuZcTcWbnjcgdPi5ghxciRKsl1lDSsgwA1i8fssonJgzmTSqfGUkCENndNdAL7PS6QQ7ZYISTo+1qq0LEWjTWcvY4isa4z+yfQB+7ooyHVg5RI7/i1Ijn/vnggDggDogD4oC00P4KMACd/juEHOrS4AAAAABJRU5ErkJggg=="/></elements></component><component name="dock"><elements><element name="button" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFBJREFUeNrs0cEJACAQA8Eofu0fu/W6EM5ZSAFDRpKTBs00CQQEBAQEBAQEBAQEBAQEBATkK8iqbY+AgICAgICAgICAgICAgICAgIC86QowAG5PAQzEJ0lKAAAAAElFTkSuQmCC"/></elements></component><component name="playlist"><elements><element name="item" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAIAAAC1nk4lAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHhJREFUeNrs2NEJwCAMBcBYuv/CFuIE9VN47WWCR7iocXR3pdWdGPqqwIoMjYfQeAiNh9B4JHc6MHQVHnjggQceeOCBBx77TifyeOY0iHi8DqIdEY8dD5cL094eePzINB5CO/LwcOTptNB4CP25L4TIbZzpU7UEGAA5wz1uF5rF9AAAAABJRU5ErkJggg=="/><element name="sliderRail" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAA8CAIAAADpFA0BAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADhJREFUeNrsy6ENACAMAMHClp2wYxZLAg5Fcu9e3OjuOKqqfTMzbs14CIZhGIZhGIZhGP4VLwEGAK/BBnVFpB0oAAAAAElFTkSuQmCC"/><element name="sliderThumb" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAA8CAIAAADpFA0BAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNrsy7ENACAMBLE8++8caFFKKiRffU53112SGs3ttOohGIZhGIZhGIZh+Fe8BRgAiaUGde6NOSEAAAAASUVORK5CYII="/></elements></component></components></skin>';this.xml=null;if(window.DOMParser){parser=new DOMParser();this.xml=parser.parseFromString(this.text,"text/xml")}else{this.xml=new ActiveXObject("Microsoft.XMLDOM");this.xml.async="false";this.xml.loadXML(this.text)}return this}})(jwplayer);(function(a){_utils=a.utils;_css=_utils.css;_hide=function(b){_css(b,{display:"none"})};_show=function(b){_css(b,{display:"block"})};a.html5.display=function(k,G){var j={icons:true,showmute:false};var Q=_utils.extend({},j,G);var h=k;var P={};var e;var u;var w;var N;var s;var I;var A;var J=!_utils.exists(h.skin.getComponentSettings("display").bufferrotation)?15:parseInt(h.skin.getComponentSettings("display").bufferrotation,10);var q=!_utils.exists(h.skin.getComponentSettings("display").bufferinterval)?100:parseInt(h.skin.getComponentSettings("display").bufferinterval,10);var z=-1;var t="";var K=true;var d;var g=false;var n=false;var H=new a.html5.eventdispatcher();_utils.extend(this,H);var D={display:{style:{cursor:"pointer",top:0,left:0,overflow:"hidden"},click:m},display_icon:{style:{cursor:"pointer",position:"absolute",top:((h.skin.getSkinElement("display","background").height-h.skin.getSkinElement("display","playIcon").height)/2),left:((h.skin.getSkinElement("display","background").width-h.skin.getSkinElement("display","playIcon").width)/2),border:0,margin:0,padding:0,zIndex:3,display:"none"}},display_iconBackground:{style:{cursor:"pointer",position:"absolute",top:((u-h.skin.getSkinElement("display","background").height)/2),left:((e-h.skin.getSkinElement("display","background").width)/2),border:0,backgroundImage:(["url(",h.skin.getSkinElement("display","background").src,")"]).join(""),width:h.skin.getSkinElement("display","background").width,height:h.skin.getSkinElement("display","background").height,margin:0,padding:0,zIndex:2,display:"none"}},display_image:{style:{display:"none",width:e,height:u,position:"absolute",cursor:"pointer",left:0,top:0,margin:0,padding:0,textDecoration:"none",zIndex:1}},display_text:{style:{zIndex:4,position:"relative",opacity:0.8,backgroundColor:parseInt("000000",16),color:parseInt("ffffff",16),textAlign:"center",fontFamily:"Arial,sans-serif",padding:"0 5px",fontSize:14}}};h.jwAddEventListener(a.api.events.JWPLAYER_PLAYER_STATE,p);h.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_MUTE,p);h.jwAddEventListener(a.api.events.JWPLAYER_PLAYLIST_ITEM,p);h.jwAddEventListener(a.api.events.JWPLAYER_ERROR,o);L();function L(){P.display=C("div","display");P.display_text=C("div","display_text");P.display.appendChild(P.display_text);P.display_image=C("img","display_image");P.display_image.onerror=function(R){_hide(P.display_image)};P.display_image.onload=y;P.display_icon=C("div","display_icon");P.display_iconBackground=C("div","display_iconBackground");P.display.appendChild(P.display_image);P.display_iconBackground.appendChild(P.display_icon);P.display.appendChild(P.display_iconBackground);f();setTimeout((function(){n=true;if(Q.icons.toString()=="true"){F()}}),1)}this.getDisplayElement=function(){return P.display};this.resize=function(S,R){_css(P.display,{width:S,height:R});_css(P.display_text,{width:(S-10),top:((R-P.display_text.getBoundingClientRect().height)/2)});_css(P.display_iconBackground,{top:((R-h.skin.getSkinElement("display","background").height)/2),left:((S-h.skin.getSkinElement("display","background").width)/2)});if(e!=S||u!=R){e=S;u=R;d=undefined;F()}c();p({})};this.show=function(){if(g){g=false;d=undefined;b()}};this.hide=function(){if(!g){d=undefined;B();g=true}};function y(R){w=P.display_image.naturalWidth;N=P.display_image.naturalHeight;c()}function c(){_utils.stretch(h.jwGetStretching(),P.display_image,e,u,w,N)}function C(R,T){var S=document.createElement(R);S.id=h.id+"_jwplayer_"+T;_css(S,D[T].style);return S}function f(){for(var R in P){if(_utils.exists(D[R].click)){P[R].onclick=D[R].click}}}function m(R){if(typeof R.preventDefault!="undefined"){R.preventDefault()}else{R.returnValue=false}if(h.jwGetState()!=a.api.events.state.PLAYING){h.jwPlay()}else{h.jwPause()}}function O(R){if(A){B();return}P.display_icon.style.backgroundImage=(["url(",h.skin.getSkinElement("display",R).src,")"]).join("");_css(P.display_icon,{width:h.skin.getSkinElement("display",R).width,height:h.skin.getSkinElement("display",R).height,top:(h.skin.getSkinElement("display","background").height-h.skin.getSkinElement("display",R).height)/2,left:(h.skin.getSkinElement("display","background").width-h.skin.getSkinElement("display",R).width)/2});b();if(_utils.exists(h.skin.getSkinElement("display",R+"Over"))){P.display_icon.onmouseover=function(S){P.display_icon.style.backgroundImage=["url(",h.skin.getSkinElement("display",R+"Over").src,")"].join("")};P.display_icon.onmouseout=function(S){P.display_icon.style.backgroundImage=["url(",h.skin.getSkinElement("display",R).src,")"].join("")}}else{P.display_icon.onmouseover=null;P.display_icon.onmouseout=null}}function B(){if(Q.icons.toString()=="true"){_hide(P.display_icon);_hide(P.display_iconBackground);M()}}function b(){if(!g&&Q.icons.toString()=="true"){_show(P.display_icon);_show(P.display_iconBackground);F()}}function o(R){A=true;B();P.display_text.innerHTML=R.error;_show(P.display_text);P.display_text.style.top=((u-P.display_text.getBoundingClientRect().height)/2)+"px"}function E(){P.display_image.style.display="none"}function p(R){if((R.type==a.api.events.JWPLAYER_PLAYER_STATE||R.type==a.api.events.JWPLAYER_PLAYLIST_ITEM)&&A){A=false;_hide(P.display_text)}var S=h.jwGetState();if(S==t){return}t=S;if(z>=0){clearTimeout(z)}if(K||h.jwGetState()==a.api.events.state.PLAYING||h.jwGetState()==a.api.events.state.PAUSED){r(h.jwGetState())}else{z=setTimeout(l(h.jwGetState()),500)}}function l(R){return(function(){r(R)})}function r(R){if(_utils.exists(I)){clearInterval(I);I=null;_utils.animations.rotate(P.display_icon,0)}switch(R){case a.api.events.state.BUFFERING:if(_utils.isIOS()){E();B()}else{if(h.jwGetPlaylist()[h.jwGetItem()].provider=="sound"){v()}s=0;I=setInterval(function(){s+=J;_utils.animations.rotate(P.display_icon,s%360)},q);O("bufferIcon");K=true}break;case a.api.events.state.PAUSED:if(!_utils.isIOS()){if(h.jwGetPlaylist()[h.jwGetItem()].provider!="sound"){_css(P.display_image,{background:"transparent no-repeat center center"})}O("playIcon");K=true}break;case a.api.events.state.IDLE:if(h.jwGetPlaylist()[h.jwGetItem()]&&h.jwGetPlaylist()[h.jwGetItem()].image){v()}else{E()}O("playIcon");K=true;break;default:if(h.jwGetPlaylist()[h.jwGetItem()]&&h.jwGetPlaylist()[h.jwGetItem()].provider=="sound"){if(_utils.isIOS()){E();K=false}else{v()}}else{E();K=false}if(h.jwGetMute()&&Q.showmute){O("muteIcon")}else{B()}break}z=-1}function v(){_css(P.display_image,{display:"block"});P.display_image.src=_utils.getAbsolutePath(h.jwGetPlaylist()[h.jwGetItem()].image)}function x(R){return function(){if(!n){return}if(!g&&d!=R){d=R;H.sendEvent(R,{component:"display",boundingRect:_utils.getDimensions(P.display_iconBackground)})}}}var F=x(a.api.events.JWPLAYER_COMPONENT_SHOW);var M=x(a.api.events.JWPLAYER_COMPONENT_HIDE);return this}})(jwplayer);(function(a){_css=a.utils.css;a.html5.dock=function(p,u){function q(){return{align:a.html5.view.positions.RIGHT}}var k=a.utils.extend({},q(),u);if(k.align=="FALSE"){return}var f={};var s=[];var g;var v;var d=false;var t=false;var e={x:0,y:0,width:0,height:0};var r;var j=new a.html5.eventdispatcher();_utils.extend(this,j);var m=document.createElement("div");m.id=p.id+"_jwplayer_dock";p.jwAddEventListener(a.api.events.JWPLAYER_PLAYER_STATE,l);this.getDisplayElement=function(){return m};this.setButton=function(A,x,y,z){if(!x&&f[A]){a.utils.arrays.remove(s,A);m.removeChild(f[A].div);delete f[A]}else{if(x){if(!f[A]){f[A]={}}f[A].handler=x;f[A].outGraphic=y;f[A].overGraphic=z;if(!f[A].div){s.push(A);f[A].div=document.createElement("div");f[A].div.style.position="relative";m.appendChild(f[A].div);f[A].div.appendChild(document.createElement("img"));f[A].div.childNodes[0].style.position="absolute";f[A].div.childNodes[0].style.left=0;f[A].div.childNodes[0].style.top=0;f[A].div.childNodes[0].style.zIndex=10;f[A].div.childNodes[0].style.cursor="pointer";f[A].div.appendChild(document.createElement("img"));f[A].div.childNodes[1].style.position="absolute";f[A].div.childNodes[1].style.left=0;f[A].div.childNodes[1].style.top=0;if(p.skin.getSkinElement("dock","button")){f[A].div.childNodes[1].src=p.skin.getSkinElement("dock","button").src}f[A].div.childNodes[1].style.zIndex=9;f[A].div.childNodes[1].style.cursor="pointer";f[A].div.onmouseover=function(){if(f[A].overGraphic){f[A].div.childNodes[0].src=f[A].overGraphic}if(p.skin.getSkinElement("dock","buttonOver")){f[A].div.childNodes[1].src=p.skin.getSkinElement("dock","buttonOver").src}};f[A].div.onmouseout=function(){if(f[A].outGraphic){f[A].div.childNodes[0].src=f[A].outGraphic}if(p.skin.getSkinElement("dock","button")){f[A].div.childNodes[1].src=p.skin.getSkinElement("dock","button").src}};if(f[A].overGraphic){f[A].div.childNodes[0].src=f[A].overGraphic}if(f[A].outGraphic){f[A].div.childNodes[0].src=f[A].outGraphic}if(p.skin.getSkinElement("dock","button")){f[A].div.childNodes[1].src=p.skin.getSkinElement("dock","button").src}}if(x){f[A].div.onclick=function(B){B.preventDefault();a(p.id).callback(A);if(f[A].overGraphic){f[A].div.childNodes[0].src=f[A].overGraphic}if(p.skin.getSkinElement("dock","button")){f[A].div.childNodes[1].src=p.skin.getSkinElement("dock","button").src}}}}}h(g,v)};function h(x,J){if(s.length>0){var y=10;var I=y;var F=-1;var G=p.skin.getSkinElement("dock","button").height;var E=p.skin.getSkinElement("dock","button").width;var C=x-E-y;var H,B;if(k.align==a.html5.view.positions.LEFT){F=1;C=y}for(var z=0;z<s.length;z++){var K=Math.floor(I/J);if((I+G+y)>((K+1)*J)){I=((K+1)*J)+y;K=Math.floor(I/J)}var A=f[s[z]].div;A.style.top=(I%J)+"px";A.style.left=(C+(p.skin.getSkinElement("dock","button").width+y)*K*F)+"px";var D={x:a.utils.parseDimension(A.style.left),y:a.utils.parseDimension(A.style.top),width:E,height:G};if(!H||(D.x<=H.x&&D.y<=H.y)){H=D}if(!B||(D.x>=B.x&&D.y>=B.y)){B=D}I+=p.skin.getSkinElement("dock","button").height+y}e={x:H.x,y:H.y,width:B.x-H.x+B.width,height:H.y-B.y+B.height}}if(t!=p.jwGetFullscreen()||g!=x||v!=J){g=x;v=J;t=p.jwGetFullscreen();r=undefined;setTimeout(n,1)}}function b(x){return function(){if(!d&&r!=x&&s.length>0){r=x;j.sendEvent(x,{component:"dock",boundingRect:e})}}}function l(x){if(a.utils.isIOS()){switch(x.newstate){case a.api.events.state.IDLE:o();break;default:c();break}}}var n=b(a.api.events.JWPLAYER_COMPONENT_SHOW);var w=b(a.api.events.JWPLAYER_COMPONENT_HIDE);this.resize=h;var o=function(){_css(m,{display:"block"});if(d){d=false;n()}};var c=function(){_css(m,{display:"none"});if(!d){w();d=true}};this.hide=c;this.show=o;return this}})(jwplayer);(function(a){a.html5.eventdispatcher=function(d,b){var c=new a.events.eventdispatcher(b);a.utils.extend(this,c);this.sendEvent=function(e,f){if(!a.utils.exists(f)){f={}}a.utils.extend(f,{id:d,version:a.version,type:e});c.sendEvent(e,f)}}})(jwplayer);(function(a){var b={prefix:"http://l.longtailvideo.com/html5/",file:"logo.png",link:"http://www.longtailvideo.com/players/jw-flv-player/",margin:8,out:0.5,over:1,timeout:5,hide:true,position:"bottom-left"};_css=a.utils.css;a.html5.logo=function(m,n){var s=m;var o;var j;var c;k();function k(){q();d();f()}function q(){if(b.prefix){var u=m.version.split(/\W/).splice(0,2).join("/");if(b.prefix.indexOf(u)<0){b.prefix+=u+"/"}}if(n.position==a.html5.view.positions.OVER){n.position=b.position}j=a.utils.extend({},b)}function d(){c=document.createElement("img");c.id=s.id+"_jwplayer_logo";c.style.display="none";c.onload=function(u){_css(c,r());s.jwAddEventListener(a.api.events.JWPLAYER_PLAYER_STATE,t);e()};if(!j.file){return}if(j.file.indexOf("http://")===0){c.src=j.file}else{c.src=j.prefix+j.file}}if(!j.file){return}this.resize=function(v,u){};this.getDisplayElement=function(){return c};function f(){if(j.link){c.onmouseover=h;c.onmouseout=e;c.onclick=p}else{this.mouseEnabled=false}}function p(u){if(typeof u!="undefined"){u.stopPropagation()}s.jwPause();s.jwSetFullscreen(false);if(j.link){window.open(j.link,"_top")}return}function e(u){if(j.link){c.style.opacity=j.out}return}function h(u){if(j.hide.toString()=="true"){c.style.opacity=j.over}return}function r(){var w={textDecoration:"none",position:"absolute",cursor:"pointer"};w.display=(j.hide.toString()=="true")?"none":"block";var v=j.position.toLowerCase().split("-");for(var u in v){w[v[u]]=j.margin}return w}function l(){if(j.hide.toString()=="true"){c.style.display="block";c.style.opacity=0;a.utils.fadeTo(c,j.out,0.1,parseFloat(c.style.opacity));o=setTimeout(function(){g()},j.timeout*1000)}}function g(){if(j.hide.toString()=="hide"){a.utils.fadeTo(c,0,0.1,parseFloat(c.style.opacity))}}function t(u){if(u.newstate==a.api.events.state.BUFFERING){clearTimeout(o);l()}}return this}})(jwplayer);(function(a){var c={ended:a.api.events.state.IDLE,playing:a.api.events.state.PLAYING,pause:a.api.events.state.PAUSED,buffering:a.api.events.state.BUFFERING};var e=a.utils;var b=e.css;var d=e.isIOS();a.html5.mediavideo=function(h,s){var r={abort:n,canplay:k,canplaythrough:k,durationchange:G,emptied:n,ended:k,error:u,loadeddata:G,loadedmetadata:G,loadstart:k,pause:k,play:D,playing:k,progress:v,ratechange:n,seeked:k,seeking:k,stalled:k,suspend:k,timeupdate:D,volumechange:n,waiting:k,canshowcurrentframe:n,dataunavailable:n,empty:n,load:z,loadedfirstframe:n};var j=new a.html5.eventdispatcher();e.extend(this,j);var y=h,l=s,m,B,A,x,f,H=false,C,p,q;o();this.load=function(J,K){if(typeof K=="undefined"){K=true}x=J;e.empty(m);q=0;if(J.levels&&J.levels.length>0){if(J.levels.length==1){m.src=J.levels[0].file}else{if(m.src){m.removeAttribute("src")}for(var I=0;I<J.levels.length;I++){var L=m.ownerDocument.createElement("source");L.src=J.levels[I].file;m.appendChild(L);q++}}}else{m.src=J.file}if(d){if(J.image){m.poster=J.image}m.controls="controls"}C=p=A=false;y.buffer=0;if(!e.exists(J.start)){J.start=0}y.duration=J.duration;j.sendEvent(a.api.events.JWPLAYER_MEDIA_LOADED);if((!d&&J.levels.length==1)||!H){m.load()}H=false;if(K){E(a.api.events.state.BUFFERING);j.sendEvent(a.api.events.JWPLAYER_MEDIA_BUFFER,{bufferPercent:0});this.play()}};this.play=function(){if(B!=a.api.events.state.PLAYING){t();m.play();if(p){E(a.api.events.state.PLAYING)}else{E(a.api.events.state.BUFFERING)}}};this.pause=function(){m.pause();E(a.api.events.state.PAUSED)};this.seek=function(I){if(!(y.duration<=0||isNaN(y.duration))&&!(y.position<=0||isNaN(y.position))){m.currentTime=I;m.play()}};_stop=this.stop=function(I){if(!e.exists(I)){I=true}g();if(I){m.style.display="none";p=false;var J=navigator.userAgent;if(J.match(/chrome/i)){m.src=undefined}else{if(J.match(/safari/i)){m.removeAttribute("src")}else{m.src=""}}m.removeAttribute("controls");m.removeAttribute("poster");e.empty(m);m.load();H=true;if(m.webkitSupportsFullscreen){try{m.webkitExitFullscreen()}catch(K){}}}E(a.api.events.state.IDLE)};this.fullscreen=function(I){if(I===true){this.resize("100%","100%")}else{this.resize(y.config.width,y.config.height)}};this.resize=function(J,I){if(false){b(l,{width:J,height:I})}j.sendEvent(a.api.events.JWPLAYER_MEDIA_RESIZE,{fullscreen:y.fullscreen,width:J,hieght:I})};this.volume=function(I){if(!d){m.volume=I/100;y.volume=I;j.sendEvent(a.api.events.JWPLAYER_MEDIA_VOLUME,{volume:Math.round(I)})}};this.mute=function(I){if(!d){m.muted=I;y.mute=I;j.sendEvent(a.api.events.JWPLAYER_MEDIA_MUTE,{mute:I})}};this.getDisplayElement=function(){return m};this.hasChrome=function(){return false};function o(){m=document.createElement("video");B=a.api.events.state.IDLE;for(var I in r){m.addEventListener(I,function(J){if(e.exists(J.target.parentNode)){r[J.type](J)}},true)}if(l.parentNode){l.parentNode.replaceChild(m,l)}if(!m.id){m.id=l.id}}function E(I){if(I==a.api.events.state.PAUSED&&B==a.api.events.state.IDLE){return}if(B!=I){var J=B;y.state=B=I;j.sendEvent(a.api.events.JWPLAYER_PLAYER_STATE,{oldstate:J,newstate:I})}}function n(I){}function v(K){var J;if(e.exists(K)&&K.lengthComputable&&K.total){J=K.loaded/K.total*100}else{if(e.exists(m.buffered)&&(m.buffered.length>0)){var I=m.buffered.length-1;if(I>=0){J=m.buffered.end(I)/m.duration*100}}}if(p===false&&B==a.api.events.state.BUFFERING){j.sendEvent(a.api.events.JWPLAYER_MEDIA_BUFFER_FULL);p=true}if(!C){if(J==100){C=true}if(e.exists(J)&&(J>y.buffer)){y.buffer=Math.round(J);j.sendEvent(a.api.events.JWPLAYER_MEDIA_BUFFER,{bufferPercent:Math.round(J)})}}}function D(J){if(e.exists(J)&&e.exists(J.target)){if(y.duration<=0||isNaN(y.duration)){y.duration=Math.round(J.target.duration*10)/10}if(!A&&m.readyState>0){m.style.display="block";E(a.api.events.state.PLAYING)}if(B==a.api.events.state.PLAYING){if(!A&&m.readyState>0){A=true;try{if(m.currentTime<x.start){m.currentTime=x.start}}catch(I){}m.volume=y.volume/100;m.muted=y.mute}y.position=Math.round(J.target.currentTime*10)/10;j.sendEvent(a.api.events.JWPLAYER_MEDIA_TIME,{position:J.target.currentTime,duration:y.duration});if(y.position>=y.duration&&(y.position>0||y.duration>0)){w()}}}v(J)}function z(I){}function k(I){if(c[I.type]){if(I.type=="ended"){w()}else{E(c[I.type])}}}function G(I){var J={height:I.target.videoHeight,width:I.target.videoWidth,duration:Math.round(I.target.duration*10)/10};if(y.duration===0||isNaN(y.duration)){y.duration=Math.round(I.target.duration*10)/10}j.sendEvent(a.api.events.JWPLAYER_MEDIA_META,{metadata:J})}function u(K){if(B==a.api.events.state.IDLE){return}var J="There was an error: ";if((K.target.error&&K.target.tagName.toLowerCase()=="video")||K.target.parentNode.error&&K.target.parentNode.tagName.toLowerCase()=="video"){var I=!e.exists(K.target.error)?K.target.parentNode.error:K.target.error;switch(I.code){case I.MEDIA_ERR_ABORTED:J="You aborted the video playback: ";break;case I.MEDIA_ERR_NETWORK:J="A network error caused the video download to fail part-way: ";break;case I.MEDIA_ERR_DECODE:J="The video playback was aborted due to a corruption problem or because the video used features your browser did not support: ";break;case I.MEDIA_ERR_SRC_NOT_SUPPORTED:J="The video could not be loaded, either because the server or network failed or because the format is not supported: ";break;default:J="An unknown error occurred: ";break}}else{if(K.target.tagName.toLowerCase()=="source"){q--;if(q>0){return}J="The video could not be loaded, either because the server or network failed or because the format is not supported: "}else{e.log("An unknown error occurred.  Continuing...");return}}_stop(false);J+=F();_error=true;j.sendEvent(a.api.events.JWPLAYER_ERROR,{error:J});return}function F(){var K="";for(var J in x.levels){var I=x.levels[J];var L=l.ownerDocument.createElement("source");K+=a.utils.getAbsolutePath(I.file);if(J<(x.levels.length-1)){K+=", "}}return K}function t(){if(!e.exists(f)){f=setInterval(function(){v()},100)}}function g(){clearInterval(f);f=null}function w(){if(B!=a.api.events.state.IDLE){_stop(false);j.sendEvent(a.api.events.JWPLAYER_MEDIA_COMPLETE)}}}})(jwplayer);(function(a){var c={ended:a.api.events.state.IDLE,playing:a.api.events.state.PLAYING,pause:a.api.events.state.PAUSED,buffering:a.api.events.state.BUFFERING};var b=a.utils.css;a.html5.mediayoutube=function(j,e){var f=new a.html5.eventdispatcher();a.utils.extend(this,f);var l=j;var h=document.getElementById(e.id);var g=a.api.events.state.IDLE;var o,n;m();function k(q){if(g!=q){var r=g;l.state=q;g=q;f.sendEvent(a.api.events.JWPLAYER_PLAYER_STATE,{oldstate:r,newstate:q})}}this.getDisplayElement=function(){return h};this.play=function(){if(g==a.api.events.state.IDLE){f.sendEvent(a.api.events.JWPLAYER_MEDIA_BUFFER,{bufferPercent:100});f.sendEvent(a.api.events.JWPLAYER_MEDIA_BUFFER_FULL);k(a.api.events.state.PLAYING)}else{if(g==a.api.events.state.PAUSED){k(a.api.events.state.PLAYING)}}};this.pause=function(){k(a.api.events.state.PAUSED)};this.seek=function(q){};this.stop=function(q){if(!_utils.exists(q)){q=true}l.position=0;k(a.api.events.state.IDLE);if(q){b(o,{display:"none"})}};this.volume=function(q){l.volume=q;f.sendEvent(a.api.events.JWPLAYER_MEDIA_VOLUME,{volume:Math.round(q)})};this.mute=function(q){h.muted=q;l.mute=q;f.sendEvent(a.api.events.JWPLAYER_MEDIA_MUTE,{mute:q})};this.resize=function(r,q){if(r*q>0){o.width=n.width=r;o.height=n.height=q}f.sendEvent(a.api.events.JWPLAYER_MEDIA_RESIZE,{fullscreen:l.fullscreen,width:r,height:q})};this.fullscreen=function(q){if(q===true){this.resize("100%","100%")}else{this.resize(l.config.width,l.config.height)}};this.load=function(q){b(o,{display:"block"});p(q);k(a.api.events.state.BUFFERING);f.sendEvent(a.api.events.JWPLAYER_MEDIA_BUFFER,{bufferPercent:0});f.sendEvent(a.api.events.JWPLAYER_MEDIA_LOADED);this.play()};this.hasChrome=function(){return(g!=a.api.events.state.IDLE)};function p(w){var t=w.levels[0].file;t=["http://www.youtube.com/v/",d(t),"&amp;hl=en_US&amp;fs=1&autoplay=1"].join("");var v={movie:t,allowfullscreen:"true",allowscriptaccess:"always"};o.innerHTML="";for(var q in v){var u=document.createElement("param");u.name=q;u.value=v[q];o.appendChild(u)}var r={src:t,type:"application/x-shockwave-flash",allowfullscreen:"true",allowscriptaccess:"always",width:o.width,height:o.height};for(var s in r){n.setAttribute(s,r[s])}o.appendChild(n);o.style.zIndex=2147483000}function m(){o=document.createElement("object");o.id=h.id;o.style.position="absolute";o.width=l.config.width;o.height=l.config.height;if(h.parentNode){h.parentNode.replaceChild(o,h)}h=o;n=document.createElement("embed");o.appendChild(n);if(a.utils.isIOS()&&l.playlist&&l.playlist[l.item]){p(l.playlist[l.item])}}function d(r){var q=r.split(/\?|\#\!/);var t="";for(var s=0;s<q.length;s++){if(q[s].substr(0,2)=="v="){t=q[s].substr(2)}}if(t==""){if(r.indexOf("/v/")>=0){t=r.substr(r.indexOf("/v/")+3)}else{if(r.indexOf("youtu.be")>=0){t=r.substr(r.indexOf("youtu.be/")+9)}else{t=r}}}if(t.indexOf("?")>-1){t=t.substr(0,t.indexOf("?"))}if(t.indexOf("&")>-1){t=t.substr(0,t.indexOf("&"))}return t}this.embed=n;return this}})(jwplayer);(function(jwplayer){var _configurableStateVariables=["width","height","start","duration","volume","mute","fullscreen","item","plugins","stretching"];jwplayer.html5.model=function(api,container,options){var _api=api;var _container=container;var _model={id:_container.id,playlist:[],state:jwplayer.api.events.state.IDLE,position:0,buffer:0,config:{width:480,height:320,item:-1,skin:undefined,file:undefined,image:undefined,start:0,duration:0,bufferlength:5,volume:90,mute:false,fullscreen:false,repeat:"",stretching:jwplayer.utils.stretching.UNIFORM,autostart:false,debug:undefined,screencolor:undefined}};var _media;var _eventDispatcher=new jwplayer.html5.eventdispatcher();var _components=["display","logo","controlbar","playlist","dock"];jwplayer.utils.extend(_model,_eventDispatcher);for(var option in options){if(typeof options[option]=="string"){var type=/color$/.test(option)?"color":null;options[option]=jwplayer.utils.typechecker(options[option],type)}var config=_model.config;var path=option.split(".");for(var edge in path){if(edge==path.length-1){config[path[edge]]=options[option]}else{if(!jwplayer.utils.exists(config[path[edge]])){config[path[edge]]={}}config=config[path[edge]]}}}for(var index in _configurableStateVariables){var configurableStateVariable=_configurableStateVariables[index];_model[configurableStateVariable]=_model.config[configurableStateVariable]}var pluginorder=_components.concat([]);if(jwplayer.utils.exists(_model.plugins)){if(typeof _model.plugins=="string"){var userplugins=_model.plugins.split(",");for(var userplugin in userplugins){if(typeof userplugins[userplugin]=="string"){pluginorder.push(userplugins[userplugin].replace(/^\s+|\s+$/g,""))}}}}if(typeof _model.config.chromeless=="undefined"&&jwplayer.utils.isIPod()){_model.config.chromeless=true}if(jwplayer.utils.isIPad()){pluginorder=["display","logo","dock","playlist"];if(!jwplayer.utils.exists(_model.config.repeat)){_model.config.repeat="list"}}else{if(_model.config.chromeless){pluginorder=["logo","playlist"];if(!jwplayer.utils.exists(_model.config.repeat)){_model.config.repeat="list"}}}_model.plugins={order:pluginorder,config:{},object:{}};if(typeof _model.config.components!="undefined"){for(var component in _model.config.components){_model.plugins.config[component]=_model.config.components[component]}}for(var pluginIndex in _model.plugins.order){var pluginName=_model.plugins.order[pluginIndex];var pluginConfig=!jwplayer.utils.exists(_model.plugins.config[pluginName])?{}:_model.plugins.config[pluginName];_model.plugins.config[pluginName]=!jwplayer.utils.exists(_model.plugins.config[pluginName])?pluginConfig:jwplayer.utils.extend(_model.plugins.config[pluginName],pluginConfig);if(!jwplayer.utils.exists(_model.plugins.config[pluginName].position)){if(pluginName=="playlist"){_model.plugins.config[pluginName].position=jwplayer.html5.view.positions.NONE}else{_model.plugins.config[pluginName].position=jwplayer.html5.view.positions.OVER}}else{_model.plugins.config[pluginName].position=_model.plugins.config[pluginName].position.toString().toUpperCase()}}if(typeof _model.plugins.config.dock!="undefined"){if(typeof _model.plugins.config.dock!="object"){var position=_model.plugins.config.dock.toString().toUpperCase();_model.plugins.config.dock={position:position}}if(typeof _model.plugins.config.dock.position!="undefined"){_model.plugins.config.dock.align=_model.plugins.config.dock.position;_model.plugins.config.dock.position=jwplayer.html5.view.positions.OVER}}function _loadExternal(playlistfile){var loader=new jwplayer.html5.playlistloader();loader.addEventListener(jwplayer.api.events.JWPLAYER_PLAYLIST_LOADED,function(evt){_model.playlist=new jwplayer.html5.playlist(evt);_loadComplete(true)});loader.addEventListener(jwplayer.api.events.JWPLAYER_ERROR,function(evt){_model.playlist=new jwplayer.html5.playlist({playlist:[]});_loadComplete(false)});loader.load(playlistfile)}function _loadComplete(){if(_model.config.shuffle){_model.item=_getShuffleItem()}else{if(_model.config.item>=_model.playlist.length){_model.config.item=_model.playlist.length-1}else{if(_model.config.item<0){_model.config.item=0}}_model.item=_model.config.item}_eventDispatcher.sendEvent(jwplayer.api.events.JWPLAYER_PLAYLIST_LOADED,{playlist:_model.playlist});_eventDispatcher.sendEvent(jwplayer.api.events.JWPLAYER_PLAYLIST_ITEM,{index:_model.item});if(_model.playlist[_model.item].file||_model.playlist[_model.item].levels[0].file){_model.setActiveMediaProvider(_model.playlist[_model.item])}}_model.loadPlaylist=function(arg){var input;if(typeof arg=="string"){if(arg.indexOf("[")==0||arg.indexOf("{")=="0"){try{input=eval(arg)}catch(err){input=arg}}else{input=arg}}else{input=arg}var config;switch(jwplayer.utils.typeOf(input)){case"object":config=input;break;case"array":config={playlist:input};break;default:_loadExternal(input);return;break}_model.playlist=new jwplayer.html5.playlist(config);if(jwplayer.utils.extension(_model.playlist[0].file)=="xml"){_loadExternal(_model.playlist[0].file)}else{_loadComplete()}};function _getShuffleItem(){var result=null;if(_model.playlist.length>1){while(!jwplayer.utils.exists(result)){result=Math.floor(Math.random()*_model.playlist.length);if(result==_model.item){result=null}}}else{result=0}return result}function forward(evt){if(evt.type==jwplayer.api.events.JWPLAYER_MEDIA_LOADED){_container=_media.getDisplayElement()}_eventDispatcher.sendEvent(evt.type,evt)}var _mediaProviders={};_model.setActiveMediaProvider=function(playlistItem){if(playlistItem.provider=="audio"){playlistItem.provider="sound"}var provider=playlistItem.provider;var current=_media?_media.getDisplayElement():null;if(provider=="sound"||provider=="http"||provider==""){provider="video"}if(!jwplayer.utils.exists(_mediaProviders[provider])){switch(provider){case"video":_media=new jwplayer.html5.mediavideo(_model,current?current:_container);break;case"youtube":_media=new jwplayer.html5.mediayoutube(_model,current?current:_container);break}if(!jwplayer.utils.exists(_media)){return false}_media.addGlobalListener(forward);_mediaProviders[provider]=_media}else{if(_media!=_mediaProviders[provider]){if(_media){_media.stop()}_media=_mediaProviders[provider]}}if(_model.config.chromeless){_media.load(playlistItem,false)}return true};_model.getMedia=function(){return _media};_model.seek=function(pos){_eventDispatcher.sendEvent(jwplayer.api.events.JWPLAYER_MEDIA_SEEK,{position:_model.position,offset:pos});return _media.seek(pos)};_model.setupPlugins=function(){if(!jwplayer.utils.exists(_model.plugins)||!jwplayer.utils.exists(_model.plugins.order)||_model.plugins.order.length==0){jwplayer.utils.log("No plugins to set up");return _model}for(var i=0;i<_model.plugins.order.length;i++){try{var pluginName=_model.plugins.order[i];if(jwplayer.utils.exists(jwplayer.html5[pluginName])){if(pluginName=="playlist"){_model.plugins.object[pluginName]=new jwplayer.html5.playlistcomponent(_api,_model.plugins.config[pluginName])}else{_model.plugins.object[pluginName]=new jwplayer.html5[pluginName](_api,_model.plugins.config[pluginName])}}else{_model.plugins.order.splice(plugin,plugin+1)}if(typeof _model.plugins.object[pluginName].addGlobalListener=="function"){_model.plugins.object[pluginName].addGlobalListener(forward)}}catch(err){jwplayer.utils.log("Could not setup "+pluginName)}}};return _model}})(jwplayer);(function(a){a.html5.playlist=function(b){var d=[];if(b.playlist&&b.playlist instanceof Array&&b.playlist.length>0){for(var c in b.playlist){if(!isNaN(parseInt(c))){d.push(new a.html5.playlistitem(b.playlist[c]))}}}else{d.push(new a.html5.playlistitem(b))}return d}})(jwplayer);(function(a){var c={size:180,position:a.html5.view.positions.NONE,itemheight:60,thumbs:true,fontcolor:"#000000",overcolor:"",activecolor:"",backgroundcolor:"#f8f8f8",font:"_sans",fontsize:"",fontstyle:"",fontweight:""};var b={_sans:"Arial, Helvetica, sans-serif",_serif:"Times, Times New Roman, serif",_typewriter:"Courier New, Courier, monospace"};_utils=a.utils;_css=_utils.css;_hide=function(d){_css(d,{display:"none"})};_show=function(d){_css(d,{display:"block"})};a.html5.playlistcomponent=function(r,B){var w=r;var e=a.utils.extend({},c,w.skin.getComponentSettings("playlist"),B);if(e.position==a.html5.view.positions.NONE||typeof a.html5.view.positions[e.position]=="undefined"){return}var x;var l;var C;var d;var g;var f;var k=-1;var h={background:undefined,item:undefined,itemOver:undefined,itemImage:undefined,itemActive:undefined};this.getDisplayElement=function(){return x};this.resize=function(F,D){l=F;C=D;if(w.jwGetFullscreen()){_hide(x)}else{var E={display:"block",width:l,height:C};_css(x,E)}};this.show=function(){_show(x)};this.hide=function(){_hide(x)};function j(){x=document.createElement("div");x.id=w.id+"_jwplayer_playlistcomponent";switch(e.position){case a.html5.view.positions.RIGHT:case a.html5.view.positions.LEFT:x.style.width=e.size+"px";break;case a.html5.view.positions.TOP:case a.html5.view.positions.BOTTOM:x.style.height=e.size+"px";break}A();if(h.item){e.itemheight=h.item.height}x.style.backgroundColor="#C6C6C6";w.jwAddEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,s);w.jwAddEventListener(a.api.events.JWPLAYER_PLAYLIST_ITEM,u);w.jwAddEventListener(a.api.events.JWPLAYER_PLAYER_STATE,m)}function p(){var D=document.createElement("ul");_css(D,{width:x.style.width,minWidth:x.style.width,height:x.style.height,backgroundColor:e.backgroundcolor,backgroundImage:h.background?"url("+h.background.src+")":"",color:e.fontcolor,listStyle:"none",margin:0,padding:0,fontFamily:b[e.font]?b[e.font]:b._sans,fontSize:(e.fontsize?e.fontsize:11)+"px",fontStyle:e.fontstyle,fontWeight:e.fontweight,overflowY:"auto"});return D}function y(D){return function(){var E=f.getElementsByClassName("item")[D];var F=e.fontcolor;var G=h.item?"url("+h.item.src+")":"";if(D==w.jwGetPlaylistIndex()){if(e.activecolor!==""){F=e.activecolor}if(h.itemActive){G="url("+h.itemActive.src+")"}}_css(E,{color:e.overcolor!==""?e.overcolor:F,backgroundImage:h.itemOver?"url("+h.itemOver.src+")":G})}}function o(D){return function(){var E=f.getElementsByClassName("item")[D];var F=e.fontcolor;var G=h.item?"url("+h.item.src+")":"";if(D==w.jwGetPlaylistIndex()){if(e.activecolor!==""){F=e.activecolor}if(h.itemActive){G="url("+h.itemActive.src+")"}}_css(E,{color:F,backgroundImage:G})}}function q(I){var P=d[I];var O=document.createElement("li");O.className="item";_css(O,{height:e.itemheight,display:"block",cursor:"pointer",backgroundImage:h.item?"url("+h.item.src+")":"",backgroundSize:"100% "+e.itemheight+"px"});O.onmouseover=y(I);O.onmouseout=o(I);var J=document.createElement("div");var F=new Image();var K=0;var L=0;var M=0;if(v()&&(P.image||P["playlist.image"]||h.itemImage)){F.className="image";if(h.itemImage){K=(e.itemheight-h.itemImage.height)/2;L=h.itemImage.width;M=h.itemImage.height}else{L=e.itemheight*4/3;M=e.itemheight}_css(J,{height:M,width:L,"float":"left",styleFloat:"left",cssFloat:"left",margin:"0 5px 0 0",background:"black",overflow:"hidden",margin:K+"px",position:"relative"});_css(F,{position:"relative"});J.appendChild(F);F.onload=function(){a.utils.stretch(a.utils.stretching.FILL,F,L,M,this.naturalWidth,this.naturalHeight)};if(P["playlist.image"]){F.src=P["playlist.image"]}else{if(P.image){F.src=P.image}else{if(h.itemImage){F.src=h.itemImage.src}}}O.appendChild(J)}var E=l-L-K*2;if(C<e.itemheight*d.length){E-=15}var D=document.createElement("div");_css(D,{position:"relative",height:"100%",overflow:"hidden"});var G=document.createElement("span");if(P.duration>0){G.className="duration";_css(G,{fontSize:(e.fontsize?e.fontsize:11)+"px",fontWeight:(e.fontweight?e.fontweight:"bold"),width:"40px",height:e.fontsize?e.fontsize+10:20,lineHeight:24,"float":"right",styleFloat:"right",cssFloat:"right"});G.innerHTML=_utils.timeFormat(P.duration);D.appendChild(G)}var N=document.createElement("span");N.className="title";_css(N,{padding:"5px 5px 0 "+(K?0:"5px"),height:e.fontsize?e.fontsize+10:20,lineHeight:e.fontsize?e.fontsize+10:20,overflow:"hidden","float":"left",styleFloat:"left",cssFloat:"left",width:((P.duration>0)?E-50:E)-10+"px",fontSize:(e.fontsize?e.fontsize:13)+"px",fontWeight:(e.fontweight?e.fontweight:"bold")});N.innerHTML=P?P.title:"";D.appendChild(N);if(P.description){var H=document.createElement("span");H.className="description";_css(H,{display:"block","float":"left",styleFloat:"left",cssFloat:"left",margin:0,paddingLeft:N.style.paddingLeft,paddingRight:N.style.paddingRight,lineHeight:(e.fontsize?e.fontsize+4:15)+"px",overflow:"hidden",position:"relative"});H.innerHTML=P.description;D.appendChild(H)}O.appendChild(D);return O}function s(E){x.innerHTML="";d=w.jwGetPlaylist();if(!d){return}items=[];f=p();for(var F=0;F<d.length;F++){var D=q(F);D.onclick=z(F);f.appendChild(D);items.push(D)}k=w.jwGetPlaylistIndex();o(k)();x.appendChild(f);if(_utils.isIOS()&&window.iScroll){f.style.height=e.itemheight*d.length+"px";var G=new iScroll(x.id)}}function z(D){return function(){w.jwPlaylistItem(D);w.jwPlay(true)}}function n(){f.scrollTop=w.jwGetPlaylistIndex()*e.itemheight}function v(){return e.thumbs.toString().toLowerCase()=="true"}function u(D){if(k>=0){o(k)();k=D.index}o(D.index)();n()}function m(){if(e.position==a.html5.view.positions.OVER){switch(w.jwGetState()){case a.api.events.state.IDLE:_show(x);break;default:_hide(x);break}}}function A(){for(var D in h){h[D]=t(D)}}function t(D){return w.skin.getSkinElement("playlist",D)}j();return this}})(jwplayer);(function(b){b.html5.playlistitem=function(d){var e={author:"",date:"",description:"",image:"",link:"",mediaid:"",tags:"",title:"",provider:"",file:"",streamer:"",duration:-1,start:0,currentLevel:-1,levels:[]};var c=b.utils.extend({},e,d);if(c.type){c.provider=c.type;delete c.type}if(c.levels.length===0){c.levels[0]=new b.html5.playlistitemlevel(c)}if(!c.provider){c.provider=a(c.levels[0])}else{c.provider=c.provider.toLowerCase()}return c};function a(e){if(b.utils.isYouTube(e.file)){return"youtube"}else{var f=b.utils.extension(e.file);var c;if(f&&b.utils.extensionmap[f]){c=b.utils.extensionmap[f].html5}else{if(e.type){c=e.type}}if(c){var d=c.split("/")[0];if(d=="audio"){return"sound"}else{if(d=="video"){return d}}}}return""}})(jwplayer);(function(a){a.html5.playlistitemlevel=function(b){var d={file:"",streamer:"",bitrate:0,width:0};for(var c in d){if(a.utils.exists(b[c])){d[c]=b[c]}}return d}})(jwplayer);(function(a){a.html5.playlistloader=function(){var c=new a.html5.eventdispatcher();a.utils.extend(this,c);this.load=function(e){a.utils.ajax(e,d,b)};function d(g){var f=[];try{var f=a.utils.parsers.rssparser.parse(g.responseXML.firstChild);c.sendEvent(a.api.events.JWPLAYER_PLAYLIST_LOADED,{playlist:new a.html5.playlist({playlist:f})})}catch(h){b("Could not parse the playlist")}}function b(e){c.sendEvent(a.api.events.JWPLAYER_ERROR,{error:e?e:"could not load playlist for whatever reason.  too bad"})}}})(jwplayer);(function(a){a.html5.skin=function(){var b={};var c=false;this.load=function(d,e){new a.html5.skinloader(d,function(f){c=true;b=f;e()},function(){new a.html5.skinloader("",function(f){c=true;b=f;e()})})};this.getSkinElement=function(d,e){if(c){try{return b[d].elements[e]}catch(f){a.utils.log("No such skin component / element: ",[d,e])}}return null};this.getComponentSettings=function(d){if(c){return b[d].settings}return null};this.getComponentLayout=function(d){if(c){return b[d].layout}return null}}})(jwplayer);(function(a){a.html5.skinloader=function(f,p,k){var o={};var c=p;var l=k;var e=true;var j;var n=f;var s=false;function m(){if(typeof n!="string"||n===""){d(a.html5.defaultSkin().xml)}else{a.utils.ajax(a.utils.getAbsolutePath(n),function(t){try{if(a.utils.exists(t.responseXML)){d(t.responseXML);return}}catch(u){h()}d(a.html5.defaultSkin().xml)},function(t){d(a.html5.defaultSkin().xml)})}}function d(y){var E=y.getElementsByTagName("component");if(E.length===0){return}for(var H=0;H<E.length;H++){var C=E[H].getAttribute("name");var B={settings:{},elements:{},layout:{}};o[C]=B;var G=E[H].getElementsByTagName("elements")[0].getElementsByTagName("element");for(var F=0;F<G.length;F++){b(G[F],C)}var z=E[H].getElementsByTagName("settings")[0];if(z&&z.childNodes.length>0){var K=z.getElementsByTagName("setting");for(var P=0;P<K.length;P++){var Q=K[P].getAttribute("name");var I=K[P].getAttribute("value");var x=/color$/.test(Q)?"color":null;o[C].settings[Q]=a.utils.typechecker(I,x)}}var L=E[H].getElementsByTagName("layout")[0];if(L&&L.childNodes.length>0){var M=L.getElementsByTagName("group");for(var w=0;w<M.length;w++){var A=M[w];o[C].layout[A.getAttribute("position")]={elements:[]};for(var O=0;O<A.attributes.length;O++){var D=A.attributes[O];o[C].layout[A.getAttribute("position")][D.name]=D.value}var N=A.getElementsByTagName("*");for(var v=0;v<N.length;v++){var t=N[v];o[C].layout[A.getAttribute("position")].elements.push({type:t.tagName});for(var u=0;u<t.attributes.length;u++){var J=t.attributes[u];o[C].layout[A.getAttribute("position")].elements[v][J.name]=J.value}if(!a.utils.exists(o[C].layout[A.getAttribute("position")].elements[v].name)){o[C].layout[A.getAttribute("position")].elements[v].name=t.tagName}}}}e=false;r()}}function r(){clearInterval(j);if(!s){j=setInterval(function(){q()},100)}}function b(y,x){var w=new Image();var t=y.getAttribute("name");var v=y.getAttribute("src");var A;if(v.indexOf("data:image/png;base64,")===0){A=v}else{var u=a.utils.getAbsolutePath(n);var z=u.substr(0,u.lastIndexOf("/"));A=[z,x,v].join("/")}o[x].elements[t]={height:0,width:0,src:"",ready:false,image:w};w.onload=function(B){g(w,t,x)};w.onerror=function(B){s=true;r();l()};w.src=A}function h(){for(var u in o){var w=o[u];for(var t in w.elements){var x=w.elements[t];var v=x.image;v.onload=null;v.onerror=null;delete x.image;delete w.elements[t]}delete o[u]}}function q(){for(var t in o){if(t!="properties"){for(var u in o[t].elements){if(!o[t].elements[u].ready){return}}}}if(e===false){clearInterval(j);c(o)}}function g(t,v,u){if(o[u]&&o[u].elements[v]){o[u].elements[v].height=t.height;o[u].elements[v].width=t.width;o[u].elements[v].src=t.src;o[u].elements[v].ready=true;r()}else{a.utils.log("Loaded an image for a missing element: "+u+"."+v)}}m()}})(jwplayer);(function(a){a.html5.api=function(c,n){var m={};var f=document.createElement("div");c.parentNode.replaceChild(f,c);f.id=c.id;m.version=a.version;m.id=f.id;var l=new a.html5.model(m,f,n);var j=new a.html5.view(m,f,l);var k=new a.html5.controller(m,f,l,j);m.skin=new a.html5.skin();m.jwPlay=function(o){if(typeof o=="undefined"){e()}else{if(o.toString().toLowerCase()=="true"){k.play()}else{k.pause()}}};m.jwPause=function(o){if(typeof o=="undefined"){e()}else{if(o.toString().toLowerCase()=="true"){k.pause()}else{k.play()}}};function e(){if(l.state==a.api.events.state.PLAYING||l.state==a.api.events.state.BUFFERING){k.pause()}else{k.play()}}m.jwStop=k.stop;m.jwSeek=k.seek;m.jwPlaylistItem=k.item;m.jwPlaylistNext=k.next;m.jwPlaylistPrev=k.prev;m.jwResize=k.resize;m.jwLoad=k.load;function h(o){return function(){return l[o]}}function d(o,q,p){return function(){var r=l.plugins.object[o];if(r&&r[q]&&typeof r[q]=="function"){r[q].apply(r,p)}}}m.jwGetItem=h("item");m.jwGetPosition=h("position");m.jwGetDuration=h("duration");m.jwGetBuffer=h("buffer");m.jwGetWidth=h("width");m.jwGetHeight=h("height");m.jwGetFullscreen=h("fullscreen");m.jwSetFullscreen=k.setFullscreen;m.jwGetVolume=h("volume");m.jwSetVolume=k.setVolume;m.jwGetMute=h("mute");m.jwSetMute=k.setMute;m.jwGetStretching=h("stretching");m.jwGetState=h("state");m.jwGetVersion=function(){return m.version};m.jwGetPlaylist=function(){return l.playlist};m.jwGetPlaylistIndex=m.jwGetItem;m.jwAddEventListener=k.addEventListener;m.jwRemoveEventListener=k.removeEventListener;m.jwSendEvent=k.sendEvent;m.jwDockSetButton=function(r,o,p,q){if(l.plugins.object.dock&&l.plugins.object.dock.setButton){l.plugins.object.dock.setButton(r,o,p,q)}};m.jwControlbarShow=d("controlbar","show");m.jwControlbarHide=d("controlbar","hide");m.jwDockShow=d("dock","show");m.jwDockHide=d("dock","hide");m.jwDisplayShow=d("display","show");m.jwDisplayHide=d("display","hide");m.jwGetLevel=function(){};m.jwGetBandwidth=function(){};m.jwGetLockState=function(){};m.jwLock=function(){};m.jwUnlock=function(){};function b(){if(l.config.playlistfile){l.addEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,g);l.loadPlaylist(l.config.playlistfile)}else{if(typeof l.config.playlist=="string"){l.addEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,g);l.loadPlaylist(l.config.playlist)}else{l.loadPlaylist(l.config);setTimeout(g,25)}}}function g(o){l.removeEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,g);l.setupPlugins();j.setup();var o={id:m.id,version:m.version};k.playerReady(o)}if(l.config.chromeless&&!a.utils.isIPad()){b()}else{m.skin.load(l.config.skin,b)}return m}})(jwplayer)};/*
 * 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.
 * 
 * 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 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 OWNER 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. 
 *
*/

// 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;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * 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 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 OWNER 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. 
 *
 */var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-11012647-2']);
        _gaq.push(['_trackPageview']);

        function writeGATag()
        {
            var ga = document.createElement('script'); 
            ga.type = 'text/javascript'; 
            ga.async = true;
            ga.src = 'http://www.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; 
            s.parentNode.insertBefore(ga, s);
         }var currContMethod = "email";
var loggedIn = false;
// Images
var imageURLs = new Array();
var imageName = new Array();
var imageDesc = new Array();
var imageSize = new Array();
var viewer;
var imageGalleryInitialHeight;
var imageFrame;
var galleryFrame;
var galleryImageCount;
var galleryImageIndex = 0;
// Adverts
var adCount = 0;
var timeCount = 0;
var numAds = 0;
var switchDelay = 0;
var commitDelay = 0;
var adverts = new Array();
var mouseOver = false;
var userDomain;
var kPhraseHeight = 0;
var tempEmailID = "0";
var maxDescriptionHeight = 176;
var descContentHeight = 0;
var companyID = 0;
var settingNewUserPass = false;
var currBlogOnShowID = 0;
var limitBlogs = true;
var panelLimit = 3;
var currReviewOnShowID = 0;
var limitReviews = true;
var currentReviewHeight;
var waiting = false;
var blogToShow = 0;
var emailPopup;
var currentMarqueeCount = 0;
var currentMarqueeLength;
var currentMarqueeCharCounter = 0;
var marqueeArray = new Array();
var currentMarquee = new Array();
var marqueeScroller;
var addressMaxHeight = 0;
var galleryMaxheight = 0;
var openingMaxheight = 0;
var descriptionMaxheight = 0;
var reviewsCount = 0;
var blogsCount = 0;
var workedCount = 0;
var eventsCount = 0;
var qAndaCount = 0;
var lastPanelHeight = 0;
var availableLeftPanelSpace = 0;
var availableRightPanelSpace = 0;
var blogsOnShow = 0;
var reviewsOnShow = 0;
var qandaAdded = 0;
var workedAdded = 0;
var eventsAdded = 0;
var blogsAdded = 0;
var reviewsAdded = 0;
var newMessagePanel;
var modalPanel;
var isIphone = false;

window.onload = function () {
    var userAgent = navigator.userAgent.toLowerCase();
    if (userAgent.indexOf('ipod') > -1 || userAgent.indexOf('iphone') > -1 || userAgent.indexOf('ipad') > -1) {
        isIphone = true;
    }
    marqueeArray[0] = "Ask me a question and I'll get back to you straight away!";
    marqueeArray[1] = "Do you carry out work on listed or special buildings?";
    marqueeArray[2] = "How can I arrange for you to come and give me a quote?";
    marqueeArray[3] = "How much would it cost to valet my Range Rover Sport?";
    marqueeArray[4] = "My poodle needs a hair cut, when can you fit me in?";
    marqueeScroller = document.getElementById('quickQuestionInputPanelScroller');
    // get the user domain for use with the handlers
    userDomain = "http://" + window.location.host + "/resources/Handlers/PlinkSocial";
    companyID = document.getElementById('hfCID').value;
    modalPanel = document.getElementById('modalPanel');
    newMessagePanel = document.getElementById('newMessagePanel');

    // check to see if we are linking directly to a blog or desc frgament
    if (window.location.hash != "") {
        var temp = window.location.hash;
        if (temp.indexOf("#!") == 0) {
            temp = temp.replace("#!", "");
            if (temp.indexOf("blog") == 0) {
                var blgID = temp.split("_")[2];
                var strURL = userDomain + "/getBlogRange.ashx";
                $.post(strURL, {
                    compID: companyID,
                    blogID: blgID
                }, function (data) {
                    if (data != "failed") {
                        waiting = true;
                        blogToShow = blgID;
                        var temp2 = document.getElementById('blogSelectorPanel');
                        var elem = document.getElementById('nextSet' + data);
                        showNextBlogSet(elem);
                    }
                });
            }
        }
    };

    // if not logged in, setup the adverts
    // Build up the advert server values
    var date = new Date()
    var d = date.getMilliseconds();
    var strURL = userDomain + '/logger.ashx?id=' + escape(document.referrer) + '&cid=' + companyID + '&vid=' + document.getElementById('hfVIPID').value.split(',')[1] + "&d=" + d;
    $.get(strURL, {});

    if (document.getElementById('mapPanel')) {
        document.getElementById('mapPanel').src = "http://maps.locallinkup.co.uk?compID=" + companyID + "&h=360px&w=640px";
    }

    if (document.getElementById('description')) {
        setDescriptionHeight();
        document.getElementById('container').onclick =
        function (event) {
            event = window.event || event;
            manageLinks(event);
        };
    }
    fragPanel = document.getElementById('fragmentPanel');
    if (fragPanel == null) {
        fragPanel = document.createElement("div");
        fragPanel.id = "fragmentPanel";
        fragPanel.style.top = "60px";
        fragPanel.style.height = "0px";
        fragPanel.innerHTML = "<div id=\"fragmentPanelTop\"></div>" +
                                "<div id=\"fragmentPanelMid\">" +
                                    "<div id=\"fragmentPanelCloseButton\" onclick=\"closeFragPanel();\"></div>" +
                                    "<div id=\"fragmentPanelText\">" +
                                    "</div>" +
                                "</div>" +
                                "<div id=\"fragmentPanelBot\"></div>";
    }
    if (document.getElementById('imagesWindow')) {
        galleryMaxHeight = 197;
        getGalleryImageList();
        galleryImageCount = document.getElementById('imagesConveyor').childNodes.length;
        setTimeout("autoScrollImages()", 6000);

        // set up the image gallery peeking
        setImageGallerySlide();
    }
    if (document.getElementById('mainContactsPanel')) {
        addressMaxHeight = document.getElementById('mainContactsPanel').offsetHeight;
    }
    if (document.getElementById('openingContentPanel')) {
        openingMaxHeight = document.getElementById('openingMainPanel').offsetHeight;
    }

    availableLeftPanelSpace = 1400 - galleryMaxheight - 238;
    availableRightPanelSpace = 1400 - 135 - 52 - addressMaxHeight - openingMaxheight;

    // set up the scroll to for clicking the top add review button
    if (document.getElementById('reviewContentPanel')) {
        reviewsCount = document.getElementById('reviewMainPanel').childNodes.length;
        availableLeftPanelSpace -= 50;
        $('a[href=#reviewAnchor]').click(
        function () {
            var scrollTo = document.getElementById('reviewMainPanel').parentNode.parentNode.offsetTop;
            $('html, body').animate({ scrollTop: scrollTo + "px" }, 1000);
            return false;
        });
    }
    if (document.getElementById('blogContentPanel')) {
        blogsCount = document.getElementById('blogMainPanel').childNodes.length;
        availableLeftPanelSpace -= 50;
    }
    if (document.getElementById('qandaMainPanel')) {
        qAndaCount = document.getElementById('qandaInnerPanel').childNodes.length;
        availableRightPanelSpace -= 50;
    }
    if (document.getElementById('workedContentPanel')) {
        workedCount = document.getElementById('workedMainPanel').childNodes.length;
        availableRightPanelSpace -= 50;
    }
    if (document.getElementById('eventContentPanel')) {
        eventsCount = document.getElementById('eventMainPanel').childNodes.length;
        availableRightPanelSpace -= 50;
    }

    if (document.getElementById('hfVID')) {
        var tempArray = document.getElementById('hfVID').value.split(",");
        jwplayer('videoPlayer').setup({
            controlbar: 'over',
            width: '640',
            height: '360',
            stretching: 'exactfit',
            image: tempArray[1],
            modes: [
                {
                    type: 'flash',
                    src: 'resources/Scripts/player.swf',
                    config: {
                        file: tempArray[0],
                        streamer: 'rtmp://streamer.locallinkup.com/cfx/st',
                        provider: 'rtmp'
                    }
                },
                {
                    type: 'html5',
                    config: {
                        file: "https://s3.amazonaws.com/lluvideo/" + tempArray[0],
                        provider: 'video'
                    }
                },
                {
                    type: 'download',
                    config: {
                        file: "https://s3.amazonaws.com/lluvideo/" + tempArray[0],
                        provider: 'video'
                    }
                }
            ]
        });
    }

    setTimeout("marqueeScroll();", 1000);

    calculateHeights();

    viewer = new LLUImageViewer(document.getElementById('container'));

    var plinkLink = document.getElementById('plinkLink')
    if (plinkLink) {
        if (plinkLink.offsetWidth > 256) {
            plinkLink.innerHTML = plinkLink.innerHTML.replace("www.", "");

        }
    }

    var strURL2 = userDomain + "/getAdContent.ashx?cID=" + companyID + "&d=" + d;
    $.get(strURL2, {},
    function (data) {
        if (data != "failed") {
            var tempArray = data.split("^^");
            numAds = parseInt(tempArray[0]);
            switchDelay = parseInt(tempArray[1]);
            commitDelay = parseInt(tempArray[2]);
            adverts = tempArray[3].split("~~");
            getAd();
        }
    });
    if (!isIphone) {
        if (!FlashDetect.versionAtLeast(9)) {
            window.open('http://get.adobe.com/flashplayer/', '', 'width=980,height=700,resizable=yes,scrollbars=yes,location=1,toolbar=1');
        }
    }
}

function redirectToMobile() {
    var cArray = document.cookie.split(';');
    for (var i = 0; i < cArray.length; i++) {
        if (cArray[i].indexOf("noredirect") > -1) {
            var exdate = new Date();
            exdate.setDate(exdate.getDate() - 1);
            document.cookie = "noredirect=0; expires=" + exdate.toGMTString() + ";";
        }
    }
    // redirect to main plink page
    window.location = document.getElementById('hfMob').value;
}

/* #region Calculate Page Height */

function calculateHeights() {
    formatLeftPanelHeight(1400);
    formatRightPanelHeight(1400);
    var leftHeight = document.getElementById('leftPanel').offsetHeight;
    var rightHeight = document.getElementById('rightPanel').offsetHeight;
    if (leftHeight < rightHeight) {
        if (document.getElementById('qandaMainPanel')) {
            document.getElementById('qandaMainPanel').style.height = "0px";
        }
        if (document.getElementById('workedContentPanel')) {
            document.getElementById('workedContentPanel').style.height = "0px";
        }
        if (document.getElementById('eventContentPanel')) {
            document.getElementById('eventContentPanel').style.height = "0px";
        }
        formatRightPanelHeight(leftHeight);
    }
    else if (rightHeight < leftHeight) {
        maxDescriptionHeight = 176;
        setDescriptionHeight();
        if (document.getElementById('blogContentPanel')) {
            document.getElementById('blogContentPanel').style.height = "0px";
        }
        if (document.getElementById('reviewContentPanel')) {
            document.getElementById('reviewContentPanel').style.height = "0px";
        }
        formatLeftPanelHeight(rightHeight);
    }
    leftHeight = document.getElementById('leftPanel').offsetHeight;
    rightHeight = document.getElementById('rightPanel').offsetHeight;
    if (leftHeight < rightHeight) {
        maxDescriptionHeight = maxDescriptionHeight + (rightHeight - leftHeight);
        maxDescriptionHeight = maxDescriptionHeight - (maxDescriptionHeight % 16);
        setDescriptionHeight();
    }
}

function formatRightPanelHeight(requiredheight) {
    qandaAdded = 0;
    var qandaMainPanel = document.getElementById('qandaInnerPanel');
    var qandaContentPanel = document.getElementById('qandaMainPanel');
    var currQandaContentHeight = 0;
    workedAdded = 0;
    var workedMainPanel = document.getElementById('workedMainPanel');
    var workedContentPanel = document.getElementById('workedContentPanel');
    var currWorkedContentHeight = 0;
    eventsAdded = 0;
    var eventsMainPanel = document.getElementById('eventMainPanel');
    var eventsContentPanel = document.getElementById('eventContentPanel');
    var currEventsContentHeight = 0;
    var rightPanel = document.getElementById('rightPanel');
    while ((qandaAdded < qAndaCount || workedAdded < workedCount || eventsAdded < eventsCount) && rightPanel.offsetHeight < requiredheight) {
        if (qAndaCount > 0) {
            if (qandaAdded < qAndaCount) {
                currQandaContentHeight += qandaMainPanel.childNodes[qandaAdded].offsetHeight + 5;
                qandaContentPanel.style.height = currQandaContentHeight + "px";
                qandaAdded++;
            }
        }
        if (workedCount > 0) {
            if (workedAdded < workedCount) {
                currWorkedContentHeight += workedMainPanel.childNodes[workedAdded].offsetHeight + 8;
                workedContentPanel.style.height = currWorkedContentHeight + "px";
                workedAdded++;
            }
        }
        if (eventsCount > 0) {
            if (eventsAdded < eventsCount) {
                currEventsContentHeight += eventsMainPanel.childNodes[eventsAdded].offsetHeight + 8;
                eventsContentPanel.style.height = currEventsContentHeight + "px";
                eventsAdded++;
            }
        }
    }
    if (qAndaCount > 0) {
        if (qandaAdded < qAndaCount - 1) {
            document.getElementById("viewAllQandA").style.display = "inline";
        }
        else {
            document.getElementById("viewAllQandA").style.display = "none";
        }
    }
    if (workedCount > 0) {
        if (workedAdded < workedCount - 1) {
            document.getElementById("viewAllWorked").style.display = "inline";
        }
        else {
            document.getElementById("viewAllWorked").style.display = "none";
        }
    }
    if (eventsCount > 0) {
        if (eventsAdded < eventsCount - 1) {
            document.getElementById("viewAllEvents").style.display = "inline";
        }
        else {
            document.getElementById("viewAllEvents").style.display = "none";
        }
    }
}

function formatLeftPanelHeight(requiredheight) {
    blogsAdded = 0;
    var blogMainPanel = document.getElementById('blogMainPanel');
    var blogContentPanel = document.getElementById('blogContentPanel');
    var currBlogContentHeight = 0;
    reviewsAdded = 0;
    var reviewMainPanel = document.getElementById('reviewMainPanel');
    var reviewContentPanel = document.getElementById('reviewContentPanel');
    var currReviewContentHeight = 0;
    var leftPanel = document.getElementById('leftPanel');
    while ((blogsAdded < blogsCount || reviewsAdded < reviewsCount) && leftPanel.offsetHeight < requiredheight) {
        if (blogsCount > 0) {
            if (blogsAdded == 0) {
                var blogTextContainer = document.getElementById('blog' + blogsAdded);
                if (blogTextContainer.offsetHeight > 0) {
                    currBlogOnShowID = blogTextContainer.firstChild.id.replace("blogText", "");
                }
                if (blogTextContainer.offsetHeight > 48) {
                    blogTextContainer.style.height = "48px";
                    blogTextContainer.nextSibling.style.display = "inline";
                }
            }
            if (blogsAdded < blogsCount) {
                currBlogContentHeight += blogMainPanel.childNodes[blogsAdded].offsetHeight + 10;
                blogContentPanel.style.height = currBlogContentHeight + "px";
                blogsAdded++;
            }
        }
        if (reviewsCount > 0) {
            if (reviewsAdded == 0) {
                var reviewsTextContainer = document.getElementById('review' + reviewsAdded);
                if (reviewsTextContainer.offsetHeight > 0) {
                    currReviewOnShowID = reviewsTextContainer.firstChild.id.replace("reviewText", "");
                }
                if (reviewsTextContainer.offsetHeight > 48) {
                    reviewsTextContainer.style.height = "48px";
                    reviewsTextContainer.nextSibling.style.display = "inline";
                }
            }
            if (reviewsAdded < reviewsCount) {
                currReviewContentHeight += reviewMainPanel.childNodes[reviewsAdded].offsetHeight + 10;
                reviewContentPanel.style.height = currReviewContentHeight + "px";
                reviewsAdded++;
            }
        }
    }
    if (blogsCount > 0) {
        if (blogsAdded < blogsCount) {
            document.getElementById("viewAllBlog").style.display = "inline";
        }
        else {
            document.getElementById("viewAllBlog").style.display = "none";
        }
    }
    if (reviewsCount > 0) {
        if (reviewsAdded < reviewsCount) {
            document.getElementById("viewAllReview").style.display = "inline";
        }
        else {
            document.getElementById("viewAllReview").style.display = "none";
        }
    }
    if (leftPanel.offsetHeight < requiredheight) {
        maxDescriptionHeight = maxDescriptionHeight + (requiredheight - leftPanel.offsetHeight);
        maxDescriptionHeight = maxDescriptionHeight - (maxDescriptionHeight % 16);
        setDescriptionHeight();
    }
    blogsOnShow = blogsAdded;
    reviewsOnShow = reviewsAdded;
}

function setDescriptionHeight() {
    descriptionMaxHeight = document.getElementById('description').offsetHeight;
    var descriptionOverflow = descriptionMaxHeight - maxDescriptionHeight;
    if (descriptionOverflow > 0) {
        document.getElementById('descriptionContainer').style.height = maxDescriptionHeight + "px";
        document.getElementById('descriptionMore').style.display = "inline";
    }
    else {
        maxDescriptionHeight = descriptionMaxHeight;
        document.getElementById('descriptionContainer').style.height = maxDescriptionHeight + "px";
        document.getElementById('descriptionMore').style.display = "none";
    }
}

/* #endregion */

/* #region Rest */

// Change the conact selection for the message being sent when a radio button is clicked
function toggleMapVideo() {
    // Make sure we don't select the same method that is already chosen
    var state = document.getElementById('contactsVideoSwitch').className.indexOf("On") > -1;
    if (state) {
        document.getElementById('contactsMapSwitch').className = "videoMapOn";
        document.getElementById('contactsVideoSwitch').className = "videoMapOff";
        $('#videoPlayerMainPanel').animate({ height: "0px" }, 500,
        function () {
            document.getElementById('mapPanel').style.marginTop = "10px";
            $('#mapPanel').animate({ height: "360px" }, 500);
        });
    }
    else {
        document.getElementById('contactsMapSwitch').className = "videoMapOff";
        document.getElementById('contactsVideoSwitch').className = "videoMapOn";
        $('#mapPanel').animate({ height: "0px" }, 500,
        function () {
            document.getElementById('mapPanel').style.marginTop = "0px";
            $('#videoPlayerMainPanel').animate({ height: "360px" }, 500);
        });
    }
}

function toggleMap() {
    var state = document.getElementById('contactsMapSwitch').className.indexOf("On") > -1;
    if (state) {
        document.getElementById('contactsMapSwitch').className = "videoMapOff";
        $('#mapPanel').animate({ height: "0px" }, 500,
        function () {
            document.getElementById('mapPanel').style.marginTop = "0px";
        });
    }
    else {
        document.getElementById('contactsMapSwitch').className = "videoMapOn";
        $('#mapPanel').animate({ height: "360px" }, 500);
        document.getElementById('mapPanel').style.marginTop = "10px";
    }
}

function sendFaceBookSMS() {
    var strURL = userDomain + "/sendFaceBookNotification.ashx";
    $.post(strURL, {
        compID: companyID,
        VIPID: document.getElementById('hfVIPID').value
    }, function (data) {
        
    });
}

function sendTwitterSMS() {
    var strURL = userDomain + "/sendTwitterClicked.ashx";
    $.post(strURL, {
        compID: companyID,
        VIPID: document.getElementById('hfVIPID').value
    }, function (data) {
        var currCount = parseInt(document.getElementById('tweetCountPanel').innerHTML, 10);
        currCount++;
        document.getElementById('tweetCountPanel').innerHTML = currCount;
    });
}

function revealContacts(button) {
    var strURL = userDomain + "/getContactNumbers.ashx";
    $.post(strURL, {
        compID: companyID,
        VIPID: document.getElementById('hfVIPID').value
    }, function (data) {
        if (data != "failed") {
            button.style.display = "none";
            var tempArray = data.split("^^");
            if (tempArray[0] != "") {
                if (document.getElementById('contactTel')) {
                    document.getElementById('contactTel').innerHTML = tempArray[0];
                }
            }
            if (tempArray[1] != "") {
                if (document.getElementById('contactMob')) {
                    document.getElementById('contactMob').innerHTML = tempArray[1];
                }
            }
            if (tempArray[2] != "") {
                if (document.getElementById('contactFax')) {
                    document.getElementById('contactFax').innerHTML = tempArray[2];
                }
            }
        }
    });
}

function manageLinks(event) {
    var elem = null;
    if (event.srcElement) {
        elem = event.srcElement;
    }
    else {
        elem = event.target;
    }
    if (elem != null) {
        if (elem.tagName.toLowerCase() == "a") {
            if (elem.className == "FragmentLink") {
                getFragment(elem.getAttribute("href").split("_")[1], elem);
            }
            else if (elem.className == "locationLink") {
                getLocation(elem.getAttribute("href").split("_")[2], elem);
            }
            else if (elem.className == "servicesLink") {
                getPhrase(elem.getAttribute("href").split("_")[2], elem);
            }
        }
    }
}

function getFragment(fID, elem) {
    var strURL = userDomain + "/getDescriptionFragment.ashx";
    $.post(strURL, {
        fragID: fID
    }, function (data) {
        if (data != "failed") {
            document.getElementById('leftPanel').appendChild(fragPanel);
            var newPos = 0;
            if (elem.parentNode.id.indexOf("desc") > -1) {
                newPos = document.getElementById('descContentPanel').parentNode.offsetTop;
            }
            else if (elem.parentNode.id.indexOf("Phrase") > -1) {
                newPos = 0;
            }
            else {
                newPos = document.getElementById('blogContentPanel').parentNode.offsetTop;
            }
            fragPanel.style.top = newPos + "px";
            document.getElementById('fragmentPanelText').innerHTML = data;
            var newHeight = (document.getElementById('fragmentPanelText').offsetHeight + 40) + "px";
            $(fragPanel).animate({ height: newHeight }, 500);
        }
    });
}

function getLocation(lID, elem) {
    var strURL = userDomain + "/getLocationFragment.ashx";
    $.post(strURL, {
        VIPID: document.getElementById('hfVIPID').value,
        locID: lID
    }, function (data) {
        if (data != "failed") {
            document.getElementById('container').appendChild(fragPanel);
            fragPanel.style.top = "60px";
            document.getElementById('fragmentPanelText').innerHTML = data;
            var newHeight = (document.getElementById('fragmentPanelText').offsetHeight + 40) + "px";
            $(fragPanel).animate({ height: newHeight }, 500);
        }
    });
}

function getPhrase(pID, elem) {
    var strURL = userDomain + "/getPhraseFragment.ashx";
    $.post(strURL, {
        VIPID: document.getElementById('hfVIPID').value,
        phrID: pID
    }, function (data) {
        if (data != "failed") {
            document.getElementById('container').appendChild(fragPanel);
            fragPanel.style.top = "60px";
            document.getElementById('fragmentPanelText').innerHTML = data;
            var newHeight = (document.getElementById('fragmentPanelText').offsetHeight + 40) + "px";
            $(fragPanel).animate({ height: newHeight }, 500);
        }
    });
}

function closeFragPanel() {
    $(fragPanel).animate({ height: "0px" }, 500);
}

function showNextBlogSet(elem) {
    if (elem.className != "blogBlockSelectorSelected" || waiting) {
        var strURL = userDomain + "/getBlogBlocks.ashx";
        $.post(strURL, {
            compID: companyID,
            VIPID: document.getElementById('hfVIPID').value,
            counts: elem.innerHTML,
            loggedIn: loggedIn.toString()
        }, function (data) {
            if (data != "failed") {
                var tempArray = data.split("~~");
                var blogLimit = tempArray[0];
                var blogCount = tempArray[1];
                if (blogCount < 4) {
                    document.getElementById('viewAllBlog').style.display = "none";
                }
                else {
                    document.getElementById('viewAllBlog').style.display = "inline";
                }
                var blogSelectorPanel = document.getElementById('blogSelectorPanel');
                for (var i = 0; i < blogSelectorPanel.childNodes.length; i++) {
                    blogSelectorPanel.childNodes[i].className = "blogBlockSelector";
                }
                elem.className = "blogBlockSelectorSelected";
                document.getElementById('blogMainPanel').innerHTML = tempArray[2];
                currBlogOnShowID = 0;
                blogToShow = tempArray[3];
                showBlogContent(blogToShow);
                var newHeight = document.getElementById('blogContentPanel').offsetTop + document.getElementById('blog' + blogToShow).offsetTop;
                $('html').animate({
                    scrollTop: newHeight
                }, 500);
            }
        });
    }
}

function showBlogContent(bID) {
    if (waiting) {
        showBlog(bID);
    }
    else {
        // first check to see if the clicked blog is already on show
        if (currBlogOnShowID != bID) {
            // hide the current blog on display
            if (currBlogOnShowID > 0) {
                var blogTextPanelOnShow = document.getElementById('blogText' + currBlogOnShowID);
                // if this is the first panel we need to hide the more button
                if (blogTextPanelOnShow.parentNode.nextSibling) {
                    if (blogTextPanelOnShow.parentNode.nextSibling.className == "moreText") {
                        blogTextPanelOnShow.parentNode.nextSibling.style.display = "none";
                    }
                }
                // hide the panel
                $(blogTextPanelOnShow.parentNode).animate({ height: "0px" }, 500, function () {
                    showBlog(bID);
                });
            }
            else {
                showBlog(bID);
            }
        }
    }
}

function showBlog(bID) {
    // then check to see if the content is already in the page
    var blogTextPanelToShow = document.getElementById('blogText' + bID);
    // check to see if the current blog content is already in the page
    if (blogTextPanelToShow.offsetHeight < 5) {
        // not present so get it
        var strURL = userDomain + "/getBlogContent.ashx";
        $.post(strURL, {
            blogID: bID,
            compID: companyID,
            VIPID: document.getElementById('hfVIPID').value
        }, function (data) {
            if (data != "failed") {
                blogTextPanelToShow.innerHTML = data;
                // now we know it's present, so show it
                $(blogTextPanelToShow.parentNode).animate({ height: blogTextPanelToShow.offsetHeight + "px" }, 500, function () {
                    // set the current blog ID
                    currBlogOnShowID = bID;
                    $("#blogContentPanel").animate({ height: document.getElementById('blogMainPanel').offsetHeight + "px" }, 500);
                });
            }
        });
    }
    else {
        // now we know it's present, so show it
        $(blogTextPanelToShow.parentNode).animate({ height: blogTextPanelToShow.offsetHeight + "px" }, 500, function () {
            // set the current blog ID
            currBlogOnShowID = bID;
            $("#blogContentPanel").animate({ height: document.getElementById('blogMainPanel').offsetHeight + "px" }, 500);
        });
    }
}

function showMore(elem, id) {
    var panel = document.getElementById(id).parentNode;
    var height = document.getElementById(id).offsetHeight;
    var containerPanel = panel.parentNode.parentNode.parentNode.parentNode;
    if (elem.innerHTML == "more") {
        lastPanelHeight = containerPanel.offsetHeight;
        $(panel).animate({ height: height + "px" }, 500);
        elem.style.backgroundImage = "url(http://image.locallinkup.com/plink/up_16x16.png)";
        elem.innerHTML = "less";
        $(containerPanel).animate({ height: (containerPanel.offsetHeight + (height - 48)) + "px" }, 500);
    }
    else {
        $(panel).animate({ height: "48px" }, 500);
        elem.style.backgroundImage = "url(http://image.locallinkup.com/plink/down_16x16.png)";
        elem.innerHTML = "more";
        $(containerPanel).animate({ height: lastPanelHeight + "px" }, 500);
    }
}

function showMoreDescription(elem) {
    var panel = document.getElementById('descriptionContainer');
    var height = document.getElementById('description').offsetHeight;
    if (elem.className == "moreButton") {
        $(panel).animate({ height: height + "px" }, 500);
        elem.className = "lessButton";
    }
    else {
        $(panel).animate({ height: maxDescriptionHeight + "px" }, 500);
        elem.className = "moreButton";
    }
}

function showMoreBlog(elem) {
    var panel = document.getElementById('blogContentPanel');
    var height = document.getElementById('blogMainPanel').offsetHeight;
    if (elem.className == "moreButton") {
        lastPanelHeight = panel.offsetHeight;
        $(panel).animate({ height: height + "px" }, 500);
        elem.className = "lessButton";
        if (document.getElementById('blogSelectorPanelContainer')) {
            document.getElementById('blogSelectorPanelContainer').style.height = "20px";
        }
        blogsOnShow = blogsCount;
    }
    else {
        $(panel).animate({ height: lastPanelHeight + "px" }, 500);
        elem.className = "moreButton";
        if (document.getElementById('blogSelectorPanelContainer')) {
            document.getElementById('blogSelectorPanelContainer').style.height = "0px";
        }
        blogsOnShow = blogsAdded;
    }
}

function showMoreReview(elem) {
    var panel = document.getElementById('reviewContentPanel');
    var height = document.getElementById('reviewMainPanel').offsetHeight;
    if (elem.className == "moreButton") {
        lastPanelHeight = panel.offsetHeight;
        $(panel).animate({ height: height + "px" }, 500);
        elem.className = "lessButton";
        reviewsOnShow = reviewsCount;
    }
    else {
        $(panel).animate({ height: lastPanelHeight + "px" }, 500);
        elem.className = "moreButton";
        reviewsOnShow = reviewsAdded;
    }
}

function showMoreQandA(elem) {
    var panel = document.getElementById('qandaMainPanel');
    var height = document.getElementById('qandaInnerPanel').offsetHeight;
    if (elem.className == "moreButton") {
        lastPanelHeight = panel.offsetHeight;
        $(panel).animate({ height: height + "px" }, 500);
        elem.className = "lessButton";
    }
    else {
        $(panel).animate({ height: lastPanelHeight + "px" }, 500);
        elem.className = "moreButton";
    }
}

function showMoreWorked(elem) {
    var panel = document.getElementById('workedContentPanel');
    var height = document.getElementById('workedMainPanel').offsetHeight;
    if (elem.className == "moreButton") {
        lastPanelHeight = panel.offsetHeight;
        $(panel).animate({ height: height + "px" }, 500);
        elem.className = "lessButton";
    }
    else {
        $(panel).animate({ height: lastPanelHeight + "px" }, 500);
        elem.className = "moreButton";
    }
}

function showMoreEvents(elem) {
    var panel = document.getElementById('eventContentPanel');
    var height = document.getElementById('eventMainPanel').offsetHeight;
    if (elem.className == "moreButton") {
        lastPanelHeight = panel.offsetHeight;
        $(panel).animate({ height: height + "px" }, 500);
        elem.className = "lessButton";
    }
    else {
        $(panel).animate({ height: lastPanelHeight + "px" }, 500);
        elem.className = "moreButton";
    }
}

function viewKeyPhrases() {
    if (kPhraseHeight > 40) {
        var kPhrasePanel = document.getElementById('keyPhrasesPanel');
        var kPhraseMore = document.getElementById('keyPhraseMore');
        var newHeight = kPhraseHeight + "px";
        if (kPhraseMore.innerHTML == "more") {
            $(kPhrasePanel).animate({ height: newHeight }, 500);
            var scrollTo = kPhrasePanel.offsetTop + kPhraseHeight;
            $('html, body').animate({
                scrollTop: scrollTo + "px"
            }, 500);
            kPhraseMore.style.backgroundImage = "url(http://image.locallinkup.com/plink/up_16x16.png)";
            kPhraseMore.innerHTML = "less";
        }
        else {
            $(kPhrasePanel).animate({ height: "40px" }, 500);
            kPhraseMore.style.backgroundImage = "url(http://image.locallinkup.com/plink/down_16x16.png)";
            kPhraseMore.innerHTML = "more";
        }
    }
}

function setImageGallerySlide() {
    $('.plinkGalleryImagePanel').hover(
    function () {
        mouseOver = true;
        $(".plinkGalleryTextPanel", this).stop().animate({ top: '0px' }, { queue: false, duration: 500 });
    },
    function () {
        mouseOver = false;
        $(".plinkGalleryTextPanel", this).stop().animate({ top: '120px' }, { queue: false, duration: 500, easing: "easeOutBounce" });
    });
}

function getAd() {
    if (document.getElementById('advertContentPanel') != null) {
        if (timeCount == commitDelay | timeCount == switchDelay + commitDelay) {
            var d = new Date();
            var time = d.getTime();
            var strURL = userDomain + "/commitServer.ashx?id=" +
                    adverts[adCount].split(';')[0] + "&page=" + window.location + "&d=" + time;
            $.get(strURL, function (data) { });
        }
        if (timeCount % switchDelay == 0) {
            var currCoName = adverts[adCount].split(';')[1];
            var currAdTitle = adverts[adCount].split(';')[2];
            var currAdText = adverts[adCount].split(';')[3];
            var currAdURL = adverts[adCount].split(';')[4];
            document.getElementById('topALink').innerHTML = currAdTitle;
            document.getElementById('topALink').href = currAdURL;
            document.getElementById('topALink').target = "_blank"
            document.getElementById('adText').innerHTML = currAdText.replace(/\n/gi, "<br>");
            document.getElementById('botALink').href = currAdURL;
            var fancyUrl = currAdURL;
            if (currAdURL.indexOf(".html") > -1) {
                fancyUrl = currCoName;
            }
            document.getElementById('botALink').target = "_blank"
            adCount++;
        }
        timeCount += 10000;
        if (adCount == numAds) {
            adCount = 0;
        }
        setTimeout("getAd()", 10000);
    }
}

function getGalleryImageList() {
    // build the image gallery arrays for displaying the main images
    var date = new Date();
    var d = date.getMilliseconds();
    var strURL = userDomain + "/getGalleryImageList.ashx?cID=" + companyID + "&d=" + d;
    $.get(strURL, {
}, function (data) {
    if (data != "failed") {
        if (data.indexOf("^^") > -1) {
            var tempArray = data.split("^^");
            imageURLs = tempArray[0].split("**");
            imageName = tempArray[1].split("**");
            imageDesc = tempArray[2].split("**");
            imageSize = tempArray[3].split("**");
        }
    }
});
}

function showBlogImage(bID) {
    // get all the data for the main blog image and create an array for each element to pass into the image viewer
    var strURL = userDomain + "/getBlogImage.ashx";
    $.post(strURL, {
        blogID: bID
    }, function (data) {
        if (data != "failed") {
            var tempArray = data.split("^^");
            var tempImageURLs = new Array();
            var tempImageName = new Array();
            var tempImageDesc = new Array();
            var tempImageSize = new Array();
            tempImageURLs[0] = tempArray[0];
            tempImageName[0] = tempArray[1];
            tempImageDesc[0] = tempArray[2];
            tempImageSize[0] = tempArray[3];
            viewer.showViewer("0", tempImageURLs, tempImageName, tempImageDesc, tempImageSize);
        }
    });
}

function showMainLogo(elem) {
    var iID = elem.getAttribute("imID");
    // get all the data for the main blog image and create an array for each element to pass into the image viewer
    var strURL = userDomain + "/getLogoImage.ashx";
    $.post(strURL, {
        imID: iID
    }, function (data) {
        if (data != "failed") {
            var tempArray = data.split("^^");
            var tempImageURLs = new Array();
            var tempImageName = new Array();
            var tempImageDesc = new Array();
            var tempImageSize = new Array();
            tempImageURLs[0] = tempArray[0];
            tempImageName[0] = tempArray[1];
            tempImageDesc[0] = tempArray[2];
            tempImageSize[0] = tempArray[3];
            viewer.showViewer("0", tempImageURLs, tempImageName, tempImageDesc, tempImageSize);
        }
    });
}

function autoScrollImages() {
    if (document.getElementById('imagesWindow') != null) {
        if (!mouseOver) {
            var imageConveyor = document.getElementById('imagesConveyor');
            if (galleryImageIndex < (galleryImageCount - 3)) {
                galleryImageIndex++;
                var newPos = "-" + (galleryImageIndex * 202) + "px";
                move(newPos);
                if (galleryImageIndex == (galleryImageCount - 3)) {
                    document.getElementById('imagesMoveRight').className = "imagesMoveRightDisabled";
                    document.getElementById('imagesMoveRight').style.backgroundPosition = "-899px -367px";
                }
                else {
                    document.getElementById('imagesMoveRight').className = "imagesMoveRight";
                    document.getElementById('imagesMoveRight').style.backgroundPosition = "-217px -368px";
                }
                if (galleryImageIndex > 0) {
                    document.getElementById('imagesMoveLeft').className = "imagesMoveLeft";
                    document.getElementById('imagesMoveLeft').style.backgroundPosition = "-258px -368px";
                }
            }
            else if (galleryImageIndex == (galleryImageCount - 3)) {
                galleryImageIndex = 0;
                move("0px");
                document.getElementById('imagesMoveLeft').className = "imagesMoveLeftDisabled";
                document.getElementById('imagesMoveLeft').style.backgroundPosition = "-908px -367px";
                if (galleryImageCount > 3) {
                    document.getElementById('imagesMoveRight').className = "imagesMoveRight";
                    document.getElementById('imagesMoveRight').style.backgroundPosition = "-217px -368px";
                }
            }
        }
        setTimeout("autoScrollImages()", 6000);
    }
}

function move(newPos) {
    $('#imagesConveyor').animate({ left: newPos }, 1000, "easeOutBounce");
}

function movePlinkGallery(dir) {
    var imageConveyor = document.getElementById('imagesConveyor');
    if (dir == "left") {
        if (galleryImageIndex > 0) {
            galleryImageIndex--;
            var newPos2 = "-" + (galleryImageIndex * 202) + "px";
            move(newPos2);
            if (galleryImageIndex == 0) {
                document.getElementById('imagesMoveLeft').className = "imagesMoveLeftDisabled";
                document.getElementById('imagesMoveLeft').style.backgroundPosition = "-908px -367px";
            }
            if (galleryImageIndex < (galleryImageCount - 3)) {
                document.getElementById('imagesMoveRight').className = "imagesMoveRight";
                document.getElementById('imagesMoveRight').style.backgroundPosition = "-217px -368px";
            }
        }
    }
    else {
        if (galleryImageIndex < (galleryImageCount - 3)) {
            galleryImageIndex++;
            var newPos = "-" + (galleryImageIndex * 202) + "px";
            move(newPos);
            if (galleryImageIndex == (galleryImageCount - 3)) {
                document.getElementById('imagesMoveRight').className = "imagesMoveRightDisabled";
                document.getElementById('imagesMoveRight').style.backgroundPosition = "-899px -367px";
            }
            else {
                document.getElementById('imagesMoveRight').className = "imagesMoveRight";
                document.getElementById('imagesMoveRight').style.backgroundPosition = "-217px -368px";
            }
            if (galleryImageIndex > 0) {
                document.getElementById('imagesMoveLeft').className = "imagesMoveLeft";
                document.getElementById('imagesMoveLeft').style.backgroundPosition = "-258px -368px";
            }
        }
    }
}

function showMovePlinkGalleryTab(elem, dir, overOut) {
    if (elem.className.indexOf("Disabled") == -1) {
        if (dir == "left") {
            if (overOut == "over") {
                elem.style.backgroundPosition = "-240px -368px";
                mouseOver = true;
            }
            else {
                elem.style.backgroundPosition = "-258px -368px";
                mouseOver = false;
            }
        }
        else {
            if (overOut == "over") {
                elem.style.backgroundPosition = "-198px -368px";
                mouseOver = true;
            }
            else {
                elem.style.backgroundPosition = "-217px -368px";
                mouseOver = false;
            }
        }
    }
}

function showReviewContent(rID) {
    // first check to see if the clicked blog is already on show
    if (currReviewOnShowID != rID) {
        // hide the current blog on display
        var reviewTextPanelOnShow = document.getElementById('reviewText' + currReviewOnShowID);
        // if this is the first panel we need to hide the more button
        if (reviewTextPanelOnShow.parentNode.nextSibling) {
            if (reviewTextPanelOnShow.parentNode.nextSibling.className == "moreText") {
                reviewTextPanelOnShow.parentNode.nextSibling.style.display = "none";
            }
        }
        // hide the panel
        $(reviewTextPanelOnShow.parentNode).animate({ height: "0px" }, 500, function () {
            // then check to see if the content is already in the page
            var reviewTextPanelToShow = document.getElementById('reviewText' + rID);
            // check to see if the current review content is already in the page
            if (reviewTextPanelToShow.offsetHeight < 5) {
                // now we know it's present, so show it
                $(reviewTextPanelToShow.parentNode).animate({ height: reviewTextPanelToShow.offsetHeight + "px" }, 500, function () {
                    // set the current review ID
                    currReviewOnShowID = rID;
                    var reviewgMainPanel = document.getElementById('reviewMainPanel');
                    var newHeight = 0;
                    for (var i = 0; i < reviewsOnShow; i++) {
                        newHeight += reviewgMainPanel.childNodes[i].offsetHeight;
                    }
                    newHeight += (reviewsOnShow * 10);
                    $("#reviewContentPanel").animate({ height: newHeight + "px" }, 500);
                });
            }
            else {
                // now we know it's present, so show it
                $(reviewTextPanelToShow.parentNode).animate({ height: reviewTextPanelToShow.offsetHeight + "px" }, 500, function () {
                    // set the current review ID
                    currReviewOnShowID = rID;
                    var reviewgMainPanel = document.getElementById('reviewMainPanel');
                    var newHeight = 0;
                    for (var i = 0; i < reviewsOnShow; i++) {
                        newHeight += reviewgMainPanel.childNodes[i].offsetHeight;
                    }
                    newHeight += (reviewsOnShow * 10);
                    $("#reviewContentPanel").animate({ height: newHeight + "px" }, 500);
                });
            }
        });
    }
}

function postAReview() {
    if (document.getElementById('reviewPanel')) {
        return;
    }
    // Build the review panel and add it to the page
    var reviewPanel = document.createElement("div");
    reviewPanel.id = "reviewPanel";
    reviewPanel.style.height = "0px";

    // This is the main label
    var reviewMainLabel = document.createElement("div");
    reviewMainLabel.id = "reviewMainLabel";
    reviewMainLabel.innerHTML = "Add your Review for this business";
    reviewPanel.appendChild(reviewMainLabel);

    // This is the title label
    var reviewTitleLabel = document.createElement("div");
    reviewTitleLabel.id = "reviewTitleLabel";
    reviewTitleLabel.innerHTML = "Title:";
    reviewPanel.appendChild(reviewTitleLabel);

    // This panel is purely for the background image of the title input box
    var reviewTitleInputPanel = document.createElement("div");
    reviewTitleInputPanel.id = "reviewTitleInputPanel";
    reviewPanel.appendChild(reviewTitleInputPanel);

    // This is the actual title input box
    var reviewTitleInput = document.createElement("input");
    reviewTitleInput.id = "reviewTitleInput";
    reviewTitleInput.setAttribute("type", "text");
    reviewTitleInput.onblur = function () { setReviewTextBox(this, ''); };
    reviewTitleInput.onclick = function () { setReviewTextBox(this, 'clear'); };
    reviewTitleInput.value = "Enter the title of your review";
    reviewTitleInputPanel.appendChild(reviewTitleInput);

    // This is the label for the comments
    var reviewCommentsLabel = document.createElement("div");
    reviewCommentsLabel.id = "reviewCommentsLabel";
    reviewCommentsLabel.innerHTML = "Comments:";
    reviewPanel.appendChild(reviewCommentsLabel);

    // This panel is purely for the background image of the comments input box
    var reviewCommentsInputPanel = document.createElement("div");
    reviewCommentsInputPanel.id = "reviewCommentsInputPanel";
    reviewPanel.appendChild(reviewCommentsInputPanel);

    // This is the actual content input box
    var reviewCommentsInput = document.createElement("textarea");
    reviewCommentsInput.id = "reviewCommentsInput";
    reviewCommentsInput.setAttribute("cols", "20");
    reviewCommentsInput.setAttribute("rows", "6");
    reviewCommentsInput.onblur = function () { setReviewTextArea('set'); };
    reviewCommentsInput.onclick = function () { setReviewTextArea('clear'); };
    reviewCommentsInput.value = "Enter your comments here";
    reviewCommentsInputPanel.appendChild(reviewCommentsInput);

    // This is the Email label
    var reviewEmailLabel = document.createElement("div");
    reviewEmailLabel.id = "reviewEmailLabel";
    reviewEmailLabel.innerHTML = "Email:";
    reviewPanel.appendChild(reviewEmailLabel);

    // This panel is purely for the background image of the Email input box
    var reviewEmailInputPanel = document.createElement("div");
    reviewEmailInputPanel.id = "reviewEmailInputPanel";
    reviewPanel.appendChild(reviewEmailInputPanel);

    // This is the actual Email input box
    var reviewEmailInput = document.createElement("input");
    reviewEmailInput.id = "reviewEmailInput";
    reviewEmailInput.setAttribute("type", "text");
    reviewEmailInput.onblur = function () { setReviewTextBox(this, ''); };
    reviewEmailInput.onclick = function () { setReviewTextBox(this, 'clear'); };
    reviewEmailInput.value = "Your email address (required)";
    reviewEmailInputPanel.appendChild(reviewEmailInput);

    // This is the submit button for saving the changes
    var reviewSubmitButton = document.createElement("div");
    reviewSubmitButton.id = "reviewSubmitButton";
    reviewSubmitButton.onclick = function () { submitReview(); };
    reviewPanel.appendChild(reviewSubmitButton);

    // This is the cancel button
    var reviewCancelButton = document.createElement("div");
    reviewCancelButton.id = "reviewCancelButton";
    reviewCancelButton.onclick = function () { cancelReview(); };
    reviewPanel.appendChild(reviewCancelButton);

    if (document.getElementById('reviewMainPanel') != null) {
        // set the location to the top of the panel
        var reviewContentPanel = document.getElementById("reviewContentPanel");
        reviewContentPanel.parentNode.insertBefore(reviewPanel, reviewContentPanel);
    }
    else {
        // set the location to the top of the panel
        var leftPanel = document.getElementById("leftPanel");
        leftPanel.insertBefore(reviewPanel, leftPanel.firstChild);
    }
    if (document.getElementById('reviewContentPanel')) {
        currentReviewHeight = document.getElementById('reviewContentPanel').offsetHeight;
    }
    $('#reviewContentPanel').animate({ height: "0px" }, 500);
    $(reviewPanel).animate({ height: "296px" }, 500);
}

function cancelReview() {
    var reviewPanel = document.getElementById('reviewPanel');
    $(reviewPanel).animate({ height: "0px" }, 500, function () {
        // remove the review editor
        reviewPanel.parentNode.removeChild(reviewPanel);
        $('#reviewContentPanel').animate({ height: currentReviewHeight + "px" }, 500);
    });
}

function submitReview() {
    if (document.getElementById('reviewTitleInput').value != "" && document.getElementById('reviewTitleInput').value != "Enter the title of your review") {
        if (document.getElementById('reviewCommentsInput').value != "" && document.getElementById('reviewCommentsInput').value != "Enter your comments here") {
            if (document.getElementById('reviewEmailInput').value != "" && document.getElementById('reviewEmailInput').value != "Your email address (required)") {
                if (document.getElementById('reviewEmailInput').value.indexOf("@") > -1) {
                    var strURL = userDomain + "/emailValidation.ashx";
                    var tempEmail = document.getElementById('reviewEmailInput').value;
                    $.post(strURL, {
                        domain: tempEmail.split("@")[1]
                    }, function (data) {
                        if (data == "success") {
                            postReview();
                        }
                        else {
                            showMessage("large", "The email address you entered is not valid.", true, document.getElementById('reviewPanel'), 4000);
                        }
                    });
                }
                else {
                    showMessage("large", "The email address you entered is not valid.", true, document.getElementById('reviewPanel'), 4000);
                }
            }
            else {
                showMessage("large", "Please enter your email address to continue.", true, document.getElementById('reviewPanel'), 4000);
            }
        }
        else {
            showMessage("large", "Please enter your comments to continue.", true, document.getElementById('reviewPanel'), 4000);
        }
    }
    else {
        showMessage("large", "Please enter a title for your review.", true, document.getElementById('reviewPanel'), 4000);
    }
}

// This actually passes the question details on to a handler for actual submition and resets all fields back to their defaults on success
function postReview() {
    var strURL = userDomain + "/sendReview.ashx";
    $.post(strURL, {
        cID: companyID,
        title: document.getElementById('reviewTitleInput').value,
        comments: document.getElementById('reviewCommentsInput').value,
        email: document.getElementById('reviewEmailInput').value,
        VIPID: document.getElementById('hfVIPID').value
    }, function (data) {
        if (data == "success") {
            showMessage("large", "Your review has been submitted.", true, document.getElementById('reviewPanel'), 4000);
            cancelReview();
        }
    });
}

// Handles the default text in the main question text area
function setReviewTextArea(type) {
    if (type == "clear") {
        if (document.getElementById('reviewCommentsInput').value == "Enter your comments here") {
            document.getElementById('reviewCommentsInput').value = "";
        }
    }
    else {
        if (document.getElementById('reviewCommentsInput').value == "") {
            document.getElementById('reviewCommentsInput').value = "Enter your comments here";
        }
    }
}

// Handles the default text in the name and contact text fields
function setReviewTextBox(element, type) {
    if (type == "clear") {
        if (element.value == "Enter the title of your review" || element.value == "Your email address (required)") {
            element.value = "";
        }
    }
    else {
        if (element.value == "") {
            if (element.id == "reviewEmailInput") {
                element.value = "Your email address (required)";
            }
            else {
                element.value = "Enter the title of your review";
            }
        }
    }
}

// Show the image popup when an image is clicked making sure there are images to view
function showImage(index) {
    if (viewer != null) {
        if (parseInt(index) <= imageURLs.length) {
            viewer.showViewer(index, imageURLs, imageName, imageDesc, imageSize);
        }
    }
}

// function to check if the string passed in is a number, returns true if it is
function IsNumeric(sText) {
    var ValidChars = "0123456789";
    var IsNumber = true;
    var Char;
    for (i = 0; i < sText.length && IsNumber == true; i++) {
        Char = sText.charAt(i);
        if (ValidChars.indexOf(Char) == -1) {
            IsNumber = false;
        }
    }
    return IsNumber;
}

// checks that the relevant fields are filled in with the correct information when the user submits a question
function submitMessage() {
    if (document.getElementById('quickQuestionInput').value != "" && document.getElementById('quickQuestionInput').value != "How can I help you?") {
        if (limitMessageText()) {
            if (document.getElementById('quickQuestionNameInput').value != "" && document.getElementById('quickQuestionNameInput').value != "Please give your name") {
                if (currContMethod == "mobile") {
                    document.getElementById('quickQuestionContactInput').value = document.getElementById('quickQuestionContactInput').value.replace(/ /g, "");
                    var mobileNum = document.getElementById('quickQuestionContactInput').value;
                    if (mobileNum != "" && mobileNum != "Please give your number") {
                        if (IsNumeric(mobileNum)) {
                            if (mobileNum.length == 11 && mobileNum.indexOf("07") == 0) {
                                postNewMessage();
                            }
                            else {
                                showMessage("large", "The number you entered is not a valid mobile phone number, must be 11 digits!", true, document.getElementById('quickQuestionPanel'), 4000);
                            }
                        }
                        else {
                            showMessage("large", "The number you entered is not a valid mobile phone number!", true, document.getElementById('quickQuestionPanel'), 4000);
                        }
                    }
                    else {
                        showMessage("large", "Please enter a mobile number to continue!", true, document.getElementById('quickQuestionPanel'), 4000);
                    }
                }
                else {
                    if (document.getElementById('quickQuestionContactInput').value != "" && document.getElementById('quickQuestionContactInput').value != "Please give your email") {
                        if (document.getElementById('quickQuestionContactInput').value.indexOf("@") > -1) {
                            var strURL = userDomain + "/emailValidation.ashx";
                            var tempEmail = document.getElementById('quickQuestionContactInput').value;
                            $.post(strURL, {
                                domain: tempEmail.split("@")[1]
                            }, function (data) {
                                if (data == "success") {
                                    postNewMessage();
                                }
                                else {
                                    showMessage("large", "The email address you entered is not valid!", true, document.getElementById('quickQuestionPanel'), 4000);
                                }
                            });
                        }
                        else {
                            showMessage("large", "The email address you entered is not valid!", true, document.getElementById('quickQuestionPanel'), 4000);
                        }
                    }
                    else {
                        showMessage("large", "Please enter your email address to continue!", true, document.getElementById('quickQuestionPanel'), 4000);
                    }
                }
            }
            else {
                showMessage("large", "Please enter your name to continue!", true, document.getElementById('quickQuestionPanel'), 4000);
            }
        }
    }
    else {
        showMessage("large", "Please enter a question to submit!", true, document.getElementById('quickQuestionPanel'), 4000);
    }
}

// Handles the default text in the contact text fields
function setTextBox2(element, type) {
    if (type == "clear") {
        var tempText = element.value;
        if (tempText == "Your Email Address" || tempText == "Your Mobile/Telephone" || tempText == "Your Message" || tempText == "Your Name or Company Name") {
            element.value = "";
        }
    }
    else {
        if (element.value == "") {
            element.value = type;
        }
    }
}

function limitMessageText() {
    var text = document.getElementById('quickQuestionInput').value;
    if (text.length > 1400) {
        document.getElementById('quickQuestionInput').setAttribute("disabled", "disabled");
        showMessage("large", "you are only permitted 1400 characters", true, document.getElementById('quickQuestionPanel'), 4000);
        var newText = text.substring(0, 1399);
        document.getElementById('quickQuestionInput').value = newText;
        document.getElementById('quickQuestionInput').removeAttribute("disabled");
        return false;
    }
    else {
        document.getElementById('quickQuestionInput').removeAttribute("disabled");
        return true;
    }
}

// This actually passes the question details on to a handler for actual submition and resets all fields back to their defaults on success
function postNewMessage() {
    var strURL = userDomain + "/sendMessage.ashx";
    $.post(strURL, {
        cID: companyID,
        Method: currContMethod,
        Name: document.getElementById('quickQuestionNameInput').value,
        Contact: document.getElementById('quickQuestionContactInput').value,
        Message: document.getElementById('quickQuestionInput').value,
        VIPID: document.getElementById('hfVIPID').value
    }, function (data) {
        if (data == "success") {
            showMessage("large", "Your question has been submitted!", true, document.getElementById('quickQuestionPanel'), 4000);
        }
        else if (data == "spam") {
            showMessage("large", "Your message has not been sent as it violates our terms and conditions!", true, document.getElementById('quickQuestionPanel'), 4000);
        }
        document.getElementById('quickQuestionReplyMobile').className = "quickQuestionReplyMobileOff";
        document.getElementById('quickQuestionReplyEmail').className = "quickQuestionReplyEmailOn";
        currContMethod = "email";
        document.getElementById('quickQuestionInput').value = "How can I help you?";
        document.getElementById('quickQuestionNameInput').value = "Please give your name";
        document.getElementById('quickQuestionContactInput').value = "Please give your number";
        hideQuickQuestion();
    });
}

// show the message box
function showMessage(size, text, auto, elem, time) {
    var newHeight = 0;
    currMessage = "messagePanelLarge";
    document.getElementById('messagePanelTextLarge').innerHTML = text;
    elem.parentNode.insertBefore(document.getElementById("messagePanelLarge"), elem);
    newHeight = (document.getElementById('messagePanelTextLarge').offsetHeight + 10) + "px";
    $(document.getElementById('messagePanelLarge')).animate({ height: newHeight }, 500);
    if (!auto) {
        document.getElementById("messagePanelNoLarge").style.display = "inline";
        document.getElementById("messagePanelYesLarge").style.display = "inline";
    }
    else {
        document.getElementById("messagePanelNoLarge").style.display = "none";
        document.getElementById("messagePanelYesLarge").style.display = "none";
    }
    if (auto) {
        setTimeout("hideMessage()", time);
    }
}

// Hide the message box popup after the timeout has expired
function hideMessage() {
    $(document.getElementById(currMessage)).animate({ height: "0px" }, 500);
}

function GetHeight() {
    var y = 0;
    if (self.innerHeight) {
        y = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight) {
        y = document.documentElement.clientHeight;
    }
    else if (document.body) {
        y = document.body.clientHeight;
    }
    return y;
}

function GetWidth() {
    var x = 0;
    if (self.clientWidth) {
        x = self.clientWidth;
    }
    else if (document.documentElement && document.documentElement.clientWidth) {
        x = document.documentElement.clientWidth;
    }
    else if (document.body) {
        x = document.body.clientWidth;
    }
    return x;
}

function gotoPage(url) {
    var newWindow = window.open(url, "newWindow", "location=1,toolbar=1,resizeable=1,status=1,scrollbars=1,width=" + GetWidth() + ",height=" + GetHeight() + "");
    try {
        newWindow.moveTo(0, 0);
    }
    catch (err) { }
}

/* #region email */
var linkUrl;
var sending = false;

function linkClicked(elem) {
    linkUrl = elem.getAttribute('urlLink');
    if (linkUrl.indexOf("@") > -1) {
        showModal();
    }
    else {
        window.location = linkUrl;
    }
}

/* #region Modal Panel */

function showModal() {
    var screenWidth = GetWidth();
    var screenHeight = GetHeight();
    modalPanel.style.width = "0px";
    modalPanel.style.height = "0px";
    modalPanel.style.top = (screenHeight / 2) + "px";
    modalPanel.style.left = (screenWidth / 2) + "px";
    modalPanel.style.display = "inline";
    $(modalPanel).animate({ top: "0px", left: "0px", width: (screenWidth - 8) + "px", height: (screenHeight - 8) + "px" }, 500,
    function () {
        var centerX = (screenWidth / 2).toString();
        if (centerX.indexOf(".") > -1) {
            centerX = parseInt(centerX.split(".")[0], 10);
        }
        centerY = (screenHeight / 2).toString();
        if (centerY.indexOf(".") > -1) {
            centerY = parseInt(centerY.split(".")[0], 10);
        }
        newMessagePanel.style.display = "block";
        var editPanelHeight = document.getElementById('newMessagePanelMid').offsetHeight + 20;
        newMessagePanel.style.left = (centerX - 324) + "px";
        newMessagePanel.style.top = ((centerY - (editPanelHeight / 2)) - 4) + "px";
        $(newMessagePanel).animate({ height: editPanelHeight + "px" }, 500);
    });
}

function closeModalPanel() {
    if (modalPanel.offsetHeight > 10) {
        var newTop = (GetHeight() / 2).toString();
        if (newTop.indexOf(".") > -1) {
            newTop = newTop.split(".")[0];
        }
        var newLeft = (GetWidth() / 2).toString();
        if (newLeft.indexOf(".") > -1) {
            newLeft = newLeft.split(".")[0];
        }
        $(newMessagePanel).animate({ height: "0px" }, 500,
        function () {
            newMessagePanel.style.display = "none";
            $(modalPanel).animate({ top: newTop + "px", left: newLeft + "px", width: "0px", height: "0px" }, 500,
            function () {
                modalPanel.style.display = "none";
                resetEmail();
            });
        });
    }
}

/* #endregion */

function resetEmail() {
    document.getElementById('addInput').value = "Your Email Address";
    document.getElementById('telInput').value = "Your Mobile/Telephone";
    document.getElementById('messageInput').value = "Your Message";
    document.getElementById('namesInput').value = "Your Name or Company Name";
}

function showQuickQuestion(e) {
    e = window.event || e;
    var sourceElem = e.target || e.srcElement;
    if (sourceElem.id != "quickQuestionCancel" && sourceElem.id != "quickQuestionAsk") {
        document.getElementById('quickQuestionNameInput').style.display = "inline";
        document.getElementById('quickQuestionContactInput').style.display = "inline";
        $('#quickQuestionInputPanelScroller').animate({ height: "0px" }, 500);
        $('#quickQuestionInput').animate({ height: "100px" }, 500,
        function () {
            $('#quickQuestionAsk').animate({ height: "32px" }, 250);
            $('#quickQuestionCancel').animate({ height: "32px" }, 250);
        });
    }
}

function hideQuickQuestion() {
    document.getElementById('quickQuestionNameInput').style.display = "none";
    document.getElementById('quickQuestionContactInput').style.display = "none";
    $('#quickQuestionAsk').animate({ height: "0px" }, 250);
    $('#quickQuestionCancel').animate({ height: "0px" }, 250,
    function () {
        $('#quickQuestionInputPanelScroller').animate({ height: "18px" }, 500);
        $('#quickQuestionInput').animate({ height: "0px" }, 500);
    });
}

// Handles the default text in the main question text area
function setTextArea(type) {
    if (type == "clear") {
        if (document.getElementById('quickQuestionInput').value == "How can I help you?") {
            document.getElementById('quickQuestionInput').value = "";
        }
    }
    else {
        if (document.getElementById('quickQuestionInput').value == "") {
            document.getElementById('quickQuestionInput').value = "How can I help you?";
        }
    }
}

// Change the conact selection for the message being sent when a radio button is clicked
function changeContactMethod(elem) {
    // Make sure we don't select the same method that is already chosen
    var emailState = document.getElementById('quickQuestionReplyEmail').className.indexOf("On") > -1;
    if (emailState) {
        document.getElementById('quickQuestionReplyMobile').className = "quickQuestionReplyMobileOn";
        document.getElementById('quickQuestionReplyEmail').className = "quickQuestionReplyEmailOff";
        document.getElementById('quickQuestionContactInput').value = "Please give your number";
        currContMethod = "mobile";
    }
    else {
        document.getElementById('quickQuestionReplyMobile').className = "quickQuestionReplyMobileOff";
        document.getElementById('quickQuestionReplyEmail').className = "quickQuestionReplyEmailOn";
        document.getElementById('quickQuestionContactInput').value = "Please give your email";
        currContMethod = "email";
    }
}

// Handles the default text in the name and contact text fields
function setTextBox(element, type) {
    if (type == "clear") {
        var tempText = element.value;
        if (tempText == "Please give your name" || tempText == "Please give your number" || tempText == "Please give your email") {
            element.value = "";
        }
    }
    else {
        if (element.value == "") {
            if (element.id == "quickQuestionNameInput") {
                element.value = type;
            }
            else {
                if (currContMethod == "email") {
                    element.value = "Please give your email";
                }
                else {
                    element.value = "Please give your number";
                }
            }
        }
    }
}

function sendMessage() {
    if (!sending) {
        sending = true;
        var emailAdd = "";
        var phoneNum = "";
        var addText = document.getElementById('addInput').value;
        var telText = document.getElementById('telInput').value;
        var mesText = document.getElementById('messageInput').value;
        var namText = document.getElementById('namesInput').value;
        if ((addText == "" || addText == "Your Email Address") && (telText == "" || telText == "Your Mobile/Telephone")) {
            showNewMessage("You must enter either a phone number or an email address!", 5000);
            sending = false;
        }
        else {
            if (mesText != "" && mesText != "Your Message") {
                if (addText != "" && addText != "Your Email Address") {
                    if (addText.indexOf("@") > -1) {
                        var strURL = userDomain + "/emailValidation.ashx?domain=" + addText.split("@")[1] + "&d=" + new Date().getMilliseconds();
                        $.ajax({
                            type: 'GET',
                            url: strURL,
                            async: false,
                            success: function (data) {
                                if (data == "success") {
                                    emailAdd = addText;
                                }
                                else {
                                    showNewMessage("Please enter a valid email address!", 5000);
                                    sending = false;
                                    return;
                                }
                            }
                        });
                    }
                    else {
                        showNewMessage("Please enter a valid email address!", 5000);
                        sending = false;
                        return;
                    }
                }
                if (telText != "" && telText != "Your Mobile/Telephone") {
                    var tempTel = telText.replace(/ /gi, "");
                    if (IsNumeric(tempTel)) {
                        if (tempTel != "" && tempTel.length == 11) {
                            phoneNum = telText;
                        }
                        else {
                            showNewMessage("Please enter a valid phone number!", 5000);
                            sending = false;
                            return;
                        }
                    }
                    else {
                        showNewMessage("Please enter a valid phone number!", 5000);
                        sending = false;
                        return;
                    }
                }
                if (namText == "" || namText == "Your Name or Company Name") {
                    showNewMessage("Please enter your name or company name!", 5000);
                    sending = false;
                    return;
                }
                var strURL2 = userDomain + "/sendEmail.ashx";
                $.post(strURL2, {
                    compID: companyID,
                    url: linkUrl,
                    phone: phoneNum,
                    email: emailAdd,
                    name: namText,
                    msg: mesText,
                    VIPID: document.getElementById('hfVIPID').value
                }, function (data) {
                    if (data == "success") {
                        closeModalPanel();
                        sending = false;
                    }
                    else if (data == "spam") {
                        showNewMessage("Your message has not been sent as it violates our terms and conditions!", 5000);
                        sending = false;
                    }
                    else {
                        showNewMessage("Failed, contact Locallinkup on 01542 230250, or email support@locallinkup.com", 5000);
                        sending = false;
                    }
                });
            }
            else {
                showNewMessage("Please enter a message to send!", 5000);
                sending = false;
            }
        }
    }
}

function showNewMessage(text, time) {
    var textPanel = document.getElementById('newMessagePanelText');
    textPanel.innerHTML = text;
    var newHeight = (textPanel.offsetHeight + 22) + "px";
    $('#newMessageNoticePanel').animate({ height: newHeight }, 500);
    setTimeout("hideNewMessage()", time);
}

function hideNewMessage() {
    $('#newMessageNoticePanel').animate({ height: "0px" }, 500);
}

/* #endregion */

function marqueeScroll() {
    marqueeScroller.innerHTML = "";
    currentMarquee = new Array();
    var nextText = marqueeArray[currentMarqueeCount];
    for (var i = 0; i < nextText.length; i++) {
        currentMarquee.push(nextText[i]);
    }
    currentMarqueeLength = currentMarquee.length;
    currentMarqueeCharCounter = 0;
    setTimeout("marqueeAddChar();", 100);
    currentMarqueeCount++;
    if (currentMarqueeCount == 5) {
        currentMarqueeCount = 0;
    }
}

function marqueeAddChar() {
    marqueeScroller.innerHTML += currentMarquee[currentMarqueeCharCounter];
    currentMarqueeCharCounter++;
    if (currentMarqueeCharCounter == currentMarqueeLength) {
        setTimeout("marqueeScroll()", 2000);
    }
    else {
        setTimeout("marqueeAddChar();", 100);
    }
}

function showLocations(elem) {
    if (document.getElementById('locationsOuterPanel').offsetHeight > 0) {
        $("#locationsOuterPanel").animate({ height: "0px" }, 250);
        elem.className = "locationsHideButton";
        document.getElementById('servicesButton').style.display = "inline";
    }
    else {
        var newHeight = document.getElementById('locationsInnerPanel').offsetHeight + 20;
        $("#locationsOuterPanel").animate({ height: newHeight + "px" }, 250,
        function () {
            var scrollTo = document.getElementById('locationsMainPanel').offsetTop;
            $('html, body').animate({ scrollTop: scrollTo + "px" }, 1000);
        });
        elem.className = "locationsShowButton";
        document.getElementById('servicesButton').style.display = "none";
    }
}

function showServices(elem) {
    if (document.getElementById('servicesOuterPanel').offsetHeight > 0) {
        $("#servicesOuterPanel").animate({ height: "0px" }, 250);
        elem.className = "servicesHideButton";
        document.getElementById('locationsButton').style.display = "inline";
    }
    else {
        var newHeight = document.getElementById('servicesInnerPanel').offsetHeight + 20;
        $("#servicesOuterPanel").animate({ height: newHeight + "px" }, 250,
        function () {
            var scrollTo = document.getElementById('servicesMainPanel').offsetTop;
            $('html, body').animate({ scrollTop: scrollTo + "px" }, 1000);
        });
        elem.className = "servicesShowButton";
        document.getElementById('locationsButton').style.display = "none";
    }
}

/* #endregion */
