(function(g,k){function j(){if(!b.isReady){try{m.documentElement.doScroll("left")}catch(a){setTimeout(j,1);return}b.ready()}}function d(a,c){c.src?b.ajax({url:c.src,async:!1,dataType:"script"}):b.globalEval(c.text||c.textContent||c.innerHTML||"");c.parentNode&&c.parentNode.removeChild(c)}function e(a,c,f,i,h,d){var Q=a.length;if(typeof c==="object"){for(var g in c)e(a,g,c[g],i,h,f);return a}if(f!==k){i=!d&&i&&b.isFunction(f);for(g=0;g<Q;g++)h(a[g],c,i?f.call(a[g],g,h(a[g],c)):f,d);return a}return Q?
h(a[0],c):k}function o(){return(new Date).getTime()}function t(){return!1}function r(){return!0}function q(a,c,f){f[0].type=a;return b.event.handle.apply(c,f)}function v(a){var c,f=[],i=[],h=arguments,e,d,g,k,j,l;d=b.data(this,"events");if(!(a.liveFired===this||!d||!d.live||a.button&&a.type==="click")){a.liveFired=this;var y=d.live.slice(0);for(k=0;k<y.length;k++)d=y[k],d.origType.replace(X,"")===a.type?i.push(d.selector):y.splice(k--,1);e=b(a.target).closest(i,a.currentTarget);j=0;for(l=e.length;j<
l;j++)for(k=0;k<y.length;k++)if(d=y[k],e[j].selector===d.selector){g=e[j].elem;i=null;if(d.preType==="mouseenter"||d.preType==="mouseleave")i=b(a.relatedTarget).closest(d.selector)[0];(!i||i!==g)&&f.push({elem:g,handleObj:d})}j=0;for(l=f.length;j<l;j++)if(e=f[j],a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,e.handleObj.origHandler.apply(e.elem,h)===!1){c=!1;break}return c}}function n(a,c){return"live."+(a&&a!=="*"?a+".":"")+c.replace(/\./g,"`").replace(/ /g,"&")}function z(a,
c){var f=0;c.each(function(){if(this.nodeName===(a[f]&&a[f].nodeName)){var c=b.data(a[f++]),h=b.data(this,c);if(c=c&&c.events){delete h.handle;h.events={};for(var e in c)for(var d in c[e])b.event.add(this,e,c[e][d],c[e][d].data)}}})}function l(a,c,f){var i,h,e,c=c&&c[0]?c[0].ownerDocument||c[0]:m;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&c===m&&!ka.test(a[0])&&(b.support.checkClone||!la.test(a[0])))h=!0,(e=b.fragments[a[0]])&&e!==1&&(i=e);i||(i=c.createDocumentFragment(),b.clean(a,
c,i,f));h&&(b.fragments[a[0]]=e?i:1);return{fragment:i,cacheable:h}}function A(a,c){var f={};b.each(ma.concat.apply([],ma.slice(0,c)),function(){f[this]=a});return f}function s(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var b=function(a,c){return new b.fn.init(a,c)},p=g.jQuery,Y=g.$,m=g.document,E,C=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Z=/^.[^:#\[\.,]*$/,F=/\S/,w=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,I=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,M=navigator.userAgent,N=!1,G=
[],J,K=Object.prototype.toString,O=Object.prototype.hasOwnProperty,D=Array.prototype.push,S=Array.prototype.slice,R=Array.prototype.indexOf;b.fn=b.prototype={init:function(a,c){var f,i,h;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(a==="body"&&!c)return this.context=m,this[0]=m.body,this.selector="body",this.length=1,this;if(typeof a==="string")if((f=C.exec(a))&&(f[1]||!c))if(f[1])return h=c?c.ownerDocument||c:m,(i=I.exec(a))?b.isPlainObject(c)?(a=[m.createElement(i[1])],
b.fn.attr.call(a,c,!0)):a=[h.createElement(i[1])]:(i=l([f[1]],[h]),a=(i.cacheable?i.fragment.cloneNode(!0):i.fragment).childNodes),b.merge(this,a);else{if(i=m.getElementById(f[2])){if(i.id!==f[2])return E.find(a);this.length=1;this[0]=i}this.context=m;this.selector=a;return this}else return!c&&/^\w+$/.test(a)?(this.selector=a,this.context=m,a=m.getElementsByTagName(a),b.merge(this,a)):!c||c.jquery?(c||E).find(a):b(c).find(a);else if(b.isFunction(a))return E.ready(a);if(a.selector!==k)this.selector=
a.selector,this.context=a.context;return b.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return S.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,c,f){var i=b();b.isArray(a)?D.apply(i,a):b.merge(i,a);i.prevObject=this;i.context=this.context;if(c==="find")i.selector=this.selector+(this.selector?" ":"")+f;else if(c)i.selector=this.selector+"."+c+"("+f+")";return i},each:function(a,
c){return b.each(this,a,c)},ready:function(a){b.bindReady();b.isReady?a.call(m,b):G&&G.push(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(S.apply(this,arguments),"slice",S.call(arguments).join(","))},map:function(a){return this.pushStack(b.map(this,function(c,b){return a.call(c,b,c)}))},end:function(){return this.prevObject||b(null)},push:D,sort:[].sort,splice:[].splice};
b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var a=arguments[0]||{},c=1,f=arguments.length,i=!1,h,e,d,g;typeof a==="boolean"&&(i=a,a=arguments[1]||{},c=2);typeof a!=="object"&&!b.isFunction(a)&&(a={});f===c&&(a=this,--c);for(;c<f;c++)if((h=arguments[c])!=null)for(e in h)d=a[e],g=h[e],a!==g&&(i&&g&&(b.isPlainObject(g)||b.isArray(g))?(d=d&&(b.isPlainObject(d)||b.isArray(d))?d:b.isArray(g)?[]:{},a[e]=b.extend(i,d,g)):g!==k&&(a[e]=g));return a};b.extend({noConflict:function(a){g.$=Y;if(a)g.jQuery=
p;return b},isReady:!1,ready:function(){if(!b.isReady){if(!m.body)return setTimeout(b.ready,13);b.isReady=!0;if(G){for(var a,c=0;a=G[c++];)a.call(m,b);G=null}b.fn.triggerHandler&&b(m).triggerHandler("ready")}},bindReady:function(){if(!N){N=!0;if(m.readyState==="complete")return b.ready();if(m.addEventListener)m.addEventListener("DOMContentLoaded",J,!1),g.addEventListener("load",b.ready,!1);else if(m.attachEvent){m.attachEvent("onreadystatechange",J);g.attachEvent("onload",b.ready);var a=!1;try{a=
g.frameElement==null}catch(c){}m.documentElement.doScroll&&a&&j()}}},isFunction:function(a){return K.call(a)==="[object Function]"},isArray:function(a){return K.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||K.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return!1;if(a.constructor&&!O.call(a,"constructor")&&!O.call(a.constructor.prototype,"isPrototypeOf"))return!1;for(var c in a);return c===k||O.call(a,c)},isEmptyObject:function(a){for(var c in a)return!1;return!0},error:function(a){throw a;
},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=b.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return g.JSON&&g.JSON.parse?g.JSON.parse(a):(new Function("return "+a))();else b.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&F.test(a)){var c=m.getElementsByTagName("head")[0]||m.documentElement,f=m.createElement("script");
f.type="text/javascript";b.support.scriptEval?f.appendChild(m.createTextNode(a)):f.text=a;c.insertBefore(f,c.firstChild);c.removeChild(f)}},nodeName:function(a,c){return a.nodeName&&a.nodeName.toUpperCase()===c.toUpperCase()},each:function(a,c,f){var i,h=0,e=a.length,d=e===k||b.isFunction(a);if(f)if(d)for(i in a){if(c.apply(a[i],f)===!1)break}else for(;h<e;){if(c.apply(a[h++],f)===!1)break}else if(d)for(i in a){if(c.call(a[i],i,a[i])===!1)break}else for(f=a[0];h<e&&c.call(f,h,f)!==!1;f=a[++h]);return a},
trim:function(a){return(a||"").replace(w,"")},makeArray:function(a,c){var f=c||[];a!=null&&(a.length==null||typeof a==="string"||b.isFunction(a)||typeof a!=="function"&&a.setInterval?D.call(f,a):b.merge(f,a));return f},inArray:function(a,c){if(c.indexOf)return c.indexOf(a);for(var b=0,i=c.length;b<i;b++)if(c[b]===a)return b;return-1},merge:function(a,c){var b=a.length,i=0;if(typeof c.length==="number")for(var h=c.length;i<h;i++)a[b++]=c[i];else for(;c[i]!==k;)a[b++]=c[i++];a.length=b;return a},grep:function(a,
c,b){for(var i=[],h=0,e=a.length;h<e;h++)!b!==!c(a[h],h)&&i.push(a[h]);return i},map:function(a,c,b){for(var i=[],h,e=0,d=a.length;e<d;e++)h=c(a[e],e,b),h!=null&&(i[i.length]=h);return i.concat.apply([],i)},guid:1,proxy:function(a,c,f){arguments.length===2&&(typeof c==="string"?(f=a,a=f[c],c=k):c&&!b.isFunction(c)&&(f=c,c=k));!c&&a&&(c=function(){return a.apply(f||this,arguments)});if(a)c.guid=a.guid=a.guid||c.guid||b.guid++;return c},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||
/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});M=b.uaMatch(M);if(M.browser)b.browser[M.browser]=!0,b.browser.version=M.version;if(b.browser.webkit)b.browser.safari=!0;if(R)b.inArray=function(a,c){return R.call(c,a)};E=b(m);m.addEventListener?J=function(){m.removeEventListener("DOMContentLoaded",J,!1);b.ready()}:m.attachEvent&&(J=function(){m.readyState===
"complete"&&(m.detachEvent("onreadystatechange",J),b.ready())});(function(){b.support={};var a=m.documentElement,c=m.createElement("script"),f=m.createElement("div"),i="script"+o();f.style.display="none";f.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var h=f.getElementsByTagName("*"),e=f.getElementsByTagName("a")[0];if(h&&h.length&&e){b.support={leadingWhitespace:f.firstChild.nodeType===3,tbody:!f.getElementsByTagName("tbody").length,
htmlSerialize:!!f.getElementsByTagName("link").length,style:/red/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:f.getElementsByTagName("input")[0].value==="on",optSelected:m.createElement("select").appendChild(m.createElement("option")).selected,parentNode:f.removeChild(f.appendChild(m.createElement("div"))).parentNode===null,deleteExpando:!0,checkClone:!1,scriptEval:!1,noCloneEvent:!0,boxModel:null};
c.type="text/javascript";try{c.appendChild(m.createTextNode("window."+i+"=1;"))}catch(d){}a.insertBefore(c,a.firstChild);if(g[i])b.support.scriptEval=!0,delete g[i];try{delete c.test}catch(k){b.support.deleteExpando=!1}a.removeChild(c);f.attachEvent&&f.fireEvent&&(f.attachEvent("onclick",function Ba(){b.support.noCloneEvent=!1;f.detachEvent("onclick",Ba)}),f.cloneNode(!0).fireEvent("onclick"));f=m.createElement("div");f.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=m.createDocumentFragment();
a.appendChild(f.firstChild);b.support.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked;b(function(){var a=m.createElement("div");a.style.width=a.style.paddingLeft="1px";m.body.appendChild(a);b.boxModel=b.support.boxModel=a.offsetWidth===2;m.body.removeChild(a).style.display="none"});a=function(a){var c=m.createElement("div"),a="on"+a,b=a in c;b||(c.setAttribute(a,"return;"),b=typeof c[a]==="function");return b};b.support.submitBubbles=a("submit");b.support.changeBubbles=a("change");a=c=
f=h=e=null}})();b.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var H="jQuery"+o(),T=0,P={};b.extend({cache:{},expando:H,noData:{embed:!0,object:!0,applet:!0},data:function(a,c,f){if(!a.nodeName||!b.noData[a.nodeName.toLowerCase()]){var a=a==g?P:a,i=a[H],h=b.cache;if(!i&&typeof c==="string"&&f===k)return null;i||(i=++T);typeof c==="object"?
(a[H]=i,h[i]=b.extend(!0,{},c)):h[i]||(a[H]=i,h[i]={});a=h[i];f!==k&&(a[c]=f);return typeof c==="string"?a[c]:a}},removeData:function(a,c){if(!a.nodeName||!b.noData[a.nodeName.toLowerCase()]){var a=a==g?P:a,f=a[H],i=b.cache,h=i[f];c?h&&(delete h[c],b.isEmptyObject(h)&&b.removeData(a)):(b.support.deleteExpando?delete a[b.expando]:a.removeAttribute&&a.removeAttribute(b.expando),delete i[f])}}});b.fn.extend({data:function(a,c){if(typeof a==="undefined"&&this.length)return b.data(this[0]);else if(typeof a===
"object")return this.each(function(){b.data(this,a)});var f=a.split(".");f[1]=f[1]?"."+f[1]:"";if(c===k){var i=this.triggerHandler("getData"+f[1]+"!",[f[0]]);i===k&&this.length&&(i=b.data(this[0],a));return i===k&&f[1]?this.data(f[0]):i}else return this.trigger("setData"+f[1]+"!",[f[0],c]).each(function(){b.data(this,a,c)})},removeData:function(a){return this.each(function(){b.removeData(this,a)})}});b.extend({queue:function(a,c,f){if(a){var c=(c||"fx")+"queue",i=b.data(a,c);if(!f)return i||[];!i||
b.isArray(f)?i=b.data(a,c,b.makeArray(f)):i.push(f);return i}},dequeue:function(a,c){var c=c||"fx",f=b.queue(a,c),i=f.shift();i==="inprogress"&&(i=f.shift());i&&(c==="fx"&&f.unshift("inprogress"),i.call(a,function(){b.dequeue(a,c)}))}});b.fn.extend({queue:function(a,c){typeof a!=="string"&&(c=a,a="fx");if(c===k)return b.queue(this[0],a);return this.each(function(){var f=b.queue(this,a,c);a==="fx"&&f[0]!=="inprogress"&&b.dequeue(this,a)})},dequeue:function(a){return this.each(function(){b.dequeue(this,
a)})},delay:function(a,c){a=b.fx?b.fx.speeds[a]||a:a;c=c||"fx";return this.queue(c,function(){var f=this;setTimeout(function(){b.dequeue(f,c)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var U=/[\n\t]/g,V=/\s+/,u=/\r/g,y=/href|src|style/,B=/(button|input)/i,x=/(button|input|object|select|textarea)/i,Ca=/^(a|area)$/i,na=/radio|checkbox/;b.fn.extend({attr:function(a,c){return e(this,a,c,!0,b.attr)},removeAttr:function(a){return this.each(function(){b.attr(this,a,"");this.nodeType===
1&&this.removeAttribute(a)})},addClass:function(a){if(b.isFunction(a))return this.each(function(c){var f=b(this);f.addClass(a.call(this,c,f.attr("class")))});if(a&&typeof a==="string")for(var c=(a||"").split(V),f=0,i=this.length;f<i;f++){var h=this[f];if(h.nodeType===1)if(h.className){for(var e=" "+h.className+" ",d=h.className,g=0,k=c.length;g<k;g++)e.indexOf(" "+c[g]+" ")<0&&(d+=" "+c[g]);h.className=b.trim(d)}else h.className=a}return this},removeClass:function(a){if(b.isFunction(a))return this.each(function(c){var f=
b(this);f.removeClass(a.call(this,c,f.attr("class")))});if(a&&typeof a==="string"||a===k)for(var c=(a||"").split(V),f=0,i=this.length;f<i;f++){var h=this[f];if(h.nodeType===1&&h.className)if(a){for(var e=(" "+h.className+" ").replace(U," "),d=0,g=c.length;d<g;d++)e=e.replace(" "+c[d]+" "," ");h.className=b.trim(e)}else h.className=""}return this},toggleClass:function(a,c){var f=typeof a,i=typeof c==="boolean";if(b.isFunction(a))return this.each(function(f){var i=b(this);i.toggleClass(a.call(this,
f,i.attr("class"),c),c)});return this.each(function(){if(f==="string")for(var h,e=0,d=b(this),g=c,k=a.split(V);h=k[e++];)g=i?g:!d.hasClass(h),d[g?"addClass":"removeClass"](h);else if(f==="undefined"||f==="boolean")this.className&&b.data(this,"__className__",this.className),this.className=this.className||a===!1?"":b.data(this,"__className__")||""})},hasClass:function(a){for(var a=" "+a+" ",c=0,b=this.length;c<b;c++)if((" "+this[c].className+" ").replace(U," ").indexOf(a)>-1)return!0;return!1},val:function(a){if(a===
k){var c=this[0];if(c){if(b.nodeName(c,"option"))return(c.attributes.value||{}).specified?c.value:c.text;if(b.nodeName(c,"select")){var f=c.selectedIndex,i=[],h=c.options,c=c.type==="select-one";if(f<0)return null;for(var e=c?f:0,f=c?f+1:h.length;e<f;e++){var d=h[e];if(d.selected){a=b(d).val();if(c)return a;i.push(a)}}return i}if(na.test(c.type)&&!b.support.checkOn)return c.getAttribute("value")===null?"on":c.value;return(c.value||"").replace(u,"")}return k}var g=b.isFunction(a);return this.each(function(c){var f=
b(this),h=a;if(this.nodeType===1)if(g&&(h=a.call(this,c,f.val())),typeof h==="number"&&(h+=""),b.isArray(h)&&na.test(this.type))this.checked=b.inArray(f.val(),h)>=0;else if(b.nodeName(this,"select")){var i=b.makeArray(h);b("option",this).each(function(){this.selected=b.inArray(b(this).val(),i)>=0});if(!i.length)this.selectedIndex=-1}else this.value=h})}});b.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,f,i){if(!a||a.nodeType===3||a.nodeType===
8)return k;if(i&&c in b.attrFn)return b(a)[c](f);var i=a.nodeType!==1||!b.isXMLDoc(a),h=f!==k,c=i&&b.props[c]||c;if(a.nodeType===1){var e=y.test(c);if(c in a&&i&&!e){h&&(c==="type"&&B.test(a.nodeName)&&a.parentNode&&b.error("type property can't be changed"),a[c]=f);if(b.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex")return(c=a.getAttributeNode("tabIndex"))&&c.specified?c.value:x.test(a.nodeName)||Ca.test(a.nodeName)&&a.href?0:k;return a[c]}if(!b.support.style&&
i&&c==="style"){if(h)a.style.cssText=""+f;return a.style.cssText}h&&a.setAttribute(c,""+f);a=!b.support.hrefNormalized&&i&&e?a.getAttribute(c,2):a.getAttribute(c);return a===null?k:a}return b.style(a,c,f)}});var X=/\.(.*)$/,Da=function(a){return a.replace(/[^\w\s\.\|`]/g,function(a){return"\\"+a})};b.event={add:function(a,c,f,i){if(!(a.nodeType===3||a.nodeType===8)){a.setInterval&&a!==g&&!a.frameElement&&(a=g);var h,e;if(f.handler)h=f,f=h.handler;if(!f.guid)f.guid=b.guid++;if(e=b.data(a)){var d=e.events=
e.events||{},j=e.handle;if(!j)e.handle=j=function(){return typeof b!=="undefined"&&!b.event.triggered?b.event.handle.apply(j.elem,arguments):k};j.elem=a;for(var c=c.split(" "),l,y=0,o;l=c[y++];){e=h?b.extend({},h):{handler:f,data:i};l.indexOf(".")>-1?(o=l.split("."),l=o.shift(),e.namespace=o.slice(0).sort().join(".")):(o=[],e.namespace="");e.type=l;e.guid=f.guid;var n=d[l],B=b.event.special[l]||{};if(!n&&(n=d[l]=[],!B.setup||B.setup.call(a,i,o,j)===!1))a.addEventListener?a.addEventListener(l,j,!1):
a.attachEvent&&a.attachEvent("on"+l,j);if(B.add&&(B.add.call(a,e),!e.handler.guid))e.handler.guid=f.guid;n.push(e);b.event.global[l]=!0}a=null}}},global:{},remove:function(a,c,f,i){if(!(a.nodeType===3||a.nodeType===8)){var h,e=0,d,g,k,j,l,y,o=b.data(a),B=o&&o.events;if(o&&B){if(c&&c.type)f=c.handler,c=c.type;if(!c||typeof c==="string"&&c.charAt(0)===".")for(h in c=c||"",B)b.event.remove(a,h+c);else{for(c=c.split(" ");h=c[e++];)if(j=h,d=h.indexOf(".")<0,g=[],d||(g=h.split("."),h=g.shift(),k=RegExp("(^|\\.)"+
b.map(g.slice(0).sort(),Da).join("\\.(?:.*\\.)?")+"(\\.|$)")),l=B[h])if(f){j=b.event.special[h]||{};for(n=i||0;n<l.length;n++)if(y=l[n],f.guid===y.guid){if(d||k.test(y.namespace))i==null&&l.splice(n--,1),j.remove&&j.remove.call(a,y);if(i!=null)break}if(l.length===0||i!=null&&l.length===1)(!j.teardown||j.teardown.call(a,g)===!1)&&oa(a,h,o.handle),delete B[h]}else for(var n=0;n<l.length;n++)if(y=l[n],d||k.test(y.namespace))b.event.remove(a,j,y.handler,n),l.splice(n--,1);if(b.isEmptyObject(B)){if(c=
o.handle)c.elem=null;delete o.events;delete o.handle;b.isEmptyObject(o)&&b.removeData(a)}}}}},trigger:function(a,c,f,i){var h=a.type||a;if(!i){a=typeof a==="object"?a[H]?a:b.extend(b.Event(h),a):b.Event(h);if(h.indexOf("!")>=0)a.type=h=h.slice(0,-1),a.exclusive=!0;f||(a.stopPropagation(),b.event.global[h]&&b.each(b.cache,function(){this.events&&this.events[h]&&b.event.trigger(a,c,this.handle.elem)}));if(!f||f.nodeType===3||f.nodeType===8)return k;a.result=k;a.target=f;c=b.makeArray(c);c.unshift(a)}a.currentTarget=
f;(i=b.data(f,"handle"))&&i.apply(f,c);i=f.parentNode||f.ownerDocument;try{if((!f||!f.nodeName||!b.noData[f.nodeName.toLowerCase()])&&f["on"+h]&&f["on"+h].apply(f,c)===!1)a.result=!1}catch(e){}if(!a.isPropagationStopped()&&i)b.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var i=a.target,d,g=b.nodeName(i,"a")&&h==="click",l=b.event.special[h]||{};if((!l._default||l._default.call(f,a)===!1)&&!g&&(!i||!i.nodeName||!b.noData[i.nodeName.toLowerCase()])){try{if(i[h])(d=i["on"+h])&&(i["on"+h]=
null),b.event.triggered=!0,i[h]()}catch(j){}d&&(i["on"+h]=d);b.event.triggered=!1}}},handle:function(a){var c,f,i,h,a=arguments[0]=b.event.fix(a||g.event);a.currentTarget=this;c=a.type.indexOf(".")<0&&!a.exclusive;if(!c)f=a.type.split("."),a.type=f.shift(),i=RegExp("(^|\\.)"+f.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");h=b.data(this,"events");f=h[a.type];if(h&&f){f=f.slice(0);h=0;for(var e=f.length;h<e;h++){var d=f[h];if(c||i.test(d.namespace)){a.handler=d.handler;a.data=d.data;a.handleObj=
d;d=d.handler.apply(this,arguments);if(d!==k)a.result=d,d===!1&&(a.preventDefault(),a.stopPropagation());if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix:function(a){if(a[H])return a;for(var c=a,a=b.Event(c),f=this.props.length,i;f;)i=this.props[--f],a[i]=c[i];if(!a.target)a.target=a.srcElement||m;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null)c=m.documentElement,f=m.body,a.pageX=a.clientX+(c&&c.scrollLeft||f&&f.scrollLeft||0)-(c&&c.clientLeft||f&&f.clientLeft||0),a.pageY=a.clientY+(c&&c.scrollTop||f&&f.scrollTop||
0)-(c&&c.clientTop||f&&f.clientTop||0);if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==k)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:b.proxy,special:{ready:{setup:b.bindReady,teardown:b.noop},live:{add:function(a){b.event.add(this,a.origType,b.extend({},a,{handler:v}))},remove:function(a){var c=!0,f=a.origType.replace(X,"");b.each(b.data(this,"events").live||
[],function(){if(f===this.origType.replace(X,""))return c=!1});c&&b.event.remove(this,a.origType,v)}},beforeunload:{setup:function(a,c,b){if(this.setInterval)this.onbeforeunload=b;return!1},teardown:function(a,c){if(this.onbeforeunload===c)this.onbeforeunload=null}}}};var oa=m.removeEventListener?function(a,c,b){a.removeEventListener(c,b,!1)}:function(a,c,b){a.detachEvent("on"+c,b)};b.Event=function(a){if(!this.preventDefault)return new b.Event(a);a&&a.type?(this.originalEvent=a,this.type=a.type):
this.type=a;this.timeStamp=o();this[H]=!0};b.Event.prototype={preventDefault:function(){this.isDefaultPrevented=r;var a=this.originalEvent;if(a)a.preventDefault&&a.preventDefault(),a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=r;var a=this.originalEvent;if(a)a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=r;this.stopPropagation()},isDefaultPrevented:t,isPropagationStopped:t,isImmediatePropagationStopped:t};
var pa=function(a){var c=a.relatedTarget;try{for(;c&&c!==this;)c=c.parentNode;if(c!==this)a.type=a.data,b.event.handle.apply(this,arguments)}catch(f){}},qa=function(a){a.type=a.data;b.event.handle.apply(this,arguments)};b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,c){b.event.special[a]={setup:function(f){b.event.add(this,c,f&&f.selector?qa:pa,a)},teardown:function(a){b.event.remove(this,c,a&&a.selector?qa:pa)}}});if(!b.support.submitBubbles)b.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!==
"form")b.event.add(this,"click.specialSubmit",function(a){var c=a.target,f=c.type;if((f==="submit"||f==="image")&&b(c).closest("form").length)return q("submit",this,arguments)}),b.event.add(this,"keypress.specialSubmit",function(a){var c=a.target,f=c.type;if((f==="text"||f==="password")&&b(c).closest("form").length&&a.keyCode===13)return q("submit",this,arguments)});else return!1},teardown:function(){b.event.remove(this,".specialSubmit")}};if(!b.support.changeBubbles){var ca=/textarea|input|select/i,
da,ra=function(a){var c=a.type,f=a.value;if(c==="radio"||c==="checkbox")f=a.checked;else if(c==="select-multiple")f=a.selectedIndex>-1?b.map(a.options,function(a){return a.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")f=a.selectedIndex;return f},ea=function(a,c){var f=a.target,i,h;if(ca.test(f.nodeName)&&!f.readOnly&&(i=b.data(f,"_change_data"),h=ra(f),(a.type!=="focusout"||f.type!=="radio")&&b.data(f,"_change_data",h),!(i===k||h===i)))if(i!=null||h)return a.type="change",b.event.trigger(a,
c,f)};b.event.special.change={filters:{focusout:ea,click:function(a){var c=a.target,b=c.type;if(b==="radio"||b==="checkbox"||c.nodeName.toLowerCase()==="select")return ea.call(this,a)},keydown:function(a){var c=a.target,b=c.type;if(a.keyCode===13&&c.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(b==="checkbox"||b==="radio")||b==="select-multiple")return ea.call(this,a)},beforeactivate:function(a){a=a.target;b.data(a,"_change_data",ra(a))}},setup:function(){if(this.type==="file")return!1;for(var a in da)b.event.add(this,
a+".specialChange",da[a]);return ca.test(this.nodeName)},teardown:function(){b.event.remove(this,".specialChange");return ca.test(this.nodeName)}};da=b.event.special.change.filters}m.addEventListener&&b.each({focus:"focusin",blur:"focusout"},function(a,c){function f(a){a=b.event.fix(a);a.type=c;return b.event.handle.call(this,a)}b.event.special[c]={setup:function(){this.addEventListener(a,f,!0)},teardown:function(){this.removeEventListener(a,f,!0)}}});b.each(["bind","one"],function(a,c){b.fn[c]=function(a,
i,h){if(typeof a==="object"){for(var e in a)this[c](e,i,a[e],h);return this}b.isFunction(i)&&(h=i,i=k);var d=c==="one"?b.proxy(h,function(a){b(this).unbind(a,d);return h.apply(this,arguments)}):h;if(a==="unload"&&c!=="one")this.one(a,i,h);else{e=0;for(var g=this.length;e<g;e++)b.event.add(this[e],a,d,i)}return this}});b.fn.extend({unbind:function(a,c){if(typeof a==="object"&&!a.preventDefault)for(var f in a)this.unbind(f,a[f]);else{f=0;for(var i=this.length;f<i;f++)b.event.remove(this[f],a,c)}return this},
delegate:function(a,c,b,i){return this.live(c,b,i,a)},undelegate:function(a,c,b){return arguments.length===0?this.unbind("live"):this.die(c,null,b,a)},trigger:function(a,c){return this.each(function(){b.event.trigger(a,c,this)})},triggerHandler:function(a,c){if(this[0]){var f=b.Event(a);f.preventDefault();f.stopPropagation();b.event.trigger(f,c,this[0]);return f.result}},toggle:function(a){for(var c=arguments,f=1;f<c.length;)b.proxy(a,c[f++]);return this.click(b.proxy(a,function(i){var h=(b.data(this,
"lastToggle"+a.guid)||0)%f;b.data(this,"lastToggle"+a.guid,h+1);i.preventDefault();return c[h].apply(this,arguments)||!1}))},hover:function(a,c){return this.mouseenter(a).mouseleave(c||a)}});var sa={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};b.each(["live","die"],function(a,c){b.fn[c]=function(a,i,h,e){var d,g=0,l,j,y=e||this.selector,o=e?this:b(this.context);b.isFunction(i)&&(h=i,i=k);for(a=(a||"").split(" ");(d=a[g++])!=null;)e=X.exec(d),l="",e&&(l=e[0],d=d.replace(X,
"")),d==="hover"?a.push("mouseenter"+l,"mouseleave"+l):(j=d,d==="focus"||d==="blur"?(a.push(sa[d]+l),d+=l):d=(sa[d]||d)+l,c==="live"?o.each(function(){b.event.add(this,n(d,y),{data:i,selector:y,handler:h,origType:d,origHandler:h,preType:j})}):o.unbind(n(d,y),h));return this}});b.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,c){b.fn[c]=
function(a){return a?this.bind(c,a):this.trigger(c)};b.attrFn&&(b.attrFn[c]=!0)});g.attachEvent&&!g.addEventListener&&g.attachEvent("onunload",function(){for(var a in b.cache)if(b.cache[a].handle)try{b.event.remove(b.cache[a].handle.elem)}catch(c){}});(function(){function a(c){for(var b="",f,h=0;c[h];h++)f=c[h],f.nodeType===3||f.nodeType===4?b+=f.nodeValue:f.nodeType!==8&&(b+=a(f.childNodes));return b}function c(a,c,b,f,h,i){for(var h=0,e=f.length;h<e;h++){var d=f[h];if(d){for(var d=d[a],j=!1;d;){if(d.sizcache===
b){j=f[d.sizset];break}if(d.nodeType===1&&!i)d.sizcache=b,d.sizset=h;if(d.nodeName.toLowerCase()===c){j=d;break}d=d[a]}f[h]=j}}}function f(a,c,b,f,h,i){for(var h=0,d=f.length;h<d;h++){var e=f[h];if(e){for(var e=e[a],j=!1;e;){if(e.sizcache===b){j=f[e.sizset];break}if(e.nodeType===1){if(!i)e.sizcache=b,e.sizset=h;if(typeof c!=="string"){if(e===c){j=!0;break}}else if(l.filter(c,[e]).length>0){j=e;break}}e=e[a]}f[h]=j}}}var i=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
h=0,e=Object.prototype.toString,d=!1,g=!0;[0,0].sort(function(){g=!1;return 0});var l=function(a,c,b,f){var b=b||[],h=c=c||m;if(c.nodeType!==1&&c.nodeType!==9)return[];if(!a||typeof a!=="string")return b;for(var d=[],g,k,o,B,p=!0,Q=A(c),x=a;(i.exec(""),g=i.exec(x))!==null;)if(x=g[3],d.push(g[1]),g[2]){B=g[3];break}if(d.length>1&&y.exec(a))if(d.length===2&&j.relative[d[0]])k=t(d[0]+d[1],c);else for(k=j.relative[d[0]]?[c]:l(d.shift(),c);d.length;)a=d.shift(),j.relative[a]&&(a+=d.shift()),k=t(a,k);else if(!f&&
d.length>1&&c.nodeType===9&&!Q&&j.match.ID.test(d[0])&&!j.match.ID.test(d[d.length-1])&&(g=l.find(d.shift(),c,Q),c=g.expr?l.filter(g.expr,g.set)[0]:g.set[0]),c){g=f?{expr:d.pop(),set:n(f)}:l.find(d.pop(),d.length===1&&(d[0]==="~"||d[0]==="+")&&c.parentNode?c.parentNode:c,Q);k=g.expr?l.filter(g.expr,g.set):g.set;for(d.length>0?o=n(k):p=!1;d.length;){var r=d.pop();g=r;j.relative[r]?g=d.pop():r="";g==null&&(g=c);j.relative[r](o,g,Q)}}else o=[];o||(o=k);o||l.error(r||a);if(e.call(o)==="[object Array]")if(p)if(c&&
c.nodeType===1)for(a=0;o[a]!=null;a++)o[a]&&(o[a]===!0||o[a].nodeType===1&&s(c,o[a]))&&b.push(k[a]);else for(a=0;o[a]!=null;a++)o[a]&&o[a].nodeType===1&&b.push(k[a]);else b.push.apply(b,o);else n(o,b);B&&(l(B,h,b,f),l.uniqueSort(b));return b};l.uniqueSort=function(a){if(p&&(d=g,a.sort(p),d))for(var c=1;c<a.length;c++)a[c]===a[c-1]&&a.splice(c--,1);return a};l.matches=function(a,c){return l(a,null,null,c)};l.find=function(a,c,b){var f,h;if(!a)return[];for(var i=0,d=j.order.length;i<d;i++){var e=j.order[i];
if(h=j.leftMatch[e].exec(a)){var g=h[1];h.splice(1,1);if(g.substr(g.length-1)!=="\\"&&(h[1]=(h[1]||"").replace(/\\/g,""),f=j.find[e](h,c,b),f!=null)){a=a.replace(j.match[e],"");break}}}f||(f=c.getElementsByTagName("*"));return{set:f,expr:a}};l.filter=function(a,c,b,f){for(var h=a,i=[],d=c,e,g,o=c&&c[0]&&A(c[0]);a&&c.length;){for(var y in j.filter)if((e=j.leftMatch[y].exec(a))!=null&&e[2]){var n=j.filter[y],B,p;p=e[1];g=!1;e.splice(1,1);if(p.substr(p.length-1)!=="\\"){d===i&&(i=[]);if(j.preFilter[y])if(e=
j.preFilter[y](e,d,b,i,f,o)){if(e===!0)continue}else g=B=!0;if(e)for(var m=0;(p=d[m])!=null;m++)if(p){B=n(p,e,m,d);var Q=f^!!B;b&&B!=null?Q?g=!0:d[m]=!1:Q&&(i.push(p),g=!0)}if(B!==k){b||(d=i);a=a.replace(j.match[y],"");if(!g)return[];break}}}if(a===h)if(g==null)l.error(a);else break;h=a}return d};l.error=function(a){throw"Syntax error, unrecognized expression: "+a;};var j=l.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,
ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")}},relative:{"+":function(a,c){var b=typeof c==="string",
f=b&&!/\W/.test(c),b=b&&!f;f&&(c=c.toLowerCase());for(var f=0,h=a.length,i;f<h;f++)if(i=a[f]){for(;(i=i.previousSibling)&&i.nodeType!==1;);a[f]=b||i&&i.nodeName.toLowerCase()===c?i||!1:i===c}b&&l.filter(c,a,!0)},">":function(a,c){var b=typeof c==="string";if(b&&!/\W/.test(c))for(var c=c.toLowerCase(),f=0,h=a.length;f<h;f++){var i=a[f];if(i)b=i.parentNode,a[f]=b.nodeName.toLowerCase()===c?b:!1}else{f=0;for(h=a.length;f<h;f++)(i=a[f])&&(a[f]=b?i.parentNode:i.parentNode===c);b&&l.filter(c,a,!0)}},"":function(a,
b,i){var d=h++,e=f;if(typeof b==="string"&&!/\W/.test(b))var g=b=b.toLowerCase(),e=c;e("parentNode",b,d,a,g,i)},"~":function(a,b,i){var d=h++,e=f;if(typeof b==="string"&&!/\W/.test(b))var g=b=b.toLowerCase(),e=c;e("previousSibling",b,d,a,g,i)}},find:{ID:function(a,c,b){if(typeof c.getElementById!=="undefined"&&!b)return(a=c.getElementById(a[1]))?[a]:[]},NAME:function(a,c){if(typeof c.getElementsByName!=="undefined"){for(var b=[],f=c.getElementsByName(a[1]),h=0,i=f.length;h<i;h++)f[h].getAttribute("name")===
a[1]&&b.push(f[h]);return b.length===0?null:b}},TAG:function(a,c){return c.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,c,b,f,h,i){a=" "+a[1].replace(/\\/g,"")+" ";if(i)return a;for(var i=0,d;(d=c[i])!=null;i++)d&&(h^(d.className&&(" "+d.className+" ").replace(/[\t\n]/g," ").indexOf(a)>=0)?b||f.push(d):b&&(c[i]=!1));return!1},ID:function(a){return a[1].replace(/\\/g,"")},TAG:function(a){return a[1].toLowerCase()},CHILD:function(a){if(a[1]==="nth"){var c=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(a[2]===
"even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=c[1]+(c[2]||1)-0;a[3]=c[3]-0}a[0]=h++;return a},ATTR:function(a,c,b,f,h,i){c=a[1].replace(/\\/g,"");!i&&j.attrMap[c]&&(a[1]=j.attrMap[c]);a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(a,c,b,f,h){if(a[1]==="not")if((i.exec(a[3])||"").length>1||/^\w/.test(a[3]))a[3]=l(a[3],null,null,c);else return a=l.filter(a[3],c,b,1^h),b||f.push.apply(f,a),!1;else if(j.match.POS.test(a[0])||j.match.CHILD.test(a[0]))return!0;
return a},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){return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,c,b){return!!l(b[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.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,c){return c===0},last:function(a,c,b,f){return c===
f.length-1},even:function(a,c){return c%2===0},odd:function(a,c){return c%2===1},lt:function(a,c,b){return c<b[3]-0},gt:function(a,c,b){return c>b[3]-0},nth:function(a,c,b){return b[3]-0===c},eq:function(a,c,b){return b[3]-0===c}},filter:{PSEUDO:function(c,b,f,h){var i=b[1],d=j.filters[i];if(d)return d(c,f,b,h);else if(i==="contains")return(c.textContent||c.innerText||a([c])||"").indexOf(b[3])>=0;else if(i==="not"){b=b[3];f=0;for(h=b.length;f<h;f++)if(b[f]===c)return!1;return!0}else l.error("Syntax error, unrecognized expression: "+
i)},CHILD:function(a,c){var b=c[1],f=a;switch(b){case "only":case "first":for(;f=f.previousSibling;)if(f.nodeType===1)return!1;if(b==="first")return!0;f=a;case "last":for(;f=f.nextSibling;)if(f.nodeType===1)return!1;return!0;case "nth":var b=c[2],h=c[3];if(b===1&&h===0)return!0;var i=c[0],d=a.parentNode;if(d&&(d.sizcache!==i||!a.nodeIndex)){for(var e=0,f=d.firstChild;f;f=f.nextSibling)if(f.nodeType===1)f.nodeIndex=++e;d.sizcache=i}f=a.nodeIndex-h;return b===0?f===0:f%b===0&&f/b>=0}},ID:function(a,
c){return a.nodeType===1&&a.getAttribute("id")===c},TAG:function(a,c){return c==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===c},CLASS:function(a,c){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(c)>-1},ATTR:function(a,c){var b=c[1],b=j.attrHandle[b]?j.attrHandle[b](a):a[b]!=null?a[b]:a.getAttribute(b),f=b+"",h=c[2],i=c[4];return b==null?h==="!=":h==="="?f===i:h==="*="?f.indexOf(i)>=0:h==="~="?(" "+f+" ").indexOf(i)>=0:!i?f&&b!==!1:h==="!="?f!==i:h==="^="?f.indexOf(i)===0:h==="$="?
f.substr(f.length-i.length)===i:h==="|="?f===i||f.substr(0,i.length+1)===i+"-":!1},POS:function(a,c,b,f){var h=j.setFilters[c[2]];if(h)return h(a,b,c,f)}}},y=j.match.POS,o;for(o in j.match)j.match[o]=RegExp(j.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),j.leftMatch[o]=RegExp(/(^(?:.|\r|\n)*?)/.source+j.match[o].source.replace(/\\(\d+)/g,function(a,c){return"\\"+(c-0+1)}));var n=function(a,c){a=Array.prototype.slice.call(a,0);if(c)return c.push.apply(c,a),c;return a};try{Array.prototype.slice.call(m.documentElement.childNodes,
0)}catch(B){n=function(a,c){var b=c||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(b,a);else if(typeof a.length==="number")for(var f=0,h=a.length;f<h;f++)b.push(a[f]);else for(f=0;a[f];f++)b.push(a[f]);return b}}var p;m.documentElement.compareDocumentPosition?p=function(a,c){if(!a.compareDocumentPosition||!c.compareDocumentPosition)return a==c&&(d=!0),a.compareDocumentPosition?-1:1;var b=a.compareDocumentPosition(c)&4?-1:a===c?0:1;b===0&&(d=!0);return b}:"sourceIndex"in m.documentElement?
p=function(a,c){if(!a.sourceIndex||!c.sourceIndex)return a==c&&(d=!0),a.sourceIndex?-1:1;var b=a.sourceIndex-c.sourceIndex;b===0&&(d=!0);return b}:m.createRange&&(p=function(a,c){if(!a.ownerDocument||!c.ownerDocument)return a==c&&(d=!0),a.ownerDocument?-1:1;var b=a.ownerDocument.createRange(),f=c.ownerDocument.createRange();b.setStart(a,0);b.setEnd(a,0);f.setStart(c,0);f.setEnd(c,0);b=b.compareBoundaryPoints(Range.START_TO_END,f);b===0&&(d=!0);return b});(function(){var a=m.createElement("div"),c=
"script"+(new Date).getTime();a.innerHTML="<a name='"+c+"'/>";var b=m.documentElement;b.insertBefore(a,b.firstChild);if(m.getElementById(c))j.find.ID=function(a,c,b){if(typeof c.getElementById!=="undefined"&&!b)return(c=c.getElementById(a[1]))?c.id===a[1]||typeof c.getAttributeNode!=="undefined"&&c.getAttributeNode("id").nodeValue===a[1]?[c]:k:[]},j.filter.ID=function(a,c){var b=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&b&&b.nodeValue===c};b.removeChild(a);
b=a=null})();(function(){var a=m.createElement("div");a.appendChild(m.createComment(""));if(a.getElementsByTagName("*").length>0)j.find.TAG=function(a,c){var b=c.getElementsByTagName(a[1]);if(a[1]==="*"){for(var f=[],h=0;b[h];h++)b[h].nodeType===1&&f.push(b[h]);b=f}return b};a.innerHTML="<a href='#'></a>";if(a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#")j.attrHandle.href=function(a){return a.getAttribute("href",2)};a=null})();m.querySelectorAll&&
function(){var a=l,c=m.createElement("div");c.innerHTML="<p class='TEST'></p>";if(!(c.querySelectorAll&&c.querySelectorAll(".TEST").length===0)){l=function(c,b,f,h){b=b||m;if(!h&&b.nodeType===9&&!A(b))try{return n(b.querySelectorAll(c),f)}catch(i){}return a(c,b,f,h)};for(var b in a)l[b]=a[b];c=null}}();(function(){var a=m.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",a.getElementsByClassName("e").length!==1))j.order.splice(1,0,"CLASS"),j.find.CLASS=function(a,c,b){if(typeof c.getElementsByClassName!=="undefined"&&!b)return c.getElementsByClassName(a[1])},a=null})();var s=m.compareDocumentPosition?function(a,c){return!!(a.compareDocumentPosition(c)&16)}:function(a,c){return a!==c&&(a.contains?a.contains(c):!0)},A=function(a){return(a=(a?a.ownerDocument||a:0).documentElement)?a.nodeName!=="HTML":!1},t=function(a,c){for(var b=[],f="",h,i=c.nodeType?[c]:c;h=j.match.PSEUDO.exec(a);)f+=
h[0],a=a.replace(j.match.PSEUDO,"");a=j.relative[a]?a+"*":a;h=0;for(var d=i.length;h<d;h++)l(a,i[h],b);return l.filter(f,b)};b.find=l;b.expr=l.selectors;b.expr[":"]=b.expr.filters;b.unique=l.uniqueSort;b.text=a;b.isXMLDoc=A;b.contains=s})();var Ea=/Until$/,Fa=/^(?:parents|prevUntil|prevAll)/,Ga=/,/,S=Array.prototype.slice,ta=function(a,c,f){if(b.isFunction(c))return b.grep(a,function(a,b){return!!c.call(a,b,a)===f});else if(c.nodeType)return b.grep(a,function(a){return a===c===f});else if(typeof c===
"string"){var i=b.grep(a,function(a){return a.nodeType===1});if(Z.test(c))return b.filter(c,i,!f);else c=b.filter(c,i)}return b.grep(a,function(a){return b.inArray(a,c)>=0===f})};b.fn.extend({find:function(a){for(var c=this.pushStack("","find",a),f=0,i=0,h=this.length;i<h;i++)if(f=c.length,b.find(a,this[i],c),i>0)for(var d=f;d<c.length;d++)for(var e=0;e<f;e++)if(c[e]===c[d]){c.splice(d--,1);break}return c},has:function(a){var c=b(a);return this.filter(function(){for(var a=0,i=c.length;a<i;a++)if(b.contains(this,
c[a]))return!0})},not:function(a){return this.pushStack(ta(this,a,!1),"not",a)},filter:function(a){return this.pushStack(ta(this,a,!0),"filter",a)},is:function(a){return!!a&&b.filter(a,this).length>0},closest:function(a,c){if(b.isArray(a)){var f=[],i=this[0],h,d={},e;if(i&&a.length){h=0;for(var g=a.length;h<g;h++)e=a[h],d[e]||(d[e]=b.expr.match.POS.test(e)?b(e,c||this.context):e);for(;i&&i.ownerDocument&&i!==c;){for(e in d)if(h=d[e],h.jquery?h.index(i)>-1:b(i).is(h))f.push({selector:e,elem:i}),delete d[e];
i=i.parentNode}}return f}var j=b.expr.match.POS.test(a)?b(a,c||this.context):null;return this.map(function(f,h){for(;h&&h.ownerDocument&&h!==c;){if(j?j.index(h)>-1:b(h).is(a))return h;h=h.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return b.inArray(this[0],a?b(a):this.parent().children());return b.inArray(a.jquery?a[0]:a,this)},add:function(a,c){var f=typeof a==="string"?b(a,c||this.context):b.makeArray(a),i=b.merge(this.get(),f);return this.pushStack(!f[0]||!f[0].parentNode||
f[0].parentNode.nodeType===11||!i[0]||!i[0].parentNode||i[0].parentNode.nodeType===11?i:b.unique(i))},andSelf:function(){return this.add(this.prevObject)}});b.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return b.dir(a,"parentNode")},parentsUntil:function(a,c,f){return b.dir(a,"parentNode",f)},next:function(a){return b.nth(a,2,"nextSibling")},prev:function(a){return b.nth(a,2,"previousSibling")},nextAll:function(a){return b.dir(a,"nextSibling")},prevAll:function(a){return b.dir(a,
"previousSibling")},nextUntil:function(a,c,f){return b.dir(a,"nextSibling",f)},prevUntil:function(a,c,f){return b.dir(a,"previousSibling",f)},siblings:function(a){return b.sibling(a.parentNode.firstChild,a)},children:function(a){return b.sibling(a.firstChild)},contents:function(a){return b.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:b.makeArray(a.childNodes)}},function(a,c){b.fn[a]=function(f,i){var h=b.map(this,c,f);Ea.test(a)||(i=f);i&&typeof i==="string"&&(h=b.filter(i,h));
h=this.length>1?b.unique(h):h;if((this.length>1||Ga.test(i))&&Fa.test(a))h=h.reverse();return this.pushStack(h,a,S.call(arguments).join(","))}});b.extend({filter:function(a,c,f){f&&(a=":not("+a+")");return b.find.matches(a,c)},dir:function(a,c,f){for(var i=[],a=a[c];a&&a.nodeType!==9&&(f===k||a.nodeType!==1||!b(a).is(f));)a.nodeType===1&&i.push(a),a=a[c];return i},nth:function(a,c,b){for(var c=c||1,i=0;a;a=a[b])if(a.nodeType===1&&++i===c)break;return a},sibling:function(a,c){for(var b=[];a;a=a.nextSibling)a.nodeType===
1&&a!==c&&b.push(a);return b}});var ua=/ jQuery\d+="(?:\d+|null)"/g,aa=/^\s+/,va=/(<([\w:]+)[^>]*?)\/>/g,Ha=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,wa=/<([\w:]+)/,Ia=/<tbody/i,Ja=/<|&#?\w+;/,ka=/<script|<object|<embed|<option|<style/i,la=/checked\s*(?:[^=]|=\s*.checked.)/i,xa=function(a,c,b){return Ha.test(b)?a:c+"></"+b+">"},L={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,"",""]};L.optgroup=L.option;L.tbody=L.tfoot=L.colgroup=L.caption=L.thead;L.th=L.td;if(!b.support.htmlSerialize)L._default=[1,"div<div>","</div>"];b.fn.extend({text:function(a){if(b.isFunction(a))return this.each(function(c){var f=b(this);f.text(a.call(this,c,f.text()))});if(typeof a!=="object"&&a!==k)return this.empty().append((this[0]&&this[0].ownerDocument||
m).createTextNode(a));return b.text(this)},wrapAll:function(a){if(b.isFunction(a))return this.each(function(c){b(this).wrapAll(a.call(this,c))});if(this[0]){var c=b(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&c.insertBefore(this[0]);c.map(function(){for(var a=this;a.firstChild&&a.firstChild.nodeType===1;)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(b.isFunction(a))return this.each(function(c){b(this).wrapInner(a.call(this,c))});return this.each(function(){var c=
b(this),f=c.contents();f.length?f.wrapAll(a):c.append(a)})},wrap:function(a){return this.each(function(){b(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(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)});else if(arguments.length){var a=b(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)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,b(arguments[0]).toArray());return a}},remove:function(a,
c){for(var f=0,i;(i=this[f])!=null;f++)if(!a||b.filter(a,[i]).length)!c&&i.nodeType===1&&(b.cleanData(i.getElementsByTagName("*")),b.cleanData([i])),i.parentNode&&i.parentNode.removeChild(i);return this},empty:function(){for(var a=0,c;(c=this[a])!=null;a++)for(c.nodeType===1&&b.cleanData(c.getElementsByTagName("*"));c.firstChild;)c.removeChild(c.firstChild);return this},clone:function(a){var c=this.map(function(){if(!b.support.noCloneEvent&&!b.isXMLDoc(this)){var a=this.outerHTML,c=this.ownerDocument;
if(!a)a=c.createElement("div"),a.appendChild(this.cloneNode(!0)),a=a.innerHTML;return b.clean([a.replace(ua,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(aa,"")],c)[0]}else return this.cloneNode(!0)});a===!0&&(z(this,c),z(this.find("*"),c.find("*")));return c},html:function(a){if(a===k)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ua,""):null;else if(typeof a==="string"&&!ka.test(a)&&(b.support.leadingWhitespace||!aa.test(a))&&!L[(wa.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(va,
xa);try{for(var c=0,f=this.length;c<f;c++)if(this[c].nodeType===1)b.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a}catch(i){this.empty().append(a)}}else b.isFunction(a)?this.each(function(c){var f=b(this),i=f.html();f.empty().append(function(){return a.call(this,c,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(b.isFunction(a))return this.each(function(c){var f=b(this),i=f.html();f.replaceWith(a.call(this,c,i))});typeof a!=="string"&&
(a=b(a).detach());return this.each(function(){var c=this.nextSibling,f=this.parentNode;b(this).remove();c?b(c).before(a):b(f).append(a)})}else return this.pushStack(b(b.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,f){var i,h,e=a[0],g=[],j;if(!b.support.checkClone&&arguments.length===3&&typeof e==="string"&&la.test(e))return this.each(function(){b(this).domManip(a,c,f,!0)});if(b.isFunction(e))return this.each(function(h){var i=b(this);a[0]=
e.call(this,h,c?i.html():k);i.domManip(a,c,f)});if(this[0]){i=e&&e.parentNode;i=b.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?{fragment:i}:l(a,this,g);j=i.fragment;if(h=j.childNodes.length===1?j=j.firstChild:j.firstChild){c=c&&b.nodeName(h,"tr");h=0;for(var o=this.length;h<o;h++)f.call(c?b.nodeName(this[h],"table")?this[h].getElementsByTagName("tbody")[0]||this[h].appendChild(this[h].ownerDocument.createElement("tbody")):this[h]:this[h],h>0||i.cacheable||this.length>
1?j.cloneNode(!0):j)}g.length&&b.each(g,d)}return this}});b.fragments={};b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,c){b.fn[a]=function(f){var i=[],f=b(f),h=this.length===1&&this[0].parentNode;if(h&&h.nodeType===11&&h.childNodes.length===1&&f.length===1)return f[c](this[0]),this;else{for(var h=0,d=f.length;h<d;h++){var e=(h>0?this.clone(!0):this).get();b.fn[c].apply(b(f[h]),e);i=i.concat(e)}return this.pushStack(i,a,
f.selector)}}});b.extend({clean:function(a,c,f,i){c=c||m;typeof c.createElement==="undefined"&&(c=c.ownerDocument||c[0]&&c[0].ownerDocument||m);for(var h=[],d=0,e;(e=a[d])!=null;d++)if(typeof e==="number"&&(e+=""),e){if(typeof e==="string"&&!Ja.test(e))e=c.createTextNode(e);else if(typeof e==="string"){e=e.replace(va,xa);var g=(wa.exec(e)||["",""])[1].toLowerCase(),j=L[g]||L._default,l=j[0],k=c.createElement("div");for(k.innerHTML=j[1]+e+j[2];l--;)k=k.lastChild;if(!b.support.tbody){l=Ia.test(e);g=
g==="table"&&!l?k.firstChild&&k.firstChild.childNodes:j[1]==="<table>"&&!l?k.childNodes:[];for(j=g.length-1;j>=0;--j)b.nodeName(g[j],"tbody")&&!g[j].childNodes.length&&g[j].parentNode.removeChild(g[j])}!b.support.leadingWhitespace&&aa.test(e)&&k.insertBefore(c.createTextNode(aa.exec(e)[0]),k.firstChild);e=k.childNodes}e.nodeType?h.push(e):h=b.merge(h,e)}if(f)for(d=0;h[d];d++)i&&b.nodeName(h[d],"script")&&(!h[d].type||h[d].type.toLowerCase()==="text/javascript")?i.push(h[d].parentNode?h[d].parentNode.removeChild(h[d]):
h[d]):(h[d].nodeType===1&&h.splice.apply(h,[d+1,0].concat(b.makeArray(h[d].getElementsByTagName("script")))),f.appendChild(h[d]));return h},cleanData:function(a){for(var c,f,i=b.cache,h=b.event.special,d=b.support.deleteExpando,e=0,g;(g=a[e])!=null;e++)if(f=g[b.expando]){c=i[f];if(c.events)for(var j in c.events)h[j]?b.event.remove(g,j):oa(g,j,c.handle);d?delete g[b.expando]:g.removeAttribute&&g.removeAttribute(b.expando);delete i[f]}}});var Ka=/z-?index|font-?weight|opacity|zoom|line-?height/i,ya=
/alpha\([^)]*\)/,za=/opacity=([^)]*)/,fa=/float/i,ga=/-([a-z])/ig,La=/([A-Z])/g,Ma=/^-?\d+(?:px)?$/i,Na=/^-?\d/,Oa={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],Ra=m.defaultView&&m.defaultView.getComputedStyle,Aa=b.support.cssFloat?"cssFloat":"styleFloat",ha=function(a,c){return c.toUpperCase()};b.fn.css=function(a,c){return e(this,a,c,!0,function(a,c,h){if(h===k)return b.curCSS(a,c);typeof h==="number"&&!Ka.test(c)&&(h+="px");b.style(a,c,h)})};
b.extend({style:function(a,c,f){if(!a||a.nodeType===3||a.nodeType===8)return k;if((c==="width"||c==="height")&&parseFloat(f)<0)f=k;var i=a.style||a,h=f!==k;if(!b.support.opacity&&c==="opacity"){if(h)i.zoom=1,c=parseInt(f,10)+""==="NaN"?"":"alpha(opacity="+f*100+")",a=i.filter||b.curCSS(a,"filter")||"",i.filter=ya.test(a)?a.replace(ya,c):c;return i.filter&&i.filter.indexOf("opacity=")>=0?parseFloat(za.exec(i.filter)[1])/100+"":""}fa.test(c)&&(c=Aa);c=c.replace(ga,ha);h&&f!="Infinitypx"&&(i[c]=f);return i[c]},
css:function(a,c,f,i){if(c==="width"||c==="height"){var h,d=c==="width"?Pa:Qa,f=function(){h=c==="width"?a.offsetWidth:a.offsetHeight;i!=="border"&&b.each(d,function(){i||(h-=parseFloat(b.curCSS(a,"padding"+this,!0))||0);i==="margin"?h+=parseFloat(b.curCSS(a,"margin"+this,!0))||0:h-=parseFloat(b.curCSS(a,"border"+this+"Width",!0))||0})};a.offsetWidth!==0?f():b.swap(a,Oa,f);return Math.max(0,Math.round(h))}return b.curCSS(a,c,f)},curCSS:function(a,c,f){var i,h=a.style;if(!b.support.opacity&&c==="opacity"&&
a.currentStyle)return i=za.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"",i===""?"1":i;fa.test(c)&&(c=Aa);if(!f&&h&&h[c])i=h[c];else if(Ra){fa.test(c)&&(c="float");c=c.replace(La,"-$1").toLowerCase();h=a.ownerDocument.defaultView;if(!h)return null;(a=h.getComputedStyle(a,null))&&(i=a.getPropertyValue(c));c==="opacity"&&i===""&&(i="1")}else if(a.currentStyle&&(f=c.replace(ga,ha),i=a.currentStyle[c]||a.currentStyle[f],!Ma.test(i)&&Na.test(i))){var c=h.left,d=a.runtimeStyle.left;a.runtimeStyle.left=
a.currentStyle.left;h.left=f==="fontSize"?"1em":i||0;i=h.pixelLeft+"px";h.left=c;a.runtimeStyle.left=d}return i},swap:function(a,c,b){var i={},h;for(h in c)i[h]=a.style[h],a.style[h]=c[h];b.call(a);for(h in c)a.style[h]=i[h]}});if(b.expr&&b.expr.filters)b.expr.filters.hidden=function(a){var c=a.offsetWidth,f=a.offsetHeight,i=a.nodeName.toLowerCase()==="tr";return c===0&&f===0&&!i?!0:c>0&&f>0&&!i?!1:b.curCSS(a,"display")==="none"},b.expr.filters.visible=function(a){return!b.expr.filters.hidden(a)};
var Sa=o(),Ta=/<script(.|\s)*?\/script>/gi,Ua=/select|textarea/i,Va=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,W=/=\?(&|$)/,ia=/\?/,Wa=/(\?|&)_=.*?(&|$)/,Xa=/^(\w+:)?\/\/([^\/?#]+)/,Ya=/%20/g,Za=b.fn.load;b.fn.extend({load:function(a,c,f){if(typeof a!=="string")return Za.call(this,a);else if(!this.length)return this;var i=a.indexOf(" ");if(i>=0)var h=a.slice(i,a.length),a=a.slice(0,i);i="GET";c&&(b.isFunction(c)?(f=c,c=null):typeof c==="object"&&
(c=b.param(c,b.ajaxSettings.traditional),i="POST"));var d=this;b.ajax({url:a,type:i,dataType:"html",data:c,complete:function(a,c){if(c==="success"||c==="notmodified")d.html(h?b("<div />").append(a.responseText.replace(Ta,"")).find(h):a.responseText);f&&d.each(f,[a.responseText,c,a])}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&
!this.disabled&&(this.checked||Ua.test(this.nodeName)||Va.test(this.type))}).map(function(a,c){var f=b(this).val();return f==null?null:b.isArray(f)?b.map(f,function(a){return{name:c.name,value:a}}):{name:c.name,value:f}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,c){b.fn[c]=function(a){return this.bind(c,a)}});b.extend({get:function(a,c,f,i){b.isFunction(c)&&(i=i||f,f=c,c=null);return b.ajax({type:"GET",url:a,data:c,success:f,dataType:i})},
getScript:function(a,c){return b.get(a,null,c,"script")},getJSON:function(a,c,f){return b.get(a,c,f,"json")},post:function(a,c,f,i){b.isFunction(c)&&(i=i||f,f=c,c={});return b.ajax({type:"POST",url:a,data:c,success:f,dataType:i})},ajaxSetup:function(a){b.extend(b.ajaxSettings,a)},ajaxSettings:{url:location.href,global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,xhr:g.XMLHttpRequest&&(g.location.protocol!=="file:"||!g.ActiveXObject)?function(){return new g.XMLHttpRequest}:
function(){try{return new g.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function c(){h.success&&h.success.call(l,j,e,x);h.global&&i("ajaxSuccess",[x,h])}function f(){h.complete&&h.complete.call(l,x,e);h.global&&i("ajaxComplete",[x,h]);h.global&&!--b.active&&b.event.trigger("ajaxStop")}
function i(a,c){(h.context?b(h.context):b.event).trigger(a,c)}var h=b.extend(!0,{},b.ajaxSettings,a),d,e,j,l=a&&a.context||h,y=h.type.toUpperCase();if(h.data&&h.processData&&typeof h.data!=="string")h.data=b.param(h.data,h.traditional);if(h.dataType==="jsonp"){if(y==="GET")W.test(h.url)||(h.url+=(ia.test(h.url)?"&":"?")+(h.jsonp||"callback")+"=?");else if(!h.data||!W.test(h.data))h.data=(h.data?h.data+"&":"")+(h.jsonp||"callback")+"=?";h.dataType="json"}if(h.dataType==="json"&&(h.data&&W.test(h.data)||
W.test(h.url))){d=h.jsonpCallback||"jsonp"+Sa++;if(h.data)h.data=(h.data+"").replace(W,"="+d+"$1");h.url=h.url.replace(W,"="+d+"$1");h.dataType="script";g[d]=g[d]||function(a){j=a;c();f();g[d]=k;try{delete g[d]}catch(b){}p&&p.removeChild(s)}}if(h.dataType==="script"&&h.cache===null)h.cache=!1;if(h.cache===!1&&y==="GET"){var n=o(),B=h.url.replace(Wa,"$1_="+n+"$2");h.url=B+(B===h.url?(ia.test(h.url)?"&":"?")+"_="+n:"")}h.data&&y==="GET"&&(h.url+=(ia.test(h.url)?"&":"?")+h.data);h.global&&!b.active++&&
b.event.trigger("ajaxStart");n=(n=Xa.exec(h.url))&&(n[1]&&n[1]!==location.protocol||n[2]!==location.host);if(h.dataType==="script"&&y==="GET"&&n){var p=m.getElementsByTagName("head")[0]||m.documentElement,s=m.createElement("script");s.src=h.url;if(h.scriptCharset)s.charset=h.scriptCharset;if(!d){var A=!1;s.onload=s.onreadystatechange=function(){if(!A&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete"))A=!0,c(),f(),s.onload=s.onreadystatechange=null,p&&s.parentNode&&p.removeChild(s)}}p.insertBefore(s,
p.firstChild);return k}var t=!1,x=h.xhr();if(x){h.username?x.open(y,h.url,h.async,h.username,h.password):x.open(y,h.url,h.async);try{(h.data||a&&a.contentType)&&x.setRequestHeader("Content-Type",h.contentType),h.ifModified&&(b.lastModified[h.url]&&x.setRequestHeader("If-Modified-Since",b.lastModified[h.url]),b.etag[h.url]&&x.setRequestHeader("If-None-Match",b.etag[h.url])),n||x.setRequestHeader("X-Requested-With","XMLHttpRequest"),x.setRequestHeader("Accept",h.dataType&&h.accepts[h.dataType]?h.accepts[h.dataType]+
", */*":h.accepts._default)}catch(r){}if(h.beforeSend&&h.beforeSend.call(l,x,h)===!1)return h.global&&!--b.active&&b.event.trigger("ajaxStop"),x.abort(),!1;h.global&&i("ajaxSend",[x,h]);var D=x.onreadystatechange=function(a){if(!x||x.readyState===0||a==="abort"){if(t||f(),t=!0,x)x.onreadystatechange=b.noop}else if(!t&&x&&(x.readyState===4||a==="timeout")){t=!0;x.onreadystatechange=b.noop;e=a==="timeout"?"timeout":!b.httpSuccess(x)?"error":h.ifModified&&b.httpNotModified(x,h.url)?"notmodified":"success";
var i;if(e==="success")try{j=b.httpData(x,h.dataType,h)}catch(g){e="parsererror",i=g}e==="success"||e==="notmodified"?d||c():b.handleError(h,x,e,i);f();a==="timeout"&&x.abort();h.async&&(x=null)}};try{var E=x.abort;x.abort=function(){x&&E.call(x);D("abort")}}catch(q){}h.async&&h.timeout>0&&setTimeout(function(){x&&!t&&D("timeout")},h.timeout);try{x.send(y==="POST"||y==="PUT"||y==="DELETE"?h.data:null)}catch(z){b.handleError(h,x,null,z),f()}h.async||D();return x}},handleError:function(a,c,f,i){a.error&&
a.error.call(a.context||a,c,f,i);a.global&&(a.context?b(a.context):b.event).trigger("ajaxError",[c,a,i])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223||a.status===0}catch(c){}return!1},httpNotModified:function(a,c){var f=a.getResponseHeader("Last-Modified"),i=a.getResponseHeader("Etag");f&&(b.lastModified[c]=f);i&&(b.etag[c]=i);return a.status===304||a.status===0},httpData:function(a,c,f){var i=a.getResponseHeader("content-type")||
"",h=c==="xml"||!c&&i.indexOf("xml")>=0,a=h?a.responseXML:a.responseText;h&&a.documentElement.nodeName==="parsererror"&&b.error("parsererror");f&&f.dataFilter&&(a=f.dataFilter(a,c));typeof a==="string"&&(c==="json"||!c&&i.indexOf("json")>=0?a=b.parseJSON(a):(c==="script"||!c&&i.indexOf("javascript")>=0)&&b.globalEval(a));return a},param:function(a,c){function f(a,h){b.isArray(h)?b.each(h,function(h,d){c||/\[\]$/.test(a)?i(a,d):f(a+"["+(typeof d==="object"||b.isArray(d)?h:"")+"]",d)}):!c&&h!=null&&
typeof h==="object"?b.each(h,function(c,b){f(a+"["+c+"]",b)}):i(a,h)}function i(a,c){c=b.isFunction(c)?c():c;h[h.length]=encodeURIComponent(a)+"="+encodeURIComponent(c)}var h=[];if(c===k)c=b.ajaxSettings.traditional;if(b.isArray(a)||a.jquery)b.each(a,function(){i(this.name,this.value)});else for(var d in a)f(d,a[d]);return h.join("&").replace(Ya,"+")}});var ja={},$a=/toggle|show|hide/,ab=/^([+-]=)?([\d+-.]+)(.*)$/,ba,ma=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width",
"marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];b.fn.extend({show:function(a,c){if(a||a===0)return this.animate(A("show",3),a,c);else{for(var f=0,i=this.length;f<i;f++){var h=b.data(this[f],"olddisplay");this[f].style.display=h||"";if(b.css(this[f],"display")==="none"){var h=this[f].nodeName,d;if(ja[h])d=ja[h];else{var e=b("<"+h+" />").appendTo("body");d=e.css("display");d==="none"&&(d="block");e.remove();ja[h]=d}b.data(this[f],"olddisplay",d)}}f=0;for(i=this.length;f<i;f++)this[f].style.display=
b.data(this[f],"olddisplay")||"";return this}},hide:function(a,c){if(a||a===0)return this.animate(A("hide",3),a,c);else{for(var f=0,i=this.length;f<i;f++){var h=b.data(this[f],"olddisplay");!h&&h!=="none"&&b.data(this[f],"olddisplay",b.css(this[f],"display"))}f=0;for(i=this.length;f<i;f++)this[f].style.display="none";return this}},_toggle:b.fn.toggle,toggle:function(a,c){var f=typeof a==="boolean";b.isFunction(a)&&b.isFunction(c)?this._toggle.apply(this,arguments):a==null||f?this.each(function(){var c=
f?a:b(this).is(":hidden");b(this)[c?"show":"hide"]()}):this.animate(A("toggle",3),a,c);return this},fadeTo:function(a,c,b){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:c},a,b)},animate:function(a,c,f,i){var h=b.speed(c,f,i);if(b.isEmptyObject(a))return this.each(h.complete);return this[h.queue===!1?"each":"queue"](function(){var c=b.extend({},h),f,i=this.nodeType===1&&b(this).is(":hidden"),d=this;for(f in a){var e=f.replace(ga,ha);f!==e&&(a[e]=a[f],delete a[f],f=e);
if(a[f]==="hide"&&i||a[f]==="show"&&!i)return c.complete.call(this);if((f==="height"||f==="width")&&this.style)c.display=b.css(this,"display"),c.overflow=this.style.overflow;if(b.isArray(a[f]))(c.specialEasing=c.specialEasing||{})[f]=a[f][1],a[f]=a[f][0]}if(c.overflow!=null)this.style.overflow="hidden";c.curAnim=b.extend({},a);b.each(a,function(f,h){var e=new b.fx(d,c,f);if($a.test(h))e[h==="toggle"?i?"show":"hide":h](a);else{var g=ab.exec(h),j=e.cur(!0)||0;if(g){var l=parseFloat(g[2]),k=g[3]||"px";
k!=="px"&&(d.style[f]=(l||1)+k,j*=(l||1)/e.cur(!0),d.style[f]=j+k);g[1]&&(l=(g[1]==="-="?-1:1)*l+j);e.custom(j,l,k)}else e.custom(j,h,"")}});return!0})},stop:function(a,c){var f=b.timers;a&&this.queue([]);this.each(function(){for(var a=f.length-1;a>=0;a--)if(f[a].elem===this){if(c)f[a](!0);f.splice(a,1)}});c||this.dequeue();return this}});b.each({slideDown:A("show",1),slideUp:A("hide",1),slideToggle:A("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,c){b.fn[a]=function(a,b){return this.animate(c,
a,b)}});b.extend({speed:function(a,c,f){var i=a&&typeof a==="object"?a:{complete:f||!f&&c||b.isFunction(a)&&a,duration:a,easing:f&&c||c&&!b.isFunction(c)&&c};i.duration=b.fx.off?0:typeof i.duration==="number"?i.duration:b.fx.speeds[i.duration]||b.fx.speeds._default;i.old=i.complete;i.complete=function(){i.queue!==!1&&b(this).dequeue();b.isFunction(i.old)&&i.old.call(this)};return i},easing:{linear:function(a,c,b,i){return b+i*a},swing:function(a,c,b,i){return(-Math.cos(a*Math.PI)/2+0.5)*i+b}},timers:[],
fx:function(a,c,b){this.options=c;this.elem=a;this.prop=b;if(!c.orig)c.orig={}}});b.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(b.fx.step[this.prop]||b.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(b.css(this.elem,this.prop,
a)))&&a>-1E4?a:parseFloat(b.curCSS(this.elem,this.prop))||0},custom:function(a,c,f){function i(a){return h.step(a)}this.startTime=o();this.start=a;this.end=c;this.unit=f||this.unit||"px";this.now=this.start;this.pos=this.state=0;var h=this;i.elem=this.elem;i()&&b.timers.push(i)&&!ba&&(ba=setInterval(b.fx.tick,13))},show:function(){this.options.orig[this.prop]=b.style(this.elem,this.prop);this.options.show=!0;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());b(this.elem).show()},
hide:function(){this.options.orig[this.prop]=b.style(this.elem,this.prop);this.options.hide=!0;this.custom(this.cur(),0)},step:function(a){var c=o(),f=!0;if(a||c>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=!0;for(var i in this.options.curAnim)this.options.curAnim[i]!==!0&&(f=!1);if(f){if(this.options.display!=null&&(this.elem.style.overflow=this.options.overflow,a=b.data(this.elem,"olddisplay"),this.elem.style.display=
a?a:this.options.display,b.css(this.elem,"display")==="none"))this.elem.style.display="block";this.options.hide&&b(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)b.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}else h=c-this.startTime,this.state=h/this.options.duration,a=this.options.easing||(b.easing.swing?"swing":"linear"),this.pos=b.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,
h,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}};b.extend(b.fx,{tick:function(){for(var a=b.timers,c=0;c<a.length;c++)a[c]()||a.splice(c--,1);a.length||b.fx.stop()},stop:function(){clearInterval(ba);ba=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){b.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}}});if(b.expr&&b.expr.filters)b.expr.filters.animated=function(a){return b.grep(b.timers,function(c){return a===c.elem}).length};b.fn.offset="getBoundingClientRect"in m.documentElement?function(a){var c=this[0];if(a)return this.each(function(c){b.offset.setOffset(this,a,c)});if(!c||!c.ownerDocument)return null;if(c===c.ownerDocument.body)return b.offset.bodyOffset(c);var f=c.getBoundingClientRect(),i=c.ownerDocument,c=i.body,i=i.documentElement;return{top:f.top+
(self.pageYOffset||b.support.boxModel&&i.scrollTop||c.scrollTop)-(i.clientTop||c.clientTop||0),left:f.left+(self.pageXOffset||b.support.boxModel&&i.scrollLeft||c.scrollLeft)-(i.clientLeft||c.clientLeft||0)}}:function(a){var c=this[0];if(a)return this.each(function(c){b.offset.setOffset(this,a,c)});if(!c||!c.ownerDocument)return null;if(c===c.ownerDocument.body)return b.offset.bodyOffset(c);b.offset.initialize();var f=c.offsetParent,i=c.ownerDocument,h,d=i.documentElement,e=i.body;h=(i=i.defaultView)?
i.getComputedStyle(c,null):c.currentStyle;for(var g=c.offsetTop,j=c.offsetLeft;(c=c.parentNode)&&c!==e&&c!==d;){if(b.offset.supportsFixedPosition&&h.position==="fixed")break;h=i?i.getComputedStyle(c,null):c.currentStyle;g-=c.scrollTop;j-=c.scrollLeft;if(c===f){g+=c.offsetTop;j+=c.offsetLeft;if(b.offset.doesNotAddBorder&&(!b.offset.doesAddBorderForTableAndCells||!/^t(able|d|h)$/i.test(c.nodeName)))g+=parseFloat(h.borderTopWidth)||0,j+=parseFloat(h.borderLeftWidth)||0;f=c.offsetParent}b.offset.subtractsBorderForOverflowNotVisible&&
h.overflow!=="visible"&&(g+=parseFloat(h.borderTopWidth)||0,j+=parseFloat(h.borderLeftWidth)||0)}if(h.position==="relative"||h.position==="static")g+=e.offsetTop,j+=e.offsetLeft;b.offset.supportsFixedPosition&&h.position==="fixed"&&(g+=Math.max(d.scrollTop,e.scrollTop),j+=Math.max(d.scrollLeft,e.scrollLeft));return{top:g,left:j}};b.offset={initialize:function(){var a=m.body,c=m.createElement("div"),f,i,h,d=parseFloat(b.curCSS(a,"marginTop",!0))||0;b.extend(c.style,{position:"absolute",top:0,left:0,
margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});c.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(c,a.firstChild);f=c.firstChild;i=f.firstChild;h=f.nextSibling.firstChild.firstChild;this.doesNotAddBorder=i.offsetTop!==
5;this.doesAddBorderForTableAndCells=h.offsetTop===5;i.style.position="fixed";i.style.top="20px";this.supportsFixedPosition=i.offsetTop===20||i.offsetTop===15;i.style.position=i.style.top="";f.style.overflow="hidden";f.style.position="relative";this.subtractsBorderForOverflowNotVisible=i.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==d;a.removeChild(c);b.offset.initialize=b.noop},bodyOffset:function(a){var c=a.offsetTop,f=a.offsetLeft;b.offset.initialize();b.offset.doesNotIncludeMarginInBodyOffset&&
(c+=parseFloat(b.curCSS(a,"marginTop",!0))||0,f+=parseFloat(b.curCSS(a,"marginLeft",!0))||0);return{top:c,left:f}},setOffset:function(a,c,f){if(/static/.test(b.curCSS(a,"position")))a.style.position="relative";var i=b(a),h=i.offset(),d=parseInt(b.curCSS(a,"top",!0),10)||0,e=parseInt(b.curCSS(a,"left",!0),10)||0;b.isFunction(c)&&(c=c.call(a,f,h));f={top:c.top-h.top+d,left:c.left-h.left+e};"using"in c?c.using.call(a,f):i.css(f)}};b.fn.extend({position:function(){if(!this[0])return null;var a=this[0],
c=this.offsetParent(),f=this.offset(),i=/^body|html$/i.test(c[0].nodeName)?{top:0,left:0}:c.offset();f.top-=parseFloat(b.curCSS(a,"marginTop",!0))||0;f.left-=parseFloat(b.curCSS(a,"marginLeft",!0))||0;i.top+=parseFloat(b.curCSS(c[0],"borderTopWidth",!0))||0;i.left+=parseFloat(b.curCSS(c[0],"borderLeftWidth",!0))||0;return{top:f.top-i.top,left:f.left-i.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||m.body;a&&!/^body|html$/i.test(a.nodeName)&&b.css(a,"position")===
"static";)a=a.offsetParent;return a})}});b.each(["Left","Top"],function(a,c){var f="scroll"+c;b.fn[f]=function(c){var h=this[0],d;if(!h)return null;return c!==k?this.each(function(){(d=s(this))?d.scrollTo(!a?c:b(d).scrollLeft(),a?c:b(d).scrollTop()):this[f]=c}):(d=s(h))?"pageXOffset"in d?d[a?"pageYOffset":"pageXOffset"]:b.support.boxModel&&d.document.documentElement[f]||d.document.body[f]:h[f]}});b.each(["Height","Width"],function(a,c){var f=c.toLowerCase();b.fn["inner"+c]=function(){return this[0]?
b.css(this[0],f,!1,"padding"):null};b.fn["outer"+c]=function(a){return this[0]?b.css(this[0],f,!1,a?"margin":"border"):null};b.fn[f]=function(a){var h=this[0];if(!h)return a==null?null:this;if(b.isFunction(a))return this.each(function(c){var h=b(this);h[f](a.call(this,c,h[f]()))});return"scrollTo"in h&&h.document?h.document.compatMode==="CSS1Compat"&&h.document.documentElement["client"+c]||h.document.body["client"+c]:h.nodeType===9?Math.max(h.documentElement["client"+c],h.body["scroll"+c],h.documentElement["scroll"+
c],h.body["offset"+c],h.documentElement["offset"+c]):a===k?b.css(h,f):this.css(f,typeof a==="string"?a:a+"px")}});g.jQuery=g.$=b})(window);
(function(g){g.ui=g.ui||{};g.ui.version||(g.extend(g.ui,{version:"1.8.2",plugin:{add:function(k,j,d){var k=g.ui[k].prototype,e;for(e in d)k.plugins[e]=k.plugins[e]||[],k.plugins[e].push([j,d[e]])},call:function(g,j,d){if((j=g.plugins[j])&&g.element[0].parentNode)for(var e=0;e<j.length;e++)g.options[j[e][0]]&&j[e][1].apply(g.element,d)}},contains:function(g,j){return document.compareDocumentPosition?g.compareDocumentPosition(j)&16:g!==j&&g.contains(j)},hasScroll:function(k,j){if(g(k).css("overflow")==
"hidden")return!1;var d=j&&j=="left"?"scrollLeft":"scrollTop",e=!1;if(k[d]>0)return!0;k[d]=1;e=k[d]>0;k[d]=0;return e},isOverAxis:function(g,j,d){return g>j&&g<j+d},isOver:function(k,j,d,e,o,t){return g.ui.isOverAxis(k,d,o)&&g.ui.isOverAxis(j,e,t)},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,
NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),g.fn.extend({_focus:g.fn.focus,focus:function(k,j){return typeof k==="number"?this.each(function(){var d=this;setTimeout(function(){g(d).focus();j&&j.call(d)},k)}):this._focus.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect",
"none")},scrollParent:function(){var k;k=g.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(g.curCSS(this,"position",1))&&/(auto|scroll)/.test(g.curCSS(this,"overflow",1)+g.curCSS(this,"overflow-y",1)+g.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(g.curCSS(this,"overflow",1)+g.curCSS(this,"overflow-y",1)+g.curCSS(this,"overflow-x",
1))}).eq(0);return/fixed/.test(this.css("position"))||!k.length?g(document):k},zIndex:function(k){if(k!==void 0)return this.css("zIndex",k);if(this.length)for(var k=g(this[0]),j;k.length&&k[0]!==document;){j=k.css("position");if(j=="absolute"||j=="relative"||j=="fixed")if(j=parseInt(k.css("zIndex")),!isNaN(j)&&j!=0)return j;k=k.parent()}return 0}}),g.extend(g.expr[":"],{data:function(k,j,d){return!!g.data(k,d[3])},focusable:function(k){var j=k.nodeName.toLowerCase(),d=g.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(j)?
!k.disabled:"a"==j||"area"==j?k.href||!isNaN(d):!isNaN(d))&&!g(k)["area"==j?"parents":"closest"](":hidden").length},tabbable:function(k){var j=g.attr(k,"tabindex");return(isNaN(j)||j>=0)&&g(k).is(":focusable")}}))})(jQuery);
(function(g){var k=g.fn.remove;g.fn.remove=function(j,d){return this.each(function(){d||(!j||g.filter(j,[this]).length)&&g("*",this).add(this).each(function(){g(this).triggerHandler("remove")});return k.call(g(this),j,d)})};g.widget=function(j,d,e){var k=j.split(".")[0],t,j=j.split(".")[1];t=k+"-"+j;if(!e)e=d,d=g.Widget;g.expr[":"][t]=function(d){return!!g.data(d,j)};g[k]=g[k]||{};g[k][j]=function(d,e){arguments.length&&this._createWidget(d,e)};d=new d;d.options=g.extend({},d.options);g[k][j].prototype=
g.extend(!0,d,{namespace:k,widgetName:j,widgetEventPrefix:g[k][j].prototype.widgetEventPrefix||j,widgetBaseClass:t},e);g.widget.bridge(j,g[k][j])};g.widget.bridge=function(j,d){g.fn[j]=function(e){var k=typeof e==="string",t=Array.prototype.slice.call(arguments,1),r=this,e=!k&&t.length?g.extend.apply(null,[!0,e].concat(t)):e;if(k&&e.substring(0,1)==="_")return r;k?this.each(function(){var d=g.data(this,j),k=d&&g.isFunction(d[e])?d[e].apply(d,t):d;if(k!==d&&k!==void 0)return r=k,!1}):this.each(function(){var k=
g.data(this,j);k?(e&&k.option(e),k._init()):g.data(this,j,new d(e,this))});return r}};g.Widget=function(g,d){arguments.length&&this._createWidget(g,d)};g.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(j,d){this.element=g(d).data(this.widgetName,this);this.options=g.extend(!0,{},this.options,g.metadata&&g.metadata.get(d)[this.widgetName],j);var e=this;this.element.bind("remove."+this.widgetName,function(){e.destroy()});this._create();this._init()},
_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(j,d){var e=j,k=this;if(arguments.length===0)return g.extend({},k.options);if(typeof j==="string"){if(d===void 0)return this.options[j];e={};e[j]=d}g.each(e,function(d,e){k._setOption(d,
e)});return k},_setOption:function(g,d){this.options[g]=d;g==="disabled"&&this.widget()[d?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",d);return this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(j,d,e){var k=this.options[j],d=g.Event(d);d.type=(j===this.widgetEventPrefix?j:this.widgetEventPrefix+j).toLowerCase();e=e||{};if(d.originalEvent)for(var j=g.event.props.length,
t;j;)t=g.event.props[--j],d[t]=d.originalEvent[t];this.element.trigger(d,e);return!(g.isFunction(k)&&k.call(this.element[0],d,e)===!1||d.isDefaultPrevented())}}})(jQuery);
(function(g){g.fn.jcarousel=function(d){if(typeof d=="string"){var e=g(this).data("jcarousel"),k=Array.prototype.slice.call(arguments,1);return e[d].apply(e,k)}else return this.each(function(){g(this).data("jcarousel",new j(this,d))})};var k={vertical:!1,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,
itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click",buttonNextCallback:null,buttonPrevCallback:null};g.jcarousel=function(d,e){this.options=g.extend({},k,e||{});this.locked=!1;this.buttonPrev=this.buttonNext=this.list=this.clip=this.container=null;this.wh=!this.options.vertical?"width":"height";this.lt=!this.options.vertical?"left":"top";for(var j="",t=d.className.split(" "),r=0;r<t.length;r++)if(t[r].indexOf("jcarousel-skin")!=
-1){g(d).removeClass(t[r]);j=t[r];break}if(d.nodeName=="UL"||d.nodeName=="OL")if(this.list=g(d),this.container=this.list.parent(),this.container.hasClass("jcarousel-clip")){if(!this.container.parent().hasClass("jcarousel-container"))this.container=this.container.wrap("<div></div>");this.container=this.container.parent()}else{if(!this.container.hasClass("jcarousel-container"))this.container=this.list.wrap("<div></div>").parent()}else this.container=g(d),this.list=this.container.find("ul,ol").eq(0);
j!=""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1&&this.container.wrap('<div class=" '+j+'"></div>');this.clip=this.list.parent();if(!this.clip.length||!this.clip.hasClass("jcarousel-clip"))this.clip=this.list.wrap("<div></div>").parent();this.buttonNext=g(".jcarousel-next",this.container);if(this.buttonNext.size()==0&&this.options.buttonNextHTML!=null)this.buttonNext=this.clip.after(this.options.buttonNextHTML).next();this.buttonNext.addClass(this.className("jcarousel-next"));
this.buttonPrev=g(".jcarousel-prev",this.container);if(this.buttonPrev.size()==0&&this.options.buttonPrevHTML!=null)this.buttonPrev=this.clip.after(this.options.buttonPrevHTML).next();this.buttonPrev.addClass(this.className("jcarousel-prev"));this.clip.addClass(this.className("jcarousel-clip")).css({overflow:"hidden",position:"relative"});this.list.addClass(this.className("jcarousel-list")).css({overflow:"hidden",position:"relative",top:0,left:0,margin:0,padding:0});this.container.addClass(this.className("jcarousel-container")).css({position:"relative"});
var q=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null,j=this.list.children("li"),v=this;if(j.size()>0){var n=0,r=this.options.offset;j.each(function(){v.format(this,r++);n+=v.dimension(this,q)});this.list.css(this.wh,n+"px");if(!e||e.size===void 0)this.options.size=j.size()}this.container.css("display","block");this.buttonNext.css("display","block");this.buttonPrev.css("display","block");this.funcNext=function(){v.next()};this.funcPrev=function(){v.prev()};this.funcResize=
function(){v.reload()};this.options.initCallback!=null&&this.options.initCallback(this,"init");this.setup()};var j=g.jcarousel;j.fn=j.prototype={jcarousel:"0.2.4"};j.fn.extend=j.extend=g.extend;j.fn.extend({setup:function(){this.prevLast=this.prevFirst=this.last=this.first=null;this.animating=!1;this.tail=this.timer=null;this.inTail=!1;if(!this.locked){this.list.css(this.lt,this.pos(this.options.offset)+"px");var d=this.pos(this.options.start);this.prevFirst=this.prevLast=null;this.animate(d,!1);
g(window).unbind("resize.jcarousel",this.funcResize).bind("resize.jcarousel",this.funcResize)}},reset:function(){this.list.empty();this.list.css(this.lt,"0px");this.list.css(this.wh,"10px");this.options.initCallback!=null&&this.options.initCallback(this,"reset");this.setup()},reload:function(){this.tail!=null&&this.inTail&&this.list.css(this.lt,j.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=!1;this.options.reloadCallback!=null&&this.options.reloadCallback(this);if(this.options.visible!=
null){var d=this,e=Math.ceil(this.clipping()/this.options.visible),k=0,t=0;g("li",this.list).each(function(g){k+=d.dimension(this,e);g+1<d.first&&(t=k)});this.list.css(this.wh,k+"px");this.list.css(this.lt,-t+"px")}this.scroll(this.first,!1)},lock:function(){this.locked=!0;this.buttons()},unlock:function(){this.locked=!1;this.buttons()},size:function(d){if(d!=void 0)this.options.size=d,this.locked||this.buttons();return this.options.size},has:function(d,e){if(e==void 0||!e)e=d;if(this.options.size!==
null&&e>this.options.size)e=this.options.size;for(var g=d;g<=e;g++){var j=this.get(g);if(!j.length||j.hasClass("jcarousel-item-placeholder"))return!1}return!0},get:function(d){return g(".jcarousel-item-"+d,this.list)},add:function(d,e){var g=this.get(d),k=0;if(g.length==0)for(var r,g=this.create(d),q=j.intval(d);r=this.get(--q);){if(q<=0||r.length){q<=0?this.list.prepend(g):r.after(g);break}}else k=this.dimension(g);g.removeClass(this.className("jcarousel-item-placeholder"));typeof e=="string"?g.html(e):
g.empty().append(e);r=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;k=this.dimension(g,r)-k;d>0&&d<this.first&&this.list.css(this.lt,j.intval(this.list.css(this.lt))-k+"px");this.list.css(this.wh,j.intval(this.list.css(this.wh))+k+"px");return g},remove:function(d){var e=this.get(d);if(e.length&&!(d>=this.first&&d<=this.last)){var g=this.dimension(e);d<this.first&&this.list.css(this.lt,j.intval(this.list.css(this.lt))+g+"px");e.remove();this.list.css(this.wh,j.intval(this.list.css(this.wh))-
g+"px")}},next:function(){this.stopAuto();this.tail!=null&&!this.inTail?this.scrollTail(!1):this.scroll((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!=null&&this.last==this.options.size?1:this.first+this.options.scroll)},prev:function(){this.stopAuto();this.tail!=null&&this.inTail?this.scrollTail(!0):this.scroll((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!=null&&this.first==1?this.options.size:this.first-this.options.scroll)},scrollTail:function(d){if(!this.locked&&
!this.animating&&this.tail){var e=j.intval(this.list.css(this.lt));!d?e-=this.tail:e+=this.tail;this.inTail=!d;this.prevFirst=this.first;this.prevLast=this.last;this.animate(e)}},scroll:function(d,e){!this.locked&&!this.animating&&this.animate(this.pos(d),e)},pos:function(d){var e=j.intval(this.list.css(this.lt));if(this.locked||this.animating)return e;this.options.wrap!="circular"&&(d=d<1?1:this.options.size&&d>this.options.size?this.options.size:d);for(var g=this.first>d,k=this.options.wrap!="circular"&&
this.first<=1?1:this.first,r=g?this.get(k):this.get(this.last),q=g?k:k-1,v=null,n=0,z=!1,l=0;g?--q>=d:++q<d;){v=this.get(q);z=!v.length;if(v.length==0&&(v=this.create(q).addClass(this.className("jcarousel-item-placeholder")),r[g?"before":"after"](v),this.first!=null&&this.options.wrap=="circular"&&this.options.size!==null&&(q<=0||q>this.options.size)))r=this.get(this.index(q)),r.length&&this.add(q,r.children().clone(!0));r=v;l=this.dimension(v);z&&(n+=l);if(this.first!=null&&(this.options.wrap=="circular"||
q>=1&&(this.options.size==null||q<=this.options.size)))e=g?e+l:e-l}for(var k=this.clipping(),A=[],s=0,q=d,b=0,r=this.get(d-1);++s;){v=this.get(q);z=!v.length;if(v.length==0&&(v=this.create(q).addClass(this.className("jcarousel-item-placeholder")),r.length==0?this.list.prepend(v):r[g?"before":"after"](v),this.first!=null&&this.options.wrap=="circular"&&this.options.size!==null&&(q<=0||q>this.options.size)))r=this.get(this.index(q)),r.length&&this.add(q,r.find(">*").clone(!0));r=v;l=this.dimension(v);
if(l==0)return 0;this.options.wrap!="circular"&&this.options.size!==null&&q>this.options.size?A.push(v):z&&(n+=l);b+=l;if(b>=k)break;q++}for(v=0;v<A.length;v++)A[v].remove();n>0&&(this.list.css(this.wh,this.dimension(this.list)+n+"px"),g&&(e-=n,this.list.css(this.lt,j.intval(this.list.css(this.lt))-n+"px")));n=d+s-1;if(this.options.wrap!="circular"&&this.options.size&&n>this.options.size)n=this.options.size;
if(q>n){s=0;q=n;for(b=0;++s;){v=this.get(q--);if(!v.length)break;b+=this.dimension(v);if(b>=k)break}}q=n-s+1;this.options.wrap!="circular"&&q<1&&(q=1);if(this.inTail&&g)e+=this.tail,this.inTail=!1;this.tail=null;if(this.options.wrap!="circular"&&n==this.options.size&&n-s+1>=1&&(g=j.margin(this.get(n),!this.options.vertical?"marginRight":"marginBottom"),b-g>k))this.tail=b-k-g;for(;d-- >q;)e+=this.dimension(this.get(d));this.prevFirst=this.first;this.prevLast=this.last;this.first=q;this.last=n;return e},
animate:function(d,e){if(!this.locked&&!this.animating){this.animating=!0;var g=this,j=function(){g.animating=!1;d==0&&g.list.css(g.lt,0);(g.options.wrap=="circular"||g.options.wrap=="both"||g.options.wrap=="last"||g.options.size==null||g.last<g.options.size)&&g.startAuto();g.buttons();g.notify("onAfterAnimation")};this.notify("onBeforeAnimation");!this.options.animation||e==!1?(this.list.css(this.lt,d+"px"),j()):this.list.animate(!this.options.vertical?{left:d}:{top:d},this.options.animation,this.options.easing,
j)}},startAuto:function(d){if(d!=void 0)this.options.auto=d;if(this.options.auto==0)return this.stopAuto();if(this.timer==null){var e=this;this.timer=setTimeout(function(){e.next()},this.options.auto*1E3)}},stopAuto:function(){if(this.timer!=null)clearTimeout(this.timer),this.timer=null},buttons:function(d,e){if(d==void 0||d==null)if(d=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="first"||this.options.size==null||this.last<this.options.size),!this.locked&&(!this.options.wrap||
this.options.wrap=="first")&&this.options.size!=null&&this.last>=this.options.size)d=this.tail!=null&&!this.inTail;if(e==void 0||e==null)if(e=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="last"||this.first>1),!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!=null&&this.first==1)e=this.tail!=null&&this.inTail;var g=this;this.buttonNext[d?"bind":"unbind"](this.options.buttonNextEvent+".jcarousel",this.funcNext)[d?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",
d?!1:!0);this.buttonPrev[e?"bind":"unbind"](this.options.buttonPrevEvent+".jcarousel",this.funcPrev)[e?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",e?!1:!0);if(this.buttonNext.length>0&&(this.buttonNext[0].jcarouselstate==void 0||this.buttonNext[0].jcarouselstate!=d)&&this.options.buttonNextCallback!=null)this.buttonNext.each(function(){g.options.buttonNextCallback(g,this,d)}),this.buttonNext[0].jcarouselstate=d;if(this.buttonPrev.length>0&&(this.buttonPrev[0].jcarouselstate==
void 0||this.buttonPrev[0].jcarouselstate!=e)&&this.options.buttonPrevCallback!=null)this.buttonPrev.each(function(){g.options.buttonPrevCallback(g,this,e)}),this.buttonPrev[0].jcarouselstate=e},notify:function(d){var e=this.prevFirst==null?"init":this.prevFirst<this.first?"next":"prev";this.callback("itemLoadCallback",d,e);this.prevFirst!==this.first&&(this.callback("itemFirstInCallback",d,e,this.first),this.callback("itemFirstOutCallback",d,e,this.prevFirst));this.prevLast!==this.last&&(this.callback("itemLastInCallback",
d,e,this.last),this.callback("itemLastOutCallback",d,e,this.prevLast));this.callback("itemVisibleInCallback",d,e,this.first,this.last,this.prevFirst,this.prevLast);this.callback("itemVisibleOutCallback",d,e,this.prevFirst,this.prevLast,this.first,this.last)},callback:function(d,e,j,k,r,q,v){if(!(this.options[d]==void 0||typeof this.options[d]!="object"&&e!="onAfterAnimation")){var n=typeof this.options[d]=="object"?this.options[d][e]:this.options[d];if(g.isFunction(n)){var z=this;if(k===void 0)n(z,
j,e);else if(r===void 0)this.get(k).each(function(){n(z,this,k,j,e)});else for(var l=k;l<=r;l++)l!==null&&!(l>=q&&l<=v)&&this.get(l).each(function(){n(z,this,l,j,e)})}}},create:function(d){return this.format("<li></li>",d)},format:function(d,e){var j=g(d).addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+e)).css({"float":"left","list-style":"none"});j.attr("jcarouselindex",e);return j},className:function(d){return d+" "+d+(!this.options.vertical?"-horizontal":"-vertical")},
dimension:function(d,e){var k=d.jquery!=void 0?d[0]:d,t=!this.options.vertical?k.offsetWidth+j.margin(k,"marginLeft")+j.margin(k,"marginRight"):k.offsetHeight+j.margin(k,"marginTop")+j.margin(k,"marginBottom");if(e==void 0||t==e)return t;t=!this.options.vertical?e-j.margin(k,"marginLeft")-j.margin(k,"marginRight"):e-j.margin(k,"marginTop")-j.margin(k,"marginBottom");g(k).css(this.wh,t+"px");return this.dimension(k)},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-j.intval(this.clip.css("borderLeftWidth"))-
j.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-j.intval(this.clip.css("borderTopWidth"))-j.intval(this.clip.css("borderBottomWidth"))},index:function(d,e){if(e==void 0)e=this.options.size;return Math.round(((d-1)/e-Math.floor((d-1)/e))*e)+1}});j.extend({defaults:function(d){return g.extend(k,d||{})},margin:function(d,e){if(!d)return 0;var k=d.jquery!=void 0?d[0]:d;if(e=="marginRight"&&g.browser.safari){var t={display:"block","float":"none",width:"auto"},r,q;g.swap(k,t,function(){r=
k.offsetWidth});t.marginRight=0;g.swap(k,t,function(){q=k.offsetWidth});return q-r}return j.intval(g.css(k,e))},intval:function(d){d=parseInt(d);return isNaN(d)?0:d}})})(jQuery);
(function(g){g.widget("ui.stars",{options:{inputType:"radio",split:0,disabled:!1,cancelTitle:"Cancel Rating",cancelValue:0,cancelShow:!0,disableValue:!0,oneVoteOnly:!1,showTitles:!1,captionEl:null,callback:null,starWidth:16,cancelClass:"ui-stars-cancel",starClass:"ui-stars-star",starOnClass:"ui-stars-star-on",starHoverClass:"ui-stars-star-hover",starDisabledClass:"ui-stars-star-disabled",cancelHoverClass:"ui-stars-cancel-hover",cancelDisabledClass:"ui-stars-cancel-disabled"},_create:function(){function k(g,
k){if(g!=-1){var o=k?e.starHoverClass:e.starOnClass,v=k?e.starOnClass:e.starHoverClass;d.$stars.eq(g).prevAll("."+e.starClass).andSelf().removeClass(v).addClass(o);d.$stars.eq(g).nextAll("."+e.starClass).removeClass(e.starHoverClass+" "+e.starOnClass);d._showCap(e.id2title[g])}else j()}function j(){d.$stars.removeClass(e.starOnClass+" "+e.starHoverClass);d._showCap("")}var d=this,e=this.options,o=0;this.element.data("former.stars",this.element.html());e.isSelect=e.inputType=="select";this.$form=g(this.element).closest("form");
this.$selec=e.isSelect?g("select",this.element):null;this.$rboxs=e.isSelect?g("option",this.$selec):g(":radio",this.element);this.$stars=this.$rboxs.map(function(j){var k={value:this.value,title:(e.isSelect?this.text:this.title)||this.value,isDefault:e.isSelect&&this.defaultSelected||this.defaultChecked};if(j==0)e.split=typeof e.split!="number"?0:e.split,e.val2id=[],e.id2val=[],e.id2title=[],e.name=e.isSelect?d.$selec.get(0).name:this.name,e.disabled=e.disabled||(e.isSelect?g(d.$selec).attr("disabled"):
g(this).attr("disabled"));if(k.value==e.cancelValue)return e.cancelTitle=k.title,null;e.val2id[k.value]=o;e.id2val[o]=k.value;e.id2title[o]=k.title;if(k.isDefault)e.checked=o,e.value=e.defaultValue=k.value,e.title=k.title;j=g("<div/>").addClass(e.starClass);k=g("<a/>").attr("title",e.showTitles?k.title:"").text(k.value);if(e.split){var q=o%e.split,v=Math.floor(e.starWidth/e.split);j.width(v);k.css("margin-left","-"+q*v+"px")}o++;return j.append(k).get(0)});e.items=o;e.isSelect?this.$selec.remove():
this.$rboxs.remove();this.$cancel=g("<div/>").addClass(e.cancelClass).append(g("<a/>").attr("title",e.showTitles?e.cancelTitle:"").text(e.cancelValue));e.cancelShow&=!e.disabled&&!e.oneVoteOnly;e.cancelShow&&this.element.append(this.$cancel);this.element.append(this.$stars);if(e.checked===void 0)e.checked=-1,e.value=e.defaultValue=e.cancelValue,e.title="";this.$value=g("<input type='hidden' name='"+e.name+"' value='"+e.value+"' />");this.element.append(this.$value);this.$stars.bind("click.stars",
function(g){if(!e.forceSelect&&e.disabled)return!1;var j=d.$stars.index(this);e.checked=j;e.value=e.id2val[j];e.title=e.id2title[j];d.$value.attr({disabled:e.disabled?"disabled":"",value:e.value});k(j,!1);d._disableCancel();!e.forceSelect&&d.callback(g,"star")}).bind("mouseover.stars",function(){if(e.disabled)return!1;var g=d.$stars.index(this);k(g,!0)}).bind("mouseout.stars",function(){if(e.disabled)return!1;k(d.options.checked,!1)});this.$cancel.bind("click.stars",function(g){if(!e.forceSelect&&
(e.disabled||e.value==e.cancelValue))return!1;e.checked=-1;e.value=e.cancelValue;e.title="";d.$value.val(e.value);e.disableValue&&d.$value.attr({disabled:"disabled"});j();d._disableCancel();!e.forceSelect&&d.callback(g,"cancel")}).bind("mouseover.stars",function(){if(d._disableCancel())return!1;d.$cancel.addClass(e.cancelHoverClass);j();d._showCap(e.cancelTitle)}).bind("mouseout.stars",function(){if(d._disableCancel())return!1;d.$cancel.removeClass(e.cancelHoverClass);d.$stars.triggerHandler("mouseout.stars")});
this.$form.bind("reset.stars",function(){!e.disabled&&d.select(e.defaultValue)});g(window).unload(function(){d.$cancel.unbind(".stars");d.$stars.unbind(".stars");d.$form.unbind(".stars");d.$selec=d.$rboxs=d.$stars=d.$value=d.$cancel=d.$form=null});this.select(e.value);e.disabled&&this.disable()},_disableCancel:function(){var g=this.options,j=g.disabled||g.oneVoteOnly||g.value==g.cancelValue;j?this.$cancel.removeClass(g.cancelHoverClass).addClass(g.cancelDisabledClass):this.$cancel.removeClass(g.cancelDisabledClass);
this.$cancel.css("opacity",j?0.5:1);return j},_disableAll:function(){var g=this.options;this._disableCancel();g.disabled?this.$stars.filter("div").addClass(g.starDisabledClass):this.$stars.filter("div").removeClass(g.starDisabledClass)},_showCap:function(g){var j=this.options;j.captionEl&&j.captionEl.text(g)},value:function(){return this.options.value},select:function(g){var j=this.options,g=g==j.cancelValue?this.$cancel:this.$stars.eq(j.val2id[g]);j.forceSelect=!0;g.triggerHandler("click.stars");
j.forceSelect=!1},selectID:function(g){var j=this.options,g=g==-1?this.$cancel:this.$stars.eq(g);j.forceSelect=!0;g.triggerHandler("click.stars");j.forceSelect=!1},enable:function(){this.options.disabled=!1;this._disableAll()},disable:function(){this.options.disabled=!0;this._disableAll()},destroy:function(){this.$form.unbind(".stars");this.$cancel.unbind(".stars").remove();this.$stars.unbind(".stars").remove();this.$value.remove();this.element.unbind(".stars").html(this.element.data("former.stars")).removeData("stars");
return this},callback:function(g,j){var d=this.options;d.callback&&d.callback(this,j,d.value,g);d.oneVoteOnly&&!d.disabled&&this.disable()}});g.extend(g.ui.stars,{version:"3.0.1"})})(jQuery);
var swfobject=function(){function g(){if(!H){try{var b=w.getElementsByTagName("body")[0].appendChild(w.createElement("span"));b.parentNode.removeChild(b)}catch(d){return}H=!0;for(var b=N.length,e=0;e<b;e++)N[e]()}}function k(b){H?b():N[N.length]=b}function j(b){if(typeof F.addEventListener!=m)F.addEventListener("load",b,!1);else if(typeof w.addEventListener!=m)w.addEventListener("load",b,!1);else if(typeof F.attachEvent!=m)A(F,"onload",b);else if(typeof F.onload=="function"){var d=F.onload;F.onload=
function(){d();b()}}else F.onload=b}function d(){var b=w.getElementsByTagName("body")[0],d=w.createElement(E);d.setAttribute("type",C);var g=b.appendChild(d);if(g){var j=0;(function(){if(typeof g.GetVariable!=m){var k=g.GetVariable("$version");if(k)k=k.split(" ")[1].split(","),u.pv=[parseInt(k[0],10),parseInt(k[1],10),parseInt(k[2],10)]}else if(j<10){j++;setTimeout(arguments.callee,10);return}b.removeChild(d);g=null;e()})()}else e()}function e(){var b=G.length;if(b>0)for(var d=0;d<b;d++){var e=G[d].id,
g=G[d].callbackFn,j={success:!1,id:e};if(u.pv[0]>0){var k=l(e);if(k)if(s(G[d].swfVersion)&&!(u.wk&&u.wk<312)){if(p(e,!0),g)j.success=!0,j.ref=o(e),g(j)}else if(G[d].expressInstall&&t()){j={};j.data=G[d].expressInstall;j.width=k.getAttribute("width")||"0";j.height=k.getAttribute("height")||"0";if(k.getAttribute("class"))j.styleclass=k.getAttribute("class");if(k.getAttribute("align"))j.align=k.getAttribute("align");for(var n={},k=k.getElementsByTagName("param"),A=k.length,D=0;D<A;D++)k[D].getAttribute("name").toLowerCase()!=
"movie"&&(n[k[D].getAttribute("name")]=k[D].getAttribute("value"));r(j,n,e,g)}else q(k),g&&g(j)}else if(p(e,!0),g){if((e=o(e))&&typeof e.SetVariable!=m)j.success=!0,j.ref=e;g(j)}}}function o(b){var d=null;if((b=l(b))&&b.nodeName=="OBJECT")typeof b.SetVariable!=m?d=b:(b=b.getElementsByTagName(E)[0])&&(d=b);return d}function t(){return!T&&s("6.0.65")&&(u.win||u.mac)&&!(u.wk&&u.wk<312)}function r(b,d,e,g){T=!0;S=g||null;R={success:!1,id:e};var j=l(e);if(j){j.nodeName=="OBJECT"?(O=v(j),D=null):(O=j,D=
e);b.id=Z;if(typeof b.width==m||!/%$/.test(b.width)&&parseInt(b.width,10)<310)b.width="310";if(typeof b.height==m||!/%$/.test(b.height)&&parseInt(b.height,10)<137)b.height="137";w.title=w.title.slice(0,47)+" - Flash Player Installation";g=u.ie&&u.win?"ActiveX":"PlugIn";g="MMredirectURL="+encodeURI(window.location).toString().replace(/&/g,"%26")+"&MMplayerType="+g+"&MMdoctitle="+w.title;typeof d.flashvars!=m?d.flashvars+="&"+g:d.flashvars=g;if(u.ie&&u.win&&j.readyState!=4)g=w.createElement("div"),
e+="SWFObjectNew",g.setAttribute("id",e),j.parentNode.insertBefore(g,j),j.style.display="none",function(){j.readyState==4?j.parentNode.removeChild(j):setTimeout(arguments.callee,10)}();n(b,d,e)}}function q(b){if(u.ie&&u.win&&b.readyState!=4){var d=w.createElement("div");b.parentNode.insertBefore(d,b);d.parentNode.replaceChild(v(b),d);b.style.display="none";(function(){b.readyState==4?b.parentNode.removeChild(b):setTimeout(arguments.callee,10)})()}else b.parentNode.replaceChild(v(b),b)}function v(b){var d=
w.createElement("div");if(u.win&&u.ie)d.innerHTML=b.innerHTML;else if(b=b.getElementsByTagName(E)[0])if(b=b.childNodes)for(var e=b.length,g=0;g<e;g++)!(b[g].nodeType==1&&b[g].nodeName=="PARAM")&&b[g].nodeType!=8&&d.appendChild(b[g].cloneNode(!0));return d}function n(b,d,e){var g,j=l(e);if(u.wk&&u.wk<312)return g;if(j){if(typeof b.id==m)b.id=e;if(u.ie&&u.win){var k="",n;for(n in b)if(b[n]!=Object.prototype[n])n.toLowerCase()=="data"?d.movie=b[n]:n.toLowerCase()=="styleclass"?k+=' class="'+b[n]+'"':
n.toLowerCase()!="classid"&&(k+=" "+n+'="'+b[n]+'"');n="";for(var p in d)d[p]!=Object.prototype[p]&&(n+='<param name="'+p+'" value="'+d[p]+'" />');j.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+k+">"+n+"</object>";J[J.length]=b.id;g=l(b.id)}else{p=w.createElement(E);p.setAttribute("type",C);for(var s in b)b[s]!=Object.prototype[s]&&(s.toLowerCase()=="styleclass"?p.setAttribute("class",b[s]):s.toLowerCase()!="classid"&&p.setAttribute(s,b[s]));for(k in d)d[k]!=Object.prototype[k]&&
k.toLowerCase()!="movie"&&(b=p,n=k,s=d[k],e=w.createElement("param"),e.setAttribute("name",n),e.setAttribute("value",s),b.appendChild(e));j.parentNode.replaceChild(p,j);g=p}}return g}function z(b){var d=l(b);if(d&&d.nodeName=="OBJECT")u.ie&&u.win?(d.style.display="none",function(){if(d.readyState==4){var e=l(b);if(e){for(var g in e)typeof e[g]=="function"&&(e[g]=null);e.parentNode.removeChild(e)}}else setTimeout(arguments.callee,10)}()):d.parentNode.removeChild(d)}function l(b){var d=null;try{d=w.getElementById(b)}catch(e){}return d}
function A(b,d,e){b.attachEvent(d,e);K[K.length]=[b,d,e]}function s(b){var d=u.pv,b=b.split(".");b[0]=parseInt(b[0],10);b[1]=parseInt(b[1],10)||0;b[2]=parseInt(b[2],10)||0;return d[0]>b[0]||d[0]==b[0]&&d[1]>b[1]||d[0]==b[0]&&d[1]==b[1]&&d[2]>=b[2]?!0:!1}function b(b,d,e,g){if(!u.ie||!u.mac){var j=w.getElementsByTagName("head")[0];if(j){e=e&&typeof e=="string"?e:"screen";g&&(U=P=null);if(!P||U!=e)g=w.createElement("style"),g.setAttribute("type","text/css"),g.setAttribute("media",e),P=j.appendChild(g),
u.ie&&u.win&&typeof w.styleSheets!=m&&w.styleSheets.length>0&&(P=w.styleSheets[w.styleSheets.length-1]),U=e;u.ie&&u.win?P&&typeof P.addRule==E&&P.addRule(b,d):P&&typeof w.createTextNode!=m&&P.appendChild(w.createTextNode(b+" {"+d+"}"))}}}function p(d,e){if(V){var g=e?"visible":"hidden";H&&l(d)?l(d).style.visibility=g:b("#"+d,"visibility:"+g)}}function Y(b){return/[\\\"<>\.;]/.exec(b)!=null&&typeof encodeURIComponent!=m?encodeURIComponent(b):b}var m="undefined",E="object",C="application/x-shockwave-flash",
Z="SWFObjectExprInst",F=window,w=document,I=navigator,M=!1,N=[function(){M?d():e()}],G=[],J=[],K=[],O,D,S,R,H=!1,T=!1,P,U,V=!0,u=function(){var b=typeof w.getElementById!=m&&typeof w.getElementsByTagName!=m&&typeof w.createElement!=m,d=I.userAgent.toLowerCase(),e=I.platform.toLowerCase(),g=e?/win/.test(e):/win/.test(d),e=e?/mac/.test(e):/mac/.test(d),d=/webkit/.test(d)?parseFloat(d.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,j=!+"\u000b1",k=[0,0,0],l=null;if(typeof I.plugins!=m&&typeof I.plugins["Shockwave Flash"]==
E){if((l=I.plugins["Shockwave Flash"].description)&&!(typeof I.mimeTypes!=m&&I.mimeTypes[C]&&!I.mimeTypes[C].enabledPlugin))M=!0,j=!1,l=l.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),k[0]=parseInt(l.replace(/^(.*)\..*$/,"$1"),10),k[1]=parseInt(l.replace(/^.*\.(.*)\s.*$/,"$1"),10),k[2]=/[a-zA-Z]/.test(l)?parseInt(l.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}else if(typeof F.ActiveXObject!=m)try{var n=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(n&&(l=n.GetVariable("$version")))j=!0,l=l.split(" ")[1].split(","),
k=[parseInt(l[0],10),parseInt(l[1],10),parseInt(l[2],10)]}catch(p){}return{w3:b,pv:k,wk:d,ie:j,win:g,mac:e}}();(function(){u.w3&&((typeof w.readyState!=m&&w.readyState=="complete"||typeof w.readyState==m&&(w.getElementsByTagName("body")[0]||w.body))&&g(),H||(typeof w.addEventListener!=m&&w.addEventListener("DOMContentLoaded",g,!1),u.ie&&u.win&&(w.attachEvent("onreadystatechange",function(){w.readyState=="complete"&&(w.detachEvent("onreadystatechange",arguments.callee),g())}),F==top&&function(){if(!H){try{w.documentElement.doScroll("left")}catch(b){setTimeout(arguments.callee,
0);return}g()}}()),u.wk&&function(){H||(/loaded|complete/.test(w.readyState)?g():setTimeout(arguments.callee,0))}(),j(g)))})();(function(){u.ie&&u.win&&window.attachEvent("onunload",function(){for(var b=K.length,d=0;d<b;d++)K[d][0].detachEvent(K[d][1],K[d][2]);b=J.length;for(d=0;d<b;d++)z(J[d]);for(var e in u)u[e]=null;u=null;for(var g in swfobject)swfobject[g]=null;swfobject=null})})();return{registerObject:function(b,d,e,g){if(u.w3&&b&&d){var j={};j.id=b;j.swfVersion=d;j.expressInstall=e;j.callbackFn=
g;G[G.length]=j;p(b,!1)}else g&&g({success:!1,id:b})},getObjectById:function(b){if(u.w3)return o(b)},embedSWF:function(b,d,e,g,j,l,A,D,o,z){var R={success:!1,id:d};u.w3&&!(u.wk&&u.wk<312)&&b&&d&&e&&g&&j?(p(d,!1),k(function(){e+="";g+="";var k={};if(o&&typeof o===E)for(var C in o)k[C]=o[C];k.data=b;k.width=e;k.height=g;C={};if(D&&typeof D===E)for(var w in D)C[w]=D[w];if(A&&typeof A===E)for(var q in A)typeof C.flashvars!=m?C.flashvars+="&"+q+"="+A[q]:C.flashvars=q+"="+A[q];if(s(j))w=n(k,C,d),k.id==
d&&p(d,!0),R.success=!0,R.ref=w;else if(l&&t()){k.data=l;r(k,C,d,z);return}else p(d,!0);z&&z(R)})):z&&z(R)},switchOffAutoHideShow:function(){V=!1},ua:u,getFlashPlayerVersion:function(){return{major:u.pv[0],minor:u.pv[1],release:u.pv[2]}},hasFlashPlayerVersion:s,createSWF:function(b,d,e){if(u.w3)return n(b,d,e)},showExpressInstall:function(b,d,e,g){u.w3&&t()&&r(b,d,e,g)},removeSWF:function(b){u.w3&&z(b)},createCSS:function(d,e,g,j){u.w3&&b(d,e,g,j)},addDomLoadEvent:k,addLoadEvent:j,getQueryParamValue:function(b){var d=
w.location.search||w.location.hash;if(d){/\?/.test(d)&&(d=d.split("?")[1]);if(b==null)return Y(d);for(var d=d.split("&"),e=0;e<d.length;e++)if(d[e].substring(0,d[e].indexOf("="))==b)return Y(d[e].substring(d[e].indexOf("=")+1))}return""},expressInstallCallback:function(){if(T){var b=l(Z);if(b&&O){b.parentNode.replaceChild(O,b);if(D&&(p(D,!0),u.ie&&u.win))O.style.display="block";S&&S(R)}T=!1}}}}();
(function(){function g(d){if(!d||typeof d!="object")return d;var e=new d.constructor,j;for(j in d)d.hasOwnProperty(j)&&(e[j]=g(d[j]));return e}function k(d,e){if(d){var g,b=0,j=d.length;if(j===void 0)for(g in d){if(e.call(d[g],g,d[g])===!1)break}else for(g=d[0];b<j&&e.call(g,b,g)!==!1;g=d[++b]);return d}}function j(d,e,g){if(typeof e!="object")return d;d&&e&&k(e,function(b,e){if(!g||typeof e!="function")d[b]=e});return d}function d(d){var e=d.indexOf(".");if(e!=-1){var g=d.slice(0,e)||"*",b=d.slice(e+
1,d.length),j=[];k(document.getElementsByTagName(g),function(){this.className&&this.className.indexOf(b)!=-1&&j.push(this)});return j}}function e(d){d=d||window.event;d.preventDefault?(d.stopPropagation(),d.preventDefault()):(d.returnValue=!1,d.cancelBubble=!0);return!1}function o(d,e,g){d[e]=d[e]||[];d[e].push(g)}function t(){return"_"+(""+Math.random()).slice(2,10)}function r(d,A,s){function b(){function b(d){!p.isLoaded()&&p._fireEvent("onBeforeClick")!==!1&&p.load();return e(d)}$f(d)?($f(d).getParent().innerHTML=
"",N=$f(d).getIndex(),z[N]=p):(z.push(p),N=z.length-1);K=parseInt(d.style.height,10)||d.clientHeight;I=d.id||"fp"+t();M=A.id||I+"_api";A.id=M;s.playerId=I;typeof s=="string"&&(s={clip:{url:s}});if(typeof s.clip=="string")s.clip={url:s.clip};s.clip=s.clip||{};if(d.getAttribute("href",2)&&!s.clip.url)s.clip.url=d.getAttribute("href",2);C=new v(s.clip,-1,p);s.playlist=s.playlist||[s.clip];var g=0;k(s.playlist,function(){var b=this;typeof b=="object"&&b.length&&(b={url:""+b});k(s.clip,function(d,e){e!==
void 0&&b[d]===void 0&&typeof e!="function"&&(b[d]=e)});s.playlist[g]=b;b=new v(b,g,p);r.push(b);g++});k(s,function(b,d){if(typeof d=="function"){if(C[b])C[b](d);else o(w,b,d);delete s[b]}});k(s.plugins,function(b,d){d&&(F[b]=new n(b,d,p))});if(!s.plugins||s.plugins.controls===void 0)F.controls=new n("controls",null,p);F.canvas=new n("canvas",null,p);E=d.innerHTML;E.replace(/\s/g,"")!==""?d.addEventListener?d.addEventListener("click",b,!1):d.attachEvent&&d.attachEvent("onclick",b):(d.addEventListener&&
d.addEventListener("click",e,!1),p.load())}var p=this,q=null,m=!1,E,C,r=[],F={},w={},I,M,N,G,J,K;j(p,{id:function(){return I},isLoaded:function(){return q!==null&&q.fp_play!=void 0&&!m},getParent:function(){return d},hide:function(b){if(b)d.style.height="0px";if(p.isLoaded())q.style.height="0px";return p},show:function(){d.style.height=K+"px";if(p.isLoaded())q.style.height=J+"px";return p},isHidden:function(){return p.isLoaded()&&parseInt(q.style.height,10)===0},load:function(b){if(!p.isLoaded()&&
p._fireEvent("onBeforeLoad")!==!1){var e=0;k(z,function(){this.unload(function(){if(++e==z.length){if((E=d.innerHTML)&&!flashembed.isSupported(A.version))d.innerHTML="";flashembed(d,A,{config:s});if(b)b.cached=!0,o(w,"onLoad",b)}})})}return p},unload:function(b){if(this.isFullscreen()&&/WebKit/i.test(navigator.userAgent))return b&&b(!1),p;if(E.replace(/\s/g,"")!==""){if(p._fireEvent("onBeforeUnload")===!1)return b&&b(!1),p;m=!0;try{q&&(q.fp_close(),p._fireEvent("onUnload"))}catch(e){}setTimeout(function(){q=
null;d.innerHTML=E;m=!1;b&&b(!0)},50)}else b&&b(!1);return p},getClip:function(b){b===void 0&&(b=G);return r[b]},getCommonClip:function(){return C},getPlaylist:function(){return r},getPlugin:function(b){var d=F[b];if(!d&&p.isLoaded()){var e=p._api().fp_getPlugin(b);e&&(d=new n(b,e,p),F[b]=d)}return d},getScreen:function(){return p.getPlugin("screen")},getControls:function(){return p.getPlugin("controls")._fireEvent("onUpdate")},getLogo:function(){try{return p.getPlugin("logo")._fireEvent("onUpdate")}catch(b){}},
getPlay:function(){return p.getPlugin("play")._fireEvent("onUpdate")},getConfig:function(b){return b?g(s):s},getFlashParams:function(){return A},loadPlugin:function(b,d,e,g){typeof e=="function"&&(g=e,e={});var j=g?t():"_";p._api().fp_loadPlugin(b,d,e,j);d={};d[j]=g;g=new n(b,null,p,d);return F[b]=g},getState:function(){return p.isLoaded()?q.fp_getState():-1},play:function(b,d){var e=function(){b!==void 0?p._api().fp_play(b,d):p._api().fp_play()};p.isLoaded()?e():m?setTimeout(function(){p.play(b,
d)},50):p.load(function(){e()});return p},getVersion:function(){if(p.isLoaded()){var b=q.fp_getVersion();b.push("flowplayer.js 3.2.0");return b}return"flowplayer.js 3.2.0"},_api:function(){if(!p.isLoaded())throw"Flowplayer "+p.id()+" not loaded when calling an API method";return q},setClip:function(b){p.setPlaylist([b]);return p},getIndex:function(){return N}});k("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut".split(","),
function(){var b="on"+this;if(b.indexOf("*")!=-1){var b=b.slice(0,b.length-1),d="onBefore"+b.slice(2);p[d]=function(b){o(w,d,b);return p}}p[b]=function(d){o(w,b,d);return p}});k("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed,setKeyboardShortcutsEnabled,isKeyboardShortcutsEnabled".split(","),function(){var b=this;p[b]=function(d,e){if(!p.isLoaded())return p;
var g=null,g=d!==void 0&&e!==void 0?q["fp_"+b](d,e):d===void 0?q["fp_"+b]():q["fp_"+b](d);return g==="undefined"||g===void 0?p:g}});p._fireEvent=function(b){typeof b=="string"&&(b=[b]);var d=b[0],e=b[1],g=b[2],j=b[3],l=0;if(!p.isLoaded()&&d=="onLoad"&&e=="player")q=q||document.getElementById(M),J=q.clientHeight,k(r,function(){this._fireEvent("onLoad")}),k(F,function(b,d){d._fireEvent("onUpdate")}),C._fireEvent("onLoad");if(!(d=="onLoad"&&e!="player")){if(d=="onError"&&(typeof e=="string"||typeof e==
"number"&&typeof g=="number"))e=g,g=j;if(d=="onContextMenu")k(s.contextMenu[e],function(b,d){d.call(p)});else if(d=="onPluginEvent"||d=="onBeforePluginEvent"){if(j=F[e.name||e])return j._fireEvent("onUpdate",e),j._fireEvent(g,b.slice(3))}else{if(d=="onPlaylistReplace"){r=[];var n=0;k(e,function(){r.push(new v(this,n++,p))})}if(d=="onClipAdd"){if(e.isInStream)return;e=new v(e,g,p);r.splice(g,0,e);for(l=g+1;l<r.length;l++)r[l].index++}var m=!0;if(typeof e=="number"&&e<r.length&&(G=e,(b=r[e])&&(m=b._fireEvent(d,
g,j)),!b||m!==!1))m=C._fireEvent(d,g,j,b);k(w[d],function(){m=this.call(p,e,g);this.cached&&w[d].splice(l,1);if(m===!1)return!1;l++});return m}}};if(typeof d=="string"){var O=document.getElementById(d);if(O)d=O,b();else throw"Flowplayer cannot access element: "+d;}else b()}function q(d){this.length=d.length;this.each=function(e){k(d,e)};this.size=function(){return d.length}}var v=function(d,e,g){var b=this,n={},q={};b.index=e;typeof d=="string"&&(d={url:d});j(this,d,!0);k("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop".split(","),
function(){var d="on"+this;if(d.indexOf("*")!=-1){var d=d.slice(0,d.length-1),j="onBefore"+d.slice(2);b[j]=function(d){o(q,j,d);return b}}b[d]=function(e){o(q,d,e);return b};e==-1&&(b[j]&&(g[j]=b[j]),b[d]&&(g[d]=b[d]))});j(this,{onCuepoint:function(d,j){if(arguments.length==1)return n.embedded=[null,d],b;typeof d=="number"&&(d=[d]);var k=t();n[k]=[d,j];g.isLoaded()&&g._api().fp_addCuepoints(d,e,k);return b},update:function(d){j(b,d);g.isLoaded()&&g._api().fp_updateClip(d,e);var k=g.getConfig();j(e==
-1?k.clip:k.playlist[e],d,!0)},_fireEvent:function(d,l,m,o){if(d=="onLoad")return k(n,function(b,d){d[0]&&g._api().fp_addCuepoints(d[0],e,b)}),!1;o=o||b;if(d=="onCuepoint"){var r=n[l];if(r)return r[1].call(g,o,m)}if(l&&"onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(d)!=-1&&(j(o,l),l.metaData))o.duration?o.fullDuration=l.metaData.duration:o.duration=l.metaData.duration;var z=!0;k(q[d],function(){z=this.call(g,o,l,m)});return z}});if(d.onCuepoint){var m=d.onCuepoint;b.onCuepoint.apply(b,
typeof m=="function"?[m]:m);delete d.onCuepoint}k(d,function(b,e){typeof e=="function"&&(o(q,b,e),delete d[b])});if(e==-1)g.onCuepoint=this.onCuepoint},n=function(d,e,g,b){var n=this,o={},m=!1;b&&j(o,b);k(e,function(b,d){typeof d=="function"&&(o[b]=d,delete e[b])});j(this,{animate:function(b,j,k){if(!b)return n;typeof j=="function"&&(k=j,j=500);if(typeof b=="string"){var m=b,b={};b[m]=j;j=500}if(k){var q=t();o[q]=k}j===void 0&&(j=500);e=g._api().fp_animate(d,b,j,q);return n},css:function(b,k){if(k!==
void 0){var m={};m[b]=k;b=m}e=g._api().fp_css(d,b);j(n,e);return n},show:function(){this.display="block";g._api().fp_showPlugin(d);return n},hide:function(){this.display="none";g._api().fp_hidePlugin(d);return n},toggle:function(){this.display=g._api().fp_togglePlugin(d);return n},fadeTo:function(b,e,j){typeof e=="function"&&(j=e,e=500);if(j){var k=t();o[k]=j}this.display=g._api().fp_fadeTo(d,b,e,k);this.opacity=b;return n},fadeIn:function(b,d){return n.fadeTo(1,b,d)},fadeOut:function(b,d){return n.fadeTo(0,
b,d)},getName:function(){return d},getPlayer:function(){return g},_fireEvent:function(b,e){if(b=="onUpdate"){var q=g._api().fp_getPlugin(d);if(!q)return;j(n,q);delete n.methods;m||(k(q.methods,function(){var b=""+this;n[b]=function(){var e=[].slice.call(arguments),e=g._api().fp_invoke(d,b,e);return e==="undefined"||e===void 0?n:e}}),m=!0)}if(q=o[b])return q=q.apply(n,e),b.slice(0,1)=="_"&&delete o[b],q;return n}})},z=[];window.flowplayer=window.$f=function(){var e=null,n=arguments[0];if(!arguments.length)return k(z,
function(){if(this.isLoaded())return e=this,!1}),e||z[0];if(arguments.length==1)if(typeof n=="number")return z[n];else{if(n=="*")return new q(z);k(z,function(){if(this.id()==n.id||this.id()==n||this.getParent()==n)return e=this,!1});return e}if(arguments.length>1){var o=arguments[1],b=arguments.length==3?arguments[2]:{};typeof o=="string"&&(o={src:o});o=j({bgcolor:"#000000",version:[9,0],expressInstall:"http://static.flowplayer.org/swf/expressinstall.swf",cachebusting:!0},o);if(typeof n=="string")if(n.indexOf(".")!=
-1){var p=[];k(d(n),function(){p.push(new r(this,g(o),g(b)))});return new q(p)}else{var t=document.getElementById(n);return new r(t!==null?t:n,o,b)}else if(n)return new r(n,o,b)}return null};j(window.$f,{fireEvent:function(){var d=[].slice.call(arguments),e=$f(d[0]);return e?e._fireEvent(d.slice(1)):null},addPlugin:function(d,e){r.prototype[d]=e;return $f},each:k,extend:j});if(typeof jQuery=="function")jQuery.fn.flowplayer=function(d,e){if(!arguments.length||typeof arguments[0]=="number"){var j=[];
this.each(function(){var b=$f(this);b&&j.push(b)});return arguments.length?j[arguments[0]]:new q(j)}return this.each(function(){$f(this,g(d),e?g(e):{})})}})();
(function(){function g(d,e){if(e)for(key in e)e.hasOwnProperty(key)&&(d[key]=e[key]);return d}function k(d,e){var g=[],j;for(j in d)d.hasOwnProperty(j)&&(g[j]=e(d[j]));return g}function j(j,k,l){if(q.isSupported(k.version))j.innerHTML=q.getHTML(k,l);else if(k.expressInstall&&q.isSupported([6,65]))j.innerHTML=q.getHTML(g(k,{src:k.expressInstall}),{MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title});else{if(!j.innerHTML.replace(/\s/g,"")&&(j.innerHTML="<h2>Flash version "+
k.version+" or greater is required</h2><h3>"+(v[0]>0?"Your version is "+v:"You have no flash plugin installed")+"</h3>"+(j.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+e+"'>here</a></p>"),j.tagName=="A"))j.onclick=function(){location.href=e};if(k.onFail){var o=k.onFail.call(this);if(typeof o=="string")j.innerHTML=o}}d&&(window[k.id]=document.getElementById(k.id));g(this,{getRoot:function(){return j},getOptions:function(){return k},getConf:function(){return l},
getApi:function(){return j.firstChild}})}var d=document.all,e="http://www.adobe.com/go/getflashplayer",o=typeof jQuery=="function",t=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,r={width:"100%",height:"100%",id:"_"+(""+Math.random()).slice(9),allowfullscreen:!0,allowscriptaccess:"always",quality:"high",wmode:"opaque",version:[3,0],onFail:null,expressInstall:null,w3c:!1,cachebusting:!1};window.attachEvent&&window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=
function(){}});window.flashembed=function(d,e,k){typeof d=="string"&&(d=document.getElementById(d.replace("#","")));if(d)return typeof e=="string"&&(e={src:e}),new j(d,g(g({},r),e),k)};var q=g(window.flashembed,{conf:r,getVersion:function(){var d;try{d=navigator.plugins["Shockwave Flash"].description.slice(16)}catch(e){try{var g=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");d=g&&g.GetVariable("$version")}catch(j){}}return(d=t.exec(d))?[d[1],d[3]]:[0,0]},asString:function(d){if(d===null||d===
void 0)return null;var e=typeof d;e=="object"&&d.push&&(e="array");switch(e){case "string":return d=d.replace(RegExp('(["\\\\])',"g"),"\\$1"),d=d.replace(/^\s?(\d+\.?\d+)%/,"$1pct"),'"'+d+'"';case "array":return"["+k(d,function(d){return q.asString(d)}).join(",")+"]";case "function":return'"function()"';case "object":var e=[],g;for(g in d)d.hasOwnProperty(g)&&e.push('"'+g+'":'+q.asString(d[g]));return"{"+e.join(",")+"}"}return String(d).replace(/\s/g," ").replace(/\'/g,'"')},getHTML:function(e,j){var e=
g({},e),k='<object width="'+e.width+'" height="'+e.height+'" id="'+e.id+'" name="'+e.id+'"';e.cachebusting&&(e.src+=(e.src.indexOf("?")!=-1?"&":"?")+Math.random());k+=e.w3c||!d?' data="'+e.src+'" type="application/x-shockwave-flash"':' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';k+=">";if(e.w3c||d)k+='<param name="movie" value="'+e.src+'" />';e.width=e.height=e.id=e.w3c=e.src=null;e.onFail=e.version=e.expressInstall=null;for(var o in e)e[o]&&(k+='<param name="'+o+'" value="'+e[o]+'" />');
o="";if(j){for(var r in j)if(j[r]){var b=j[r];o+=r+"="+(/function|object/.test(typeof b)?q.asString(b):b)+"&"}o=o.slice(0,-1);k+='<param name="flashvars" value=\''+o+"' />"}k+="</object>";return k},isSupported:function(d){return v[0]>d[0]||v[0]==d[0]&&v[1]>=d[1]}}),v=q.getVersion();if(o)jQuery.tools=jQuery.tools||{version:"3.2.0"},jQuery.tools.flashembed={conf:r},jQuery.fn.flashembed=function(d,e){return this.each(function(){$(this).data("flashembed",flashembed(this,d,e))})}})();
/****VIDEO PLAYER*****/

var ADMIN_URL="/admin";
var ACCESS_URL="/snowlogClient";
var VIDEO_THUMBS_URL = ADMIN_URL+"/archivos/videos/thumbs";
var VIDEO_THUMBS_EXT = ".png";
var VIDEO_THUMBS_DINAMICOS_EXT = ".gif";
var VIDEO_DOWNLOAD_URL = "http://snowlog.s3.amazonaws.com/";
var BANNER_PPAL_URL = ADMIN_URL+"/archivos/publicidad";
var BANNER_EXT = ".gif";
var SUBS_URL="/admin/archivos/videos/subs/";

var control_enabled = false;
var control_visible=false;

function getVideoHome(inicio){
	var get = getUrlVars();
	var film;
	if(inicio && get['id'] && get['id'].length>0){
		film = get['id']+"_360";
		home=false;
		startPlayer(film);
//		currentVideo=data;
		$("#guideVideoName").text(get['titulo'].replace(/\+/g, ' '));

//		openVideoPlayer(data.id, false);
		window.video.enableControlBarVisibility(true);	
		window.video.sendBackground(false);
		
	}else{
		film = "home/1";
		if(inicio){
			startPlayer(film);						
		}else{
			home=true;
			window.video.enableControlBarVisibility(false);
			openVideoPlayer(film, true);
		}
	}
	/*
	$.getJSON(ACCESS_URL+"/home?jsoncallback=?",
			function(data){
				if(inicio && get['id'] && get['id'].length>0){
					film = get['id']+"_360";
					home=false;
					startPlayer(film);						
					currentVideo=data;
					window.video.enableControlBarVisibility(true);
					$("#guideVideoName").text(get['titulo'].replace(/\+/g, ' '));
				}else{
					var i = Math.floor(Math.random()*data.length);
					var homeVideoId = data[i].id;
					film = "home/"+homeVideoId;
					if(inicio){
						startPlayer(film);						
					}else{
						home=true;
						window.video.enableControlBarVisibility(false);
						openVideoPlayer(film, true);
					}
				}
			}
			);
	*/
}

function startPlayer(film){
	flowplayer("player_movie", "/flash/flowplayer.commercial-3.2.3.swf",{ //ojo
			"plugins":{
				"controls":{
					"borderRadius":0,
					"timeColor":"rgba(109, 109, 109, 1)",
					"bufferGradient":"none",
					"slowForward":true,
					"backgroundColor":"rgba(0, 0, 0, 0)",
					"volumeSliderGradient":"none",
					"slowBackward":false,
					"timeBorderRadius":5,
					"time":true,
					"progressGradient":"none",
					"height":25,
					"volumeColor":"#4599ff",
					"tooltips":{
						"marginBottom":5,
						"volume":true,
						"scrubber":true,
						"buttons":false
					},
					"fastBackward":false,
					"opacity":1,
					"timeFontSize":12,
					"volumeSliderColor":"#ffffff",
					"border":"0px",
					"bufferColor":"#a3a3a3",
					"buttonColor":"#ffffff",
					"mute":true,
					"autoHide":{
						"enabled":true,
						"hideDelay":500,
						"hideStyle":"fade",
						"mouseOutDelay":400,
						"hideDuration":300,
						"fullscreenOnly":true
					},
					"backgroundGradient":"none",
					"width":"100pct",
					"display":"block",
					"sliderBorder":"1px solid rgba(128, 128, 128, 0.7)",
					"buttonOverColor":"#ffffff",
					"fullscreen":true,
					"timeBgColor":"rgba(0, 0, 0, 1)",
					"borderWidth":0,
					"scrubberBarHeightRatio":0.5,
					"bottom":0,
					"stop":false,
					"zIndex":1,
					"sliderColor":"#000000",
					"scrubberHeightRatio":0.5,
					"tooltipTextColor":"#ffffff",
					"sliderGradient":"none",
					"timeBgHeightRatio":0.5,
					"volumeSliderHeightRatio":0.5,
					"timeSeparator":" ",
					"name":"controls",
					"volumeBarHeightRatio":0.5,
					"left":"50pt",
					"tooltipColor":"rgba(0, 0, 0, 0)",
					"playlist":false,
					"durationColor":"rgba(109, 109, 109, 1)",
					"play":true,
					"fastForward":true,
					"progressColor":"#017Eff",
					"timeBorder":"0px solid rgba(0, 0, 0, 0.3)",
					"volume":true,
					"scrubber":true,
					"builtIn":false,
					"volumeBorder":"1px solid rgba(128, 128, 128, 0.7)",
//                            "onLoad": function(){this.getPlugin("controls").hide();}
					"display":"none"

				},
				// the RTMP plugin
				rtmp: {
					url: '/flash/flowplayer.rtmp-3.2.2-dev.swf',
	
					// netConnectionUrl has our CloudFront domain name + 'cfx/st'
					netConnectionUrl: 'rtmp://scit63yrot8wj.cloudfront.net/cfx/st'
				},
                /*
                    configure a content plugin so that it
                    looks good for showing subtitles
                */
                content: {
                    url:'flowplayer.content-3.2.0.swf',
                    bottom: 5,
                    height:50,
                    backgroundColor: 'transparent',
                    backgroundGradient: 'none',
                    border: 0,
                    textDecoration: 'outline',
                    style: {
                        body: {
                            fontSize: 20,
                            fontFamily: 'Arial',
                            fontStyle: 'bold',
                            textAlign: 'center',
                            color: '#FFFFFF'
                        }
                    },
                    display:"none"
                },
                // the captions plugin
                captions: {
                    url: 'flowplayer.captions-3.2.0.swf',

                    // pointer to a content plugin (see below)
                    captionTarget: 'content',
                    captionType: 'external',
                    button:null
                }
            },
			key:'#$26b4973ef4e4fa4656b',
			cachebusting: true,
            showErrors:false,
            log: {level:"supress"},
            clip: {
                // use the RTMP plugin
                //provider: 'rtmp',
                //bufferLength: 30,
                //autobuffering: true,
		baseUrl:'http://dtm5pxmpz0br1.cloudfront.net',
                onStart:snowlog_start,
                onFinish:snowlog_ends,
				
				scaling: 'orig'
                // this is the SubRib file with captions info
//                captionUrl: 'subs/test.srt',
            },
            onLoad:function(){ playerCargado = true; if(!modoNavegacion) {if(film){initMovie(film)}; videoIniciado = true;} }

//                    onLoad: function(){}
		});
		$("#player").css("display","block");

}

function initMovie(film){
	$f().play(film+".mp4");
	//$f().getPlugin("captions").loadCaptions(0,SUBS_URL+film+".xml");
}

function snowlog_start(){
    bindContainer();
	$('#animation').hide();
    this.getConfig().play=null;
	$.preloadImages("/images/fondo.png");
}

function snowlog_ends(){
	if(playAllIndex>-1){
		playNextVideoFromPlaylist('next');
	}else{
		openGuide();
		unbindContainer();
	}
}

function getUrlVars(){
	var vars = [], hash;
	var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

	for(var i = 0; i < hashes.length; i++){
		hash = hashes[i].split('=');
		vars.push(hash[0]);
		vars[hash[0]] = hash[1];
	}

	return vars;
}


//register a console.log function if firebug is missing
if (!window.console) {
    window.console = {log:function(msg){}};
}


var snowlog={};
snowlog.flowplayer = {};
snowlog.flowplayer.subsClick=function(){
    var captions= $f().getPlugin("captions");
    captions.toggleCaption();
}
snowlog.flowplayer.commentClick=function(){openCommentsFromPlayer();
									docElements.pantalla.fadeOut(HIDE_DELAY_PANTALLA);
									$('#bodyId').removeClass('pantallaBody');
									$('.footer-social').show();
								}
snowlog.flowplayer.infoClick=function(){openInfoFromPlayer();
									docElements.pantalla.fadeOut(HIDE_DELAY_PANTALLA);
									$('#bodyId').removeClass('pantallaBody');
									$('.footer-social').show();
								}

//CREATE VIDEO INSTANCE
window.video = new VideoPlayer("Main");

video.flashMovieInitialized = function() {
    //bindContainer();
    //window.video.enableControlBarVisibility(true);
}

video.showInfo = function() {
    openInfoFromPlayer();
}

video.showComments = function() {
    openCommentsFromPlayer();
}

video.ended = function() {
	openGuide();
	unbindContainer();		
}

video.playing = function() {//need videoStarted??
//    console.log("Video started!");
    //    video.enableControlBarVisibility(true);
    bindContainer();
}

function VideoPlayer(id) {
    this.id = id;
}

VideoPlayer.prototype.getPlayer = function() {
    if (!this.player) {
        this.player = $('#'+this.id)[0];
    }
    return this.player;
}

VideoPlayer.prototype.sendBackground = function(back) {
    if(back){
        this.pause();
        var control = $f().getPlugin("controls");
    }
    else {
        this.play();
    }
//    this.getPlayer().sendBackground(back);
}

VideoPlayer.prototype.enableControlBarVisibility = function(enable) {
//    this.getPlayer().enableControlBarVisibility(enable);
}

VideoPlayer.prototype.play = function() {
    $f().resume();
}

VideoPlayer.prototype.pause = function() {
    $f().pause();
}

VideoPlayer.prototype.setDebug = function(debug) {
//    this.getPlayer().setDebug(debug);//show debug info
}

VideoPlayer.prototype.setBaseUrl = function(baseUrl) {
//    this.getPlayer().setBaseUrl(baseUrl);//ex: "rtmp://s2e5eegw6tqkl.cloudfront.net/cfx/st/"
}

VideoPlayer.prototype.setSource = function(source) {
	var url = source+".mp4";
    $f().play(url);//video or full url. ex: "mp4:169HD720_1000.mp4"
    $f().getPlugin("captions").loadCaptions(0,SUBS_URL+source+".srt");
    var control = $f().getPlugin("controls");
//    control.css("display","block");
    control.show();
    controlBarInitialized=true;
    unbindContainer();
}

VideoPlayer.prototype.setVolume = function(volume) {
//    this.getPlayer().setVolume(volume);//from 0 to 100%
}

VideoPlayer.prototype.getState = function() {
//    return this.getPlayer().getState();
}

/****EVENTS*****/
var maxVideoVisto;
var idPublicidadVigente;

$(document).ready(function () {
    getVideoHome(true);
//    getData();
	getDataByLang('en');
    get_related_featured_videos();
    getMaxVideoVisto();
//	getPublicidad_pie_pagina();	

    /*add events to elements*/
	docElements.pantalla=$("div[id=pantalla]");
    docElements.guide=$("div[id=guide]");
    docElements.data=$("div[id=data]");
    docElements.channels=$("div[id=channels]");
    docElements.channelInfo=$("div[id=channelInfo]");
    docElements.container=$("div.container-center");
    docElements.videoTable = $("div.video-data-center-content-item.video-table");
    docElements.videoInfo = $("div.video-data-center-content-item.video-info");
    docElements.videoComments = $("div.video-data-center-content-item.video-comment");
    docElements.videoShare = $("div.video-data-center-content-item.video-share");
    docElements.closeButton = $("div.data-top-right-close");
    docElements.featuredVideos = $("#featuredVideos");
    docElements.videoInfoVoteButton = $("div.button",$("#voteMenuItem"));
    docElements.videosRelacionadoPlaylistMenuItem = $("#videosRelacionadoPlaylistMenuItem");
    docElements.videosRelacionadoShareMenuItem = $("#videosRelacionadoShareMenuItem");
	docElements.videosRelacionadoDownloadMenuItem = $("#videosRelacionadoDownloadMenuItem");
    docElements.commentConfirmButton = $("#commentConfirmButton");
    docElements.commentText = $("#commentText");
    docElements.searchButton = $("div.search");
	docElements.loginSkin = $("div[id=loginSkin]");
	docElements.register = $("div[id=register]");
	docElements.loginIn = $("div[id=loginIn]");	

	//ojo
    bindContainer();

    $("#featuredVideos").css("visibility", "hidden");
	/*
	$("#aboutLink").click(function(){
        openAbout();								   
		closeAll();
    });*/

    $("a[id=guideButton]").click(function(){
		docElements.pantalla.fadeOut(HIDE_DELAY_PANTALLA);
		$('#bodyId').removeClass('pantallaBody');
		$('.footer-social').show();
		$("#aboutUsText").hide();
        closeGuide();
        openData();
        unbindContainer();
        window.video.sendBackground(true);
		modoNavegacion = true;
    });

	docElements.closeButton.click(function(){
		//openGuide();
		closeData();
		bindContainer();
        window.video.sendBackground(false);
		if(home){
			window.video.enableControlBarVisibility(false);
		}else{
			docElements.pantalla.fadeIn(SHOW_DELAY_PANTALLA);
			$('#bodyId').addClass('pantallaBody');
			$('.footer-social').hide();
		}
    });
	
	
	$("#currentLang").click(function(){
		//lang = $("#language").val();
		//(lang);
		$(".selectLanguage").show();
    });
	
	$("#en").click(function(){
		resetLang('en');
//		$(".selectLanguage").hide();
    });
	
	$("#es").click(function(){
		resetLang('es');
//		$(".selectLanguage").hide();
    });
	
	$("#po").click(function(){
		resetLang('po');
//		$(".selectLanguage").hide();
    });
	
	$("#selectLanguage").click(function(){
		$(".selectLanguage").hide();
    });
	

    $("div.homeButton").click(function(){
		modoNavegacion = false;
		if(!home || (home && !videoIniciado)){
			getVideoHome(false);
			videoIniciado = true;
		}		
		home=true;
		
		closeData();
		bindContainer();
        window.video.sendBackground(false);
		//$("#animation").show();
		//window.video.sendBackground(true);
        window.video.enableControlBarVisibility(false);
		pageGlobal = 'playVideoHome';
    });

    $("#channelsMenu").click(function(){
        openChannels();
		$("#aboutUsText").hide();
        closeChannelInfo();
		closeLoginSkin();
    });

    $("#topVideosMenu").click(function(){
		ocultarFlechasOrden();
		$("#tablaPopularityOrderDown").show();

        getTopVideos("cantidadVisto", "DESC", globalLang);
        openChannelInfo("topVideos");
        openVideoTable();
		$("#aboutUsText").hide();
        closeVideoInfo();
        closeVideoComments();
        closeVideoShare();
        closeChannels();
		closeLoginSkin();
    });

    $("#playlistMenu").click(function(){
		if(globalUserName && globalUserName.length>0){
			openPlaylistFull();
			$("#aboutUsText").hide();
			closeChannelInfo();
			closeLoginSkin();
		}else{
			ocultarFlechasOrden();									  
			initializeVideosXSegmento(getDataFromPlaylist(), 'playlist');
			openChannelInfo("playlist");
			openVideoTable();
			$("#aboutUsText").hide();
			closeVideoInfo();
			closeVideoComments();
			closeVideoShare();
			closeChannels();
			closeLoginSkin();
		}
    });

    $("#loginLink").click(function(){
		closeAll();	
		openLoginSkin();
		openLoginIn();
		closeRegister();
    });
	
	$("#loginRegisterButton").click(function(){
		$("#loginIn").hide();
		openRegister();
    });

	$("#loginRegisterCloseButton").click(function(){
		$("#register").hide();												  
		openLoginIn();
    });
	
	$("#loginRegisterAceptButton").click(
		function(){
		   register(document.getElementById('registerUser'), document.getElementById('registerPass'), document.getElementById('registerMail'));
		}
	);
	
	$("#loginAceptButton").click(function(){
				logIn(document.getElementById('loginUser').value, document.getElementById('loginPass').value);
			}
	);

    $("div.videosRelacionadosMenuItemContainerBack").click(function(){
        closeVideoInfo();
        openVideoTable();
    });

    $("#infoVoteButton","div.videosRelacionadosMenu").click(menuItemClick);
    $("#voteMenuItem").click(function(event){
        event.stopImmediatePropagation();
    });

	docElements.videosRelacionadoShareMenuItem.click(function(){
		var video = $(this).data("video");
        openVideoShare(VIDEO_INFO,video.id, video.titulo, video.descripcion);
        closeVideoInfo();
    });
	
	docElements.videosRelacionadoDownloadMenuItem.click(function(){
		var video = $(this).data("video");
		var id = video.id;
		var html = $.ajax({
							type: "GET",
							url: 'download.php',
							data: ({id: id}),
							dataType: 'html',
							async: false
							}).responseText;
		if(html=='false'){
			alert('temporarily unavailable');
		}else{
			location.href = html;
		}
		
    });

    docElements.videoInfoVoteButton.click(function(){
		var video = $(this).data("video");
        var ui = $("#stars-wrapper2").data("stars");
        var value = ui.options.value;
        var id = video.id;
        $.ajax({
            type: 'POST',
            url: ACCESS_URL+"/videos/"+id+"/voto/"+value
        });
        closeMenuItem();
		setVotosHeader(video, value);
    });

    $("div.video-comments-button").click(function(){
        closeVideoInfo();
        openVideoComments();
    });

    $("#commentCancelButton").click(closeAddComment);

    $("#voteMenuItem").bind("mouseleave",closeMenuItem);

    $("#stars-wrapper1").stars({
        disabled: true
    });
    $("#stars-wrapper2").stars({
        cancelShow: false
    });

    $("#eraseAllButton").click(function(){
        playlist = {};
        initializeVideosXSegmento(new Array(), 'playlist');
    });

    $("#playAllButton").click(function(){
		playNextVideoFromPlaylist('next');
    });

    var colTitulo = $("#tablaTitle");
    colTitulo.attr("orden","ASC");
    colTitulo.attr("campo","titulo");
    colTitulo.attr("imagenDown","tablaTitleOrderDown");
    colTitulo.attr("imagenUp","tablaTitleOrderUp");
    colTitulo.click(function(){
        cambiaOrden(colTitulo);
    });

    var colTime = $("#tablaTime");
    colTime.attr("orden","ASC");
    colTime.attr("campo","duracion");
    colTime.attr("imagenDown","tablaTimeOrderDown");
    colTime.attr("imagenUp","tablaTimeOrderUp");
    colTime.click(function(){
        cambiaOrden(colTime);
    });

    var colRelease = $("#tablaRelease");
    colRelease.attr("orden","ASC");
    colRelease.attr("campo","fechaLanzamiento");
    colRelease.attr("imagenDown","tablaReleaseOrderDown");
    colRelease.attr("imagenUp","tablaReleaseOrderUp");
    colRelease.click(function(){
        cambiaOrden(colRelease);
    });

    var colPopularity = $("#tablaPopularity");
    colPopularity.attr("orden","ASC");
    colPopularity.attr("campo","cantidadVisto");
    colPopularity.attr("imagenDown","tablaPopularityOrderDown");
    colPopularity.attr("imagenUp","tablaPopularityOrderUp");
    colPopularity.click(function(){
        cambiaOrden(colPopularity);
    });

    docElements.videosRelacionadoPlaylistMenuItem.click(function(){
        var video = $(this).data("video");
        if(!playlist[video.id]){
            playlist[video.id]=video;
        }
    });

    docElements.commentConfirmButton.click(function(){
        var id = $(this).data("videoId");
        sendComment(id,docElements.commentText.val());
    });
	
    $("div.closeShare").click(function(){
        closeVideoShare();
        var prev = docElements.videoShare.data("prev");
        if(prev==VIDEO_TABLE){
            openVideoTable();
        } else if(prev == VIDEO_INFO){
            openVideoInfo();
        }
        docElements.videoShare.removeData("prev");
    });

    $("div.video-share-footer-send-button").click(function(){
        $("#shareForm").submit();
        $("div.closeShare").click();
    })

    $("#shareForm").submit(function(event){
        event.preventDefault();
    });

    $("#searchInput").keypress(function(event){
        if (event.keyCode == '13') {
            event.preventDefault();
            docElements.searchButton.click();
        }
    });

    docElements.searchButton.click(function(){
		ocultarFlechasOrden();
		$("#tablaPopularityOrderDown").show();
        searchAction("cantidadVisto", "DESC");
    });
	
	getPublicidad_pie_pagina();

});

var docElements={};

var HIDE_DELAY=300;
var SHOW_DELAY=300;
var HIDE_DELAY_PANTALLA=2000;
var SHOW_DELAY_PANTALLA=2000;

function pantallaFadeOut(){
	docElements.pantalla.fadeOut(HIDE_DELAY_PANTALLA);
	$('#bodyId').removeClass('pantallaBody');
	$("#footer-social").show();
}
function pantallaFadeIn(){
	docElements.pantalla.fadeOut(SHOW_DELAY_PANTALLA);
	$('#bodyId').addClass('pantallaBody');
	$("#footer-social").show();
}

/*close functions*/

jQuery.preloadImages = function(){
    for(var i = 0; i<arguments.length; i++){
        jQuery("<img>").attr("src", arguments[i]);
    }
}

function searchAction(ordenCampo, ordenDir){
    var text = $("#searchInput").val();
    if(text!=""){
        searchVideos(text, ordenCampo, ordenDir, globalLang);
        openChannelInfo("search");
        openVideoTable();
        closeVideoInfo();
        closeVideoComments();
        closeVideoShare();
        closeChannels();
    }
}

function closeAll(){
	closeGuide();
	closeFeaturedVideos();
	closeChannels();
	closeChannelInfo();
	closeVideoTable();
	closeVideoInfo();
	closeVideoComments();
	closeVideoShare();
	closeLoginSkin();
}
function closeGuide(){
    docElements.guide.fadeOut(HIDE_DELAY);
    closeFeaturedVideos();
    if(controlBarInitialized){
        var control = $f().getPlugin("controls");
        control.fadeOut();
    }
}

function closeFeaturedVideos() {
    docElements.featuredVideos.fadeOut(HIDE_DELAY);
}

function closeData(){
    if($.browser.msie && $.browser.version.substr(0,1)=="7"){
        docElements.data.hide();
    }else{
        docElements.data.fadeOut(HIDE_DELAY);
    }
    closeChannelInfo();
    openChannels();
}

function closeChannels(){
    docElements.channels.fadeOut(HIDE_DELAY);
}

function closeChannelInfo(){
    if($.browser.msie && $.browser.version.substr(0,1)=="7"){
        docElements.channelInfo.hide();
    }else {
        docElements.channelInfo.fadeOut(HIDE_DELAY);
    }
    openVideoTable();
    closeVideoInfo();
    closeVideoComments();
    closeVideoShare();
}
function closeVideoTable(){
    docElements.videoTable.fadeOut(HIDE_DELAY);
}

function closeVideoInfo(){
    docElements.videoInfo.fadeOut(HIDE_DELAY);
}

function closeVideoComments(){
    docElements.videoComments.fadeOut(HIDE_DELAY);
}

function closeVideoShare(){
    docElements.videoShare.fadeOut(HIDE_DELAY);
}

function closeLoginSkin(){
    docElements.loginSkin.fadeOut(HIDE_DELAY);	
}

function closeLoginIn(){
    docElements.loginIn.fadeOut(HIDE_DELAY);	
}

function closeRegister(){
    docElements.register.fadeOut(HIDE_DELAY);	
}

/*open functions*/
function openGuide(){
    docElements.guide.fadeIn(SHOW_DELAY);
    if(home){
        $("#guideVideoNameContainer").hide();
        openFeaturedVideos();
    }else{
        $("#guideVideoNameContainer").show();
    }

    if(controlBarInitialized &&  !home){
        var control = $f().getPlugin("controls");
        control.fadeIn();
    }
}

function openFeaturedVideos() {
    docElements.featuredVideos.fadeIn(SHOW_DELAY);
}

function openData(){
    docElements.data.fadeIn(SHOW_DELAY);
}

function openChannels(){
	getPublicidad_by_pagina(3, 1, '');
	getDataByLang(globalLang);
    docElements.channels.fadeIn(SHOW_DELAY);
	$(".playlistInfoTitle").hide();
	$("#channels_cabecera").show();	
}

function openPlaylistFull(){
	getPlaylistByUserId(globalUserId);
    docElements.channels.fadeIn(SHOW_DELAY);
	$("#playlistUserName").empty().text(globalUserName);
	$(".playlistInfoTitle").show();
	$("#channels_cabecera").hide();	
}

function openAbout(){
	$("#aboutUsText").fadeIn(SHOW_DELAY);
}

function openLoginSkin(){
	$("#loginSkin").fadeIn(SHOW_DELAY);	
}

function openRegister(){
	$("#register").fadeIn(SHOW_DELAY);	
}

function openLoginIn(){
	$("#loginIn").fadeIn(SHOW_DELAY);		
	$("#loginUser").val("");
	$("#loginPass").val("");	
}

function openChannelInfo(page){
    pageGlobal = page;
    if(page=="playlist"){
        $(".channelNamePlaylist").show();
        $(".channelNameVideo").hide();
        $(".channelNameTopVideo").hide();
        $(".channelNameSearch").hide();
    } else {
        $(".channelNamePlaylist").hide();
        if(page=="topVideos"){
            $(".channelNameVideo").hide();
            $(".channelNameTopVideo").show();
            $(".channelNameSearch").hide();
        }else{
            $(".channelNameTopVideo").hide();
            if(page=="search"){
                $(".channelNameVideo").hide();
                $(".channelNameSearch").show();
            }else{
                pageGlobal = "segmento";
                $(".channelNameSearch").hide();
                $(".channelNameVideo").show();
            }
        }
    }
    docElements.channelInfo.fadeIn(SHOW_DELAY);
}

function openVideoTable(){
    docElements.videoTable.fadeIn(SHOW_DELAY);
}

function openVideoInfo(){
    docElements.videoInfo.fadeIn(SHOW_DELAY);
}

function openVideoComments(){
    docElements.videoComments.fadeIn(SHOW_DELAY);
}

function openVideoShare(prev, id, titulo, descripcion){

	$("#embededCodeText").text("<object id=\"flowplayer\" width=\"360\" height=\"200\" data=\"http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf\" type=\"application/x-shockwave-flash\"> <param name=\"movie\" value=\"http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf\" /> <param name=\"allowfullscreen\" value=\"true\" /> <param name=\"flashvars\" value='config={\"clip\":\"http://dtm5pxmpz0br1.cloudfront.net/"+id+"_360.mp4\"}' /> </object> ");
	document.getElementById('share_name').value = '';
	document.getElementById('share_your_email').value = '';
	document.getElementById('share_receivers_name').value = '';
	document.getElementById('share_receivers_email').value = '';
	document.getElementById('share_message').value = '';
//	var titulo = '';
	
	$("#sendMailButton").click(
							   function(){
								   sendMail(document.getElementById('share_name'), document.getElementById('share_your_email'), document.getElementById('share_receivers_name'), document.getElementById('share_receivers_email'), document.getElementById('share_message'), id, titulo);
								}
							  );	
//aca
	$("#shareFb").unbind('click').click(function(){
		window.open("http://www.facebook.com/sharer.php?u=http://www.snowlog.tv/sharePag.php?vars="+id+"-1-"+titulo+"-1-"+descripcion);
    });

    docElements.videoShare.fadeIn(SHOW_DELAY);
    docElements.videoShare.data("prev",prev);
}

function changeForAnimation (){
    var img = $("img",this).first();
    var src = img.attr("src");
    src = src.substr(0,src.length-3);
    img.attr("src",src+"gif");
};

function changeForImage (){
    var img = $("img",this).first();
    var src = img.attr("src");
    src = src.substr(0,src.length-3);
    img.attr("src",src+"png");
};

function menuItemClick(){
    var elem = $(this).first();
    var offset = elem.offset();
    var menuItemContainer = $("#voteMenuItem").first();
    //    menuItemContainer.css("left", offset.left);
    //    menuItemContainer.css("top", offset.top);
    var origDivs = $("#voteMenuItems",elem);
    origDivs.hide();
    menuItemContainer.data("origDivs", origDivs);
    menuItemContainer.show();
}

function closeMenuItem(event){
    var elem = $("#voteMenuItem").first();
    var origDivs = $(elem.data("origDivs"));
    elem.data("origDivs",null);
    origDivs.show();
    elem.hide();
}

function bindContainer(){
    var guide=$("div[id=guide]");
    $("div.container-center").hover(
            function (){
                openGuide();
            },
            function (){
                closeGuide();
            }
            );
};

function getMaxVideoVisto(){
    $.getJSON(ACCESS_URL+"/videos/maxVideoVisto?jsoncallback=?",
            function(data){
                maxVideoVisto = data[0].maxVisto;
            }
            );
};

function unbindContainer(){
    docElements.container.unbind('mouseenter mouseleave');
};

/*function getData(){
    $.getJSON(ACCESS_URL+"/segmentos?jsoncallback=?", initializeSegmentos);
};*/

function getDataByLang(lang){
    $.getJSON(ACCESS_URL+"/segmentos/byLang/"+lang+"?jsoncallback=?", initializeSegmentos);
};

function getPlaylistByUserId(userId){
    $.getJSON(ACCESS_URL+"/playlist/byUser/"+userId+"?jsoncallback=?", initializeSegmentos);
};

function getPublicidad_by_pagina(tipoPublicidad, idPagina, idSegmento){
    var param = {tipoPublicidad:tipoPublicidad,idPagina:idPagina,idSegmento:idSegmento};
    $.getJSON(ACCESS_URL+"/publicidad/publicidad?jsoncallback=?", param, function(data){
																							var totalMuestra = data.length;
																							var imagen;
																							var arrPublicidad = new Array();
																							var arrLink = new Array();
																							var i = 0;
																							$.each(data,function(){
																								//ponderamos el registro
																								var ponderacion = Number(this.impresionesFaltantes)/Number(this.diasFaltantes);
																								var cantItems = Math.ceil((ponderacion/totalMuestra));
																								
																								for(j=0;j<cantItems;j++){
																									arrPublicidad[i]=this.id;
																									arrLink[i]=this.linkUrl;
																									i++;
																								}
																							});
																							var t = Math.floor(Math.random()*arrPublicidad.length);
																							var idPubli = arrPublicidad[t];
																							var linkPubli = arrLink[t];
																							imagen = "/banner/"+idPubli+BANNER_EXT;
																							if(tipoPublicidad==3 && arrPublicidad.length==0){
																								getBannerDefault();
																							}else{
																								addBannerPpal(imagen, idPubli, linkPubli);
																								$.ajax({
																									type: 'POST',
																									url: ACCESS_URL+"/publicidad/"+idPubli+"/incrementarImpresion/"
																								});
																							}
																						}
																	);
	llamaAjax("log.php?pagina="+idPagina+"&segmento="+idSegmento, true);																	
};

function getBannerDefault(){
    $.getJSON(ACCESS_URL+"/publicidad/bannerDefault?jsoncallback=?", function(data){
																							var imagen = '/bannerDefault/1.gif';
																							addBannerPpal(imagen, 'bannerDefault', data[0].linkUrl);
																						}
																	);
};

function getCabeceraChannels(){
    $.getJSON(ACCESS_URL+"/publicidad/cabeceraChannels?jsoncallback=?", function(data){
																						var imagen = '/cabeceraChannels/1.gif';
																						var linkUrl = data[0].linkUrl;
																						if(linkUrl == null || linkUrl.length==0){
																							$("#cabeceraChannels").attr("src",BANNER_PPAL_URL+imagen);
																						}else{
																							$("#cabeceraChannels").attr("src",BANNER_PPAL_URL+imagen).addClass("button").unbind('click').click(function(){window.open('http://'+linkUrl);});
																						}
																						}
																	);
};

function getPublicidad_pie_pagina(){
    $.getJSON(ACCESS_URL+"/publicidad/piePagina?jsoncallback=?", function(data){
																				//$("div.footer-banner").empty();
																				var i = 1;
																				var banners
																				$.each(data,function(){
																					if(i<6){
																						var links = this.linkUrl;
																						var imagen = "/banner/"+this.id+BANNER_EXT;
																						banners = $("#pie"+i).attr("src",BANNER_PPAL_URL+imagen).addClass("button").show().click(function(){window.open('http://'+links);});
																						i++;
																					}
																				});
//																				$("div.footer-banner").append(banners);
																			}
																	);
};

function getVidos_by_segmento(id, orden, dir, lang){
    var orden = {orden:orden,dir:dir,lang:lang};
    $.getJSON(ACCESS_URL+"/segmentos/"+id+"/videos?jsoncallback=?", orden, function(data){
																				getPublicidad_by_pagina(3, '', id);
																				initializeVideosXSegmento(data, 'segmento');
																			}
																		);
};

function get_comments_by_video_id(id){
    $.getJSON(ACCESS_URL+"/videos/"+id+"/comentarios?jsoncallback=?", initializeComentariosXVideos);
};

function get_related_videos_by_video_id(id){
    $.getJSON(ACCESS_URL+"/videos/"+id+"/relacionados?jsoncallback=?", initializeRelacionadosXVideos);
};

function get_related_featured_videos(){
    $.getJSON(ACCESS_URL+"/videos/featured?jsoncallback=?", initializeFeaturedVideos);
};

function getTopVideos(orden, dir, lang){
    var orden = {orden:orden,dir:dir,lang:lang};
    $.getJSON(ACCESS_URL+"/topvideos?jsoncallback=?", orden, function(data){initializeVideosXSegmento(data, 'topVideos');});
};

function sendComment(id, comentario) {
    if(comentario!=null && comentario!=""){
        var data = {text:comentario};
        $.getJSON(ACCESS_URL+"/videos/"+id+"/comentario?jsoncallback=?",
                data,
                function(data){refreshComentarios(id);
				}
                );
    }
};

function searchVideos(text, orden, dir, lang){
    var data = {search:text,orden:orden,dir:dir,lang:lang};
    $.getJSON(ACCESS_URL+"/videos/search?jsoncallback=?",
            data,
            function(datos){initializeVideosXSegmento(datos, 'search');}
            );
};

function refreshComentarios(id){
    get_comments_by_video_id(id);
    closeAddComment();
}

function closeAddComment(){
    closeVideoComments();
    openVideoInfo();
    docElements.commentText.val("");
}

function incrementaClicks(publicidad, id){
	$.ajax({
		type: 'POST',
		url: ACCESS_URL+"/publicidad/"+id+"/"+publicidad+"/"
	});
}

function addBannerPpal(imagen, id, linkUrl){
	$("div.video-data-center-top-Add > img").removeAttr("src");
	$("div.data-center-top-Add > img").removeAttr("src");
	$("div.video-data-center-top-Add > img").attr("src",BANNER_PPAL_URL+imagen).addClass("button").unbind('click').click(function(){
																																  window.open('http://'+linkUrl);
																																  incrementaClicks('addClick', id);
																																  }
																														);
	$("div.data-center-top-Add > img").attr("src",BANNER_PPAL_URL+imagen).addClass("button").unbind('click').click(function(){
																															window.open('http://'+linkUrl);
																															incrementaClicks('addClick', id);
																															}
																													);
}

/**
 * Inserts channel elements
 * Channel element ui look like this
 *
 *   <div class="channel button">
 *       <div class="channelTitle"><a href="#">&gt;&nbsp;FREERIDE</a></div>
 *       <div class="channelDesc">
 *           <div class="channelDescLine"></div>
 *           <div class="channelDescText">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</div>
 *       </div>
 *   </div>
 *
 * @param elements of segments data
 */
function initializeSegmentos(data){
	getCabeceraChannels();
    $("#dynamicChannelsContainer").empty();
	getPublicidad_by_pagina(3, 1, '');
    $.each(data,function(){
        var container = $('<div></div>').addClass("channel button");
        var title = $('<div></div>').addClass("channelTitle");
        container.append(title);
        var titleLink = $('<a></a>').attr("href","#").text("> "+replaceTxt(this.titulo.toUpperCase()));
        title.append(titleLink);
        var desc = $("<div></div>").addClass("channelDesc");
        container.append(desc);
        var descLine = $("<div></div>").addClass("channelDescLine");
        desc.append(descLine);
        var descText = $('<div></div>').addClass("channelDescText").text(replaceTxt(this.descripcion));
        desc.append(descText);
        container.data("dataElement",this);
        container.click(function(){
            var data = $(this).data("dataElement");
            getVidos_by_segmento(data.id, "fechaLanzamiento", "DESC", globalLang);
			ocultarFlechasOrden();
			$("#tablaReleaseOrderDown").show();
            $("div.channelNameVideo","#channelInfo").text("> "+replaceTxt(data.titulo));
            openChannelInfo("channels");
            closeChannels();
			globalSegmentoId = data.id;			
        });
        $("#dynamicChannelsContainer").append(container);
    });
};


/**
 * Inserts video elements in video table as lines
 *
 * <div class="videos-table-body-line">
 *     <div class="video-table-col1 video-table-body-col0 button">
 *      <div class="video-table-body-col0-img"></div>
 *      <div class="video-table-body-col0-titulo">NOMBRE DEL VIDEO</div>
 *     </div>
 *     <div class="video-table-col2 video-table-body-cell">0:32'</div>
 *     <div class="video-table-col3 video-table-body-cell">10/08/2010</div>
 *     <div class="video-table-col4 video-table-body-cell">
 *      <image src="images/popularity.png"/>
 *     </div>
 *     <div class="video-table-col5 video-table-body-cell button">
 *      <image src="images/info.png"/>
 *     </div>
 *     <div class="video-table-col6 video-table-body-cell button">
 *      <image src="images/save.png"/>
 *     </div>
 *     <div class="video-table-col7 video-table-body-cell button">
 *      <image src="images/delete.png"/>
 *     </div>
 *     <div class="video-table-col8 video-table-body-cell button">
 *      <image src="images/addtoplaylist.png"/>
 *     </div>
 *     <div class="video-table-col9 video-table-body-cell button">
 *      <image src="images/share.png"/>
 *     </div>
 *     <div class="video-table-col10 video-table-body-cell button">
 *      <image src="images/download.png"/>
 *     </div>
 *     <div class="video-table-col11 video-table-body-hint-cell">                                        </div>
 * </div>
 * @param data
 */
function initializeVideosXSegmento(data, pagina){
    $("#dynamicVideoContainerGlobal").empty();	
	var comm = $("<div></div>").addClass("videos-table-body").attr('id', 'dynamicVideoTableContainer');
	$("#dynamicVideoContainerGlobal").append(comm);
//    $("#dynamicVideoTableContainer").empty();
    if(data.length>0){
        var dataItem = data[0];
        var idSegmento = dataItem.idSegmento;
        setVideoInfoHeader(dataItem);
        $(".videoTituloContainer").show();
		$(".videoThumb").show();
		$(".videoDescription").show();

	}
    else{
        $(".videoTituloContainer").hide();
		$(".videoThumb").hide();
		$(".videoDescription").hide();
    }
    var prefix = "video";
//    if(isPlayListView){
    if(pagina == 'playlist'){		
		getPublicidad_by_pagina(3, 3, '');
        prefix = "playlist";
        $("#playAllButton")
                .attr("class",function(){return $(this)
                .attr("class").replace(/^video-table-col/,"playlist-table-col");});
        $("#eraseAllButton")
                .attr("class",function(){return $(this)
                .attr("class").replace(/^video-table-col/,"playlist-table-col");});
    }
    else{
        $("#playAllButton")
                .attr("class",function(){
            return $(this)
                    .attr("class").replace(/^playlist-table-col/,"video-table-col");});
        $("#eraseAllButton")
                .attr("class",function(){
            return $(this)
                    .attr("class").replace(/^playlist-table-col/,"video-table-col");});
    }

	if(pagina=='topVideos')
		getPublicidad_by_pagina(3, 2, '');		
	if(pagina=='search')
		getPublicidad_by_pagina(3, 2, '');

    $("#tablaTitle").attr("paginaId",idSegmento);
    $("#tablaTime").attr("paginaId",idSegmento);
    $("#tablaRelease").attr("paginaId",idSegmento);
    $("#tablaPopularity").attr("paginaId",idSegmento);

    $.each(data,function(){
        var line = $("<div></div>").addClass("videos-table-body-line");

        //col1:title
        var col1 = $("<div></div>").addClass(prefix+"-table-col1 video-table-body-col0 button");
        var col1Img = $("<div></div>").addClass("video-table-body-col0-img");
        col1.append(col1Img);
        var title = $("<div></div>").addClass("video-table-body-col0-titulo").text(replaceTxt(this.titulo));
        col1.append(title);
        line.append(col1);
		
		//col flecha
        var colf1 = $("<div></div>").addClass("video-table-flecha videos-table-header-display button");
        line.append(colf1);
		
        //col2:time
        var col2 = $("<div></div>").addClass(prefix+"-table-col2 video-table-body-cell").text(timeToMin(this.duracion));
        line.append(col2);
		
		//col flecha
        var colf2 = $("<div></div>").addClass("video-table-flecha videos-table-header-display button");
        line.append(colf2);
		
        //col3:release
        var col3 = $("<div></div>").addClass(prefix+"-table-col3 video-table-body-cell").text(this.fechaLanzamiento);
        line.append(col3);
		
		//col flecha
        var colf3 = $("<div></div>").addClass("video-table-flecha videos-table-header-display button");
        line.append(colf3);

        //col4:popularity
        var col4 = $("<div></div>").addClass(prefix+"-table-col4 "+calculaPopularity(this.cantidadVisto)+" video-table-body-cell");
        var col4Img = $("<div></div>");
		$("."+prefix+"-table-col4").attr("align","center");		
        col4.append(col4Img);
        line.append(col4);

		//col flecha
        var colf4 = $("<div></div>").addClass("video-table-flecha videos-table-header-display button");
        line.append(colf4);
		
        //col5:imfo
        var col5 = $("<div></div>").addClass(prefix+"-table-col5 table-col5 video-table-body-cell button");
        var col5Img = $("<div></div>").text(" ");
        col5.append(col5Img);
        line.append(col5);

        //col6:save
        var col6 = $("<div></div>").addClass(prefix+"-table-col6 table-col6 video-table-body-cell button");
        var col6Img = $("<div></div>");
        col6.append(col6Img);
        line.append(col6);

        //col7:delete
        var col7 = $("<div></div>").addClass(prefix+"-table-col7 table-col7 video-table-body-cell button");
        var col7Img = $("<div></div>");
        col7.append(col7Img);
        line.append(col7);

        //col8:add playlist
        var col8 = $("<div></div>").addClass(prefix+"-table-col8 table-col8 video-table-body-cell button");
        var col8Img = $("<div></div>");
        col8.append(col8Img);
        line.append(col8);

        //col9:info
        var col9 = $("<div></div>").addClass(prefix+"-table-col9 table-col9 video-table-body-cell button");
        var col9Img = $("<div></div>");
        col9.append(col9Img);
        line.append(col9);

        //col10:download
        var col10 = $("<div></div>").addClass(prefix+"-table-col10 table-col10 video-table-body-cell button");
        var col10Img = $("<div></div>");
        col10.append(col10Img);
        line.append(col10);

        //col11
        var col11 = $("<div></div>").addClass(prefix+"-table-col11 video-table-body-hint-cell");
        line.append(col11);

        $("#dynamicVideoTableContainer").append(line);

        //Setting events
        col5.hover(function(){
            col11.html("| info");
        },
                function(){
                    col11.html("");
                });

        col6.hover(function(){
            col11.html("| save");
        },
                function(){
                    col11.html("");
                });

        col7.hover(function(){
            col11.html("| erase");
        },
                function(){
                    col11.html("");
                });

        col8.hover(function(){
            col11.html("| playlist");
        },
                function(){
                    col11.html("");
                });

        col9.hover(function(){
            col11.html("| share");
        },
                function(){
                    col11.html("");
                });

        col10.hover(function(){
            col11.html("| download");
        },
                function(){
                    col11.html("");
                });

        col1.data("video",this);
        col1.click(function(){
            var video = $(this).data("video");
			playAllIndex = -1;
            playVideo(video);
        });
        col1.hover(function(){
            var video = $(this).data("video");
            setVideoInfoHeader(video);
        });

        col5.data("video",this);

        col5.click(function(){
            var video = $(this).data("video");
            showVideoInfoForVideo(video);
        });

        col7.data("videoId",this.id);

        col7.click(function(){
            var videoId = $(this).data("videoId");
            if(playlist[videoId]){
                delete playlist[videoId];	
                initializeVideosXSegmento(getDataFromPlaylist(), 'playlist');
            }
        });

        col8.data("video",this);

        col8.click(function(){
            var video = $(this).data("video");
            if(!playlist[video.id]){
                playlist[video.id]=video;
            }
        });

        col9.data("video",this);

        col9.click(function(){
            var video = $(this).data("video");
            closeVideoTable();
            openVideoShare(VIDEO_TABLE, video.id, video.titulo, video.descripcion);
        });

        col10.data("videoId",this.id);
        col10.click(function(){
            var id = $(this).data("videoId");
			var html = $.ajax({
								type: "GET",
								url: 'download.php',
								data: ({id: id}),
								dataType: 'html',
								async: false
								}).responseText;
			if(html=='false'){
				alert('temporarily unavailable');
			}else{
				location.href = html;
			}
        })

    });

	$('#dynamicVideoTableContainer').jScrollPane();

};

function calculaPopularity(cantidadVisto){
    var max = maxVideoVisto;
    if(Number(max)==0) max = 1;
    if(Number(cantidadVisto)==0) cantidadVisto = 1;
    var popu = cantidadVisto * 100 / max;
    var result = "";

    if(popu<25) result = "table-col4-a";
    if(popu>24 && popu <50) result = "table-col4-b";
    if(popu>49 && popu <75) result = "table-col4-c";
    if(popu>74) result = "table-col4-d";

    return result;
}

function cambiaOrden(obj){
    var id = obj.attr("paginaId");

    var orden = obj.attr("orden");
    var campo = obj.attr("campo");
    if(orden=="DESC"){
        var imagenShow = obj.attr("imagenDown");
        var imagenHide = obj.attr("imagenUp");
        var newOrden = "ASC";
    }else{
        var imagenShow = obj.attr("imagenUp");
        var imagenHide = obj.attr("imagenDown");
        var newOrden = "DESC";
    }

   ocultarFlechasOrden();

    $("#"+imagenShow).show();
    obj.attr("orden", newOrden);

    if(pageGlobal=="segmento"){
        getVidos_by_segmento(id, campo, newOrden, globalLang);
    }
    if(pageGlobal=="topVideos"){
        getTopVideos(campo, newOrden, globalLang);
    }
    /*	if(pageGlobal=="playlist"){
     getVidos_by_segmento(id, campo, newOrden);
     }*/
    if(pageGlobal=="search"){
        searchAction(campo, newOrden);
    }

}

function ocultarFlechasOrden(){
    $("#tablaTitleOrderDown").hide();
    $("#tablaTitleOrderUp").hide();
    $("#tablaTimeOrderDown").hide();
    $("#tablaTimeOrderUp").hide();
    $("#tablaReleaseOrderDown").hide();
    $("#tablaReleaseOrderUp").hide();
    $("#tablaPopularityOrderDown").hide();
    $("#tablaPopularityOrderUp").hide();
}

function initializeComentariosXVideos(data){
    //$("#commentsIn").empty();
	$("#commentsGlobal").empty();
	$("div.video-comments-counter").text(data.length + " comments");
//	<div id="commentsIn" class="video-bottom-body video-comments-body">
	var comm = $("<div></div>").addClass("video-bottom-body video-comments-body").attr('id', 'commentsIn');
	$("#commentsGlobal").append(comm);
	
    $.each(data,function(){
        var line = $("<div></div>").addClass("videos-comment-line").text(this.comentario);
        $("#commentsIn").append(line);

    });
	$('#commentsIn').jScrollPane();

};

function initializeRelacionadosXVideos(data){
    var carousel = jQuery('#mycarousel').data('jcarousel');
    if(carousel){
        carousel.reset();
    }

    jQuery('#mycarousel').jcarousel({
        size: data.length,
//        visible:false,
        itemLoadCallback: {onBeforeAnimation: function(carousel, state){fillCommentsCarousel(carousel, state, getRelatedVideosCarouselHtmlItem, data);
            initializeCarouselElements("mycarousel");}}
    });
//    $("#mycarousel").scroll(0,true);
};

//carro
function initializeFeaturedVideos(data){
    var carousel = jQuery('#featuredVideosCarousel').data('jcarousel');
    if(carousel){
        carousel.reset();
    }
    jQuery('#featuredVideosCarousel').jcarousel({
        vertical: true,
        size: data.length,
        visible:false,
        itemLoadCallback: {onBeforeAnimation: function(carousel, state){fillCommentsCarousel(carousel, state, getFeaturedVideosCarouselHtmlItem, data);
            initializeCarouselElements("featuredVideosCarousel");}}
    });
    setTimeout(function(){$("#featuredVideos").css("visibility","visible");docElements.featuredVideos.hide();},100);
};

function fillCommentsCarousel(carousel, state, htmlfunction, data){
    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > data.length) {
            break;
        }

        carousel.add(i, htmlfunction(data[i-1]));
    }
};

function getCarouselHtmlItem(item){
    return item.comentario;
};

function getFeaturedVideosCarouselHtmlItem(item){
    var result = $("<div></div>").addClass("featuredVideoCarouselItem");
	result.click(function(){playVideo(item)});
    result.append(getVideosCarouselHtmlItem(item));
    var titleContainer = $("<div></div>").addClass("titleContainer");
    var titleBackground = $("<div></div>").addClass("titleBackground");
    titleContainer.append(titleBackground);
    var title = $("<div></div>").addClass("title").text(">  "+replaceTxt(item.titulo));
    titleContainer.append(title);
    result.append(titleContainer);
    var playBackground = $("<div></div>").addClass("playBackground");
    result.append(playBackground);
    var play = $("<div></div>").addClass("play");
    result.append(play);
    return result;
}

function getRelatedVideosCarouselHtmlItem(item) {
//    var result = getVideosCarouselHtmlItem(item);
  //  result.click(function(){playVideo(item)});
	
	var result = $("<div></div>").addClass("featuredVideoCarouselItem");
	result.click(function(){playVideo(item)});
    result.append(getVideosCarouselHtmlItem(item));

	var titleContainer = $("<div></div>").addClass("titleContainer");
    var titleBackground = $("<div></div>").addClass("titleBackground");
    titleContainer.append(titleBackground);
    var title = $("<div></div>").addClass("title").text(">  "+replaceTxt(item.titulo));
    titleContainer.append(title);
    result.append(titleContainer);
    var playBackground = $("<div></div>").addClass("playBackground");
    result.append(playBackground);
    var play = $("<div></div>").addClass("play");
    result.append(play);
	
    return result;
}

//<img src="images/video1.png" width="228" height="120" alt="" />
function getVideosCarouselHtmlItem(item){
    var img = $("<img/>").attr("width","228").attr("height","120").attr("src",VIDEO_THUMBS_URL+"/"+item.id+VIDEO_THUMBS_EXT).attr("alt","");

	$.preloadImages(VIDEO_THUMBS_URL+"/"+item.id+".gif");		
    return img;
};

function initializeCarouselElements(id){
    $("li","#"+id).hover(changeForAnimation, changeForImage);
}

docElements.isMyCarouselInitilized = false;

var playlist = {};

function getDataFromPlaylist(){
    var data = new Array();
    for (var videoId in playlist){
        data.push(playlist[videoId]);
    }
    return data;
}

function getNextVideoFromPlaylist(direction){
	var i=0;
	var data = new Array();

	if(playAllIndex>-1){
		if(direction=='next')
		    playAllIndex++;
		if(direction=='prev')
		    playAllIndex--;			
	}else{
		if(direction=='next')		
		    playAllIndex = 0;
		if(direction=='prev')
			playAllIndex = playlist.length-1;
	}
	for (var videoId in playlist){
		if(i==playAllIndex){
			data.push(playlist[videoId]);
			return data;
		}
		i++;
    }
	playAllIndex = -1;
	return null;
}

function playNextVideoFromPlaylist(direccion){
	var data = getNextVideoFromPlaylist(direccion);
	if(data){
		var dataItem = data[0];
		playVideo(dataItem);
	}
}

function openVideoPlayer(id, homes){
	if(!homes){
		$.ajax({
			type: 'POST',
			url: ACCESS_URL+"/videos/"+id+"/view/"
		});
		getMaxVideoVisto();
	}
    if(!homes){
        if(id=="2"){
            id=id+"_360";//720
        }else{
            id=id+"_360";
        }
    }
    window.video.setSource(id);
}

function playVideo(data){
	if(playerCargado){
		home=false;
		currentVideo=data;
		window.video.enableControlBarVisibility(true);
		openVideoPlayer(data.id, false);
		docElements.pantalla.fadeIn(SHOW_DELAY_PANTALLA);
		$('#bodyId').addClass('pantallaBody');
		$('.footer-social').hide();
	
		$("#guideVideoName").text(data.titulo);
		closeGuide();
		closeData();
	//    bindContainer();
		$("#animation").hide();
		window.video.sendBackground(false);
		pageGlobal = 'playVideo';	
	}
}

function setVideoInfoHeader(dataItem){
    $("div.videoName","#channelInfo").text(replaceTxt(dataItem.titulo));
	
    setVotosHeader(dataItem, 0);
    $("div.videoThumb > img").attr("src",VIDEO_THUMBS_URL+"/"+dataItem.id+VIDEO_THUMBS_EXT);
    $("div.videoDescription").text(replaceTxt(dataItem.descripcion));
}

function setVotosHeader(dataItem, value){
	//calculo puntaje
    var prom = 0;
    var total = 0;
    for(var i = 1; i<6; i++){
        var valor = parseInt(dataItem['puntaje'+i]);
		if(value==i) valor++;
		prom += valor*i;
        total +=valor;
    }
    prom= prom/total;
    $("div.videoNameVotes > div","#channelInfo").text(total+" votes");
    $("#stars-wrapper1").stars("select", parseInt(prom));
}

function timeToMin(time){
    if(Number(time)>0){
        time = Number(time);
        minu = Math.floor(time/60);
        sec = time % 60;
        display = (minu<10?'0'+minu:minu) + ':' + (sec<10?'0'+sec:sec);
    }else{
        display = '00:00';
    }
    return display;
}

function openInfoFromPlayer(){
    openChannelInfo("topVideos");
    showVideoInfoForVideo(currentVideo);
    closeVideoComments();
    closeVideoShare();

    docElements.channels.hide();
    docElements.videoTable.hide();
    closeGuide();

    openData();
    unbindContainer();
    window.video.sendBackground(true);

}

function openCommentsFromPlayer(){
    openChannelInfo("topVideos");
    showVideoInfoForVideo(currentVideo);
    closeVideoComments();
    closeVideoShare();

    docElements.channels.hide();
    docElements.videoTable.hide();
    docElements.videoInfo.hide();
    openVideoComments();

    openData();
    unbindContainer();
    window.video.sendBackground(true);
}

function showVideoInfoForVideo(video) {
    docElements.videoInfoVoteButton.data("video", video);
    docElements.videosRelacionadoPlaylistMenuItem.data("video", video);
	docElements.videosRelacionadoShareMenuItem.data("video", video);
	docElements.videosRelacionadoDownloadMenuItem.data("video", video);
    get_comments_by_video_id(video.id);
    docElements.commentConfirmButton.data("videoId", video.id);
    get_related_videos_by_video_id(video.id);
    var link_container = $("div.video-links-body > ul");
    link_container.empty();
    var links = video.links.split(",");
    $.each(links, function(index, link){
        var li = $("<li></li>");
				var lia = $("<a></a>").attr({href: 'http://'+$.trim(link), target: '_blank'}).text($.trim(link)).click(function(){
																																	window.open('http://'+linkUrl);
																																	//incrementaClicks('linkVideo', video.id);
																																	}
																															);
		li.append(lia);
        link_container.append(li);
    });
    setVideoInfoHeader(video);
    closeVideoTable();
    openVideoInfo();
}

function nuevoAjax(){ 
  var xmlhttp=false; 
  try { 
   // Creación del objeto ajax para navegadores diferentes a Explorer 
   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
  } catch (e) { 
   // o bien 
   try { 
     // Creación del objet ajax para Explorer 
     xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { 
     xmlhttp = false; 
   } 
  } 

  if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
   xmlhttp = new XMLHttpRequest(); 
  } 
  return xmlhttp; 
} 

function llamaAjax(url, asincrono){
	ajax=nuevoAjax();
	ajax.open("GET", url, asincrono);
	if(asincrono){
		ajax.onreadystatechange=function() 
		{ 
			if (ajax.readyState==1)
			{
				// Mientras carga elimino la opcion "Elige pais" y pongo una que dice "Cargando"
			}
			if (ajax.readyState==4)
			{ 
				//document.getElementById("mailContainer").innerHTML=ajax.responseText;
			} 
		}
	}
	ajax.send(null);
	
	if(!asincrono)
		return ajax.responseText;
}

function sendMail(objShareName, objShareMail, objRecName, objRecMail, objMes, id, titulo){
	//validaciones
	var isOk = false;
	if(objShareName && objShareName.value.length>0)
		isOk = true;

	if(objShareMail && objShareMail.value.length>0)
		isOk = true;

	if(objRecName && objRecName.value.length>0)
		isOk = true;

	if(objRecMail && objRecMail.value.length>0)
		isOk = true;

	if(objMes)
		isOk = true;

	//todo: validate mail
	
	if(isOk){
		var datos = '?shareName='+objShareName.value+'&shareMail='+objShareMail.value+'&id='+id+'&recName='+objRecName.value+'&recMail='+objRecMail.value+'&msg='+objMes.value+'&titulo='+titulo;
		llamaAjax("mail.php"+datos, true);
	}
}

function replaceTxt(txt){
	return txt.replace(/%enie%/gi, "ñ").replace(/%eniem%/gi, "Ñ").replace(/%aacento%/gi, "á").replace(/%aacentom%/gi, "Á").replace(/%eacento%/gi, "é").replace(/%eacentom%/gi, "É").replace(/%iacento%/gi, "í").replace(/%iacentom%/gi, "Í").replace(/%oacento%/gi, "ó").replace(/%oacentom%/gi, "Ó").replace(/%uacento%/gi, "ú").replace(/%uacentom%/gi, "Ú");
}

function resetLang(lang){
	globalLang = lang;
	
	if(lang=='es') 	var texto = 'Español';
	if(lang=='en') 	var texto = 'English';
	if(lang=='po') 	var texto = 'Portugues';	
	
	var container = $('#currentLang');
	container.empty().text(texto);
	var imag = $("<img>").attr({src: 'images/orderDown.png', width: '10', height: '7'});
	container.append(imag);
		
	getDataByLang(lang);
	if(pageGlobal=='topVideos')
		getTopVideos("cantidadVisto", "DESC", globalLang);
	if(pageGlobal=='search')
		searchVideos(text, ordenCampo, ordenDir, globalLang);
	if(pageGlobal=='segmento')
		getVidos_by_segmento(globalSegmentoId, "fechaLanzamiento", "DESC", globalLang);
}

function register(objUser, objPass, objMail){
	//validaciones
	var isOk = false;
	if(objUser && objUser.value.length>0)
		isOk = true;

	if(objPass && objPass.value.length>0)
		isOk = true;

	if(objMail && validateMail(objMail.value))
		isOk = true;
	
	if(isOk){
		var datos = '?accion=validate&user='+objUser.value+'&mail='+objMail.value;
		var validate = llamaAjax("register.php"+datos, false);
		if(validate == 'ok'){		
			var datos = '?accion=register&user='+objUser.value+'&mail='+objMail.value+'&pass='+objPass.value;
			var registro = llamaAjax("register.php"+datos, false);
			if(registro=='no'){
				alert("Error saving record");
			}else{
				logIn(objUser.value, objPass.value);
			}
		}else{
			if(validate == 'user'){
				if(globalLang=='en'){
					alert('User already exists, please enter another');
				}else{
					alert('El usuario ya existe, por favor ingrese otro');
				}
			}
			if(validate == 'mail'){
				if(globalLang=='en'){
					alert('Mail already exists, please enter another');
				}else{
					alert('El mail ya existe, por favor ingrese otro');				
				}
			}
		}
	}
}

function logIn(user, pass){
	var datos = '?accion=logIn&user='+user+'&pass='+pass;
	var registro = llamaAjax("register.php"+datos, false);
	if(registro!='no'){
		var user_container = $("#userInfo");
		user_container.empty().text('User:');
		//<span class="nameUser">User:Tati | <a href="#">LogOut</a></span>
		
		var spanUser = $("<span></span>").addClass("nameUser").text(user+' | ');
		var logOut = $("<a></a>").attr({href: '#'}).text("LogOut").click(function(){
																				logOut1();
																				}
																		);
		spanUser.append(logOut);
		user_container.append(spanUser);
		
		globalUserName = user;
		globalUserId = registro;

		
		//abro pantalla de usuario
		openPlaylistFull();
		$("#aboutUsText").hide();
		closeChannelInfo();
		closeLoginSkin();
	}else{
		if(globalLang!='en'){
			alert('Usuario Invalido, por favor registrese');
		}else{
			alert('Invalid user, please register');
		}
	}
}

function logOut1(){
	/*var datos = '?accion=logOut';
	llamaAjax("register.php"+datos, false);*/
	var user_container = $("#userInfo");
	user_container.empty().text('');

	openChannels();
	$("#aboutUsText").hide();
	closeChannelInfo();
	closeLoginSkin();
	
	globalUserName = null;
	globalUserId = null;
}

function validateMail(email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(email) == false) {
      alert('Invalid Email Address');
      return false;
   }
   return true;
}

var playerCargado = false;
var videoIniciado = false;
var modoNavegacion = false;
var globalUserName = null;
var globalUserId = null;
var globalSegmentoId = null;
var globalLang = 'en';
var home=true;
var currentVideo = null;
var pageGlobal;
var playAllIndex = -1;

var VIDEO_TABLE = "VIDEO_TABLE";
var VIDEO_INFO = "VIDEO_INFO";
var controlBarInitialized = false;
