/*! jQuery v1.6.4 http://jquery.com/ | http://jquery.org/license */
(function(a,b){function cu(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cr(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cq(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cp(){cn=b}function co(){setTimeout(cp,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bA.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bW(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bP,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bW(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bW(a,c,d,e,"*",g));return l}function bV(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bL),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function by(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bt:bu;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bv(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bd,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bf(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function V(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(Q.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function U(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function M(a,b){return(a&&a!=="*"?a+".":"")+b.replace(y,"`").replace(z,"&")}function L(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(w,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function J(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;B.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:H?function(a){return a==null?"":H.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?F.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(!b)return-1;if(I)return I.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=G.call(arguments,2),g=function(){return a.apply(c,f.concat(G.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){J["[object "+b+"]"]=b.toLowerCase()}),A=e.uaMatch(z),A.browser&&(e.browser[A.browser]=!0,e.browser.version=A.version),e.browser.webkit&&(e.browser.safari=!0),j.test("Â ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?C=function(){c.removeEventListener("DOMContentLoaded",C,!1),e.ready()}:c.attachEvent&&(C=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",C),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g+"With"](this===b?d:this,[h])}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-1000px",top:"-1000px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i=f.expando,j=typeof c=="string",k=a.nodeType,l=k?f.cache:a,m=k?a[f.expando]:a[f.expando]&&f.expando;if((!m||e&&m&&l[m]&&!l[m][i])&&j&&d===b)return;m||(k?a[f.expando]=m=++f.uuid:m=f.expando),l[m]||(l[m]={},k||(l[m].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?l[m][i]=f.extend(l[m][i],c):l[m]=f.extend(l[m],c);g=l[m],e&&(g[i]||(g[i]={}),g=g[i]),d!==b&&(g[f.camelCase(c)]=d);if(c==="events"&&!g[c])return g[i]&&g[i].events;j?(h=g[c],h==null&&(h=g[f.camelCase(c)])):h=g;return h}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e=f.expando,g=a.nodeType,h=g?f.cache:a,i=g?a[f.expando]:f.expando;if(!h[i])return;if(b){d=c?h[i][e]:h[i];if(d){d[b]||(b=f.camelCase(b)),delete d[b];if(!l(d))return}}if(c){delete h[i][e];if(!l(h[i]))return}var j=h[i][e];f.support.deleteExpando||!h.setInterval?delete h[i]:h[i]=null,j?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=j):g&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u,v;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=v:u&&(i=u)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.attr(a,b,""),a.removeAttribute(b),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(u&&f.nodeName(a,"button"))return u.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(u&&f.nodeName(a,"button"))return u.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==null?g:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabIndex=f.propHooks.tabIndex,v={get:function(a,c){var d;return f.prop(a,c)===!0||(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(u=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=/\.(.*)$/,x=/^(?:textarea|input|select)$/i,y=/\./g,z=/ /g,A=/[^\w\s.|`]/g,B=function(a){return a.replace(A,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=C;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=C);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),B).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete 
t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,M(a.origType,a.selector),f.extend({},a,{handler:L,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,M(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?D:C):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=D;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=D;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=D,this.stopPropagation()},isDefaultPrevented:C,isPropagationStopped:C,isImmediatePropagationStopped:C};var E=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},F=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?F:E,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?F:E)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="submit"||c==="image")&&f(b).closest("form").length&&J("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&J("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var G,H=function(a){var b=f.nodeName(a,"input")?a.type:"",c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},I=function(c){var d=c.target,e,g;if(!!x.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=H(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:I,beforedeactivate:I,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&I.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&I.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",H(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in G)f.event.add(this,c+".specialChange",G[c]);return x.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return x.test(this.nodeName)}},G=f.event.special.change.filters,G.focus=G.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var K={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||C,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=w.exec(h),k="",j&&(k=j[0],h=h.replace(w,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,K[h]?(a.push(K[h]+k),h=h+k):h=(K[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+M(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+M(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var N=/Until$/,O=/^(?:parents|prevUntil|prevAll)/,P=/,/,Q=/^.[^:#\[\.,]*$/,R=Array.prototype.slice,S=f.expr.match.POS,T={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(V(this,a,!1),"not",a)},filter:function(a){return this.pushStack(V(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=S.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=S.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(U(c[0])||U(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=R.call(arguments);N.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!T[a]?f.unique(e):e,(this.length>1||P.test(d))&&O.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|object|embed|option|style)/i,bb=/checked\s*(?:[^=]|=\s*.checked.)/i,bc=/\/(java|ecma)script/i,bd=/^\s*<!(?:\[CDATA\[|\-\-)/,be={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,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!be[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bb.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bf(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bl)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!ba.test(a[0])&&(f.support.checkClone||!bb.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean
(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)g[h]&&bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=be[l]||be._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bk(k[i]);else bk(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bc.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bm=/alpha\([^)]*\)/i,bn=/opacity=([^)]*)/,bo=/([A-Z]|^ms)/g,bp=/^-?\d+(?:px)?$/i,bq=/^-?\d/,br=/^([\-+])=([\-+.\de]+)/,bs={position:"absolute",visibility:"hidden",display:"block"},bt=["Left","Right"],bu=["Top","Bottom"],bv,bw,bx;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bv(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=br.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bv)return bv(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return by(a,b,d);f.swap(a,bs,function(){e=by(a,b,d)});return e}},set:function(a,b){if(!bp.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bm,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bv(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bw=function(a,c){var d,e,g;c=c.replace(bo,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bx=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bp.test(d)&&bq.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bv=bw||bx,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bz=/%20/g,bA=/\[\]$/,bB=/\r?\n/g,bC=/#.*$/,bD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bE=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bF=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bG=/^(?:GET|HEAD)$/,bH=/^\/\//,bI=/\?/,bJ=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bK=/^(?:select|textarea)/i,bL=/\s+/,bM=/([?&])_=[^&]*/,bN=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bO=f.fn.load,bP={},bQ={},bR,bS,bT=["*/"]+["*"];try{bR=e.href}catch(bU){bR=c.createElement("a"),bR.href="",bR=bR.href}bS=bN.exec(bR.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bO)return bO.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bJ,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bK.test(this.nodeName)||bE.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bB,"\r\n")}}):{name:b.name,value:c.replace(bB,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?bX(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),bX(a,b);return a},ajaxSettings:{url:bR,isLocal:bF.test(bS[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bT},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bV(bP),ajaxTransport:bV(bQ),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?bZ(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=b$(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bD.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bC,"").replace(bH,bS[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bL),d.crossDomain==null&&(r=bN.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bS[1]&&r[2]==bS[2]&&(r[3]||(r[1]==="http:"?80:443))==(bS[3]||(bS[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bW(bP,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bG.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bI.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bM,"$1_="+x);d.url=y+(y===d.url?(bI.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bT+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bW(bQ,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bz,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cq("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cr(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cq("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cq("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cr(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cq("show",1),slideUp:cq("hide",1),slideToggle:cq("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return d.step(a)}var d=this,e=f.fx;this.startTime=cn||co(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&f.timers.push(g)&&!cl&&(cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||co(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.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}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cs=/^t(?:able|d|h)$/i,ct=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cu(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cs.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=ct.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!ct.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cu(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cu(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNaN(j)?i:j}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);/*!
 * jQuery UI 1.8.1
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
jQuery.ui||function(c){c.ui={version:"1.8.1",plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")=="hidden")return false;
b=b&&b=="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,f,g){return c.ui.isOverAxis(a,d,f)&&c.ui.isOverAxis(b,e,g)},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,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}};c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none")},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||
/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==
undefined)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b=="absolute"||b=="relative"||b=="fixed"){b=parseInt(a.css("zIndex"));if(!isNaN(b)&&b!=0)return b}a=a.parent()}}return 0}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b||"area"==b?a.href||!isNaN(d):!isNaN(d))&&
!c(a)["area"==b?"parents":"closest"](":hidden").length},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}})}(jQuery);
;/*!
 * jQuery UI Widget 1.8.1
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b){var j=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add(this).each(function(){b(this).triggerHandler("remove")});return j.call(b(this),a,c)})};b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend({},c.options);b[e][a].prototype=
b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.substring(0,1)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==undefined){h=i;return false}}):this.each(function(){var g=
b.data(this,a);if(g){d&&g.option(d);g._init()}else b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){this.element=b(c).data(this.widgetName,this);this.options=b.extend(true,{},this.options,b.metadata&&b.metadata.get(c)[this.widgetName],a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.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(a,c){var d=a,e=this;if(arguments.length===0)return b.extend({},e.options);if(typeof a==="string"){if(c===undefined)return this.options[a];d={};d[a]=c}b.each(d,function(f,
h){e._setOption(f,h)});return e},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=
b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*
 * jQuery UI Position 1.8.1
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Position
 */
(function(c){c.ui=c.ui||{};var m=/left|center|right/,n=/top|center|bottom/,p=c.fn.position,q=c.fn.offset;c.fn.position=function(a){if(!a||!a.of)return p.apply(this,arguments);a=c.extend({},a);var b=c(a.of),d=(a.collision||"flip").split(" "),e=a.offset?a.offset.split(" "):[0,0],g,h,i;if(a.of.nodeType===9){g=b.width();h=b.height();i={top:0,left:0}}else if(a.of.scrollTo&&a.of.document){g=b.width();h=b.height();i={top:b.scrollTop()/*,left:b.scrollLeft()*/}}else if(a.of.preventDefault){a.at="left top";g=h=
0;i={top:a.of.pageY,left:a.of.pageX}}else{g=b.outerWidth();h=b.outerHeight();i=b.offset()}c.each(["my","at"],function(){var f=(a[this]||"").split(" ");if(f.length===1)f=m.test(f[0])?f.concat(["center"]):n.test(f[0])?["center"].concat(f):["center","center"];f[0]=m.test(f[0])?f[0]:"center";f[1]=n.test(f[1])?f[1]:"center";a[this]=f});if(d.length===1)d[1]=d[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(a.at[0]==="right")i.left+=g;else if(a.at[0]==="center")i.left+=
g/2;if(a.at[1]==="bottom")i.top+=h;else if(a.at[1]==="center")i.top+=h/2;i.left+=e[0];i.top+=e[1];return this.each(function(){var f=c(this),k=f.outerWidth(),l=f.outerHeight(),j=c.extend({},i);if(a.my[0]==="right")j.left-=k;else if(a.my[0]==="center")j.left-=k/2;if(a.my[1]==="bottom")j.top-=l;else if(a.my[1]==="center")j.top-=l/2;j.left=parseInt(j.left);j.top=parseInt(j.top);c.each(["left","top"],function(o,r){c.ui.position[d[o]]&&c.ui.position[d[o]][r](j,{targetWidth:g,targetHeight:h,elemWidth:k,
elemHeight:l,offset:e,my:a.my,at:a.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(j,{using:a.using}))})};c.ui.position={fit:{left:function(a,b){var d=c(window);b=a.left+b.elemWidth-d.width()-d.scrollLeft();a.left=b>0?a.left-b:Math.max(0,a.left)},top:function(a,b){var d=c(window);b=a.top+b.elemHeight-d.height()-d.scrollTop();a.top=b>0?a.top-b:Math.max(0,a.top)}},flip:{left:function(a,b){if(b.at[0]!=="center"){var d=c(window);d=a.left+b.elemWidth-d.width()-d.scrollLeft();var e=b.my[0]==="left"?
-b.elemWidth:b.my[0]==="right"?b.elemWidth:0,g=-2*b.offset[0];a.left+=a.left<0?e+b.targetWidth+g:d>0?e-b.targetWidth+g:0}},top:function(a,b){if(b.at[1]!=="center"){var d=c(window);d=a.top+b.elemHeight-d.height()-d.scrollTop();var e=b.my[1]==="top"?-b.elemHeight:b.my[1]==="bottom"?b.elemHeight:0,g=b.at[1]==="top"?b.targetHeight:-b.targetHeight,h=-2*b.offset[1];a.top+=a.top<0?e+b.targetHeight+h:d>0?e+g+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(a,b){if(/static/.test(c.curCSS(a,"position")))a.style.position=
"relative";var d=c(a),e=d.offset(),g=parseInt(c.curCSS(a,"top",true),10)||0,h=parseInt(c.curCSS(a,"left",true),10)||0;e={top:b.top-e.top+g,left:b.left-e.left+h};"using"in b?b.using.call(a,e):d.css(e)};c.fn.offset=function(a){var b=this[0];if(!b||!b.ownerDocument)return null;if(a)return this.each(function(){c.offset.setOffset(this,a)});return q.call(this)}}})(jQuery);
;/*
 * jQuery UI Dialog 1.8.1
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Dialog
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *  jquery.ui.button.js
 *	jquery.ui.draggable.js
 *	jquery.ui.mouse.js
 *	jquery.ui.position.js
 *	jquery.ui.resizable.js
 */
(function(c){c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");var a=this,b=a.options,d=b.title||a.originalTitle||"&#160;",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content "+
b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-helper-clearfix").prependTo(g),
h=c('<a href="#"></a>').addClass("ui-dialog-titlebar-close").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("<span></span>")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("<span></span>").addClass("ui-dialog-title").attr("id",
e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");
a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==
b.uiDialog[0])d=Math.max(d,c(this).css("z-index"))});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+=1;d.uiDialog.css("z-index",
c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;d.next().length&&d.appendTo("body");a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===
f[0]&&e.shiftKey){g.focus(1);return false}}});c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();a._trigger("open");a._isOpen=true;return a}},_createButtons:function(a){var b=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,function(){return!(d=true)});if(d){c.each(a,
function(g,f){g=c('<button type="button"></button>').text(g).click(function(){f.apply(b.element[0],arguments)}).appendTo(e);c.fn.button&&g.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");
b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,originalSize:f.originalSize,position:f.position,size:f.size}}a=a===undefined?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");
a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",
f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0];a=a||c.ui.dialog.prototype.options.position;if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(e,g){if(+b[e]===b[e]){d[e]=b[e];b[e]=
g}})}else if(typeof a==="object"){if("left"in a){b[0]="left";d[0]=a.left}else if("right"in a){b[0]="right";d[0]=-a.right}if("top"in a){b[1]="top";d[1]=a.top}else if("bottom"in a){b[1]="bottom";d[1]=-a.bottom}}(a=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0/*,left:0*/}).position({my:b.join(" "),at:b.join(" "),offset:d.join(" "),of:window,collision:"fit",using:function(e){var g=c(this).css(e).offset().top;g<0&&c(this).css("top",e.top-g)}});a||this.uiDialog.hide()},_setOption:function(a,
b){var d=this,e=d.uiDialog,g=e.is(":data(resizable)"),f=false;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):e.removeClass("ui-dialog-disabled");break;case "draggable":b?d._makeDraggable():e.draggable("destroy");break;
case "height":f=true;break;case "maxHeight":g&&e.resizable("option","maxHeight",b);f=true;break;case "maxWidth":g&&e.resizable("option","maxWidth",b);f=true;break;case "minHeight":g&&e.resizable("option","minHeight",b);f=true;break;case "minWidth":g&&e.resizable("option","minWidth",b);f=true;break;case "position":d._position(b);break;case "resizable":g&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",
d.uiDialogTitlebar).html(""+(b||"&#160;"));break;case "width":f=true;break}c.Widget.prototype._setOption.apply(d,arguments);f&&d._size()},_size:function(){var a=this.options,b;this.element.css({width:"auto",minHeight:0,height:0});b=this.uiDialog.css({height:"auto",width:a.width}).height();this.element.css(a.height==="auto"?{minHeight:Math.max(a.minHeight-b,0),height:"auto"}:{minHeight:0,height:Math.max(a.height-b,0)}).show();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",
this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.1",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&
c(document).bind(c.ui.dialog.overlay.events,function(d){return c(d.target).zIndex()>=c.ui.dialog.overlay.maxZ})},1);c(document).bind("keydown.dialog-overlay",function(d){if(a.options.closeOnEscape&&d.keyCode&&d.keyCode===c.ui.keyCode.ESCAPE){a.close(d);d.preventDefault()}});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var b=(this.oldInstances.pop()||c("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});c.fn.bgiframe&&
b.bgiframe();this.instances.push(b);return b},destroy:function(a){this.oldInstances.push(this.instances.splice(c.inArray(a,this.instances),1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var b=0;c.each(this.instances,function(){b=Math.max(b,this.css("z-index"))});this.maxZ=b},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);b=Math.max(document.documentElement.offsetHeight,
document.body.offsetHeight);return a<b?c(window).height()+"px":a+"px"}else return c(document).height()+"px"},width:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);return a<b?c(window).width()+"px":a+"px"}else return c(document).width()+"px"},resize:function(){var a=c([]);c.each(c.ui.dialog.overlay.instances,function(){a=a.add(this)});a.css({width:0,
height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
;/*
 * SimpleModal 1.3.5 - jQuery Plugin
 * http://www.ericmmartin.com/projects/simplemodal/
 * Copyright (c) 2010 Eric Martin (http://twitter.com/EricMMartin)
 * Dual licensed under the MIT and GPL licenses
 * Revision: $Id: jquery.simplemodal.js 245 2010-03-25 20:41:15Z emartin24 $
 */

/**
 * SimpleModal is a lightweight jQuery plugin that provides a simple
 * interface to create a modal dialog.
 *
 * The goal of SimpleModal is to provide developers with a cross-browser 
 * overlay and container that will be populated with data provided to
 * SimpleModal.
 *
 * There are two ways to call SimpleModal:
 * 1) As a chained function on a jQuery object, like $('#myDiv').modal();.
 * This call would place the DOM object, #myDiv, inside a modal dialog.
 * Chaining requires a jQuery object. An optional options object can be
 * passed as a parameter.
 *
 * @example $('<div>my data</div>').modal({options});
 * @example $('#myDiv').modal({options});
 * @example jQueryObject.modal({options});
 *
 * 2) As a stand-alone function, like $.modal(data). The data parameter
 * is required and an optional options object can be passed as a second
 * parameter. This method provides more flexibility in the types of data 
 * that are allowed. The data could be a DOM object, a jQuery object, HTML
 * or a string.
 * 
 * @example $.modal('<div>my data</div>', {options});
 * @example $.modal('my data', {options});
 * @example $.modal($('#myDiv'), {options});
 * @example $.modal(jQueryObject, {options});
 * @example $.modal(document.getElementById('myDiv'), {options}); 
 * 
 * A SimpleModal call can contain multiple elements, but only one modal 
 * dialog can be created at a time. Which means that all of the matched
 * elements will be displayed within the modal container.
 * 
 * SimpleModal internally sets the CSS needed to display the modal dialog
 * properly in all browsers, yet provides the developer with the flexibility
 * to easily control the look and feel. The styling for SimpleModal can be 
 * done through external stylesheets, or through SimpleModal, using the
 * overlayCss and/or containerCss options.
 *
 * SimpleModal has been tested in the following browsers:
 * - IE 6, 7, 8
 * - Firefox 2, 3
 * - Opera 9, 10
 * - Safari 3, 4
 * - Chrome 1, 2, 3, 4
 *
 * @name SimpleModal
 * @type jQuery
 * @requires jQuery v1.2.2
 * @cat Plugins/Windows and Overlays
 * @author Eric Martin (http://ericmmartin.com)
 * @version 1.3.5
 */
;(function ($) {
	var ie6 = $.browser.msie && parseInt($.browser.version) == 6 && typeof window['XMLHttpRequest'] != "object",
		ieQuirks = null,
		w = [];

	/*
	 * Stand-alone function to create a modal dialog.
	 * 
	 * @param {string, object} data A string, jQuery object or DOM object
	 * @param {object} [options] An optional object containing options overrides
	 */
	$.modal = function (data, options) {
		return $.modal.impl.init(data, options);
	};

	/*
	 * Stand-alone close function to close the modal dialog
	 */
	$.modal.close = function () {
		$.modal.impl.close();
	};

	/*
	 * Chained function to create a modal dialog.
	 * 
	 * @param {object} [options] An optional object containing options overrides
	 */
	$.fn.modal = function (options) {
		return $.modal.impl.init(this, options);
	};

	/*
	 * SimpleModal default options
	 * 
	 * appendTo:		(String:'body') The jQuery selector to append the elements to. For ASP.NET, use 'form'.
	 * focus:			(Boolean:true) Forces focus to remain on the modal dialog
	 * opacity:			(Number:50) The opacity value for the overlay div, from 0 - 100
	 * overlayId:		(String:'simplemodal-overlay') The DOM element id for the overlay div
	 * overlayCss:		(Object:{}) The CSS styling for the overlay div
	 * containerId:		(String:'simplemodal-container') The DOM element id for the container div
	 * containerCss:	(Object:{}) The CSS styling for the container div
	 * dataId:			(String:'simplemodal-data') The DOM element id for the data div
	 * dataCss:			(Object:{}) The CSS styling for the data div
	 * minHeight:		(Number:null) The minimum height for the container
	 * minWidth:		(Number:null) The minimum width for the container
	 * maxHeight:		(Number:null) The maximum height for the container. If not specified, the window height is used.
	 * maxWidth:		(Number:null) The maximum width for the container. If not specified, the window width is used.
	 * autoResize:		(Boolean:false) Resize container on window resize? Use with caution - this may have undesirable side-effects.
	 * autoPosition:	(Boolean:true) Automatically position container on creation and window resize?
	 * zIndex:			(Number: 1000) Starting z-index value
	 * close:			(Boolean:true) If true, closeHTML, escClose and overClose will be used if set.
	 							If false, none of them will be used.
	 * closeHTML:		(String:'<a class="modalCloseImg" title="Close"></a>') The HTML for the 
							default close link. SimpleModal will automatically add the closeClass to this element.
	 * closeClass:		(String:'simplemodal-close') The CSS class used to bind to the close event
	 * escClose:		(Boolean:true) Allow Esc keypress to close the dialog? 
	 * overlayClose:	(Boolean:false) Allow click on overlay to close the dialog?
	 * position:		(Array:null) Position of container [top, left]. Can be number of pixels or percentage
	 * persist:			(Boolean:false) Persist the data across modal calls? Only used for existing
								DOM elements. If true, the data will be maintained across modal calls, if false,
								the data will be reverted to its original state.
	 * modal:			(Boolean:true) If false, the overlay, iframe, and certain events will be disabled
								allowing the user to interace with the page below the dialog
	 * onOpen:			(Function:null) The callback function used in place of SimpleModal's open
	 * onShow:			(Function:null) The callback function used after the modal dialog has opened
	 * onClose:			(Function:null) The callback function used in place of SimpleModal's close
	 */
	$.modal.defaults = {
		appendTo: 'body',
		focus: true,
		opacity: 50,
		overlayId: 'simplemodal-overlay',
		overlayCss: {},
		containerId: 'simplemodal-container',
		containerCss: {},
		dataId: 'simplemodal-data',
		dataCss: {},
		minHeight: null,
		minWidth: null,
		maxHeight: null,
		maxWidth: null,
		autoResize: false,
		autoPosition: true,
		zIndex: 1000,
		close: true,
		closeHTML: '<a class="modalCloseImg" title="Fermer"></a>',
		closeClass: 'simplemodal-close',
		escClose: true,
		overlayClose: false,
		position: null,
		persist: false,
		modal: true,
		onOpen: null,
		onShow: null,
		onClose: null
	};

	/*
	 * Main modal object
	 */
	$.modal.impl = {
		/*
		 * Modal dialog options
		 */
		o: null,
		/*
		 * Contains the modal dialog elements and is the object passed 
		 * back to the callback (onOpen, onShow, onClose) functions
		 */
		d: {},
		/*
		 * Initialize the modal dialog
		 */
		init: function (data, options) {
			var s = this;

			// don't allow multiple calls
			if (s.d.data) {
				return false;
			}

			// $.boxModel is undefined if checked earlier
			ieQuirks = $.browser.msie && !$.boxModel;

			// merge defaults and user options
			s.o = $.extend({}, $.modal.defaults, options);

			// keep track of z-index
			s.zIndex = s.o.zIndex;

			// set the onClose callback flag
			s.occb = false;

			// determine how to handle the data based on its type
			if (typeof data == 'object') {
				// convert DOM object to a jQuery object
				data = data instanceof jQuery ? data : $(data);
				s.d.placeholder = false;

				// if the object came from the DOM, keep track of its parent
				if (data.parent().parent().size() > 0) {
					data.before($('<span></span>')
						.attr('id', 'simplemodal-placeholder')
						.css({display: 'none'}));

					s.d.placeholder = true;
					s.display = data.css('display');

					// persist changes? if not, make a clone of the element
					if (!s.o.persist) {
						s.d.orig = data.clone(true);
					}
				}
			}
			else if (typeof data == 'string' || typeof data == 'number') {
				// just insert the data as innerHTML
				data = $('<div></div>').html(data);
			}
			else {
				// unsupported data type!
				alert('SimpleModal Error: Unsupported data type: ' + typeof data);
				return s;
			}

			// create the modal overlay, container and, if necessary, iframe
			s.create(data);
			data = null;

			// display the modal dialog
			s.open();

			// useful for adding events/manipulating data in the modal dialog
			if ($.isFunction(s.o.onShow)) {
				s.o.onShow.apply(s, [s.d]);
			}

			// don't break the chain =)
			return s;
		},
		/*
		 * Create and add the modal overlay and container to the page
		 */
		create: function (data) {
			var s = this;

			// get the window properties
			w = s.getDimensions();

			// add an iframe to prevent select options from bleeding through
			if (s.o.modal && ie6) {
				s.d.iframe = $('<iframe src="javascript:false;"></iframe>')
					.css($.extend(s.o.iframeCss, {
						display: 'none',
						opacity: 0, 
						position: 'fixed',
						height: w[0],
						width: w[1],
						zIndex: s.o.zIndex,
						top: 0,
						left: 0
					}))
					.appendTo(s.o.appendTo);
			}

			// create the overlay
			s.d.overlay = $('<div></div>')
				.attr('id', s.o.overlayId)
				.addClass('simplemodal-overlay')
				.css($.extend(s.o.overlayCss, {
					display: 'none',
					opacity: s.o.opacity / 100,
					height: s.o.modal ? w[0] : 0,
					width: s.o.modal ? w[1] : 0,
					position: 'fixed',
					left: 0,
					top: 0,
					zIndex: s.o.zIndex + 1
				}))
				.appendTo(s.o.appendTo);
		
			// create the container
			s.d.container = $('<div></div>')
				.attr('id', s.o.containerId)
				.addClass('simplemodal-container')
				.css($.extend(s.o.containerCss, {
					display: 'none',
					position: 'absolute', 
					zIndex: s.o.zIndex + 2
				}))
				.append(s.o.close && s.o.closeHTML
					? $(s.o.closeHTML).addClass(s.o.closeClass)
					: '')
				.appendTo(s.o.appendTo);
				
			s.d.wrap = $('<div></div>')
				.attr('tabIndex', -1)
				.addClass('simplemodal-wrap')
				.css({height: '100%', outline: 0, width: '100%'})
				.appendTo(s.d.container);
				
			// add styling and attributes to the data
			// append to body to get correct dimensions, then move to wrap
			s.d.data = data
				.attr('id', data.attr('id') || s.o.dataId)
				.addClass('simplemodal-data')
				.css($.extend(s.o.dataCss, {
						display: 'none'
				}))
				.appendTo('body');
			data = null;

			s.setContainerDimensions();
			s.d.data.appendTo(s.d.wrap);

			// fix issues with IE
			if (ie6 || ieQuirks) {
				s.fixIE();
			}
		},
		/*
		 * Bind events
		 */
		bindEvents: function () {
			var s = this;

			// bind the close event to any element with the closeClass class
			$('.' + s.o.closeClass).bind('click.simplemodal', function (e) {
				e.preventDefault();
				s.close();
			});
			
			// bind the overlay click to the close function, if enabled
			if (s.o.modal && s.o.close && s.o.overlayClose) {
				s.d.overlay.bind('click.simplemodal', function (e) {
					e.preventDefault();
					s.close();
				});
			}
	
			// bind keydown events
			$(document).bind('keydown.simplemodal', function (e) {
				if (s.o.modal && s.o.focus && e.keyCode == 9) { // TAB
					s.watchTab(e);
				}
				else if ((s.o.close && s.o.escClose) && e.keyCode == 27) { // ESC
					e.preventDefault();
					s.close();
				}
			});

			// update window size
			$(window).bind('resize.simplemodal', function () {
				// redetermine the window width/height
				w = s.getDimensions();

				// reposition the dialog
				s.setContainerDimensions(true);
	
				if (ie6 || ieQuirks) {
					s.fixIE();
				}
				else if (s.o.modal) {
					// update the iframe & overlay
					s.d.iframe && s.d.iframe.css({height: w[0], width: w[1]});
					s.d.overlay.css({height: w[0], width: w[1]});
				}
			});
		},
		/*
		 * Unbind events
		 */
		unbindEvents: function () {
			$('.' + this.o.closeClass).unbind('click.simplemodal');
			$(document).unbind('keydown.simplemodal');
			$(window).unbind('resize.simplemodal');
			this.d.overlay.unbind('click.simplemodal');
		},
		/*
		 * Fix issues in IE6 and IE7 in quirks mode
		 */
		fixIE: function () {
			var s = this, p = s.o.position;

			// simulate fixed position - adapted from BlockUI
			$.each([s.d.iframe || null, !s.o.modal ? null : s.d.overlay, s.d.container], function (i, el) {
				if (el) {
					var bch = 'document.body.clientHeight', bcw = 'document.body.clientWidth',
						bsh = 'document.body.scrollHeight', bsl = 'document.body.scrollLeft',
						bst = 'document.body.scrollTop', bsw = 'document.body.scrollWidth',
						ch = 'document.documentElement.clientHeight', cw = 'document.documentElement.clientWidth',
						sl = 'document.documentElement.scrollLeft', st = 'document.documentElement.scrollTop',
						s = el[0].style;

					s.position = 'absolute';
					if (i < 2) {
						s.removeExpression('height');
						s.removeExpression('width');
						s.setExpression('height','' + bsh + ' > ' + bch + ' ? ' + bsh + ' : ' + bch + ' + "px"');
						s.setExpression('width','' + bsw + ' > ' + bcw + ' ? ' + bsw + ' : ' + bcw + ' + "px"');
					}
					else {
						var te, le;
						if (p && p.constructor == Array) {
							var top = p[0] 
								? typeof p[0] == 'number' ? p[0].toString() : p[0].replace(/px/, '')
								: el.css('top').replace(/px/, '');
							te = top.indexOf('%') == -1 
								? top + ' + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"'
								: parseInt(top.replace(/%/, '')) + ' * ((' + ch + ' || ' + bch + ') / 100) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"';

							if (p[1]) {
								var left = typeof p[1] == 'number' ? p[1].toString() : p[1].replace(/px/, '');
								le = left.indexOf('%') == -1 
									? left + ' + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"'
									: parseInt(left.replace(/%/, '')) + ' * ((' + cw + ' || ' + bcw + ') / 100) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"';
							}
						}
						else {
							te = '(' + ch + ' || ' + bch + ') / 2 - (this.offsetHeight / 2) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"';
							le = '(' + cw + ' || ' + bcw + ') / 2 - (this.offsetWidth / 2) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"';
						}
						s.removeExpression('top');
						s.removeExpression('left');
						s.setExpression('top', te);
						s.setExpression('left', le);
					}
				}
			});
		},
		focus: function (pos) {
			var s = this, p = pos || 'first';

			// focus on dialog or the first visible/enabled input element
			var input = $(':input:enabled:visible:' + p, s.d.wrap);
			input.length > 0 ? input.focus() : s.d.wrap.focus();
		},
		getDimensions: function () {
			var el = $(window);

			// fix a jQuery/Opera bug with determining the window height
			var h = $.browser.opera && $.browser.version > '9.5' && $.fn.jquery <= '1.2.6' ? document.documentElement['clientHeight'] :
				$.browser.opera && $.browser.version < '9.5' && $.fn.jquery > '1.2.6' ? window.innerHeight :
				el.height();

			return [h, el.width()];
		},
		getVal: function (v) {
			return v == 'auto' ? 0 
				: v.indexOf('%') > 0 ? v 
					: parseInt(v.replace(/px/, ''));
		},
		setContainerDimensions: function (resize) {
			var s = this;

			if (!resize || (resize && s.o.autoResize)) {
				// get the dimensions for the container and data
				var ch = $.browser.opera ? s.d.container.height() : s.getVal(s.d.container.css('height')), 
					cw = $.browser.opera ? s.d.container.width() : s.getVal(s.d.container.css('width')),
					dh = s.d.data.outerHeight(true), dw = s.d.data.outerWidth(true);

				var mh = s.o.maxHeight && s.o.maxHeight < w[0] ? s.o.maxHeight : w[0],
					mw = s.o.maxWidth && s.o.maxWidth < w[1] ? s.o.maxWidth : w[1];

				// height
				if (!ch) {
					if (!dh) {ch = s.o.minHeight;}
					else {
						if (dh > mh) {ch = mh;}
						else if (dh < s.o.minHeight) {ch = s.o.minHeight;}
						else {ch = dh;}
					}
				}
				else {
					ch = ch > mh ? mh : ch;
				}

				// width
				if (!cw) {
					if (!dw) {cw = s.o.minWidth;}
					else {
						if (dw > mw) {cw = mw;}
						else if (dw < s.o.minWidth) {cw = s.o.minWidth;}
						else {cw = dw;}
					}
				}
				else {
					cw = cw > mw ? mw : cw;
				}

				s.d.container.css({height: ch, width: cw});
				/*if (dh > ch || dw > cw) {
					s.d.wrap.css({overflow:'auto'});
				}*/
			}
			
			if (s.o.autoPosition) {
				s.setPosition();
			}
		},
		setPosition: function () {
			var s = this, top, left,
				hc = (w[0]/2) - (s.d.container.outerHeight(true)/2),
				vc = (w[1]/2) - (s.d.container.outerWidth(true)/2);

			if (s.o.position && Object.prototype.toString.call(s.o.position) === "[object Array]") {
				top = s.o.position[0] || hc;
				left = s.o.position[1] || vc;
			} else {
				top = hc;
				left = vc;
			}
			s.d.container.css({left: left, top: top});
		},
		watchTab: function (e) {
			var s = this;

			if ($(e.target).parents('.simplemodal-container').length > 0) {
				// save the list of inputs
				s.inputs = $(':input:enabled:visible:first, :input:enabled:visible:last', s.d.data[0]);

				// if it's the first or last tabbable element, refocus
				if ((!e.shiftKey && e.target == s.inputs[s.inputs.length -1]) ||
						(e.shiftKey && e.target == s.inputs[0]) ||
						s.inputs.length == 0) {
					e.preventDefault();
					var pos = e.shiftKey ? 'last' : 'first';
					setTimeout(function () {s.focus(pos);}, 10);
				}
			}
			else {
				// might be necessary when custom onShow callback is used
				e.preventDefault();
				setTimeout(function () {s.focus();}, 10);
			}
		},
		/*
		 * Open the modal dialog elements
		 * - Note: If you use the onOpen callback, you must "show" the 
		 *	        overlay and container elements manually 
		 *         (the iframe will be handled by SimpleModal)
		 */
		open: function () {
			var s = this;
			// display the iframe
			s.d.iframe && s.d.iframe.show();

			if ($.isFunction(s.o.onOpen)) {
				// execute the onOpen callback 
				s.o.onOpen.apply(s, [s.d]);
			}
			else {
				// display the remaining elements
				s.d.overlay.show();
				s.d.container.show();
				s.d.data.show();
			}
			
			s.focus();

			// bind default events
			s.bindEvents();
		},
		/*
		 * Close the modal dialog
		 * - Note: If you use an onClose callback, you must remove the 
		 *         overlay, container and iframe elements manually
		 *
		 * @param {boolean} external Indicates whether the call to this
		 *     function was internal or external. If it was external, the
		 *     onClose callback will be ignored
		 */
		close: function () {
			var s = this;

			// prevent close when dialog does not exist
			if (!s.d.data) {
				return false;
			}

			// remove the default events
			s.unbindEvents();

			if ($.isFunction(s.o.onClose) && !s.occb) {
				// set the onClose callback flag
				s.occb = true;

				// execute the onClose callback
				s.o.onClose.apply(s, [s.d]);
			}
			else {
				// if the data came from the DOM, put it back
				if (s.d.placeholder) {
					var ph = $('#simplemodal-placeholder');
					// save changes to the data?
					if (s.o.persist) {
						// insert the (possibly) modified data back into the DOM
						ph.replaceWith(s.d.data.removeClass('simplemodal-data').css('display', s.display));
					}
					else {
						// remove the current and insert the original, 
						// unmodified data back into the DOM
						s.d.data.hide().remove();
						ph.replaceWith(s.d.orig);
					}
				}
				else {
					// otherwise, remove it
					s.d.data.hide().remove();
				}

				// remove the remaining elements
				s.d.container.hide().remove();
				s.d.overlay.hide().remove();
				s.d.iframe && s.d.iframe.hide().remove();

				// reset the dialog object
				s.d = {};
			}
		}
	};
})(jQuery);
/*
 * Copyright (c) 2009 Simo Kinnunen.
 * Licensed under the MIT license.
 *
 * @version 1.09
 */
var Cufon=(function(){var m=function(){return m.replace.apply(null,arguments)};var x=m.DOM={ready:(function(){var C=false,E={loaded:1,complete:1};var B=[],D=function(){if(C){return}C=true;for(var F;F=B.shift();F()){}};if(document.addEventListener){document.addEventListener("DOMContentLoaded",D,false);window.addEventListener("pageshow",D,false)}if(!window.opera&&document.readyState){(function(){E[document.readyState]?D():setTimeout(arguments.callee,10)})()}if(document.readyState&&document.createStyleSheet){(function(){try{document.body.doScroll("left");D()}catch(F){setTimeout(arguments.callee,1)}})()}q(window,"load",D);return function(F){if(!arguments.length){D()}else{C?F():B.push(F)}}})(),root:function(){return document.documentElement||document.body}};var n=m.CSS={Size:function(C,B){this.value=parseFloat(C);this.unit=String(C).match(/[a-z%]*$/)[0]||"px";this.convert=function(D){return D/B*this.value};this.convertFrom=function(D){return D/this.value*B};this.toString=function(){return this.value+this.unit}},addClass:function(C,B){var D=C.className;C.className=D+(D&&" ")+B;return C},color:j(function(C){var B={};B.color=C.replace(/^rgba\((.*?),\s*([\d.]+)\)/,function(E,D,F){B.opacity=parseFloat(F);return"rgb("+D+")"});return B}),fontStretch:j(function(B){if(typeof B=="number"){return B}if(/%$/.test(B)){return parseFloat(B)/100}return{"ultra-condensed":0.5,"extra-condensed":0.625,condensed:0.75,"semi-condensed":0.875,"semi-expanded":1.125,expanded:1.25,"extra-expanded":1.5,"ultra-expanded":2}[B]||1}),getStyle:function(C){var B=document.defaultView;if(B&&B.getComputedStyle){return new a(B.getComputedStyle(C,null))}if(C.currentStyle){return new a(C.currentStyle)}return new a(C.style)},gradient:j(function(F){var G={id:F,type:F.match(/^-([a-z]+)-gradient\(/)[1],stops:[]},C=F.substr(F.indexOf("(")).match(/([\d.]+=)?(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)/ig);for(var E=0,B=C.length,D;E<B;++E){D=C[E].split("=",2).reverse();G.stops.push([D[1]||E/(B-1),D[0]])}return G}),quotedList:j(function(E){var D=[],C=/\s*((["'])([\s\S]*?[^\\])\2|[^,]+)\s*/g,B;while(B=C.exec(E)){D.push(B[3]||B[1])}return D}),recognizesMedia:j(function(G){var E=document.createElement("style"),D,C,B;E.type="text/css";E.media=G;try{E.appendChild(document.createTextNode("/**/"))}catch(F){}C=g("head")[0];C.insertBefore(E,C.firstChild);D=(E.sheet||E.styleSheet);B=D&&!D.disabled;C.removeChild(E);return B}),removeClass:function(D,C){var B=RegExp("(?:^|\\s+)"+C+"(?=\\s|$)","g");D.className=D.className.replace(B,"");return D},supports:function(D,C){var B=document.createElement("span").style;if(B[D]===undefined){return false}B[D]=C;return B[D]===C},textAlign:function(E,D,B,C){if(D.get("textAlign")=="right"){if(B>0){E=" "+E}}else{if(B<C-1){E+=" "}}return E},textShadow:j(function(F){if(F=="none"){return null}var E=[],G={},B,C=0;var D=/(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)|(-?[\d.]+[a-z%]*)|,/ig;while(B=D.exec(F)){if(B[0]==","){E.push(G);G={};C=0}else{if(B[1]){G.color=B[1]}else{G[["offX","offY","blur"][C++]]=B[2]}}}E.push(G);return E}),textTransform:(function(){var B={uppercase:function(C){return C.toUpperCase()},lowercase:function(C){return C.toLowerCase()},capitalize:function(C){return C.replace(/\b./g,function(D){return D.toUpperCase()})}};return function(E,D){var C=B[D.get("textTransform")];return C?C(E):E}})(),whiteSpace:(function(){var D={inline:1,"inline-block":1,"run-in":1};var C=/^\s+/,B=/\s+$/;return function(H,F,G,E){if(E){if(E.nodeName.toLowerCase()=="br"){H=H.replace(C,"")}}if(D[F.get("display")]){return H}if(!G.previousSibling){H=H.replace(C,"")}if(!G.nextSibling){H=H.replace(B,"")}return H}})()};n.ready=(function(){var B=!n.recognizesMedia("all"),E=false;var D=[],H=function(){B=true;for(var K;K=D.shift();K()){}};var I=g("link"),J=g("style");function C(K){return K.disabled||G(K.sheet,K.media||"screen")}function G(M,P){if(!n.recognizesMedia(P||"all")){return true}if(!M||M.disabled){return false}try{var Q=M.cssRules,O;if(Q){search:for(var L=0,K=Q.length;O=Q[L],L<K;++L){switch(O.type){case 2:break;case 3:if(!G(O.styleSheet,O.media.mediaText)){return false}break;default:break search}}}}catch(N){}return true}function F(){if(document.createStyleSheet){return true}var L,K;for(K=0;L=I[K];++K){if(L.rel.toLowerCase()=="stylesheet"&&!C(L)){return false}}for(K=0;L=J[K];++K){if(!C(L)){return false}}return true}x.ready(function(){if(!E){E=n.getStyle(document.body).isUsable()}if(B||(E&&F())){H()}else{setTimeout(arguments.callee,10)}});return function(K){if(B){K()}else{D.push(K)}}})();function s(D){var C=this.face=D.face,B={"\u0020":1,"\u00a0":1,"\u3000":1};this.glyphs=D.glyphs;this.w=D.w;this.baseSize=parseInt(C["units-per-em"],10);this.family=C["font-family"].toLowerCase();this.weight=C["font-weight"];this.style=C["font-style"]||"normal";this.viewBox=(function(){var F=C.bbox.split(/\s+/);var E={minX:parseInt(F[0],10),minY:parseInt(F[1],10),maxX:parseInt(F[2],10),maxY:parseInt(F[3],10)};E.width=E.maxX-E.minX;E.height=E.maxY-E.minY;E.toString=function(){return[this.minX,this.minY,this.width,this.height].join(" ")};return E})();this.ascent=-parseInt(C.ascent,10);this.descent=-parseInt(C.descent,10);this.height=-this.ascent+this.descent;this.spacing=function(L,N,E){var O=this.glyphs,M,K,G,P=[],F=0,J=-1,I=-1,H;while(H=L[++J]){M=O[H]||this.missingGlyph;if(!M){continue}if(K){F-=G=K[H]||0;P[I]-=G}F+=P[++I]=~~(M.w||this.w)+N+(B[H]?E:0);K=M.k}P.total=F;return P}}function f(){var C={},B={oblique:"italic",italic:"oblique"};this.add=function(D){(C[D.style]||(C[D.style]={}))[D.weight]=D};this.get=function(H,I){var G=C[H]||C[B[H]]||C.normal||C.italic||C.oblique;if(!G){return null}I={normal:400,bold:700}[I]||parseInt(I,10);if(G[I]){return G[I]}var E={1:1,99:0}[I%100],K=[],F,D;if(E===undefined){E=I>400}if(I==500){I=400}for(var J in G){if(!k(G,J)){continue}J=parseInt(J,10);if(!F||J<F){F=J}if(!D||J>D){D=J}K.push(J)}if(I<F){I=F}if(I>D){I=D}K.sort(function(M,L){return(E?(M>=I&&L>=I)?M<L:M>L:(M<=I&&L<=I)?M>L:M<L)?-1:1});return G[K[0]]}}function r(){function D(F,G){if(F.contains){return F.contains(G)}return F.compareDocumentPosition(G)&16}function B(G){var F=G.relatedTarget;if(!F||D(this,F)){return}C(this,G.type=="mouseover")}function E(F){C(this,F.type=="mouseenter")}function C(F,G){setTimeout(function(){var H=d.get(F).options;m.replace(F,G?h(H,H.hover):H,true)},10)}this.attach=function(F){if(F.onmouseenter===undefined){q(F,"mouseover",B);q(F,"mouseout",B)}else{q(F,"mouseenter",E);q(F,"mouseleave",E)}}}function u(){var C=[],D={};function B(H){var E=[],G;for(var F=0;G=H[F];++F){E[F]=C[D[G]]}return E}this.add=function(F,E){D[F]=C.push(E)-1};this.repeat=function(){var E=arguments.length?B(arguments):C,F;for(var G=0;F=E[G++];){m.replace(F[0],F[1],true)}}}function A(){var D={},B=0;function C(E){return E.cufid||(E.cufid=++B)}this.get=function(E){var F=C(E);return D[F]||(D[F]={})}}function a(B){var D={},C={};this.extend=function(E){for(var F in E){if(k(E,F)){D[F]=E[F]}}return this};this.get=function(E){return D[E]!=undefined?D[E]:B[E]};this.getSize=function(F,E){return C[F]||(C[F]=new n.Size(this.get(F),E))};this.isUsable=function(){return !!B}}function q(C,B,D){if(C.addEventListener){C.addEventListener(B,D,false)}else{if(C.attachEvent){C.attachEvent("on"+B,function(){return D.call(C,window.event)})}}}function v(C,B){var D=d.get(C);if(D.options){return C}if(B.hover&&B.hoverables[C.nodeName.toLowerCase()]){b.attach(C)}D.options=B;return C}function j(B){var C={};return function(D){if(!k(C,D)){C[D]=B.apply(null,arguments)}return C[D]}}function c(F,E){var B=n.quotedList(E.get("fontFamily").toLowerCase()),D;for(var C=0;D=B[C];++C){if(i[D]){return i[D].get(E.get("fontStyle"),E.get("fontWeight"))}}return null}function g(B){return document.getElementsByTagName(B)}function k(C,B){return C.hasOwnProperty(B)}function h(){var C={},B,F;for(var E=0,D=arguments.length;B=arguments[E],E<D;++E){for(F in B){if(k(B,F)){C[F]=B[F]}}}return C}function o(E,M,C,N,F,D){var K=document.createDocumentFragment(),H;if(M===""){return K}var L=N.separate;var I=M.split(p[L]),B=(L=="words");if(B&&t){if(/^\s/.test(M)){I.unshift("")}if(/\s$/.test(M)){I.push("")}}for(var J=0,G=I.length;J<G;++J){H=z[N.engine](E,B?n.textAlign(I[J],C,J,G):I[J],C,N,F,D,J<G-1);if(H){K.appendChild(H)}}return K}function l(D,M){var C=D.nodeName.toLowerCase();if(M.ignore[C]){return}var E=!M.textless[C];var B=n.getStyle(v(D,M)).extend(M);var F=c(D,B),G,K,I,H,L,J;if(!F){return}for(G=D.firstChild;G;G=I){K=G.nodeType;I=G.nextSibling;if(E&&K==3){if(H){H.appendData(G.data);D.removeChild(G)}else{H=G}if(I){continue}}if(H){D.replaceChild(o(F,n.whiteSpace(H.data,B,H,J),B,M,G,D),H);H=null}if(K==1){if(G.firstChild){if(G.nodeName.toLowerCase()=="cufon"){z[M.engine](F,null,B,M,G,D)}else{arguments.callee(G,M)}}J=G}}}var t=" ".split(/\s+/).length==0;var d=new A();var b=new r();var y=new u();var e=false;var z={},i={},w={autoDetect:false,engine:null,forceHitArea:false,hover:false,hoverables:{a:true},ignore:{applet:1,canvas:1,col:1,colgroup:1,head:1,iframe:1,map:1,optgroup:1,option:1,script:1,select:1,style:1,textarea:1,title:1,pre:1},printable:true,selector:(window.Sizzle||(window.jQuery&&function(B){return jQuery(B)})||(window.dojo&&dojo.query)||(window.Ext&&Ext.query)||(window.YAHOO&&YAHOO.util&&YAHOO.util.Selector&&YAHOO.util.Selector.query)||(window.$$&&function(B){return $$(B)})||(window.$&&function(B){return $(B)})||(document.querySelectorAll&&function(B){return document.querySelectorAll(B)})||g),separate:"words",textless:{dl:1,html:1,ol:1,table:1,tbody:1,thead:1,tfoot:1,tr:1,ul:1},textShadow:"none"};var p={words:/\s/.test("\u00a0")?/[^\S\u00a0]+/:/\s+/,characters:"",none:/^/};m.now=function(){x.ready();return m};m.refresh=function(){y.repeat.apply(y,arguments);return m};m.registerEngine=function(C,B){if(!B){return m}z[C]=B;return m.set("engine",C)};m.registerFont=function(D){if(!D){return m}var B=new s(D),C=B.family;if(!i[C]){i[C]=new f()}i[C].add(B);return m.set("fontFamily",'"'+C+'"')};m.replace=function(D,C,B){C=h(w,C);if(!C.engine){return m}if(!e){n.addClass(x.root(),"cufon-active cufon-loading");n.ready(function(){n.addClass(n.removeClass(x.root(),"cufon-loading"),"cufon-ready")});e=true}if(C.hover){C.forceHitArea=true}if(C.autoDetect){delete C.fontFamily}if(typeof C.textShadow=="string"){C.textShadow=n.textShadow(C.textShadow)}if(typeof C.color=="string"&&/^-/.test(C.color)){C.textGradient=n.gradient(C.color)}else{delete C.textGradient}if(!B){y.add(D,arguments)}if(D.nodeType||typeof D=="string"){D=[D]}n.ready(function(){for(var F=0,E=D.length;F<E;++F){var G=D[F];if(typeof G=="string"){m.replace(C.selector(G),C,true)}else{l(G,C)}}});return m};m.set=function(B,C){w[B]=C;return m};return m})();Cufon.registerEngine("canvas",(function(){var b=document.createElement("canvas");if(!b||!b.getContext||!b.getContext.apply){return}b=null;var a=Cufon.CSS.supports("display","inline-block");var e=!a&&(document.compatMode=="BackCompat"||/frameset|transitional/i.test(document.doctype.publicId));var f=document.createElement("style");f.type="text/css";f.appendChild(document.createTextNode(("cufon{text-indent:0;}@media screen,projection{cufon{display:inline;display:inline-block;position:relative;vertical-align:middle;"+(e?"":"font-size:1px;line-height:1px;")+"}cufon cufontext{display:-moz-inline-box;display:inline-block;width:0;height:0;overflow:hidden;text-indent:-10000in;}"+(a?"cufon canvas{position:relative;}":"cufon canvas{position:absolute;}")+"}@media print{cufon{padding:0;}cufon canvas{display:none;}}").replace(/;/g,"!important;")));document.getElementsByTagName("head")[0].appendChild(f);function d(p,h){var n=0,m=0;var g=[],o=/([mrvxe])([^a-z]*)/g,k;generate:for(var j=0;k=o.exec(p);++j){var l=k[2].split(",");switch(k[1]){case"v":g[j]={m:"bezierCurveTo",a:[n+~~l[0],m+~~l[1],n+~~l[2],m+~~l[3],n+=~~l[4],m+=~~l[5]]};break;case"r":g[j]={m:"lineTo",a:[n+=~~l[0],m+=~~l[1]]};break;case"m":g[j]={m:"moveTo",a:[n=~~l[0],m=~~l[1]]};break;case"x":g[j]={m:"closePath"};break;case"e":break generate}h[g[j].m].apply(h,g[j].a)}return g}function c(m,k){for(var j=0,h=m.length;j<h;++j){var g=m[j];k[g.m].apply(k,g.a)}}return function(V,w,P,t,C,W){var k=(w===null);if(k){w=C.getAttribute("alt")}var A=V.viewBox;var m=P.getSize("fontSize",V.baseSize);var B=0,O=0,N=0,u=0;var z=t.textShadow,L=[];if(z){for(var U=z.length;U--;){var F=z[U];var K=m.convertFrom(parseFloat(F.offX));var I=m.convertFrom(parseFloat(F.offY));L[U]=[K,I];if(I<B){B=I}if(K>O){O=K}if(I>N){N=I}if(K<u){u=K}}}var Z=Cufon.CSS.textTransform(w,P).split("");var E=V.spacing(Z,~~m.convertFrom(parseFloat(P.get("letterSpacing"))||0),~~m.convertFrom(parseFloat(P.get("wordSpacing"))||0));if(!E.length){return null}var h=E.total;O+=A.width-E[E.length-1];u+=A.minX;var s,n;if(k){s=C;n=C.firstChild}else{s=document.createElement("cufon");s.className="cufon cufon-canvas";s.setAttribute("alt",w);n=document.createElement("canvas");s.appendChild(n);if(t.printable){var S=document.createElement("cufontext");S.appendChild(document.createTextNode(w));s.appendChild(S)}}var aa=s.style;var H=n.style;var j=m.convert(A.height);var Y=Math.ceil(j);var M=Y/j;var G=M*Cufon.CSS.fontStretch(P.get("fontStretch"));var J=h*G;var Q=Math.ceil(m.convert(J+O-u));var o=Math.ceil(m.convert(A.height-B+N));n.width=Q;n.height=o;H.width=Q+"px";H.height=o+"px";B+=A.minY;H.top=Math.round(m.convert(B-V.ascent))+"px";H.left=Math.round(m.convert(u))+"px";var r=Math.max(Math.ceil(m.convert(J)),0)+"px";if(a){aa.width=r;aa.height=m.convert(V.height)+"px"}else{aa.paddingLeft=r;aa.paddingBottom=(m.convert(V.height)-1)+"px"}var X=n.getContext("2d"),D=j/A.height;X.scale(D,D*M);X.translate(-u,-B);X.save();function T(){var x=V.glyphs,ab,l=-1,g=-1,y;X.scale(G,1);while(y=Z[++l]){var ab=x[Z[l]]||V.missingGlyph;if(!ab){continue}if(ab.d){X.beginPath();if(ab.code){c(ab.code,X)}else{ab.code=d("m"+ab.d,X)}X.fill()}X.translate(E[++g],0)}X.restore()}if(z){for(var U=z.length;U--;){var F=z[U];X.save();X.fillStyle=F.color;X.translate.apply(X,L[U]);T()}}var q=t.textGradient;if(q){var v=q.stops,p=X.createLinearGradient(0,A.minY,0,A.maxY);for(var U=0,R=v.length;U<R;++U){p.addColorStop.apply(p,v[U])}X.fillStyle=p}else{X.fillStyle=P.get("color")}T();return s}})());Cufon.registerEngine("vml",(function(){var e=document.namespaces;if(!e){return}e.add("cvml","urn:schemas-microsoft-com:vml");e=null;var b=document.createElement("cvml:shape");b.style.behavior="url(#default#VML)";if(!b.coordsize){return}b=null;var h=(document.documentMode||0)<8;document.write(('<style type="text/css">cufoncanvas{text-indent:0;}@media screen{cvml\\:shape,cvml\\:rect,cvml\\:fill,cvml\\:shadow{behavior:url(#default#VML);display:block;antialias:true;position:absolute;}cufoncanvas{position:absolute;text-align:left;}cufon{display:inline-block;position:relative;vertical-align:'+(h?"middle":"text-bottom")+";}cufon cufontext{position:absolute;left:-10000in;font-size:1px;}a cufon{cursor:pointer}}@media print{cufon cufoncanvas{display:none;}}</style>").replace(/;/g,"!important;"));function c(i,j){return a(i,/(?:em|ex|%)$|^[a-z-]+$/i.test(j)?"1em":j)}function a(l,m){if(m==="0"){return 0}if(/px$/i.test(m)){return parseFloat(m)}var k=l.style.left,j=l.runtimeStyle.left;l.runtimeStyle.left=l.currentStyle.left;l.style.left=m.replace("%","em");var i=l.style.pixelLeft;l.style.left=k;l.runtimeStyle.left=j;return i}function f(l,k,j,n){var i="computed"+n,m=k[i];if(isNaN(m)){m=k.get(n);k[i]=m=(m=="normal")?0:~~j.convertFrom(a(l,m))}return m}var g={};function d(p){var q=p.id;if(!g[q]){var n=p.stops,o=document.createElement("cvml:fill"),i=[];o.type="gradient";o.angle=180;o.focus="0";o.method="sigma";o.color=n[0][1];for(var m=1,l=n.length-1;m<l;++m){i.push(n[m][0]*100+"% "+n[m][1])}o.colors=i.join(",");o.color2=n[l][1];g[q]=o}return g[q]}return function(ac,G,Y,C,K,ad,W){var n=(G===null);if(n){G=K.alt}var I=ac.viewBox;var p=Y.computedFontSize||(Y.computedFontSize=new Cufon.CSS.Size(c(ad,Y.get("fontSize"))+"px",ac.baseSize));var y,q;if(n){y=K;q=K.firstChild}else{y=document.createElement("cufon");y.className="cufon cufon-vml";y.alt=G;q=document.createElement("cufoncanvas");y.appendChild(q);if(C.printable){var Z=document.createElement("cufontext");Z.appendChild(document.createTextNode(G));y.appendChild(Z)}if(!W){y.appendChild(document.createElement("cvml:shape"))}}var ai=y.style;var R=q.style;var l=p.convert(I.height),af=Math.ceil(l);var V=af/l;var P=V*Cufon.CSS.fontStretch(Y.get("fontStretch"));var U=I.minX,T=I.minY;R.height=af;R.top=Math.round(p.convert(T-ac.ascent));R.left=Math.round(p.convert(U));ai.height=p.convert(ac.height)+"px";var F=Y.get("color");var ag=Cufon.CSS.textTransform(G,Y).split("");var L=ac.spacing(ag,f(ad,Y,p,"letterSpacing"),f(ad,Y,p,"wordSpacing"));if(!L.length){return null}var k=L.total;var x=-U+k+(I.width-L[L.length-1]);var ah=p.convert(x*P),X=Math.round(ah);var O=x+","+I.height,m;var J="r"+O+"ns";var u=C.textGradient&&d(C.textGradient);var o=ac.glyphs,S=0;var H=C.textShadow;var ab=-1,aa=0,w;while(w=ag[++ab]){var D=o[ag[ab]]||ac.missingGlyph,v;if(!D){continue}if(n){v=q.childNodes[aa];while(v.firstChild){v.removeChild(v.firstChild)}}else{v=document.createElement("cvml:shape");q.appendChild(v)}v.stroked="f";v.coordsize=O;v.coordorigin=m=(U-S)+","+T;v.path=(D.d?"m"+D.d+"xe":"")+"m"+m+J;v.fillcolor=F;if(u){v.appendChild(u.cloneNode(false))}var ae=v.style;ae.width=X;ae.height=af;if(H){var s=H[0],r=H[1];var B=Cufon.CSS.color(s.color),z;var N=document.createElement("cvml:shadow");N.on="t";N.color=B.color;N.offset=s.offX+","+s.offY;if(r){z=Cufon.CSS.color(r.color);N.type="double";N.color2=z.color;N.offset2=r.offX+","+r.offY}N.opacity=B.opacity||(z&&z.opacity)||1;v.appendChild(N)}S+=L[aa++]}var M=v.nextSibling,t,A;if(C.forceHitArea){if(!M){M=document.createElement("cvml:rect");M.stroked="f";M.className="cufon-vml-cover";t=document.createElement("cvml:fill");t.opacity=0;M.appendChild(t);q.appendChild(M)}A=M.style;A.width=X;A.height=af}else{if(M){q.removeChild(M)}}ai.width=Math.max(Math.ceil(p.convert(k*P)),0);if(h){var Q=Y.computedYAdjust;if(Q===undefined){var E=Y.get("lineHeight");if(E=="normal"){E="1em"}else{if(!isNaN(E)){E+="em"}}Y.computedYAdjust=Q=0.5*(a(ad,E)-parseFloat(ai.height))}if(Q){ai.marginTop=Math.ceil(Q)+"px";ai.marginBottom=Q+"px"}}return y}})());/*!
 * jQuery UI 1.8.1
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
;jQuery.ui || (function($) {

//Helper functions and ui object
$.ui = {
	version: "1.8.1",

	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
	plugin: {
		add: function(module, option, set) {
			var proto = $.ui[module].prototype;
			for(var i in set) {
				proto.plugins[i] = proto.plugins[i] || [];
				proto.plugins[i].push([option, set[i]]);
			}
		},
		call: function(instance, name, args) {
			var set = instance.plugins[name];
			if(!set || !instance.element[0].parentNode) { return; }

			for (var i = 0; i < set.length; i++) {
				if (instance.options[set[i][0]]) {
					set[i][1].apply(instance.element, args);
				}
			}
		}
	},

	contains: function(a, b) {
		return document.compareDocumentPosition
			? a.compareDocumentPosition(b) & 16
			: a !== b && a.contains(b);
	},

	hasScroll: function(el, a) {

		//If overflow is hidden, the element might have extra content, but the user wants to hide it
		if ($(el).css('overflow') == 'hidden') { return false; }

		var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
			has = false;

		if (el[scroll] > 0) { return true; }

		// TODO: determine which cases actually cause this to happen
		// if the element doesn't have the scroll set, see if it's possible to
		// set the scroll
		el[scroll] = 1;
		has = (el[scroll] > 0);
		el[scroll] = 0;
		return has;
	},

	isOverAxis: function(x, reference, size) {
		//Determines when x coordinate is over "b" element axis
		return (x > reference) && (x < (reference + size));
	},

	isOver: function(y, x, top, left, height, width) {
		//Determines when x, y coordinates is over "b" element
		return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
	},

	keyCode: {
		ALT: 18,
		BACKSPACE: 8,
		CAPS_LOCK: 20,
		COMMA: 188,
		CONTROL: 17,
		DELETE: 46,
		DOWN: 40,
		END: 35,
		ENTER: 13,
		ESCAPE: 27,
		HOME: 36,
		INSERT: 45,
		LEFT: 37,
		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
	}
};

//jQuery plugins
$.fn.extend({
	_focus: $.fn.focus,
	focus: function(delay, fn) {
		return typeof delay === 'number'
			? this.each(function() {
				var elem = this;
				setTimeout(function() {
					$(elem).focus();
					(fn && fn.call(elem));
				}, delay);
			})
			: 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 scrollParent;
		if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
			scrollParent = this.parents().filter(function() {
				return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
			}).eq(0);
		} else {
			scrollParent = this.parents().filter(function() {
				return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
			}).eq(0);
		}

		return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
	},

	zIndex: function(zIndex) {
		if (zIndex !== undefined) {
			return this.css('zIndex', zIndex);
		}
		
		if (this.length) {
			var elem = $(this[0]), position, value;
			while (elem.length && elem[0] !== document) {
				// Ignore z-index if position is set to a value where z-index is ignored by the browser
				// This makes behavior of this function consistent across browsers
				// WebKit always returns auto if the element is positioned
				position = elem.css('position');
				if (position == 'absolute' || position == 'relative' || position == 'fixed')
				{
					// IE returns 0 when zIndex is not specified
					// other browsers return a string
					// we ignore the case of nested elements with an explicit value of 0
					// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
					value = parseInt(elem.css('zIndex'));
					if (!isNaN(value) && value != 0) {
						return value;
					}
				}
				elem = elem.parent();
			}
		}

		return 0;
	}
});


//Additional selectors
$.extend($.expr[':'], {
	data: function(elem, i, match) {
		return !!$.data(elem, match[3]);
	},

	focusable: function(element) {
		var nodeName = element.nodeName.toLowerCase(),
			tabIndex = $.attr(element, 'tabindex');
		return (/input|select|textarea|button|object/.test(nodeName)
			? !element.disabled
			: 'a' == nodeName || 'area' == nodeName
				? element.href || !isNaN(tabIndex)
				: !isNaN(tabIndex))
			// the element and all of its ancestors must be visible
			// the browser may report that the area is hidden
			&& !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
	},

	tabbable: function(element) {
		var tabIndex = $.attr(element, 'tabindex');
		return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
	}
});

})(jQuery);
/*!
 * jQuery UI Widget 1.8.1
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Widget
 */
(function( $ ) {

var _remove = $.fn.remove;

$.fn.remove = function( selector, keepData ) {
	return this.each(function() {
		if ( !keepData ) {
			if ( !selector || $.filter( selector, [ this ] ).length ) {
				$( "*", this ).add( this ).each(function() {
					$( this ).triggerHandler( "remove" );
				});
			}
		}
		return _remove.call( $(this), selector, keepData );
	});
};

$.widget = function( name, base, prototype ) {
	var namespace = name.split( "." )[ 0 ],
		fullName;
	name = name.split( "." )[ 1 ];
	fullName = namespace + "-" + name;

	if ( !prototype ) {
		prototype = base;
		base = $.Widget;
	}

	// create selector for plugin
	$.expr[ ":" ][ fullName ] = function( elem ) {
		return !!$.data( elem, name );
	};

	$[ namespace ] = $[ namespace ] || {};
	$[ namespace ][ name ] = function( options, element ) {
		// allow instantiation without initializing for simple inheritance
		if ( arguments.length ) {
			this._createWidget( options, element );
		}
	};

	var basePrototype = new base();
	// we need to make the options hash a property directly on the new instance
	// otherwise we'll modify the options hash on the prototype that we're
	// inheriting from
//	$.each( basePrototype, function( key, val ) {
//		if ( $.isPlainObject(val) ) {
//			basePrototype[ key ] = $.extend( {}, val );
//		}
//	});
	basePrototype.options = $.extend( {}, basePrototype.options );
	$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
		namespace: namespace,
		widgetName: name,
		widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
		widgetBaseClass: fullName
	}, prototype );

	$.widget.bridge( name, $[ namespace ][ name ] );
};

$.widget.bridge = function( name, object ) {
	$.fn[ name ] = function( options ) {
		var isMethodCall = typeof options === "string",
			args = Array.prototype.slice.call( arguments, 1 ),
			returnValue = this;

		// allow multiple hashes to be passed on init
		options = !isMethodCall && args.length ?
			$.extend.apply( null, [ true, options ].concat(args) ) :
			options;

		// prevent calls to internal methods
		if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
			return returnValue;
		}

		if ( isMethodCall ) {
			this.each(function() {
				var instance = $.data( this, name ),
					methodValue = instance && $.isFunction( instance[options] ) ?
						instance[ options ].apply( instance, args ) :
						instance;
				if ( methodValue !== instance && methodValue !== undefined ) {
					returnValue = methodValue;
					return false;
				}
			});
		} else {
			this.each(function() {
				var instance = $.data( this, name );
				if ( instance ) {
					if ( options ) {
						instance.option( options );
					}
					instance._init();
				} else {
					$.data( this, name, new object( options, this ) );
				}
			});
		}

		return returnValue;
	};
};

$.Widget = function( options, element ) {
	// allow instantiation without initializing for simple inheritance
	if ( arguments.length ) {
		this._createWidget( options, element );
	}
};

$.Widget.prototype = {
	widgetName: "widget",
	widgetEventPrefix: "",
	options: {
		disabled: false
	},
	_createWidget: function( options, element ) {
		// $.widget.bridge stores the plugin instance, but we do it anyway
		// so that it's stored even before the _create function runs
		this.element = $( element ).data( this.widgetName, this );
		this.options = $.extend( true, {},
			this.options,
			$.metadata && $.metadata.get( element )[ this.widgetName ],
			options );

		var self = this;
		this.element.bind( "remove." + this.widgetName, function() {
			self.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( key, value ) {
		var options = key,
			self = this;

		if ( arguments.length === 0 ) {
			// don't return a reference to the internal hash
			return $.extend( {}, self.options );
		}

		if  (typeof key === "string" ) {
			if ( value === undefined ) {
				return this.options[ key ];
			}
			options = {};
			options[ key ] = value;
		}

		$.each( options, function( key, value ) {
			self._setOption( key, value );
		});

		return self;
	},
	_setOption: function( key, value ) {
		this.options[ key ] = value;

		if ( key === "disabled" ) {
			this.widget()
				[ value ? "addClass" : "removeClass"](
					this.widgetBaseClass + "-disabled" + " " +
					"ui-state-disabled" )
				.attr( "aria-disabled", value );
		}

		return this;
	},

	enable: function() {
		return this._setOption( "disabled", false );
	},
	disable: function() {
		return this._setOption( "disabled", true );
	},

	_trigger: function( type, event, data ) {
		var callback = this.options[ type ];

		event = $.Event( event );
		event.type = ( type === this.widgetEventPrefix ?
			type :
			this.widgetEventPrefix + type ).toLowerCase();
		data = data || {};

		// copy original event properties over to the new event
		// this would happen if we could call $.event.fix instead of $.Event
		// but we don't have a way to force an event to be fixed multiple times
		if ( event.originalEvent ) {
			for ( var i = $.event.props.length, prop; i; ) {
				prop = $.event.props[ --i ];
				event[ prop ] = event.originalEvent[ prop ];
			}
		}

		this.element.trigger( event, data );

		return !( $.isFunction(callback) &&
			callback.call( this.element[0], event, data ) === false ||
			event.isDefaultPrevented() );
	}
};

})( jQuery );
/*!
 * jQuery UI Mouse 1.8.1
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
(function($) {

$.widget("ui.mouse", {
	options: {
		cancel: ':input,option',
		distance: 1,
		delay: 0
	},
	_mouseInit: function() {
		var self = this;

		this.element
			.bind('mousedown.'+this.widgetName, function(event) {
				return self._mouseDown(event);
			})
			.bind('click.'+this.widgetName, function(event) {
				if(self._preventClickEvent) {
					self._preventClickEvent = false;
					event.stopImmediatePropagation();
					return false;
				}
			});

		this.started = false;
	},

	// TODO: make sure destroying one instance of mouse doesn't mess with
	// other instances of mouse
	_mouseDestroy: function() {
		this.element.unbind('.'+this.widgetName);
	},

	_mouseDown: function(event) {
		// don't let more than one widget handle mouseStart
		// TODO: figure out why we have to use originalEvent
		event.originalEvent = event.originalEvent || {};
		if (event.originalEvent.mouseHandled) { return; }

		// we may have missed mouseup (out of window)
		(this._mouseStarted && this._mouseUp(event));

		this._mouseDownEvent = event;

		var self = this,
			btnIsLeft = (event.which == 1),
			elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
		if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
			return true;
		}

		this.mouseDelayMet = !this.options.delay;
		if (!this.mouseDelayMet) {
			this._mouseDelayTimer = setTimeout(function() {
				self.mouseDelayMet = true;
			}, this.options.delay);
		}

		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
			this._mouseStarted = (this._mouseStart(event) !== false);
			if (!this._mouseStarted) {
				event.preventDefault();
				return true;
			}
		}

		// these delegates are required to keep context
		this._mouseMoveDelegate = function(event) {
			return self._mouseMove(event);
		};
		this._mouseUpDelegate = function(event) {
			return self._mouseUp(event);
		};
		$(document)
			.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);

		// preventDefault() is used to prevent the selection of text here -
		// however, in Safari, this causes select boxes not to be selectable
		// anymore, so this fix is needed
		($.browser.safari || event.preventDefault());

		event.originalEvent.mouseHandled = true;
		return true;
	},

	_mouseMove: function(event) {
		// IE mouseup check - mouseup happened when mouse was out of window
		if ($.browser.msie && !event.button) {
			return this._mouseUp(event);
		}

		if (this._mouseStarted) {
			this._mouseDrag(event);
			return event.preventDefault();
		}

		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
			this._mouseStarted =
				(this._mouseStart(this._mouseDownEvent, event) !== false);
			(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
		}

		return !this._mouseStarted;
	},

	_mouseUp: function(event) {
		$(document)
			.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);

		if (this._mouseStarted) {
			this._mouseStarted = false;
			this._preventClickEvent = (event.target == this._mouseDownEvent.target);
			this._mouseStop(event);
		}

		return false;
	},

	_mouseDistanceMet: function(event) {
		return (Math.max(
				Math.abs(this._mouseDownEvent.pageX - event.pageX),
				Math.abs(this._mouseDownEvent.pageY - event.pageY)
			) >= this.options.distance
		);
	},

	_mouseDelayMet: function(event) {
		return this.mouseDelayMet;
	},

	// These are placeholder methods, to be overriden by extending plugin
	_mouseStart: function(event) {},
	_mouseDrag: function(event) {},
	_mouseStop: function(event) {},
	_mouseCapture: function(event) { return true; }
});

})(jQuery);
/*
 * jQuery UI Draggable 1.8.1
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Draggables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function($) {

$.widget("ui.draggable", $.ui.mouse, {
	widgetEventPrefix: "drag",
	options: {
		addClasses: true,
		appendTo: "parent",
		axis: false,
		connectToSortable: false,
		containment: false,
		cursor: "auto",
		cursorAt: false,
		grid: false,
		handle: false,
		helper: "original",
		iframeFix: false,
		opacity: false,
		refreshPositions: false,
		revert: false,
		revertDuration: 500,
		scope: "default",
		scroll: true,
		scrollSensitivity: 20,
		scrollSpeed: 20,
		snap: false,
		snapMode: "both",
		snapTolerance: 20,
		stack: false,
		zIndex: false
	},
	_create: function() {

		if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
			this.element[0].style.position = 'relative';

		(this.options.addClasses && this.element.addClass("ui-draggable"));
		(this.options.disabled && this.element.addClass("ui-draggable-disabled"));

		this._mouseInit();

	},

	destroy: function() {
		if(!this.element.data('draggable')) return;
		this.element
			.removeData("draggable")
			.unbind(".draggable")
			.removeClass("ui-draggable"
				+ " ui-draggable-dragging"
				+ " ui-draggable-disabled");
		this._mouseDestroy();

		return this;
	},

	_mouseCapture: function(event) {

		var o = this.options;

		// among others, prevent a drag on a resizable-handle
		if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
			return false;

		//Quit if we're not on a valid handle
		this.handle = this._getHandle(event);
		if (!this.handle)
			return false;

		return true;

	},

	_mouseStart: function(event) {

		var o = this.options;

		//Create and append the visible helper
		this.helper = this._createHelper(event);

		//Cache the helper size
		this._cacheHelperProportions();

		//If ddmanager is used for droppables, set the global draggable
		if($.ui.ddmanager)
			$.ui.ddmanager.current = this;

		/*
		 * - Position generation -
		 * This block generates everything position related - it's the core of draggables.
		 */

		//Cache the margins of the original element
		this._cacheMargins();

		//Store the helper's css position
		this.cssPosition = this.helper.css("position");
		this.scrollParent = this.helper.scrollParent();

		//The element's absolute position on the page minus margins
		this.offset = this.positionAbs = this.element.offset();
		this.offset = {
			top: this.offset.top - this.margins.top,
			left: this.offset.left - this.margins.left
		};

		$.extend(this.offset, {
			click: { //Where the click happened, relative to the element
				left: event.pageX - this.offset.left,
				top: event.pageY - this.offset.top
			},
			parent: this._getParentOffset(),
			relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
		});

		//Generate the original position
		this.originalPosition = this.position = this._generatePosition(event);
		this.originalPageX = event.pageX;
		this.originalPageY = event.pageY;

		//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
		(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));

		//Set a containment if given in the options
		if(o.containment)
			this._setContainment();

		//Trigger event + callbacks
		if(this._trigger("start", event) === false) {
			this._clear();
			return false;
		}

		//Recache the helper size
		this._cacheHelperProportions();

		//Prepare the droppable offsets
		if ($.ui.ddmanager && !o.dropBehaviour)
			$.ui.ddmanager.prepareOffsets(this, event);

		this.helper.addClass("ui-draggable-dragging");
		this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
		return true;
	},

	_mouseDrag: function(event, noPropagation) {

		//Compute the helpers position
		this.position = this._generatePosition(event);
		this.positionAbs = this._convertPositionTo("absolute");

		//Call plugins and callbacks and use the resulting position if something is returned
		if (!noPropagation) {
			var ui = this._uiHash();
			if(this._trigger('drag', event, ui) === false) {
				this._mouseUp({});
				return false;
			}
			this.position = ui.position;
		}

		if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
		if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
		if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);

		return false;
	},

	_mouseStop: function(event) {

		//If we are using droppables, inform the manager about the drop
		var dropped = false;
		if ($.ui.ddmanager && !this.options.dropBehaviour)
			dropped = $.ui.ddmanager.drop(this, event);

		//if a drop comes from outside (a sortable)
		if(this.dropped) {
			dropped = this.dropped;
			this.dropped = false;
		}
		
		//if the original element is removed, don't bother to continue
		if(!this.element[0] || !this.element[0].parentNode)
			return false;

		if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
			var self = this;
			$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
				if(self._trigger("stop", event) !== false) {
					self._clear();
				}
			});
		} else {
			if(this._trigger("stop", event) !== false) {
				this._clear();
			}
		}

		return false;
	},
	
	cancel: function() {
		
		if(this.helper.is(".ui-draggable-dragging")) {
			this._mouseUp({});
		} else {
			this._clear();
		}
		
		return this;
		
	},

	_getHandle: function(event) {

		var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
		$(this.options.handle, this.element)
			.find("*")
			.andSelf()
			.each(function() {
				if(this == event.target) handle = true;
			});

		return handle;

	},

	_createHelper: function(event) {

		var o = this.options;
		var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element);

		if(!helper.parents('body').length)
			helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));

		if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
			helper.css("position", "absolute");

		return helper;

	},

	_adjustOffsetFromHelper: function(obj) {
		if (typeof obj == 'string') {
			obj = obj.split(' ');
		}
		if ($.isArray(obj)) {
			obj = {left: +obj[0], top: +obj[1] || 0};
		}
		if ('left' in obj) {
			this.offset.click.left = obj.left + this.margins.left;
		}
		if ('right' in obj) {
			this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
		}
		if ('top' in obj) {
			this.offset.click.top = obj.top + this.margins.top;
		}
		if ('bottom' in obj) {
			this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
		}
	},

	_getParentOffset: function() {

		//Get the offsetParent and cache its position
		this.offsetParent = this.helper.offsetParent();
		var po = this.offsetParent.offset();

		// This is a special case where we need to modify a offset calculated on start, since the following happened:
		// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
		// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
		//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
		if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
			po.left += this.scrollParent.scrollLeft();
			po.top += this.scrollParent.scrollTop();
		}

		if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
		|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
			po = { top: 0, left: 0 };

		return {
			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
		};

	},

	_getRelativeOffset: function() {

		if(this.cssPosition == "relative") {
			var p = this.element.position();
			return {
				top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
				left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
			};
		} else {
			return { top: 0, left: 0 };
		}

	},

	_cacheMargins: function() {
		this.margins = {
			left: (parseInt(this.element.css("marginLeft"),10) || 0),
			top: (parseInt(this.element.css("marginTop"),10) || 0)
		};
	},

	_cacheHelperProportions: function() {
		this.helperProportions = {
			width: this.helper.outerWidth(),
			height: this.helper.outerHeight()
		};
	},

	_setContainment: function() {

		var o = this.options;
		if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
		if(o.containment == 'document' || o.containment == 'window') this.containment = [
			0 - this.offset.relative.left - this.offset.parent.left,
			0 - this.offset.relative.top - this.offset.parent.top,
			$(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
			($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
		];

		if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
			var ce = $(o.containment)[0]; if(!ce) return;
			var co = $(o.containment).offset();
			var over = ($(ce).css("overflow") != 'hidden');

			this.containment = [
				co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
				co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
				co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
				co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
			];
		} else if(o.containment.constructor == Array) {
			this.containment = o.containment;
		}

	},

	_convertPositionTo: function(d, pos) {

		if(!pos) pos = this.position;
		var mod = d == "absolute" ? 1 : -1;
		var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);

		return {
			top: (
				pos.top																	// The absolute mouse position
				+ this.offset.relative.top * mod										// Only for relative positioned nodes: Relative offset from element to offset parent
				+ this.offset.parent.top * mod											// The offsetParent's offset without borders (offset + border)
				- ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
			),
			left: (
				pos.left																// The absolute mouse position
				+ this.offset.relative.left * mod										// Only for relative positioned nodes: Relative offset from element to offset parent
				+ this.offset.parent.left * mod											// The offsetParent's offset without borders (offset + border)
				- ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
			)
		};

	},

	_generatePosition: function(event) {

		var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
		var pageX = event.pageX;
		var pageY = event.pageY;

		/*
		 * - Position constraining -
		 * Constrain the position to a mix of grid, containment.
		 */

		if(this.originalPosition) { //If we are not dragging yet, we won't check for options

			if(this.containment) {
				if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
				if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
				if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
				if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
			}

			if(o.grid) {
				var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
				pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;

				var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
				pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
			}

		}

		return {
			top: (
				pageY																// The absolute mouse position
				- this.offset.click.top													// Click offset (relative to the element)
				- this.offset.relative.top												// Only for relative positioned nodes: Relative offset from element to offset parent
				- this.offset.parent.top												// The offsetParent's offset without borders (offset + border)
				+ ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
			),
			left: (
				pageX																// The absolute mouse position
				- this.offset.click.left												// Click offset (relative to the element)
				- this.offset.relative.left												// Only for relative positioned nodes: Relative offset from element to offset parent
				- this.offset.parent.left												// The offsetParent's offset without borders (offset + border)
				+ ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
			)
		};

	},

	_clear: function() {
		this.helper.removeClass("ui-draggable-dragging");
		if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
		//if($.ui.ddmanager) $.ui.ddmanager.current = null;
		this.helper = null;
		this.cancelHelperRemoval = false;
	},

	// From now on bulk stuff - mainly helpers

	_trigger: function(type, event, ui) {
		ui = ui || this._uiHash();
		$.ui.plugin.call(this, type, [event, ui]);
		if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
		return $.Widget.prototype._trigger.call(this, type, event, ui);
	},

	plugins: {},

	_uiHash: function(event) {
		return {
			helper: this.helper,
			position: this.position,
			originalPosition: this.originalPosition,
			offset: this.positionAbs
		};
	}

});

$.extend($.ui.draggable, {
	version: "1.8.1"
});

$.ui.plugin.add("draggable", "connectToSortable", {
	start: function(event, ui) {

		var inst = $(this).data("draggable"), o = inst.options,
			uiSortable = $.extend({}, ui, { item: inst.element });
		inst.sortables = [];
		$(o.connectToSortable).each(function() {
			var sortable = $.data(this, 'sortable');
			if (sortable && !sortable.options.disabled) {
				inst.sortables.push({
					instance: sortable,
					shouldRevert: sortable.options.revert
				});
				sortable._refreshItems();	//Do a one-time refresh at start to refresh the containerCache
				sortable._trigger("activate", event, uiSortable);
			}
		});

	},
	stop: function(event, ui) {

		//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
		var inst = $(this).data("draggable"),
			uiSortable = $.extend({}, ui, { item: inst.element });

		$.each(inst.sortables, function() {
			if(this.instance.isOver) {

				this.instance.isOver = 0;

				inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
				this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)

				//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
				if(this.shouldRevert) this.instance.options.revert = true;

				//Trigger the stop of the sortable
				this.instance._mouseStop(event);

				this.instance.options.helper = this.instance.options._helper;

				//If the helper has been the original item, restore properties in the sortable
				if(inst.options.helper == 'original')
					this.instance.currentItem.css({ top: 'auto', left: 'auto' });

			} else {
				this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
				this.instance._trigger("deactivate", event, uiSortable);
			}

		});

	},
	drag: function(event, ui) {

		var inst = $(this).data("draggable"), self = this;

		var checkPos = function(o) {
			var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
			var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
			var itemHeight = o.height, itemWidth = o.width;
			var itemTop = o.top, itemLeft = o.left;

			return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
		};

		$.each(inst.sortables, function(i) {
			
			//Copy over some variables to allow calling the sortable's native _intersectsWith
			this.instance.positionAbs = inst.positionAbs;
			this.instance.helperProportions = inst.helperProportions;
			this.instance.offset.click = inst.offset.click;
			
			if(this.instance._intersectsWith(this.instance.containerCache)) {

				//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
				if(!this.instance.isOver) {

					this.instance.isOver = 1;
					//Now we fake the start of dragging for the sortable instance,
					//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
					//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
					this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
					this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
					this.instance.options.helper = function() { return ui.helper[0]; };

					event.target = this.instance.currentItem[0];
					this.instance._mouseCapture(event, true);
					this.instance._mouseStart(event, true, true);

					//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
					this.instance.offset.click.top = inst.offset.click.top;
					this.instance.offset.click.left = inst.offset.click.left;
					this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
					this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;

					inst._trigger("toSortable", event);
					inst.dropped = this.instance.element; //draggable revert needs that
					//hack so receive/update callbacks work (mostly)
					inst.currentItem = inst.element;
					this.instance.fromOutside = inst;

				}

				//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
				if(this.instance.currentItem) this.instance._mouseDrag(event);

			} else {

				//If it doesn't intersect with the sortable, and it intersected before,
				//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
				if(this.instance.isOver) {

					this.instance.isOver = 0;
					this.instance.cancelHelperRemoval = true;
					
					//Prevent reverting on this forced stop
					this.instance.options.revert = false;
					
					// The out event needs to be triggered independently
					this.instance._trigger('out', event, this.instance._uiHash(this.instance));
					
					this.instance._mouseStop(event, true);
					this.instance.options.helper = this.instance.options._helper;

					//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
					this.instance.currentItem.remove();
					if(this.instance.placeholder) this.instance.placeholder.remove();

					inst._trigger("fromSortable", event);
					inst.dropped = false; //draggable revert needs that
				}

			};

		});

	}
});

$.ui.plugin.add("draggable", "cursor", {
	start: function(event, ui) {
		var t = $('body'), o = $(this).data('draggable').options;
		if (t.css("cursor")) o._cursor = t.css("cursor");
		t.css("cursor", o.cursor);
	},
	stop: function(event, ui) {
		var o = $(this).data('draggable').options;
		if (o._cursor) $('body').css("cursor", o._cursor);
	}
});

$.ui.plugin.add("draggable", "iframeFix", {
	start: function(event, ui) {
		var o = $(this).data('draggable').options;
		$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
			$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
			.css({
				width: this.offsetWidth+"px", height: this.offsetHeight+"px",
				position: "absolute", opacity: "0.001", zIndex: 1000
			})
			.css($(this).offset())
			.appendTo("body");
		});
	},
	stop: function(event, ui) {
		$("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
	}
});

$.ui.plugin.add("draggable", "opacity", {
	start: function(event, ui) {
		var t = $(ui.helper), o = $(this).data('draggable').options;
		if(t.css("opacity")) o._opacity = t.css("opacity");
		t.css('opacity', o.opacity);
	},
	stop: function(event, ui) {
		var o = $(this).data('draggable').options;
		if(o._opacity) $(ui.helper).css('opacity', o._opacity);
	}
});

$.ui.plugin.add("draggable", "scroll", {
	start: function(event, ui) {
		var i = $(this).data("draggable");
		if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
	},
	drag: function(event, ui) {

		var i = $(this).data("draggable"), o = i.options, scrolled = false;

		if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {

			if(!o.axis || o.axis != 'x') {
				if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
					i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
				else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
					i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
			}

			if(!o.axis || o.axis != 'y') {
				if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
					i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
				else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
					i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
			}

		} else {

			if(!o.axis || o.axis != 'x') {
				if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
					scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
				else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
					scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
			}

			if(!o.axis || o.axis != 'y') {
				if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
					scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
				else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
					scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
			}

		}

		if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
			$.ui.ddmanager.prepareOffsets(i, event);

	}
});

$.ui.plugin.add("draggable", "snap", {
	start: function(event, ui) {

		var i = $(this).data("draggable"), o = i.options;
		i.snapElements = [];

		$(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
			var $t = $(this); var $o = $t.offset();
			if(this != i.element[0]) i.snapElements.push({
				item: this,
				width: $t.outerWidth(), height: $t.outerHeight(),
				top: $o.top, left: $o.left
			});
		});

	},
	drag: function(event, ui) {

		var inst = $(this).data("draggable"), o = inst.options;
		var d = o.snapTolerance;

		var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
			y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;

		for (var i = inst.snapElements.length - 1; i >= 0; i--){

			var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
				t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;

			//Yes, I know, this is insane ;)
			if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
				if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
				inst.snapElements[i].snapping = false;
				continue;
			}

			if(o.snapMode != 'inner') {
				var ts = Math.abs(t - y2) <= d;
				var bs = Math.abs(b - y1) <= d;
				var ls = Math.abs(l - x2) <= d;
				var rs = Math.abs(r - x1) <= d;
				if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
				if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
				if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
				if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
			}

			var first = (ts || bs || ls || rs);

			if(o.snapMode != 'outer') {
				var ts = Math.abs(t - y1) <= d;
				var bs = Math.abs(b - y2) <= d;
				var ls = Math.abs(l - x1) <= d;
				var rs = Math.abs(r - x2) <= d;
				if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
				if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
				if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
				if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
			}

			if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
				(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
			inst.snapElements[i].snapping = (ts || bs || ls || rs || first);

		};

	}
});

$.ui.plugin.add("draggable", "stack", {
	start: function(event, ui) {

		var o = $(this).data("draggable").options;

		var group = $.makeArray($(o.stack)).sort(function(a,b) {
			return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
		});
		if (!group.length) { return; }
		
		var min = parseInt(group[0].style.zIndex) || 0;
		$(group).each(function(i) {
			this.style.zIndex = min + i;
		});

		this[0].style.zIndex = min + group.length;

	}
});

$.ui.plugin.add("draggable", "zIndex", {
	start: function(event, ui) {
		var t = $(ui.helper), o = $(this).data("draggable").options;
		if(t.css("zIndex")) o._zIndex = t.css("zIndex");
		t.css('zIndex', o.zIndex);
	},
	stop: function(event, ui) {
		var o = $(this).data("draggable").options;
		if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
	}
});

})(jQuery);
/*
 * jQuery UI Droppable 1.8.1
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Droppables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	jquery.ui.mouse.js
 *	jquery.ui.draggable.js
 */
(function($) {

$.widget("ui.droppable", {
	widgetEventPrefix: "drop",
	options: {
		accept: '*',
		activeClass: false,
		addClasses: true,
		greedy: false,
		hoverClass: false,
		scope: 'default',
		tolerance: 'intersect'
	},
	_create: function() {

		var o = this.options, accept = o.accept;
		this.isover = 0; this.isout = 1;

		this.accept = $.isFunction(accept) ? accept : function(d) {
			return d.is(accept);
		};

		//Store the droppable's proportions
		this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };

		// Add the reference and positions to the manager
		$.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
		$.ui.ddmanager.droppables[o.scope].push(this);

		(o.addClasses && this.element.addClass("ui-droppable"));

	},

	destroy: function() {
		var drop = $.ui.ddmanager.droppables[this.options.scope];
		for ( var i = 0; i < drop.length; i++ )
			if ( drop[i] == this )
				drop.splice(i, 1);

		this.element
			.removeClass("ui-droppable ui-droppable-disabled")
			.removeData("droppable")
			.unbind(".droppable");

		return this;
	},

	_setOption: function(key, value) {

		if(key == 'accept') {
			this.accept = $.isFunction(value) ? value : function(d) {
				return d.is(value);
			};
		}
		$.Widget.prototype._setOption.apply(this, arguments);
	},

	_activate: function(event) {
		var draggable = $.ui.ddmanager.current;
		if(this.options.activeClass) this.element.addClass(this.options.activeClass);
		(draggable && this._trigger('activate', event, this.ui(draggable)));
	},

	_deactivate: function(event) {
		var draggable = $.ui.ddmanager.current;
		if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
		(draggable && this._trigger('deactivate', event, this.ui(draggable)));
	},

	_over: function(event) {

		var draggable = $.ui.ddmanager.current;
		if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element

		if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
			if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
			this._trigger('over', event, this.ui(draggable));
		}

	},

	_out: function(event) {

		var draggable = $.ui.ddmanager.current;
		if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element

		if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
			if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
			this._trigger('out', event, this.ui(draggable));
		}

	},

	_drop: function(event,custom) {

		var draggable = custom || $.ui.ddmanager.current;
		if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element

		var childrenIntersection = false;
		this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
			var inst = $.data(this, 'droppable');
			if(
				inst.options.greedy
				&& !inst.options.disabled
				&& inst.options.scope == draggable.options.scope
				&& inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
				&& $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
			) { childrenIntersection = true; return false; }
		});
		if(childrenIntersection) return false;

		if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
			if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
			if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
			this._trigger('drop', event, this.ui(draggable));
			return this.element;
		}

		return false;

	},

	ui: function(c) {
		return {
			draggable: (c.currentItem || c.element),
			helper: c.helper,
			position: c.position,
			offset: c.positionAbs
		};
	}

});

$.extend($.ui.droppable, {
	version: "1.8.1"
});

$.ui.intersect = function(draggable, droppable, toleranceMode) {

	if (!droppable.offset) return false;

	var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
		y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
	var l = droppable.offset.left, r = l + droppable.proportions.width,
		t = droppable.offset.top, b = t + droppable.proportions.height;

	switch (toleranceMode) {
		case 'fit':
			return (l < x1 && x2 < r
				&& t < y1 && y2 < b);
			break;
		case 'intersect':
			return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
				&& x2 - (draggable.helperProportions.width / 2) < r // Left Half
				&& t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
				&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
			break;
		case 'pointer':
			var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
				draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
				isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
			return isOver;
			break;
		case 'touch':
			return (
					(y1 >= t && y1 <= b) ||	// Top edge touching
					(y2 >= t && y2 <= b) ||	// Bottom edge touching
					(y1 < t && y2 > b)		// Surrounded vertically
				) && (
					(x1 >= l && x1 <= r) ||	// Left edge touching
					(x2 >= l && x2 <= r) ||	// Right edge touching
					(x1 < l && x2 > r)		// Surrounded horizontally
				);
			break;
		default:
			return false;
			break;
		}

};

/*
	This manager tracks offsets of draggables and droppables
*/
$.ui.ddmanager = {
	current: null,
	droppables: { 'default': [] },
	prepareOffsets: function(t, event) {

		var m = $.ui.ddmanager.droppables[t.options.scope] || [];
		var type = event ? event.type : null; // workaround for #2317
		var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();

		droppablesLoop: for (var i = 0; i < m.length; i++) {

			if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue;	//No disabled and non-accepted
			for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
			m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; 									//If the element is not visible, continue

			m[i].offset = m[i].element.offset();
			m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };

			if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables

		}

	},
	drop: function(draggable, event) {

		var dropped = false;
		$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {

			if(!this.options) return;
			if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
				dropped = dropped || this._drop.call(this, event);

			if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
				this.isout = 1; this.isover = 0;
				this._deactivate.call(this, event);
			}

		});
		return dropped;

	},
	drag: function(draggable, event) {

		//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
		if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);

		//Run through all droppables and check their positions based on specific tolerance options
		$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {

			if(this.options.disabled || this.greedyChild || !this.visible) return;
			var intersects = $.ui.intersect(draggable, this, this.options.tolerance);

			var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
			if(!c) return;

			var parentInstance;
			if (this.options.greedy) {
				var parent = this.element.parents(':data(droppable):eq(0)');
				if (parent.length) {
					parentInstance = $.data(parent[0], 'droppable');
					parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
				}
			}

			// we just moved into a greedy child
			if (parentInstance && c == 'isover') {
				parentInstance['isover'] = 0;
				parentInstance['isout'] = 1;
				parentInstance._out.call(parentInstance, event);
			}

			this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
			this[c == "isover" ? "_over" : "_out"].call(this, event);

			// we just moved out of a greedy child
			if (parentInstance && c == 'isout') {
				parentInstance['isout'] = 0;
				parentInstance['isover'] = 1;
				parentInstance._over.call(parentInstance, event);
			}
		});

	}
};

})(jQuery);
/*
 * jQuery UI Sortable 1.8.1
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Sortables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function($) {

$.widget("ui.sortable", $.ui.mouse, {
	widgetEventPrefix: "sort",
	options: {
		appendTo: "parent",
		axis: false,
		connectWith: false,
		containment: false,
		cursor: 'auto',
		cursorAt: false,
		dropOnEmpty: true,
		forcePlaceholderSize: false,
		forceHelperSize: false,
		grid: false,
		handle: false,
		helper: "original",
		items: '> *',
		opacity: false,
		placeholder: false,
		revert: false,
		scroll: true,
		scrollSensitivity: 20,
		scrollSpeed: 20,
		scope: "default",
		tolerance: "intersect",
		zIndex: 1000
	},
	_create: function() {

		var o = this.options;
		this.containerCache = {};
		this.element.addClass("ui-sortable");

		//Get the items
		this.refresh();

		//Let's determine if the items are floating
		this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;

		//Let's determine the parent's offset
		this.offset = this.element.offset();

		//Initialize mouse events for interaction
		this._mouseInit();

	},

	destroy: function() {
		this.element
			.removeClass("ui-sortable ui-sortable-disabled")
			.removeData("sortable")
			.unbind(".sortable");
		this._mouseDestroy();

		for ( var i = this.items.length - 1; i >= 0; i-- )
			this.items[i].item.removeData("sortable-item");

		return this;
	},

	_setOption: function(key, value){
		if ( key === "disabled" ) {
			this.options[ key ] = value;
	
			this.widget()
				[ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
		} else {
			// Don't call widget base _setOption for disable as it adds ui-state-disabled class
			$.Widget.prototype._setOption.apply(self, arguments);
		}
	},

	_mouseCapture: function(event, overrideHandle) {

		if (this.reverting) {
			return false;
		}

		if(this.options.disabled || this.options.type == 'static') return false;

		//We have to refresh the items data once first
		this._refreshItems(event);

		//Find out if the clicked node (or one of its parents) is a actual item in this.items
		var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
			if($.data(this, 'sortable-item') == self) {
				currentItem = $(this);
				return false;
			}
		});
		if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target);

		if(!currentItem) return false;
		if(this.options.handle && !overrideHandle) {
			var validHandle = false;

			$(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
			if(!validHandle) return false;
		}

		this.currentItem = currentItem;
		this._removeCurrentsFromItems();
		return true;

	},

	_mouseStart: function(event, overrideHandle, noActivation) {

		var o = this.options, self = this;
		this.currentContainer = this;

		//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
		this.refreshPositions();

		//Create and append the visible helper
		this.helper = this._createHelper(event);

		//Cache the helper size
		this._cacheHelperProportions();

		/*
		 * - Position generation -
		 * This block generates everything position related - it's the core of draggables.
		 */

		//Cache the margins of the original element
		this._cacheMargins();

		//Get the next scrolling parent
		this.scrollParent = this.helper.scrollParent();

		//The element's absolute position on the page minus margins
		this.offset = this.currentItem.offset();
		this.offset = {
			top: this.offset.top - this.margins.top,
			left: this.offset.left - this.margins.left
		};

		// Only after we got the offset, we can change the helper's position to absolute
		// TODO: Still need to figure out a way to make relative sorting possible
		this.helper.css("position", "absolute");
		this.cssPosition = this.helper.css("position");

		$.extend(this.offset, {
			click: { //Where the click happened, relative to the element
				left: event.pageX - this.offset.left,
				top: event.pageY - this.offset.top
			},
			parent: this._getParentOffset(),
			relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
		});

		//Generate the original position
		this.originalPosition = this._generatePosition(event);
		this.originalPageX = event.pageX;
		this.originalPageY = event.pageY;

		//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
		(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));

		//Cache the former DOM position
		this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };

		//If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
		if(this.helper[0] != this.currentItem[0]) {
			this.currentItem.hide();
		}

		//Create the placeholder
		this._createPlaceholder();

		//Set a containment if given in the options
		if(o.containment)
			this._setContainment();

		if(o.cursor) { // cursor option
			if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
			$('body').css("cursor", o.cursor);
		}

		if(o.opacity) { // opacity option
			if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
			this.helper.css("opacity", o.opacity);
		}

		if(o.zIndex) { // zIndex option
			if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
			this.helper.css("zIndex", o.zIndex);
		}

		//Prepare scrolling
		if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
			this.overflowOffset = this.scrollParent.offset();

		//Call callbacks
		this._trigger("start", event, this._uiHash());

		//Recache the helper size
		if(!this._preserveHelperProportions)
			this._cacheHelperProportions();


		//Post 'activate' events to possible containers
		if(!noActivation) {
			 for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); }
		}

		//Prepare possible droppables
		if($.ui.ddmanager)
			$.ui.ddmanager.current = this;

		if ($.ui.ddmanager && !o.dropBehaviour)
			$.ui.ddmanager.prepareOffsets(this, event);

		this.dragging = true;

		this.helper.addClass("ui-sortable-helper");
		this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
		return true;

	},

	_mouseDrag: function(event) {

		//Compute the helpers position
		this.position = this._generatePosition(event);
		this.positionAbs = this._convertPositionTo("absolute");

		if (!this.lastPositionAbs) {
			this.lastPositionAbs = this.positionAbs;
		}

		//Do scrolling
		if(this.options.scroll) {
			var o = this.options, scrolled = false;
			if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {

				if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
					this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
				else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
					this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;

				if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
					this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
				else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
					this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;

			} else {

				if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
					scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
				else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
					scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);

				if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
					scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
				else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
					scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);

			}

			if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
				$.ui.ddmanager.prepareOffsets(this, event);
		}

		//Regenerate the absolute position used for position checks
		this.positionAbs = this._convertPositionTo("absolute");

		//Set the helper position
		if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
		if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';

		//Rearrange
		for (var i = this.items.length - 1; i >= 0; i--) {

			//Cache variables and intersection, continue if no intersection
			var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
			if (!intersection) continue;

			if(itemElement != this.currentItem[0] //cannot intersect with itself
				&&	this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
				&&	!$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
				&& (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
				//&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
			) {

				this.direction = intersection == 1 ? "down" : "up";

				if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
					this._rearrange(event, item);
				} else {
					break;
				}

				this._trigger("change", event, this._uiHash());
				break;
			}
		}

		//Post events to containers
		this._contactContainers(event);

		//Interconnect with droppables
		if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);

		//Call callbacks
		this._trigger('sort', event, this._uiHash());

		this.lastPositionAbs = this.positionAbs;
		return false;

	},

	_mouseStop: function(event, noPropagation) {

		if(!event) return;

		//If we are using droppables, inform the manager about the drop
		if ($.ui.ddmanager && !this.options.dropBehaviour)
			$.ui.ddmanager.drop(this, event);

		if(this.options.revert) {
			var self = this;
			var cur = self.placeholder.offset();

			self.reverting = true;

			$(this.helper).animate({
				left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
				top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
			}, parseInt(this.options.revert, 10) || 500, function() {
				self._clear(event);
			});
		} else {
			this._clear(event, noPropagation);
		}

		return false;

	},

	cancel: function() {

		var self = this;

		if(this.dragging) {

			this._mouseUp();

			if(this.options.helper == "original")
				this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
			else
				this.currentItem.show();

			//Post deactivating events to containers
			for (var i = this.containers.length - 1; i >= 0; i--){
				this.containers[i]._trigger("deactivate", null, self._uiHash(this));
				if(this.containers[i].containerCache.over) {
					this.containers[i]._trigger("out", null, self._uiHash(this));
					this.containers[i].containerCache.over = 0;
				}
			}

		}

		//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
		if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
		if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();

		$.extend(this, {
			helper: null,
			dragging: false,
			reverting: false,
			_noFinalSort: null
		});

		if(this.domPosition.prev) {
			$(this.domPosition.prev).after(this.currentItem);
		} else {
			$(this.domPosition.parent).prepend(this.currentItem);
		}

		return this;

	},

	serialize: function(o) {

		var items = this._getItemsAsjQuery(o && o.connected);
		var str = []; o = o || {};

		$(items).each(function() {
			var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
			if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
		});

		return str.join('&');

	},

	toArray: function(o) {

		var items = this._getItemsAsjQuery(o && o.connected);
		var ret = []; o = o || {};

		items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
		return ret;

	},

	/* Be careful with the following core functions */
	_intersectsWith: function(item) {

		var x1 = this.positionAbs.left,
			x2 = x1 + this.helperProportions.width,
			y1 = this.positionAbs.top,
			y2 = y1 + this.helperProportions.height;

		var l = item.left,
			r = l + item.width,
			t = item.top,
			b = t + item.height;

		var dyClick = this.offset.click.top,
			dxClick = this.offset.click.left;

		var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;

		if(	   this.options.tolerance == "pointer"
			|| this.options.forcePointerForContainers
			|| (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
		) {
			return isOverElement;
		} else {

			return (l < x1 + (this.helperProportions.width / 2) // Right Half
				&& x2 - (this.helperProportions.width / 2) < r // Left Half
				&& t < y1 + (this.helperProportions.height / 2) // Bottom Half
				&& y2 - (this.helperProportions.height / 2) < b ); // Top Half

		}
	},

	_intersectsWithPointer: function(item) {

		var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
			isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
			isOverElement = isOverElementHeight && isOverElementWidth,
			verticalDirection = this._getDragVerticalDirection(),
			horizontalDirection = this._getDragHorizontalDirection();

		if (!isOverElement)
			return false;

		return this.floating ?
			( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
			: ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );

	},

	_intersectsWithSides: function(item) {

		var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
			isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
			verticalDirection = this._getDragVerticalDirection(),
			horizontalDirection = this._getDragHorizontalDirection();

		if (this.floating && horizontalDirection) {
			return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
		} else {
			return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
		}

	},

	_getDragVerticalDirection: function() {
		var delta = this.positionAbs.top - this.lastPositionAbs.top;
		return delta != 0 && (delta > 0 ? "down" : "up");
	},

	_getDragHorizontalDirection: function() {
		var delta = this.positionAbs.left - this.lastPositionAbs.left;
		return delta != 0 && (delta > 0 ? "right" : "left");
	},

	refresh: function(event) {
		this._refreshItems(event);
		this.refreshPositions();
		return this;
	},

	_connectWith: function() {
		var options = this.options;
		return options.connectWith.constructor == String
			? [options.connectWith]
			: options.connectWith;
	},
	
	_getItemsAsjQuery: function(connected) {

		var self = this;
		var items = [];
		var queries = [];
		var connectWith = this._connectWith();

		if(connectWith && connected) {
			for (var i = connectWith.length - 1; i >= 0; i--){
				var cur = $(connectWith[i]);
				for (var j = cur.length - 1; j >= 0; j--){
					var inst = $.data(cur[j], 'sortable');
					if(inst && inst != this && !inst.options.disabled) {
						queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
					}
				};
			};
		}

		queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);

		for (var i = queries.length - 1; i >= 0; i--){
			queries[i][0].each(function() {
				items.push(this);
			});
		};

		return $(items);

	},

	_removeCurrentsFromItems: function() {

		var list = this.currentItem.find(":data(sortable-item)");

		for (var i=0; i < this.items.length; i++) {

			for (var j=0; j < list.length; j++) {
				if(list[j] == this.items[i].item[0])
					this.items.splice(i,1);
			};

		};

	},

	_refreshItems: function(event) {

		this.items = [];
		this.containers = [this];
		var items = this.items;
		var self = this;
		var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
		var connectWith = this._connectWith();

		if(connectWith) {
			for (var i = connectWith.length - 1; i >= 0; i--){
				var cur = $(connectWith[i]);
				for (var j = cur.length - 1; j >= 0; j--){
					var inst = $.data(cur[j], 'sortable');
					if(inst && inst != this && !inst.options.disabled) {
						queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
						this.containers.push(inst);
					}
				};
			};
		}

		for (var i = queries.length - 1; i >= 0; i--) {
			var targetData = queries[i][1];
			var _queries = queries[i][0];

			for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
				var item = $(_queries[j]);

				item.data('sortable-item', targetData); // Data for target checking (mouse manager)

				items.push({
					item: item,
					instance: targetData,
					width: 0, height: 0,
					left: 0, top: 0
				});
			};
		};

	},

	refreshPositions: function(fast) {

		//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
		if(this.offsetParent && this.helper) {
			this.offset.parent = this._getParentOffset();
		}

		for (var i = this.items.length - 1; i >= 0; i--){
			var item = this.items[i];

			var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;

			if (!fast) {
				item.width = t.outerWidth();
				item.height = t.outerHeight();
			}

			var p = t.offset();
			item.left = p.left;
			item.top = p.top;
		};

		if(this.options.custom && this.options.custom.refreshContainers) {
			this.options.custom.refreshContainers.call(this);
		} else {
			for (var i = this.containers.length - 1; i >= 0; i--){
				var p = this.containers[i].element.offset();
				this.containers[i].containerCache.left = p.left;
				this.containers[i].containerCache.top = p.top;
				this.containers[i].containerCache.width	= this.containers[i].element.outerWidth();
				this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
			};
		}

		return this;
	},

	_createPlaceholder: function(that) {

		var self = that || this, o = self.options;

		if(!o.placeholder || o.placeholder.constructor == String) {
			var className = o.placeholder;
			o.placeholder = {
				element: function() {

					var el = $(document.createElement(self.currentItem[0].nodeName))
						.addClass(className || self.currentItem[0].className+" ui-sortable-placeholder")
						.removeClass("ui-sortable-helper")[0];

					if(!className)
						el.style.visibility = "hidden";

					return el;
				},
				update: function(container, p) {

					// 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
					// 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
					if(className && !o.forcePlaceholderSize) return;

					//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
					if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };
					if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };
				}
			};
		}

		//Create the placeholder
		self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem));

		//Append it after the actual current item
		self.currentItem.after(self.placeholder);

		//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
		o.placeholder.update(self, self.placeholder);

	},

	_contactContainers: function(event) {
		
		// get innermost container that intersects with item 
		var innermostContainer = null, innermostIndex = null;		
		
		
		for (var i = this.containers.length - 1; i >= 0; i--){

			// never consider a container that's located within the item itself 
			if($.ui.contains(this.currentItem[0], this.containers[i].element[0]))
				continue;

			if(this._intersectsWith(this.containers[i].containerCache)) {

				// if we've already found a container and it's more "inner" than this, then continue 
				if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0]))
					continue;

				innermostContainer = this.containers[i]; 
				innermostIndex = i;
					
			} else {
				// container doesn't intersect. trigger "out" event if necessary 
				if(this.containers[i].containerCache.over) {
					this.containers[i]._trigger("out", event, this._uiHash(this));
					this.containers[i].containerCache.over = 0;
				}
			}

		}
		
		// if no intersecting containers found, return 
		if(!innermostContainer) return; 

		// move the item into the container if it's not there already
		if(this.containers.length === 1) {
			this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
			this.containers[innermostIndex].containerCache.over = 1;
		} else if(this.currentContainer != this.containers[innermostIndex]) { 

			//When entering a new container, we will find the item with the least distance and append our item near it 
			var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top']; 
			for (var j = this.items.length - 1; j >= 0; j--) { 
				if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; 
				var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top']; 
				if(Math.abs(cur - base) < dist) { 
					dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; 
				} 
			} 

			if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled 
				return; 

			this.currentContainer = this.containers[innermostIndex]; 
			itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); 
			this._trigger("change", event, this._uiHash()); 
			this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); 

			//Update the placeholder 
			this.options.placeholder.update(this.currentContainer, this.placeholder); 
		
			this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 
			this.containers[innermostIndex].containerCache.over = 1;
		} 
	
		
	},

	_createHelper: function(event) {

		var o = this.options;
		var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);

		if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
			$(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);

		if(helper[0] == this.currentItem[0])
			this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };

		if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
		if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());

		return helper;

	},

	_adjustOffsetFromHelper: function(obj) {
		if (typeof obj == 'string') {
			obj = obj.split(' ');
		}
		if ($.isArray(obj)) {
			obj = {left: +obj[0], top: +obj[1] || 0};
		}
		if ('left' in obj) {
			this.offset.click.left = obj.left + this.margins.left;
		}
		if ('right' in obj) {
			this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
		}
		if ('top' in obj) {
			this.offset.click.top = obj.top + this.margins.top;
		}
		if ('bottom' in obj) {
			this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
		}
	},

	_getParentOffset: function() {


		//Get the offsetParent and cache its position
		this.offsetParent = this.helper.offsetParent();
		var po = this.offsetParent.offset();

		// This is a special case where we need to modify a offset calculated on start, since the following happened:
		// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
		// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
		//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
		if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
			po.left += this.scrollParent.scrollLeft();
			po.top += this.scrollParent.scrollTop();
		}

		if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
		|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
			po = { top: 0, left: 0 };

		return {
			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
		};

	},

	_getRelativeOffset: function() {

		if(this.cssPosition == "relative") {
			var p = this.currentItem.position();
			return {
				top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
				left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
			};
		} else {
			return { top: 0, left: 0 };
		}

	},

	_cacheMargins: function() {
		this.margins = {
			left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
			top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
		};
	},

	_cacheHelperProportions: function() {
		this.helperProportions = {
			width: this.helper.outerWidth(),
			height: this.helper.outerHeight()
		};
	},

	_setContainment: function() {

		var o = this.options;
		if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
		if(o.containment == 'document' || o.containment == 'window') this.containment = [
			0 - this.offset.relative.left - this.offset.parent.left,
			0 - this.offset.relative.top - this.offset.parent.top,
			$(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
			($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
		];

		if(!(/^(document|window|parent)$/).test(o.containment)) {
			var ce = $(o.containment)[0];
			var co = $(o.containment).offset();
			var over = ($(ce).css("overflow") != 'hidden');

			this.containment = [
				co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
				co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
				co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
				co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
			];
		}

	},

	_convertPositionTo: function(d, pos) {

		if(!pos) pos = this.position;
		var mod = d == "absolute" ? 1 : -1;
		var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);

		return {
			top: (
				pos.top																	// The absolute mouse position
				+ this.offset.relative.top * mod										// Only for relative positioned nodes: Relative offset from element to offset parent
				+ this.offset.parent.top * mod											// The offsetParent's offset without borders (offset + border)
				- ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
			),
			left: (
				pos.left																// The absolute mouse position
				+ this.offset.relative.left * mod										// Only for relative positioned nodes: Relative offset from element to offset parent
				+ this.offset.parent.left * mod											// The offsetParent's offset without borders (offset + border)
				- ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
			)
		};

	},

	_generatePosition: function(event) {

		var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);

		// This is another very weird special case that only happens for relative elements:
		// 1. If the css position is relative
		// 2. and the scroll parent is the document or similar to the offset parent
		// we have to refresh the relative offset during the scroll so there are no jumps
		if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
			this.offset.relative = this._getRelativeOffset();
		}

		var pageX = event.pageX;
		var pageY = event.pageY;

		/*
		 * - Position constraining -
		 * Constrain the position to a mix of grid, containment.
		 */

		if(this.originalPosition) { //If we are not dragging yet, we won't check for options

			if(this.containment) {
				if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
				if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
				if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
				if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
			}

			if(o.grid) {
				var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
				pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;

				var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
				pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
			}

		}

		return {
			top: (
				pageY																// The absolute mouse position
				- this.offset.click.top													// Click offset (relative to the element)
				- this.offset.relative.top												// Only for relative positioned nodes: Relative offset from element to offset parent
				- this.offset.parent.top												// The offsetParent's offset without borders (offset + border)
				+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
			),
			left: (
				pageX																// The absolute mouse position
				- this.offset.click.left												// Click offset (relative to the element)
				- this.offset.relative.left												// Only for relative positioned nodes: Relative offset from element to offset parent
				- this.offset.parent.left												// The offsetParent's offset without borders (offset + border)
				+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
			)
		};

	},

	_rearrange: function(event, i, a, hardRefresh) {

		a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));

		//Various things done here to improve the performance:
		// 1. we create a setTimeout, that calls refreshPositions
		// 2. on the instance, we have a counter variable, that get's higher after every append
		// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
		// 4. this lets only the last addition to the timeout stack through
		this.counter = this.counter ? ++this.counter : 1;
		var self = this, counter = this.counter;

		window.setTimeout(function() {
			if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
		},0);

	},

	_clear: function(event, noPropagation) {

		this.reverting = false;
		// We delay all events that have to be triggered to after the point where the placeholder has been removed and
		// everything else normalized again
		var delayedTriggers = [], self = this;

		// We first have to update the dom position of the actual currentItem
		// Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
		if(!this._noFinalSort && this.currentItem[0].parentNode) this.placeholder.before(this.currentItem);
		this._noFinalSort = null;

		if(this.helper[0] == this.currentItem[0]) {
			for(var i in this._storedCSS) {
				if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
			}
			this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
		} else {
			this.currentItem.show();
		}

		if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
		if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
		if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
			if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
			for (var i = this.containers.length - 1; i >= 0; i--){
				if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) {
					delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); };  }).call(this, this.containers[i]));
					delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this));  }; }).call(this, this.containers[i]));
				}
			};
		};

		//Post events to containers
		for (var i = this.containers.length - 1; i >= 0; i--){
			if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); };  }).call(this, this.containers[i]));
			if(this.containers[i].containerCache.over) {
				delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); };  }).call(this, this.containers[i]));
				this.containers[i].containerCache.over = 0;
			}
		}

		//Do what was originally in plugins
		if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
		if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
		if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index

		this.dragging = false;
		if(this.cancelHelperRemoval) {
			if(!noPropagation) {
				this._trigger("beforeStop", event, this._uiHash());
				for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
				this._trigger("stop", event, this._uiHash());
			}
			return false;
		}

		if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());

		//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
		this.placeholder[0].parentNode.removeChild(this.placeholder[0]);

		if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;

		if(!noPropagation) {
			for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
			this._trigger("stop", event, this._uiHash());
		}

		this.fromOutside = false;
		return true;

	},

	_trigger: function() {
		if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
			this.cancel();
		}
	},

	_uiHash: function(inst) {
		var self = inst || this;
		return {
			helper: self.helper,
			placeholder: self.placeholder || $([]),
			position: self.position,
			originalPosition: self.originalPosition,
			offset: self.positionAbs,
			item: self.currentItem,
			sender: inst ? inst.element : null
		};
	}

});

$.extend($.ui.sortable, {
	version: "1.8.1"
});

})(jQuery);
/*
Stylish Select 0.4.1 - $ plugin to replace a select drop down box with a stylable unordered list
http://github.com/sko77sun/Stylish-Select

Requires: jQuery 1.3 or newer

Contributions from Justin Beasley: http://www.harvest.org/ & Anatoly Ressin: http://www.artazor.lv/

Dual licensed under the MIT and GPL licenses.

*/
(function($) {
    //add class to html tag
    $('html').addClass('stylish-select');

    //create cross-browser indexOf
    Array.prototype.indexOf = function(obj, start) {
        for (var i = (start || 0); i < this.length; i++) {
            if (this[i] == obj) {
                return i;
            }
        }
    }

    //utility methods
    $.fn.extend({
        getSetSSValue: function(value) {
            if (value) {
                //set value and trigger change event
                $(this).val(value).change();
                return this;
            } else {
                return $(this).find(':selected').val();
            }
        },
        //added by Justin Beasley
        resetSS: function() {
            var oldOpts = $(this).data('ssOpts');
            $this = $(this);
            $this.next().remove();
            //unbind all events and redraw
            $this.unbind('.sSelect').sSelect(oldOpts);
        }
    });

    $.fn.sSelect = function(options) {

        return this.each(function() {

            var defaults = {
                defaultText: 'Please select',
                animationSpeed: 0, //set speed of dropdown
                ddMaxHeight: '', //set css max-height value of dropdown
                containerClass: '', //additional classes for container div
					 alwaysOnBottom: false
            };

            //initial variables
            var opts = $.extend(defaults, options),
$input = $(this),
$containerDivText = $('<div class="selectedTxt"></div>'),
$containerDiv = $('<div class="newListSelected ' + opts.containerClass + '"></div>'),
$newUl = $('<ul class="newList" style="visibility:hidden;"></ul>'),
itemIndex = -1,
currentIndex = -1,
keys = [],
prevKey = false,
prevented = false,
$newLi;

            //added by Justin Beasley
            $(this).data('ssOpts', options);

            //build new list
            $containerDiv.insertAfter($input);
            $containerDiv.attr("tabindex", $input.attr("tabindex") || "0");
            $containerDivText.prependTo($containerDiv);
            $newUl.appendTo($containerDiv);
            $input.hide();

            //added by Justin Beasley (used for lists initialized while hidden)
            $containerDivText.data('ssReRender', !$containerDivText.is(':visible'));

            //test for optgroup
            if ($input.children('optgroup').length == 0) {
                $input.children().each(function(i) {
                    var option = $(this).html();
                    var key = $(this).val();

                    //add first letter of each word to array
                    keys.push(option.charAt(0).toLowerCase());
                    if ($(this).attr('selected') == true) {
                        opts.defaultText = option;
                        currentIndex = i;
                    }
                    $newUl.append($('<li><a href="JavaScript:void(0);">' + option + '</a></li>').data('key', key));

                });
                //cache list items object
                $newLi = $newUl.children().children();

            } else { //optgroup
                $input.children('optgroup').each(function() {

                    var optionTitle = $(this).attr('label'),
                    $optGroup = $('<li class="newListOptionTitle">' + optionTitle + '</li>');

                    $optGroup.appendTo($newUl);

                    var $optGroupList = $('<ul></ul>');

                    $optGroupList.appendTo($optGroup);

                    $(this).children().each(function() {
                        ++itemIndex;
                        var option = $(this).html();
                        var key = $(this).val();
                        //add first letter of each word to array
                        keys.push(option.charAt(0).toLowerCase());
                        if ($(this).attr('selected') == true) {
                            opts.defaultText = option;
                            currentIndex = itemIndex;
                        }
                        $optGroupList.append($('<li><a href="JavaScript:void(0);">' + option + '</a></li>').data('key', key));
                    })
                });
                //cache list items object
                $newLi = $newUl.find('ul li a');
            }

            //get heights of new elements for use later
            var newUlHeight = $newUl.height(),
            containerHeight = $containerDiv.height(),
            newLiLength = $newLi.length;

            //check if a value is selected
            if (currentIndex != -1) {
                navigateList(currentIndex, true);
            } else {
                //set placeholder text
                $containerDivText.text(opts.defaultText);
            }

            //decide if to place the new list above or below the drop-down
				function newUlPos() {
					if (opts.alwaysOnBottom) {
						$input.onTop = false;
					} else {
						var containerPosY = $containerDiv.offset().top,
						docHeight = jQuery(window).height(),
						scrollTop = jQuery(window).scrollTop();

						//if height of list is greater then max height, set list height to max height value
						if (newUlHeight > parseInt(opts.ddMaxHeight)) {
							newUlHeight = parseInt(opts.ddMaxHeight);
						}

						containerPosY = containerPosY - scrollTop;
						if (containerPosY + newUlHeight >= docHeight) {
							$newUl.css({
								top: '-' + newUlHeight + 'px',
								height: newUlHeight
							});
							$input.onTop = true;
						} else {
							$newUl.css({
								top: containerHeight + 'px',
								height: newUlHeight
							});
							$input.onTop = false;
						}
					}
            }

            //run function on page load
            newUlPos();

            //run function on browser window resize
            $(window).bind('resize.sSelect scroll.sSelect', newUlPos);

            //positioning
            function positionFix() {
                $containerDiv.css('position', 'relative');
            }

            function positionHideFix() {
                $containerDiv.css('position', 'static');
            }

            $containerDivText.bind('click.sSelect', function(event) {
                event.stopPropagation();

                //added by Justin Beasley
                if ($(this).data('ssReRender')) {
                    newUlHeight = $newUl.height('').height();
                    containerHeight = $containerDiv.height();
                    $(this).data('ssReRender', false);
                    newUlPos();
                }

                //hide all menus apart from this one
                $('.newList').not($(this).next()).hide()
                    .parent()
                        .css('position', 'static')
                        .removeClass('newListSelFocus');

                //show/hide this menu
                $newUl.toggle();
                positionFix();
                //scroll list to selected item
                $newLi.eq(currentIndex).focus();

            });

            $newLi.bind('click.sSelect', function(e) {
                var $clickedLi = $(e.target);

                //update counter
                currentIndex = $newLi.index($clickedLi);

                //remove all hilites, then add hilite to selected item
                prevented = true;
                navigateList(currentIndex);
                $newUl.hide();
                $containerDiv.css('position', 'static'); //ie

            });

            $newLi.bind('mouseenter.sSelect',
function(e) {
    var $hoveredLi = $(e.target);
    $hoveredLi.addClass('newListHover');
}
).bind('mouseleave.sSelect',
function(e) {
    var $hoveredLi = $(e.target);
    $hoveredLi.removeClass('newListHover');
}
);

            function navigateList(currentIndex, init) {
                $newLi.removeClass('hiLite')
                .eq(currentIndex)
                .addClass('hiLite');

                if ($newUl.is(':visible')) {
                    $newLi.eq(currentIndex).focus();
                }

                var text = $newLi.eq(currentIndex).html();
                var val = $newLi.eq(currentIndex).parent().data('key');

                //page load
                if (init == true) {
                    $input.val(val);
                    $containerDivText.text(text);
                    return false;
                }

                try {
                    $input.val(val)
                } catch (ex) {
                    // handle ie6 exception
                    $input[0].selectedIndex = currentIndex;
                }

                $input.change();
                $containerDivText.text(text);
            }

            $input.bind('change.sSelect', function(event) {
                $targetInput = $(event.target);
                //stop change function from firing
                if (prevented == true) {
                    prevented = false;
                    return false;
                }
                $currentOpt = $targetInput.find(':selected');

                //currentIndex = $targetInput.find('option').index($currentOpt);
                currentIndex = $targetInput.find('option').index($currentOpt);

                navigateList(currentIndex, true);
            });

            //handle up and down keys
            function keyPress(element) {
                //when keys are pressed
                $(element).unbind('keydown.sSelect').bind('keydown.sSelect', function(e) {
                    var keycode = e.which;

                    //prevent change function from firing
                    prevented = true;

                    switch (keycode) {
                        case 40: //down
                        case 39: //right
                            incrementList();
                            return false;
                            break;
                        case 38: //up
                        case 37: //left
                            decrementList();
                            return false;
                            break;
                        case 33: //page up
                        case 36: //home
                            gotoFirst();
                            return false;
                            break;
                        case 34: //page down
                        case 35: //end
                            gotoLast();
                            return false;
                            break;
                        case 13:
                        case 27:
                            $newUl.hide();
                            positionHideFix();
                            return false;
                            break;
                    }

                    //check for keyboard shortcuts
                    keyPressed = String.fromCharCode(keycode).toLowerCase();

                    var currentKeyIndex = keys.indexOf(keyPressed);

                    if (typeof currentKeyIndex != 'undefined') { //if key code found in array
                        ++currentIndex;
                        currentIndex = keys.indexOf(keyPressed, currentIndex); //search array from current index
                        if (currentIndex == -1 || currentIndex == null || prevKey != keyPressed) currentIndex = keys.indexOf(keyPressed); //if no entry was found or new key pressed search from start of array


                        navigateList(currentIndex);
                        //store last key pressed
                        prevKey = keyPressed;
                        return false;
                    }
                });
            }

            function incrementList() {
                if (currentIndex < (newLiLength - 1)) {
                    ++currentIndex;
                    navigateList(currentIndex);
                }
            }

            function decrementList() {
                if (currentIndex > 0) {
                    --currentIndex;
                    navigateList(currentIndex);
                }
            }

            function gotoFirst() {
                currentIndex = 0;
                navigateList(currentIndex);
            }

            function gotoLast() {
                currentIndex = newLiLength - 1;
                navigateList(currentIndex);
            }

            $containerDiv.bind('click.sSelect', function(e) {
                e.stopPropagation();
                keyPress(this);
            });

            $containerDiv.bind('focus.sSelect', function() {
                $(this).addClass('newListSelFocus');
                keyPress(this);
            });

            $containerDiv.bind('blur.sSelect', function() {
                $(this).removeClass('newListSelFocus');
            });

            //hide list on blur
            $(document).bind('click.sSelect', function() {
                $containerDiv.removeClass('newListSelFocus');
                $newUl.hide();
                positionHideFix();
            });

            //add classes on hover
            $containerDivText.bind('mouseenter.sSelect',
function(e) {
    var $hoveredTxt = $(e.target);
    $hoveredTxt.parent().addClass('newListSelHover');
}
).bind('mouseleave.sSelect',
function(e) {
    var $hoveredTxt = $(e.target);
    $hoveredTxt.parent().removeClass('newListSelHover');
}
            );

            //reset left property and hide
            $newUl.css({
                left: '0',
                display: 'none',
                visibility: 'visible'
            });

        });

    };

})(jQuery);


function texte_recherche(obj,vis){
default_str="Rechercher";
 if(vis=="off"){ tmp_obj_value=obj.value;  obj.value="";}
 else if(vis=="on" && (obj.value)==""){ obj.value= tmp_obj_value};
}


function chaine_recherche(obj,vis){
default_str="Rechercher une chaîne";
 if(vis=="off"){ tmp_obj_value=obj.value;  obj.value=""; }
 else if(vis=="on" && (obj.value)==""){ obj.value= tmp_obj_value};
}

grille_counter=0;
	
function trim (myString) {
		return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
		} 

  function isdefined( variable){
    return (typeof(window[variable]) == "undefined")?  false: true;
}



 function get_program(type,result) {
 switch(type){
   case('series'):type_programme="serie";text_programme="S&eacute;rie";break;
   case('divertissement'):type_programme="divertissement" ;text_programme="Divertissement";break;
   case('sport'):type_programme="sport" ;text_programme="Sport";break;
   case('films'):type_programme="cinema" ;text_programme="Cin&eacute;ma";break;
   case('cinema'):type_programme="cinema" ;text_programme="Cin&eacute;ma";break;
   case('decouverte'):type_programme="decouverte" ;text_programme="D&eacute;couverte";break;
   case('jeunesse'):type_programme="jeunesse" ;text_programme="Jeunesse";break;
   case('information'):type_programme="information" ;text_programme="Information";break;
    case('charme'):type_programme="charme" ;text_programme="Charme";break;
  default:type_programme="divertissement"  ;text_programme="Divertissement";break;}
  if(result=="text"){ return(text_programme); }
  else{ return(type_programme); }
  }
  
//////////////////////////* fonction des pages avec carousel *////////////////////////////////


 var maxprogramme=0;
 var maxprogramme_moment=0;
 
var max_tmpprogramme=0;
 var count_images=0;
 var max_count_images=0;
 var lienpopin=' lien-popin';
 var lienpopin2=' class="lien-popin" ';
  var lienpopinTV=' class="lien-popinTV" ';
 
/* page autre plage horaire */
function mycarousel_getItemHTML_autreplage(item,num)
{   grille_counter++;
programme_html="";
programme=eval('programme'+item.title);
programme_moment=eval('programme_moment'+item.title); 
var  max_tmpprogramme=0;
 var count_images=0;
 var max_count_images=0;
for(i=0;i<=programme.length-1;i++){
   max_tmpprogramme++;
    programme_html+= "<p class=\"unite-programme ";  
	if(programme[i][6]==1 ){ programme_html+=" focus-programme"; }
	 programme_html+= "\">";
 /* image titre si image presente */
  if( programme[i][1]!=""){count_images++; programme_html+= "<a href=\""+programme[i][2]+"\" "+lienpopin2+"><img src=\""+programme[i][1]+"\" alt=\""+programme[i][0]+"\" class=\"capture-tv-grille\" /></a><br/>"; }
    programme_html+="<font class=\"gras gris-clair\">"+programme[i][3].substr(0,2)+":"+ programme[i][3].substr(2,2)+"</font><br/>"+
                 "<a href=\""+programme[i][2]+"\" class=\"noir gras"+lienpopin+"\">"+ programme[i][0]+"</a><br/>"+
				 "<font class=\"couleur-thematique-"+get_program(programme[i][4],'type')+" gras caps1\">"+get_program(programme[i][4],'text');
	programme_html+="</font></p>";
  /*separateur sauf dernier element */
  	if( i!=(programme.length-1)){ programme_html+="<hr class=\"separateur_programme\"/>"; }

	}
maxprogramme=Math.max(maxprogramme,max_tmpprogramme);// nbre max de lignes de programme
	max_count_images=Math.max(count_images,max_count_images);
	
	
	var max_tmpprogramme_moment=0;
	 programme_moment_html="";
	 var num_moment=1;
for(i=0;i<=programme_moment.length-1;i++){	
    max_tmpprogramme_moment++;
	
	programme_moment_html+= "<p class=\"unite-programme ";  // focus-programme lorsque le programme est affiché avec un fd orange
	if(programme_moment[i][6]==1 ){ programme_moment_html+=" focus-programme"; }
	 programme_moment_html+= "\">";
	programme_moment_html+="<font class=\"gras gris-clair\">"+programme_moment[i][3].substr(0,2)+":"+ programme_moment[i][3].substr(2,2)+"</font><br/>"+
                           "<a href=\"#\" class=\"noir gras\">"+ programme_moment[i][0]+"</a><br/>"+
				           "<font class=\"couleur-thematique-"+get_program(programme_moment[i][4],'type')+" gras caps1\">"+get_program(programme_moment[i][4],'text');
    programme_moment_html+="</font></p>";
    /*separateur sauf dernier element */
  	if( i!=(programme_moment.length-1)){ programme_moment_html+="<hr class=\"separateur_programme\"/>"; }
	num_moment++;
}
	maxprogramme_moment=Math.max(maxprogramme_moment,max_tmpprogramme_moment);
  ///  '.grille-generale-autre{height:'+((maxprogramme *60+15)+(max_count_images*1)*110)+'px;}'+
	             
	if(grille_counter==1){div_encemoment='<div class="titre-article noir titre-incruste" ><h4>EN CE MOMENT</h4></div>';
							div_plagetitre='<div class="titre-article noir titre-plage clear-both" ><h4>APRES-MIDI</h4></div>';}
	else{div_encemoment='';div_plagetitre='';}
	
     return  '<style>'+
	               '.grille-en-ce-moment{height:'+(maxprogramme_moment * 55+15)+'px;}'+
				   '#moment-horaire-grille0{top:'+(150+42+(maxprogramme * 60+15)+(max_count_images*1)*110)+'px;}'+
			'</style>'+
			 '<div class="carousel-titre-chaine" >'+
	         '<div class="encart_picto">'+
		       '<img src="' +rep_chaines+ item.url + '" width="56" height="42" alt="' + item.title + '" />' +
	           '<div class="numero_canal">'+item.canal+'</div>'+
			 '</div>'+
	       '<font class="lien_grille_chaine noir gras"><a href="'+item.url_semaine+'" class="lien-noir10 noir souligne gras" >Voir la semaine</a></font></div>' +
	       '<div class="detail_programme_chaine grille-generale-autre" >'+div_plagetitre+programme_html+'</div>' +
		   '<div class="grille-en-ce-moment" id="grille-moment-'+num_moment+'">'+div_encemoment+programme_moment_html+'</div>';


};
function mycarousel_itemLoadCallback_autreplage(carousel, state)
{
    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > mycarousel_itemList.length) {
            break;
        }

        carousel.add(i, mycarousel_getItemHTML_autreplage(mycarousel_itemList[i-1],i));
    }
};
 
/* page grille d'une chaine */ 
function mycarousel_getItemHTML_grillechaine(item,num)
{  grille_counter++;
 programme_html="";
 programme=eval('programme'+item.title);
 var  max_tmpprogramme=0;
  var count_images=0;
 var max_count_images=0;
for(i=0;i<=programme.length-1;i++){
  max_tmpprogramme++;
   programme_html+= "<p class=\"unite-programme ";  // focus-programme lorsque le programme est affiché avec un fd orange
	if(programme[i][6]==1 ){ programme_html+=" focus-programme"; }
	 programme_html+= "\">";
 /* image titre si image presente */
  if( programme[i][1]!=""){programme_html+= "<a href=\""+programme[i][2]+"\"><img src=\""+programme[i][1]+"\" alt=\""+programme[i][0]+"\" class=\"capture-tv-grille\" /></a><br/>"; }
    programme_html+="<font class=\"gras gris-clair\">"+programme[i][3].substr(0,2)+":"+ programme[i][3].substr(2,2)+"</font><br/>"+
                 "<a href=\""+programme[i][2]+"\" class=\"noir gras\">"+ programme[i][0]+"</a><br/>"+
				 "<font class=\"couleur-thematique-"+get_program(programme[i][4],'type')+" gras caps1\">"+get_program(programme[i][4],'text');
  programme_html+="</font></p>";
 /*separateur sauf dernier element */
  	if( i!=(programme.length-1)){ programme_html+="<hr class=\"separateur_programme\"/>"; }

	}
    maxprogramme=Math.max(maxprogramme,max_tmpprogramme);// nbre max de lignes de programme
	max_count_images=Math.max(count_images,max_count_images);
	
		
	
	var max_tmpprogramme=0;
	 programme_moment_html="";
	 var num_moment=1;
	if(grille_counter==1){div_encemoment='<div class="titre-article noir titre-incruste" ><h4>EN CE MOMENT</h4></div>';
							div_plagetitre='<div class="titre-article noir titre-plage clear-both" ><h4>LA SOIREE</h4></div>';}
	else{div_encemoment='';div_plagetitre='';}

  return  '<style>'+
	               '.grille-generale{height:'+(50+(maxprogramme * 100+15)+(max_count_images*1)*110)+'px;}'+
	               '.grille-en-ce-moment{height:'+(maxprogramme_moment * 55+15)+'px;}</style>'+
          '<div class="carousel-titre-chaine" >'+
	         '<!-- <div class="encart_picto ">'+
		       '<img src="' +rep_chaines+ item.url + '" width="56" height="42" alt="' + item.title + '" />' +
	           '<div class="numero_canal">'+item.canal+'</div>'+
			 '</div>'+
	       '<font class="lien_grille_chaine noir gras"><a href="'+item.url_semaine+'" class="lien-noir10 noir souligne gras" >Voir la semaine</a></font></div> -->' +
	        '<div class="detail_programme_chaine grille-generale"  style="height:'+(50+(maxprogramme * 100+15)+(max_count_images*1)*110)+'px;"><span class="titre-jour-grille">'+item.title+'</span>'+programme_html+'</div>'+
		   '';
};
function mycarousel_itemLoadCallback_grillechaine(carousel, state)
{
    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > mycarousel_itemList.length) {
            break;
        }

        carousel.add(i, mycarousel_getItemHTML_grillechaine(mycarousel_itemList[i-1],i));
    }
};

/* page loggue abbonne -*/

function mycarousel_getItemHTML_loggueabbone(item,num)
{   grille_counter++;
// alert(item.programme);
programme_html="";
programme=eval('programme'+item.title);
programme_moment=eval('programme_moment'+item.title);
var  max_tmpprogramme=0;
 var count_images=0;
 var max_count_images=0;
for(i=0;i<=programme.length-1;i++){
  max_tmpprogramme++;
    programme_html+= "<p class=\"unite-programme ";  // focus-programme lorsque le programme est affiché avec un fd orange
	if(programme[i][6]==1 ){ programme_html+=" focus-programme"; }
	 programme_html+= "\">";
 /* image titre si image presente */
 if( programme[i][1]!=""){programme_html+= "<a href=\""+programme[i][2]+"\"><img src=\""+programme[i][1]+"\" alt=\""+programme[i][0]+"\" class=\"capture-tv-grille\" /></a><br/>"; }
    programme_html+="<font class=\"gras gris-clair\">"+programme[i][3].substr(0,2)+":"+ programme[i][3].substr(2,2)+"</font><br/>"+
                 "<a href=\""+programme[i][2]+"\" class=\"noir gras\">"+ programme[i][0]+"</a><br/>"+
				 "<font class=\"couleur-thematique-"+get_program(programme[i][4],'type')+" gras caps1\">"+get_program(programme[i][4],'text');
				 //programme[i][4]
  /* ajout d'espace sous l'entrée si le programme dure > 2h - non demandé et supprimé*/
   // if(programme[i][5]>=120 && i!=0 && programme[i][1]==""){programme_html+="<br/><br/>";}
     programme_html+="</font></p>";
 /*separateur sauf dernier element */
  	if( i!=(programme.length-1)){ programme_html+="<hr class=\"separateur_programme\"/>"; }

	}
  maxprogramme=Math.max(maxprogramme,max_tmpprogramme);// nbre max de lignes de programme
	max_count_images=Math.max(count_images,max_count_images);
	
	var max_tmpprogramme_moment=0;
	 programme_moment_html="";
	 var num_moment=1;
for(i=0;i<=programme_moment.length-1;i++){	
    max_tmpprogramme_moment++;
	
	programme_moment_html+= "<p class=\"unite-programme ";  // focus-programme lorsque le programme est affiché avec un fd orange
	if(programme_moment[i][6]==1 ){ programme_moment_html+=" focus-programme"; }
	 programme_moment_html+= "\">";
	programme_moment_html+="<font class=\"gras gris-clair\">"+programme_moment[i][3].substr(0,2)+":"+ programme_moment[i][3].substr(2,2)+"</font><br/>"+
                           "<a href=\"#\" class=\"noir gras\">"+ programme_moment[i][0]+"</a><br/>"+
				           "<font class=\"couleur-thematique-"+get_program(programme_moment[i][4],'type')+" gras caps1\">"+get_program(programme_moment[i][4],'text');
    programme_moment_html+="</font></p>";
    /*separateur sauf dernier element */
  	if( i!=(programme_moment.length-1)){ programme_moment_html+="<hr class=\"separateur_programme\"/>"; }
	num_moment++;
}
	maxprogramme_moment=Math.max(maxprogramme_moment,max_tmpprogramme_moment);// nbre max de lignes de programme

	if(grille_counter==1){div_encemoment='<div class="titre-article noir titre-incruste" ><h4>EN CE MOMENT</h4></div>';
							div_plagetitre='<div class="titre-article noir titre-plage clear-both" ><h4>APRES-MIDI</h4></div>';}
	else{div_encemoment='';div_plagetitre='';}
	
	image_chaine='<img src="' +rep_chaines+ item.url + '"  alt="' + item.title + '"/>';  // width="56" height="42"
	 if(item.rights==0){image_chaine='<div class="chaine-non-dispo" ></div><img src="' +rep_chaines+ item.url + '" alt="' + item.title + '" />'; }
  return '<style>'+
	               '.grille-generale{height:'+((maxprogramme * 100+15)+(max_count_images*1)*110)+'px;}'+
	               '.grille-en-ce-moment{height:'+(maxprogramme_moment * 55+15)+'px;}</style>'+
          '<div class="carousel-titre-chaine" >'+
	         '<div class="encart_picto">'+
		          '<div class="cadre-encart-picto">'+image_chaine +'</div>'+
	           '<div class="numero_canal">'+item.canal+'</div>'+
			 '</div>'+
	       '<font class="lien_grille_chaine noir gras"><a href="'+item.url_semaine+'" class="lien-noir10 noir souligne gras" >Voir la semaine</a></font></div>' +
	       '<div class="detail_programme_chaine grille-generale" >'+div_plagetitre+programme_html+'</div>'+
		   '<div class="grille-en-ce-moment" id="grille-moment-'+num+'">'+div_encemoment+programme_moment_html+'</div>';
		 
};
function mycarousel_itemLoadCallback_loggueabbone(carousel, state)
{
    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > mycarousel_itemList.length) {
            break;
        }

        carousel.add(i, mycarousel_getItemHTML_loggueabbone(mycarousel_itemList[i-1],i));
    }
};


/* panorama */
function mycarousel_getItemHTML_panorama(item,num)
{   grille_counter++;
// alert(item.programme);
programme_html="";
programme=eval('programme'+item.title);
programme_moment=eval('programme_moment'+item.title);
var  max_tmpprogramme=0;
 var count_images=0;
 var max_count_images=0;
for(i=0;i<=programme.length-1;i++){
  max_tmpprogramme++;
    programme_html+= "<p class=\"unite-programme ";  // focus-programme lorsque le programme est affiché avec un fd orange
	if(programme[i][6]==1 ){ programme_html+=" focus-programme"; }
	 programme_html+= "\">";
 /* image titre si image presente */
  if( programme[i][1]!=""){programme_html+= "<a href=\""+programme[i][2]+"\" "+lienpopin2+"><img src=\""+programme[i][1]+"\" alt=\""+programme[i][0]+"\" class=\"capture-tv-grille\" /></a><br/>"; }
    programme_html+="<font class=\"gras gris-clair\">"+programme[i][3].substr(0,2)+":"+ programme[i][3].substr(2,2)+"</font><br/>"+
                 "<a href=\""+programme[i][2]+"\" class=\"noir gras"+lienpopin+"\">"+ programme[i][0]+"</a><br/>"+
				 "<font class=\"couleur-thematique-"+get_program(programme[i][4],'type')+" gras caps1\">"+get_program(programme[i][4],'text');
   programme_html+="</font></p>";
 /*separateur sauf dernier element */
  	if( i!=(programme.length-1)){ programme_html+="<hr class=\"separateur_programme\"/>"; }

	}
    maxprogramme=Math.max(maxprogramme,max_tmpprogramme);// nbre max de lignes de programme
	max_count_images=Math.max(count_images,max_count_images);
	
	var max_tmpprogramme_moment=0;
	 programme_moment_html="";
	 var num_moment=1;
for(i=0;i<=programme_moment.length-1;i++){	
    max_tmpprogramme_moment++;
	programme_moment_html+= "<p class=\"unite-programme ";  // focus-programme lorsque le programme est affiché avec un fd orange
	if(programme_moment[i][6]==1 ){ programme_moment_html+=" focus-programme"; }
	 programme_moment_html+= "\">";
	programme_moment_html+="<font class=\"gras gris-clair\" >"+programme_moment[i][3].substr(0,2)+":"+ programme_moment[i][3].substr(2,2)+"</font><br/>"+
                           "<a href=\"#\" class=\"noir gras\">"+ programme_moment[i][0]+"</a><br/>"+
				           "<font class=\"couleur-thematique-"+get_program(programme_moment[i][4],'type')+" gras caps1\">"+get_program(programme_moment[i][4],'text');
    programme_moment_html+="</font></p>";
    /*separateur sauf dernier element */
  	if( i!=(programme_moment.length-1)){ programme_moment_html+="<hr class=\"separateur_programme\"/>"; }
	num_moment++;
}
	maxprogramme_moment=Math.max(maxprogramme_moment,max_tmpprogramme_moment);// nbre max de lignes de programme

 
 if(grille_counter==1){div_encemoment='<div class="titre-article noir titre-incruste" ><h4>EN CE MOMENT</h4></div>';
							div_plagetitre='<div class="titre-article noir titre-plage clear-both" ><h4>LA SOIREE</h4></div>';}
	else{div_encemoment='';div_plagetitre='';}
	// '<a href="#" '+lienpopinTV+'><img src="' +rep_chaines+ item.url + '" width="56" height="42" alt="' + item.title + '" /></a>' +
	          
  return '<style>'+
	               '.grille-generale{height:'+((maxprogramme * 100+15)+(max_count_images*1)*110)+'px;}'+
	               '.grille-en-ce-moment{height:'+(maxprogramme_moment * 55+15)+'px;}</style>'+
          '<div class="carousel-titre-chaine" >'+
	         '<div class="encart_picto">'+
		       '<a href="#" '+lienpopinTV+'><img src="' +rep_chaines+ item.url + '" width="56" height="42" alt="' + item.title + '" /></a>' +
	           '<div class="numero_canal">'+item.canal+'</div>'+
			 '</div>'+
	       '<font class="lien_grille_chaine noir gras"><a href="'+item.url_semaine+'" class="lien-noir10 noir souligne gras" >Voir la semaine</a></font></div>' +
	       '<div class="detail_programme_chaine grille-generale" >'+div_plagetitre+programme_html+'</div>'+
		   '<div class="grille-en-ce-moment" id="grille-moment-'+num+'">'+div_encemoment+programme_moment_html+'</div>';
};


function mycarousel_itemLoadCallback_panorama(carousel, state)
{
    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > mycarousel_itemList.length) {
            break;
        }

        carousel.add(i, mycarousel_getItemHTML_panorama(mycarousel_itemList[i-1],i));
    }
};

/*   grille perso */

function mycarousel_getItemHTML_grilleperso(item,num)
{   grille_counter++;
programme_html="";
programme=eval('programme'+item.title);
programme_moment=eval('programme_moment'+item.title);
var  max_tmpprogramme=0;
 var count_images=0;
 var max_count_images=0;
for(i=0;i<=programme.length-1;i++){
max_tmpprogramme++;
 programme_html+= "<p class=\"unite-programme ";  // focus-programme lorsque le programme est affiché avec un fd orange
	if(programme[i][6]==1 ){ programme_html+=" focus-programme"; }
	 programme_html+= "\">";
 /* image titre si image presente */
  if( programme[i][1]!=""){programme_html+= "<a href=\""+programme[i][2]+"\"><img src=\""+programme[i][1]+"\" alt=\""+programme[i][0]+"\" class=\"capture-tv-grille\" /></a><br/>"; }
    programme_html+="<font class=\"gras gris-clair\">"+programme[i][3].substr(0,2)+":"+ programme[i][3].substr(2,2)+"</font><br/>"+
                 "<a href=\""+programme[i][2]+"\" class=\"noir gras\">"+ programme[i][0]+"</a><br/>"+
				 "<font class=\"couleur-thematique-"+get_program(programme[i][4],'type')+" gras caps1\">"+get_program(programme[i][4],'text');
				 //programme[i][4]
     programme_html+="</font></p>";
 /*separateur sauf dernier element */
  	if( i!=(programme.length-1)){ programme_html+="<hr class=\"separateur_programme\"/>"; }

	}
 maxprogramme=Math.max(maxprogramme,max_tmpprogramme);// nbre max de lignes de programme
	max_count_images=Math.max(count_images,max_count_images);
	
	var max_tmpprogramme_moment=0;
	 programme_moment_html="";
	 var num_moment=1;
for(i=0;i<=programme_moment.length-1;i++){	
    max_tmpprogramme_moment++;
	programme_moment_html+= "<p class=\"unite-programme ";  // focus-programme lorsque le programme est affiché avec un fd orange
	if(programme_moment[i][6]==1 ){ programme_moment_html+=" focus-programme"; }
	 programme_moment_html+= "\">";
	programme_moment_html+="<font class=\"gras gris-clair\" >"+programme_moment[i][3].substr(0,2)+":"+ programme_moment[i][3].substr(2,2)+"</font><br/>"+
                           "<a href=\"#\" class=\"noir gras\">"+ programme_moment[i][0]+"</a><br/>"+
				           "<font class=\"couleur-thematique-"+get_program(programme_moment[i][4],'type')+" gras caps1\">"+get_program(programme_moment[i][4],'text');
    programme_moment_html+="</font></p>";
    /*separateur sauf dernier element */
  	if( i!=(programme_moment.length-1)){ programme_moment_html+="<hr class=\"separateur_programme\"/>"; }
	num_moment++;
}
	maxprogramme_moment=Math.max(maxprogramme_moment,max_tmpprogramme_moment);// nbre max de lignes de programme

 
 
    if(grille_counter==1){div_encemoment='<div class="titre-article noir titre-incruste" ><h4>EN CE MOMENT</h4></div>';
							div_plagetitre='<div class="titre-article noir titre-plage clear-both" ><h4>LA SOIREE</h4></div>';}
	else{div_encemoment='';div_plagetitre='';}
	
  return '<style>.grille-generale{height:'+((maxprogramme * 100+15)+(max_count_images*1)*110)+'px;}'+
				'.grille-en-ce-moment{height:'+(maxprogramme_moment * 55+15)+'px;}</style>'+
          '<div class="carousel-titre-chaine" >'+
	         '<div class="encart_picto">'+
		       '<img src="' +rep_chaines+ item.url + '" width="56" height="42" alt="' + item.title + '" />' +
	           '<div class="numero_canal">'+item.canal+'</div>'+
			 '</div>'+
	       '<font class="lien_grille_chaine noir gras"><a href="'+item.url_semaine+'" class="lien-noir10 noir souligne gras" >Voir la semaine</a></font></div>' +
	       '<div class="detail_programme_chaine grille-generale" >'+div_plagetitre+programme_html+'</div>'+
		   '<div class="grille-en-ce-moment" id="grille-moment-'+num+'">'+div_encemoment+programme_moment_html+'</div>';
};


function mycarousel_itemLoadCallback_grilleperso(carousel, state)
{
    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > mycarousel_itemList.length) {
            break;
        }

        carousel.add(i, mycarousel_getItemHTML_grilleperso(mycarousel_itemList[i-1],i));
    }
};
  
function mycarousel_itemLoadCallback(carousel, state)
{
    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > mycarousel_itemList.length) {
            break;
        }

        carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[i-1],i));
    }
};

function mycarousel_itemLoadCallback2(carousel, state,grille)
{
   itemList=mycarousel_itemList2;
 if(grille==1){ itemList=mycarousel_itemList;}
 else if(grille==2){ itemList=mycarousel_itemList2;};

    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > itemList.length) {
            break;
        }

        carousel.add(i, mycarousel_getItemHTML(itemList[i-1],i));
		
    }
};


  
  function reloadcarousel(id_carousel){
   // liste de données et fonction a appeller en fct de l'id carousel
   // necessite X fonctions mycarousel_itemLoadCallback predefinies
   itemList= mycarousel_itemList2
   
   loadfunction= 'mycarousel_itemLoadCallback2' ;
   document.getElementById('mycarousel').innerHTML='';
    jQuery('#mycarousel').jcarousel({
        size: itemList.length,
        itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback2}
    });
	
}



/**********************************************************************************/
/************ Fonctions pour le drag and drop des chaines *************************/
/**********************************************************************************/
function set_image(num,id,nom){
	obj=document.getElementById(id);
	title=obj.title;
	nom=trim(nom.toString());
	imgsrc=$("#"+nom).attr("src");
	$("#"+id).html("<div class=\"image-chaine\"><img src="+imgsrc+" /></div><div class=\"ico-suppr\" id=\"ico-suppr"+num+"\" ><a title=\"supprimer\" href=\"javascript:suppr_chaine('"+id+"','"+nom+"');\" id=\"suppr_"+id+"\" class=\"tooltip\"><img src=\""+sImageFront+"/design/front_office_canalsat_v4/img/02_grille_tv/ico-suppr.png\" alt=\"supprimer\"/><span>Supprimer</span></a></div>");
    $("li."+nom).css("background-image","url("+sImageFront+"/design/front_office_canalsat_v4/img/02_grilletv_bloc-panarama/fond-chaine-selectionnee.png)");
    $("li."+nom).draggable('disable');
	set_zone_drop(idcount);
}
		
function suppr_chaine(idchaine,nomchaine){
	$("#"+idchaine).remove();
	$("li."+nomchaine).css("background-image","url('')");
	$("li."+nomchaine).draggable('enable');
	set_zone_drop(idcount);
}
		
function set_zone_drop(num){ 
 //nbre d'elt par ligne (3)
 tmpheight=(150+ Math.floor(num/3)*64)+'px';
 document.getElementById('selection-chaines').style.height=tmpheight
 }
 
 
/**********************************************************************************/
/************ fct jquery *************************/
/**********************************************************************************/

		
$(document).ready(function(){
	$(".contenu-theme-grille").hide();
	$(".premier-contenu").show();
	$(".titre-theme-grille").toggle(function() {
		$(this).addClass("active");
	}, function () {
		$(this).removeClass("active");
	});
	$(".premier-titre").toggle(function(){
		$(this).removeClass("active");//alert('jsquery toggle premier-titre ON');
	}, function () {
		$(this).addClass("active");//alert('jsquery toggle premier-titre OFF');
	});
	$(".titre-theme-grille").click(function(){
		$(this).next(".contenu-theme-grille").slideToggle("slow", function(){
		positionnementGrilleTV();
		});
	});
});if(typeof(sso_cookie)=='undefined'){
	var sso_cookie;
}if(typeof(subscriberToken)=='undefined'){
	var subscriberToken;
}if(typeof(authentif)=='undefined'){
	var authentif = 0;
}if(typeof(logue)=='undefined'){
	var logue = 0;
}if(typeof(abonne)=='undefined'){
	var abonne = 0;
}if(typeof(abonne_webtv)=='undefined'){
	var abonne_webtv;
}if(typeof(abonne_declaratif)=='undefined'){
	var abonne_declaratif;
}if(typeof(authentif_light)=='undefined'){
	var authentif_light = 0;
}if(typeof(nivGamme)=='undefined'){
	var nivGamme;
}if(typeof(aboCplus)=='undefined'){
	var aboCplus;
}if(typeof(OldAbonne)=='undefined'){
	var OldAbonne;
}if(typeof(aboCplusNonEligible)=='undefined'){
	var aboCplusNonEligible;
}if(typeof(aboCSATNonEligible)=='undefined'){
	var aboCSATNonEligible;
}if(typeof(aboCSATSansPack)=='undefined'){
	var aboCSATSansPack;
}if(typeof(aboCoupleNonEligible)=='undefined'){
	var aboCoupleNonEligible;
}if(typeof(sso_prenom)=='undefined'){
	var sso_prenom;
}        

var clickOk=0;
var afficheFleche=0;

$.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = $.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

var isSafari = false;
var isSafari3 = false;
var isSafari4 = false;
var isIE = false;
var isIE6 = false;
var isIE7 = false;
var isIE8 = false;
var isMozilla = false;
var isOpera = false;
var isChrome = false;
var isMac = false;
var tableau = new Array();

function browserTest() {
	/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ some simple browser testing */
	// are we on a Mac ?
	if (navigator.appVersion.indexOf("Mac")!=-1) {
		isMac = true;
		$('body').addClass("isMac");
	}
	function searchVersion(browser) {
		var dataString = navigator.userAgent;
		var index = dataString.indexOf(browser);
		if (index == -1) return;
		var bVersion = parseFloat(dataString.substring(index+browser.length+1));
		return bVersion.toString().split(".")[0];
	}
	// Safari versioning
	isSafari = $.browser.safari;
	if (isSafari) {
		$('body').addClass("isSafari");
		version = searchVersion("Version") || + "";
		$('body').addClass("isSafari"+version);
		isSafari3 = (version == 3) ? true : false;
		isSafari4 = (version == 4) ? true : false;
	}
	// IE versioning
	isIE = $.browser.msie;
	if (isIE) {
		$('body').addClass("isIE");
		version = searchVersion("MSIE") || "";
		$('body').addClass("isIE"+version);
		isIE6 = (version == 6) ? true : false;
		isIE7 = (version == 7) ? true : false;
		isIE8 = (version == 8) ? true : false;
	}
	// Mozilla versioning
	isMozilla = $.browser.mozilla;
	if (isMozilla) {
		$('body').addClass("isMozilla");
		version = searchVersion("Firefox") || "";
		$('body').addClass("isMozilla"+version);
	}
	// Opera versioning
	isOpera = $.browser.opera;
	if (isOpera) {
		$('body').addClass("isOpera");
	}
	// Chrome
	if (navigator.userAgent.indexOf("Chrome") != -1) {
		isChrome = true;
		$('body').addClass("isChrome");
	}
}

var userPageSectionState = null;
var playerEmbarque = 0;
var playerEmbarqueWidth = "";
var playerEmbarqueHeight = "";
var playerEmbarqueUrl = "";
var playerEmbarqueInstallUrl = "";
var sPlayer = "";
var playerEmbarqueVars = {};
var playerEmbarqueParams = { bgcolor:"#000000", menu:"true", allowFullScreen:"true", allowScriptAccess:"always", wmode:"opaque" };
var playerEmbarqueAttributes = { id:"CanalPlayerEmbarque", name:"CanalPlayerEmbarque" };
//-------------------------------------------------------------------------------------------------------------------------
// Player embarque
//-------------------------------------------------------------------------------------------------------------------------
function switchPlayerEmbarque(videoId, playerId, param, env) {
	if	(typeof playerId == "string" && playerId != ""){
		playerEmbarqueAttributes.id = playerId;
		playerEmbarqueAttributes.name = playerId;
		sPlayer = playerId;
	}else{
		sPlayer = "CanalPlayerEmbarque";
	}
	if(typeof param == "string"){
		playerEmbarqueVars.param = param;
	}
	if(typeof env == "string" && env != ""){
		playerEmbarqueVars.env = env;
	}
	if (playerEmbarque == 1 && sPlayer == "CanalPlayerEmbarque") {
		document.getElementById("CanalPlayerEmbarque").chargeVideoPlay(videoId);
	} else {
		playerEmbarque = 1;
		playerEmbarqueVars.videoId = videoId;
		swfobject.embedSWF(playerEmbarqueUrl, sPlayer, playerEmbarqueWidth, playerEmbarqueHeight, "9.0.28", playerEmbarqueInstallUrl, playerEmbarqueVars, playerEmbarqueParams, playerEmbarqueAttributes);
		
		timecode = 0;
	}
}
//-------------------------------------------------------------------------------------------------------------------------
// layers Identification / Inscription
//-------------------------------------------------------------------------------------------------------------------------

function inscriptionFunctions() {

	// premiere visite
    $('.lien-popin-premierevisite').unbind('click');
	$('.lien-popin-premierevisite').click(function(e) {
			e.preventDefault();
			_href = $(this).attr('href');
			$.modal.close();
			$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
			$('#premierevisite').html('');
			$('#identification').html('');
			$('#mdp-oublie').html('');
			positionTop = positionPopupTopIdentif();
			$.ajax({
				url: _href,
				success: function(data) {
					$('#premierevisite').html(data);
					$("#premierevisite").modal({ position: [positionTop]});
				}
			});
    });

	// identification
    $('.lien-popin-identification').unbind('click');
	$('.lien-popin-identification').bind('click', function(e) {
			e.preventDefault();
			_href = $(this).attr('href');
			$.modal.close();
			$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
			$('#premierevisite').html('');
			$('#identification').html('');
			$('#mdp-oublie').html('');
			positionTop = positionPopupTopIdentif();
			$.ajax({
				url: _href,
				success: function(data) {
					$('#identification').html(data);
					$("#identification").modal({
						position: [positionTop],
						onShow: function() {
							if ($('input#email').val()!="") {
								$('input#mdp').trigger('focus');
							}
						}
					});
				}
			});
    });
    
	// identification
   
	 // identification foot+
	$('.lien-popin-identification-footplus').unbind('click');
	$('.lien-popin-identification-footplus').click(function(e) {
		e.preventDefault();
		_href = $(this).attr('href');
		$.modal.close();
		$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
		$('#premierevisite').html('');
		$('#identification').html('');
		$('#mdp-oublie').html('');
		positionTop = positionPopupTopIdentif();
		$.ajax({
			url: _href,
			success: function(data) {
				$('#identification').html(data);
				$("#identification").modal({position: [positionTop]});
			}
		});
   });
	
	// alerte foot+
	$('.lien-popin-alerte-footplus').unbind('click');
	$('.lien-popin-alerte-footplus').click(function(e) {
		e.preventDefault();
		_href = $(this).attr('href');
		$.modal.close();
		$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
		$('#premierevisite').html('');
		$('#identification').html('');
		$('#mdp-oublie').html('');
		positionTop = positionPopupTopIdentif();
		$.ajax({
			url: _href,
			success: function(data) {
				$('#identification').html(data);
				$("#identification").modal({position: [positionTop]});
			}
		});
	});
	 
	//mdp-oublie
    $('.lien-popin-mdp-oublie').unbind('click');
	$('.lien-popin-mdp-oublie').click(function(e) {
			e.preventDefault();
			_href = $(this).attr('href');
			$.modal.close();
			$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
			$('#premierevisite').html('');
			$('#identification').html('');
			$('#mdp-oublie').html('');
			positionTop = positionPopupTopIdentif();
			$.ajax({
				url: _href,
				success: function(data) {
        			$('#mdp-oublie').html(data);
					$("#mdp-oublie").modal({position: [positionTop]});
				}
			});

    });

    //inscription
    $('.lien-popin-inscription').unbind('click');
    $('.lien-popin-inscription').click(function(e) {
			e.preventDefault();
			_href = $(this).attr('href');
			$.modal.close();
			$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
			$('#premierevisite').html('');
			$('#identification').html('');
			$('#mdp-oublie').html('');
			positionInscription = positionPopupTopInsc();
			$.ajax({
				url: _href,
				success: function(data) {
        			$('#inscription').html(data);
        			$("#inscription").modal({position: [positionInscription]});
				}
			});

    });

    //confirmation inscription
    $('.lien-popin-inscription-confirm').unbind('click');
    $('.lien-popin-inscription-confirm').click(function(e) {
			e.preventDefault();
			_href = $(this).attr('href');
			$.modal.close();
			$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
			$('#premierevisite').html('');
			$('#identification').html('');
			$('#mdp-oublie').html('');
			positionTop = positionPopupTopIdentif();
			$.ajax({
				url: _href,
				success: function(data) {
					$('#inscription-validee').html(data);
					$("#inscription-validee").modal({position: [positionTop]});
				}
			});
    });

    //confirmation mdp-oublie
    $('.lien-popin-mdp-confirm').unbind('click');
    $('.lien-popin-mdp-confirm').click(function(e) {
			e.preventDefault();
			_href = $(this).attr('href');
			$.modal.close();
			$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
			$('#premierevisite').html('');
			$('#identification').html('');
			$('#mdp-oublie').html('');
			positionTop = positionPopupTopIdentif();
			$.ajax({
				url: _href,
				success: function(data) {
					$('#mdp-oublie-validee').html(data);
					$("#mdp-oublie-validee").modal({position: [positionTop]});
				}
			});
    });

}

// cache / affiche champ numero client
function show_chp_numclient(){
	$('label[for="noclient"]').show().next('input').show().next('label').show().next('a').show();
}
function hide_chp_numclient(){
	$('label[for="noclient"]').hide().next('input').hide().next('label').hide().next('a').hide();
	$("#noclient").val('');
	// reset message numero client
	showValidity('noclient');
	clearMessage('noclient');
	// reset message code postal et relance le test simple
	showValidity('code');
	clearMessage('code');
	if($(".code").val() != '') checkField('codePostalSeul',$(".code"));
}
$(document).ready(function(){
	if($(".abonne1").checked){
		hide_chp_numclient();
	}
});

// cache layer confirmation inscription
function Hide_form_validee(){
    $.modal.close();
 }

//-------------------------------------------------------------------------------------------------------------------------
// Header Identification
//-------------------------------------------------------------------------------------------------------------------------

// ajax pour le bloc identification du header
function identificationHeader(pid, from, errorCode) {
	$.ajax({   
		type: 'GET',
		data : 'pid=' + pid + '&from=' + from + '&errorCode=' + errorCode + '&authentif=' + authentif + '&logue=' + logue + '&sso_prenom=' + (authentif?encodeURIComponent(sso_prenom):""),
		url: '/ajax/private/inscription/identification_header.ajax.php',
		success: function(data) {
			$('div#header div#identifiant').html(data);
			inscriptionFunctions();
		}
	});
}

/* affiche le input text et cache le input password*/
function showLibellePasswordInput() {
	if( $('#SUBSCRIBER_PASSWORD_HEADER').val() == ''){
		$('#LIBELLE_PASSWORD_HEADER').val("Mot de passe");
		$('#SUBSCRIBER_PASSWORD_HEADER').hide();
		$('#LIBELLE_PASSWORD_HEADER').show();
	}
}

/* cache le input text et affiche le input password*/
function hideLibellePasswordInput() {
	$('#LIBELLE_PASSWORD_HEADER').hide();
	$('#SUBSCRIBER_PASSWORD_HEADER').show();
	$('#SUBSCRIBER_PASSWORD_HEADER').focus();
}

/* cache la value de input mail*/
function hideLibelleEmailInput() {
	if( $('#SUBSCRIBER_EMAIL_HEADER').val() == "E-mail"){
		$('#SUBSCRIBER_EMAIL_HEADER').val("");
	}
}

/* affiche la value de input mail*/
function showLibelleEmailInput(){
	if( $('#SUBSCRIBER_EMAIL_HEADER').val() == ''){
		$('#SUBSCRIBER_EMAIL_HEADER').val("E-mail");
	}
}
/* controle identification header */
function checkIdentificationHeader(){
	if( $('#SUBSCRIBER_EMAIL_HEADER').val() == '' ){
		alert('Vous devez entrer votre adresse email');
		return false;
	}else if(!isMail($('#SUBSCRIBER_EMAIL_HEADER').val())){
		alert('Vous devez entrer votre adresse email valide');
		return false;
	}
	if( $('#SUBSCRIBER_PASSWORD_HEADER').val() == '' ){
		alert('Vous devez entrer votre mot de passe');
		return false;
	}
	return true;
}

/* ouverture du layer d'identification au clic sur un lien de la navigation secondaire */
function identificationNavigation(urlLayer){
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$.ajax({
		url: urlLayer,
		success: function(data) {
			$('#identification').html(data);
			$('#identification').modal({ position: [200]});
		}
	});
}

/* ouverture du layer premiere visite au clic sur un lien de la navigation secondaire */
function premiereVisiteNavigation(urlLayer){
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$.ajax({
		url: urlLayer,
		success: function(data) {
			$('#premierevisite').html(data);
			$('#premierevisite').modal({ position: [200]});
		}
	});
}

/* ouverture du layer d'inscription au clic sur un lien de la navigation secondaire */
function inscriptionNavigation(urlLayer){
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$.ajax({
		url: urlLayer,
		success: function(data) {
			$('#inscription').html(data);
			$('#inscription').modal({ position: [200]});
		}
	});
}

//-------------------------------------------------------------------------------------------------------------------------
// Header Navigation
//-------------------------------------------------------------------------------------------------------------------------
$(document).ready(function() {
	/*
    $(".premier-contenu").show();
	
    $(".titre-theme").toggle(function() {
        $(this).addClass("active");
    }, function() {
        $(this).removeClass("active");
    });
	
    $(".premier-titre").toggle(function() {
        $(this).removeClass("active");
    }, function() {
        $(this).addClass("active");
    });

    $(".titre-theme").click(function() {
        $(this).next(".contenu-theme-header").slideToggle("slow,");
    });*/
});

function refresh_fonts() {
	Cufon.refresh('#navigation ul li a');
    /*Cufon.replace('#bouton-menu-grillesTV', { hover: true, fontFamily: 'Canal+ italic 700' });
    Cufon.replace('#bouton-menu-actus', { hover: true, fontFamily: 'Canal+ italic 700' });
    Cufon.replace('#bouton-menu-chaines', { hover: true, fontFamily: 'Canal+ italic 700' });
    Cufon.replace('#bouton-menu-offre', { hover: true, fontFamily: 'Canal+ italic 700' });
    Cufon.replace('#bouton-menu-moncsat', { hover: true, fontFamily: 'Canal+ italic 700' });*/
}

var grillesTV_shown = false;
var actus_shown = false;
var chaines_shown = false;
var offre_shown = false;
var moncsat_shown = false;




function texte_recherche(obj,vis){
	default_str="Rechercher";
 	if(vis=="off"){
 		tmp_obj_value=obj.value;
 		obj.value="";
 	}else if(vis=="on" && (obj.value)==""){
 		obj.value= tmp_obj_value;
 	}
}



//-------------------------------------------------------------------------------------------------------------------------
// Footer Navigation
//-------------------------------------------------------------------------------------------------------------------------
function footerNavigation() {
	if($("#navigation_secondaire li.li-nav")){
		$("#navigation_secondaire li.li-nav").live('click',function(e) {
			e.preventDefault();
			var href = $(this).find("a").attr("href");
			if (href != "#" && href != "" && href != undefined && !$(this).find('a').hasClass('lien-popin-identification') && !$(this).find('a').hasClass('lien-popin-identification-webtv')) {
				window.location = href;
				return false;
			}else if($(this).find('a').hasClass('lien-popin-identification')){
				e.preventDefault();
				$.modal.close();
				$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
				$('#premierevisite').html('');
				$('#identification').html('');
				$('#mdp-oublie').html('');
				positionTop = positionPopupTopIdentif();
				$.ajax({
					url: href,
					success: function(data) {
						$('#identification').html(data);
						$("#identification").modal({
							position: [positionTop],
							onShow: function() {
								if ($('input#email').val()!="") {
									$('input#mdp').trigger('focus');
								}
							}
						});
					}
				});
			}else if($(this).find('a').hasClass('lien-popin-identification-webtv')){
				e.preventDefault();
				$.modal.close();
				$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
				$('#premierevisite').html('');
				$('#identification-webtv').html('');
				$('#mdp-oublie').html('');
				$('#controle-acces-webtv').html('');
				$('#inscription').html('');
				positionTop = positionPopupTopIdentif();
				$.ajax({
					url: href,
					success: function(data) {
						$('#identification-webtv').html(data);
						$("#identification-webtv").modal({position: [320], escClose:false, 
							overlayId : "identifLiveTv" ,
							onShow:function (dialog) { 
							 ShadowModal('#identification-webtv', "#identifLiveTv"); 
						   } 
						});
					}
				});
			}
		});
	}
	if(logue == 1 && abonne == 1 && authentif_light !=1){
		$('#navigation_footer_nonlogue').addClass("columns_off").removeClass("columns_on");
		$('#navigation_footer_logue_strong').addClass("columns_on").removeClass("columns_off");
	}else if(logue == 1 && authentif_light ==1){
		$('#navigation_footer_nonlogue').addClass("columns_off").removeClass("columns_on");
		$('#navigation_footer_logue_light').addClass("columns_on").removeClass("columns_off");
	}else if(logue == 1 && (abonne == 0 || abonne_declaratif == 1)){
		$('#navigation_footer_nonlogue').addClass("columns_off").removeClass("columns_on");
		$('#navigation_footer_prospect').addClass("columns_on");
		$('#navigation_footer_prospect').removeClass("columns_off");
	}
}

//-------------------------------------------------------------------------------------------------------------------------
// UserPageElementState
//-------------------------------------------------------------------------------------------------------------------------
function UserPageElementState(page) {
	this.cookieName = "userElementCookieState_";
	this.page = page;
	this.aEls = new Array();

	this.cookie = null;
	this.init = function() {
		this.cookie = $.cookie(this.cookieName + this.page);
		if(this.cookie && this.cookie != "") {
			var aElsTmp = this.cookie.split("|");
			for(i=0; i<aElsTmp.length; i++){
				var tmp = aElsTmp[i].split(":");
				this.aEls[tmp[0]]= tmp[1];
			}
		}
	};
	this.updateValue = function(id,value) {
		this.aEls[id] = value;
		var tmp = "";
		for (var key in this.aEls) {
			tmp += key + ":" + this.aEls[key] + "|";
		}
		$.cookie(this.cookieName + this.page, tmp, { expires: 30});
	};

}

//-------------------------------------------------------------------------------------------------------------------------
// positionPopup
//-------------------------------------------------------------------------------------------------------------------------
function positionPopup(id) {

	var windowHeight = $(window).height();
	var scrollTop = $(window).scrollTop();
	if ((screen.width>1024) && (screen.height>768))
	{
		var mid = scrollTop + Math.floor(windowHeight / 2) - 300;
	}else{
		var mid = scrollTop + Math.floor(windowHeight / 2) - 200;
	}
	return mid;
}

function positionPopupTopIdentif(id) {

	var scrollTop = $(window).scrollTop();
	var mid = scrollTop + 200;
	return mid;
}

function positionPopupTopInsc(id) {

	var scrollTop = $(window).scrollTop();
	var mid = scrollTop + 110;
	return mid;
}
function positionBreve(id) {

	var scrollTop = $(window).scrollTop();
	var mid = scrollTop + 200;
	return mid;
}
//-------------------------------------------------------------------------------------------------------------------------
// HOME
//-------------------------------------------------------------------------------------------------------------------------
var timeout;
var timeoutOnglet;
/* Home Top */
function HomeInitHomeTop() { (function () {
		$.fn.programme = function () {
			var c = $(this);
			var f = c.children('div.data');
			var n = f.length;
			timeout = 6000;
			timeoutOnglet = 6000;
			$(f).hide();
			$(f[0]).show().addClass('active');
			/*var model1home = $('.data.model1');
			var longueurhome = model1home.length;
			if(longueurhome != 0){
				theme($('div.data.active', c));
			}*/
			theme($('div.data.active', c));
			checkArrow();
			checkSemaine();
			//time();
			c.hover(function(){
				$(this).addClass('hover');
				var g = $('div.data.active', c).attr('class').replace(/data/, '').replace(/active/, '').replace(/ /, '').replace(/header1/, '').replace(/header2/, '').replace(/header3/, '').replace(/header4/, '').replace(/header5/, '');
				
				if(trim(g) == "model1"){
					window.clearTimeout(timeout);
				}else{
					window.clearTimeout(timeoutOnglet);
				}
			},function(){
				$(this).removeClass('hover');
				var u = $('div.data.active', c).attr('class').replace(/data/, '').replace(/active/, '').replace(/ /, '').replace(/header1/, '').replace(/header2/, '').replace(/header3/, '').replace(/header4/, '').replace(/header5/, '');
				if(trim(u) == "model1"){
					time();
				}else{
					timeOnglet();
				}			
			});
			$('a.next', c).click(function () {
				next();
				return false;
			});
			$('a.back', c).click(function () {
				back();
				return false;
			});
			$('.navigationOnglets li').click(function () {
				navig($(this));
				return false;
			});
			$('.data.model2 ul li', c).click(function () {
				semaine($(this));
				return false;
			});
			function next() {
				window.clearTimeout(timeout);
				var e = $('div.data.model1.active', c);
				var f = e.next('.model1:first');
				off(e);
				on(f);
			}
			function back() {
				window.clearTimeout(timeout);
				var e = $('div.data.model1.active', c);
				var f = e.prev('.model1:first');
				off(e);
				on(f);
			}
			function navig(b) {
				var t = $(b).attr('class').replace(/data/, '').replace(/active/, '').replace(/ /, '').replace(/model1/, '').replace(/model2/, '').replace(/model3/, '').replace(/model4/, '').replace(/model5/, '');
				off($('.data.active', c));
				on($('.data.' + t + ':first', c));
			}
			function off(e) {
				e.removeClass('active').fadeOut('normal', function () {})
			}
			function on(e) {
				e.addClass('active').fadeIn('normal', function () {
					checkArrow();
					theme($('div.data.active', c));
				})
			}
			function checkArrow() {
				if ($('.data.active').is('div.model1')) {
					var e = $('.data.model1');
					var n = e.length;
					if (e.index($('.data.model1.active')) == 0) $('a.back', c).hide();
					else $('a.back', c).show();
					if (e.index($('.data.model1.active')) == n - 1) $('a.next', c).hide();
					else $('a.next', c).show();
					time();					
				} else {
					window.clearTimeout(timeout);
					$('a.next,a.back', c).hide();
				}
			}
			function theme(e) {
				var t = e.attr('class').replace(/data/, '').replace(/active/, '').replace(/ /, '').replace(/model1/, '').replace(/model2/, '').replace(/model3/, '').replace(/model4/, '').replace(/model5/, '');
				var s = '.navigationOnglets li.' + t;
				var longueur = $('.navigationOnglets li span.bouton-nav').length;
				$('.navigationOnglets li').each(function (index) {
					if(index == longueur - 1){
						var a = $('span.bouton-nav', this).css('background-image').replace(/-big-on.gif/, '-big-off.gif').replace(/-big-on.png/, '-big-off.png');
					}else{
						var a = $('span.bouton-nav', this).css('background-image').replace(/-on.gif/, '-off.gif').replace(/-on.png/, '-off.png');
					}
					$('span.bouton-nav', this).css('background-image', a)
					$('span.bouton-nav', this).css('color', "#bcbcbe")
					Cufon.replace('#home_top .navigationOnglets .bouton-nav', { fontFamily: 'CanalBoldRomain' });		
				});
				var ElementActif = e.attr('class').replace(/data/, '').replace(/active/, '').replace(/ /, '').replace(/model1/, '').replace(/model2/, '').replace(/model3/, '').replace(/model4/, '').replace(/model5/, '').replace(/data/, '').replace(/active/, '').replace(/header/, '');
				if(ElementActif == longueur){
					var b = $('span.bouton-nav', s).css('background-image').replace(/-big-off.gif/, '-big-on.gif').replace(/-big-off.png/, '-big-on.png');
				}else{
					var b = $('span.bouton-nav', s).css('background-image').replace(/-off.gif/, '-on.gif').replace(/-off.png/, '-on.png');
				}
				$('span.bouton-nav', s).css('background-image', b)
				$('span.bouton-nav', s).css('color', "#fff")
				Cufon.replace('#home_top .navigationOnglets .bouton-nav', { fontFamily: 'CanalBoldRomain' });
				var Onglet = e.attr('class').replace(/data/, '').replace(/active/, '').replace(/ /, '').replace(/data/, '').replace(/active/, '').replace(/header1/, '').replace(/header2/, '').replace(/header3/, '').replace(/header4/, '').replace(/header5/, '');
				window.clearTimeout(timeoutOnglet);
				if(trim(Onglet) != "model1"){
					timeOnglet();
				}
			} 
			function ChangementOnglet(){
				var e = $('.navigationOnglets li');
				var n = e.length;
				var t = $('div.data.active').attr("class").replace(/data/, '').replace(/active/, '').replace(/ /, '').replace(/model1/, '').replace(/model2/, '').replace(/model3/, '').replace(/model4/, '').replace(/model5/, '').replace(/data/, '').replace(/active/, '').replace(/header/, '');
				if(t == n){
					 $('li.header1').trigger('click');
				}else{					
					var i =  parseInt(t)+1;
					$('li.header'+i).trigger('click');
				}
			}
			function triggerclick() {
				var e = $('.data.model1');
				var n = e.length;
				if(n>1){
				if (e.index($('.data.model1.active')) == n - 1) {
					ChangementOnglet();
				} else 
					$('a.next', c).trigger('click');
				}
			}
			function timeOnglet(){				
				timeoutOnglet = setTimeout(ChangementOnglet, 6000);
			}
			function time() {
				timeout = setTimeout(triggerclick, 6000);
			}
			function checkSemaine() {
				$('.data.model2 > div', c).hide();
				$('.data.model2 ul li', c).each(function () {
					if ($(this).hasClass('active')) {
						var e = $(this).attr('class').replace(/active/, '').replace(/ /, '');
						$('.data.model2 > div.' + e, c).show();
					} else {
						$('.data.model2 ul li.bloc1', c).addClass('active');						
						$('.data.model2 > div.bloc1', c).show();
					}					
				})				
			}
			function semaine(e) {
				$('.data.model2 > div', c).hide();
				$('.data.model2 ul li', c).removeClass('active');
				var f = e.attr('class').replace(/active/, '').replace(/ /, '');
				$(e).addClass('active');
				Cufon.replace('.model2 ul li', { fontFamily: 'CanalBoldRomain' });
				$('.data.model2 > div.' + f, c).show()
				window.clearTimeout(timeoutOnglet);
				timeOnglet();
			}
		}
	})();
 
	$('#home_top').programme();
	
}
function StopDefilement(){
	$('#home_top').addClass('hover');
	window.clearTimeout(timeoutOnglet);
	window.clearTimeout(timeout);
}
function trim(myString){
	return myString.replace(/^\s+/g,'').replace(/\s+$/g,'');
}
/* Home Actus */
function HomeInitHomeActus(){
	$('#home_actus .breves .data:last,#home_actus .parolesExperts .data:last').css('borderBottom','0 none');
	$('.home_mea').each(function(){$('.data:last',this).css('marginRight','0');});
}

/* Home Mea */
function HomeInitHomeMea(){
	$('#home_tv .revoir .contenu .data:odd').css('marginRight','0');
	$('#home_tv .revoir .contenu .data:gt(1)').css('borderBottom','0 none');
}

/* Home TV */
function HomeInitHomeTv() { (function () {
		$.fn.defil = function (o) {
			var b = {
				affiche: 4
			};
			var c = $.extend(b, o);
			var d = $(this);
			var e = $('li:not(.top):not(.bottom)', d);
			$(e[0]).addClass('first borderTop');
			$(e[1]).addClass('borderTop');
			$('li.top', d).live('click', function () {
				movetop();
				return false
			});
			$('li.bottom', d).live('click', function () {
				movebottom();
				return false
			});
			function movetop() {
				var l = e.length - 1;
				var r = e.length;
				for (i = 0; i < c.affiche; i++) {
					var a = $('li:not(.top):not(.bottom)', d);
					$(a[l]).insertBefore($('li.first', d));
					$('li.first', d).removeClass('first');
					$('li.borderTop', d).removeClass('borderTop');
					$(a[l]).addClass('first')
				}
				$('li:not(.top):not(.bottom):eq(0)', d).addClass('borderTop')
				$('li:not(.top):not(.bottom):eq(1)', d).addClass('borderTop')
			}
			function movebottom() {
				var l = e.length - 1;
				for (i = 0; i < c.affiche; i++) {
					var a = $('li:not(.top):not(.bottom)', d);
					$('li.borderTop', d).removeClass('borderTop');
					$(a[0]).insertAfter($(a[l], d)).removeClass('first')
				}
				$('li:not(.top):not(.bottom):eq(0)', d).addClass('first borderTop')
				$('li:not(.top):not(.bottom):eq(1)', d).addClass('borderTop')
			}
		}
	})();
	(function () {
		$.fn.onglet = function () {
			var b = $(this);
			var PlayerActif = false;
			var f = b.children('div:not(.onglets)');
			f.hide();
			var a = $('.onglets ul li.active', b).attr('class').replace(/active/, '').replace(/ /, '');
			$('.' + a, b).show();
			
			$('.onglets ul li').click(function () {
				action($(this));
				/*var k = $(this).attr("class").replace(/active/, '');
				
				if(trim(k) == 'onglet2' && PlayerActif == false){
					if(authentif == 0 || abonne_webtv == 0){
						InitPlayerEnDirect()
						PlayerActif = true;
					}
				}*/
				/*if (document.getElementById("CanalsatPlayerEmbarque1")) {
					if (typeof document.getElementById('CanalsatPlayerEmbarque1').playerStop == "function") {
						document.getElementById("CanalsatPlayerEmbarque1").playerStop();
					}
				}
				if (document.getElementById("CanalsatPlayerEmbarque2")) {
					if (typeof document.getElementById('CanalsatPlayerEmbarque2').playerStop == "function") {
						document.getElementById("CanalsatPlayerEmbarque2").playerStop();
					}
				}
				if (document.getElementById("CanalsatPlayerEmbarque3")) {
					if (typeof document.getElementById('CanalsatPlayerEmbarque3').playerStop == "function") {
						document.getElementById("CanalsatPlayerEmbarque3").playerStop();
					}
				}
				*/
				return false
			});
			function action(e) {
				f.hide();
				$('.onglets ul li', b).removeClass('active');
				
				e.addClass('active');
				var g = e.attr('class').replace(/active/, '').replace(/ /, '');
				$('.' + g, b).show();
				i = g.replace('onglet', '');
				if ($('div.onglet'+i).html()=="") {
					cache = '';
					if (i==2 || i==4) {
						cache = 'private/';
					}
					$.ajax({
						url: '/ajax/'+cache+'home/homeTab'+i+'.php',
						data: {
							pid: pid,
							pvid: pvid,
							ztid: ztid
						},
						success: function(data) {
							if (data) {
								$('div.onglet'+i).html(data);
							}
						}
					});
				}
			}
		}
	})();

	$('#home_tv').onglet();
	/*$('#home_tv #direct .list_abo ul').defil({
		affiche: 8
	});*/
	/*$('#home_tv .selection .list ul').defil({
		affiche: 4
	});*/
	/*$('#home_tv .canalplay .list ul').defil({
		affiche: 3
	});*/
	
	/*$("#select_canal_a_la_demande").sSelect().change(function() {
		siteLienExterne('sc_intcmp=CSAT:ACCUEIL:REVOIRCANALSAT:TOUTESLESTHEMATIQUES');
		window.open($(this).getSetSSValue(), "_blank");
		
	});*/
}
/*function InitPlayerEnDirect(){
	$.ajax({
		url: '/ajax/home/init_player_en_direct.php',
		async: false,
		type: 'get',
		dataType: 'text',
		success: function(data){
			if(data != ""){
				if(authentif == 0){
					$('div.player-en-direct-nl').html(data);
				}else{
					$('div.player-en-direct-nw').html(data);
				}
			}
		},
		error: function(){
			alert('Erreur');
		}

	});
}*/
/*
function OngletDirectHome(){
	var cookie_gamme = $.cookie("gamme");
	if(logue != 1 && authentif== 0 && cookie_gamme != "webtv"){
		$('#en_direct_non_logue').addClass("en-direct-visible").removeClass("en-direct-non-visible");
		$('#en_direct_logue_light').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_logue_no_webtv').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv_identifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv_authentifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
	}else if(authentif_light == 1 && cookie_gamme != "webtv"){
		$('#en_direct_non_logue').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_logue_light').addClass("en-direct-visible").removeClass("en-direct-non-visible");
		$('#en_direct_logue_no_webtv').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv_identifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv_authentifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
	}else if(logue == 1 && authentif == 1 && cookie_gamme != "webtv"){
		$('#en_direct_non_logue').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_logue_light').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_logue_no_webtv').addClass("en-direct-visible").removeClass("en-direct-non-visible");
		$('#en_direct_webtv').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv_identifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv_authentifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
	}else if(logue != 1 && authentif== 0 && cookie_gamme == "webtv"){
		$('#en_direct_non_logue').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_logue_light').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_logue_no_webtv').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv').addClass("en-direct-visible").removeClass("en-direct-non-visible");
		$('#en_direct_webtv_identifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv_authentifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
	}else if(authentif_light == 1 && cookie_gamme == "webtv"){
		$('#en_direct_non_logue').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_logue_light').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_logue_no_webtv').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv_identifie').addClass("en-direct-visible").removeClass("en-direct-non-visible");
		$('#en_direct_webtv_authentifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
	}else if(logue == 1 && authentif == 1 && cookie_gamme == "webtv"){
		$('#en_direct_non_logue').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_logue_light').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_logue_no_webtv').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv_identifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv_authentifie').addClass("en-direct-visible").removeClass("en-direct-non-visible");
	}
	/*
	
	if (authentif_light == 1 && cookie_gamme == "webtv"  && logue != 1) {
		$('#en_direct_non_logue').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_logue_light').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv_identifie').addClass("en-direct-visible").removeClass("en-direct-non-visible");
	}else if(authentif== 1 && logue == 1 && abonne == 1 && cookie_gamme == ""){
		$('#en_direct_non_logue').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_logue_light').addClass("en-direct-visible").removeClass("en-direct-non-visible");
		$('#en_direct_webtv_identifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
	}else if(authentif== 1 && logue == 1 && abonne == 1 && cookie_gamme == "webtv"){
		$('#en_direct_non_logue').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv').addClass("en-direct-visible").removeClass("en-direct-non-visible");
		$('#en_direct_logue_light').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv_identifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
	}else if(authentif_light == 1 && cookie_gamme == "" ){
		$('#en_direct_non_logue').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_logue_light').addClass("en-direct-visible").removeClass("en-direct-non-visible");
		$('#en_direct_webtv_identifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
	}	else if(authentif_light == 0 && cookie_gamme == "webtv" && logue != 1){
		$('#en_direct_non_logue').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv').addClass("en-direct-visible").removeClass("en-direct-non-visible");
		$('#en_direct_logue_light').addClass("en-direct-visible").removeClass("en-direct-non-visible");
		$('#en_direct_webtv_identifie').addClass("en-direct-non-visible").removeClass("en-direct-visible");
		$('#en_direct_webtv_non_identifie').addClass("en-direct-visible").removeClass("en-direct-non-visible");
	}
}*/
function refreshEnDirect(){
	$.ajax({
		url: '/ajax/private/home/en_direct.php',
		async: false,
		type: 'get',
		dataType: 'text',
		success: function(data){
			if(data != ""){
				$('div#direct').html(data);
			}else{
				RefreshBoutonInscrire();
			}
		},
		error: function(){
			alert('Erreur');
		}

	});
}

function RefreshBoutonInscrire(){
	$.ajax({
		url: '/ajax/private/home/refresh_bouton_home_direct.php',
		async: false,
		type: 'GET',
		dataType: 'script'

	});
}

function refreshColonne(page_id,page_version,from,error,step,fromlink){

	if(!jQuery.cookie("gamme")){
		var url = "/ajax/private/check_eligibility.php";
		
		jQuery.ajax({
				url: url,
				dataType: "script",
				async:false,
				success: function(){
				if(authentif == 1){
					if (abonne_webtv == 1) {
						jQuery.cookie("gamme", "webtv", { expires: 7300 , path: '/' }); // 20 ans
					} else {
						jQuery.cookie("gamme", "", { expires: 7300 , path: '/' }); // 20 ans
					}
				}
			}
		});	
	}
		
			


		$.ajax({
			url: '/ajax/private/home/load_colonne_home.php',
			async: false,
			type: 'post',	
			data: {page_id:page_id, page_version:page_version, from:from, error:error, step:step,fromlink:fromlink},
			dataType: 'text',
			success: function(data) {
				if(data !="") {
					var totalHtml ='';
					var data1 ='';
					var data2 ='';
					var data3 ='';
					var data4 ='';
					var debdl ='';
					data = eval('('+data+')');
					var debHomeAbonne = '<div id="home_abonne">';
					var ulNavig ='<ul class="onglets"><li class="pas-encore-abo majuscules" ><a href="javascript://" onclick="showNoAbo(\''+data.pid+'\',\''+data.pv+'\',\''+data.from+'\',\''+data.error+'\',\''+data.step+'\');">Pas encore abonn&eacute; ?</a></li><li class="deja-abo majuscules"><a href="#">D&eacute;j&agrave; abonn&eacute;</a></li></ul>';
					var debdata = '<div class="data">';
					var findata = '</div>';
					var finHomeAbonne = '</div>';
					if ((!data.bLogueLight && !data.bLogueFort && data.fromlink) || (!data.bLogueLight && !data.fromlink && data.error != "" && data.error != 10)) {
						var data1 = '<div class="idenfication_home"><h3 class="majuscules">s\'identifier</h3>';
						var data2 = '<form action="'+data.urlCanalsatSecure+'/ajax/private/signon.php" name="fFormIdentification" id="fFormIdentification" method="POST" onsubmit="return checkFormIdentificationHome();" class="gris-fonce"><input type="hidden" name="_step_" id="_step_" value="identification"><input type="hidden" name="_step_from_" id="_step_from_" value="identification"><input type="hidden" name="from" id="from" value="'+data.from+'">';
						if (data.error== 2 && data.step == "") {
							var data3 ='<label id="erreur_auth" for="erreur_auth" class="label120 erreur-home">Compte verrouill&eacute;</label>';
						}
						else {
							var data3 ='';
						}
						if ((data.error == 1 || data.error == 2) && data.step == "") {
							var classerreur = "erreur-home";
							var mdpinvalide = "mot de passe invalide";
							var emailinvalide = "e-mail invalide";
						}
						else {
							var classerreur = "";
							var mdpinvalide = "";
							var emailinvalide = "";
						}
						var data4 = '<label id="emailHome_champs" for="emailHome" class="label120 '+classerreur+'">Entrez votre adresse e-mail : </label><input type="text" id="emailHome" name="SUBSCRIBER_EMAIL" value="" onkeypress="return handleEnterIdentificationHome(\'s\', event)" onfocus="showValidity(\'email\');" onkeypress="return handleEnterIdentificationHome(\'s\', event)" class="input-identification email" style="display:none;"/><input type="text" id="lib_emailHome" name="LIBELLE_EMAIL" value="'+emailinvalide+'" onFocus="hideLibelleEmailInputHome();" class="input-identification gris-fonce '+classerreur+'"/><label id="mdpHome_champs" for="mdpHome" class="label120 '+classerreur+'">Entrez votre mot de passe :</label><input type="password" id="mdpHome" name="SUBSCRIBER_PASSWORD" onkeypress="return handleEnterIdentificationHome(\'s\', event)" onfocus="showValidity(\'mdp\');" onkeypress="return handleEnterIdentificationHome(\'s\', event)" class="input-identification" style="display:none;" /><input type="text" id="lib_mdpHome" name="LIBELLE_PASSWORD" value="'+mdpinvalide+'" onFocus="hideLibellePwdInputHome();" class="input-identification gris-fonce '+classerreur+'"/><a href="/ajax/private/signon.php?_step_=password_oublie_form&from='+data.from+'" class="lien-popin-mdp-oublie gris-clair souligne mdp-home">Vous avez oubli&eacute; votre mot de passe ?</a><input type="submit" class="bouton-ok-home" value="" /></form></div>';
						totalHtml =  debHomeAbonne+ulNavig+debdata+data1+data2+data3+data4;
					}
					else {
						var data1 ='<div class="identite"><p>Bienvenue '+data.firstname+',<br />Profitez pleinement de votre abonnement !</p></div>';
						if (data.aMEA[0] !="") {
							if (data.aMEA[0].flag1 == "2") {
								var data2 ='<div class="bloc"><div class="visuel"><a href="'+data.aMEA[0].url+'"><img src="'+data.mhttp+data.aMEA[0].path+'" alt="" /></a></div>';
								if (data.aMEA[0].path2 != ""){
									var data3 ='<div class="bouton"><a href="'+data.aMEA[0].url2+'"><img src="'+data.mhttp+data.aMEA[0].path2+'" alt="" /></a></div>';
								}
								else {
									var data3 ='';
								}
							}
							else {
								var data2 ='<div class="bloc2"><h3>'+data.aMEA[0].title+'</h3><div class="visuel"><a href="'+data.aMEA[0].url+'"><img src="'+data.mhttp+data.aMEA[0].path+'" alt="visuel" /></a></div><h4><a href="'+data.aMEA[0].url+'" style="color:'+data.aMEA[0].stitle2+'">'+data.aMEA[0].text2+'</a></h4><p><a href="'+data.aMEA[0].url+'">'+data.aMEA[0].text+'</a></p><br><p>'+data.aNavigation.zparams3+'</p>';				
								if (data.aMEA[0].path2 != "") {
									var data4 ='<div class="bouton"><a href="'+data.aMEA[0].url2+'"><img src="'+data.mhttp+data.aMEA[0].path2+'" alt="" /></a></div></div>';
								}
								else {
									var data4 ='</div>';
								}
							}
						}
						totalHtml =  debHomeAbonne+ulNavig+debdata+data1+data2+data3+data4;
					}
					debdl = '<dl>';
					var retour = debdl;
					if ( data.cntn > 0 ) {
						for (i=0;i<data.cntn;i++) {
							if (data.aNavigation.NAVIGATIONS[i].ntitle) {
								if (data.aNavigation.NAVIGATIONS[i].nurl) {
									if (data.aNavigation.NAVIGATIONS[i].nauth) {
										var auth = data.aNavigation.NAVIGATIONS[i].auth;
									}
									else {
										var auth = "";
									}
									retour +='<a title="'+data.aNavigation.NAVIGATIONS[i].ntitle+'" href='+data.aNavigation.NAVIGATIONS[i].nurl+' '+auth+'>';
								}
								retour +='<dt>'+data.aNavigation.NAVIGATIONS[i].ntitle+'';
								if (data.aNavigation.NAVIGATIONS[i].nauth) {
									retour +='<img src="'+data.dhttp+'/img/home/img_secure.png" class="cadenas-nav-droite" alt="S&eacute;curis&eacute;" />';
								}
								retour +='</dt>';
								if (data.aNavigation.NAVIGATIONS[i].nurl) {
									retour +='</a>';
								}
							}
							for(j=0;j<(data.aNavigation.NAVIGATIONS[i].NAVIGATIONS.length);j++) {
								if(data.cgamme == "webtv" && ((data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ncgamme == null || data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ncgamme == "") ||data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ncgamme == 1) && data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].lauth !=3) {
									if(data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nauth != 0) {
										var auth = data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].auth;
										retour +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" '+auth+' style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
									}
									else {
										retour +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" href='+(data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nurl)+' style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
									}
								}
								else if ((data.cgamme == "" || data.cgamme == null) && ((data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ncgamme == 0 || data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ncgamme == null) ||data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ncgamme == 2) && data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].lauth !=3) {
									if (data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nauth != 0) {
										var auth = data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].auth;
										retour +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" '+auth+' style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
									}
									else {
										retour +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" href='+(data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nurl)+' style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
									}
									//flagg&eacute; comme lien web tv
								}
								else if( (((data.cgamme == "" || data.cgamme == null) && ((data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ncgamme == 0 || data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ncgamme == null) ||data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ncgamme == 2)) || (data.cgamme == "webtv" && ((data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ncgamme == 0 || data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ncgamme == null)||data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ncgamme == 1))) && data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].lauth ==3){
									
									if ((data.cgamme == "" || data.cgamme == null) && !data.bLogueLight && !data.bLogueFort) {
										retour +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" href="/ajax/private/signon.php?_step_=identification_form_webtv_no_cg&from='+data.from+'&validationForm='+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nurl+'" class="lien-popin-identification-webtv" style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
										//Sans cookie gamme logu&eacute; light
									}
									else if((data.cgamme == "" || data.cgamme == null) && data.bLogueLight) {
										retour +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" href="/ajax/private/signon.php?_step_=controle_for_no_cg&from='+data.from+'&validationForm='+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nurl+'" class="lien-popin-identification-webtv" style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
										//avec cookie gamme non logu&eacute;
									//Abonn&eacute; OLD C
									}else if(data.cgamme !="webtv" && logue !=0 && abonne ==1 && aboCplusNonEligible == 1 && OldAbonne ==1){
										retour +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" href="'+data.mainhttp+'/ajax/popin_presentation.php?pid='+data.pid+'&popin-livetv=1" class="lien-popin-presentation-webtv" style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
									//Abonn&eacute; Coupl&eacute; OLD 	
									}else if(data.cgamme !="webtv" && logue !=0 && abonne ==1 && aboCoupleNonEligible == 1 && OldAbonne ==1){
										retour +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" href="'+data.mainhttp+'/ajax/popin_presentation.php?pid='+data.pid+'&popin-livetv=1" class="lien-popin-presentation-webtv" style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
										
									//Abonn&eacute; Csat seul sans pack service 	
									}else if(data.cgamme !="webtv" && logue !=0 && abonne ==1 && aboCSATSansPack == 1){ 
										retour +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" href="'+data.mainhttp+'/ajax/popin_presentation.php?pid='+data.pid+'&popin-livetv=1" class="lien-popin-presentation-webtv" style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
									//Sans cookie gamme non logu&eacute;
									}else if(data.cgamme == "webtv" && !data.bLogueLight && !data.bLogueFort) {
										retour +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" href="/ajax/private/signon.php?_step_=identification_form_webtv_cg&from='+data.from+'&validationForm='+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nurl+'" class="lien-popin-controle-acces" style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
										//avec cookie gamme logu&eacute; light
									}
									else if(data.cgamme == "webtv" && data.bLogueLight) {
										retour +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" href="/ajax/private/signon.php?_step_=controle_for_cg&from='+data.from+'&validationForm='+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nurl+'" class="lien-popin-controle-acces" style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
										//tous les autres cas
									}
									else {
										retour +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" href='+(data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nurl)+' style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
									}					
								}
							}
						}
							retour += '</dl>';
							if(data.cntm >0){
								for(k=1;k<data.cntm;k++){
									if (data.aMEA[k].flag1 ==  "2") {
										retour +='<div class="bloc padding-10px"><h3>'+data.aMEA[k].title+'</h3><div class="visuel"><a href="'+(data.aMEA[k].url)+'"><img src="'+data.mhttp+data.aMEA[k].path+'" alt="visuel" /></a></div>';
										if (data.aMEA[k].path2 != "") {
											retour +='<div class="bouton"><a href='+(data.aMEA[k].url2)+'><img src="'+data.mhttp+data.aMEA[k].path2+'" alt="" /></a>	</div>';
										}
										retour +='</div>';
									}
									else {
										if (k==1) {
											var margin = "padding-10px";
										}
										else {
											var margin = "padding-20px";
										}
										retour +='<div class="bloc2-bas '+margin+'"><h3>'+data.aMEA[k].title+'</h3><div class="visuel"><a title="'+data.aMEA[k].title+'" href="'+data.aMEA[k].url+'"><img src="'+data.mhttp+data.aMEA[k].path+'" alt="'+data.aMEA[k].title+'" /></a></div><h4><a title="'+data.aMEA[k].title+'" href="'+data.aMEA[k].url+'" style="color:'+data.aMEA[k].stitle2+'">'+data.aMEA[k].text2+'</a></h4><p><a title="'+data.aMEA[k].title+'" href="'+data.aMEA[k].url+'">'+data.aMEA[k].text+'</a></p>';
										if (data.aMEA[k].path2 != "") {
											retour +='<div class="bouton"><a href="'+(data.aMEA[k].url2)+'"><img src="'+data.mhttp+data.aMEA[k].path2+'" alt="" /></a></div>';
										}
										retour +='</div>';
									}
								}
							}
					}
					totalHtml +=retour;
					totalHtml += findata+finHomeAbonne;
					//totalHtml +='<script type="text/javascript">$(document).ready(function() {PopinWebTv();inscriptionFunctions();});</script>';
					$('div#colonne_home').html(totalHtml);
					PopinWebTv();
					inscriptionFunctions();
					Cufon.replace("#home_abonne .pas-encore-abo, #home_abonne .deja-abo", { fontFamily: "CanalBoldRomain" });
					Cufon.replace("#home_non_abonne .data .bloc  p, #home_abonne .data .bloc  p,#home_abonne .data .bloc2  p.phrase_nav, #home_non_abonne .data .bloc2  p.phrase_nav", { fontFamily: "CanalBoldItalique" });
					Cufon.replace("#home_non_abonne .bloc h3,#home_abonne .bloc h3,#home_non_abonne .bloc2 h3,,#home_abonne .bloc2 h3,#home_abonne .bloc2-bas h3,#home_non_abonne .bloc2-bas h3,#home_non_abonne dl dt, #home_abonne dl dt", { fontFamily: "CanalBoldRomain" });
					Cufon.replace(" #home_non_abonne dd, #home_abonne dd", { fontFamily: "CanalDemiRomain" });
					Cufon.replace("#home_abonne .idenfication_home h3,#home_non_abonne .idenfication_home h3,.model2 ul li", { fontFamily: "CanalBoldRomain"});
				}
				
			},
			error: function(){
				alert('Erreur');
			}
		});
}


function refreshColonne2(page_id,page_version,from,error,step,fromlink){
	
	$.ajax({
		url: '/ajax/private/home/refresh_onglet_abonne.php',
		type: 'post',	
		data: {page_id:page_id, page_version:page_version, from:from, error:error, step:step,fromlink:fromlink},
		dataType: 'text',
		success: function(data){
			
			data = eval('('+data+')');
			if(data.isLogueLight || data.isLogueFort){
				var OngletPasAbo = $('li.pas-encore-abo').css('background-image').replace(/-on.png/, '-off.png');
				var OngletDejaAbo = $('li.deja-abo').css('background-image').replace(/-off.png/, '-on.png');
				$('li.pas-encore-abo').css('background-image',OngletPasAbo);
				$('li.deja-abo').css('background-image',OngletDejaAbo);
			
				$('div#colonne_home #home_non_abonne').attr('id','home_abonne');
				$('div#colonne_home .data').html($('#colonne_home_abonnee').html());
				PopinWebTv();
				inscriptionFunctions();
				Cufon.replace("#home_abonne .pas-encore-abo, #home_abonne .deja-abo", { fontFamily: "CanalBoldRomain" });
				Cufon.replace("#home_non_abonne .data .bloc  p, #home_abonne .data .bloc  p,#home_abonne .data .bloc2  p.phrase_nav, #home_non_abonne .data .bloc2  p.phrase_nav", { fontFamily: "CanalBoldItalique" });
				Cufon.replace("#home_non_abonne .bloc h3,#home_abonne .bloc h3,#home_non_abonne .bloc2 h3,,#home_abonne .bloc2 h3,#home_abonne .bloc2-bas h3,#home_non_abonne .bloc2-bas h3,#home_non_abonne dl dt, #home_abonne dl dt", { fontFamily: "CanalBoldRomain" });
				Cufon.replace(" #home_non_abonne dd, #home_abonne dd", { fontFamily: "CanalDemiRomain" });
				Cufon.replace("#home_abonne .idenfication_home h3,#home_non_abonne .idenfication_home h3,.model2 ul li", { fontFamily: "CanalBoldRomain"});
			}else{
				if(data.error == 2 && data.step == ""){
					var OngletPasAbo = $('li.pas-encore-abo').css('background-image').replace(/-on.png/, '-off.png');
					var OngletDejaAbo = $('li.deja-abo').css('background-image').replace(/-off.png/, '-on.png');
					$('li.pas-encore-abo').css('background-image',OngletPasAbo);
					$('li.deja-abo').css('background-image',OngletDejaAbo);
					$('label#erreur_auth').show();
					$('div#colonne_home #home_non_abonne').attr('id','home_abonne');
					$('div#colonne_home .data').html($('#colonne_home_abonnee').html());
					PopinWebTv();
					inscriptionFunctions();
					Cufon.replace("#home_abonne .pas-encore-abo, #home_abonne .deja-abo", { fontFamily: "CanalBoldRomain" });
					Cufon.replace("#home_non_abonne .data .bloc  p, #home_abonne .data .bloc  p,#home_abonne .data .bloc2  p.phrase_nav, #home_non_abonne .data .bloc2  p.phrase_nav", { fontFamily: "CanalBoldItalique" });
					Cufon.replace("#home_non_abonne .bloc h3,#home_abonne .bloc h3,#home_non_abonne .bloc2 h3,,#home_abonne .bloc2 h3,#home_abonne .bloc2-bas h3,#home_non_abonne .bloc2-bas h3,#home_non_abonne dl dt, #home_abonne dl dt", { fontFamily: "CanalBoldRomain" });
					Cufon.replace(" #home_non_abonne dd, #home_abonne dd", { fontFamily: "CanalDemiRomain" });
					Cufon.replace("#home_abonne .idenfication_home h3,#home_non_abonne .idenfication_home h3,.model2 ul li", { fontFamily: "CanalBoldRomain"});
					
				}
				if((data.error == 1 || data.error == 2) && data.step == ""){
					var OngletPasAbo = $('li.pas-encore-abo').css('background-image').replace(/-on.png/, '-off.png');
					var OngletDejaAbo = $('li.deja-abo').css('background-image').replace(/-off.png/, '-on.png');
					$('li.pas-encore-abo').css('background-image',OngletPasAbo);
					$('li.deja-abo').css('background-image',OngletDejaAbo);
					$('div#colonne_home #home_non_abonne').attr('id','home_abonne');
					$('div#colonne_home .data').html($('#colonne_home_abonnee').html());
					PopinWebTv();
					inscriptionFunctions();
					Cufon.replace("#home_abonne .pas-encore-abo, #home_abonne .deja-abo", { fontFamily: "CanalBoldRomain" });
					Cufon.replace("#home_non_abonne .data .bloc  p, #home_abonne .data .bloc  p,#home_abonne .data .bloc2  p.phrase_nav, #home_non_abonne .data .bloc2  p.phrase_nav", { fontFamily: "CanalBoldItalique" });
					Cufon.replace("#home_non_abonne .bloc h3,#home_abonne .bloc h3,#home_non_abonne .bloc2 h3,,#home_abonne .bloc2 h3,#home_abonne .bloc2-bas h3,#home_non_abonne .bloc2-bas h3,#home_non_abonne dl dt, #home_abonne dl dt", { fontFamily: "CanalBoldRomain" });
					Cufon.replace(" #home_non_abonne dd, #home_abonne dd", { fontFamily: "CanalDemiRomain" });
					Cufon.replace("#home_abonne .idenfication_home h3,#home_non_abonne .idenfication_home h3,.model2 ul li", { fontFamily: "CanalBoldRomain"});
					$('#emailHome_champs').addClass('erreur-home');
					$('#lib_emailHome').addClass('erreur-home');
					$('#lib_mdpHome').addClass('erreur-home');
					$('#mdpHome_champs').addClass('erreur-home');
					
					$('#lib_mdpHome').val('mot de passe invalide');
					$('#lib_emailHome').val('e-mail invalide');
				}
			}
			
			
		},
		error: function(){
			alert('Erreur');
		}
	});
}



function refreshColonneAbonne(page_id,page_version,from,error,step,fromlink){
	
				$('div#colonne_home #home_non_abonne').attr('id','home_abonne');
				$('div#colonne_home .data').html($('#colonne_home_abonnee').html());
				PopinWebTv();
				inscriptionFunctions();
				Cufon.replace("#home_abonne .pas-encore-abo, #home_abonne .deja-abo", { fontFamily: "CanalBoldRomain" });
				Cufon.replace("#home_non_abonne .data .bloc  p, #home_abonne .data .bloc  p,#home_abonne .data .bloc2  p.phrase_nav, #home_non_abonne .data .bloc2  p.phrase_nav", { fontFamily: "CanalBoldItalique" });
				Cufon.replace("#home_non_abonne .bloc h3,#home_abonne .bloc h3,#home_non_abonne .bloc2 h3,,#home_abonne .bloc2 h3,#home_abonne .bloc2-bas h3,#home_non_abonne .bloc2-bas h3,#home_non_abonne dl dt, #home_abonne dl dt", { fontFamily: "CanalBoldRomain" });
				Cufon.replace(" #home_non_abonne dd, #home_abonne dd", { fontFamily: "CanalDemiRomain" });
				Cufon.replace("#home_abonne .idenfication_home h3,#home_non_abonne idenfication_home h3,.model2 ul li", { fontFamily: "CanalBoldRomain"});
				var OngletPasAbo = $('li.pas-encore-abo').css('background-image').replace(/-on.png/, '-off.png');
				var OngletDejaAbo = $('li.deja-abo').css('background-image').replace(/-off.png/, '-on.png');
				$('li.pas-encore-abo').css('background-image',OngletPasAbo);
				$('li.deja-abo').css('background-image',OngletDejaAbo);
			
	
}
function verifConnexion(page_id,page_version,from,error,step,fromlink){
	
	$.ajax({
		url: '/ajax/private/home/verif_connexion.php',
		type: 'post',	
		data: {page_id:page_id, page_version:page_version, from:from, error:error, step:step,fromlink:fromlink},
		dataType: 'text',
		success: function(data){
				if(data){
					refreshColonne(page_id,page_version,from,error,step,fromlink);
					var OngletPasAbo = $('li.pas-encore-abo').css('background-image').replace(/-off.png/, '-on.png');
					var OngletDejaAbo = $('li.deja-abo').css('background-image').replace(/-on.png/, '-off.png');
					$('li.pas-encore-abo').css('background-image',OngletPasAbo);
					$('li.deja-abo').css('background-image',OngletDejaAbo);
				}
		},
		error: function(){
			alert('Erreur');
		}
	});
}
function refreshLienDejaAbo(){
	if(logue == 1 && abonne != 1 && authentif ==1){
		$('#logue_non_abonne').addClass("lien_on").removeClass("lien_off");
		$('#non_logue').addClass("lien_off").removeClass("lien_on");
	}
}
function refreshLienEnvoiAmi(){
	$.ajax({
		url: '/ajax/private/home/lien_envoi_ami.php',
		async: false,
		type: 'GET',
		dataType: 'script'
	});
}
function AfficheFormAuth(bAffich, from,error,step){
	
	$.ajax({
		url: '/ajax/private/home/formulaire_auth.php',
		async: false,
		type: 'get',
		data: {bAffich:bAffich,from:from, error:error, step:step},
		dataType: 'text',
		success: function(data){		
			if(data !=""){
				
				$('#bloc_log').html(data);
				$("div.bloc2").hide();
				$("div.bloc").hide();
				var OngletPasAbo = $('li.pas-encore-abo').css('background-image').replace(/-on.png/, '-off.png');
				var OngletDejaAbo = $('li.deja-abo').css('background-image').replace(/-off.png/, '-on.png');
				
				$('li.pas-encore-abo').css('background-image',OngletPasAbo);
				$('li.deja-abo').css('background-image',OngletDejaAbo);
				$('li.pas-encore-abo').css('color','#fff');
				inscriptionFunctions();
				
			}
			
		},
		error: function(){
			alert('Erreur');
		}
	});
}

function showNoAbo(page_id,page_version,from,error,step) {
 
	/*$('.idenfication_home').hide();
	$('.bloc2').show();
	$(".bloc").show();
	var OngletPasAbo = $('li.pas-encore-abo').css('background-image').replace(/-off.png/, '-on.png');
	var OngletDejaAbo = $('li.deja-abo').css('background-image').replace(/-on.png/, '-off.png');
	$('li.pas-encore-abo').css('background-image',OngletPasAbo);
	$('li.deja-abo').css('background-image',OngletDejaAbo);
	Cufon.replace('#home_non_abonne .pas-encore-abo', { fontFamily: 'CanalBoldRomain' });
	$('li.deja-abo').css('background-image',OngletDejaAbo);*/
	$.ajax({
		url: '/ajax/private/home/show_no_abonne.php',
		async: false,
		type: 'post',
		data: {page_id:page_id, page_version:page_version, from:from, error:error, step:step},
		dataType: 'text',
		success: function(data) {
			if(data !="") {
				var totalHtmlNoAb ='';
				var retourNoAb ='';
				var debdl ='';
				data = eval('('+data+')');
				var debHomeAbonne = '<div id="home_non_abonne">';
				var ulNavig ='<ul class="onglets"><li class="pas-encore-abo majuscules"><a href="javascript://" onclick="showNoAbo(\''+data.pid+'\',\''+data.pv+'\',\''+data.from+'\',\''+data.error+'\',\''+data.step+'\');">Pas encore abonn&eacute; ?</a></li><li id="logue_non_abonne" class="deja-abo majuscules lien_off"><a href="javascript://" onclick="ClickOnInscription();">D&eacute;j&agrave; abonn&eacute;</a></li><li id="non_logue" class="deja-abo majuscules lien_on"><a href="javascript://" onclick="refreshColonne(\''+data.pid+'\',\''+data.pv+'\',\''+data.from+'\',\''+data.error+'\',\''+data.step+'\',\'1\');">D&eacute;j&agrave; abonn&eacute;</a></li></ul>';
				var debdata = '<div class="data">';
				var findata = '</div>';
				var finHomeAbonne = '</div>';
				retourNoAb +=debHomeAbonne;
				retourNoAb +=ulNavig;
				retourNoAb +=debdata;
				if (data.aMEA[0] != "") {
					if (data.aMEA[0].flag1 == "2") {
						retourNoAb +='<div class="bloc"><h3><strong>'+data.aNavigation.zparams+'</strong></h3><span class="sous-titre">'+data.aNavigation.zparams2+'</span><div class="visuel"><a href="'+(data.aMEA[0].url)+'"><img src="'+data.mhttp+data.aMEA[0].path+'" alt="" /></a></div>';
						if (data.aMEA[0].path2 != "") {
							retourNoAb +='<div class="bouton"><a href="'+(data.aMEA[0].url2)+'"><img src="'+data.mhttp+data.aMEA[0].path2+'" alt="" /></a></div>';
						}
						retourNoAb +='</div>';
					}
					else {
						retourNoAb +='<div class="bloc2"><h3><strong>'+data.aNavigation.zparams+'</strong></h3><span class="sous-titre">'+data.aNavigation.zparams2+'</span><div class="visuel"><a href="'+data.aMEA[0].url+'"><img src="'+data.mhttp+data.aMEA[0].path+'" alt="visuel" /></a>	</div><h4><a href="'+(data.aMEA[0].url)+'" style="color:'+data.aMEA[0].stitle2+'">'+data.aMEA[0].text2+'</a></h4><p><a href="'+(data.aMEA[0].url)+'">'+data.aMEA[0].text+'</a></p><br><p  class="phrase_nav">'+data.aNavigation.zparams3+'</p>';								
						if (data.aMEA[0].path2 != "") {
							retourNoAb +='<div class="bouton"><a href="'+(data.aMEA[0].url2)+'"><img src="'+data.mhttp+data.aMEA[0].path2+'" alt="" /></a></div>';
						}
						retourNoAb +='</div>';
					}
				}
				retourNoAb +='<dl>';
				if (data.cntn >0) {
					for(i=0;i<data.cntn;i++) {
						if (data.aNavigation.NAVIGATIONS[i].ntitle) {
							if (data.aNavigation.NAVIGATIONS[i].nurl) {
								if(data.aNavigation.NAVIGATIONS[i].nauth) {
									var auth = data.aNavigation.NAVIGATIONS[i].auth;
								}
								else {
									var auth = "";
								}
								retourNoAb +='<a title="'+data.aNavigation.NAVIGATIONS[i].ntitle+'" href="'+(data.aNavigation.NAVIGATIONS[i].nurl)+'" '+auth+'>';
							}
							retourNoAb +='<dt>'+data.aNavigation.NAVIGATIONS[i].ntitle+'';
							if (data.aNavigation.NAVIGATIONS[i].nauth) {
								retourNoAb +='<img src="'+data.dhttp+'/img/home/img_secure.png" class="cadenas-nav-droite" alt="S&eacute;curis&eacute;" />';
							}
							retourNoAb +='</dt>';
							if (data.aNavigation.NAVIGATIONS[i].nurl) {
								retourNoAb +='</a>';
							}
						}
						for (j=0;j<(data.aNavigation.NAVIGATIONS[i].NAVIGATIONS.length);j++) {
							if (data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nauth != 0) {
								var auth = data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].auth;
								retourNoAb +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" '+auth+' style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
							}
							else {
								retourNoAb +='<dd><a title="'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'" href="'+(data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nurl)+'" style="background-image: url('+data.mhttp+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].nimg+');">'+data.aNavigation.NAVIGATIONS[i].NAVIGATIONS[j].ntitle+'</a></dd>';
							}
						}
					}
				}
				retourNoAb +='</dl>';	
				if (data.cntm >0) {
					for (k=1;k<data.cntm;k++) {
						if (data.aMEA[k].flag1 == "2") {
							retourNoAb +='<div class="bloc padding-10px"><h3>'+data.aMEA[k].title+'</h3><div class="visuel"><a href="'+data.aMEA[k].url+'"><img src="'+data.mhttp+data.aMEA[k].path+'" alt="visuel" /></a></div>';
							if (data.aMEA[k].path2 != "") {
								retourNoAb +='<div class="bouton"><a href="'+(data.aMEA[k].url2)+'"><img src="'+data.mhttp+data.aMEA[k].path2+'" alt="" /></a></div>';
							}
							retourNoAb +='</div>';
						}
						else {
							if(k==1) {
								var margin = "padding-10px";
							}
							else {
								var margin = "padding-20px";
							}
							retourNoAb +='<div class="bloc2-bas '+margin+'"><h3>'+data.aMEA[k].title+'</h3><div class="visuel"><a title="'+data.aMEA[k].title+'" href="'+(data.aMEA[k].url)+'"><img src="'+data.mhttp+data.aMEA[k].path+'" alt="'+data.aMEA[k].title+'" /></a></div><h4><a title="'+data.aMEA[k].title+'" href="'+data.aMEA[k].url+'" style="color:'+data.aMEA[k].stitle2+'">'+data.aMEA[k].text2+'</a></h4><p><a title="'+data.aMEA[k].title+'" href="'+data.aMEA[k].url+'">'+data.aMEA[k].text+'</a></p>';
							if (data.aMEA[k].path2 != "") {
								retourNoAb +='<div class="bouton"><a href="'+(data.aMEA[k].url2)+'"><img src="'+data.mhttp+data.aMEA[k].path2+'" alt="" /></a></div>';
							}
							retourNoAb +='</div>';
						}
					}
				}
				retourNoAb +='</div></div>';
				$('div#colonne_home').html(retourNoAb);
				var OngletPasAbo = $('li.pas-encore-abo').css('background-image').replace(/-off.png/, '-on.png');
				var OngletDejaAbo = $('li.deja-abo').css('background-image').replace(/-on.png/, '-off.png');
				$('li.pas-encore-abo').css('background-image',OngletPasAbo);
				$('li.deja-abo').css('background-image',OngletDejaAbo);
				Cufon.replace("#home_abonne .pas-encore-abo, #home_abonne .deja-abo, #home_non_abonne .pas-encore-abo, #home_non_abonne .deja-abo", { fontFamily: "CanalBoldRomain" });
				Cufon.replace("#home_non_abonne .data .bloc  p, #home_abonne .data .bloc  p,#home_abonne .data .bloc2  p.phrase_nav, #home_non_abonne .data .bloc2  p.phrase_nav", { fontFamily: "CanalBoldItalique" });
				Cufon.replace("#home_non_abonne .bloc h3,#home_abonne .bloc h3,#home_non_abonne .bloc2 h3,,#home_abonne .bloc2 h3,#home_abonne .bloc2-bas h3,#home_non_abonne .bloc2-bas h3,#home_non_abonne dl dt, #home_abonne dl dt", { fontFamily: "CanalBoldRomain" });
				Cufon.replace(" #home_non_abonne dd, #home_abonne dd", { fontFamily: "CanalDemiRomain" });
				Cufon.replace("#home_abonne .idenfication_home h3,#home_non_abonne .idenfication_home h3,.model2 ul li", { fontFamily: "CanalBoldRomain"});
			}
		},
		error: function() {
			alert('Erreur');
		}
	});
}


function showNoAbo2(page_id,page_version,from,error,step) {
	
	/*$('.idenfication_home').hide();
	$('.bloc2').show();
	$(".bloc").show();
	var OngletPasAbo = $('li.pas-encore-abo').css('background-image').replace(/-off.png/, '-on.png');
	var OngletDejaAbo = $('li.deja-abo').css('background-image').replace(/-on.png/, '-off.png');
	$('li.pas-encore-abo').css('background-image',OngletPasAbo);
	$('li.deja-abo').css('background-image',OngletDejaAbo);
	Cufon.replace('#home_non_abonne .pas-encore-abo', { fontFamily: 'CanalBoldRomain' });
	$('li.deja-abo').css('background-image',OngletDejaAbo);*/
	/*$.ajax({
		url: '/ajax/private/home/show_no_abonne.php',
		async: false,
		type: 'post',
		data: {page_id:page_id, page_version:page_version, from:from, error:error, step:step},
		dataType: 'text',
		success: function(data){		
			if(data.length >0){
				$('div#colonne_home').html($('#colonne_home_abonne').html());
				//$('div#colonne_home').html(data);
				var OngletPasAbo = $('li.pas-encore-abo').css('background-image').replace(/-off.png/, '-on.png');
				var OngletDejaAbo = $('li.deja-abo').css('background-image').replace(/-on.png/, '-off.png');
				$('li.pas-encore-abo').css('background-image',OngletPasAbo);
				$('li.deja-abo').css('background-image',OngletDejaAbo);
				Cufon.replace("#home_abonne .pas-encore-abo, #home_abonne .deja-abo, #home_non_abonne .pas-encore-abo, #home_non_abonne .deja-abo", { fontFamily: "CanalBoldRomain" });
				Cufon.replace("#home_non_abonne .data .bloc  p, #home_abonne .data .bloc  p,#home_abonne .data .bloc2  p.phrase_nav, #home_non_abonne .data .bloc2  p.phrase_nav", { fontFamily: "CanalBoldItalique" });
				Cufon.replace("#home_non_abonne .bloc h3,#home_abonne .bloc h3,#home_non_abonne .bloc2 h3,,#home_abonne .bloc2 h3,#home_abonne .bloc2-bas h3,#home_non_abonne .bloc2-bas h3,#home_non_abonne dl dt, #home_abonne dl dt", { fontFamily: "CanalBoldRomain" });
				Cufon.replace(" #home_non_abonne dd, #home_abonne dd", { fontFamily: "CanalDemiRomain" });
				Cufon.replace("#home_abonne .idenfication_home h3,#home_non_abonne .idenfication_home h3,.model2 ul li", { fontFamily: "CanalBoldRomain"});
				
			}
			
		},
		error: function(){
			alert('Erreur');
		}
	});
	*/
	$('div#colonne_home #home_abonne').attr('id','home_non_abonne');
	$('div#colonne_home').html($('#colonne_home_non_abonne').html());
	//$('div#colonne_home').html(data);
	var OngletPasAbo = $('li.pas-encore-abo').css('background-image').replace(/-off.png/, '-on.png');
	var OngletDejaAbo = $('li.deja-abo').css('background-image').replace(/-on.png/, '-off.png');
	$('li.pas-encore-abo').css('background-image',OngletPasAbo);
	$('li.deja-abo').css('background-image',OngletDejaAbo);
	Cufon.replace("#home_abonne .pas-encore-abo, #home_abonne .deja-abo, #home_non_abonne .pas-encore-abo, #home_non_abonne .deja-abo", { fontFamily: "CanalBoldRomain" });
	Cufon.replace("#home_non_abonne .data .bloc  p, #home_abonne .data .bloc  p,#home_abonne .data .bloc2  p.phrase_nav, #home_non_abonne .data .bloc2  p.phrase_nav", { fontFamily: "CanalBoldItalique" });
	Cufon.replace("#home_non_abonne .bloc h3,#home_abonne .bloc h3,#home_non_abonne .bloc2 h3,,#home_abonne .bloc2 h3,#home_abonne .bloc2-bas h3,#home_non_abonne .bloc2-bas h3,#home_non_abonne dl dt, #home_abonne dl dt", { fontFamily: "CanalBoldRomain" });
	Cufon.replace(" #home_non_abonne dd, #home_abonne dd", { fontFamily: "CanalDemiRomain" });
	Cufon.replace("#home_abonne .idenfication_home h3,#home_non_abonne .idenfication_home h3,.model2 ul li", { fontFamily: "CanalBoldRomain"});
}
function ClickOnInscription(){
	
	$('a.lien-popin-inscription').trigger("click");
}
/* affiche le input text et cache le input password*/
function showLibellePwdInputHome() {
	if( $('#mdpHome').val() == ''){
		$('#lib_mdpHome').val("Mot de passe");
		$('#mdpHome').hide();
		$('#lib_mdpHome').show();
	}
}

/* cache le input text et affiche le input password*/
function hideLibellePwdInputHome() {
	$('#lib_mdpHome').hide();
	$('#mdpHome').css("display","");
	$('#mdpHome').focus();
}

/* cache la value de input mail*/
function hideLibelleEmailInputHome() {
	$('#lib_emailHome').hide();	
	$('#emailHome').css("display","");
	$('#emailHome').focus();
}

/* affiche la value de input mail*/
function showLibelleEmailInputHome(){
	if( $('#emailHome').val() == ''){
		$('#lib_emailHome').val("E-mail");
		$('#emailHome').hide();
		$('#lib_emailHome').show();
	}
}

//-------------------------------------------------------------------------------------------------------------------------
// PANORAMA
//-------------------------------------------------------------------------------------------------------------------------
function PanoramaSectionInitUserCookie(){
	userPageSectionState = new UserPageElementState("panorama");
	userPageSectionState.init();
	for (var key in userPageSectionState.aEls) {
		if (userPageSectionState.aEls[key] == 1) {
			var e = $.Event("click");
			$("div."+key+" a.BtnOpenClose").trigger(e);
		}
	}

}

function PanoramaAbonnementSectionInitUserCookie(){
	userPageSectionState = new UserPageElementState("panorama_abonnement");
	userPageSectionState.init();
	for (var key in userPageSectionState.aEls) {
		if (userPageSectionState.aEls[key] == 1) {
			var e = $.Event("click");
			$("div."+key+" a.BtnOpenClose").trigger(e);
		}
	}

}

function PanoramaWebTvSectionInitUserCookie(){
	userPageSectionState = new UserPageElementState("panorama_webtv");
	userPageSectionState.init();
	for (var key in userPageSectionState.aEls) {
		if (userPageSectionState.aEls[key] == 1) {
			var e = $.Event("click");
			$("div."+key+" a.BtnOpenClose").trigger(e);
		}
	}
}
function PanoramaSectionInitNoCookie(){
	userPageSectionState = new UserPageElementState("panorama");
	userPageSectionState.init();
}
function PanoramaWebTVSectionInitNoCookie(){
	userPageSectionState = new UserPageElementState("panorama_webtv");
	userPageSectionState.init();
}
function sectionOpenClose(){
	$(".contenu-theme").hide();
	$(".premier-contenu").show();
	$(".titre-theme").toggle(function(){
		$(this).addClass("active");
		userPageSectionState.updateValue($(this).attr("class").split(" ")[1],'1');

		}, function () {
		$(this).removeClass("active");
		userPageSectionState.updateValue($(this).attr("class").split(" ")[1],'0');
	});
	$(".premier-titre").toggle(function(){
	$(this).removeClass("active");
		}, function () {
		$(this).addClass("active");
	});
	$(".titre-theme").click(function(){
		$(this).next(".contenu-theme").slideToggle("slow,");
	});
}

function openLayer() {
	//$('a.lien-popin').unbind('click');
	$('a.lien-popin').live('click', function(e) {

		e.preventDefault();
		bLockMEAPopup = true;
		
		_tmpid = $(this).attr('class');
		_idchaine = _tmpid.split('chaine-');

		arreteMEA();
		//lien pour ouverture de la popin
		var url= "/index.php?pid="+_idpageCible+"&chid="+_idchaine[1]+"&cid_only=1";
	    $.modal.close();
		$.modal.defaults.closeHTML = "<a class=\"modalCloseImg2\" title=\"Fermer\" ></a>";
		$('#fiche').html('');
		windowHeight = positionPopup();
		if ((screen.width<=1024) && (screen.height<=768)){
			left=(screen.width - 680)/2;
		}else{
			left=300.5;
		}
		
		_href = url;  
		$('#fiche').html("<iframe class=\"my_frame\" id=\"my_frame\" src =\""+_href+"\" frameborder=\"0\" scrolling=\"no\" style=\"height:520px\"  width=\"100%\" />");
		
		$('#fiche').modal({
			close: true,
			autoResize: true,
			minHeight: 538,
			opacity: 80,  
			minWidth:680,
			position : [windowHeight,0],
			onShow: function() {
				$('.my_frame').css({'height':'100%'});
				$('.simplemodal-data').css({'width':'600px'});
				$('.simplemodal-data').css({'min-width':'680px'});
				$('.simplemodal-container').css({'width':''});
				$('.simplemodal-container').css({'left':'50%'});
				$('.simplemodal-container').css({'margin-left':'-340px'});
				$('.simplemodal-wrap').css({'width':'680px'});
				$('.simplemodal-overlay').unbind('click');
				$('.simplemodal-overlay').bind('click', function() {
					$.modal.close();
				});
				$("div#simplemodal-container").addClass("simplemodal-container-popin-chaine");
				CANAL.initPlayers();
				
			},
			onClose: function() {
				$.modal.close();
				$('#fiche').html('');
				relanceMEA();
				
			}
		});
		$('#fiche').addClass("simplemodal-data-btm");
		$('#fiche').css("height", "100%");
		$('#fiche').css("padding-bottom", "3px");
		$('#simplemodal-overlay').css("height", "100%");
		$('#simplemodal-overlay').css("width", "100%");
		
		
	});
	
	
	/* popup programme */
	lightboxes();
}

function openLayerPopin(chaineId, pageId) {
		bLockMEAPopup = true;
		arreteMEA();
		
		//lien pour ouverture de la popin
		var url= "/index.php?pid=687&chid="+chaineId+"&cid_only=1";
	    
	    $.modal.close();
		
		$('#fiche').html('');
		windowHeight = positionPopup();
		_href = url;  
		$('#fiche').html("<iframe class=\"my_frame\" id=\"my_frame\" src =\""+_href+"\" frameborder=\"0\" scrolling=\"no\" style=\"height:520px\"  width=\"100%\" />");
		
		$('#fiche').modal({
			close: true,
			autoResize: true,
			minHeight: 538,
			minWidth:680,
			position : [windowHeight,0],
			onShow: function() {
				$('.my_frame').css({'height':'100%'});
				$('.simplemodal-data').css({'width':'600px'});
				$('.simplemodal-data').css({'min-width':'680px'});
				$('.simplemodal-container').css({'width':''});
				$('.simplemodal-container').css({'left':'300.5px'});
				$('.simplemodal-wrap').css({'width':'680px'});
				$('.simplemodal-overlay').unbind('click');
				$('.simplemodal-overlay').bind('click', function() {
					$.modal.close();
				});
				CANAL.initPlayers();
			},
			onClose: function() {
				$.modal.close();
				$('#fiche').html('');
				relanceMEA();
				
			}
		});
		$('#fiche').css("height", "100%");
		$('#simplemodal-overlay').css("height", "100%");
		$('#simplemodal-overlay').css("width", "100%");
	
	/* popup programme */
	lightboxes();
}

function CloseLayerChaine(url) {
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$('#fiche').html('');
	parent.document.location.href=url;
}

function mesEnregistrements() {
//	indispensableFunctions();
//	liBrevesInitUserCookie();
//	customDropDown();
	grilleInfoEureka();
	jQuery.ajax({
		url: "/ajax/private/ead/ead_liste_enregistrements.php",
		data: {
//			pid: pid
		},
		success: function(data){
			jQuery("div#liste_enregistements").html(data);
			lightboxes();
		}
	});
}
//-------------------------------------------------------------------------------------------------------------------------
// BR&eacute;VES ET PAROLE D EXPERT
//-------------------------------------------------------------------------------------------------------------------------
function openBreve() {
	$('a.lien-popin-details-breve').unbind('click');
	$('a.lien-popin-details-breve').bind('click', function(e) {
		e.preventDefault();
		_href = $(this).attr('href');
		$.modal.close();
		$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
		topBreve = positionBreve();
		$.ajax({
			url: _href,
			success: function(data) {
				$('#details-fiche-breve').html(data);
				$('#details-fiche-breve').modal({ position : [topBreve]});
			}
		});
	});
}
function PositionArticle(){
	var ScrollTop = $(window).scrollTop();
	ScrollTop = ScrollTop+100;
	return ScrollTop;
}
function openParoleExpert() {
	$('a.lien-popin-fiche-parole').unbind('click');
	$('a.lien-popin-fiche-parole').bind('click', function(e) {
		e.preventDefault();
		_href = $(this).attr('href');
		$.modal.close();
		$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
		windowHeightParole = PositionArticle();
		$.ajax({
			url: _href,
			success: function(data) {
				$('#detail-fiche-parole').html(data);
				$('#detail-fiche-parole').modal({position : [windowHeightParole,0]});
			}
		});
	});
	
}

function openSendToFriend(urlSendToAFriend) {
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$.ajax({
		url: urlSendToAFriend,
		success: function(data) {
			$('#envoyer-ami').html(data);
			$('#envoyer-ami').modal({position : [200,0]});
		}
	});
 }
 
function openInscriptionToSendToFriend(urlIdentification) {
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$.ajax({
		url: urlIdentification,
		success: function(data) {
			$('#inscription').html(data);
			$("#inscription").modal({position: [200]});
		}
	});
}
 
function openIdentificationToSendToFriend(urlIdentification) {
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$.ajax({
		url: urlIdentification,
		success: function(data) {
			$('#identification').html(data);
			$("#identification").modal({position: [200]});
		}
	});
}
 
function openPremiereVisiteToSendToFriend(urlIdentification) {
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$.ajax({
		url: urlIdentification,
		success: function(data) {
			$('#premierevisite').html(data);
			$("#premierevisite").modal({position: [200]});
		}
	});
 }
 
 function consultationForContent(cid, type) {
	$.ajax({
		url: '/ajax/private/consultation.ajax.php?cid=' + cid + '&type=' + type
	});
}

function voteForContent(cid, type, action, affichage) {
	if(action == 'vote'){
		typeAjax = 'POST';
	}else{
		typeAjax = 'GET';
	}
	$.ajax({   
		type: typeAjax,
		data : 'cid=' + cid + '&type=' + type + '&action=' + action + '&affichage=' + affichage,
		url: '/ajax/vote.ajax.php',
		success: function(data) {
			$('#vote_'+cid).html(data);
			$('#vote').html(data);
		}
	});
}
function sendComArticle(ref_type_id,ctn_id) {
	document.getElementById('commentaire_texte').value = document.getElementById('tmp_commentaire_texte').value;
	document.getElementById('tmp_commentaire_texte').value = "";
	if (document.getElementById('commentaire_texte').value=="") {
		alert('Vous n\'avez pas saisi de commentaire');
		return;
	}
	var comment = document.getElementById('commentaire_texte').value;

	$.ajax({
		url: '/ajax/private/commenter_un_article.php',
		async: false,
		type: 'post',
		data: {ref_type_id:ref_type_id, ctn_id:ctn_id, comment:comment},
		dataType: "script"

	});
	//setOmnitureSerialize('events||event12##eVar31||Poste avis prog');
}
function showVoteForContent(cid, type) {
	if( $('#vote_'+cid).html() == ''){
		$.ajax({
			data : 'cid=' + cid + '&type=' + type + '&action=display&affichage=lecture_vote',
			url: '/ajax/vote.ajax.php',
			success: function(data) {
				$('#vote_'+cid).html(data);
			}
		});
	}
	$('#vote_'+cid).css({'visibility':'visible'});
}
 
function hideVoteForContent(cid) {
	$('#vote_'+cid).css({'visibility':'hidden'});
}
 
function checkFormComment(){
	if($('#commentaire_texte').val() == ''){
		$('#comment_erreur').html('Vous devez saisir un commentaire');
		$('#comment_erreur').show();
		return false;
	}
	return true;
}
 
function simulateClick(id){
	try
   {//pour ie
  		document.getElementById(id).click();
   }catch(e)
   {//pour ff
		var evt = document.createEvent("MouseEvents"); // cr&eacute;er un ?vennement souris
		evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);  // intiailser l'?vennement d?ja cr?e par un click
		var cb = document.getElementById(id); // pointe sur l'?lement
		cb.dispatchEvent(evt);  // envoyer l'?vennement vers l'?lement
   }
//	$('#'+id+'').trigger('click');
}
function filtre_thematique_open() {
    filtre_thematique_canceltimer();
    filtre_thematique_close();
    ddmenuitem = $(this).find('ul').css('visibility', 'visible');
}
function filtre_thematique_close(){ 
	if (ddmenuitem) ddmenuitem.css('visibility', 'hidden'); 
}
function filtre_thematique_timer(){ 
	closetimer = window.setTimeout(filtre_thematique_close, timeout); 
}
function filtre_thematique_canceltimer() {
    if (closetimer) {
        window.clearTimeout(closetimer);
        closetimer = null;
    }
}
function LoadingBreve(){
	$('a.toutes-thematique').live('click',function(e){
    		e.preventDefault();
    	});
	// Menu d?roulant pour le filtre de recherche sur les th?matiques (grille TV)
    $('#filtre-thematique-breve > li').live('click', function(){
	
    	ddmenuitem = $(this).find('ul');
    	if(ddmenuitem.is(":visible") == true){
    		ddmenuitem.css('display', 'none'); 
    		ddmenuitem.css('visibility', 'hidden'); 
    	}else{
    		ddmenuitem.css('display', 'block'); 
			ddmenuitem.css('visibility', 'visible'); 
    	}
		
    });
    // Menu d?roulant pour le filtre de recherche sur le nombre de r?sultats par page (recherche)
    $('#nbr-elements > li').bind('mouseover', filtre_thematique_open)
    $('#nbr-elements > li').bind('mouseout', filtre_thematique_timer)
	
	Cufon.replace('h3.filtrer-rech_avancee, h3.filtrer-rech_simple, h4.top');
}
function checkFormSendToAFriend(){
	if( $('#FRIEND_EMAIL').val() == ""){
		$('#erreurSendToAFriend').html('Saisissez un email');
		$('#erreurSendToAFriend').show();
		return false;
	}
	if(!isMail($('#FRIEND_EMAIL').val())){
		$('#erreurSendToAFriend').html('Saisissez un email valide');
		$('#erreurSendToAFriend').show();
		return false;
	}
	return true;
}
//-------------------------------------------------------------------------------------------------------------------------
// GRILLE TV PERSONNALISATION
//-------------------------------------------------------------------------------------------------------------------------
function GrillePersonnalisation() {
	if(typeof(idcount)=='undefined'){
		idcount=0;
	}
		$(function() {
			$(".bloc-chaines-panorama .content ul li").draggable({
				helper: "clone"
			});
			$(".grille-perso-centre ol").droppable({
				activeClass: "ui-state-default",
				hoverClass: "ui-state-hover",
				accept: ":not(.ui-sortable-helper)",
				drop: function(event, ui) {
				$(this).find(".placeholder").remove();
				idcount++;
				$("<li id='dropchaine_"+idcount+"' title='"+ui.draggable.text()+"' ></li>").text(ui.draggable.text()).appendTo(this);
				set_image(idcount,"dropchaine_"+idcount,ui.draggable.text());  //affiche l'image
				set_zone_drop(idcount);
			}
			}).sortable({
				items: "li:not(.placeholder)",
				sort: function() {
				$(this).removeClass("ui-state-default");
				},
				stop: function() {
			}
		});
	});
	$('.bloc-chaines-panorama ul li a').click(function() {		        
		return false;
	});
}
function init_chaines() {
	if (mSelection!="|") {
		a=mSelection.split('|');
		idcount=0;
		for(i=0; i<a.length; i++) {
			chaines_perso_array.push('chaine_'+a[i]);
			if (a[i]!="") {
				idcount++; 
				$('#grille-perso-centre ol').find(".placeholder").remove();
				imgsrc=$("#chaine_"+a[i]).attr("src");
				if(idcount % 3 == 0) {
					$("<li id='dropchaine_"+idcount+"' title='chaine_"+a[i]+"' ></li>").html("<div class=\"image-chaine\"><img src="+imgsrc+" /></div><div class=\"ico-suppr\" id=\"ico-suppr"+idcount+"\" ><a title=\"supprimer\" href=\"javascript:suppr_chaine('dropchaine_"+idcount+"','chaine_"+a[i]+"');\" id=\"suppr_"+idcount+"\" class=\"tooltip\"><img src=\""+sImageFront+"/design/front_office_canalsat_v4/img/02_grille_tv/ico-suppr.png\" alt=\"supprimer\"/><span style=\"margin-left:-85px;\">Supprimer</span></a></div>").appendTo('#grille-perso-centre ol');
				}else {
					$("<li id='dropchaine_"+idcount+"' title='chaine_"+a[i]+"' ></li>").html("<div class=\"image-chaine\"><img src="+imgsrc+" /></div><div class=\"ico-suppr\" id=\"ico-suppr"+idcount+"\" ><a title=\"supprimer\" href=\"javascript:suppr_chaine('dropchaine_"+idcount+"','chaine_"+a[i]+"');\" id=\"suppr_"+idcount+"\" class=\"tooltip\"><img src=\""+sImageFront+"/design/front_office_canalsat_v4/img/02_grille_tv/ico-suppr.png\" alt=\"supprimer\"/><span>Supprimer</span></a></div>").appendTo('#grille-perso-centre ol');
				}
				$("li.chaine_"+a[i]).css("background-image","url("+sImageFront+"/design/front_office_canalsat_v4/img/02_grilletv_bloc-panarama/fond-chaine-selectionnee.png)");
				$("li.chaine_"+a[i]).draggable("disable");
				set_zone_drop(idcount);
			}
		}
	}
}
function save_liste_chaines(){
	var sChaines ="";
	chaines_perso_ordered=new Array();
	var result_array = $('#grille-perso-centre ol').sortable('toArray');
	for(i=0;i<=(result_array.length-1);i++){
		chaines_perso_ordered.push( document.getElementById(result_array[i]).title );
	}
	for(j=0;j<=(chaines_perso_ordered.length-1);j++){
		if (sChaines!="") {
			sChaines+=",";
		}
		sChaines+=chaines_perso_ordered[j].replace('chaine_', '');
	}
	document.getElementById("all_chaines").value = sChaines;
	//xajax_call('perso_grille', sChaines)
	$.ajax({
		url: '/ajax/perso_grille.php',
		async: false,
		type: 'post',
		data: {sChaines:sChaines},
		dataType: "script"
	});
}
function RedirectGrillePerso(sUrl){
	document.location.href=sUrl;
}
 //-------------------------------------------------------------------------------------------------------------------------
// OUVERTURE POPUP
//-------------------------------------------------------------------------------------------------------------------------
 function openPopupNclinet(tpl, height, width, scroll, popup_type) {
	var params = "height=" + height + ",width=" + width + ",scrollbars=" + scroll;
	var url = "/index_popup.php?tpl=" + tpl + "&popup_type=" + popup_type;
	if (typeof sUrlSite == "string") {
		url = sUrlSite + url;
	}
	window.open(url, "TexteRiche", params);
}


//-------------------------------------------------------------------------------------------------------------------------
// WEB TV
//-------------------------------------------------------------------------------------------------------------------------
function webtvFunctions() {

	// config
    $('.lien-popin-webtv-config').unbind('click');
	$('.lien-popin-webtv-config').click(function(e) {
		e.preventDefault();
		_href = $(this).attr('href');
		$.modal.close();
		$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
		$('#webtv-config').html("<iframe src =\""+_href+"\" frameborder=\"0\" scrolling=\"no\" height=\"100%\" width=\"100%\" />");
		$('#webtv-config').modal({ position : [200]});
    });

	// faq
    $('.lien-popin-webtv-faq').unbind('click');
	$('.lien-popin-webtv-faq').click(function(e) {
		e.preventDefault();
		_href = $(this).attr('href');
		$.modal.close();
		$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
		$('#webtv-faq').html("<iframe src =\""+_href+"\" frameborder=\"0\" scrolling=\"no\" height=\"100%\" width=\"100%\" />");
		$('#webtv-faq').modal({ position : [200]});
    });

	// config
    $('.lien-popin-webtv-modalite').unbind('click');
	$('.lien-popin-webtv-modalite').click(function(e) {
		e.preventDefault();
		_href = $(this).attr('href');
		$.modal.close();
		$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
		$('#webtv-modalite').html("<iframe src =\""+_href+"\" frameborder=\"0\" scrolling=\"auto\" height=\"100%\" width=\"100%\" />");
		$('#webtv-modalite').modal({ position : [200]});

    });

}
//-------------------------------------------------------------------------------------------------------------------------
// PROGRAMME
//-------------------------------------------------------------------------------------------------------------------------

function ProgrammeCommunautaire() {

	if(authentif_light == 1 || logue == 1){
		$('#lien_communautaire_nonlogue').css("display","none");
		$('#lien_communautaire_logue').css("display","block");
	}else{
		$('#lien_communautaire_logue').css("display","none");
		$('#lien_communautaire_nonlogue').css("display","block");
	}
}

function SetLayerInsc(pgid,dfid){
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$('#fiche').html('');
	var url = from+encodeURIComponent("&prog="+pgid+"&diff="+dfid+"&listecom=1&valid=ok");
	if(premiereVisite == false){
		$("a#lien_auto").removeClass("lien");
		$("a#lien_auto").addClass("lien-popin-premierevisite");
		$("a#lien_auto").attr("href", "/ajax/private/signon.php?_step_=premierevisite_form&from="+url);
	}else{
		$("a#lien_auto").removeClass("lien");
		$("a#lien_auto").addClass("lien-popin-identification");
		$("a#lien_auto").attr("href", "/ajax/private/signon.php?_step_=identification_form&from="+url);
	}
	inscriptionFunctions();
	$("a#lien_auto").trigger('click');
	
}
function SetPseudo(pgid,dfid){
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$('#fiche').html('');
	var url = from+encodeURIComponent("&prog="+pgid+"&diff="+dfid+"&onglet=avis&valid=ok");
	$("a#lien_auto").removeClass("lien");
	$("a#lien_auto").addClass("lien-popin-inscription");
	$("a#lien_auto").attr("href", "/ajax/private/signon.php?_step_=inscription_form&from="+url);
	inscriptionFunctions();
	$("a#lien_auto").trigger('click');
	
}
 function OpenLayerEnvoyer(pgid,dfid){
 	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
 	$('#fiche').html('');
	var url = from+encodeURIComponent("&prog="+pgid+"&diff="+dfid+"&sento=1");
	if(premiereVisite == false){
		$("a#lien_auto").removeClass("lien");
		$("a#lien_auto").addClass("lien-popin-premierevisite");
		$("a#lien_auto").attr("href", "/ajax/private/signon.php?_step_=premierevisite_form&from="+url);
	}else{
		$("a#lien_auto").removeClass("lien");
		$("a#lien_auto").addClass("lien-popin-identification");
		$("a#lien_auto").attr("href", "/ajax/private/signon.php?_step_=identification_form&from="+url);
	}
	inscriptionFunctions();
	$("a#lien_auto").trigger('click');
 }
  function OpenLinkPopup(myclass, myid) {
	$(myclass).unbind('click');
	$(myclass).bind('click', function(e) {
		e.preventDefault();
		_href = $(this).attr('href');
		$.modal.close();
		$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
		$.ajax({
			url: _href,
			success: function(data) {
				$(myid).html(data);
				$(myid).modal({position : [200,0]});
			}
		});
	});
 }
 function openIdentificationToSendToFriendProg(urlIdentification) {
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$('#fiche').html('');
	$("a#lien_auto").removeClass("lien");
	$("a#lien_auto").addClass("lien-popin-identification");
	$("a#lien_auto").attr("href", "/ajax/private/signon.php?_step_=identification_form&from="+urlIdentification);
	inscriptionFunctions();
	$("a#lien_auto").trigger('click');
 }

 function openPremiereVisiteToSendToFriendProg(urlIdentification) {
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$('#fiche').html('');
	$("a#lien_auto").removeClass("lien");
	$("a#lien_auto").addClass("lien-popin-premierevisite");
	$("a#lien_auto").attr("href", "/ajax/private/signon.php?_step_=identification_form&from="+urlIdentification);
	inscriptionFunctions();
	$("a#lien_auto").trigger('click');
 }
 function RefreshLienAuto(){
 	$("a#lien_auto").trigger('click');
 	$("a#lien_auto").removeClass("lien-popin-envoyer");
 	$("a#lien_auto").addClass("lien");
 	$("a#lien_auto").attr("href","lien");
 }
 function OpenSendToFriendProg(urlSendToAFriend) {
	/*$.modal.close();
	$('#fiche').html('');
	$('#envoyer-ami').html('');
	$('#simplemodal-overlay').remove();
	$('#simplemodal-container').remove();
	$("a#lien_auto").removeClass("lien");
	$("a#lien_auto").addClass("lien-popin-envoyer");
	$("a#lien_auto").attr("href", urlSendToAFriend);
	OpenLinkPopup("a.lien-popin-envoyer","#envoyer-ami");
	RefreshLienAuto();*/
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$.ajax({
		url: urlSendToAFriend,
		success: function(data) {
			$('#envoyer-ami').html(data);
			$('#envoyer-ami').modal({position : [200,0]});
		}
	});
	//setTimeout(, 1000);
 }
 function OpenAlertProg(urlSendToAFriend) {
	/*$.modal.close();
	$('#fiche').html('');
	$("a#lien_auto").removeClass("lien");
	$("a#lien_auto").addClass("lien-popin-alerte");
	$("a#lien_auto").attr("href", urlSendToAFriend);
	OpenLinkPopup("a.lien-popin-alerte","#layer-alerte");
	$("a#lien_auto").trigger('click');*/
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$.ajax({
		url: urlSendToAFriend,
		success: function(data) {
			$('#layer-alerte').html(data);
			$('#layer-alerte').modal({position : [200,0]});
		}
	});
 }
 function CloseAlertOpenProg(urlSendToAFriend) {
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$('#fiche').html('');
	$("a#lien_auto").removeClass("lien");
	$("a#lien_auto").addClass("lien-popin");
	$("a#lien_auto").attr("href", urlSendToAFriend);
	OpenLinkPopup("a.lien-popin","#fiche");
	$("a#lien_auto").trigger('click');
 }
 function OpenFicheChaineProgramme(urlChaine) {
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$('#fiche').html('');
	$("a#lien_auto").removeClass("lien");
	$("a#lien_auto").addClass("lien-popin chaine-");
	$("a#lien_auto").attr("href", urlChaine);
	openLayer();
	$("a#lien_auto").trigger('click');
 }
 
 function OpenFicheChaineProgrammeHD(urlChaine,chaineId) {
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$('#fiche').html('');
	$("a#lien_auto").removeClass("lien");
	$("a#lien_auto").addClass("lien-popin chaine-"+chaineId);
	$("a#lien_auto").attr("href", urlChaine);
	openLayer();
	$("a#lien_auto").trigger('click');
 }
function heightLayerChaines(id){
	if(id == ".presentation"){
		var h = $('#my_frame').contents().find(id).height();
		var w = $('#my_frame').contents().find("#chaine ul").height();
		var hauteurColG = h+w+141;
//		var hauteurColG = 538;
	}else{
		var hauteurColG = $('#my_frame').contents().find("#chaine").height();
	}
	var hauteurColD = $('#my_frame').contents().find("#infos").height();
	if(hauteurColG > hauteurColD){
		$("#simplemodal-container").css("height", hauteurColG+"px");
		$("#simplemodal-wrap").css("height", hauteurColG+"px");
	}else{
		$("#simplemodal-container").css("height",hauteurColD+"px");
		$("#simplemodal-wrap").css("height",hauteurColD+"px");
	}
}
function heightLayerProgramme(){
	var hauteurColG = $('#my_frame').contents().find("#programme").height();
	var hauteurColD = $('#my_frame').contents().find("#infos").height();
	var hauteurLayer = 0;
	if(hauteurColG > hauteurColD){
		hauteurLayer = hauteurColG
	}else{
		hauteurLayer = hauteurColD
	}
	if(hauteurLayer < 560){
		hauteurLayer = 560;
	}
	$("#simplemodal-container").css("height", hauteurLayer+"px");
	$("#simplemodal-wrap").css("height", hauteurLayer+"px");
}

function RecordProgramme(diff_id,action, link) {
			$.ajax({
				url: '/ajax/private/enregistrer_programme.php',
				async: false,
				type: 'post',
				data: {diff_id:diff_id, action:action, link:link},
				dataType: "script"
		
			});
		}

function partage_facebook(uFacebook, tFacebook, dFacebook) {
	$('meta[name=title]').attr("content", tFacebook);
	$('meta[name=description]').attr("content", dFacebook);
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(uFacebook)+'&t='+encodeURIComponent(tFacebook)+'&description='+encodeURIComponent(dFacebook),'sharer','toolbar=0,status=0,width=626,height=436'); 
	return false;
}

function partage_facebook_programme(uFacebook, tFacebook, dFacebook, vFacebook) {
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(uFacebook)+'&t='+encodeURIComponent(tFacebook)+'&description='+encodeURIComponent(dFacebook)+ "&image_src" + encodeURIComponent(vFacebook),'sharer','toolbar=0,status=0,width=626,height=436'); 
	return false;
}
//-------------------------------------------------------------------------------------------------------------------------
// CANAL EDUCATION 
//-------------------------------------------------------------------------------------------------------------------------
function refreshZone(niveau,matiere){
	var edu_type_onglet = $("#type-onglet").val();
	var edu_onglet_actif = $("#onglet-actif").val();
	if(typeof(edu_type_onglet)  == "undefined"){
		edu_type_onglet= '3';
	}
	
	$.ajax({
		url: '/ajax/education/ajaxRefreshZone.php',
		async: false,
		type: 'get',
		data: {niveau:niveau, matiere:matiere,edu_type_onglet:edu_type_onglet,onglet_actif:edu_onglet_actif},
		dataType: 'text',
		success: function(data){
			$('div#resultAjax').html(data);

		},
		error: function(){
			alert('Erreur');
		}

	});
}
function listeProgramme(edu_niveau,edu_theme,edu_matiere, id_page, alert_sujet, confirm_alert, alert_prog, confirm_alert_prog, from_edu){
	var edu_onglet = $("#type-onglet").val();
	$.ajax({
			url: "/ajax/education/listeProgrammeEducation.php",
			async: false,
			type: "get",
			data: {edu_theme:edu_theme, edu_niveau:edu_niveau, edu_matiere:edu_matiere, id_page:id_page,alert_sujet:alert_sujet, confirm_alert:confirm_alert,alert_prog:alert_prog, confirm_alert_prog:confirm_alert_prog, from_edu :from_edu, edu_onglet:edu_onglet},
			dataType: "text",
			success: function(data){
				if(alert_sujet !="" || confirm_alert != "" || alert_prog != "" || confirm_alert_prog != ""){
					if(edu_niveau != ""){
						$("div.filtre-niveau div.selectedTxt").text(edu_niveau);
					}
					if(edu_matiere != ""){
						$("div.filtre-matiere div.selectedTxt").text(edu_matiere);
					}
				}
				if(data != ""){
					$("div#resultAjax").html(data);
				}
				openLayer();
			},
			error: function(){
				alert("Erreur");
			}
			
	});
}
function SelectMatiereLevel(){
	
	$("div.filtre-matiere ul.newList li").click(function(){
		niveau=encodeURIComponent($("div.filtre-niveau div.selectedTxt").text());
		matiere=encodeURIComponent($("div.filtre-matiere div.selectedTxt").text());
		refreshZone(niveau,matiere);
		
	});

	$("div.filtre-niveau ul.newList li").click(function(){
		niveau=encodeURIComponent($("div.filtre-niveau div.selectedTxt").text());
		matiere=encodeURIComponent($("div.filtre-matiere div.selectedTxt").text());
		refreshZone(niveau,matiere);
		
	});
}
function OpenAlertSujet(urlSendToAFriend) {
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
	$('#fiche').html('');
	$("a#lien_auto").removeClass("lien");
	$("a#lien_auto").addClass("lien-popin-alerte");
	$("a#lien_auto").attr("href", urlSendToAFriend);
	OpenLinkPopup("a.lien-popin-alerte","#layer-alerte");
	$("a#lien_auto").trigger('click');
 }
//-------------------------------------------------------------------------------------------------------------------------
// FAQ
//-------------------------------------------------------------------------------------------------------------------------
function sectionOpenCloseFaq(){

	$(".contenu-theme-faq").hide();
	$(".premier-contenu-faq").show();
	$(".titre-theme-faq").toggle(function(){
		$(this).addClass("active");
		}, function () {
		$(this).removeClass("active");
	});
	$(".premier-titre-faq").toggle(function(){
	$(this).removeClass("active");
		}, function () {
		$(this).addClass("active");
	});
	$(".titre-theme-faq").click(function(){
		$(this).next(".contenu-theme-faq").slideToggle("slow,");
	});
}
//-------------------------------------------------------------------------------------------------------------------------
// FOCUS
//-------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------
// positionPopup
//-------------------------------------------------------------------------------------------------------------------------
function positionLayerVideo() {

	var windowHeight = $(window).height();
	var scrollTop = $(window).scrollTop();
	if ((screen.width>1024) && (screen.height>768))
	{
		var mid = scrollTop + Math.floor(windowHeight / 2) - 300;
	}else{
		var mid = scrollTop + Math.floor(windowHeight / 2) - 200;
	}
	return mid;
}

function openLayerVideo() {
	$('a.lien-popin-video').live('click', function(e) {
		e.preventDefault();
		_href = $(this).attr('href');
		$.modal.close();
		$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
		windowHeight = positionLayerVideo();
		$.ajax({
			url: _href,
			success: function(data) {
				$('#layer-video').html(data);
				$('#layer-video').modal({ minHeight: 600, position : [windowHeight,0]});
			}
		});
	});
}

function DisplayBloc(id,etat) {
	$("."+id).css("display", etat);
}

//-------------------------------------------------------------------------------------------------------------------------
// WEB TV V4
//-------------------------------------------------------------------------------------------------------------------------
/* affiche le input text et cache le input password*/
function showLibellePwdInputWebTv() {
	if( $('#mdpWebTv').val() == ''){
		$('#lib_mdpWebTv').val("Mot de passe");
		$('#mdpWebTv').hide();
		$('#lib_mdpWebTv').show();
	}
}

/* cache le input text et affiche le input password*/
function hideLibellePwdInputWebTv() {
	$('#lib_mdpWebTv').hide();
	$('#mdpWebTv').css("display","");
	$('#mdpWebTv').focus();
}

/* cache la value de input mail*/
function hideLibelleEmailInputWebTv() {
	$('#lib_emailWebTv').hide();	
	$('#emailWebTv').css("display","");
	$('#emailWebTv').focus();
}

/* affiche la value de input mail*/
function showLibelleEmailInputWebTv(){
	if( $('#emailWebTv').val() == ''){
		$('#lib_emailWebTv').val("E-mail");
		$('#emailWebTv').hide();
		$('#lib_emailWebTv').show();
	}
}
function detectFlash() {
	if(navigator.mimeTypes.length > 0 ) {
		if( typeof(navigator.mimeTypes["application/x-shockwave-flash"])!='undefined'){
			return navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin != null;
		}else{
			return false;
		}
	}else if( window.ActiveXObject ) {
		try {
			new ActiveXObject( "ShockwaveFlash.ShockwaveFlash" );
			return true;
		} catch( oError ){
			return false;
		}
	}else{
		return false;
	}
}

function openTestConfig() {
	$('a.lien-popin-test-config').unbind('click');
	$('a.lien-popin-test-config').bind('click', function(e) {
		e.preventDefault();
		_href = $(this).attr('href');
		$.modal.close();
		$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
		$.ajax({
			url: _href,
			success: function(data) {
				$('#fiche').html(data);
				$('#fiche').modal({ minHeight: 420, position : [200,0]});
			}
		});
	});
}

function openConfigFromFlash(){
	$("#test-configuration-webtv").trigger('click');
}

function keepAliveSession() {
	if ($.cookie("webtv_session") == "1") {
		var url = "/ajax/private/check_session.php";
		$.getScript(url);
		setTimeout("keepAliveSession()", 900000); // 15 minutes
	}
}
//-------------------------------------------------------------------------------------------------------------------------
// CHARME
//-------------------------------------------------------------------------------------------------------------------------
function CloseLayer() {
	$.cookie("InternauteMajeur", 1, { expires: ""});
	$.modal.close();
	$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
}
function RedirectionHome() {
	var lienHome = $('a#lien-18ans-avertissement').attr("href");
	parent.document.location.href=lienHome;
}
function openLayerAvertissement() {
	$('a.lien-popin-avertissement').unbind('click');
	$('a.lien-popin-avertissement').bind('click', function(e) {
		e.preventDefault();
		_href = $(this).attr('href');
		$.modal.close();
		$.modal.defaults.closeHTML = "<a class=\"modalCloseImg\" title=\"Fermer\" onClick=\"RedirectionHome();\"></a>";
		$.ajax({
			url: _href,
			success: function(data) {
				$('#avertissement-charme').html(data);
				$('#avertissement-charme').modal({ minHeight: 600, position : [300,0]
				});
			}
		});
	});
}
function ClickLienAvertissement() {
	$('a#lien-popin-avertissement').trigger('click');
}
function ProgrammeCharmeEnvoi() {

	if(logue == 1){
		$('.lien_non_logue').addClass("lien_non_visible").removeClass("lien_visible");
		$('.lien_logue').addClass("lien_visible").removeClass("lien_non_visible");
	}else{
		$('.lien_logue').addClass("lien_non_visible").removeClass("lien_visible");
		$('.lien_non_logue').addClass("lien_visible");
		$('.lien_non_logue').removeClass("lien_non_visible");
	}
}

//-------------------------------------------------------------------------------------------------------------------------
//WEB TV
//-------------------------------------------------------------------------------------------------------------------------
function jumpToEpgChannel(id) {
	//appel ajax
	$.ajax({
		url: 'ajax/getChaineId.php',
		async: false,
		type: 'post',
		data: 'id='+id,
		success: function(data){
			loadGrilleNavigationChaines(data);
		}
	});
}


// Positionnement GRILLE TV
function positionnementGrilleTV() {
	isIE = $.browser.msie;
	if ($("#panneau-thematique").css("display")=="none") {
		h1 = 0;
	} else {
		h1 = parseInt($("#panneau-thematique").height());
	}
	nav1_active = false;
	$("#navigation_secondaire .contenu-theme-header").each(function(){
		if ($(this).css("display")!="none") {
			nav1_active = true;
		}
	});
	if (nav1_active) {
		h2 = parseInt($("#navigation_secondaire").height());
	} else {
		h2 = 0;
	}
	if ($("#grille_multi").size() > 0) {
		$("#grille_multi.jcarousel-skin-tango .jcarousel-next-horizontal").css("top", 345+h1+h2);
		$("#grille_multi.jcarousel-skin-tango .jcarousel-prev-horizontal").css("top", 345+h1+h2);
	}
}

function PopinWebTv(){
   $('.lien-popin-presentation-webtv').unbind('click');
	$('.lien-popin-presentation-webtv').click(function(e) {
			e.preventDefault();
			_href = $(this).attr('href');
			$.modal.close();
			$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
			$('#premierevisite').html('');
			$('#identification-webtv').html('');
			$('#mdp-oublie').html('');
			$('#controle-acces-webtv').html('');
			$('#inscription').html('');
			positionTop = positionPopupTopIdentif();
			$.ajax({
				url: _href,
				success: function(data) {
        			$('#popin-presentation-webtv').html(data);
        			refreshPopin();
					$("#popin-presentation-webtv").modal({position: [positionTop], overlayClose:true });
					
				}
			});

    });
   $('.lien-popin-controle-acces').unbind('click');
	$('.lien-popin-controle-acces').click(function(e) {
			e.preventDefault();
			_href = $(this).attr('href');
			$.modal.close();
			$.modal.defaults.closeHTML='<a class="modalCloseImg isEpgid" title="Fermer"></a>';
			$('#premierevisite').html('');
			$('#identification-webtv').html('');
			$('#mdp-oublie').html('');
			$('#controle-acces-webtv').html('');
			$('#inscription').html('');
			positionTop = positionPopupTopIdentif();
			$.ajax({
				url: _href,
				success: function(data) {
        			$('#controle-acces-webtv').html(data);
					$("#controle-acces-webtv").modal({position: [positionTop], overlayClose:true });
					
				}
			});

    });
   $('.lien-popin-identification-webtv').unbind('click');
	$('.lien-popin-identification-webtv').bind('click', function(e) {
			e.preventDefault();
			_href = $(this).attr('href');
			$.modal.close();
			$.modal.defaults.closeHTML='<a class="modalCloseImg isEpgid" title="Fermer"></a>';
			$('#premierevisite').html('');
			$('#identification-webtv').html('');
			$('#mdp-oublie').html('');
			$('#controle-acces-webtv').html('');
			$('#inscription').html('');
			positionTop = positionPopupTopIdentif();
			$.ajax({
				url: _href,
				success: function(data) {
					$('#identification-webtv').html(data);
					$("#identification-webtv").modal({position: [positionTop], overlayClose :true});
				}
			});
    });
	$(".isEpgid").live('click',function() {
		var urlLienLiveTv;
		window.top.$('.nav_livetv').each(function(){
			if($(this).is(':visible')){
				urlLienLiveTvEpgId = window.top.$(this).find('a').attr('href');
				urlLienLiveTv = urlLienLiveTvEpgId.replace(/[?&]epgid=[\d]+/g,"");
				window.top.$(this).find('a').attr('href', urlLienLiveTv);
			}
		});
		
	});
}

var shadowObject = null;
var shadowCurrentIteration = 1;
var shadowMaxIteration = 3;
var shadowPeriod = 75;
function shadow() {
	$(shadowObject).each(function() {
		if ($(this).hasClass("shadow")) {
			$(this).removeClass("shadow");
		} else {
			$(this).addClass("shadow");
		}
	});
	if (shadowCurrentIteration == shadowMaxIteration*2) {
		shadowCurrentIteration = 1;
	} else {
		shadowCurrentIteration += 1;
		setTimeout("shadow()", shadowPeriod);
	}
}

function ShadowModal(idPopin, idOverlay){
	$(idOverlay).live('click', function() {
		shadowObject = $(idPopin+" div.header");
		shadow();
	});
}
function PopinWebTvNoEsc(){
	if(authentif_light == 1 || logue == 0){
		PositionTopPresentation = 270;
	}else if(nivGamme == 5){
		PositionTopPresentation = 290;
	}else if(nivGamme == 3 || nivGamme == 4){
		PositionTopPresentation = 280;
	}else if(aboCplus == 1){
		PositionTopPresentation = 290;
	}else if(nivGamme == 0){
		PositionTopPresentation = 290;
	}else{
		PositionTopPresentation = 320;
	}
	
	$('.lien-popin-identification-webtv').unbind('click');
	$('.lien-popin-identification-webtv').bind('click', function(e) {
			e.preventDefault();
			_href = $(this).attr('href');
			$.modal.close();
			$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
			$('#premierevisite').html('');
			$('#identification-webtv').html('');
			$('#mdp-oublie').html('');
			$('#controle-acces-webtv').html('');
			$('#inscription').html('');
			positionTop = positionPopupTopIdentif();
			$.ajax({
				url: _href,
				success: function(data) {
					$('#identification-webtv').html(data);
					$("#identification-webtv").modal({position: [320], escClose:false, 
						overlayId : "identifLiveTv" ,
						onShow:function (dialog) { 
			          	 ShadowModal('#identification-webtv', "#identifLiveTv"); 
			           } 
					});
				}
			});
    });
    
    $('.lien-popin-presentation-webtv').unbind('click');
	$('.lien-popin-presentation-webtv').click(function(e) {
			e.preventDefault();
			_href = $(this).attr('href');
			$.modal.close();
			$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
			$('#premierevisite').html('');
			$('#identification-webtv').html('');
			$('#mdp-oublie').html('');
			$('#controle-acces-webtv').html('');
			$('#inscription').html('');
			positionTop = positionPopupTopIdentif();
			$.ajax({
				url: _href,
				success: function(data) {
        			$('#popin-presentation-webtv').html(data);
        			refreshPopin();
					$("#popin-presentation-webtv").modal({position: [PositionTopPresentation], escClose:false, 
						overlayId : "popinLiveTv" ,
						onShow:function (dialog) { 
			          	 ShadowModal("#popin-presentation-webtv", "#popinLiveTv"); 
			           } 
					});
				}
			});

    });
    $('.lien-popin-controle-acces').unbind('click');
	$('.lien-popin-controle-acces').click(function(e) {
			e.preventDefault();
			_href = $(this).attr('href');
			$.modal.close();
			$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
			$('#premierevisite').html('');
			$('#identification-webtv').html('');
			$('#mdp-oublie').html('');
			$('#controle-acces-webtv').html('');
			$('#inscription').html('');
			positionTop = positionPopupTopIdentif();
			$.ajax({
				url: _href,
				success: function(data) {
        			$('#controle-acces-webtv').html(data);
					$("#controle-acces-webtv").modal({position: [320], escClose:false,
						overlayId : "controleLiveTv" ,
						onShow:function (dialog) { 
			          	 ShadowModal("#controle-acces-webtv","#controleLiveTv"); 
			           } 
					});
				}
			});

    });
    
}

function updateAccount(){
	//inscription
    $('.lien-popin-update-inscription').unbind('click');
    $('.lien-popin-update-inscription').click(function(e) {
			e.preventDefault();
			_href = $(this).attr('href');
			$.modal.close();
			$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
			$('#premierevisite').html('');
			$('#identification').html('');
			$('#mdp-oublie').html('');
			positionInscription = positionPopupTopInsc();
			$.ajax({
				url: _href,
				success: function(data) {
        			$('#inscription').html(data);
        			$("#inscription").modal({position: [positionInscription],
        			onShow:function (dialog) { 
			            $('div#simplemodal-container input[name=SUBSCRIBER_NUMBER_1]').focus(); 
			           } 
        			});
				}
			});

    });
}

function refreshPopin() {
	
	var cookie_gamme = $.cookie("gamme");
	if(authentif_light == 1 || logue == 0){
		$('#popin-presentation-webtv').css("width","845px");
		$('#popin-presentation-webtv').css("margin","auto");
		$('#popin-presentation-webtv div.header').css("width","835px");
		$('#popin-nl').addClass("display-block").removeClass("display-none");
		$('#popin-nl2').addClass("display-none").removeClass("display-block");
		$('#popin-nl3').addClass("display-none").removeClass("display-block");
		$('#popin-nl4').addClass("display-none").removeClass("display-block");
		$('#popin-cinqetoiles').addClass("display-none").removeClass("display-block");
		$('#popin-trois-quatre-etoiles').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-abo-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-cplus').addClass("display-none").removeClass("display-block");
	}else if(cookie_gamme !="webtv" && logue !=0 && aboCplusNonEligible == 1 && OldAbonne ==1){
		$('#popin-presentation-webtv').css("width","845px");
		$('#popin-presentation-webtv').css("margin","auto");
		$('#popin-presentation-webtv div.header').css("width","835px");
		$('#popin-nl2').addClass("display-block").removeClass("display-none");
		$('#popin-nl3').addClass("display-none").removeClass("display-block");
		$('#popin-nl4').addClass("display-none").removeClass("display-block");
		$('#popin-cinqetoiles').addClass("display-none").removeClass("display-block");
		$('#popin-trois-quatre-etoiles').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-abo-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-nl').addClass("display-none").removeClass("display-block");
		
	}else if(cookie_gamme !="webtv" && logue !=0 && aboCoupleNonEligible == 1 && OldAbonne ==1){ 
		
		$('#popin-presentation-webtv').css("width","845px");
		$('#popin-presentation-webtv').css("margin","auto");
		$('#popin-presentation-webtv div.header').css("width","835px");
		$('#popin-nl2').addClass("display-none").removeClass("display-block");
		$('#popin-nl4').addClass("display-none").removeClass("display-block");
		$('#popin-nl3').addClass("display-block").removeClass("display-none");
		$('#popin-cinqetoiles').addClass("display-none").removeClass("display-block");
		$('#popin-trois-quatre-etoiles').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-abo-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-nl').addClass("display-none").removeClass("display-block");
		
	}else if(nivGamme == 0){
		$('#popin-presentation-webtv').css("width","845px");
		$('#popin-presentation-webtv').css("margin","auto");
		$('#popin-presentation-webtv div.header').css("width","835px");
		$('#popin-nl').addClass("display-none").removeClass("display-block");
		$('#popin-nl2').addClass("display-none").removeClass("display-block");
		$('#popin-nl3').addClass("display-none").removeClass("display-block");
		$('#popin-nl4').addClass("display-none").removeClass("display-block");
		$('#popin-cinqetoiles').addClass("display-none").removeClass("display-block");
		$('#popin-trois-quatre-etoiles').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-abo-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-cplus').addClass("display-block").removeClass("display-none");
	}else if(cookie_gamme !="webtv" && logue !=0 && aboCSATSansPack == 1){ 
		$('#popin-presentation-webtv').css("width","845px");
		$('#popin-presentation-webtv').css("margin","auto");
		$('#popin-presentation-webtv div.header').css("width","835px");
		$('#popin-nl2').addClass("display-none").removeClass("display-block");
		$('#popin-nl3').addClass("display-none").removeClass("display-block");
		$('#popin-nl4').addClass("display-block").removeClass("display-none");
		$('#popin-cinqetoiles').addClass("display-none").removeClass("display-block");
		$('#popin-trois-quatre-etoiles').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-abo-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-nl').addClass("display-none").removeClass("display-block");
		
	}
	
	else if(nivGamme == 5){
//		$('#popin-presentation-webtv').css("width","723px");
//		$('#popin-presentation-webtv').css("margin","auto");
//		$('#popin-presentation-webtv div.header').css("width","723px");
//		$('#popin-nl').addClass("display-none").removeClass("display-block");
//		$('#popin-cinqetoiles').addClass("display-block").removeClass("display-none");
//		$('#popin-trois-quatre-etoiles').addClass("display-none").removeClass("display-block");
//		$('#popin-no-abo-csat-abo-cplus').addClass("display-none").removeClass("display-block");
//		$('#popin-no-abo-csat-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-presentation-webtv').css("width","845px");
		$('#popin-presentation-webtv').css("margin","auto");
		$('#popin-presentation-webtv div.header').css("width","835px");
		$('#popin-nl2').addClass("display-none").removeClass("display-block");
		$('#popin-nl3').addClass("display-none").removeClass("display-block");
		$('#popin-nl4').addClass("display-block").removeClass("display-none");
		$('#popin-cinqetoiles').addClass("display-none").removeClass("display-block");
		$('#popin-trois-quatre-etoiles').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-abo-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-nl').addClass("display-none").removeClass("display-block");
	}else if(nivGamme == 3 || nivGamme == 4){
//		if(navigator.appCodeName == "Mozilla"){
//			$('#popin-presentation-webtv').css("width","672px");
//		}else{	
//			$('#popin-presentation-webtv').css("width","673px");
//		}
//		$('#popin-presentation-webtv').css("margin","auto");
//		$('#popin-presentation-webtv div.header').css("width","673px");
//		$('#popin-nl').addClass("display-none").removeClass("display-block");
//		$('#popin-cinqetoiles').addClass("display-none").removeClass("display-block");
//		$('#popin-trois-quatre-etoiles').addClass("display-block").removeClass("display-none");
//		$('#popin-no-abo-csat-abo-cplus').addClass("display-none").removeClass("display-block");
//		$('#popin-no-abo-csat-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-presentation-webtv').css("width","845px");
		$('#popin-presentation-webtv').css("margin","auto");
		$('#popin-presentation-webtv div.header').css("width","835px");
		$('#popin-nl2').addClass("display-none").removeClass("display-block");
		$('#popin-nl3').addClass("display-none").removeClass("display-block");
		$('#popin-nl4').addClass("display-block").removeClass("display-none");
		$('#popin-cinqetoiles').addClass("display-none").removeClass("display-block");
		$('#popin-trois-quatre-etoiles').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-abo-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-nl').addClass("display-none").removeClass("display-block");
	}else if(aboCplus == 1){
//		$('#popin-presentation-webtv').css("width","695px");
//		$('#popin-presentation-webtv').css("margin","auto");
//		$('#popin-presentation-webtv div.header').css("width","695px");
//		$('#popin-nl').addClass("display-none").removeClass("display-block");
//		$('#popin-cinqetoiles').addClass("display-none").removeClass("display-block");
//		$('#popin-trois-quatre-etoiles').addClass("display-none").removeClass("display-block");
//		$('#popin-no-abo-csat-abo-cplus').addClass("display-block").removeClass("display-none");
//		$('#popin-no-abo-csat-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-presentation-webtv').css("width","845px");
		$('#popin-presentation-webtv').css("margin","auto");
		$('#popin-presentation-webtv div.header').css("width","835px");
		$('#popin-nl2').addClass("display-none").removeClass("display-block");
		$('#popin-nl3').addClass("display-none").removeClass("display-block");
		$('#popin-nl4').addClass("display-block").removeClass("display-none");
		$('#popin-cinqetoiles').addClass("display-none").removeClass("display-block");
		$('#popin-trois-quatre-etoiles').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-abo-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-no-abo-csat-cplus').addClass("display-none").removeClass("display-block");
		$('#popin-nl').addClass("display-none").removeClass("display-block");
	}
	
	
}
function refreshLienLiveTvFooter(){
	var cookie_gamme = $.cookie("gamme");
	
	
	if(cookie_gamme == "webtv"){
		$('.avec-cg').addClass("display-block").removeClass("display-none");
		$('.sans-cg').addClass("display-none").removeClass("display-block");
	}else{
		if(logue !=0 && aboCplusNonEligible == 1 && OldAbonne ==1){
			$('.avec-cg').addClass("display-none").removeClass("display-block");
			$('.sans-cg').addClass("display-none").removeClass("display-block");
			$('.oldAbonneCplus').addClass("display-block").removeClass("display-none");
			$('.oldAbonneCouple').addClass("display-none").removeClass("display-block");
			$('.abonnecsatsanspack').addClass("display-none").removeClass("display-block");
		}else if(logue !=0 && aboCoupleNonEligible == 1 && OldAbonne ==1){ 
			$('.avec-cg').addClass("display-none").removeClass("display-block");
			$('.sans-cg').addClass("display-none").removeClass("display-block");
			$('.oldAbonneCouple').addClass("display-block").removeClass("display-none");
			$('.oldAbonneCplus').addClass("display-none").removeClass("display-block");
			$('.abonnecsatsanspack').addClass("display-none").removeClass("display-block");
		}else if(logue !=0 && aboCSATSansPack == 1){ 
			$('.avec-cg').addClass("display-none").removeClass("display-block");
			$('.sans-cg').addClass("display-none").removeClass("display-block");
			$('.abonnecsatsanspack').addClass("display-block").removeClass("display-none");
			$('.oldAbonneCplus').addClass("display-none").removeClass("display-block");
			$('.oldAbonneCouple').addClass("display-none").removeClass("display-block");
		}else if(nivGamme == 3 || nivGamme == 4 || nivGamme == 5){
			$('.avec-cg').addClass("display-none").removeClass("display-block");
			$('.sans-cg').addClass("display-none").removeClass("display-block");
			$('.abonnecsatsanspack').addClass("display-block").removeClass("display-none");
			$('.oldAbonneCplus').addClass("display-none").removeClass("display-block");
			$('.oldAbonneCouple').addClass("display-none").removeClass("display-block");
		}else{
			$('.sans-cg').addClass("display-block").removeClass("display-none");
			$('.avec-cg').addClass("display-none").removeClass("display-block");
		}
	}
}
function refreshLienLiveTvHeader(){
	var url = "/ajax/private/check_eligibility.php";

	jQuery.getScript(url, function(){
		//on r?cup?re uniquement la variable "abonne_webtv"
		if(authentif == 1){
			if (abonne_webtv == 1) {
				jQuery.cookie("gamme", "webtv", { expires: 7300 , path: '/' }); // 20 ans
			} else {
				jQuery.cookie("gamme", "", { expires: 7300 , path: '/' }); // 20 ans
			}
		}
		
	
	var cookie_gamme = jQuery.cookie("gamme");
	
	if(cookie_gamme != "webtv" && authentif_light == 1){
		$('.nl-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-sans-cg').addClass("display-block").removeClass("display-none");
		$('.light-avec-cg').addClass("display-none").removeClass("display-block");
		$('.logue-avec-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-sans-cg').css("display", "none");
		$('.nl-avec-cg').css("display", "none");
		$('.light-avec-cg').css("display", "none");
		$('.light-sans-cg').css("display", "block");
		$('.logue-avec-sans-cg').css("display", "none");
		$('a.direct-light-sans-cg').parent('li').css("display", "inline");
	}else if(cookie_gamme == "webtv" && authentif_light == 1){
		$('.nl-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-sans-cg').addClass("display-none").removeClass("display-block");
		$('.light-avec-cg').addClass("display-block").removeClass("display-none");
		$('.logue-avec-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-sans-cg').css("display", "none");
		$('.nl-avec-cg').css("display", "none");
		$('.light-avec-cg').css("display", "block");
		$('.light-sans-cg').css("display", "none");
		$('.logue-avec-sans-cg').css("display", "none");
		$('a.direct-light-avec-cg').parent('li').css("display", "inline");
	}else if(cookie_gamme !="webtv" && logue !=0 && abonne ==1 && aboCplusNonEligible == 1 && OldAbonne ==1){
		$('.direct-nl-sans-cg-old-cplus').addClass("display-block").removeClass("display-none");
		$('.nl-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-sans-cg').addClass("display-none").removeClass("display-block");
		$('.logue-avec-sans-cg').addClass("display-none").removeClass("display-block");
		$('.direct-nl-sans-cg-old-cplus').css("display", "block");
		$('.nl-sans-cg').css("display-none");
		$('.nl-avec-cg').css("display", "none");
		$('.light-avec-cg').css("display", "none");
		$('.light-sans-cg').css("display", "none");
		$('.logue-avec-sans-cg').css("display", "none");
		$('a.direct-nl-sans-cg-old-cplus').parent('li').css("display", "inline");
	}else if(cookie_gamme !="webtv" && logue !=0 && abonne ==1 && aboCoupleNonEligible == 1 && OldAbonne ==1){ 
		$('.direct-nl-sans-cg-old-couple').addClass("display-block").removeClass("display-none");
		$('.nl-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-sans-cg').addClass("display-none").removeClass("display-block");
		$('.logue-avec-sans-cg').addClass("display-none").removeClass("display-block");
		$('.direct-nl-sans-cg-old-couple').css("display", "block");
		$('.nl-sans-cg').css("display-none");
		$('.nl-avec-cg').css("display", "none");
		$('.light-avec-cg').css("display", "none");
		$('.light-sans-cg').css("display", "none");
		$('.logue-avec-sans-cg').css("display", "none");
		$('a.direct-nl-sans-cg-old-couple').parent('li').css("display", "inline");
	}else if(cookie_gamme !="webtv" && logue !=0 && abonne ==1 && aboCSATSansPack == 1){ 
		$('.direct-nl-sans-cg-sans-packservice').addClass("display-block").removeClass("display-none");
		$('.nl-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-sans-cg').addClass("display-none").removeClass("display-block");
		$('.logue-avec-sans-cg').addClass("display-none").removeClass("display-block");
		$('.direct-nl-sans-cg-sans-packservice').css("display", "block");
		$('.nl-sans-cg').css("display-none");
		$('.nl-avec-cg').css("display", "none");
		$('.light-avec-cg').css("display", "none");
		$('.light-sans-cg').css("display", "none");
		$('.logue-avec-sans-cg').css("display", "none");
		$('a.direct-nl-sans-cg-sans-packservice').parent('li').css("display", "inline");
	}else if(cookie_gamme != "webtv" && logue != 1 && authentif_light == 0){
		$('.nl-sans-cg').addClass("display-block").removeClass("display-none");
		$('.nl-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-sans-cg').addClass("display-none").removeClass("display-block");
		$('.logue-avec-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-sans-cg').css("display", "block");
		$('.nl-avec-cg').css("display", "none");
		$('.light-avec-cg').css("display", "none");
		$('.light-sans-cg').css("display", "none");
		$('.logue-avec-sans-cg').css("display", "none");
		$('a.direct-nl-sans-cg').parent('li').css("display", "inline");
	}else if(cookie_gamme == "webtv" && logue != 1 && authentif_light == 0){
		$('.nl-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-avec-cg').addClass("display-block").removeClass("display-none");
		$('.light-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-sans-cg').addClass("display-none").removeClass("display-block");
		$('.logue-avec-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-sans-cg').css("display", "none");
		$('.nl-avec-cg').css("display", "block");
		$('.light-avec-cg').css("display", "none");
		$('.light-sans-cg').css("display", "none");
		$('.logue-avec-sans-cg').css("display", "none");
		$('a.direct-nl-avec-cg').parent('li').css("display", "inline");
	}else if(cookie_gamme == "webtv" && (logue != 1 || pose==1)  && authentif_light == 0){
		$('.nl-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-sans-cg').addClass("display-none").removeClass("display-block");
		$('.logue-avec-sans-cg').addClass("display-block").removeClass("display-none");
		$('.nl-sans-cg').css("display", "none");
		$('.nl-avec-cg').css("display", "none");
		$('.light-avec-cg').css("display", "none");
		$('.light-sans-cg').css("display", "none");
		$('.logue-avec-sans-cg').css("display", "block");
		$('a.direct-logue-avec-sans-cg').parent('li').css("display", "inline");
	}else if(nivGamme == 0){
		$('.direct-nl-sans-cg-sans-packservice').addClass("display-block").removeClass("display-none");
		$('.nl-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-sans-cg').addClass("display-none").removeClass("display-block");
		$('.logue-avec-sans-cg').addClass("display-none").removeClass("display-block");
		$('.direct-nl-sans-cg-sans-packservice').css("display", "block");
		$('.nl-sans-cg').css("display-none");
		$('.nl-avec-cg').css("display", "none");
		$('.light-avec-cg').css("display", "none");
		$('.light-sans-cg').css("display", "none");
		$('.logue-avec-sans-cg').css("display", "none");
		$('a.direct-nl-sans-cg-sans-packservice').parent('li').css("display", "inline");
		
	}else if((nivGamme == 3 || nivGamme == 4 || nivGamme == 5) && logue != 1){
		$('.direct-nl-sans-cg-sans-packservice').addClass("display-block").removeClass("display-none");
		$('.nl-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-sans-cg').addClass("display-none").removeClass("display-block");
		$('.logue-avec-sans-cg').addClass("display-none").removeClass("display-block");
		$('.direct-nl-sans-cg-sans-packservice').css("display", "block");
		$('.nl-sans-cg').css("display-none");
		$('.nl-avec-cg').css("display", "none");
		$('.light-avec-cg').css("display", "none");
		$('.light-sans-cg').css("display", "none");
		$('.logue-avec-sans-cg').css("display", "none");
		$('a.direct-nl-sans-cg-sans-packservice').parent('li').css("display", "inline");
	}else{
		$('.nl-sans-cg').addClass("display-none").removeClass("display-block");
		$('.nl-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-avec-cg').addClass("display-none").removeClass("display-block");
		$('.light-sans-cg').addClass("display-none").removeClass("display-block");
		$('.logue-avec-sans-cg').addClass("display-block").removeClass("display-none");
		$('.nl-sans-cg').css("display", "none");
		$('.nl-avec-cg').css("display", "none");
		$('.light-avec-cg').css("display", "none");
		$('.light-sans-cg').css("display", "none");
		$('.logue-avec-sans-cg').css("display", "block");
		$('a.direct-logue-avec-sans-cg').parent('li').css("display", "inline");
	}
	});
}

function sectionColHeights() {
	var timer1 = microtime(true);
	$("div.section div.cols div.col:first-child").addClass("col-first");
	var _cols = $("div.section div.cols");
	_cols.each(function(i,val){
		if (!$(this).parent().hasClass("noSectionColHeights")) {
			var max = 0;
			$(this).children("div.col").each(function(j){
				if ($(this).height() > max) max = $(this).height();
			});
			if (max != 0) {
				if (isIE || $.browser.msie || isSafari) {
					$(this).parents("div.section").attr("maxheight",max);
				}
				if ( $(this).children("div.col2x").length > 0 ) {
					$(this).children("div.col2x").children("ul").find("li").addClass("marginRight20");
				}
				$(this).find("div.col").height(max);
			}
		}
	});
	var timer2 = microtime(true);
	totalTimer["sectionColHeight"] = (timer2-timer1);
}
function sectionColHeightsAlt() {
	$("div.section div.cols div.col:first-child").addClass("col-first");
	var _cols = $("div.section div.cols");
	_cols.each(function(i,val){
		var heights = new Array();
		heights[0] = $(this).find("div.col:nth-child(1)").height();
		heights[1] = $(this).find("div.col:nth-child(2)").height();
		var max = 0;
		for (var i = 0; i <=1; i++) {
			if (heights[i] > max) {
				max = heights[i];
			}
		}
		$(this).find("div.col").height(Math.max(109, max));
		$(this).find("div.col > ul >li").height(Math.max(109, max));
		$(this).height(Math.max(109, max) + 16);
		$("#lesFilmsDuMois div.cols div.col").addClass("col-withBorder");
	});
}

function updateTableau(cle,valeur) {
	tableau.push(cle+","+valeur);
}
function jourAccordion() {
	// set up time and date to open the accordions at the right time
	var d = new Date();
	var h = d.getHours();
	// times to split by
	var t = [[6, 12], [12, 18], [18, 20], [20, 24], [0, 6]];
	// which to open
	var o = 0;
	for (var i = 0; i < t.length; i++) {
		if (h >= t[i][0] && h < t[i][1]) {
			o = i;
		}
	}
	// need to fix the heights of the accordions
	var hgts = { t1: [], t2: [], t3: [], t4: [], t5: [] };
	$("div.jour-accordion").each(function(div){
		// few helper class fixes
		$(this).contents("h5:first").addClass("last");
		$(this).contents("h5:last").addClass("last");
		$(this).contents("h5").eq(o).addClass("open");
		// find all the heights
		$(this).find("ul").each(function(i){
			hgts["t"+(i+1)][div] = $(this).height();
		});
		$(this).contents("h5").eq(o).removeClass("open");
	});
	// then fix the heights...
	$("div.jour-accordion").each(function(i){
		$(this).find("ul").each(function(i){
			// sort the array by length, bring the biggest value to the 1st position
			hgts["t"+(i+1)].sort(function(a,b){return b - a});
			// and fix the heights
			$(this).height(hgts["t"+(i+1)][0]);
		});
		$(this).find("h5").each(function(i){
			$(this).find("a").click(function(e){
				e.preventDefault();
				$("div.jour-accordion").each(function(){
					$(this).contents("h5").eq(i).toggleClass("open");
					if (!isIE) {
						$(this).contents("ul").eq(i).animate({"height": "toggle"}, 1000);
					} else {
						$(this).contents("ul").eq(i).toggle();
					}
				});
				var valeur;
				cle = $(this).parents().attr("class").replace("open","");
				cle = cle.replace(" last", "");
				cle = cle.replace("accordeon_", "");
				if ($(this).parents().hasClass("open")) {
					valeur="1";
					updateTableau(cle,valeur);
				} else {
					valeur="0";
					updateTableau(cle, valeur);
				}
			});
		});
	});
	openAccordeon(o);
}
function semaineSlider() {

	var sliderContainer = $(".planifier .planifier-header .semaine-slider-container");
	var sliderInner = $(".planifier .planifier-header .semaine-slider-container .semaine-slider");
	var sliderInnerChaines = $(".planifier-chaines .planifier-header .semaine-slider-container .semaine-slider");
	var sliderInnerChaine = $(".planifier-chaine .planifier-header .semaine-slider-container .semaine-slider");
	var sliderInnerChaine1 = $(".planifier-chaine .planifier-header1 .semaine-slider-container .semaine-slider");
	var sliderInnerChaine2 = $(".planifier-chaine .planifier-header2 .semaine-slider-container .semaine-slider");
	var slideAmount = 98;
	var sliderMoving = false;
	var currentSet = 3;
	var budge = 4;
	if (sliderInnerChaines.html()) {
		var maxSet = 12;
	} else {
		var maxSet = 5;
	}

	var currentDayIndex_r = 0; /* relative index of the current day */
	var todayIndex = 0; /* stays the same */

	var currentOffsetLeft = 0;
	var _x1 = $("#canalsat").offset().left + 5;
	var _x2 = _x1 + (5 * 127);

	
	// set up
	getCurrentIndexes();
	updateCurrentOffsetLeft(); // initialize
	todayIndex = currentDayIndex_r;
	//
	var currentSliderPos = budge + ((currentDayIndex_r) * slideAmount * -1); // because the current day is meant to be in 2nd position in the semaineSlider
	sliderInner.css({ left: currentSliderPos });

	// returns relative index of the current day
	function getCurrentIndexes() {
		var current = $(".semaine-slider ul li.current:first");
		currentDayIndex_r = current.prevAll().size();
	}

	function updateCurrentOffsetLeft() {
		currentOffsetLeft = sliderInner.find("ul").find("li").eq(currentDayIndex_r-1).offset().left;
	}

	// the slider functions
	function moveSlider(direction) {
		
		if (!sliderMoving) {
			calculateNextPosition(direction);
			sliderMoving = true;
			sliderInner.animate({
				left: currentSliderPos
			}, 800, function(){ sliderMoving = false; });
			updateSlider(direction);
			updatePaginator();
		}
	}
	// calculate the next position of the slider
	function calculateNextPosition(direction) {
		if(direction == 'right') {
			currentSliderPos -= 127;
			currentSet++;
		} else if (direction == 'left') {
			currentSliderPos += 127;
			currentSet--;
		}
	}

	// update paginator links
	function updatePaginator() {
		if(currentDayIndex_r == 0) {
			sliderContainer.find("ul[class*=paginator]").find("li.prev a").hide();
			sliderContainer.find("ul[class*=paginator]").find("li.next a").show();
		} else if (currentDayIndex_r == (maxSet-1)) {
			sliderContainer.find("ul[class*=paginator]").find("li.next a").hide();
			sliderContainer.find("ul[class*=paginator]").find("li.prev a").show();
		} else {
			sliderContainer.find("ul[class*=paginator]").find("li.next a").show();
			sliderContainer.find("ul[class*=paginator]").find("li.prev a").show();
		}
	}

	function updateSlider(direction) {
		if (direction == "right") {
			sliderInner.find("ul").find("li.current").removeClass("current");
			sliderInner.find("ul").find("li").eq(currentDayIndex_r+1).addClass("current");
		} else if (direction == "left"){
			sliderInner.find("ul").find("li.current").removeClass("current");
			sliderInner.find("ul").find("li").eq(currentDayIndex_r-1).addClass("current");
		}
		getCurrentIndexes(); // updates the index
		updateCurrentOffsetLeft(); // updates the left offset
		sliderInner.find("ul").find("li.current").trigger("click");
	}
	if(clickOk==0){
		// add some events to the slider buttons
		sliderContainer.find("ul[class*=paginator]").find("li.prev a").click(function(e){
			e.preventDefault();
			if(clickOk==0){
				updateCurrentOffsetLeft();
				if (currentOffsetLeft <= _x1) {
					moveSlider('left');
				} else {
					updateSlider('left');
				}
			}	
		});
		sliderContainer.find("ul[class*=paginator]").find("li.next a").click(function(e){
			e.preventDefault();
			if(clickOk==0){
				updateCurrentOffsetLeft();
				if (sliderInnerChaines.html()) {
					if (currentOffsetLeft >= _x2) {
						moveSlider('right');
					} else {
						updateSlider('right');
					}
				} else {
					moveSlider('right');
				}
			}
		});
		sliderInnerChaines.find("ul").find("li").click(function(e){
			e.preventDefault();
			if(clickOk==0){
				if (!$(this).hasClass("current")) {
					updateCurrentOffsetLeft();
					sliderInnerChaines.find("ul").find("li.current").removeClass("current");
					$(this).addClass("current");
					currentDayIndex_r = $(this).prevAll().size(); // updates the index of current
					updateCurrentOffsetLeft(); // updates the left offset of current
				}
				currentDate = sliderInnerChaines.find("ul").find("li.current").attr("id").replace("nav-", "");
				currentChaine = $('#bloc_programmes').find(".ch-first").attr("class").replace("ch ch-first ch-", "");
				grilleChaines(currentDate, currentChaine, iThematiqueId, '', iTemplateId, sChainesAbo, true);
			}
		});
		
		/*sliderInnerChaine.find("ul").find("li").click(function(e){
			e.preventDefault();
			if(clickOk==0){
				if (!$(this).hasClass("current")) {
					updateCurrentOffsetLeft();
					currentDayIndex_r = $(this).prevAll().size(); // updates the index of current
					updateCurrentOffsetLeft(); // updates the left offset of current
				}
				if ($(this).is("li[id^='nav-']")) {
					currentDate = $(this).attr("id").replace("nav-", "");
				} else {
					currentDate = $(this).attr("id").replace("nav2-", "");
				}
				sliderInnerChaine1.find("ul").find("li.current").removeClass("current");
				sliderInnerChaine1.find("ul").find("li#nav-"+currentDate).addClass("current");
				sliderInnerChaine2.find("ul").find("li.current").removeClass("current");
				sliderInnerChaine2.find("ul").find("li#nav2-"+currentDate).addClass("current");
				currentChaine = sliderInnerChaine.find("ul").attr("class").replace("planifier-chaine-", "");
				currentDate = sliderInnerChaine1.find("ul").find("li[id^='nav-']") .eq(currentSet-1).attr("id").replace("nav-", "");
				grilleChaine(currentDate, currentChaine);
			}	
		});*/
	
		paginationChaines();
	}
}



function semaineSlider2() {


	var sliderContainer2 = $(".planifier .planifier-header .semaine-slider-container2");
		var sliderInner2 = $(".planifier .planifier-header .semaine-slider-container2 .semaine-slider2");
		var sliderInnerChaines2 = $(".planifier-chaines .planifier-header .semaine-slider-container2 .semaine-slider2");
		var sliderInnerChaine2 = $(".planifier-chaine .planifier-header .semaine-slider-container2 .semaine-slider2");
		var sliderInnerChaine12 = $(".planifier-chaine .planifier-header1 .semaine-slider-container2 .semaine-slider2");
		var sliderInnerChaine22 = $(".planifier-chaine .planifier-header2 .semaine-slider-container2 .semaine-slider2");
		var slideAmount = 164.5;
		var sliderMoving = false;
		var currentSet = 3;
		var budge = 4;
		if (sliderInnerChaines2.html()) {
			var maxSet = 12;
		} else {
			var maxSet = 5;
		}

		var currentDayIndex_r = 0; /* relative index of the current day */
		var todayIndex = 0; /* stays the same */

		var currentOffsetLeft = 0;
		var _x1 = $("#canalsat").offset().left + 8;
		var _x2 = _x1 + (5 * 165);

			// set up
			getCurrentIndexes();
			updateCurrentOffsetLeft(); // initialize
			todayIndex = currentDayIndex_r;
			//
			var currentSliderPos = budge + ((currentDayIndex_r) * slideAmount * -1); // because the current day is meant to be in 2nd position in the semaineSlider
			sliderInner2.css({ left: currentSliderPos });

			// returns relative index of the current day
			function getCurrentIndexes() {
				var current = $(".semaine-slider2 ul li.current:first");
				currentDayIndex_r = current.prevAll().size();
			}

			function updateCurrentOffsetLeft() {
				if(sliderInner2.find("ul").find("li").eq(currentDayIndex_r-1).offset() !=null){
					currentOffsetLeft = sliderInner2.find("ul").find("li").eq(currentDayIndex_r-1).offset().left;
				}
			}

			// the slider functions
			function moveSlider(direction) {
				
				if (!sliderMoving) {
					calculateNextPosition(direction);
					sliderMoving = true;
					sliderInner2.animate({
							left: currentSliderPos
						}, 800, function(){ 
							sliderMoving = false;
							ajxSlider();
						}
					);
					updateSlider(direction);
				}
			}
			// calculate the next position of the slider
			function calculateNextPosition(direction) {
				if(direction == 'right') {
					currentSliderPos -= 165;
					currentSet++;
				} else if (direction == 'left') {
					currentSliderPos += 165;
					currentSet--;
				}
			}

			// update paginator links
			function updatePaginator() {
				
				if(currentDayIndex_r == 0) {
					sliderContainer2.find("ul[class*=paginator]").find("li.prev a").hide();
					sliderContainer2.find("ul[class*=paginator]").find("li.next a").show();
				} else if (currentDayIndex_r == (maxSet-1)) {
					sliderContainer2.find("ul[class*=paginator]").find("li.next a").hide();
					sliderContainer2.find("ul[class*=paginator]").find("li.prev a").show();
				} else {
					sliderContainer2.find("ul[class*=paginator]").find("li.next a").show();
					sliderContainer2.find("ul[class*=paginator]").find("li.prev a").show();
				}
				//$('.load-grille').remove();
			}

			function updateSlider(direction) {
				if (direction == "right") {
					sliderInner2.find("ul").find("li.current").removeClass("current");
					sliderInner2.find("ul").find("li").eq(currentDayIndex_r+1).addClass("current");
				} else if (direction == "left"){
					sliderInner2.find("ul").find("li.current").removeClass("current");
					sliderInner2.find("ul").find("li").eq(currentDayIndex_r-1).addClass("current");
				}
				getCurrentIndexes(); // updates the index
				updateCurrentOffsetLeft(); // updates the left offset
				sliderInner2.find("ul").find("li.current").trigger("click");
			}

			function ajxSlider(){
				currentChaine = sliderInnerChaine2.find("ul").attr("class").replace("planifier-chaine-", "");
				currentDate = sliderInnerChaine12.find("ul").find("li[id^='nav-']") .eq(currentSet-1).attr("id").replace("nav-", "");
					$.ajax({
						url: "/ajax/grilleChaine.php",
						data: {
							date: currentDate,
							chaine: currentChaine
						},
						dataType: "json",
						success: function(data) {
							$("div#bloc_soiree").html(data.soiree);
							$("div#bloc_programmes").html(data.programmes);
							$('.load-grille').remove();
							jourAccordion();
							labelMessages();
							updatePaginator();
						}	
					});		
			}
			
			
				// add some events to the slider buttons
				sliderContainer2.find("ul[class*=paginator]").find("li.prev a").click(function(e){
					e.preventDefault();
					$('.paginator li.prev a').hide();
					$('.paginator li.prev').append('<div class="load-grille"></div>');
					updateCurrentOffsetLeft();
					if (currentOffsetLeft <= _x1) {
						moveSlider('left');
						//ajxSlider();
					} else {
						updateSlider('left');
					}
					
				});
				
				sliderContainer2.find("ul[class*=paginator]").find("li.next a").click(function(e){
					e.preventDefault();
					$('.paginator li.next a').hide();
					$('.paginator li.next').append('<div class="load-grille"></div>');
					updateCurrentOffsetLeft();
					if (sliderInnerChaines2.html()) {
						if (currentOffsetLeft >= _x2) {
							moveSlider('right');
							//ajxSlider();
						} else {
							updateSlider('right');
						}
					} else {
						moveSlider('right');
						//ajxSlider();
					}
					
				});
				
				sliderInnerChaine2.find("ul").find("li").click(function(e){
					e.preventDefault();
				});	
}


function paginationChaines() {
	var etatClick = '';
	$('.paginator-chaine li').each(function() {
		if (!$(this).hasClass("inactif")) {
			$(this).bind("click", function(e) {
				e.preventDefault();
				if ($(this).hasClass("prev")) {
					chaine = $(this).attr("class").replace("prev prev-", "");
					etatClick = 'prev';
				} else
				if ($(this).hasClass("next")) {
					chaine = $(this).attr("class").replace("next next-", "");
					etatClick = 'next';
				}
				focus1 = $(this).parent().parent('.channels').attr('id');
				var sliderInnerChaines = $(".planifier-chaines .planifier-header .semaine-slider-container .semaine-slider");
				currentDate = sliderInnerChaines.find("ul").find("li.current").attr("id").replace("nav-", "");
				grilleChaines(currentDate, chaine, iThematiqueId, focus1, iTemplateId, sChainesAbo, false,true,etatClick);
				
			});
		}
	});
}


var nbMEA = 0;
var stopMEA = 0;
var delaiMEA = 6000;
var MEAS_encours = 0;
var MEA_encours = 0;
var nbMEAS_max = '';
var bLockMEAPopup = false;
var timeout_mea;
function changeMEA() {
	// Si cette fonction recoit 2 args, c'est que le changement est provoqué à la main
	var bManuel = (arguments.length == 2) ? true : false;
	// Si le script n'est pas bloqué, ou que le changement est manuel et que la popup programme n'est pas ouverte
	if (bManuel || stopMEA != 1 && !$("div#detailprogram-inner").is(":visible")){
	//alert(stopMEA);
	//if (bManuel || (stopMEA != 1 && !bLockMEAPopup)){
		// Quelle est la MEAS a changer ?
		// Si c'est un clic, on bloque le d?filement auto
		if (bManuel) {
			stopMEA = 1;
		}
		// On masque la MEA précédente
		$(".recommandations ul.features li").removeClass("current");
		$("ul.paginator li").removeClass("current");
		// 
		if (bManuel) {
			if (arguments[1]=="next") {
				MEA_encours++;
				if (MEA_encours > nbMEAS_max) {
					MEA_encours = 0;
				}
			}
			else if (arguments[1]=="prev") {
				MEA_encours--;
				if (MEA_encours < 0) {
					MEA_encours = nbMEAS_max;
				}
			}
			else {
				MEA_encours = arguments[1];
			}
		} else {
			// Si c'est automatique, on passe au suivant
			// Quel est la prochaine MEA de cette MEAS ?
			MEA_encours++;
			// Si le prochain est supérieur au nombre Max
			if (MEA_encours > nbMEAS_max) {
				MEA_encours = 0; // RAZ
			}
			
		}
		
		// On affiche la MEA courante
		$(".recommandations ul.features li.reco-"+MEA_encours).addClass("current");
		$("ul.paginator li.prog-"+MEA_encours).addClass("current");
	}
	clearTimeout(timeout_mea);
	if (bManuel) {
		// on réactivera la fonction dans 'delai' secondes si le changement est manuel...
		//relanceMEA();
		timeout_mea=setTimeout("changeMEA()", delaiMEA);
	} else {
		// sinon, on relance la fonction de défilement
		timeout_mea=setTimeout("changeMEA()", delaiMEA);
	}
}

function arreteMEA() {
	stopMEA = 1;
}
function relanceMEA() {
	stopMEA = 0;
}
function tvGrid() {
	browserTest();
	openLayer();
	if(chaineId==""){
		semaineSlider();
	}else{
		semaineSlider2();
	}	
	jourAccordion();
	if ($("div.bannerbar").is(":visible")) {
		$("div.leprogrammedelajournee").addClass("leprogrammedelajournee-with-bannebar");
	}
	//openLayerVideo();
	grilleRecommandations();
	grilleLiensAuth();
	grilleInfoEureka();
	$('.click-zone').live('click', function(e) {
		e.preventDefault();
		_href = $(this).find('a').attr('href');
		document.location.href = _href;
	});
	labelMessages();
}

function tvGridProg() {
	browserTest();
	openLayer();
	jourAccordion();
	if ($("div.bannerbar").is(":visible")) {
		$("div.leprogrammedelajournee").addClass("leprogrammedelajournee-with-bannebar");
	}
	//openLayerVideo();
	grilleRecommandations();
	grilleLiensAuth();
	grilleInfoEureka();
	$('.click-zone').live('click', function(e) {
		e.preventDefault();
		_href = $(this).find('a').attr('href');
		document.location.href = _href;
	});
	labelMessages();
}
function grilleInfoEureka() {
	$(".featurebar ul.schedule li.eureka, .info-eureka, #navigation_secondaire li.eureka").live("click", function() {
		$.modal.close();
		$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
		bLockMEAPopup = true;
		arreteMEA();
		windowHeight = positionLayerVideo();
		$.ajax({
			url: "/ajax/private/grilleInfoEureka.php",
			dataType: "json",
			success: function(data) {
				$('#layer-info-eureka').addClass('visible');
				$('#layer-info-eureka').html(data.sHTML);
				$('#layer-info-eureka').modal({
					close: true,
					position : [windowHeight,0],
					onShow: function() {
						$('.simplemodal-close').addClass('close-popin-v2');
						$('.simplemodal-overlay').unbind('click');
						$('.simplemodal-overlay').bind('click', function() {
							$.modal.close();
						});
						var _p = $('#simplemodal-container');
						var h = $(window).height();
						var h2 = 350;
						var windowTopOffset = $(window).scrollTop();
							windowTopOffset = windowTopOffset + ((h-h2) / 2);
						_p.css('top', windowTopOffset + 'px');
					},
					onClose: function() {
						$.modal.close();
						$('.simplemodal-close').removeClass('close-popin-v2');
						$('#layer-info-eureka').removeClass('visible');
						$('#layer-info-eureka').html('');
						relanceMEA();
					}
				});
			}
		});
	});
	
}



function grilleLiensAuth() {
	sURLFrom = $(".nav-grille .lien-grille-abo a").attr("href");
	$.ajax({
		url: "/ajax/private/grilleAuth.php",
		data: {
			from: sURLFrom
		},
		dataType: "json",
		success: function(data) {
			$(".nav-grille .lien-grille-abo a").addClass(data.sURLClass);
			$(".nav-grille .lien-grille-abo a").attr("href", data.sURL);
			inscriptionFunctions();
		}
	});
}

function infiniteScrollProgrammes(http_url){
	
	$('.affichage-type a').click(function(){
			
			$('.affichage-type li').removeClass('active');
			
			/*if($('.block').length > 0){
				$('.program-content').attr('style','min-height:640px');
			}else{
				$('.program-content').attr('style','');
			}*/
			
			var genreSelected = $('#genre-selected-id').val();
			var sousGenreSelected = $('#sous_genre-selected-id').val();
			var horaireSelected = $('#horaire-selected-id').val();
			var selectionSelected = $('#selection-selected-id').val();
			var triSelected = $('#tri-selected-id').val();
			var timestamp = $('#timestamp-id').val();
	
			if($(this).attr('id') == 'grid'){
				
				$('input#type-selected').val('grid');
				$('.affichage-type li a').removeClass('active');
				
				$(this).addClass('active');
				$(this).parent().addClass('active');
				
				$('#infscr-loading').each(function(){
					$(this).fadeOut('fast');
				});
				
				$('.new_content').each(function(){
					$(this).remove();
				});
				
				infiniteDestroy();
				infiniteUpdate(http_url, 'grid', genreSelected, sousGenreSelected, horaireSelected, selectionSelected, triSelected, '', timestamp);
				
				
				$('.program-content .block').fadeOut('200', function() {
					$('.program-content .block').css('border-color', 'transparent');
					$('.program-content .block').css('padding-bottom', '0px');
					$('.program-content .block').css('width', '226px');
					$('.program-content .block').removeClass('margin-list');
					$('.program-content .block').each(function(i){
						if (i%4!=3) {
							$(this).addClass('margin-grid');
						}
					});
					$('.program-content .block .infos').hide();
					$('.program-content .block .infos-grid').show();
					$('.program-content .block').fadeIn('200');
      			});
      			
      			if($('.block').length <16){
					infiniteDestroy();
				}
				
			} else {
				$('input#type-selected').val('list');
				$('.affichage-type li a').removeClass('active');
				$(this).addClass('active');
				$(this).parent().addClass('active');
				
				$('#infscr-loading').each(function(){
					$(this).fadeOut('fast');
				});
				$('.new_content').each(function(){
					$(this).remove();
				});
				infiniteDestroy();
				infiniteUpdate(http_url, 'list', genreSelected, sousGenreSelected, horaireSelected, selectionSelected, triSelected, '', timestamp);
			    
				$('.program-content .block').fadeOut('200',function() {
					$('.program-content .block').css('border-color', '#DDDDDD');
					$('.program-content .block').css('padding-bottom', '20px');
					$('.program-content .block').css('width', '474px');
					$('.program-content .block').removeClass('margin-grid');
					$('.program-content .block').each(function(i){
						if (i%2==0) {
							$(this).addClass('margin-list');
						}
					});
	        		$('.program-content .block .infos-grid').hide();
	        		$('.program-content .block .infos').show();
					$('.program-content .block').fadeIn('200',function(){
					});
      			});
				
				if($('.block').length <16){
					infiniteDestroy();
				}
				
			}
			hoverProgramme();
			return false;
		});
		

		if($('.block').length <16){
			infiniteDestroy();
		}
		Cufon.replace("h2.titre_cesoir", { fontFamily: "CanalBoldRomain" });
		
	
}
function grilleRecommandations() {
	$.ajax({
		url: "/ajax/private/grilleRecommandations.php",
		data: {
			iTemplatePage: iTemplatePage
		},
		dataType: "json",
		success: function(data) {
			$(".featurebar .col2x").html(data.sHTML);
			$(".featurebar .col2x").addClass(data.sClass);
			/*Cufon.replace("#content h3", { fontFamily: "CanalBoldRomain" });*/
			nbMEAS_max = data.iNbMEA -1;
			$(".recommandations").f_controler();
			$(".reco-edito ul.paginator li a").click(function(e) {
				e.preventDefault();
			});
			
			$(".recommandations li .reco").mouseover(function() {
				arreteMEA();
				clearTimeout(timeout_mea);
			/*}).mouseout(function() {
				if (!bLockMEAPopup) {
					relanceMEA();
					timeout_mea=setTimeout("changeMEA()", delaiMEA);
				}*/
			});
			
			$(".recommandations li .reco").mouseout(function() {
				if (!bLockMEAPopup) {
					relanceMEA();
					timeout_mea=setTimeout("changeMEA()", delaiMEA);
				}
			});
			
			hoverCarrousel();
			hoverProgramme();
			
			$(".slider .pagination a").mouseover(function() {
				arreteMEA();
				clearTimeout(timeout_mea);
			});
			$(".slider .pagination a").mouseout(function() {
				if (!bLockMEAPopup) {
					relanceMEA();
					timeout_mea=setTimeout("changeMEA()", delaiMEA);
				}
			});
			timeout_mea=setTimeout("changeMEA()", delaiMEA);
		}
		
	});
}
function pageRecommandations() {
	$.ajax({
		url: "/ajax/private/pageRecommandations.php",
		dataType: "json",
		success: function(data) {
			if (data.sHTML!="") {
				$("#lesFilmsDuMois").html(data.sHTML);
				setOmnitureSerialize("pageName||CSAT - GrillesTV - Recommandations - Personnalisees##prop4||CSAT - Grilles TV##prop5||CSAT - GrillesTV - Recommandations##prop6||CSAT - GrillesTV - Recommandations - Personnalisees");
				openLayer();
				sectionColHeightsAlt();
			} else {
				setOmnitureSerialize("pageName||CSAT - GrillesTV - Recommandations - Editoriales##prop4||CSAT - Grilles TV##prop5||CSAT - GrillesTV - Recommandations##prop6||CSAT - GrillesTV - Recommandations - Editoriales");
			}
		}
	});
}


function GetSousGenresCetteSemaine(elm, id, label, http_url){
	
	$('#infscr-loading').hide();
	$('input#genre-selected-id').val(id);
	$('input#sous_genre-selected-id').val('');
	/*$('.program-content').attr('style','min-height:640px');*/
	$('.filtre-horaire-cette-semaine-selected').removeClass('dd-open');
	$('.filtre-horaires-cette-semaine .ul-detail').addClass('displayNone');
	$('.filtre-genres-cette-semaine-selected').removeClass('dd-open');
	$('.filtre-genres-cette-semaine .ul-detail').addClass('displayNone');	
	$('.filtre-selection-cette-semaine-selected').removeClass('dd-open');
	$('.filtre-selection-cette-semaine .ul-detail').addClass('displayNone');	
	$('.filtre-chaine-cette-semaine-selected').removeClass('dd-open');	
	$('.filtre-chaines-cette-semaine .ul-detail').addClass('displayNone');	
	$('.filtre-genres-cette-semaine-selected').html('Sous-genre');
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	var jourSelected = $('#jour-selected-id').val();
	
	if(id != 0){
		_href = 'ajax/private/sous_genre_details.php'
		$.ajax({
			url: _href,
			close: true,
			data : {
				'genreId':id,
				'genre': label,
				'type': 'cettesemaine'
			},
			async: false,
			type: 'post',
			success: function(dataf) {
				$('.filtrage-genres-cette-semaine').show();
				$('.program-filters ul:first li.active').removeClass('active');
				elm.parent().removeClass('active');
				elm.parent().addClass('active');
				/*$('.filtre-jour ul').css("left","236px");
				$('.filtre-horaires-cette-semaine ul').css("left","391px");
				$('.filtre-selection-cette-semaine ul').css("left","546px");
				$('.filtre-chaines-cette-semaine ul').css("left","773px");*/
				
				$('.filtrage-genres-cette-semaine ul.genres-cette-semaine').html(dataf);
			}
		});
	}else{
		/*$('.filtre-jour ul').css("left","81px");
		$('.filtre-horaires-cette-semaine ul').css("left","236px");
		$('.filtre-selection-cette-semaine ul').css("left","391px");
		$('.filtre-chaines-cette-semaine ul').css("left","618px");*/
		$('.filtrage-genres-cette-semaine').hide();
		$('.program-filters ul:first li.active').removeClass('active');
		$('.program-filters ul:first li:first').removeClass('active');
		$('.program-filters ul:first li:first').addClass('active');
	}
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_cette_semaine.php';
	$.ajax({
		url: _href,
		close: true,
		data : {
			'page': 1,
			'genre': id,
			'horaire': horaireSelected,
			'tri': triSelected,
			'selection': selectionSelected,
			'nbjour': jourSelected,
			'type': _type
		},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				$('.program-content').attr('style','');
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selectionSelected, triSelected, jourSelected, '');
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			
			if($('.block').length <16){
				infiniteDestroy();
			}
			var sOmnitureGenre = $('.program-filters li.active a').attr('class').charAt(0);
			sOmnitureGenre += $('.program-filters li.active a').attr('class').substring(1).toLowerCase();
			setOmnitureSerialize("pageName||CSAT - Guide - "+sOmniturePeriode+" - "+sOmnitureGenre+"##prop4||CSAT - Guide##prop5||CSAT - Guide - "+sOmniturePeriode+"##prop6||CSAT - Guide - "+sOmniturePeriode+" - "+sOmnitureGenre+"##prop7||##eVar7||");
		}
	});
	
}

function GetSousGenresMaintenant(elm, id, label, http_url){
	
	$('#infscr-loading').hide();
	$('input#genre-selected-id').val(id);
	$('input#sous_genre-selected-id').val('');
	/*$('.program-content').attr('style','min-height:640px');*/
	$('.filtre-genres-maintenant-selected').removeClass('dd-open');
	$('.filtre-genres-maintenant .ul-detail').addClass('displayNone');	
	$('.filtre-selection-maintenant-selected').removeClass('dd-open');
	$('.filtre-selection-maintenant .ul-detail').addClass('displayNone');	
	$('.filtre-chaine-maintenant-selected').removeClass('dd-open');	
	$('.filtre-chaines-maintenant .ul-detail').addClass('displayNone');	
	$('.filtre-genres-maintenant-selected').html('Sous-genre')
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	var timestamp = $('#timestamp-id').val();
	
	
	if(id != 0){
		_href = 'ajax/private/sous_genre_details.php'
		$.ajax({
			url: _href,
			close: true,
			data : { 'genreId':id, 'genre': label,'type':'maintenant'},
			async: false,
			type: 'post',
			success: function(dataf) {
				$('.filtrage-genres-maintenant').show();
				$('.program-filters ul:first li.active').removeClass('active');
				elm.parent().removeClass('active');
				elm.parent().addClass('active');
				/*$('.filtre-selection-maintenant ul').css("left","236px");
				$('.filtre-chaines-maintenant ul').css("left","463px");*/
				
				$('.filtrage-genres-maintenant ul.genres-maintenant').html(dataf);
			}
		});
	}else{
		/*$('.filtre-selection-maintenant ul').css("left","81px");
		$('.filtre-chaines-maintenant ul').css("left","308px");*/
		$('.filtrage-genres-maintenant').hide();
		$('.program-filters ul:first li.active').removeClass('active');
		$('.program-filters ul:first li:first').removeClass('active');
		$('.program-filters ul:first li:first').addClass('active');
	}
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_maintenant.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre':id,
				 'horaire': horaireSelected,
				 'tri': triSelected,
				 'selection': selectionSelected,
			     'type': _type,
				 'timestamp': timestamp
		},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selectionSelected, triSelected, '', timestamp);
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			
			if($('.block').length <16){
				infiniteDestroy();
			}
			var sOmnitureGenre = $('.program-filters li.active a').attr('class').charAt(0);
			sOmnitureGenre += $('.program-filters li.active a').attr('class').substring(1).toLowerCase();
			setOmnitureSerialize("pageName||CSAT - Guide - "+sOmniturePeriode+" - "+sOmnitureGenre+"##prop4||CSAT - Guide##prop5||CSAT - Guide - "+sOmniturePeriode+"##prop6||CSAT - Guide - "+sOmniturePeriode+" - "+sOmnitureGenre+"##prop7||##eVar7||");
		}
	});
	
}

function GetSousGenresEureka(elm, id, label, http_url){
	
	$('#infscr-loading').hide();
	$('input#genre-selected-id').val(id);
	$('input#sous_genre-selected-id').val('');
	/*$('.program-content').attr('style','min-height:640px');*/
	$('.filtre-genres-eureka-selected').removeClass('dd-open');
	$('.filtre-genres-eureka .ul-detail').addClass('displayNone');
	$('.filtre-selection-eureka-selected').removeClass('dd-open');
	$('.filtre-selection-eureka .ul-detail').addClass('displayNone');
	$('.filtre-chaine-eureka-selected').removeClass('dd-open');
	$('.filtre-chaines-eureka .ul-detail').addClass('displayNone');
	$('.filtre-genres-eureka-selected').html('Sous-genre');
	if (id=='') {
		$('span.filtre').hide();
		$('p.sort').css('border-left-color', 'transparent');
		$('p.sort').css('margin-left', '5px');
	}
	else {
		$('span.filtre').show();
		$('p.sort').css('border-left-color', '#CCCCCC');
		$('p.sort').css('margin-left', '20px');
	}
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	
	if(id != 0){
		_href = 'ajax/private/sous_genre_details.php'
		$.ajax({
			url: _href,
			close: true,
			data : { 'genreId':id, 'genre': label,'type':'eureka'},
			async: false,
			type: 'post',
			success: function(dataf) {
				$('.filtrage-genres-eureka').show();
				$('.program-filters ul:first li.active').removeClass('active');
				elm.parent().removeClass('active');
				elm.parent().addClass('active');
				/*$('.filtre-selection-eureka ul').css("left","236px");
				$('.filtre-chaines-eureka ul').css("left","463px");*/
				
				$('.filtrage-genres-eureka ul.genres-eureka').html(dataf);
			}
		});
	}else{
		/*$('.filtre-selection-eureka ul').css("left","81px");
		$('.filtre-chaines-eureka ul').css("left","308px");*/
		$('.filtrage-genres-eureka').hide();
		$('.program-filters ul:first li.active').removeClass('active');
		$('.program-filters ul:first li:first').removeClass('active');
		$('.program-filters ul:first li:first').addClass('active');
	}
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_eureka.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre':id,
				 'horaire': horaireSelected,
				 'tri': triSelected,
				 'selection': selectionSelected,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				$('.program-content').attr('style','');
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selectionSelected, triSelected, '', '');
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			
			if($('.block').length <16){
				infiniteDestroy();
			}
			var sOmnitureGenre = $('.program-filters li.active a').attr('class').charAt(0);
			sOmnitureGenre += $('.program-filters li.active a').attr('class').substring(1).toLowerCase();
			setOmnitureSerialize("pageName||CSAT - Guide - "+sOmniturePeriode+" - "+sOmnitureGenre+"##prop4||CSAT - Guide##prop5||CSAT - Guide - "+sOmniturePeriode+"##prop6||CSAT - Guide - "+sOmniturePeriode+" - "+sOmnitureGenre+"##prop7||##eVar7||");
		}
	});
	
}

function GetSousGenres(elm, id, label, http_url){
	$('#infscr-loading').hide();
	$('input#genre-selected-id').val(id);
	$('input#sous_genre-selected-id').val('');
	/*$('.program-content').attr('style','min-height:640px');*/
	$('.filtre-horaire-selected').removeClass('dd-open');
	$('.filtre-horaires .ul-detail').addClass('displayNone');
	$('.filtre-genres-selected').removeClass('dd-open');
	$('.filtre-genres .ul-detail').addClass('displayNone');
	$('.filtre-selection-selected').removeClass('dd-open');
	$('.filtre-selection .ul-detail').addClass('displayNone');
	$('.filtre-chaine-selected').removeClass('dd-open');
	$('.filtre-chaines .ul-detail').addClass('displayNone');
	$('.filtre-genres-selected').html('Sous-genre')
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	
	
	if(id != 0){
		_href = 'ajax/private/sous_genre_details.php'
		$.ajax({
			url: _href,
			close: true,
			data : {
				'genreId':id,
				'genre': label,
				'type': ''
			},
			async: false,
			type: 'post',
			success: function(dataf) {
				$('.filtrage-genres').show();
				$('.program-filters ul:first li.active').removeClass('active');
				elm.parent().removeClass('active');
				elm.parent().addClass('active');
				/*$('.filtre-horaires ul').css("left","236px");
				$('.filtre-selection ul').css("left","391px");
				$('.filtre-chaines ul').css("left","618px");*/
				
				$('.filtrage-genres ul.genres').html(dataf);
			}
		});
	}else{
		/*$('.filtre-horaires ul').css("left","81px");
		$('.filtre-selection ul').css("left","236px");
		$('.filtre-chaines ul').css("left","463px");*/
		$('.filtrage-genres').hide();
		$('.program-filters ul:first li.active').removeClass('active');
		$('.program-filters ul:first li:first').removeClass('active');
		$('.program-filters ul:first li:first').addClass('active');
	}
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_ce_soir.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre':id,
				 'horaire': horaireSelected,
				 'tri': triSelected,
				 'selection': selectionSelected,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selectionSelected, triSelected, '', '');
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			
			if($('.block').length <16){
				infiniteDestroy();
			}
			var sOmnitureGenre = $('.program-filters li.active a').attr('class').charAt(0);
			sOmnitureGenre += $('.program-filters li.active a').attr('class').substring(1).toLowerCase();
			setOmnitureSerialize("pageName||CSAT - Guide - "+sOmniturePeriode+" - "+sOmnitureGenre+"##prop4||CSAT - Guide##prop5||CSAT - Guide - "+sOmniturePeriode+"##prop6||CSAT - Guide - "+sOmniturePeriode+" - "+sOmnitureGenre+"##prop7||##eVar7||");
		}
	});
	
}


function infiniteUpdate(http_url, type, genre, sous_genre, horaire, selection, tri, jour, timestamp){
	
	$('#header').infinitescroll({
					state: {isDestroyed : false},
				    debug           : false,
				    nextSelector    : "div.navigation a.default",
				    defaultSelector : type,
				    genre : genre,
				    sous_genre : sous_genre,
				    horaire : horaire,
				    selection : selection,
				    jour : jour,
				    tri : tri,
					timestamp: timestamp,
				    loadImg         : 'div.navigation-2',
				    loading         : { img         : http_url+"/img/ajax-loader.gif",
				    				    msgText     : null,
				    				    finishedMsg : null},
				    navSelector     : "div.navigation",
				    contentSelector : ".program-content",
				    itemSelector    : ".new_content",
				    isDuringAjax : true,
				    genre : $('input#genre-selected-id').val(),
				    sous_genre : $('input#sous_genre-selected-id').val()
				    },function(){ 
			 		
	});
}


function infiniteDestroy(){
	$('#header').infinitescroll('destroy');
}


function changeSousGenre(elem, id_sous_genre, id_parent, http_url) {
	$('#infscr-loading').hide();
	$('input#genre-selected-id').val(id_parent);
	$('input#sous_genre-selected-id').val(id_sous_genre);
	$('.filtrage-genres .filtre-genres-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-genres .filtre-genres-selected').attr('param-info');
		$('.filtrage-genres .filtre-genres-selected').attr('param-default', $tmp);
		$('.filtrage-genres .filtre-genres-selected').attr('param-default', $tmp).text("Sous-genre");
	}
	else {
		$('.filtrage-genres .filtre-genres-selected').attr('param-default', elem.find('span').html());
	}
	//$('.filtrage-genres .filtre-genres-selected').trigger('click');
	
	$('.filtrage-genres .filtre-genres-selected').removeClass('dd-open');
	$('.filtrage-genres .filtre-genres .ul-detail').addClass('displayNone');
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_ce_soir.php';
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre':id_parent,
				 'sous_genre': id_sous_genre,
				 'horaire': horaireSelected,
				 'tri': triSelected,
				 'selection': selectionSelected,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, id_parent, id_sous_genre, horaireSelected, selectionSelected, triSelected, '', '');
				
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
	
}

function changeSousGenreCetteSemaine(elem, id_sous_genre, id_parent, http_url) {
	
	$('#infscr-loading').hide();
	$('input#genre-selected-id').val(id_parent);
	$('input#sous_genre-selected-id').val(id_sous_genre);
	
	/*$('.program-content').attr('style','min-height:640px');*/
	$('.filtrage-genres-cette-semaine .filtre-genres-cette-semaine-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-genres-cette-semaine .filtre-genres-cette-semaine-selected').attr('param-info');
		$('.filtrage-genres-cette-semaine .filtre-genres-cette-semaine-selected').attr('param-default', $tmp);
		$('.filtrage-genres-cette-semaine .filtre-genres-cette-semaine-selected').attr('param-default', $tmp).text("Sous-genre");
	}
	else {
		$('.filtrage-genres-cette-semaine .filtre-genres-cette-semaine-selected').attr('param-default', elem.find('span').html());
	}
	//$('.filtrage-genres-cette-semaine .filtre-genres-cette-semaine-selected').trigger('click');
	
	$('.filtrage-genres-cette-semaine .filtre-genres-cette-semaine-selected').removeClass('dd-open');
	$('.filtrage-genres-cette-semaine .filtre-genres-cette-semaine .ul-detail').addClass('displayNone');
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_cette_semaine.php';
	
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	var jourSelected = $('#jour-selected-id').val();
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre':id_parent,
				 'sous_genre': id_sous_genre,
				 'horaire': horaireSelected,
				 'tri': triSelected,
				 'selection': selectionSelected,
				 'nbjour': jourSelected,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, id_parent, id_sous_genre, horaireSelected, selectionSelected, triSelected, jourSelected, '');
				
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
	
}

function changeSousGenreMaintenant(elem, id_sous_genre, id_parent, http_url) {
	
	$('#infscr-loading').hide();
	$('input#genre-selected-id').val(id_parent);
	$('input#sous_genre-selected-id').val(id_sous_genre);

	
	/*$('.program-content').attr('style','min-height:640px');*/
	$('.filtrage-genres-maintenant .filtre-genres-maintenant-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-genres-maintenant .filtre-genres-maintenant-selected').attr('param-info');
		$('.filtrage-genres-maintenant .filtre-genres-maintenant-selected').attr('param-default', $tmp);
		$('.filtrage-genres-maintenant .filtre-genres-maintenant-selected').attr('param-default', $tmp).text("Sous-genre");
	}
	else {
		$('.filtrage-genres-maintenant .filtre-genres-maintenant-selected').attr('param-default', elem.find('span').html());
	}
	//$('.filtrage-genres-maintenant .filtre-genres-maintenant-selected').trigger('click');
	
	$('.filtrage-genres-maintenant .filtre-genres-maintenant-selected').removeClass('dd-open');
	$('.filtrage-genres-maintenant .filtre-genres-maintenant .ul-detail').addClass('displayNone');
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_maintenant.php';
	
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	var timestamp = $('#timestamp-id').val();
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre':id_parent,
				 'sous_genre': id_sous_genre,
				 'horaire': horaireSelected,
				 'tri': triSelected,
				 'selection': selectionSelected,
			     'type': _type,
				 'timestamp': timestamp
		},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, id_parent, id_sous_genre, horaireSelected, selectionSelected, triSelected, '', timestamp);
				
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
	
}

function changeSousGenreEureka(elem, id_sous_genre, id_parent, http_url) {
	
	$('#infscr-loading').hide();
	$('input#genre-selected-id').val(id_parent);
	$('input#sous_genre-selected-id').val(id_sous_genre);
	
	/*$('.program-content').attr('style','min-height:640px');*/
	$('.filtrage-genres-eureka .filtre-genres-eureka-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-genres-eureka .filtre-genres-eureka-selected').attr('param-info');
		$('.filtrage-genres-eureka .filtre-genres-eureka-selected').attr('param-default', $tmp);
		$('.filtrage-genres-eureka .filtre-genres-eureka-selected').attr('param-default', $tmp).text("Sous-genre");
	}
	else {
		$('.filtrage-genres-eureka .filtre-genres-eureka-selected').attr('param-default', elem.find('span').html());
	}
	
	$('.filtrage-genres-eureka .filtre-genres-eureka-selected').removeClass('dd-open');
	$('.filtrage-genres-eureka .filtre-genres-eureka .ul-detail').addClass('displayNone');
	//$('.filtrage-genres-eureka .filtre-genres-eureka-selected').trigger('click');
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_eureka.php';
	
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre':id_parent,
				 'sous_genre': id_sous_genre,
				 'horaire': horaireSelected,
				 'tri': triSelected,
				 'selection': selectionSelected,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, id_parent, id_sous_genre, horaireSelected, selectionSelected, triSelected, '', '');
				
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
	
}
function changeHoraireCetteSemaine(elem, horaire, http_url) {
	$('.filtrage-horaires-cette-semaine .filtre-horaire-cette-semaine-selected').html(elem.find('span').html());
	
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-horaires-cette-semaine .filtre-horaire-cette-semaine-selected').attr('param-info');
		$('.filtrage-horaires-cette-semaine .filtre-horaire-cette-semaine-selected').attr('param-default', $tmp);
		$('.filtrage-horaires-cette-semaine .filtre-horaire-cette-semaine-selected').attr('param-default', $tmp).text("Horaires");
	}
	else {
		$('.filtrage-horaires-cette-semaine .filtre-horaire-cette-semaine-selected').attr('param-default', elem.find('span').html());
	}
	//$('.filtrage-horaires-cette-semaine .filtre-horaire-cette-semaine-selected').trigger('click');
	
	$('.filtrage-horaires-cette-semaine .filtre-horaire-cette-semaine-selected').removeClass('dd-open');
	$('.filtrage-horaires-cette-semaine .filtre-horaires-cette-semaine .ul-detail').addClass('displayNone');
	
	
	/*$('.program-content').attr('style','min-height:640px');*/
	$('input#horaire-selected-id').val(horaire);
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	var jourSelected = $('#jour-selected-id').val();
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_cette_semaine.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre': genreSelected,
				 'sous_genre': sousGenreSelected,
				 'horaire': horaire,
				 'tri': triSelected,
				 'selection': selectionSelected,
				 'nbjour': jourSelected,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selectionSelected, triSelected, jourSelected, '');
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
}

function changeJourCetteSemaine(elem, nbjour, http_url) {
	$('.filtrage-jour .filtre-jour-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-jour .filtre-jour-selected').attr('param-info');
		$('.filtrage-jour .filtre-jour-selected').attr('param-default', $tmp);
		$('.filtrage-jour .filtre-jour-selected').attr('param-default', $tmp).text("Jour");
	}
	else {
		$('.filtrage-jour .filtre-jour-selected').attr('param-default', elem.find('span').html());
	}
	
	$('.filtrage-jour .filtre-jour-selected ').removeClass('dd-open');
	$('.filtrage-jour .filtre-jour .ul-detail').addClass('displayNone');
	
	//$('.filtrage-jour .filtre-jour-selected').trigger('click');
	/*$('.program-content').attr('style','min-height:640px');*/
	$('input#jour-selected-id').val(nbjour);
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var jourSelected = $('#jour-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_cette_semaine.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre': genreSelected,
				 'sous_genre': sousGenreSelected,
				 'horaire': horaireSelected,
				 'tri': triSelected,
				 'selection': selectionSelected,
				 'nbjour': nbjour,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selectionSelected, triSelected, nbjour, '');
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
}

function changeHoraire(elem, horaire, http_url) {
	$('.filtrage-horaires .filtre-horaire-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-horaires .filtre-horaire-selected').attr('param-info');
		$('.filtrage-horaires .filtre-horaire-selected').attr('param-default', $tmp);
		$('.filtrage-horaires .filtre-horaire-selected').attr('param-default', $tmp).text("Horaires");
	}
	else {
		$('.filtrage-horaires .filtre-horaire-selected').attr('param-default', elem.find('span').html());
	}
	//$('.filtrage-horaires .filtre-horaire-selected').trigger('click');
	
	$('.filtrage-horaires .filtre-horaire-selected ').removeClass('dd-open');
	$('.filtrage-horaires .filtre-horaires .ul-detail').addClass('displayNone');
	
	/*$('.program-content').attr('style','min-height:640px');*/
	$('input#horaire-selected-id').val(horaire);
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_ce_soir.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre': genreSelected,
				 'sous_genre': sousGenreSelected,
				 'horaire': horaire,
				 'tri': triSelected,
				 'selection': selectionSelected,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selectionSelected, triSelected, '', '');
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
}

function changeSelectionCetteSemaine(elem, selection, http_url) {
	$('.filtrage-selection-cette-semaine .filtre-selection-cette-semaine-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-selection-cette-semaine .filtre-selection-cette-semaine-selected').attr('param-info');
		$('.filtrage-selection-cette-semaine .filtre-selection-cette-semaine-selected').attr('param-default', $tmp);
		$('.filtrage-selection-cette-semaine .filtre-selection-cette-semaine-selected').attr('param-default', $tmp).text("Recommandé par");
	}
	else {
		$('.filtrage-selection-cette-semaine .filtre-selection-cette-semaine-selected').attr('param-default', elem.find('span').html());
	}
	
	$('.filtrage-selection-cette-semaine .filtre-selection-cette-semaine-selected').removeClass('dd-open');
	$('.filtrage-selection-cette-semaine .filtre-selection-cette-semaine .ul-detail').addClass('displayNone');
	
	//$('.filtrage-selection-cette-semaine .filtre-selection-cette-semaine-selected').trigger('click');
	/*$('.program-content').attr('style','min-height:640px');*/
	
	$('input#selection-selected-id').val(selection);
	var jourSelected = $('#jour-selected-id').val();
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	if (selection!='') {
		$('.filtre-chaine-cette-semaine-selected').addClass('filtre-chaine-selected-inactif');
		$('.filtre-chaine-cette-semaine-selected').die();
	}
	else {
		$('.filtre-chaine-cette-semaine-selected').removeClass('filtre-chaine-selected-inactif');
		bindTriGuideTV();
	}
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_cette_semaine.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre': genreSelected,
				 'sous_genre': sousGenreSelected,
				 'horaire': horaireSelected,
				 'tri': triSelected,
				 'selection': selection,
				 'nbjour': jourSelected,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selection, triSelected, jourSelected, '');
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
	
}

function changeSelectionMaintenant(elem, selection, http_url) {
	$('.filtrage-selection-maintenant .filtre-selection-maintenant-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-selection-maintenant .filtre-selection-maintenant-selected').attr('param-info');
		$('.filtrage-selection-maintenant .filtre-selection-maintenant-selected').attr('param-default', $tmp);
		$('.filtrage-selection-maintenant .filtre-selection-maintenant-selected').attr('param-default', $tmp).text("Recommandé par");
	}
	else {
		$('.filtrage-selection-maintenant .filtre-selection-maintenant-selected').attr('param-default', elem.find('span').html());
	}
	//$('.filtrage-selection-maintenant .filtre-selection-maintenant-selected').trigger('click');
	/*$('.program-content').attr('style','min-height:640px');*/
	
	$('.filtrage-selection-maintenant .filtre-selection-maintenant-selected ').removeClass('dd-open');
	$('.filtrage-selection-maintenant .filtre-selection-maintenant .ul-detail').addClass('displayNone');
	
	
	$('input#selection-selected-id').val(selection);
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	var timestamp = $('#timestamp-id').val();
	if (selection!='') {
		$('.filtre-chaine-maintenant-selected').addClass('filtre-chaine-selected-inactif');
		$('.filtre-chaine-maintenant-selected').die();
	}
	else {
		$('.filtre-chaine-maintenant-selected').removeClass('filtre-chaine-selected-inactif');
		bindTriGuideTV();
	}
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_maintenant.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre': genreSelected,
				 'sous_genre': sousGenreSelected,
				 'horaire': horaireSelected,
				 'tri': triSelected,
				 'selection': selection,
			     'type': _type,
				 'timestamp': timestamp
		},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selection, triSelected, '', timestamp);
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
	
}

function changeSelectionEureka(elem, selection, http_url) {
	$('.filtrage-selection-eureka .filtre-selection-eureka-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-selection-eureka .filtre-selection-eureka-selected').attr('param-info');
		$('.filtrage-selection-eureka .filtre-selection-eureka-selected').attr('param-default', $tmp);
		$('.filtrage-selection-eureka .filtre-selection-eureka-selected').attr('param-default', $tmp).text("Recommandé par");
	}
	else {
		$('.filtrage-selection-eureka .filtre-selection-eureka-selected').attr('param-default', elem.find('span').html());
	}
	//$('.filtrage-selection-eureka .filtre-selection-eureka-selected').trigger('click');
	/*$('.program-content').attr('style','min-height:640px');*/
	
	$('.filtrage-selection-eureka .filtre-selection-eureka-selected ').removeClass('dd-open');
	$('.filtrage-selection-eureka .filtre-selection-eureka .ul-detail').addClass('displayNone');
	
	$('input#selection-selected-id').val(selection);
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	if (selection!='') {
		$('.filtre-chaine-eureka-selected').addClass('filtre-chaine-selected-inactif');
		$('.filtre-chaine-eureka-selected').die();
	}
	else {
		$('.filtre-chaine-eureka-selected').removeClass('filtre-chaine-selected-inactif');
		bindTriGuideTV();
	}
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_eureka.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre': genreSelected,
				 'sous_genre': sousGenreSelected,
				 'horaire': horaireSelected,
				 'tri': triSelected,
				 'selection': selection,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selection, triSelected, '', '');
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
	
}


function changeSelection(elem, selection, http_url) {
	$('.filtrage-selection .filtre-selection-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-selection .filtre-selection-selected').attr('param-info');
		$('.filtrage-selection .filtre-selection-selected').attr('param-default', $tmp);
		$('.filtrage-selection .filtre-selection-selected').attr('param-default', $tmp).text("Recommandé par");
	}
	else {
		$('.filtrage-selection .filtre-selection-selected').attr('param-default', elem.find('span').html());
	}
	$('.filtrage-selection .filtre-selection-selected ').removeClass('dd-open');
	$('.filtrage-selection .filtre-selection .ul-detail').addClass('displayNone');
	/*$('.program-content').attr('style','min-height:640px');*/
	
	$('input#selection-selected-id').val(selection);
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	if (selection!='') {
		$('.filtre-chaine-selected').addClass('filtre-chaine-selected-inactif');
		$('.filtre-chaine-selected').die();
	}
	else {
		$('.filtre-chaine-selected').removeClass('filtre-chaine-selected-inactif');
		bindTriGuideTV();
	}
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_ce_soir.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre': genreSelected,
				 'sous_genre': sousGenreSelected,
				 'horaire': horaireSelected,
				 'tri': triSelected,
				 'selection': selection,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selection, triSelected, '', '');
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
	
}

function changeTriCetteSemaine(elem, tri, http_url) {
	$('.filtrage-chaines-cette-semaine .filtre-chaine-cette-semaine-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-chaines-cette-semaine .filtre-chaine-cette-semaine-selected').attr('param-info');
		$('.filtrage-chaines-cette-semaine .filtre-chaine-cette-semaine-selected').attr('param-default', $tmp);
	}
	else {
		$('.filtrage-chaines-cette-semaine .filtre-chaine-cette-semaine-selected').attr('param-default', elem.find('span').html());
	}
	
	$('.filtrage-chaines-cette-semaine .filtre-chaine-cette-semaine-selected ').removeClass('dd-open');
	$('.filtrage-chaines-cette-semaine .filtre-chaines-cette-semaine .ul-detail').addClass('displayNone');
	
	//$('.filtrage-chaines-cette-semaine .filtre-chaine-cette-semaine-selected').trigger('click');
	/*$('.program-content').attr('style','min-height:640px');*/
	
	$('input#tri-selected-id').val(tri);
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	var jourSelected = $('#jour-selected-id').val();
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_cette_semaine.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre': genreSelected,
				 'sous_genre': sousGenreSelected,
				 'horaire': horaireSelected,
				 'tri': tri,
				 'selection': selectionSelected,
				  'nbjour': jourSelected,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selectionSelected, tri, jourSelected, '');
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
}

function changeTriMaintenant(elem, tri, http_url) {
	$('.filtrage-chaines-maintenant .filtre-chaine-maintenant-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-chaines-maintenant .filtre-chaine-maintenant-selected').attr('param-info');
		$('.filtrage-chaines-maintenant .filtre-chaine-maintenant-selected').attr('param-default', $tmp);
	}
	else {
		$('.filtrage-chaines-maintenant .filtre-chaine-maintenant-selected').attr('param-default', elem.find('span').html());
	}
	
	$('.filtrage-chaines-maintenant .filtre-chaine-maintenant-selected ').removeClass('dd-open');
	$('.filtrage-chaines-maintenant .filtre-chaines-maintenant .ul-detail').addClass('displayNone');
	
	
	//$('.filtrage-chaines-maintenant .filtre-chaine-maintenant-selected').trigger('click');
	/*$('.program-content').attr('style','min-height:640px');*/
	
	$('input#tri-selected-id').val(tri);
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	var timestamp = $('#timestamp-id').val();
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_maintenant.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre': genreSelected,
				 'sous_genre': sousGenreSelected,
				 'horaire': horaireSelected,
				 'tri': tri,
				 'selection': selectionSelected,
			     'type': _type,
				 'timestamp': timestamp
		},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selectionSelected, tri, '', timestamp);
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
			hoverProgramme();
		}
	});
}

function changeTriEureka(elem, tri, http_url) {
	$('.filtrage-chaines-eureka .filtre-chaine-eureka-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-chaines-eureka .filtre-chaine-eureka-selected').attr('param-info');
		$('.filtrage-chaines-eureka .filtre-chaine-eureka-selected').attr('param-default', $tmp);
	}
	else {
		$('.filtrage-chaines-eureka .filtre-chaine-eureka-selected').attr('param-default', elem.find('span').html());
	}
	//$('.filtrage-chaines-eureka .filtre-chaine-eureka-selected').trigger('click');
	/*$('.program-content').attr('style','min-height:640px');*/
	
	$('.filtrage-chaines-eureka .filtre-chaine-eureka-selected').removeClass('dd-open');
	$('.filtrage-chaines-eureka .filtre-chaines-eureka .ul-detail').addClass('displayNone');
	
	$('input#tri-selected-id').val(tri);
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_eureka.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre': genreSelected,
				 'sous_genre': sousGenreSelected,
				 'horaire': horaireSelected,
				 'tri': tri,
				 'selection': selectionSelected,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selectionSelected, tri, '', '');
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
}


function changeTri(elem, tri, http_url) {
	$('.filtrage-chaines .filtre-chaine-selected').html(elem.find('span').html());
	if (elem.find('span').hasClass('defaut')) {
		$tmp = $('.filtrage-chaines .filtre-chaine-selected').attr('param-info');
		$('.filtrage-chaines .filtre-chaine-selected').attr('param-default', $tmp);
	}
	else {
		$('.filtrage-chaines .filtre-chaine-selected').attr('param-default', elem.find('span').html());
	}
	
	$('.filtrage-chaines .filtre-chaine-selected ').removeClass('dd-open');
	$('.filtrage-chaines .filtre-chaines .ul-detail').addClass('displayNone');
	//$('.filtrage-chaines .filtre-chaine-selected').trigger('click');
	/*$('.program-content').attr('style','min-height:640px');*/
	
	$('input#tri-selected-id').val(tri);
	
	var genreSelected = $('#genre-selected-id').val();
	var sousGenreSelected = $('#sous_genre-selected-id').val();
	var horaireSelected = $('#horaire-selected-id').val();
	var selectionSelected = $('#selection-selected-id').val();
	var triSelected = $('#tri-selected-id').val();
	
	_type = $('.affichage-type li a.active').attr('id');
	_href = 'ajax/private/grille_ce_soir.php';
	$.ajax({
		url: _href,
		close: true,
		data : { 'page':1,
				 'genre': genreSelected,
				 'sous_genre': sousGenreSelected,
				 'horaire': horaireSelected,
				 'tri': tri,
				 'selection': selectionSelected,
			     'type': _type},
		async: false,
		type: 'get',
		success: function(data) {
			if(data != ""){
				/*$('.program-content').attr('style','');*/
				infiniteDestroy();
				infiniteUpdate(http_url, _type, genreSelected, sousGenreSelected, horaireSelected, selectionSelected, tri, '', '');
			}else{
				infiniteDestroy();
			}
			$('.program-content').html(data.replace('new_content',''));
			if($('.block').length <16){
				infiniteDestroy();
			}
		}
	});
}
	
	
function grilleChaines(date, chaine, thematique, focus1, template, chainesAbo, omniture, pagination_ch, etatClick) {
	if (clickOk==0) {
		clickOk=1;
		if(!pagination_ch) {
			pagination_ch = false;
		}
		if(!etatClick){
			etatClick = '';
		}
		//ajaxChargement();
		
		if(pagination_ch){
			if(etatClick == 'next'){
				$('.paginator-chaine li.next a').hide();
				$('.paginator-chaine li.next').append('<div class="load-grille"></div>');
			}else if(etatClick == 'prev'){
				$('.paginator-chaine li.prev a').hide();
				$('.paginator-chaine li.prev').append('<div class="load-grille"></div>');
			}
		}
		if(!pagination_ch) {
			$('.semaine-slider ul li.current').find('p').hide();
			$('.semaine-slider ul li.current-s').removeClass('current-s');
			$('.semaine-slider ul li.current').addClass('current-s');
			$('.semaine-slider ul li').find('a').removeClass('load-grille');
			$('.semaine-slider ul li.current').find('a').addClass('load-grille');
			$('.semaine-slider ul li').removeClass('current');
		}
		
		if (focus1=="bloc_programmes") {
			var scroll_pos1 = $(document).scrollTop();
			var bloc_pos1 = $("div#bloc_programmes").offset();
		}
		
		
		
		$.ajax({
			url: "/ajax/grilleChaines.php",
			data: {
				date: date,
				chaine: chaine,
				thematique: thematique,
				template: template,
				chainesAbo: chainesAbo
			},
			dataType: "json",
			success: function(data) {
				
				if(pagination_ch){
					if(etatClick == 'next'){
						$('.paginator-chaine li.next .load-grille').remove();
						$('.paginator-chaine li.next a').show();
					}else if(etatClick == 'prev'){
						$('.paginator-chaine li.prev .load-grille').remove();
						$('.paginator-chaine li.prev a').show();
					}
				}
				if(!pagination_ch) {
				$('.semaine-slider ul li').find('p').show();
				$('.semaine-slider ul li.current-s').addClass('current');
				$('.semaine-slider ul li.current-s').find('a').removeClass('load-grille');
				$('.semaine-slider ul li.current-s').removeClass('current');
				$('.semaine-slider ul li.current-s').addClass('current');
				$('.semaine-slider ul li.current-s').removeClass('current-s');
				}
				$("div#bloc_soiree").html(data.soiree);
				$("div#bloc_programmes").html(data.programmes);
				if (omniture) {
					setOmnitureSerialize(data.omniture);
				}
				paginationChaines();
				//openLayer();
				jourAccordion();
				//openAccordeon();
				if (focus1=="bloc_programmes") {
					$("div#bloc_soiree").ready(function() {
						var bloc_pos2 = $("div#bloc_programmes").offset();
						var scroll_pos2 = scroll_pos1+bloc_pos2.top-bloc_pos1.top;
						$(document).scrollTop(scroll_pos2);
					});
				}
				labelMessages();
				clickOk=0;
			}
		});
	}
}
/*
function grilleChaine(date, chaine) {
	$.ajax({
		url: "/ajax/grilleChaine.php",
		data: {
			date: date,
			chaine: chaine
		},
		dataType: "json",
		success: function(data) {
			$("div#bloc_soiree").html(data.soiree);
			$("div#bloc_programmes").html(data.programmes);
			jourAccordion();
			labelMessages();
		}
	});
}
*/
function openVideoBA() {
	$('.popin-ba-video').live('click', function(e) {
		e.preventDefault();
		_href = $(this).find('a').attr('href');
		$.modal.close();
		$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
		windowHeight = positionLayerVideo();
		$.ajax({
			url: _href,
			close: true,
			success: function(data) {
				$('#layer-ba-video').addClass('visible');
				$('#layer-ba-video').html(data);
				$('#layer-ba-video').modal({
					minHeight: 450,
					position : [windowHeight,0], 
					onShow: function() {
						$('.simplemodal-close').addClass('close-popin-v2');
						$('.simplemodal-overlay').unbind('click');
						$('.simplemodal-overlay').bind('click', function() {
							$.modal.close();
						});
						bLockMEAPopup = true;
						arreteMEA();
					},
					onClose: function() {
						$.modal.close();
						$('.simplemodal-close').removeClass('close-popin-v2');
						$('#layer-ba-video').removeClass('visible');
						$('#layer-ba-video').html('');
						relanceMEA();
					}
				});
			}
		});
	});
}

function popinbavideo(){
	$('.popin-ba-video').live('click', function(e) {
		e.preventDefault();
		_href = $(this).attr('href');
		$.modal.close();
		$.modal.defaults.closeHTML='<a class="modalCloseImg" title="Fermer"></a>';
		windowHeight = positionLayerVideo();
		$.ajax({
			url: _href,
			close: true,
			success: function(data) {
				$('#layer-ba-video').addClass('visible');
				$('#layer-ba-video').html(data);
				$('#layer-ba-video').modal({
					minHeight: 450,
					position : [windowHeight,0], 
					onShow: function() {
						$('.simplemodal-close').addClass('close-popin-v2');
						$('.simplemodal-overlay').unbind('click');
						$('.simplemodal-overlay').bind('click', function() {
							$.modal.close();
						});
						bLockMEAPopup = true;
					},
					onClose: function() {
						$.modal.close();
						$('.simplemodal-close').removeClass('close-popin-v2');
						$('#layer-ba-video').removeClass('visible');
						$('#layer-ba-video').html('');
					}
				});
			}
		});
	});
}

function openAccordeon(o) {
	$("div.jour-accordion ul").hide();
	bCreneauxActif = false;
	for (i=0;i<tableau.length;i++) {
		chaine = tableau[i].split(",");
		cle = chaine[0];
		valeur = chaine[1];
		if (valeur == 1) {
			$(".accordeon_"+cle).addClass("open");
			$(".ul_"+cle).toggle();
			bCreneauxActif = true;
		}
		if (valeur==0) {
			$(".accordeon_"+cle).removeClass("open");
			$(".ul_"+cle).toggle();
		}
	}
	// Ouvre le creanau horaire courant, si aucun n'est predefini
	if (!bCreneauxActif) {
		$("div.jour-accordion .accordeon_"+o).addClass("open");
		$("div.jour-accordion .ul_"+o).toggle();
		updateTableau(o, 1);
	}
}
function createFiltreThematiques() {
	$('.filtre-thematiques-selected').live('click', function() {
		if ($('ul.thematiques').hasClass('visible')) {
			$('ul.thematiques').removeClass('visible');
			$('.thematique-chaines').removeClass('visible');
			$('body').unbind('click');
		} else {
			$('ul.thematiques').addClass('visible');
			$('body').bind('click', function(e) {
				var $target = $(e.target);
				if($target.parents('.filtre-thematiques').html()==null) {
					$('.filtre-thematiques-selected').trigger('click');
				}
			});
		}
	});
}

function createFiltreCeSoir() {
	$('.filtre-genres-selected').live('click', function() {
		$('.filtre-horaire-selected').removeClass('dd-open');
		$('.filtre-horaires .ul-detail').addClass('displayNone');
		$('.filtre-selection-selected').removeClass('dd-open');
		$('.filtre-selection .ul-detail').addClass('displayNone');
		$('.filtre-chaine-selected').removeClass('dd-open');
		$('.filtre-chaine .ul-detail').addClass('displayNone');
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-genres').html()==null) {
				$('.filtre-horaire-selected').removeClass('dd-open');
				$('.filtre-horaires .ul-detail').addClass('displayNone');
				$('.filtre-selection-selected').removeClass('dd-open');
				$('.filtre-selection .ul-detail').addClass('displayNone');
				$('.filtre-chaine-selected').removeClass('dd-open');
				$('.filtre-chaine .ul-detail').addClass('displayNone');
				$('.filtre-genres-selected').removeClass('dd-open');
				$('.filtre-genres .ul-detail').addClass('displayNone');
			}
		});
	});
	$('.filtre-genres-cette-semaine-selected').live('click', function() {
		$('.filtre-horaire-cette-semaine-selected').removeClass('dd-open');
		$('.filtre-horaires-cette-semaine .ul-detail').addClass('displayNone');
		$('.filtre-selection-cette-semaine-selected').removeClass('dd-open');
		$('.filtre-selection-cette-semaine .ul-detail').addClass('displayNone');
		$('.filtre-chaine-cette-semaine-selected').removeClass('dd-open');
		$('.filtre-chaine-cette-semaine .ul-detail').addClass('displayNone');
		$('.filtre-jour-selected').removeClass('dd-open');
		$('.filtre-jour .ul-detail').addClass('displayNone');
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-genres-cette-semaine').html()==null) {
				$('.filtre-horaire-cette-semaine-selected').removeClass('dd-open');
				$('.filtre-horaires-cette-semaine .ul-detail').addClass('displayNone');
				$('.filtre-selection-cette-semaine-selected').removeClass('dd-open');
				$('.filtre-selection-cette-semaine .ul-detail').addClass('displayNone');
				$('.filtre-chaine-cette-semaine-selected').removeClass('dd-open');
				$('.filtre-chaine-cette-semaine .ul-detail').addClass('displayNone');
				$('.filtre-jour-selected').removeClass('dd-open');
				$('.filtre-jour .ul-detail').addClass('displayNone');
				$('.filtre-genres-cette-semaine-selected').removeClass('dd-open');
				$('.filtre-genres-cette-semaine .ul-detail').addClass('displayNone');
			}
		});
	});
	$('.filtre-genres-maintenant-selected').live('click', function() {
		$('.filtre-selection-maintenant-selected').removeClass('dd-open');
		$('.filtre-selection-maintenant .ul-detail').addClass('displayNone');
		$('.filtre-chaine-maintenant-selected').removeClass('dd-open');
		$('.filtre-chaine-maintenant .ul-detail').addClass('displayNone');
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-selection-maintenant').html()==null) {
				$('.filtre-selection-maintenant-selected').removeClass('dd-open');
				$('.filtre-selection-maintenant .ul-detail').addClass('displayNone');
				$('.filtre-chaine-maintenant-selected').removeClass('dd-open');
				$('.filtre-chaine-maintenant .ul-detail').addClass('displayNone');
			}
		});
		
	});
	$('.filtre-genres-eureka-selected').live('click', function() {
		$('.filtre-selection-eureka-selected').removeClass('dd-open');
		$('.filtre-selection-eureka .ul-detail').addClass('displayNone');	
		$('.filtre-chaine-eureka-selected').removeClass('dd-open');	
		$('.filtre-chaine-eureka .ul-detail').addClass('displayNone');	
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-genres-eureka').html()==null) {
					$('.filtre-selection-eureka-selected').removeClass('dd-open');
					$('.filtre-selection-eureka .ul-detail').addClass('displayNone');	
					$('.filtre-chaine-eureka-selected').removeClass('dd-open');	
					$('.filtre-chaine-eureka .ul-detail').addClass('displayNone');	
					$('.filtre-genres-eureka-selected').removeClass('dd-open');	
					$('.filtre-genres-eureka .ul-detail').addClass('displayNone');	
			}
		});
	});
	$('.filtre-horaire-selected').live('click', function() {
		$('.filtre-genres-selected').removeClass('dd-open');
		$('.filtre-genres .ul-detail').addClass('displayNone');
		$('.filtre-selection-selected').removeClass('dd-open');
		$('.filtre-selection .ul-detail').addClass('displayNone');
		$('.filtre-chaine-selected').removeClass('dd-open');
		$('.filtre-chaines .ul-detail').addClass('displayNone');
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open'); 
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-horaires').html()==null) {
					$('.filtre-genres-selected').removeClass('dd-open');
					$('.filtre-genres .ul-detail').addClass('displayNone');
					$('.filtre-selection-selected').removeClass('dd-open');
					$('.filtre-selection .ul-detail').addClass('displayNone');
					$('.filtre-chaine-selected').removeClass('dd-open');
					$('.filtre-chaines .ul-detail').addClass('displayNone');	
					$('.filtre-horaire-selected').removeClass('dd-open');
					$('.filtre-horaires .ul-detail').addClass('displayNone');
					$('.filtre-horaire-selected').html($('.filtre-horaire-selected').attr('param-default'));
			}
		});
	});
	$('.filtre-horaire-cette-semaine-selected').live('click', function() {
		$('.filtre-genres-cette-semaine-selected').removeClass('dd-open');
		$('.filtre-genres-cette-semaine .ul-detail').addClass('displayNone');	
		$('.filtre-selection-cette-semaine-selected').removeClass('dd-open');
		$('.filtre-selection-cette-semaine .ul-detail').addClass('displayNone');	
		$('.filtre-chaine-cette-semaine-selected').removeClass('dd-open');	
		$('.filtre-chaines-cette-semaine .ul-detail').addClass('displayNone');	
		$('.filtre-jour-selected').removeClass('dd-open');	
		$('.filtre-jour .ul-detail').addClass('displayNone');	
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-horaire-cette-semaine').html()==null) {
					$('.filtre-genres-cette-semaine-selected').removeClass('dd-open');
					$('.filtre-genres-cette-semaine .ul-detail').addClass('displayNone');	
					$('.filtre-selection-cette-semaine-selected').removeClass('dd-open');
					$('.filtre-selection-cette-semaine .ul-detail').addClass('displayNone');	
					$('.filtre-chaine-cette-semaine-selected').removeClass('dd-open');	
					$('.filtre-chaines-cette-semaine .ul-detail').addClass('displayNone');	
					$('.filtre-horaire-cette-semaine-selected').removeClass('dd-open');
					$('.filtre-horaires-cette-semaine .ul-detail').addClass('displayNone');
					$('.filtre-jour-selected').removeClass('dd-open');
					$('.filtre-jour .ul-detail').addClass('displayNone');
					$('.filtre-horaire-cette-semaine-selected').html($('.filtre-horaire-cette-semaine-selected').attr('param-default'));
			}
		});
	});
	$('.filtre-jour-selected').live('click', function() {
		$('.filtre-genres-cette-semaine-selected').removeClass('dd-open');
		$('.filtre-genres-cette-semaine .ul-detail').addClass('displayNone');	
		$('.filtre-selection-cette-semaine-selected').removeClass('dd-open');
		$('.filtre-selection-cette-semaine .ul-detail').addClass('displayNone');	
		$('.filtre-chaine-cette-semaine-selected').removeClass('dd-open');	
		$('.filtre-chaines-cette-semaine .ul-detail').addClass('displayNone');	
		$('.filtre-horaire-cette-semaine-selected').removeClass('dd-open');
		$('.filtre-horaires-cette-semaine .ul-detail').addClass('displayNone');	
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-jour').html()==null) {
					$('.filtre-genres-cette-semaine-selected').removeClass('dd-open');
					$('.filtre-genres-cette-semaine .ul-detail').addClass('displayNone');	
					$('.filtre-selection-cette-semaine-selected').removeClass('dd-open');
					$('.filtre-selection-cette-semaine .ul-detail').addClass('displayNone');	
					$('.filtre-chaine-cette-semaine-selected').removeClass('dd-open');	
					$('.filtre-chaines-cette-semaine .ul-detail').addClass('displayNone');	
					$('.filtre-horaire-cette-semaine-selected').removeClass('dd-open');
					$('.filtre-horaires-cette-semaine .ul-detail').addClass('displayNone');
					$('.filtre-jour-selected').removeClass('dd-open');
					$('.filtre-jour .ul-detail').addClass('displayNone');
					$('.filtre-jour-selected').html($('.filtre-jour-selected').attr('param-default'));
			}
		});
	});
	$('.filtre-selection-selected').live('click', function() {
		$('.filtre-genres-selected').removeClass('dd-open');
		$('.filtre-genres .ul-detail').addClass('displayNone');	
		$('.filtre-horaire-selected').removeClass('dd-open');
		$('.filtre-horaires .ul-detail').addClass('displayNone');	
		$('.filtre-chaine-selected').removeClass('dd-open');	
		$('.filtre-chaines .ul-detail').addClass('displayNone');
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-selection').html()==null) {
					$('.filtre-genres-selected').removeClass('dd-open');
					$('.filtre-genres .ul-detail').addClass('displayNone');	
					$('.filtre-selection-selected').removeClass('dd-open');
					$('.filtre-selection .ul-detail').addClass('displayNone');	
					$('.filtre-horaire-selected').removeClass('dd-open');
					$('.filtre-horaires .ul-detail').addClass('displayNone');	
					$('.filtre-chaine-selected').removeClass('dd-open');	
					$('.filtre-chaines .ul-detail').addClass('displayNone');
					$('.filtre-selection-selected').html($('.filtre-selection-selected').attr('param-default'));
			}
		});
	});
	$('.filtre-selection-cette-semaine-selected').live('click', function() {
		$('.filtre-genres-cette-semaine-selected').removeClass('dd-open');
		$('.filtre-genres-cette-semaine .ul-detail').addClass('displayNone');	
		$('.filtre-horaire-cette-semaine-selected').removeClass('dd-open');
		$('.filtre-horaires-cette-semaine .ul-detail').addClass('displayNone');	
		$('.filtre-chaine-cette-semaine-selected').removeClass('dd-open');	
		$('.filtre-chaines-cette-semaine .ul-detail').addClass('displayNone');
		$('.filtre-jour-selected').removeClass('dd-open');	
		$('.filtre-jour .ul-detail').addClass('displayNone');	
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-selection-cette-semaine').html()==null) {
				$('.filtre-genres-cette-semaine-selected').removeClass('dd-open');
				$('.filtre-genres-cette-semaine .ul-detail').addClass('displayNone');	
				$('.filtre-horaire-cette-semaine-selected').removeClass('dd-open');
				$('.filtre-horaires-cette-semaine .ul-detail').addClass('displayNone');	
				$('.filtre-chaine-cette-semaine-selected').removeClass('dd-open');	
				$('.filtre-chaines-cette-semaine .ul-detail').addClass('displayNone');
				$('.filtre-jour-selected').removeClass('dd-open');	
				$('.filtre-jour .ul-detail').addClass('displayNone');
				$('.filtre-selection-cette-semaine .ul-detail').addClass('displayNone');	
				$('.filtre-selection-cette-semaine-selected').html($('.filtre-selection-cette-semaine-selected').attr('param-default'));
			}
		});
	});
	$('.filtre-selection-maintenant-selected').live('click', function() {
		$('.filtre-genres-maintenant-selected').removeClass('dd-open');
		$('.filtre-genres-maintenant .ul-detail').addClass('displayNone');	
		$('.filtre-horaire-maintenant-selected').removeClass('dd-open');
		$('.filtre-horaires-maintenant .ul-detail').addClass('displayNone');	
		$('.filtre-chaine-maintenant-selected').removeClass('dd-open');	
		$('.filtre-chaines-maintenant .ul-detail').addClass('displayNone');
		$('.filtre-jour-selected').removeClass('dd-open');	
		$('.filtre-jour .ul-detail').addClass('displayNone');	
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-selection-maintenant').html()==null) {
				$('.filtre-genres-maintenant-selected').removeClass('dd-open');
				$('.filtre-genres-maintenant .ul-detail').addClass('displayNone');	
				$('.filtre-horaire-maintenant-selected').removeClass('dd-open');
				$('.filtre-horaires-maintenant .ul-detail').addClass('displayNone');	
				$('.filtre-chaine-maintenant-selected').removeClass('dd-open');	
				$('.filtre-chaines-maintenant .ul-detail').addClass('displayNone');
				$('.filtre-jour-selected').removeClass('dd-open');	
				$('.filtre-jour .ul-detail').addClass('displayNone');
				$('.filtre-selection-maintenant-selected').removeClass('dd-open');	
				$('.filtre-selection-maintenant .ul-detail').addClass('displayNone');	
				$('.filtre-selection-maintenant-selected').html($('.filtre-selection-maintenant-selected').attr('param-default'));
			}
		});
	});
	$('.filtre-selection-eureka-selected').live('click', function() {
		$('.filtre-genres-eureka-selected').removeClass('dd-open');
		$('.filtre-genres-eureka .ul-detail').addClass('displayNone');	
		$('.filtre-horaire-eureka-selected').removeClass('dd-open');
		$('.filtre-horaires-eureka .ul-detail').addClass('displayNone');	
		$('.filtre-chaine-eureka-selected').removeClass('dd-open');	
		$('.filtre-chaines-eureka .ul-detail').addClass('displayNone');
		$('.filtre-jour-selected').removeClass('dd-open');	
		$('.filtre-jour .ul-detail').addClass('displayNone');	
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-selection-eureka').html()==null) {
				$('.filtre-genres-eureka-selected').removeClass('dd-open');
				$('.filtre-genres-eureka .ul-detail').addClass('displayNone');	
				$('.filtre-horaire-eureka-selected').removeClass('dd-open');
				$('.filtre-horaires-eureka .ul-detail').addClass('displayNone');	
				$('.filtre-chaine-eureka-selected').removeClass('dd-open');	
				$('.filtre-chaines-eureka .ul-detail').addClass('displayNone');
				$('.filtre-jour-selected').removeClass('dd-open');	
				$('.filtre-jour .ul-detail').addClass('displayNone');
				$('.filtre-selection-eureka-selected').html($('.filtre-selection-eureka-selected').attr('param-default'));
			}
		});
	});
	bindTriGuideTV();
}
function bindTriGuideTV() {
	$('.filtre-chaine-selected').die('click');
	$('.filtre-chaine-selected').live('click', function() {
		$('.filtre-genres-selected').removeClass('dd-open');
		$('.filtre-genres .ul-detail').addClass('displayNone');
		$('.filtre-horaire-selected').removeClass('dd-open');
		$('.filtre-horaires .ul-detail').addClass('displayNone');
		$('.filtre-selection-selected').removeClass('dd-open');
		$('.filtre-selection .ul-detail').addClass('displayNone');
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
				var $target = $(e.target);
				if($target.parents('.filtre-chaine').html()==null) {
						$('.filtre-genres-selected').removeClass('dd-open');
						$('.filtre-genres .ul-detail').addClass('displayNone');	
						$('.filtre-horaire-selected').removeClass('dd-open');
						$('.filtre-horaires .ul-detail').addClass('displayNone');	
						$('.filtre-selection-selected').removeClass('dd-open');
						$('.filtre-selection .ul-detail').addClass('displayNone');
						$('.filtre-chaine-selected').removeClass('dd-open');
						$('.filtre-chaine .ul-detail').addClass('displayNone');
						$('.filtre-chaines .ul-detail').addClass('displayNone');
						$('.filtre-chaine-selected').html($('.filtre-chaine-selected').attr('param-default'));	
				}
			});
	});
	$('.filtre-chaine-cette-semaine-selected').die('click');
	$('.filtre-chaine-cette-semaine-selected').live('click', function() {
		$('.filtre-genres-cette-semaine-selected').removeClass('dd-open');
		$('.filtre-genres-cette-semaine .ul-detail').addClass('displayNone');	
		$('.filtre-horaire-cette-semaine-selected').removeClass('dd-open');
		$('.filtre-horaires-cette-semaine .ul-detail').addClass('displayNone');	
		$('.filtre-selection-cette-semaine-selected').removeClass('dd-open');
		$('.filtre-selection-cette-semaine .ul-detail').addClass('displayNone');	
		$('.filtre-jour-selected').removeClass('dd-open');	
		$('.filtre-jour .ul-detail').addClass('displayNone');	
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-chaine-cette-semaine').html()==null) {
				$('.filtre-genres-cette-semaine-selected').removeClass('dd-open');
				$('.filtre-genres-cette-semaine .ul-detail').addClass('displayNone');	
				$('.filtre-horaire-cette-semaine-selected').removeClass('dd-open');
				$('.filtre-horaires-cette-semaine .ul-detail').addClass('displayNone');	
				$('.filtre-selection-cette-semaine-selected').removeClass('dd-open');
				$('.filtre-selection-cette-semaine .ul-detail').addClass('displayNone');	
				$('.filtre-jour-selected').removeClass('dd-open');	
				$('.filtre-jour .ul-detail').addClass('displayNone');
				$('.filtre-chaines-cette-semaine .ul-detail').addClass('displayNone');
				$('.filtre-chaine-cette-semaine-selected').html($('.filtre-chaine-cette-semaine-selected').attr('param-default'));	
			}
		});
	});
	$('.filtre-chaine-maintenant-selected').die('click');
	$('.filtre-chaine-maintenant-selected').live('click', function() {
		$('.filtre-genres-maintenant-selected').removeClass('dd-open');
		$('.filtre-genres-maintenant .ul-detail').addClass('displayNone');	
		$('.filtre-selection-maintenant-selected').removeClass('dd-open');
		$('.filtre-selection-maintenant .ul-detail').addClass('displayNone');	
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-chaine-maintenant').html()==null) {
				$('.filtre-genres-maintenant-selected').removeClass('dd-open');
				$('.filtre-genres-maintenant .ul-detail').addClass('displayNone');	
				$('.filtre-horaire-maintenant-selected').removeClass('dd-open');
				$('.filtre-horaires-maintenant .ul-detail').addClass('displayNone');	
				$('.filtre-chaine-maintenant-selected').removeClass('dd-open');	
				$('.filtre-chaines-maintenant .ul-detail').addClass('displayNone');
				$('.filtre-jour-selected').removeClass('dd-open');	
				$('.filtre-jour .ul-detail').addClass('displayNone');
				$('.filtre-chaines-maintenant .ul-detail').addClass('displayNone');
				$('.filtre-chaine-maintenant-selected').html($('.filtre-chaine-maintenant-selected').attr('param-default'));
			}
		});
	});
	$('.filtre-chaine-eureka-selected').die('click');
	$('.filtre-chaine-eureka-selected').live('click', function() {
		$('.filtre-genres-eureka-selected').removeClass('dd-open');
		$('.filtre-genres-eureka .ul-detail').addClass('displayNone');
		$('.filtre-selection-eureka-selected').removeClass('dd-open');
		$('.filtre-selection-eureka .ul-detail').addClass('displayNone');
		if ($(this).hasClass('dd-open')) {
			$(this).html($(this).attr('param-default'));
			$(this).next().removeClass('displayNone');
			$(this).next().addClass('displayNone');
			$(this).removeClass('dd-open');
		}
		else {
			$(this).html($(this).attr('param-info'));
			$(this).addClass('dd-open');
			$(this).next().removeClass('displayNone');
		}
		$('body').bind('click', function(e) {
			var $target = $(e.target);
			if($target.parents('.filtre-chaine-eureka').html()==null) {
				$('.filtre-genres-maintenant-selected').removeClass('dd-open');
				$('.filtre-genres-maintenant .ul-detail').addClass('displayNone');	
				$('.filtre-horaire-maintenant-selected').removeClass('dd-open');
				$('.filtre-horaires-maintenant .ul-detail').addClass('displayNone');	
				$('.filtre-chaine-maintenant-selected').removeClass('dd-open');	
				$('.filtre-chaines-maintenant .ul-detail').addClass('displayNone');
				$('.filtre-jour-selected').removeClass('dd-open');	
				$('.filtre-jour .ul-detail').addClass('displayNone');
				$('.filtre-chaine-eureka-selected').removeClass('dd-open');
				$('.filtre-chaine-eureka .ul-detail').addClass('displayNone');	
				$('.filtre-chaines-eureka .ul-detail').addClass('displayNone');	
				$('.filtre-chaine-eureka-selected').html($('.filtre-chaine-eureka-selected').attr('param-default'));
			}
		});
	});
}

function homeFootPlus() {
	$.ajax({
		url: '/ajax/private/footPlusCall.php',
		type: 'post',
		dataType: "json",
		success: function(data) {
			$("#listfoot")
				.html(data.sHTML)
				.ready(function() {
					if (data.sJS) {
						eval(data.sJS);
					}
				});
		}
	});
}
function homeLiveTV() {
	$.ajax({
		url: '/ajax/private/homeLiveTV.php',
		/*data: {
			cGamme: cGamme,
			logue: logue,
			authentif: authentif,
			authentif_light: authentif_light
		},*/
		dataType: "json",
		success: function(data) {
			$('#direct')
				.html(data.sHTML)
				.ready(function() {
					if (data.sJS) {
						eval(data.sJS);
					}
				});
		}
	});
}

function hoverCarrousel(){
	$('.reco div.img').hover(function(){
		jQuery(this).parents("div.reco").children("div .infos").addClass("hover");
		}, function() {
		jQuery(this).parents("div.reco").children("div .infos").removeClass("hover");
	});
	
	$('.infos p').hover(function(){
		jQuery(this).parent().addClass("hover");
		}, function() {
		jQuery(this).parent().removeClass("hover");
	});
	
	$('.infos h4').hover(function(){
		jQuery(this).parent().addClass("hover");
		}, function() {
		jQuery(this).parent().removeClass("hover");
	});
	
	$('a.logo-chaine').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).parent().children("h4.popin-programme").children("a").addClass("notUnderline");
			}else{
				jQuery(this).parent().children("h4.popin-programme").children("a").removeClass("notUnderline");
			}
		}
	);
	
}

function hoverProgramme(){
	$('.program-content .block').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).children("div div.infos").addClass("hover");
				jQuery(this).children("div div.infos-grid").addClass("hover");
				jQuery(this).css("cursor","pointer");
			}else{
				jQuery(this).children("div div.infos").removeClass("hover");
				jQuery(this).children("div div.infos-grid").removeClass("hover");
				jQuery(this).css("cursor","default");
			}
		}
	);

	$('.program-content .block div a.image').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).parents("div").children("div div.infos").addClass("hover");
				jQuery(this).parents("div.block").children("div div.infos-grid").addClass("hover");
			}else{
				jQuery(this).parents("div").children("div div.infos").removeClass("hover");
				jQuery(this).parents("div.block").children("div div.infos-grid").removeClass("hover");
			}
		}
	);
	
	$('.infos a.lien-popin').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).parents().removeClass("hover");
			}else{
				jQuery(this).parents().addClass("hover");
			}
		}
	);
	
	$('.infos-grid ').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).addClass("hover");
			}else{
				jQuery(this).removeClass("hover");
			}
		}
	);
	
	$('.infos-grid a.lien-popin').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).parents().removeClass("hover");
			}else{
				jQuery(this).parents().addClass("hover");
			}
		}
	);
	
	$('.infos p').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).parent().addClass("hover");
			}else{
				jQuery(this).parent().removeClass("hover");
			}
		}
	);
	
	$('.infos h4').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).parent().addClass("hover");
			}else{
				jQuery(this).parent().removeClass("hover");
			}
		}
	);
	
	$('.infos h5').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).parent().addClass("hover");
			}else{
				jQuery(this).parent().removeClass("hover");
			}
		}
	);
	
	$('.infos-grid p').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).parent().addClass("hover");
			}else{
				jQuery(this).parent().removeClass("hover");
			}
		}
	);
	
	$('.infos-grid h4').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).parent().addClass("hover");
			}else{
				jQuery(this).parent().removeClass("hover");
			}
		}
	);
	
	$('.infos-grid h5').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).parent().addClass("hover");
			}else{
				jQuery(this).parent().removeClass("hover");
			}
		}
	);
	
	$('.infos').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).addClass("hover");
			}else{
				jQuery(this).removeClass("hover");
			}
		}
	);
	
	$('a.logo-chaine').live('mouseover mouseout',
		function(event){
			if(event.type == 'mouseover'){
				jQuery(this).parent().children("h4").children("div.popin-programme").children("a").addClass("notUnderline");
			}else{
				jQuery(this).parent().children("h4").children("div.popin-programme").children("a").removeClass("notUnderline");
			}
		}
	);
	
	$('.infos').live('click',function(e){
		var _urlProg = jQuery(this).children("h4").children("div.popin-programme").children("a").attr("href");
		var _classDiff = jQuery(this).children("h4").children("div.popin-programme").children("a").attr("class");
		var _pgid = getPgIdFromUrl(_urlProg);
		var _dfid = getDfIdFromClass(_classDiff);
		if(!jQuery(e.target).parent().hasClass('logo-chaine')){
			openPopinProgDiff(_pgid, _dfid)
		}
	});
}
function getPgIdFromUrl(sHref){
	var sUrl;
	var getsParam;
	var param;
	var pgidTemp;
	var paramTemp;
	if(typeof(sHref) == "string"){
		first = sHref.split("#");
		for(i=0;i<first.length;i++){
			if(i == 0){
				sUrl += first[i]+"&cid_only=1";
			}else{
				sUrl += "#"+first[i];
			}
		}
		param = sHref.split("?");
		getsParam = param[1];
		pgidTemp = getsParam.split("&");
		paramTemp = pgidTemp[0].split("=");
		return paramTemp[1];
	}
}
function getDfIdFromClass(sClass){
	var _dfidTemp;
	var _dfidTemp2;
	_dfidTemp = sClass.replace("titre-programme","");
	_dfidTemp = sClass.replace("lbl-ba","");
	_dfidTemp = sClass.replace("lbl","");
	_dfidTemp = sClass.replace("reco-detail","");
	_dfidTemp2 = _dfidTemp.split('dfid-');
	return _dfidTemp2[1];
}
function openPopinProgDiff(pgid, dfid){
	arreteMEA();
	posPP = false;
	posPProg = false;
	firstVisite = false;
	if(typeof habillageGrille == "string" && habillageGrille != ""){
		$("div#lb-mask").css("background-image", "url("+habillageGrille+")");
		$("div#lb-mask").css("background-repeat", "no-repeat");
		$("div#lb-mask").css("background-position", "top center");
	}
	showMask();
	$("div#lb-mask-load").html('<div id="loader" style="opacity:1;"><img style="opacity:1;" src="/lib/images/ajax/ajax-loader.gif" alt="" /></div>');
	$("#lb-detailprogram .wrap").css('background-position','1000px top');
	$("#lb-detailprogram .wrap p").css('display','none');
	$("#lb-detailprogram").css('background-position','1000px top');
	_tab = 1;
	updatePopupEPG(_tab);
	if ($().f_stopAutoFader) $().f_stopAutoFader("all"); 
	if (pgid != "" && dfid != "") {
		sURL='/ajax/private/programme.ajax.php?pgid='+pgid+'&dfid='+dfid;
		$("#detailprogram-inner").load(sURL,
			function(responseText, textStatus, XMLHttpRequest) {
				$("#lb-detailprogram .wrap").css('background-position','left bottom');
				$("#lb-detailprogram .wrap p").css('display','block');
				$("#lb-detailprogram").css('background-position','left top');
				//$("#detailprogram-inner").ready(function() {	
					if(screen.height<=600){
						$("div#voir-aussi").hide();
					}
					if(_tab==5){
						initTab4(pgid,dfid);
					}
					tabs(_tab);
					CANAL.initPlayers();
						if ($("#loader").is(":visible")) {
							$("div#loader").remove();	
							$("#lb-detailprogram").parent(".lb").show();			
						}
					//});	
			}
		)	
	}
}

/**
 * Fonctions JS pour le taggage Omniture
 *
 */


function setOmnitureProp6(valeur){
	s["prop6"] = "CSAT - " + valeur;
	s.pageName = "CSAT - " + valeur;
	s.t();
}


function setOmnitureProp5et6(valeur5,valeur6){
	s.prop5 = valeur5;
	s.prop6 = valeur6;
	s.pageName = valeur6;
	s.t();
}


// setOmnitureSerialize :utilise une chaine de caracteres pour positionner des parametres omniture
// chaineParams : chaine de parametre : prop1||valeur1##prop2||valeur2
function setOmnitureSerialize(chaineParamsOrig){
	var reg = new RegExp("events","g");
	if(chaineParamsOrig.match(reg)){
		chaineParamsOrig+="##pageName||##prop4||##prop5||##prop6||##prop7||##prop12||##prop13||##prop14||##eVar4||##eVar5||##eVar6||##eVar7||##eVar12||##eVar13||##eVar14||";
	}
	//alert(chaineParamsOrig);	
	// Pour l'ajax
	var reg= new RegExp("(event3,event3)","g");
	if(s["events"].match(reg)){
		s["events"] = "";
	}
	var chaineParams = unescape(chaineParamsOrig);
	if(chaineParams){
		var aCouple = chaineParams.split('##'); //alert(aCouple.length);
		for(cpt=0;cpt < (aCouple.length);cpt++){
			var sChaineElem = aCouple[cpt];
			var aElem = sChaineElem.split('||');
						
			if(aElem[1] == ""){							
				s[aElem[0]] = "";							
			}else{
				s[aElem[0]] = aElem[1];
			}					
		}	
		s["events"] = clearEvents(s["events"]);				
		s.t();				
	}
}



// envoie l'event3 a Omniture
function setPageVue(chaineParamsOrig){	
	var chaineParams = unescape(chaineParamsOrig);
	if(chaineParams){
		var reg= new RegExp("(event3,event3)","g");
		if(s["events"].match(reg)){
			s["events"] = "";
		}
		var aCouple = chaineParams.split('##'); 
		for(cpt=0;cpt < (aCouple.length);cpt++){
			var sChaineElem = aCouple[cpt];
			var aElem = sChaineElem.split('||');
									
			/*var reg1=new RegExp(aElem[1],"g");
			if (s["events"].match(reg1)) {
				// Si l'évènement existe, on le supprime
				s["events"] = "";
			}
			else{*/					
				if(aElem[1] == ""){				
					s[aElem[0]] = "";				
				}else{
					s[aElem[0]] = aElem[1];
				}				
			//}			
		}	
		s["events"] = clearEvents(s["events"]);		
		s.t();					
	}	
}

/** Réinitialise toutes les variables SUTRA a NULL**/
function cleanSutra(){
	
	s['prop31'] = "";
	s['prop32'] = "";
	s['prop33'] = "";
	s['prop34'] = "";
	s['prop35'] = "";
	s['prop36'] = "";
	s['prop37'] = "";
	s['prop38'] = "";
	s['prop39'] = "";
	
	s.t();
	
}
/* Supprime les doublons dans la variables events */
function clearEvents(events){
	var stringEvents = "";
	var aEvents = events.split(',');
	for(i=0;i<(aEvents.length);i++){		
		if(aEvents[i] != "" && aEvents[i] != undefined && aEvents[i] != "event3"){
			var reg=new RegExp("("+aEvents[i]+")","g");
			if (!stringEvents.match(reg)){
				// si l'event n'est pas déjà dans la liste, on l'ajoute
				stringEvents = stringEvents + ((stringEvents != "")? "," : "")+aEvents[i];
			}
		}
	}
	return stringEvents;
}


function preg_replace (array_pattern, array_pattern_replace, my_string)  {
	var new_string = String (my_string);
	for (i=0; i<array_pattern.length; i++) {
		var reg_exp= RegExp(array_pattern[i], "gi");
		var val_to_replace = array_pattern_replace[i];
		new_string = new_string.replace (reg_exp, val_to_replace);
	}
	return new_string;
}



function no_accent (chaine) {
	var new_chaine = "";
	var avec_accent = new Array("é", "è", "ê", "ë", "ç", "à", "â", "ä", "î", "ï", "ù", "ô", "ó", "ö");
	var sans_accent = new Array("e", "e", "e", "e", "c", "a", "a", "a", "i", "i", "u", "o", "o", "o");
	if (chaine && chaine!= "") {
		chaine = chaine.toLowerCase();
		new_chaine = preg_replace (avec_accent, sans_accent, chaine);
	}
	return new_chaine;
}

function setOmnitureEnreg(chaineParamsOrig){
	var chaineParams = unescape(chaineParamsOrig);
	if(chaineParams){
		var aCouple = chaineParams.split('##'); //alert(aCouple.length);
		for(cpt=0;cpt < (aCouple.length);cpt++){
			var sChaineElem = aCouple[cpt];
			var aElem = sChaineElem.split('||');				
			if(aElem[1] == ""){				
				s[aElem[0]] = "";				
			}else{
				s[aElem[0]] = aElem[1];
			}			
		}		
		s["events"] = clearEvents(s["events"]);
		s.tl();				
	}
}

function siteLienExterne(nomLienExterne) {
		s.linkTrackVars="events,eVar24"; // Les evars a tracker
        s.linkTrackEvents="event10"; // les events a tracker
        s.events="event10";
        s.eVar24=nomLienExterne;
        void(s.tl(true,'o',nomLienExterne));
}

function sendTag(page, prop4, prop5, prop6){
// ou page contient le libellé de la page, se référer au plan de marquage
// prop4 - contenu niv.1, prop5 - contenu niv. 2, prop6 - contenu niv.3
		s.pageName = page;
		s.pageURL = window.location.href;
		s.prop4 = prop4; s.prop5 = prop5; s.prop6 = prop6;
		if(s.channel){s.hier1="WebCanal|"+s.channel;
		if(s.prop4){s.hier1=s.hier1+'|'+s.prop4;if(s.prop5){s.hier1=s.hier1+'|'+s.prop5;
		if(s.prop6){s.hier1=s.hier1+'|'+s.prop6;if(s.prop7){s.hier1=s.hier1+'|'+s.prop7;}}}}}
		s.ch = "CANALSAT.FR"; s["events"] = clearEvents(s["events"]); /*s.events = "event3";*/	s.tl();
}
var vote_effectue=false;
				var etoiles_active=0;
				var on_vote=false;
				
			/*	function note_over(num){
				  note_out(1);
				  on_vote=true;
				  //alert(num+'    '+on_vote);
				  etoiles_active++;
				 if(!vote_effectue){
					  for(i=1;i<=num;i++){
						  tmpid="votenote"+i;
						  if(!on_vote && vote_actuel>=i){ break;}
						  document.getElementById(tmpid).src=document.getElementById(tmpid).src.replace("etoile.png","etoile-vide.png");
						  document.getElementById(tmpid).style.backgroundColor=theme;
						  }
					 
					  }
					  
				 }
				 function note_out(num){
				   if(!vote_effectue){
				   
				     for(i=num;i>=1;i--){
				        tmpid="votenote"+i;
						document.getElementById(tmpid).src=document.getElementById(tmpid).src.replace("etoile-vide.png","etoile.png");
					   }
					 }
				 }
				 
				 
				*/
				 function vote_in(){ 
				 on_vote=true;
				 
				 }
				 function vote_out(){ 
				  on_vote=false;
				 	restore_votes();
				   }
				 function restore_votes(){
				    if(!vote_effectue && on_vote==false){ 
                       for(i=1;i<=vote_actuel;i++){
					     tmpid="votenote"+i;
					     document.getElementById(tmpid).src=sImageFront+"/design/front_office_canalsat_v4/img/etoile-vide.png"
					     document.getElementById(tmpid).style.backgroundColor=theme;
					    }
          	    	}
				}
StarOutUrl=		'etoile.png';		//image par défaut
StarOverUrl=	'etoile-vide.png';		//image d'une étoile sélectionnée
StarBaseId=		'votenote';			//id de base des étoiles
NbStar=			5;			//nombre d'étoiles

LgtStarBaseId=StarBaseId.lastIndexOf('');

function NotationSystem() {
	for (i=1;i<NbStar+1;i++) {
		var img			=document.getElementById('votenote'+i);
		//Réaction lors du clic sur une étoile
		//Evidemment, il faudrait compléter cette fonction pour la rendre vraiment utile.
		//Par exemple, envoyer la note dans une base de donnée via un XMLHttpRequest.
		
		img.alt			='Donner la note de '+i;
		//Texte au survol
		img.onmouseover	=function() {StarOver(this.id);};
		img.onmouseout	=function() {StarOut(this.id);};
	}
}

function StarOver(Star) {
	StarNb=Name2Nb(Star);
	for(i=1;i<6;i++){
	document.getElementById('votenote'+i).src=document.getElementById('votenote'+i).src.replace(StarOverUrl,StarOutUrl);
	}
	for (i=1;i<(StarNb*1)+1;i++) {
		document.getElementById('votenote'+i).src=document.getElementById('votenote'+i).src.replace(StarOutUrl,StarOverUrl);
	}
}

function StarOut(Star) {
	StarNb=Name2Nb(Star);
	for (i=1;i<(StarNb*1)+1;i++) {
		document.getElementById('votenote'+i).src=document.getElementById('votenote'+i).src.replace(StarOverUrl,StarOutUrl);
	}
}

function Name2Nb(Star) {
	//Le survol d'une étoile ne nous permet pas de connaître directement son numéro
	//Cette fonction extrait donc ce numéro à partir de l'Id
	StarNb=Star.slice(LgtStarBaseId);
	return(StarNb);
}function trim(strSaisie) {
	var strRetour = "";
	var beginPos = 0, endPos;
	if (strSaisie != "") {
		while (strSaisie.charAt(beginPos) == ' ' && beginPos < strSaisie.length) {
			beginPos++;
		}
		endPos = strSaisie.length - 1;
		while (strSaisie.charAt(endPos) == ' ' && endPos > beginPos) {
			endPos--;
		}
		for (i = beginPos; i < endPos + 1; i++) {
			strRetour = strRetour + strSaisie.charAt(i);
		}
	}
	return strRetour;
}

function isBlank(strSaisie) {
	var iSaisie = 0;
	var strBlank = "";

	if (strSaisie != "") {
		for (i = 0; i < strSaisie.length; i++) {
			if (strSaisie.charAt(i) != ' ') {
				return false;
			}
		}
	}
	return true;
}

function isMail(S) {
	var pass = 0;
	if (window.RegExp) {
		var tempS = "a";
		var tempReg = new RegExp(tempS);
		if (tempReg.test(tempS)) pass = 1;
	}
	if (!pass)
	return (S.indexOf(".") > 2) && (S.indexOf("@") > 0);
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	//A CONTROLER var r2 = new RegExp("^[a-zA-Z0-9\\.\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\}\\~]*[a-zA-Z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\}\\~]\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	var r2 = new RegExp("^[a-zA-Z0-9\\.\\-\\_]*[a-zA-Z0-9\\.\\-\\_]\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,4})(\\]?)$");
	return (!r1.test(S) && r2.test(S));
}

function isURL(strSaisie) {
//	var r = new RegExp("^http://[a-zA-Z0-9\\.\\-\\_]*[a-zA-Z0-9\\.\\-\\_]\\.(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
//	return (r.test(strSaisie));
	var regexp = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
	return regexp.test(strSaisie);
}

function nl2br(obj) {
	var temp = new RegExp("\r\n" , "gi");
	var temp2 = obj.value.replace(temp, "<br />");
	obj.value = temp2;
}

function isAlphaNum(strSaisie) {
	var re = new RegExp(/^[0-9A-Za-z\\_]+$/);
	return re.test(strSaisie);
}

function isAlphabetic(strSaisie){
	var re=new RegExp("^([a-zA-Z\\_]*)$");
	return re.test(strSaisie);
}

function countchars(obj, imax) {
	var o = document.getElementById('cnt_' + obj.name + '_div');
	if ( imax ) {
		o.innerHTML = obj.value.length + '/' + imax + ' caract&egrave;res';
	} else {
		o.innerHTML = obj.value.length + ' caract&egrave;re' + (obj.value.length > 1?'s':'');
	}
}

var objInputDiv;

function showInputDiv(obj) {

	var list = document.getElementById(obj+"_DIV");

	var elem = document.getElementById(obj+"_IMG");

	var pos = { x: elem.offsetLeft, y: elem.offsetTop };
	if (elem.offsetParent) {
		var tmp = getAbsolutePosition(elem.offsetParent);
		pos.x += tmp.x;
		pos.y += tmp.y;
	}

	if (list.style.display == 'none') {
		list.style.top = pos.y+15;
		list.style.left = pos.x;
		list.style.display = '';
		hideSelectBoxes(list,true);
	} else {
		hideSelectBoxes(list,false);
		list.style.display = 'none';
	}

	objInputDiv = obj;
}

function selectInputDiv(id , lib) {
	if (objInputDiv) {
		var oId = document.getElementById(objInputDiv);
		var oLabel = document.getElementById(objInputDiv+"_LABEL");
		if (id) {
			oId.value = id;
			oLabel.innerHTML = lib.replace('"',"'");
		}
		showInputDiv(objInputDiv);
	}
}

function cleanText(text, bUnchange, XITI) {
	var sReturn = text;
	if (sReturn) {
		if (!bUnchange) sReturn = sReturn.toLowerCase();
		sReturn = trim(sReturn.replace(/[\»\«\^\·\'\;\-\:\.\?\,\"\&\_\=\°\/\%\!\(\)]/gi,' '));
		sReturn = trim(sReturn.replace(/[\>\<]/gi,'-'));
		sReturn = sReturn.replace(/[\(\)\+]/gi,'');
		sReturn = sReturn.replace(/[\s]{1,10}/gi,'-');
		sReturn = sReturn.replace(/_{1,10}/gi,'-');
		sReturn = sReturn.replace(/[äâà]/gi,'a');
		sReturn = sReturn.replace(/[éèëê]/gi,'e');
		sReturn = sReturn.replace(/[ïî]/gi,'i');
		sReturn = sReturn.replace(/[öô]/gi,'o');
		sReturn = sReturn.replace(/[ùüû]/gi,'u');
		sReturn = sReturn.replace(/[ç]/gi,'c');
		sReturn = sReturn.replace(/-{1,10}/gi,'-');
		sReturn = sReturn.replace(/-nbsp/gi,'');
		sReturn = sReturn.replace(/nbsp-/gi,'');
		sReturn = sReturn.replace(/-[a-z0-9]{1,2}-/gi,'-');
		sReturn = sReturn.replace(/-[a-z0-9]{1,2}-/gi,'-');
		if (XITI) {
			sReturn = sReturn.replace(/-/gi,'_');
		}
	}
	return sReturn;
}

function resizeMiniword(objName, i) {
	if ((i<0 && document.getElementById(objName).height>200) || i>0) {
		document.getElementById(objName).height = parseInt(document.getElementById(objName).height) + i;
	}
}function isNumeric(strSaisie) {
	var re = new RegExp("^([\-]?[0-9]*)$");
	if (re.test(strSaisie)) {
		return true;
	}
	return false;
}
 
function isFloat(strSaisie) {
	var re = new RegExp("^([\-]?[0-9]*[\\.\\,]?[0-9]+)$");
	if (re.test(strSaisie)) {
		return true;
	}
	return false;
}
 
function isTel(strSaisie) {
	var re = new RegExp("^([0-9\\.\\-\\ ]*)$");
	if (!isBlank(strSaisie) && re.test(strSaisie)) {
		return true;
	}
	return false;
}function isDate(value) {
	 
	var re;
	 
	switch (dateLanguageFormat) {
		case "MM/DD/YYYY":
		{
			re = new RegExp(/(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](16|17|18|19|20\d\d)/);
			reg1 = 2;
			reg2 = 1;
			break;
		}
		case "DD/MM/YYYY":
		{
			re = new RegExp(/(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.](16|17|18|19|20\d\d)/);
			reg1 = 1;
			reg2 = 2;
			break;
		}
	}
	 
	var ma = re.exec(value);
	if (ma == null) {
		return false;
	} else {
		j = eval(ma[reg1]);
		m = eval(ma[reg2]);
		y = eval(ma[3]);
	}
	 
	if (isNaN(j) || isNaN(m) || isNaN(y) ) {
		return false;
	}
	if ((j < 1) || (j > 31) ) {
		return false;
	}
	if ((m < 1) || (m > 12) ) {
		return false;
	}
	if (((m == 4) || (m == 6) || (m == 9) || (m == 11)) && (j == 31) ) {
		return false;
	}
	if ((m == 2) && (j == 29) && !((y%400 == 0) || ((y%4 == 0) && y%100 ) ) ) {
		return false;
	}
	if ((m == 2) && (j > 29)) {
		return false;
	}
	return true;
}
 
function isDate_edition(theDate) {
	// si c'est une date le test est bon
	if (isDate(theDate)) {
		return true;
	}
	else if (theDate.length == 7) {
		// si c'est mm/yyyy, le test est bon
		var m = theDate.substring(0, theDate.indexOf("/"));
		if (m.charAt(0) == "0" ) {
			m = m.charAt(1);
		}
		m = parseInt(m);
		var y = theDate.substring(theDate.lastIndexOf("/")+1, theDate.length);
		if (y.length < 4 || y.length > 4 ) {
			return false;
		}
		var y = parseInt(y);
		 
		for (var i = 0; i < theDate.length; i++) {
			if (isNaN(parseInt(theDate.charAt(i))) && (theDate.charAt(i) != '/') ) {
				return false;
			}
		}
		if (isNaN(m) || isNaN(y) ) {
			return false;
		}
		if ((m < 1) || (m > 12) ) {
			return false;
		}
	}
	else if (theDate.length == 4) {
		// si c'est yyyy, le test est bon
		var y = theDate;
		 
		for (var i = 0; i < theDate.length; i++) {
			if (isNaN(parseInt(theDate.charAt(i)))) {
				return false;
			}
		}
		if (isNaN(parseInt(y)) ) {
			return false;
		}
	} else {
		return false;
	}
	return true;
}
 
function isHour(strSaisie) {
	var h = strSaisie.substring(0, strSaisie.indexOf(":"));
	for (i = 0; i < strSaisie.length; i++) {
		if (isNaN(parseInt(strSaisie.charAt(i))) && (strSaisie.charAt(i) != ':') ) {
			return false;
		}
	}
	if (h.charAt(0) == "0" ) {
		h = h.charAt(1);
	}
	if (h.length > 2 ) {
		return false;
	}
	h = parseInt(h);
	var m = strSaisie.substring(strSaisie.lastIndexOf(":")+1, strSaisie.length);
	if (m.charAt(0) == "0" ) {
		m = m.charAt(1);
	}
	if (m.length > 2 ) {
		return false;
	}
	m = parseInt(m);
	if (h > 23 ) {
		return false;
	}
	if (m > 60 ) {
		return false;
	}
	return true;
}
 
function dateDiff (strDDeb, strDFin, strHDeb, strHFin) {
	if (arguments.length > 2 ) {
		dDeb = new Date(strDDeb.substring(strDDeb.lastIndexOf("/")+1, strDDeb.length), strDDeb.substring(strDDeb.indexOf("/")+1, strDDeb.lastIndexOf("/")), strDDeb.substring(0, strDDeb.indexOf("/")), strHDeb.substring(0, strHDeb.indexOf(":")), strHDeb.substring(strHDeb.lastIndexOf(":")+1, strHDeb.length));
	} else {
		dDeb = new Date(strDDeb.substring(strDDeb.lastIndexOf("/")+1, strDDeb.length), strDDeb.substring(strDDeb.indexOf("/")+1, strDDeb.lastIndexOf("/")), strDDeb.substring(0, strDDeb.indexOf("/")));
	}
	if (arguments.length > 3 ) {
		dFin = new Date(strDFin.substring(strDFin.lastIndexOf("/")+1, strDFin.length), strDFin.substring(strDFin.indexOf("/")+1, strDFin.lastIndexOf("/")), strDFin.substring(0, strDFin.indexOf("/")), strHFin.substring(0, strHFin.indexOf(":")), strHFin.substring(strHFin.lastIndexOf(":")+1, strHFin.length));
	} else {
		dFin = new Date(strDFin.substring(strDFin.lastIndexOf("/")+1, strDFin.length), strDFin.substring(strDFin.indexOf("/")+1, strDFin.lastIndexOf("/")), strDFin.substring(0, strDFin.indexOf("/")));
	}
	return (dDeb - dFin);
}
 
function verifIntervalle (obj1, obj2) {
	if (!(obj1.value) && (obj2.value)) {
		alert("La date de fin doit être remplie.");
		obj2.focus();
		return false;
	}
	if (!(obj2.value) && (obj1.value)) {
		alert("La date de début doit être remplie.");
		obj1.focus();
		return false;
	}
	if (dateDiff(obj1.value, obj2.value, '0', '0') > 0) {
		alert("La date de fin doit être postérieure à la date de début.");
		obj2.focus();
		return false;
	}
	return true;
}/*
	FUDGE + AREA17 auto paginated content slider with next/prev btns
	-----------------
	
	Usage: jQuery('div[class*=-slider-container]').f_slider({ itemsVisible: 4, doAutoScroll: false, slideAmount: 660 });
	
	Authors: Mike '1312' Byrne and Seb
	
	Copyright 2009 Fudge Studios & AREA 17

*/

jQuery.fn.f_slider = function(options) {
	
	// Set Options
	var options = jQuery.extend({
		itemsVisible: 1,
		doAutoScroll: false,
		slideAmount: ""
	}, options);
	
	if (options.slideAmount != "" && jQuery(jQuery(this).selector).length > 0) {
		
		return this.each(function (i) {
		
			// slider container
			var sliderContainer = jQuery(this);
			// slider motion
			var sliderInner = sliderContainer.find("ul[class*=-slider]");
			// get all the items in the slider list
			var listItems = sliderContainer.find("ul[class*=-slider]").children();
			// get the html of the list items into a var (picked up later)
			var listItemsHTML;
			// is the slider moving
			var sliderMoving = false;
			// which bit of the slider are we working on?
			var itemsVisible = options.itemsVisible;
			var currentSliderCount = itemsVisible;
			var currentSliderPos = 0;
			var initSliderPos = currentSliderPos;
			var slideAmount = options.slideAmount;
			// a var to attach the autoscroller set interval to
			var doAutoScroll = options.doAutoScroll;
			
			// the slider functions
			function moveSlider(direction) {
				if (!sliderMoving) {
					clearInterval(doAutoScroll);
					calculateNextPosition(direction);
					sliderMoving = true;
					sliderInner.animate({
						left: (currentSliderPos * -1)					
					}, 1000, function(){
						checkForLoop();
					});
					updatePaginator2();
				}
			}		
			// calculate the next position of the slider
			function calculateNextPosition(direction) {
				if(direction == 'right') {
					currentSliderCount = currentSliderCount + itemsVisible;
					currentSliderPos += slideAmount;
				} else if (direction == 'left') {			
					currentSliderCount = currentSliderCount - itemsVisible;
					currentSliderPos -= slideAmount;
				} else {
					currentSliderCount = (direction + 1) * itemsVisible;
					// working out the width of the original set of LIs
					var width = (slideAmount/itemsVisible) * listItems.length;
					currentSliderPos = width - initSliderPos + (direction * slideAmount);
				}
			}
			// auto scroll
			function autoScroll() {
				moveSlider('right');	
			}
			// add extra list items into the dom!
			function addListItems() {
				if (listItems.length > 0) {
					// check the amount of LIs, make to a division of 4
					// and then keep checking until it is				
					for (var i=1; i<=itemsVisible; i++) {
						var isEvenTest = listItems.length % itemsVisible;
						if ((isEvenTest*1) > 0) {
							sliderInner.append('<li class="blank"></li>');
							listItems = sliderContainer.find("ul[class*=-slider]").children();
						}
					}
					// more setting up needed, based on any new elements that have been added
					listItemsHTML = sliderContainer.find("ul[class*=-slider]").html();
					listItems = sliderContainer.find("ul[class*=-slider]").children();		
					// sort out the paginator size
					var paginatorBtns = listItems.length / itemsVisible;
					for (var i=1; i<=paginatorBtns; i++) {
						if (i==1) {
							sliderContainer.find("ul[class*=paginator]").append('<li class="current"><a href="#">'+i+'</a></li>');
						} else {
							sliderContainer.find("ul[class*=paginator]").append('<li><a href="#">'+i+'</a></li>');
						}
					}
					if (jQuery.browser.msie) {
						if (sliderContainer.parent("div.col").prev("div.col-first").children("h3").html() == "Sorties de la semaine") {
						} else {
							var pw = (paginatorBtns * 13) + 63;
							sliderContainer.find("ul[class*=paginator]").css("width",pw);
						}
						
					}
					// now duplicate the li's to be able to do the looping animation of them			
					if (listItems.length > itemsVisible) {				
						// add in a copy of the LIs - twice
						// there are now 3 copies of the LIs and we want to mainly see the middle set,
						// and then over run onto one of the 2 copies, either left or right
						// before resetting back to showing the middle set
						sliderInner.append(listItemsHTML);
						sliderInner.append(listItemsHTML);
						// sorts out positions and variables that other slider functions use
						resetSlider();
						// set up the prototype periodical executor
						//new PeriodicalExecuter(autoScroll, 5);
						// gah need to stop and start it, setInterval it is then...
						if (doAutoScroll != false) {
							doAutoScroll = setInterval(autoScroll, 5000 );
						}
					} else {
						// less than shown, dont do any auto scroll or any btn funcs
						sliderContainer.find("ul[class*=paginator]").find("li.current a").hide();
						sliderContainer.find("ul[class*=paginator]").find("li.next a").hide();
						sliderContainer.find("ul[class*=paginator]").find("li.prev a").hide();
					}
				} else {
					// nothing in the list!
					sliderContainer.find("ul[class*=paginator]").find("li.next a").hide();
					sliderContainer.find("ul[class*=paginator]").find("li.prev a").hide();
				}
			}
			// check for loop, reset if need be
			function checkForLoop() {
				// if current is bigger than the amount plus 3(?), then we're repeating the first 4 LIs, so we can just show the middle set again
				// or
				// if current is the same as negative amount minus 4(?), we've now gone backwards a full set, so we can just show the middle set again
				if( (currentSliderCount >= (listItems.length + itemsVisible)) || (currentSliderCount == 0) ) {
					resetSlider();
				}
				//update the paginator
				//updatePaginator();
				//
				sliderMoving = false;
				if (doAutoScroll != false) {
					doAutoScroll = setInterval(autoScroll, 5000);
				}
			}
			// reset slider position and variables
			function resetSlider() {
				// as default or as just gone backwards:
		
				// working out the width of the original set of LIs
				var width = (slideAmount/itemsVisible) * listItems.length;
				// 0 is gone backwards, else is gone forwards
				if(currentSliderCount == 0) {
					currentSliderCount = listItems.length;
					// then adjusting (so the left button doesnt obscure)
					currentSliderPos = width + width - slideAmount - initSliderPos;
				} else {
					currentSliderCount = itemsVisible;
					// then adjusting (so the left button doesnt obscure)
					currentSliderPos = width - initSliderPos;
				}
				// then need to sort the position out, so that the middle set of LIs is shown.
				var posAdjust = "-"+currentSliderPos+"px";
				// and adjust
				sliderInner.css({ left: posAdjust });
				//
			}
			// update paginator links (this is to be run after the animation has happened, alternatively you can use the v2)
			function updatePaginator() {
				sliderContainer.find("ul[class*=paginator]").find("li.current").removeClass("current");
				var paginatorCurrent = currentSliderCount/itemsVisible;
				paginatorCurrent = paginatorCurrent + 1;
				sliderContainer.find("ul[class*=paginator]").find("li:eq("+paginatorCurrent+")").addClass("current");
			}
			// update paginator links (this can be run at the same time the animation starts, has bits of code from checkforloop and reset in it)
			function updatePaginator2() {
				var cSc = currentSliderCount;
				if( (currentSliderCount >= (listItems.length + itemsVisible)) || (currentSliderCount == 0) ) {
					if(cSc == 0) {
						cSc = listItems.length;
					} else {
						cSc = itemsVisible;
					}
				}
				sliderContainer.find("ul[class*=paginator]").find("li.current").removeClass("current");
				var paginatorCurrent = cSc/itemsVisible;
				paginatorCurrent = paginatorCurrent + 1;
				sliderContainer.find("ul[class*=paginator]").find("li:eq("+paginatorCurrent+")").addClass("current");
			}
			// need to make sure extra list items have been added if needed
			addListItems();
			// add some events to the slider buttons
			sliderContainer.find("ul[class*=paginator]").find("li.prev a").click(function(e){
				e.preventDefault();
				moveSlider('left');
			});
			sliderContainer.find("ul[class*=paginator]").find("li.next a").click(function(e){
				e.preventDefault();
				moveSlider('right');
			});
			sliderContainer.find("ul[class*=paginator]").find("li a").each(function(i,val){
				if (i > 1 && !sliderContainer.sliderMoving) {
					jQuery(val).click(function(e) {
						e.preventDefault();
						if (!jQuery(this).parent().hasClass("current") && !sliderMoving) {
							moveSlider(i-2);
							sliderContainer.find("ul[class*=paginator]").find("li.current").removeClass("current");
							jQuery(val).parents("li").addClass("current");
						}
					});
				}
			});
		
		});
	
	}
};

jQuery.fn.f_controler = function(options) {

	myFeature = function(name) {
		this.init(name);
	}
	
	jQuery.extend(myFeature.prototype, {
		widget_name: '',
		widget_scrollInterval: 0,
		widget_delay: 0,
		widget_faderTimer: 0,
		widget_hoverTimer: 0,
		
		widget_sliderContainer: '',
		widget_sliderInner: '',
		widget_listItems: '',
		widget_currentSliderPos: '',
		widget_initSliderPos: '',
		widget_slideAmount: '',
		widget_isFading: false,
		widget_scrollInterval: false,
		
		widget_setIntervalId: 0,
		widget_setTimeOutId: 0,
		widget_setTimeOutId2: 0,
		widget_setTimeOutId3: 0,

		// getter widget name
		myNameIs: function() {
			return this.widget_name;
		},
		
		// getter/setter for scroll interval
		saveScrollInterval: function(widget_scrollInterval) {
			this.widget_scrollInterval = widget_scrollInterval;
		},
		getScrollInterval: function() {
			return this.widget_scrollInterval;
		},
		
		// getter/setter for fader timer
		saveFaderTimer: function(widget_faderTimer) {
			this.widget_faderTimer = widget_faderTimer;
		},
		getFaderTimer: function() {
			return this.widget_faderTimer;
		},
		// getter/setter for delay
		saveDelay: function(widget_delay) {
			this.widget_delay = widget_delay;
		},
		getDelay: function() {
			return this.widget_delay;
		},
		// getter/setter for hover timer
		saveHoverTimer: function(widget_hoverTimer) {
			this.widget_hoverTimer = widget_hoverTimer;
		},
		getHoverTimer: function() {
			return this.widget_hoverTimer;
		},
		
		// getter/setter for the setInterval id
		saveSetIntervalId: function(widget_setIntervalId) {
			this.widget_setIntervalId = widget_setIntervalId;
		},
		getSetIntervalId: function() {
			return this.widget_setIntervalId;
		},
		
		// getter/setter for the setTimeOut id
		saveSetTimeOutId: function(widget_setTimeOutId) {
			this.widget_setTimeOutId = widget_setTimeOutId;
		},
		getSetTimeOutId: function() {
			return this.widget_setTimeOutId;
		},
		
		// getter/setter for the setTimeOut id 2
		saveSetTimeOutId2: function(widget_setTimeOutId2) {
			this.widget_setTimeOutId2 = widget_setTimeOutId2;
		},
		getSetTimeOutId2: function() {
			return this.widget_setTimeOutId2;
		},
		
		// getter/setter for the setTimeOut id 3
		saveSetTimeOutId3: function(widget_setTimeOutId3) {
			this.widget_setTimeOutId3 = widget_setTimeOutId3;
		},
		getSetTimeOutId3: function() {
			return this.widget_setTimeOutId3;
		},
		
		moveSlider: function(widget_direction, widget_trigger) {
			if (!this.widget_isFading) {
				this.widget_listItems.eq(this.widget_currentSliderPos).fadeOut(800);
				this.widget_isFading = true;
				this.calculateNextPosition(widget_direction); 
				this.widget_listItems.eq(this.widget_currentSliderPos).fadeIn(1000);
				this.widget_isFading = false;
				// updates the paginator (not if we use the pagination bullets)
				if (widget_trigger != "bullet") {
					this.updatePaginator();
				}
			}			
		},
		
		calculateNextPosition: function(widget_direction) {
			if (widget_direction == "right") {
				if (this.widget_currentSliderPos == this.widget_listItems.length - 1) {
					this.resetSlider();
				} else {
					this.widget_currentSliderPos++;
				}
			} else {
				this.widget_currentSliderPos = widget_direction;
			}
		},
		
		resetSlider: function() {
			this.widget_currentSliderPos = this.widget_initSliderPos;
		},
		
		updatePaginator: function() {
			this.paginatorCurrent = this.widget_sliderContainer.find("ul[class*=paginator]").find("li.current").prevAll().size();
			this.widget_sliderContainer.find("ul[class*=paginator]").find("li.current").removeClass("current");
			// if we reach the last paginator, we rollback to the 1st
			if (this.paginatorCurrent == this.widget_listItems.length + 1) {
				this.paginatorCurrent = 1;
			}
			this.paginatorCurrent = this.paginatorCurrent + 1;
			this.widget_sliderContainer.find("ul[class*=paginator]").find("li:eq("+this.paginatorCurrent+")").addClass("current");
		},
		
		hideNonVisiblePosters: function() {
			if (this.widget_listItems.length > 0) {
				for (var i = this.widget_listItems.length; i > 1; i--) {
					this.widget_listItems.eq(i-1).hide();
				}
			}
		},
		
		addListItems: function() {
			if (this.widget_listItems.length > 0) {
				// sort out the paginator size
				this.paginatorBtns = this.widget_listItems.length;
				for (var i=1; i<=this.paginatorBtns; i++) {
					if (i==1) {
						this.widget_sliderContainer.find("ul[class*=paginator]").append('<li class="current"><a href="#">'+i+'</a></li>');
					} else {
						this.widget_sliderContainer.find("ul[class*=paginator]").append('<li><a href="#">'+i+'</a></li>');
					}
				}
				if (jQuery.browser.msie) {
					var pw = (this.paginatorBtns * 13) + 63;
					this.widget_sliderContainer.find("ul[class*=paginator]").css("width",pw);
				}
				
			} else {
				// nothing in the list!
				this.widget_sliderContainer.find("ul[class*=paginator]").find("li.next a").hide();
				this.widget_sliderContainer.find("ul[class*=paginator]").find("li.prev a").hide();
			}
		},
		
		// start slider auto fade
		autoFade: function() {
			this.moveSlider("right", "");
		},
		
		info: function() {
			//console.log('my name is ' + this.widget_name + " and have a delay of " + this.widget_delay);
			//console.log('my name is ' + this.widget_name + " and have a fader timer of " + this.widget_faderTimer);
		},
		init: function(options) {
			
			var options = jQuery.extend({
				widget_name: "",
				widget_scrollInterval: 0,
				widget_delay: 0
			}, options);
			
			this.widget_name = options.widget_name;
			this.widget_scrollInterval = options.widget_scrollInterval;
			this.widget_delay = options.widget_delay;
			
			this.widget_sliderContainer = jQuery("#" + this.widget_name);
			this.widget_sliderInner = this.widget_sliderContainer.find("ul[class*=-slider]");
			this.widget_listItems = this.widget_sliderInner.children();
			
			this.widget_currentSliderPos = 0;
			this.widget_initSliderPos = this.widget_currentSliderPos;
			
			this.hideNonVisiblePosters();
			this.addListItems();
			
		}
		
	});
	
	// private rescoping method
	var rescope = function(scope, method){
	        if(!method){ method = scope; scope = null; }
	        if(typeof method == "string"){
	                scope = scope || window;
	                if(!scope[method]){ throw(['method not found']); }
	                return function(){ return scope[method].apply(scope, arguments || []); };
	        }
	        return !scope ? method : function(){ return method.apply(scope,	arguments || []); };
	}
	
	// PUBLIC function to move the slider
	// _name : name of the feature
	// _direction : direction of the move
	// _delay : runs the auto fade after X seconds of delay
	// _scrollInterval : runs the auto fade every X seconds of autofade
	// _iterator : since each feature calls twice moveSlider, we have 2 setTimeOut ids so we have to keep track of them
	jQuery.fn.f_moveSlider = function(_name, _direction, _delay, _scrollInterval, _iterator, _trigger) {
		if (_name == g1.myNameIs()) {
			if (_delay >= 0) {
				var _d = setTimeout(function() {
					if (_scrollInterval > 0) {
						var _t = setInterval(_g1_scrollInterval, _scrollInterval);
						g1.saveSetIntervalId(_t);
						//console.log("g1.saveSetIntervalId= " + _t + " (iterator #" + _iterator + ")");
					} else {
						//console.log("g1.direction= " + _direction + " (iterator #" + _iterator + ")");
						g1.moveSlider(_direction, _trigger);
					}
				}, _delay);	
				//console.log(g1.myNameIs() + " timeOutId= " + _d);
				if (_iterator == 1) {
					g1.saveSetTimeOutId(_d);
					//console.log("g1.saveSetTimeOutId= " + _iterator);
				} else if (_iterator == 2) {
					g1.saveSetTimeOutId2(_d);
					//console.log("g1.saveSetTimeOutId2= " + _iterator);
				} else if (_iterator == 3) {
					g1.saveSetTimeOutId3(_d);
					//console.log("g1.saveSetTimeOutId3= " + _iterator);
				}			
			}
		} else if (_name == g2.myNameIs()) {
			if (_delay >= 0) {
				var _d = setTimeout(function() {
					if (_scrollInterval > 0) {
						var _t = setInterval(_g2_scrollInterval, _scrollInterval);
						g2.saveSetIntervalId(_t);
					} else {
						g2.moveSlider(_direction, _trigger);
					}
				}, _delay);	
				//console.log(g2.myNameIs() + " timeOutId= " + _d);
				if (_iterator == 1) {
					g2.saveSetTimeOutId(_d);
					//console.log("g2.saveSetTimeOutId= " + _iterator);
				} else if (_iterator == 2) {
					g2.saveSetTimeOutId2(_d);
					//console.log("g2.saveSetTimeOutId2= " + _iterator);
				}			
			}
		} else if (_name == g3.myNameIs()) {
			if (_delay >= 0) {
				var _d = setTimeout(function() {
					if (_scrollInterval > 0) {
						var _t = setInterval(_g3_scrollInterval, _scrollInterval);
						g3.saveSetIntervalId(_t);
						//console.log(g3.myNameIs() + " setIntervalid= " + _t);
					} else {
						g3.moveSlider(_direction, _trigger);
					}
				}, _delay);
				//console.log(g3.myNameIs() + " timeOutId= " + _d);
				if (_iterator == 1) {
					g3.saveSetTimeOutId(_d);
					//console.log("g3.saveSetTimeOutId= " + _iterator);
				} else if (_iterator == 2) {
					g3.saveSetTimeOutId2(_d);
					//console.log("g3.saveSetTimeOutId2= " + _iterator);
				}				
			}
		} else {
			return -1;
		}		
	}
	
	// the following 3 functions had to be created in order to use "setInterval" properly in f_startAutoFader
	function _g1_scrollInterval() {
		g1.autoFade();
	}
	function _g2_scrollInterval() {
		g2.autoFade();
	}
	function _g3_scrollInterval() {
		g3.autoFade();
	}
	
	// Anonymous functions to clear the intervals
	function _g1_clearIntervals() {
		clearInterval(g1.getSetTimeOutId());
		clearInterval(g1.getSetTimeOutId2());
		clearInterval(g1.getSetIntervalId());
	}
	
	function _g2_clearIntervals() {
		clearInterval(g2.getSetTimeOutId());
		clearInterval(g2.getSetTimeOutId2());
		clearInterval(g2.getSetIntervalId());
	}
	
	function _g3_clearIntervals() {
		clearInterval(g3.getSetTimeOutId());
		clearInterval(g3.getSetTimeOutId2());
		clearInterval(g3.getSetIntervalId());
	}
	
	// PUBLIC function to stop the autofader (individually or all)
	jQuery.fn.f_stopAutoFader = function(_name) {
		if (_name == g1.myNameIs()) {
			_g1_clearIntervals();
		} else if (_name == g2.myNameIs()) {
			_g2_clearIntervals();
		} else if (_name == g3.myNameIs()) {
			_g3_clearIntervals();
		} else if (_name == "all") {
			_g1_clearIntervals();
			_g2_clearIntervals();
			_g3_clearIntervals();
		} else {
			return -1;
		}		
	}
	
	// Resynchronizing all 3 features. 
	// First we stop all auto fading
	// Then based on the name of the feature that has been rolled out, we relaunch all 3 with the right sequence order changes while keeping the proper delays
	// So on mouse out event : 
	// if (this) is genre-1
	// we stop all timers, genre-1 fades after 2 seconds we relaunch with config#1 (1=0s, 2=2s, 3=4s);
	// if (this) is genre-2
	// we stop all timers and relaunch with config #2 (2=0s, 3=2s, 1=4s)
	// if (this) is genre-3
	// we stop all timers and relaunch with config #3 (3=0s, 1=2s, 2=4s)
	jQuery.fn.f_launchSynchroFaders = function(_name, _trigger) {
		
		this.delay_1 = g1.getDelay();
		this.delay_2 = g2.getDelay();
		this.delay_3 = g3.getDelay();
		
		if (_trigger == "mouseout") {
			jQuery().f_stopAutoFader("all");
		} else if (_trigger == "bullet") {
			this.delay_1 += 1000;
			this.delay_2 += 1000;
			this.delay_3 += 1000;
		}
	
		if (_name == g1.myNameIs()) {
			jQuery().f_moveSlider(g1.myNameIs(), "right", this.delay_1, 0, 1, "");
			jQuery().f_moveSlider(g2.myNameIs(), "right", this.delay_2, 0, 1, "");
			jQuery().f_moveSlider(g3.myNameIs(), "right", this.delay_3, 0, 1, "");
			// this runs the sequence every 6 eights seconds. the trick here is that it waits for 8 seconds on launch before running and 
			// repeating every next 6 seconds
			jQuery().f_moveSlider(g1.myNameIs(), "right", this.delay_1, g1.getScrollInterval(), 2, "");
			jQuery().f_moveSlider(g2.myNameIs(), "right", this.delay_2, g2.getScrollInterval(), 2, "");
			jQuery().f_moveSlider(g3.myNameIs(), "right", this.delay_3, g3.getScrollInterval(), 2, "");
			
		} else if (_name == g2.myNameIs()) {
			
			jQuery().f_moveSlider(g2.myNameIs(), "right", this.delay_1, 0, 1, "");
			jQuery().f_moveSlider(g3.myNameIs(), "right", this.delay_2, 0, 1, "");
			jQuery().f_moveSlider(g1.myNameIs(), "right", this.delay_3, 0, 1, "");
			
			jQuery().f_moveSlider(g2.myNameIs(), "right", this.delay_1, g2.getScrollInterval(), 2, "") ;
			jQuery().f_moveSlider(g3.myNameIs(), "right", this.delay_2, g3.getScrollInterval(), 2, "");
			jQuery().f_moveSlider(g1.myNameIs(), "right", this.delay_3, g1.getScrollInterval(), 2, "");
			
		} else if (_name == g3.myNameIs()) {
			
			jQuery().f_moveSlider(g3.myNameIs(), "right", this.delay_1, 0, 1, "");
			jQuery().f_moveSlider(g1.myNameIs(), "right", this.delay_2, 0, 1, "");
			jQuery().f_moveSlider(g2.myNameIs(), "right", this.delay_3, 0, 1, "");
			
			jQuery().f_moveSlider(g3.myNameIs(), "right", this.delay_1, g3.getScrollInterval(), 2, "");
			jQuery().f_moveSlider(g1.myNameIs(), "right", this.delay_2, g1.getScrollInterval(), 2, "");
			jQuery().f_moveSlider(g2.myNameIs(), "right", this.delay_3, g2.getScrollInterval(), 2, "");
		} 
		
		delete this.delay_1;
		delete this.delay_2;
		delete this.delay_3;
	}
	
	// We use this function to synchronize two features when the third is being hovered
	jQuery.fn.f_ajustSynchroFaders = function(_name) {
		
		this.delay_1 = g1.getDelay();
		this.delay_2 = g2.getDelay();
		this.widget_scrollInterval = g1.getScrollInterval() - 2000;
		
		if (_name == g1.myNameIs()) {
			jQuery().f_moveSlider(g2.myNameIs(), "right", this.delay_1, 0, 1, "");
			jQuery().f_moveSlider(g3.myNameIs(), "right", this.delay_2, 0, 1, "");
			// this runs the sequence every 6 eights seconds. the trick here is that it waits for 8 seconds on launch before running and 
			// repeating every next 6 seconds
			jQuery().f_moveSlider(g2.myNameIs(), "right", this.delay_1, this.widget_scrollInterval, 2, "");
			jQuery().f_moveSlider(g3.myNameIs(), "right", this.delay_2, this.widget_scrollInterval, 2, "");
			
		} else if (_name == g2.myNameIs()) {
			jQuery().f_moveSlider(g3.myNameIs(), "right", this.delay_1, 0, 1, "");
			jQuery().f_moveSlider(g1.myNameIs(), "right", this.delay_2, 0, 1, "");
			jQuery().f_moveSlider(g3.myNameIs(), "right", this.delay_1, this.widget_scrollInterval, 2, "");
			jQuery().f_moveSlider(g1.myNameIs(), "right", this.delay_2, this.widget_scrollInterval, 2, "");
			
		} else if (_name == g3.myNameIs()) {
			jQuery().f_moveSlider(g1.myNameIs(), "right", this.delay_1, 0, 1, "");
			jQuery().f_moveSlider(g2.myNameIs(), "right", this.delay_2, 0, 1, "");
			jQuery().f_moveSlider(g1.myNameIs(), "right", this.delay_1, this.widget_scrollInterval, 2, "");
			jQuery().f_moveSlider(g2.myNameIs(), "right", this.delay_2, this.widget_scrollInterval, 2, "");
		}	
		
		delete this.delay_1;
		delete this.delay_2;
		delete this.widget_scrollInterval;
	}
	
	// Creating the objects
	var g1 = new myFeature({ widget_name: "genre-1", widget_scrollInterval: 6000, widget_delay: 2000});
	var g2 = new myFeature({ widget_name: "genre-2", widget_scrollInterval: 6000, widget_delay: 4000});
	var g3 = new myFeature({ widget_name: "genre-3", widget_scrollInterval: 6000, widget_delay: 6000});
	
	// Starting the auto fade 
	jQuery().f_launchSynchroFaders("genre-1");
	
	// Attaching mouse events (pagination click, feature hover);
	jQuery('div.genre').f_faderMouseEvents();
	

};

jQuery.fn.f_faderMouseEvents = function() {
	
	if ((jQuery(this).selector).length > 0) {
		
		return this.each(function (i) {
			// slider id
			var sliderId = jQuery(this).attr("id");
			// slider container
			var sliderContainer = jQuery(this);
			// slider motion
			var sliderInner = sliderContainer.find("ul[class*=-slider]");
			// get all the items in the slider list
			var listItems = sliderContainer.find("ul[class*=-slider]").children();
			
			// rescoping methods
			var rescope = function(scope, method){
			        if(!method){ method = scope; scope = null; }
			        if(typeof method == "string"){
			                scope = scope || window;
			                if(!scope[method]){ throw(['method not found']); }
			                return function(){ return scope[method].apply(scope, arguments || []); };
			        }
			        return !scope ? method : function(){ return method.apply(scope,	arguments || []); };
			}
			
			// Click event on slider pagination bullets
			sliderContainer.find("ul[class*=paginator]").find("li a").each(function(i,val){
				if (i > 1) {
					jQuery(val).click(function(e) {
						e.preventDefault();
						if (!jQuery(this).parent().hasClass("current")) {
							jQuery().f_stopAutoFader("all"); // making s
							jQuery().f_moveSlider(sliderId, i-2, 0, 0, 3, "bullet"); //function(_name, _direction, _delay, _scrollInterval, _iterator)
							sliderContainer.find("ul[class*=paginator]").find("li.current").removeClass("current");
							jQuery(val).parents("li").addClass("current");
							
							// if we are still hovering the bullets, don't run auto fade for the current slide but adjust the two other features
							if (sliderInner.hasClass("features-hover")) {
								jQuery().f_ajustSynchroFaders(sliderId);
							}
							// if not, run general auto fade for all three features 
							else {
								jQuery().f_launchSynchroFaders(sliderId, "bullet");
							}
						}
					});
				}
			});
			
			// Hover event on the slider paginator bullets
			sliderContainer.find("ul.paginator").hover(function(){
				sliderContainer.find("ul.features-slider").addClass("features-hover");
				jQuery().f_stopAutoFader("all");
				jQuery().f_ajustSynchroFaders(sliderId);
			}, function() {
				sliderContainer.find("ul.features-slider").removeClass("features-hover");
				jQuery().f_launchSynchroFaders(sliderId, "mouseout");
			});

			// Hover on the slider
			sliderInner.hover(function(){
				sliderInner.addClass("features-hover");
				jQuery().f_stopAutoFader("all");
				jQuery().f_ajustSynchroFaders(sliderId);
			}, function() {
				sliderInner.removeClass("features-hover");
				if (jQuery("div#lb-mask").css("display") == "none" ) jQuery().f_launchSynchroFaders(sliderId, "mouseout");
				
			});
		});
	}
};


function videoSlider() {

	jQuery("ul.videos-slider li._videos").hover(function(){
		jQuery(this).addClass("pointer");
	}, function() {
		jQuery(this).removeClass("pointer");
	});
	
	jQuery("ul.videos-slider li h4 a.a_info, ul.videos-slider li h4 a.a_img, ul.videos-slider li h4 a.video").hover(function(){
		jQuery(this).parents("li").removeClass("pointer");
	}, function() {
		jQuery(this).parents("li").addClass("pointer");
	});
	jQuery("ul.videos-slider li p a.a_info").hover(function(){
		jQuery(this).parents("li").addClass("hover");
	}, function() {
		jQuery(this).parents("li").removeClass("hover");
	});
	
	jQuery("ul.videos-slider li._videos").click(function(e) {
		if (jQuery(this).hasClass("pointer")) {
			e.preventDefault();
			var href = jQuery(this).find("a").attr("href");
			if (href != "#" && href != "" && href != undefined) {
				window.location = href;
			}
		}
	});

} tpid='';
 cid='';
 _rel='';
var posPP = false;
var posPProg = false;
var firstVisite = false;
var diffusionId = '';
function lightboxes() {
//	var timer1 = microtime(true);
	var _eY = 0;
	var _tab = 0;
	var _epgid = "";
	var bAuthenticated = true;
	var bIdentified = true;
	 isServiceEnabled = true;

	function hideMask() {
		if(typeof habillageGrille == "string" && habillageGrille != ""){
			$("div#lb-mask").css("background-image", "");
			$("div#lb-mask").css("background-repeat", "");
			$("div#lb-mask").css("background-position", "");
		}
		$("div#lb-mask").hide();
		$("div#lb-mask-load").hide();
	}

	function hideLBs() {
		$(".lb").hide();
	}
	
	// update show detail program after ajax complete
	function update(textStatus,href,tab) {
		if (textStatus == "success") {
			//liBrevesInitUserCookie();
			if($("#detailProgramDropDown").is(":visible")){
				customDropDown("detailProgramDropDown");
			}
			tabs(tab);
			updatePopupEPG(tab);
			labelMessages();
		} else {
			window.location = href;
		}
	}

	function positionPopup(id) {
		var _parent = $(id).parent('.lb');
		_parent.show();
		var h = $(window).height();
		var h2 = parseFloat(_parent.height());
		var windowTopOffset = $(window).scrollTop();
		alert(h);	alert(h2);
		if ((h-h2) < 80) {
			windowTopOffset = windowTopOffset + 40;
		} else {
			windowTopOffset = windowTopOffset + ((h-h2) / 2);
		}
		//_parent.css('top', windowTopOffset + 'px');
	}
	
	function positionPopup2() {
		var _parent = $('.lb');
		
		var h = $(window).height();
		var h2 = parseFloat(_parent.height());
		var windowTopOffset = $(window).scrollTop();
		alert(h);	alert(h2);
			windowTopOffset = windowTopOffset + ((h-h2) / 2);
		//_parent.css('top', windowTopOffset + 'px');
	}
	function openPopup(id, type) {
	
		function _openPopup(id, type) {
			var params = "";
			if (type == "rec") {
				params = params + "rec=1";
			}
			if (type == "live") {
				params = params + "live=1";
			}
			if (type == "live-premium") {
				params = params + "live=1&premium=1";
				if (_epgid != "") {
					params = params + "&epgid=" + _epgid;
				}
			}
			if (type == "match") {
				params = params + "match=1";
			}
			if (typeof pid == "string") {
				if (params != "") {
					params = params + "&";
				}
				params = params + "pid=" + pid;
			}
			if (typeof cid == "string") {
				if (params != "") {
					params = params + "&";
				}
				params = params + "cid=" + cid;
			}

			if (isFirstCallLightboxes) {
				if (typeof init == "string") {
					if (params != "") {
						params = params + "&";
					}
					params = params + "init=" + init;
				}
				if (typeof lck == "string") {
					if (params != "") {
						params = params + "&";
					}
					params = params + "lck=" + lck;
				}
				if (typeof mc == "string") {
					if (params != "") {
						params = params + "&";
					}
					params = params + "mc=" + mc;
				}
				if (typeof mesinc == "string") {
					if (params != "") {
						params = params + "&";
					}
					params = params + "mesinc=" + mesinc;
				}
				if (typeof remember == "string") {
					if (params != "") {
						params = params + "&";
					}
					params = params + "remember=" + remember;
				}
				if (typeof exist == "string") {
					if (params != "") {
						params = params + "&";
					}
					params = params + "exist=" + exist;
				}
				if (typeof live == "string") {
					if (params != "") {
						params = params + "&";
					}
					params = params + "live=" + live;
				}
				if (typeof premium == "string") {
					if (params != "") {
						params = params + "&";
					}
					params = params + "premium=" + premium;
				}
				if (typeof epgid == "string") {
					if (params != "") {
						params = params + "&";
					}
					params = params + "epgid=" + epgid;
				}
			}

			if (id == "compte-login") {
				var _id = "#lb-login";
			} else {
				var _id = "#lb-" + id;
			}
			
			if (id == "forget-password" || id == "login" || id == "compte-login") {
				if (bIdentified || bAuthenticated) {
					if (params != "") {
						params = params + "&";
					}
					params = params + "authentif_light=1";
				}
				if (typeof sUrlSite == "string") {
					var url = sUrlSite + "/partner/partner_popin.js.php?id=" + id + "&" + params;
					$.getScript(url, function() {
						positionPopup(_id);
						if (id == "compte-login" && (!isSafari || isChrome)) {
							$(_id + " input[name=SUBSCRIBER_EMAIL]").remove();
							$(_id + " input[name=SUBSCRIBER_EMAIL_DISABLED]").removeAttr("disabled");
							$(_id + " input[name=SUBSCRIBER_EMAIL_DISABLED]").attr("name", "SUBSCRIBER_EMAIL");
						}
						$(_id + " input[name=from_url]").val(from_url);
						$(_id + " input:enabled:first").focus();
						$(_id + " input:enabled:first").select();
						$("#a_compte-login-forget").click(function(e) {
							e.preventDefault();
							hideLBs();
							openPopup("compte-login");
						});
						$("#a_forget-password").click(function(e) {
							e.preventDefault();
							hideLBs();
							openPopup("forget-password");
						});
						$("#a_register-forget").click(function(e) {
							e.preventDefault();
							hideLBs();
							openPopup("register");
						});
						$("#a_register-signup").click(function(e) {
							e.preventDefault();
							hideLBs();
							openPopup("register");
						});
						$("#lb-close-login, #lb-close-forget-password").click(function(e) {
							e.preventDefault();
							hideMask();
							hideLBs();
						});
					});
				} else {
					if (id == "forget-password") {
						var _href = "/forget.ajax.php";
					} else {
						var _href = "/login.ajax.php";
					}
				}
			}
			if (id == "register" || id == "compte") {
				if (typeof sUrlSite == "string") {
					var _src = sUrlSiteSecure + "/index.php?pid=" + pid + "&cid=" + cid + "&tpl=10&par=CPLUS&url_retour=" + encodeURIComponent(from_url);
					if (id == "register") {
						var _height = 975;
					}
					if (id == "compte") {
						var _height = 810;
					}
					$(_id).css("height", _height + "px");
					$(_id).html('<p class="close" style="top: 14px;"><a href="#" id="lb-close">Fermer</a></p><iframe width="660" height="' + _height + '" frameborder="0" scrolling="auto" src="' + _src + '">');
					$("#lb-close").click(function(e) {
						$("div#lb-mask").hide();
						$("div#lb-mask-load").hide();
						$("div.lb").hide();
						relanceMEA();
					});
				} else {
					var _href = "/compte.ajax.php";
				}
			}

			if (typeof _href == "string" && typeof from_url == "string") {
				if (params != "") {
					_href += "?" + params;
				}
				$(_id).load(_href,
				function(responseText, textStatus, XMLHttpRequest) {
					positionPopup(_id);
					$(_id + " input[name=from_url]").val(from_url);
					$(_id + " input:enabled:first").focus();
					$(_id + " input:enabled:first").select();
					if (type == "rec" && id == "compte") {
						$(_id + " input[type=radio][name=SUBSCRIBER_FLAG_ABO]").each(function(){
							if ($(this).val() == "0") {
								$(this).removeAttr("checked");
							}
							if ($(this).val() == "1") {
								$(this).attr("checked", "checked");
							}
						});
						$(_id + " input[name=SUBSCRIBER_NUMBER]").focus();
						$(_id + " input[name=SUBSCRIBER_NUMBER]").select();
					}
					if (type == "rec" && (id == "login" || id == "compte-login" || id == "compte")) {
						var _html = '';
						if (id == "login" || id == "compte-login") {
							_html += '<p class="service">Pour enregistrer ce programme, nous vous invitons à vous identifier.</p>';
						}
						_html += '<input type="hidden" name="rec" value="1" /><input type="hidden" name="mpid" value="'+mpid+'" /><input type="hidden" name="pgid" value="'+pgid+'" /><input type="hidden" name="dfid" value="'+dfid+'" />';
						if ($("div.semaine-slider").is(":visible")) {
							var _date = $("div.semaine-slider ul li.current").attr("id").replace("nav-", "");
							_html += '<input type="hidden" name="date" value="'+_date+'" />';
						}
						$(_id + " form").prepend(_html);
					}
					if (type == "match" && (id == "login" || id == "compte-login")) {
						var _html = '<input type="hidden" name="match" value="1" />';
						$(_id + " form").prepend(_html);
					}
					$("#a_compte-login-forget").click(function(e) {
						e.preventDefault();
						hideLBs();
						openPopup("compte-login", type);
					});
					$("#a_forget-password").click(function(e) {
						e.preventDefault();
						hideLBs();
						openPopup("forget-password", type);
					});
					$("#a_register-forget").click(function(e) {
						e.preventDefault();
						hideLBs();
						openPopup("register", type);
					});
					$("#a_register-signup").click(function(e) {
						e.preventDefault();
						hideLBs();
						openPopup("register", type);
					});
					$("#lb-close, #lb-close-button, #lb-close-login, #lb-close-forget-password").click(function(e) {
						e.preventDefault();
						hideMask();
						hideLBs();
						
					});
				}
				);
			} else {
				positionPopup(_id);
			}
		}
		
	}
	
	$("#lb-mask").click(function(e) {
		e.preventDefault();
		if ($("#detailprogram-inner").is(":visible")) {
			clearProgramDetail();
		}
		if ($().f_launchSynchroFaders) {
			$().f_launchSynchroFaders("genre-1");
		}
		if (tpid == "650" && !$("div#lb-compte").is(":visible") && !$("div#lb-detailprogram").is(":visible")) {
			shadowObject = $("div#lb-live-tv h2:visible, div#lb-login h2:visible, div#lb-forget-password h2:visible, div#lb-register h2:visible");
			shadow();
		} else {
			hideMask();
			hideLBs();
		}
		relanceMEA();
	});
	$("#lb-mask-load").click(function(e) {
		e.preventDefault();
		if ($("#detailprogram-inner").is(":visible")) {
			clearProgramDetail();
		}
		if ($().f_launchSynchroFaders) {
			$().f_launchSynchroFaders("genre-1");
		}
		hideMask();
		hideLBs();
		relanceMEA();
	});
	
	
	$("#lb-close-alt").click(function(e) {
		e.preventDefault();
		clearProgramDetail();
		if ( $().f_launchSynchroFaders){
			$().f_launchSynchroFaders("genre-1");
		}
		hideMask();
		hideLBs();
		playerEmbarque = 0;
		closePlayerVideo();
		relanceMEA();
	});

	$("#lb-close-brevesport").click(function(e) {
		e.preventDefault();
		clearBreveSport();
		hideMask();
		hideLBs();
	});

	$('#a_register, #a_register-planNav, #a_register-avisCom, .register').live('click', function(e) {
		e.preventDefault();
		showMask();
		openPopup("register");
	});

	// show login
	$("#a_login, #a_login-planNav, .identify").click(function(e) {
		e.preventDefault();
		showMask();
		openPopup("login");
	});

	$(".a_login-live").click(function(e) {
		e.preventDefault();
		var _rel = $(this).attr("rel");
		if (_rel != "") {
			_epgid = _rel;
		}
		if (_epgid != "") {
			window.location = sUrlLiveTV + "?epgid=" + _epgid;
		} else {
			window.location = sUrlLiveTV;
		}
			
	});
	
	if(typeof(sso_action) == "string"){
		if(sso_action == "inscription"){
			showMask();
			openPopup("register");
		}
	}

	if (typeof(bIsAutentif) != "undefined") {
		if (bIsAutentif == 1) {
			var myAccountCompteLogin = "";
			var myAccountCompte = ", .myaccount";
		} else {
			var myAccountCompteLogin = ", .myaccount";
			var myAccountCompte = "";
		}
	} else {
		var myAccountCompteLogin = "";
		var myAccountCompte = "";
	}

	

	$("#a_compte-rec, #a_compte-rec-2").click(function(e) {
		e.preventDefault();
		showMask();
		hideLBs();
		openPopup("compte", "rec");
	});

	// ajax show detail program

	// align visible popups
	
	
	
	// ajax show detail program
	$('.popin-programme').live('click', function(e) {
		e.preventDefault();
		arreteMEA();
		posPP = false;
		posPProg = false;
		firstVisite = false;
		
		_href = $(this).find("a:first").attr("href");
		if ($(e.target).is("a.lbl-ba")) {
			_href += "&onglet=ba";
		}		
		test = _href;
		var url = "";
	    first = test.split("#");
	    for(i=0;i<first.length;i++){
	        if(i == 0){
	        	url += first[i]+"&cid_only=1";
	        }else{
	        	url += "#"+first[i];
	        }
	    }
		
		_dfid = $(this).find("a:first").attr('class');
		_dfidTemp = _dfid.replace("titre-programme","");
		_dfidTemp = _dfid.replace("lbl-ba","");
		_dfidTemp = _dfid.replace("lbl","");
		_dfidTemp = _dfid.replace("reco-detail","");
		_dfidTemp2 = _dfidTemp.split('dfid-');
		dfid=_dfidTemp2[1];
		
		
		
		_rel=$(this).find("a:first").attr("rel");
		param=test.split("?");
		gets=param[1];
		pgidTemp=gets.split("&");
		paramTemp=pgidTemp[0].split("=");
		pgid=paramTemp[1];
		
		if((bAuthenticated && $(e.target).is("a.lbl-rec")) || !$(e.target).is("a.lbl-rec")){
			e.preventDefault();
			if(typeof habillageGrille == "string" && habillageGrille != ""){
				$("div#lb-mask").css("background-image", "url("+habillageGrille+")");
				$("div#lb-mask").css("background-repeat", "no-repeat");
				$("div#lb-mask").css("background-position", "top center");
			}
			showMask();
			
			$("div#lb-mask-load").html('<div id="loader" style="opacity:1;"><img style="opacity:1;" src="/lib/images/ajax/ajax-loader.gif" alt="" /></div>');
			$("#lb-detailprogram .wrap").css('background-position','1000px top');
			$("#lb-detailprogram .wrap p").css('display','none');
			$("#lb-detailprogram").css('background-position','1000px top');
			updatePopupEPG(_tab);
			
			if ($().f_stopAutoFader) $().f_stopAutoFader("all"); 
			if (!$(e.target).is("span.lbl-voirLeDirect")) {
				_eY = e.pageY;
				if ($(this).children("h4").length > 0) {
					_href = $(this).children("h4").children("a").attr("href");
				} else if ($(this).children("h5").length > 0) {
					_href = $(this).children("h5").children("a").attr("href");
				} else if ($(this).children("a").length > 0) {
					_href = $(this).children("a").attr("href");
				}
				
				if ($(e.target).is("a.lbl-rec") || $(e.target).is("a.lbl-action") || _rel=="ead" ) {
					if(!firstVisite){
						firstVisite = true;
						var _p = $('.lb-alt');
				
						var h = $(window).height();
						var h2 = 350;
						var windowTopOffset = $(window).scrollTop();
							windowTopOffset = windowTopOffset + ((h-h2) / 2);
						_p.css('top', windowTopOffset + 'px');
					}
					_tab = 5;
				} else {
					if ($(e.target).is("a.lbl-ba")) {
						_tab = 4;
					} else {
						if($(e.target).is("a.lbl-diff")) {
							_tab = 3;
						} else {
							_tab = 1;
						}
					}
				}
	
	
				if (_href != "" || _href != "#") {
				
				sURL='/ajax/private/programme.ajax.php?pgid='+pgid+'&dfid='+dfid;
					$("#detailprogram-inner").load(sURL,
						function(responseText, textStatus, XMLHttpRequest) {
							$("#lb-detailprogram .wrap").css('background-position','left bottom');
							$("#lb-detailprogram .wrap p").css('display','block');
							$("#lb-detailprogram").css('background-position','left top');
							//$("#detailprogram-inner").ready(function() {	
								if(screen.height<=600){
									$("div#voir-aussi").hide();
								}
								if(_tab==5){
									initTab4(pgid,dfid);
								}
								tabs(_tab);
								CANAL.initPlayers();
									if ($("#loader").is(":visible")) {
										$("div#loader").remove();	
										$("#lb-detailprogram").parent(".lb").show();			
									}
								//});	
						}
					)	
				}
			}
		}
	});
}


function customDropDown(id) {
	//var timer1 = microtime(true);
	if(typeof id == "string"){
		var cddDivs = "div#"+id;
	} else {
		var cddDivs = "div.customDropDown";
	}
	$(cddDivs).each(function (i) {
		$(this).find("h3").hover(function(){
			$(this).addClass("hover");
		}, function() {
			$(this).removeClass("hover");
		});
		//
		var ddShow = false;
		var ddInput = $(this).children()[0];
		var ddDiv = $(this).children()[1];
		//
		ddInput = $(ddInput);
		ddDiv = $(ddDiv);
		//
		ddDiv.hide();
		//
		var ddH3text = $(this).find("h3").text();
		if (ddH3text != ddDiv.find("li:first a").text()) {
			ddDiv.find("li a:contains('" + ddH3text + "')").parent().hide();
		} else {
			ddDiv.find("li:first").hide();
		}
		//
		var clickFunction = $(this).attr("id");
		//
		ddInput.click(
		function () {;
			toggleDD();
		}
		);

		$(document).click(
		function (e) {
			if($(e.target).parents().attr("id") != clickFunction) {
				ddDiv.hide();
				ddDiv.removeClass("dd-open");
				ddDiv.prev().removeClass("dd-open");
				if(isIE) {
					$(".schedule-sm").css("zIndex","1");
				}
			}
		}
		);

		function toggleDD() {
			ddDiv.toggle();
			ddDiv.toggleClass("dd-open");
			ddDiv.prev().toggleClass("dd-open");
			if (isIE) {
				if(ddDiv.hasClass("dd-open")) {
					$(".schedule-sm").css("zIndex","-1");
				} else {
					$(".schedule-sm").css("zIndex","1");
				}
			}
		}

		//
		ddDiv.find("li a").click(
		function (e) {
			if($(this).parents("li").parents("ul").parents("div").parents("div").attr("id") != "NavSportDropDown"){
				e.preventDefault();
			}
			ddInput.html($(this).html());
			toggleDD();
			$(this).parent().siblings().show();
			$(this).parent().hide();
			if (clickFunction) {
				//on sauvegarde le click dans le cookie
				eval(clickFunction + "('" + ($(this).attr("rel")) + "')");
			//	userPageLiState.updateValue($(this).parents("li").attr("id"),($(this).attr("rel")));
			//	userPageLiParentState.updateValue($(this).parents("li").attr("id"),$(this).parents("li").parents("div").parents("div").attr("id"));
			}
		}
		);
	});
}


function updatePopupEPG(tab) {
	var _parent = $("#lb-detailprogram").parent(".lb-alt");
	var h = $(window).height();
	var h2 = parseFloat(_parent.height());
	if(tab ==3) h2 =380;
	var windowTopOffset = $(window).scrollTop();
	if (h < h2) {
		windowTopOffset = windowTopOffset;
	} else {
		windowTopOffset = windowTopOffset + ((h-h2)/2);
	}
	_parent.css("top", windowTopOffset+"px");
}




function tabs(t) {
	
	if (t) {
		var _a = $("ul.tabs li a._tabs");
		_a.each(function(i){
			var _class = $(this).parents("li").attr("class");
			_class = _class.replace("tab-", "");
			_class = _class.replace("current", "");
			_class = _class.replace(" ", "");
			if (_class == t) {
				$(this).unbind("click");
			} else {
				$(this).unbind("click");
				$(this).bind("click", function(e){
					tabs(_class);
					if (_class == 5 ) {
						//e.preventDefault();
						initTab4(pgid, dfid);
					}
				});
			}	
			
		});
		$("#detailprogram-inner ul.tabs li[class*=tab-]").removeClass("current");
		$("#detailprogram-inner ul.tabs li.tab-"+t).addClass("current");
		$("#detailprogram-inner div[class*=tab-content]").hide();
		if (t==3) {
			if (typeof $("#detailprogram-inner div.tab-content-3")=='undefined'){
				$("#detailprogram-inner div.tab-content-4").show();
			} else {
				FlashPlayerPause("CanalPlayerGrille");
				$("#detailprogram-inner div.tab-content-3").show();
				if (isIE || $.browser.msie) {
					$("#detailprogram-inner div.diffusion").css("float","none");
					$("#detailprogram-inner div.diffusion").css("margin","0px 10px 0px 14px");
					$("#detailprogram-inner div.diffusion").css("float","left");
				}
			}

		} else {
			$("#detailprogram-inner div.tab-content-"+t).show();
			var c1_vide=false;
			$("#detailprogram-inner div.tab-content-1 div.feature-alt p").each(function(){
				if($(this).html()==""){
					c1_vide=true;
				}
			});
			
	
			if(t==3){
				FlashPlayerPlay("CanalPlayerGrille");
				slPlayerPause();
			}else{
				FlashPlayerPause("CanalPlayerGrille");
			}
		}
	} 
}


function FlashPlayerPause(sPlayerEmbarqueId) {
	if(typeof sPlayerEmbarqueId == "string"){
		if (document.getElementById(sPlayerEmbarqueId)) {
			if (typeof document.getElementById(sPlayerEmbarqueId).playerPause == "function") {
				document.getElementById(sPlayerEmbarqueId).playerPause();
			}
		}
	}else{
		if (document.getElementById("CanalPlayerEmbarque")) {
			if (typeof document.getElementById("CanalPlayerEmbarque").playerPause == "function") {
				document.getElementById('CanalPlayerEmbarque').playerPause();
			}
		}
	}
}

function FlashPlayerPlay(sPlayerEmbarqueId) {
	if(typeof sPlayerEmbarqueId == "string"){
		if (document.getElementById(sPlayerEmbarqueId)) {
			if (typeof document.getElementById(sPlayerEmbarqueId).playerPause == "function") {
				document.getElementById(sPlayerEmbarqueId).playerPause();
			}
		}
	}else{
		if (document.getElementById("CanalPlayerEmbarque")) {
			if (typeof document.getElementById("CanalPlayerEmbarque").playerPlay == "function") {
				document.getElementById("CanalPlayerEmbarque").playerPlay();
			}
		}
	}
}

function FlashPlayerStop() {
	if (document.getElementById("CanalPlayerEmbarque")) {
		if (typeof document.getElementById('CanalPlayerEmbarque').playerStop == "function") {
			document.getElementById("CanalPlayerEmbarque").playerStop();
		}
	}
}
function closePlayerVideo() {
	$("div#lb-player-video").hide();
	$("div#lb-player-video div#player-video").html('<object id="CanalPlayerEmbarque"></object>');
	playerEmbarque = 0;
}


function initTab4(pgid,dfid){
$('div#enregistrement').html('');
$.ajax({
						url: '/ajax/private/ead/ead_init.php',
						data: {
							pgid:pgid,
							dfid:dfid
							},
						dataType: "json",
						success: function(data){
							$("div #enregistrement").html(data.enregistrement);
							$("div #visuel_alerte_horaire_debut").html(data.visuel_alerte_horaire_debut);
							eval(data.js);
							diffusionId=dfid;
						}
						
			});			
}

function enregistrementAvantDropDown(i) {
	$('#enregistrementAvant').val(i);
	eavt=$('#enregistrementAvant').val();
	eapr=$('#enregistrementApres').val();
	dfid=diffusionId;
	$.ajax({
						url: '/ajax/private/ead/ead_check_conflict.php',
						data: {
							pgid:pgid,
							dfid:dfid,
							eavt:eavt,
							eapr:eapr
							},
						dataType: "json",
						success: function(data){
							$("div #enregistrement").html(data.enregistrement);
							eval(data.retour_js);
							
						}
						
			});			
}
	

function enregistrementApresDropDown(i) {
	$('#enregistrementApres').val(i);
	eavt=$('#enregistrementAvant').val();
	eapr=$('#enregistrementApres').val();
	dfid=diffusionId;
	$.ajax({
						url: '/ajax/private/ead/ead_check_conflict.php',
						data: {
							pgid:pgid,
							dfid:dfid,
							eavt:eavt,
							eapr:eapr
							},
						dataType: "json",
						success: function(data){
							$("div #enregistrement").html(data.enregistrement);
							eval(data.retour_js);
						}
						
			});			
	
}

function supressionDiffusion(diffId) {
	//$("#zone_modification_"+diffId).css("visibility", "hidden");
	$("#zone_modification_"+diffId).addClass("visibilityHidden");
	//$("#zone_modification_"+diffId).css("display", "none");
	$("#zone_modification_"+diffId).css("displayNone");
	//$("#zone_suppression_"+diffId).css("visibility", "visible");
	$("#zone_suppression_"+diffId).addClass("visibilityVisible");
	//$("#zone_suppression_"+diffId).css("display", "block");
	$("#zone_suppression_"+diffId).css("displayBlock");
	//$('.horaireDropDown ul').css('height', '110px');
	$('.horaireDropDown ul').addClass('height110px');
	//$('.horaireDropDown ul').css('overflow-y', 'auto');
	$('.horaireDropDown ul').addClass('overflowY-auto');
}
function modificationDiffusion(diffId) {
	//$("#zone_suppression_"+diffId).css("visibility", "hidden");
	$("#zone_modification_"+diffId).addClass("visibilityHidden");
	//$("#zone_suppression_"+diffId).css("display", "none");
	$("#zone_suppression_"+diffId).addClass("displayNone");
	$("#zone_suppression_"+diffId).addClass("displayNone");
	//$("#zone_modification_"+diffId).css("visibility", "visible");
	$("#zone_modification_"+diffId).addClass("visibilityVisible");
	//$("#zone_modification_"+diffId).css("display", "block");
	$("#zone_modification_"+diffId).css("displayBlock");
	//$('.horaireDropDown ul').css('height', '110px');
	$('.horaireDropDown ul').addClass('height110px');
	//$('.horaireDropDown ul').css('overflow-y', 'auto');
	$('.horaireDropDown ul').addClass('overflowY-auto');
}
function validerEnregistrement(pgid,dfid) {
	$.ajax({
						url: '/ajax/private/ead/ead_validation.php',
						data: {
							pgid:pgid,
							dfid:dfid,
							eavt : $('#enregistrementAvant').val(),
							eapr : $('#enregistrementApres').val()
							},
						dataType: "json",
						success: function(data){
							$("div #enregistrement").html(data.enregistrement);
						}
						
			});			
	
	
}

function ead_conflict_modif_suppression(oRecordDiffId, pgid, dfid, eavt, eapr){

	$.ajax({
						url: '/ajax/private/ead/ead_conflict_modif_suppression.php',
						data: {
							oRecordDiffId:oRecordDiffId,
							pgid:pgid,
							dfid:dfid,
							eavt:eavt,
							eapr:eapr
							},
						dataType: "json",
						success: function(data){
							$("div #zone_suppression_"+oRecordDiffId).html(data.html);
							eval(data.zone_suppression_js);
						}
						
			});			

}

function ead_conflict_modif_suppression_annulation(iDiffusionIdentifiant,iRecordProgrammeIdentifiant,iRecordDiffusionIdentifiant,iRecordEnregistrementAvant,iRecordEnregistrementApres){
		$.ajax({
						url: '/ajax/private/ead/ead_conflict_modif_suppression_annulation.php',
						data: {
							oRecordDiffId:oRecordDiffId,
							pgid:iRecordProgrammeIdentifiant,
							dfid:iRecordDiffusionIdentifiant,
							eavt:iRecordEnregistrementAvant,
							eapr:iRecordEnregistrementApres
							},
						dataType: "json",
						success: function(data){
							eval(data.js);
						}
						
			});			
}

function ead_conflict_rediff(iDiffusionIdentifiant){
	$.ajax({
						url: '/ajax/private/ead/ead_conflict_rediff.php',
						data: {
							dfid:iDiffusionIdentifiant
							},
						dataType: "json",
						success: function(data){
							$("div #detail_conflits").html(data.detail_conflits);
							eval(data.js);
						}
						
			});			
}



function ead_conflict_modif(iProgrammeIdentifiant,iDiffusionIdentifiant,iEnregistrementAvant,iEnregistrementApres ){
	$.ajax({
						url: '/ajax/private/ead/ead_conflict_modif.php',
						data: {
							pgid:iProgrammeIdentifiant,
							dfid:iDiffusionIdentifiant,
							eavt:iEnregistrementAvant,
							eapr:iEnregistrementApres
							},
						dataType: "json",
						success: function(data){
							$("div #detail_conflits").html(data.detail_conflits);
							eval(data.js);
						}
			});			
}

function labelMessages2() {
	$("a.lbl-message2").hover(function(){
		//$(".message2").css('display', 'block');
		$(".message2").addClass('showBlock');
	}, function() {
		$(".message2").hide();
		$(".message2").removeClass('showBlock');
	});
}

function labelMessages3() {
	$("a.lbl-message3").hover(function(){
		//$(this).next().css('display', 'block');
		$(this).next().addClass('showBlock');
	}, function() {
		$(this).next().hide();
		$(this).next().removeClass('showBlock');
	});
}

function lienProgramme(progId, diffId) {
	var url = page_url+"?rec=1&pgid="+progId+"&dfid="+diffId;
	if ($("div.semaine-slider").is(":visible")) {
		var date = $("div.semaine-slider ul li.current").attr("id").replace("nav-", "");
		url += "&date="+date;
	}
	//document.location.href = url;
	initTab4(progId, diffId);
}

function labelMessages() {
	var bgS = -180;
	$("span.message").prev("a.lbl").addClass("lbl-message");
	$("a.lbl-message").mousemove(function(e){
		if($(this).attr('id') == 5){
			var bgS = -155;
		}else{
			var bgS = -180;
		}
		$(this).parents("div.ch").css("z-index","998");
		var mX = e.pageX;
		var pX = $(this).parent().offset().left;
		pX = Math.ceil(pX);
		var p = mX - pX;
		p = (p > 5) ? p : 5;
		p = bgS + p - 5;
		if ($("#programmesTable").length > 0) {
			p = p + 71;
		}
		$(this).next("span.message").css({ backgroundPosition: p});
		

	});
	$("a.lbl-message").hover(function(){
		if (isIE && $("div.customDropDown").length > 0) {
			$("div.customDropDown").addClass("customDropDown-alt");
		}
		$(this).next().show();
	}, function() {
		if (isIE && $("div.customDropDown").length > 0) {
			$("div.customDropDown").removeClass("customDropDown-alt");
		}
		$(this).next().hide();
		$(this).parents("div.ch").css("z-index","1");
	});
}

function clearProgramDetail() {
		$("#detailprogram-inner").html("");
		FlashPlayerPause("CanalPlayerGrille");
	}
	
function inscriptionsLayer(){
	$(document).ready(function(){
		lien=$('body a.lien-popin-premierevisite');
		href=lien.attr("href");
		if(href.indexOf("pid")<0){
			href = href+encodeURIComponent(pageGrille+'?programme='+pgid+'&dfid='+dfid+'&rec=1');
		}else{
			href = href+encodeURIComponent('&programme='+pgid+'&dfid='+dfid+'&rec=1');
		}
		lien.attr("href",href);
		lien.click();
		$("#lb-close-alt").click();
	});
}

function compteLayer(){
	$(document).ready(function(){
		lien=$('div#identifiant div.login a.lien-popin-inscription');
		href=lien.attr("href");
		if(href.indexOf("pid")<0){
			href = href+encodeURIComponent(pageGrille+'?programme='+pgid+'&dfid='+dfid+'&rec=1');
		}else{
			href = href+encodeURIComponent('&programme='+pgid+'&dfid='+dfid+'&rec=1');
		}
		lien.attr("href",href);
		lien.click();
		$("#lb-close-alt").click();
	});
}

$(document).ready(function(){
		if(programme){
			pgid=programme;
			if(rec==1){	
				_tab=5;
			}else{
				_tab=1;
			}	
				
				
			if(typeof habillageGrille == "string" && habillageGrille != ""){
				$("div#lb-mask").css("background-image", "url("+habillageGrille+")");
				$("div#lb-mask").css("background-repeat", "no-repeat");
				$("div#lb-mask").css("background-position", "top center");
				
			}
			arreteMEA();
			showMask();
			
			$("div#lb-mask-load").html('<div id="loader"><img src="/lib/images/ajax/ajax-loader.gif" alt="" style="opacity:1"/></div>');
			$("#lb-detailprogram .wrap").css('background-position','1000px top');
			$("#lb-detailprogram .wrap p").css('display','none');
			$("#lb-detailprogram").css('background-position','1000px top');
			updatePopupEPG(_tab);
			
				sURL='/ajax/private/programme.ajax.php?pgid='+pgid+'&dfid='+dfid;
					$("#detailprogram-inner").load(sURL,
						function(responseText, textStatus, XMLHttpRequest) {
							$("#lb-detailprogram .wrap").css('background-position','left bottom');
							$("#lb-detailprogram .wrap p").css('display','block');
							$("#lb-detailprogram").css('background-position','left top');
							$("#detailprogram-inner").ready(function() {	
								if(screen.height<=600){
									$("div#voir-aussi").hide();
								}
								if(_tab==5){
									initTab4(pgid,dfid);
								}
								tabs(_tab);
								CANAL.initPlayers();
								if ($("#loader").is(":visible")) {
										$("div#loader").remove();	
										$("#lb-detailprogram").parent(".lb").show();			
									}
								});	
								
						}
					)	
		}
});

function showMask() {
		if (isIE6) {
			var h = $("body").height();
			$("div#lb-mask").height(h);
			$("div#lb-mask-load").height(h);
		}
		$("div#lb-mask").show();
		$("div#lb-mask-load").show();
		if (tpid == "650") {
			$("div.live-premium-player").find("*").css("visibility", "hidden");
		}
	}
	
function refreshPopupProgramme(pgid){
			$("div#lb-mask").click();
			$("div#lb-mask-load").click();
			showMask();
			$("div#lb-mask-load").html('<div id="loader"><img src="/lib/images/ajax/ajax-loader.gif" alt="" style="opacity:1" /></div>');
			$("#lb-detailprogram .wrap").css('background-position','1000px top');
			$("#lb-detailprogram .wrap p").css('display','none');
			$("#lb-detailprogram").css('background-position','1000px top');
			_tab=1;
			updatePopupEPG(_tab);
			
				sURL='/ajax/private/programme.ajax.php?pgid='+pgid;
					$("#detailprogram-inner").load(sURL,
						function(responseText, textStatus, XMLHttpRequest) {

							$("#lb-detailprogram .wrap").css('background-position','left bottom');
							$("#lb-detailprogram .wrap p").css('display','block');
							$("#lb-detailprogram").css('background-position','left top');
							$("#detailprogram-inner").ready(function() {	
								if(screen.height<=600){
									$("div#voir-aussi").hide();
								}
								if(_tab==5){
									initTab4(pgid,dfid);
								}
								tabs(_tab);
								CANAL.initPlayers();
								if ($("#loader").is(":visible")) {
										$("div#loader").remove();	
										$("#lb-detailprogram").parent(".lb").show();			
									}
								});	
								
						}
					)	
}

function survol(){
	$("div.programme a").hover(function(){
		$(this).children("h5").addClass("hover");
	}, function() {
		$(this).children("h5").removeClass("hover");
	});

}
/*
--------------------------------
Infinite Scroll
--------------------------------
+ https://github.com/paulirish/infinite-scroll
+ version 2.0b2.111027
+ Copyright 2011 Paul Irish & Luke Shumard
+ Licensed under the MIT license
+ Documentation: http://infinite-scroll.com/
*/

(function (window, $, undefined) {

$.infinitescroll = function infscr(options, callback, element) {

this.element = $(element);
this._create(options, callback);

};

$.infinitescroll.defaults = {
loading: {
finished: undefined,
finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
img: "http://www.infinite-scroll.com/loading.gif",
msg: null,
msgText: "<em>Loading the next set of posts...</em>",
selector: null,
speed: 'fast',
start: undefined
},
state: {
isDuringAjax: false,
isInvalidPage: false,
isDestroyed: false,
isDone: false, // For when it goes all the way through the archive.
isPaused: false,
currPage: 1
},
callback: undefined,
debug: false,
behavior: undefined,
binder: $(window), // used to cache the selector
nextSelector: "div.navigation a:first",
navSelector: "div.navigation",
contentSelector: null, // rename to pageFragment
extraScrollPx: 150,
itemSelector: "div.post",
animate: false,
pathParse: undefined,
dataType: 'html',
appendCallback: true,
bufferPx: 40,
errorCallback: function () { },
infid: 0, //Instance ID
pixelsFromNavToBottom: undefined,
path: undefined,
defaultSelector : 'list',
loadImg : undefined,
type : undefined,
genre : undefined,
sous_genre : undefined,
horaire : undefined,
tri : undefined,
selection : undefined,
jour : undefined,
timestamp : undefined
};


    $.infinitescroll.prototype = {

        /*
----------------------------
Private methods
----------------------------
*/

        // Bind or unbind from scroll
        _binding: function infscr_binding(binding) {

            var instance = this,
			opts = instance.options;
			
			opts.v = '2.0b2.111027';
			/** D :BETD **/
			if($('input#bSuite'+opts.state.currPage).val() == 'ko' || $('input#nbContentSuite1').val() < 16){
				$(opts.loadImg).find('#infscr-loading').hide();
				$(opts.loadImg).hide();
			}
			/** F :BETD **/
			
			            // if behavior is defined and this function is extended, call that instead of default
			if (!!opts.behavior && this['_binding_'+opts.behavior] !== undefined) {
			this['_binding_'+opts.behavior].call(this);
			return;
			}
			
			if (binding !== 'bind' && binding !== 'unbind') {
                this._debug('Binding value ' + binding + ' not valid')
                return false;
            }

            if (binding == 'unbind') {

                (this.options.binder).unbind('smartscroll.infscr.' + instance.options.infid);

            } else {

                (this.options.binder)[binding]('smartscroll.infscr.' + instance.options.infid, function () {
                    instance.scroll();
                });

            };

            this._debug('Binding', binding);

        },

		// Fundamental aspects of the plugin are initialized
		_create: function infscr_create(options, callback) {

            // If selectors from options aren't valid, return false
            if (!this._validate(options)) { return false; }
            // Define options and shorthand
            var opts = this.options = $.extend(true, {}, $.infinitescroll.defaults, options),
			// get the relative URL - everything past the domain name.
			relurl = /(.*?\/\/).*?(\/.*)/,
			path = $(opts.nextSelector).attr('href');
			
			/** D : BETD **/
			if($('input#nbContentSuite1').val() == 16){
				$(opts.loadImg).find('#infscr-loading').show();
				$(opts.loadImg).show();
			}
			/** F : BETD **/
			
			if(opts.defaultSelector && opts.defaultSelector !=''){
				path = path+'&type='+opts.defaultSelector;
			}

			if(opts.genre && opts.genre !=''){
				path = path+'&genre='+opts.genre;
			}
			
			if(opts.sous_genre && opts.sous_genre !=''){
				path = path+'&sous_genre='+opts.sous_genre;
			}
			
			if(opts.horaire && opts.horaire !=''){
				path = path+'&horaire='+opts.horaire;
			}
			
			if(opts.tri && opts.tri !=''){
				path = path+'&tri='+opts.tri;
			}
			
			if(opts.selection && opts.selection !=''){
				path = path+'&selection='+opts.selection;
			}
			
			if(opts.timestamp && opts.timestamp !=''){
				path = path+'&timestamp='+opts.timestamp;
			}
			
			
			if(opts.jour && opts.jour !=''){
				path = path+'&nbjour='+opts.jour;
			}
			
            // contentSelector is 'page fragment' option for .load() / .ajax() calls
            opts.contentSelector = opts.contentSelector || this.element;

            // loading.selector - if we want to place the load message in a specific selector, defaulted to the contentSelector
            opts.loading.selector = opts.loading.selector || opts.contentSelector;

            // if there's not path, return
            if (!path) { this._debug('Navigation selector not found'); return; }

            // Set the path to be a relative URL from root.
            opts.path = this._determinepath(path);

            // Define loading.msg
            opts.loading.msg = $('<div id="infscr-loading" style="text-align:center;margin-bottom: 7px;"><img alt="Loading..." src="' + opts.loading.img + '" width="30px" style="text-align: center; margin-top: 10px;"/><div style="margin-top: 7px;padding-bottom:10px">' + opts.loading.msgText + '</div></div>');

            // Preload loading.img
            (new Image()).src = opts.loading.img;

            // distance from nav links to bottom
            // computed as: height of the document + top offset of container - top offset of nav link
            opts.pixelsFromNavToBottom = 220;

			// determine loading.start actions
            opts.loading.start = opts.loading.start || function() {

				
				$('#infscr-loading').fadeIn(opts.loading.speed, function () {//return false;
				beginAjax(opts);
				});
			};

			// determine loading.finished actions
			opts.loading.finished = opts.loading.finished || function() {
			opts.loading.msg.fadeOut('normal');
			};

            // callback loading
            opts.callback = function(instance,data) {
				if (!!opts.behavior && instance['_callback_'+opts.behavior] !== undefined) {
					instance['_callback_'+opts.behavior].call($(opts.contentSelector)[0], data);
				}
				if (callback) {
					callback.call($(opts.contentSelector)[0], data, opts);
				}
			};

            this._setup();

        },

        // Console log wrapper
        _debug: function infscr_debug() {

			if (this.options && this.options.debug) {
	                return window.console && console.log.call(console, arguments);
	            }
	
	        },
	
	        // find the number to increment in the path.
	        _determinepath: function infscr_determinepath(path) {

            var opts = this.options;

			// if behavior is defined and this function is extended, call that instead of default
			if (!!opts.behavior && this['_determinepath_'+opts.behavior] !== undefined) {
				this['_determinepath_'+opts.behavior].call(this,path);
				return;
			}

            if (!!opts.pathParse) {

                this._debug('pathParse manual');
                return opts.pathParse();

            } else if (path.match(/^(.*?)\b2\b(.*?$)/)) {
                path = path.match(/^(.*?)\b2\b(.*?$)/).slice(1);

                // if there is any 2 in the url at all.
            } else if (path.match(/^(.*?)2(.*?$)/)) {

                // page= is used in django:
                // http://www.infinite-scroll.com/changelog/comment-page-1/#comment-127
                if (path.match(/^(.*?page=)2(\/.*|$)/)) {
                    path = path.match(/^(.*?page=)2(\/.*|$)/).slice(1);
                    return path;
                }

                path = path.match(/^(.*?)2(.*?$)/).slice(1);

            } else {

                // page= is used in drupal too but second page is page=1 not page=2:
                // thx Jerod Fritz, vladikoff
                if (path.match(/^(.*?page=)1(\/.*|$)/)) {
                    path = path.match(/^(.*?page=)1(\/.*|$)/).slice(1);
                    return path;
                } else {
                    this._debug('Sorry, we couldn\'t parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com.');
                    // Get rid of isInvalidPage to allow permalink to state
                    opts.state.isInvalidPage = true; //prevent it from running on this page.
                }
            }
            this._debug('determinePath', path);
            return path;

        },

        // Custom error
        _error: function infscr_error(xhr) {

            var opts = this.options;

			// if behavior is defined and this function is extended, call that instead of default
			if (!!opts.behavior && this['_error_'+opts.behavior] !== undefined) {
				this['_error_'+opts.behavior].call(this,xhr);
				return;
			}

            if (xhr !== 'destroy' && xhr !== 'end') {
                xhr = 'unknown';
            }

            if (xhr == 'destroy') {
			    $.removeData(this.element[0]);
			}
            
            this._debug('Error', xhr);

            if (xhr == 'end') {
                this._showdonemsg();
            }

            opts.state.isDone = true;
            opts.state.currPage = 1; // if you need to go back to this instance
            opts.state.isPaused = false;
            this._binding('unbind');

        },

        // Load Callback
        _loadcallback: function infscr_loadcallback(box, data) {

            var opts = this.options,
			callback = this.options.callback, // GLOBAL OBJECT FOR CALLBACK
			result = (opts.state.isDone) ? 'done' : (!opts.appendCallback) ? 'no-append' : 'append',
			frag;
			
			// if behavior is defined and this function is extended, call that instead of default
			if (!!opts.behavior && this['_loadcallback_'+opts.behavior] !== undefined) {
				this['_loadcallback_'+opts.behavior].call(this,box,data);
				return;
			}

            switch (result) {

                case 'done':

                    this._showdonemsg();
                    return false;

                    break;

                case 'no-append':

                    if (opts.dataType == 'html') {
                        data = '<div>' + data + '</div>';
                        data = $(data).find(opts.itemSelector);
                    };

                    break;

                case 'append':
					/** D :BETD **/
					if($('input#nbContentSuite1').val() < 16 || ($('input#nbContentSuite'+(opts.state.currPage-1)).val() < 16 && opts.type != "grid")){
						$(opts.loadImg).find('#infscr-loading').hide();
						$(opts.loadImg).hide();
					}else{
						$(opts.loadImg).find('#infscr-loading').show();
						$(opts.loadImg).show();
					}
					/** F :BETD **/
					
                    var children = box.children();

                    // if it didn't return anything
                    if (children.length == 0) {
                        return this._error('end');
                    }


                    // use a documentFragment because it works when content is going into a table or UL
                    frag = document.createDocumentFragment();
                    while (box[0].firstChild) {
                        frag.appendChild(box[0].firstChild);
                    }

                    this._debug('contentSelector', $(opts.contentSelector)[0])
                    $(opts.contentSelector)[0].appendChild(frag);
                    // previously, we would pass in the new DOM element as context for the callback
                    // however we're now using a documentfragment, which doesnt havent parents or children,
                    // so the context is the contentContainer guy, and we pass in an array
                    // of the elements collected as the first argument.

                    data = children.get();

					$('.program-content #image .now').hide();
					$('.program-content #image').hover(function(){
						$(this).find('.now').slideDown('fast');
					}, function(){
						$(this).find('.now').slideUp('fast');
					});
                    break;

            }

            // loadingEnd function
			opts.loading.finished.call($(opts.contentSelector)[0],opts)
            

            // smooth scroll to ease in the new content
            if (opts.animate) {
                var scrollTo = $(window).scrollTop() + $('#infscr-loading').height() + opts.extraScrollPx + 'px';
                $('html,body').animate({ scrollTop: scrollTo }, 800, function () { opts.state.isDuringAjax = false; });
            }

            if (!opts.animate) opts.state.isDuringAjax = false; // once the call is done, we can allow it again.

            callback(this,data);

        },

        _nearbottom: function infscr_nearbottom() {

            var opts = this.options,
			pixelsFromWindowBottomToBottom = 0 + $(document).height() - (opts.binder.scrollTop()) - $(window).height();
			/** D :BETD **/
			if($('input#bSuite'+opts.state.currPage).val() == 'ko'){
				$(opts.loadImg).find('#infscr-loading').hide();
				$(opts.loadImg).hide();
			}
			/** F :BETD **/
			// if behavior is defined and this function is extended, call that instead of default
			if (!!opts.behavior && this['_nearbottom_'+opts.behavior] !== undefined) {
				this['_nearbottom_'+opts.behavior].call(this);
				return;
			}
			
			this._debug('math:', pixelsFromWindowBottomToBottom, opts.pixelsFromNavToBottom);

            // if distance remaining in the scroll (including buffer) is less than the orignal nav to bottom....
            return (pixelsFromWindowBottomToBottom - opts.bufferPx < 220);

        },

		// Pause / temporarily disable plugin from firing
        _pausing: function infscr_pausing(pause) {

            var opts = this.options;

            // if behavior is defined and this function is extended, call that instead of default
			if (!!opts.behavior && this['_pausing_'+opts.behavior] !== undefined) {
				this['_pausing_'+opts.behavior].call(this,pause);
				return;
			}
			
			// If pause is not 'pause' or 'resume', toggle it's value
            if (pause !== 'pause' && pause !== 'resume' && pause !== null) {
                this._debug('Invalid argument. Toggling pause value instead');
            };

            pause = (pause && (pause == 'pause' || pause == 'resume')) ? pause : 'toggle';

            switch (pause) {
                case 'pause':
                    opts.state.isPaused = true;
                    break;

                case 'resume':
                    opts.state.isPaused = false;
                    break;

                case 'toggle':
                    opts.state.isPaused = !opts.state.isPaused;
                    break;
            }

            this._debug('Paused', opts.state.isPaused);
            return false;

        },

		// Behavior is determined
		// If the behavior option is undefined, it will set to default and bind to scroll
		_setup: function infscr_setup() {
		
			var opts = this.options;
			
			// if behavior is defined and this function is extended, call that instead of default
			if (!!opts.behavior && this['_setup_'+opts.behavior] !== undefined) {
			this['_setup_'+opts.behavior].call(this);
			return;
			}
			
			this._binding('bind');
			
			return false;
		
		},

        // Show done message
        _showdonemsg: function infscr_showdonemsg() {

            var opts = this.options;

			// if behavior is defined and this function is extended, call that instead of default
			if (!!opts.behavior && this['_showdonemsg_'+opts.behavior] !== undefined) {
				this['_showdonemsg_'+opts.behavior].call(this);
				return;
			}
			
			      $(opts.loadImg)
			.find('#infscr-loading')
			.hide();
			$(opts.loadImg).find('#infscr-loading-fin div:first').html(opts.loading.finishedMsg);
			$('#infscr-loading-fin').show().animate({ opacity: 1 }, 2000, function () {
				$(this).fadeOut('normal');
			});

            // user provided callback when done
            opts.errorCallback.call($(opts.contentSelector)[0],'done');

        },

		// grab each selector option and see if any fail
        _validate: function infscr_validate(opts) {

            for (var key in opts) {
                if (key.indexOf && key.indexOf('Selector') > -1 && $(opts[key]).length === 0) {
                    this._debug('Your ' + key + ' found no elements.');
                    return false;
                }
                return true;
            }

        },

        /*
		----------------------------
		Public methods
		----------------------------
		*/
		
		// Bind to scroll
		bind: function infscr_bind() {
			this._binding('bind');
		},
		
	        // Destroy current instance of plugin
	        destroy: function infscr_destroy() {
	
	            this.options.state.isDestroyed = true;
	            return this._error('destroy');
	
	        },
		
		// Set pause value to false
		pause: function infscr_pause() {
			this._pausing('pause');
		},
		
		// Set pause value to false
		resume: function infscr_resume() {
			this._pausing('resume');
		},

        // Retrieve next set of content items
        retrieve: function infscr_retrieve(pageNum) {

            var instance = this,
			opts = instance.options,
			path = opts.path,
			box, frag, desturl, method, condition,
			pageNum = pageNum || null,
			getPage = (!!pageNum) ? pageNum : opts.state.currPage;
			beginAjax = function infscr_ajax(opts) {
			
				// increment the URL bit. e.g. /page/3/
				opts.state.currPage++;
				
				instance._debug('heading into ajax', path);
				
				// if we're dealing with a table we can't use DIVs
				box = $(opts.contentSelector).is('table') ? $('<tbody/>') : $('<div/>');
				
				desturl = path.join(opts.state.currPage);
				
				method = (opts.dataType == 'html' || opts.dataType == 'json') ? opts.dataType : 'html+callback';
				if (opts.appendCallback && opts.dataType == 'html') method += '+callback'
				
				switch (method) {
				
					case 'html+callback':
					
					instance._debug('Using HTML via .load() method');
					box.load(desturl + ' ' + opts.itemSelector, null, function infscr_ajax_callback(responseText) {
						instance._loadcallback(box, responseText);
					});
					
					break;
					
					case 'html':
					case 'json':
					
					instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
					$.ajax({
						// params
						url: desturl,
						dataType: opts.dataType,
						complete: function infscr_ajax_callback(jqXHR, textStatus) {
							condition = (typeof (jqXHR.isResolved) !== 'undefined') ? (jqXHR.isResolved()) : (textStatus === "success" || textStatus === "notmodified");
							(condition) ? instance._loadcallback(box, jqXHR.responseText) : instance._error('end');
						}
					});
					
					break;
				}
			};

			// if behavior is defined and this function is extended, call that instead of default
			if (!!opts.behavior && this['retrieve_'+opts.behavior] !== undefined) {
				this['retrieve_'+opts.behavior].call(this,pageNum);
				return;
			}
			
			            
			// for manual triggers, if destroyed, get out of here
			if (opts.state.isDestroyed) {
			                this._debug('Instance is destroyed');
			                return false;
			            };
			
			            // we dont want to fire the ajax multiple times
			            opts.state.isDuringAjax = true;
			
			            opts.loading.start.call($(opts.contentSelector)[0],opts);
			
			        },
			
			        // Check to see next page is needed
			        scroll: function infscr_scroll() {
			
			            var opts = this.options,
						state = opts.state;
						
			            // if behavior is defined and this function is extended, call that instead of default
						if (!!opts.behavior && this['scroll_'+opts.behavior] !== undefined ) {
							this['scroll_'+opts.behavior].call(this);
							return;
						}

						if (state.isDuringAjax || state.isInvalidPage || state.isDone || state.isDestroyed || state.isPaused) return;
						
						            if (!this._nearbottom()) return;
									/** D :BETD **/
									if($('input#bSuite'+opts.state.currPage).val() == 'ok'){
										this.retrieve();
									}
									/** F :BETD **/

       				 },

					// Toggle pause value
					toggle: function infscr_toggle() {
						this._pausing();
					},
					
					// Unbind from scroll
					unbind: function infscr_unbind() {
						this._binding('unbind');
					},
					
					// update options
					update: function infscr_options(key) {
						if ($.isPlainObject(key)) {
							this.options = $.extend(true,this.options,key);
						}
					}

    }


    /*
----------------------------
Infinite Scroll function
----------------------------
Borrowed logic from the following...
jQuery UI
- https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js
jCarousel
- https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarousel.js
Masonry
- https://github.com/desandro/masonry/blob/master/jquery.masonry.js
*/

    $.fn.infinitescroll = function infscr_init(options, callback) {


        var thisCall = typeof options;

        switch (thisCall) {

            // method
            case 'string':

                var args = Array.prototype.slice.call(arguments, 1);

                this.each(function () {

                    var instance = $.data(this, 'infinitescroll');

                    if (!instance) {
                        // not setup yet
                        // return $.error('Method ' + options + ' cannot be called until Infinite Scroll is setup');
						return false;
                    }
                    if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
                        // return $.error('No such method ' + options + ' for Infinite Scroll');
						return false;
                    }

                    // no errors!
                    instance[options].apply(instance, args);

                });

                break;

            // creation
            case 'object':

                this.each(function () {

                    var instance = $.data(this, 'infinitescroll');

                    if (instance) {

                        // update options of current instance
                        instance.update(options);

                    } else {

                        // initialize new instance
                        $.data(this, 'infinitescroll', new $.infinitescroll(options, callback, this));

                    }

                });

                break;

        }

        return this;

    };



    /*
* smartscroll: debounced scroll event for jQuery *
* https://github.com/lukeshumard/smartscroll
* Based on smartresize by @louis_remi: https://github.com/lrbabe/jquery.smartresize.js *
* Copyright 2011 Louis-Remi & Luke Shumard * Licensed under the MIT license. *
*/

    var event = $.event,
	scrollTimeout;

    event.special.smartscroll = {
        setup: function () {
            $(this).bind("scroll", event.special.smartscroll.handler);
        },
        teardown: function () {
            $(this).unbind("scroll", event.special.smartscroll.handler);
        },
        handler: function (event, execAsap) {
            // Save the context
            var context = this,
			args = arguments;

            // set correct event type
            event.type = "smartscroll";

            if (scrollTimeout) { clearTimeout(scrollTimeout); }
            scrollTimeout = setTimeout(function () {
                $.event.handle.apply(context, args);
            }, execAsap === "execAsap" ? 0 : 100);
        }
    };

    $.fn.smartscroll = function (fn) {
        return fn ? this.bind("smartscroll", fn) : this.trigger("smartscroll", ["execAsap"]);
    };


})(window, jQuery);/*!
 * The following copyright notice may not be removed under any circumstances.
 * 
 * Copyright:
 * URW Software, Copyright 1997 by URW
 */
Cufon.registerFont({"w":1509,"face":{"font-family":"Canal+ Demi italic","font-weight":700,"font-style":"italic","font-stretch":"normal","units-per-em":"2048","panose-1":"0 0 0 0 0 0 0 0 0 0","ascent":"1473","descent":"-575","x-height":"33","bbox":"-102 -2013 10201 530","underline-thickness":"268","underline-position":"-107","unicode-range":"U+0020-U+00FF"},"glyphs":{" ":{"w":575},"!":{"d":"156,-151v0,-96,82,-180,182,-180v96,0,180,84,180,180v0,99,-84,182,-182,182v-97,0,-180,-84,-180,-182xm193,-477r0,-1059r287,0r0,1059r-287,0","w":672},"\"":{"d":"205,-1536r258,0r-25,621r-176,0xm631,-1536r258,0r-22,621r-179,0","w":889},"#":{"d":"1227,-1116r0,215r-237,0r-31,235r215,0r0,217r-242,0r-59,472r-215,-29r55,-443r-242,0r-61,472r-219,-29r55,-445r-217,0r0,-215r248,0r28,-235r-221,0r0,-215r248,0r55,-443r215,31r-51,412r244,0r55,-443r215,31r-53,412r215,0xm766,-901r-242,0r-28,235r244,0","w":1251},"$":{"d":"615,-248v133,7,236,-78,237,-206v0,-47,-15,-85,-46,-115v-88,-87,-352,-158,-449,-240v-88,-74,-137,-170,-137,-298v0,-140,54,-254,161,-341v31,-25,83,-53,154,-82r0,-94r276,0r0,96v144,37,183,74,289,170r-150,193v-77,-78,-135,-120,-246,-125v-102,-5,-201,68,-195,165v8,126,123,144,230,193v117,54,204,96,255,135v101,77,157,159,157,317v0,155,-58,280,-173,373v-33,27,-88,55,-167,86r0,111r-276,0r0,-90v-226,-47,-288,-106,-426,-273r170,-178v103,127,169,194,336,203","w":1307},"%":{"d":"70,-1193v0,-243,178,-423,426,-423v244,0,418,181,418,424v0,242,-177,420,-421,420v-245,0,-423,-176,-423,-421xm1276,-1604r211,117r-897,1557r-215,-119xm938,-340v0,-242,178,-416,428,-416v242,0,420,173,420,416v0,243,-180,417,-424,417v-245,0,-424,-173,-424,-417xm703,-1188v0,-123,-83,-230,-208,-230v-121,0,-206,105,-206,229v0,125,84,230,207,230v122,0,207,-106,207,-229xm1567,-340v0,-123,-81,-230,-206,-230v-120,0,-204,107,-204,230v0,125,83,229,205,229v122,0,205,-104,205,-229","w":1855},"&":{"d":"750,-1571v226,0,420,150,420,368v0,91,-34,172,-101,244v-34,37,-94,81,-180,134r252,290r203,-196r176,176r-80,80r-64,57r-67,66r309,352r-371,0r-151,-174v-172,133,-266,200,-493,209v-263,10,-480,-182,-480,-442v0,-161,98,-312,240,-386r127,-75v-100,-114,-153,-168,-158,-320v-8,-227,187,-383,418,-383xm475,-564v-129,136,12,345,180,335v112,-8,183,-57,277,-131r-291,-334v-82,55,-136,99,-166,130xm765,-1356v-127,0,-192,143,-120,246v15,23,48,65,101,127v63,-43,103,-79,127,-103v98,-101,37,-270,-108,-270","w":1634},"'":{"d":"414,-915r-168,0r20,-621r246,0","w":512},"(":{"d":"544,-1710v-252,541,-251,1375,0,1909r-215,123v-243,-454,-298,-1243,-128,-1831v23,-84,66,-191,128,-322","w":668},")":{"d":"123,199v254,-543,248,-1367,0,-1909r217,-121v151,261,229,687,229,1091v0,401,-68,744,-229,1062","w":672},"*":{"d":"587,-1180r177,283r-175,94r-145,-295r-213,252r-145,-135r235,-229r-305,-127r84,-181r295,156r20,-332r199,25r-55,326r319,-80r39,196","w":934},"+":{"d":"379,-964v1,-28,3,-29,31,-29r569,0v23,0,35,-10,35,-31r0,-518v0,-18,10,-27,29,-27r241,0v19,0,29,10,29,31r0,520v0,17,8,25,23,25r572,0v18,0,27,8,27,23r0,255v0,21,-10,31,-31,31r-564,0v-24,1,-26,5,-27,31r0,616v0,25,-10,37,-31,37r-239,0v-19,0,-29,-9,-29,-27r0,-626v0,-21,-10,-31,-31,-31r-573,0v-21,0,-31,-9,-31,-27r0,-253","w":2314},",":{"d":"0,332r33,-633r291,0r-123,633r-201,0","w":385,"k":{"1":247}},"-":{"d":"0,-576r461,0r0,209r-461,0r0,-209","w":461,"k":{"\u00c1":-77,"\u00c6":-74,"\u00c5":-77,"\u00c4":-77,"Y":67,"W":-43,"V":3,"T":-16,"A":-77}},".":{"d":"111,-148v0,-98,83,-182,183,-182v94,0,178,85,178,180v0,96,-84,181,-180,181v-94,0,-181,-84,-181,-179","w":584,"k":{"1":53}},"\/":{"d":"924,-1776r282,0r-837,1999r-281,0","w":1227},"0":{"d":"387,-1420v189,-199,526,-206,726,-11v147,142,237,378,237,665v0,248,-60,448,-181,599v-109,137,-247,206,-414,206v-179,0,-323,-77,-434,-231v-107,-150,-161,-341,-161,-574v0,-282,78,-498,227,-654xm826,-1296v-172,-60,-280,96,-326,243v-94,298,-22,828,256,828v85,0,152,-49,207,-144v149,-260,112,-840,-137,-927","k":{"7":103,"4":74,"1":96}},"1":{"d":"662,-1276r-221,0r0,-260r520,0r0,1536r-299,0r0,-1276","k":{"9":80,"8":49,"7":88,"6":78,"5":88,"4":78,"3":64,"2":82,"1":77,"0":44,".":1,",":-47}},"2":{"d":"743,-1575v295,0,543,204,541,494v0,85,-22,170,-65,253v-94,182,-331,402,-480,568r557,0r0,260r-1116,0r452,-514v125,-142,212,-247,259,-316v63,-92,94,-174,94,-245v0,-133,-106,-238,-238,-234v-152,4,-206,93,-223,252r-320,0v24,-226,90,-332,225,-429v86,-62,193,-89,314,-89","k":{"7":64,"4":46,"1":72}},"3":{"d":"988,-466v0,-127,-101,-244,-228,-241r-65,0r0,-215r61,0v114,1,191,-86,191,-203v0,-124,-86,-211,-209,-209v-129,2,-185,72,-201,199r-285,0v35,-198,92,-284,218,-367v78,-51,173,-73,280,-73v275,0,485,162,482,432v-2,165,-61,245,-179,321v152,68,232,173,234,370v3,301,-235,491,-542,491v-251,0,-462,-143,-530,-341v-12,-33,-21,-80,-26,-140r299,0v17,100,37,135,106,179v41,26,90,38,144,38v141,0,250,-101,250,-241","k":{"7":88,"4":48,"1":83}},"4":{"d":"1179,-512r180,0r0,242r-180,0r0,270r-281,0r0,-270r-749,0r0,-135r759,-1158r271,0r0,1051xm898,-512r0,-608r-395,608r395,0","k":{"7":82,"4":21,"1":92}},"5":{"d":"651,-829v-122,3,-199,34,-296,100r-16,0r182,-807r711,0r0,260r-508,0r-59,240v364,-62,635,194,635,527v0,333,-265,548,-606,548v-109,0,-210,-22,-304,-65v-48,-23,-109,-68,-182,-136r100,-260v109,122,203,189,375,197v171,8,318,-127,318,-293v0,-175,-166,-316,-350,-311","k":{"7":89,"4":50,"1":84}},"6":{"d":"752,39v-321,0,-582,-210,-581,-522v0,-153,65,-317,195,-490r467,-624r233,131r-348,450v293,10,400,55,528,226v63,84,90,186,90,297v2,318,-260,532,-584,532xm1037,-485v0,-154,-126,-287,-283,-287v-153,0,-282,134,-282,289v0,156,127,286,282,286v156,0,283,-132,283,-288","k":{"7":134,"4":50,"1":138}},"7":{"d":"901,-1276r-713,0r0,-260r1184,0r-930,1579r-244,-143","k":{":":182,"8":82,"7":-24,"6":221,"5":139,"4":248,"3":82,"2":78,"1":-29,".":274,",":225}},"8":{"d":"221,-427v4,-193,106,-309,276,-376v-139,-69,-220,-177,-223,-335v-5,-261,219,-437,486,-437v268,0,485,176,481,437v-3,170,-86,263,-229,335v176,69,271,183,274,379v4,281,-236,463,-525,463v-293,0,-545,-188,-540,-466xm969,-1139v0,-114,-95,-217,-212,-217v-114,0,-215,102,-215,217v0,114,103,213,216,213v116,0,211,-97,211,-213xm989,-440v0,-127,-106,-238,-236,-238v-127,0,-231,110,-231,239v0,129,107,242,233,242v128,0,234,-114,234,-243","k":{"7":82,"4":44,"1":77}},"9":{"d":"756,-1575v320,0,581,211,580,522v0,158,-64,322,-192,492r-469,622r-234,-131r351,-450v-292,-10,-404,-55,-530,-226v-63,-86,-91,-187,-91,-298v-2,-317,260,-531,585,-531xm1037,-1052v0,-155,-126,-285,-285,-285v-156,0,-280,130,-280,287v0,153,125,286,278,286v157,0,287,-133,287,-288","k":{"7":75,"4":183,"1":70}},":":{"d":"184,-148v0,-98,82,-181,181,-181v96,0,179,83,179,180v0,96,-83,180,-180,180v-94,0,-180,-83,-180,-179xm184,-850v0,-99,81,-182,181,-182v96,0,179,83,179,180v0,97,-82,180,-180,180v-95,0,-180,-82,-180,-178","w":729},";":{"d":"180,332r35,-633r291,0r-123,633r-203,0xm225,-850v0,-99,81,-182,181,-182v96,0,179,83,179,180v0,98,-82,180,-180,180v-95,0,-180,-81,-180,-178","w":731},"<":{"d":"1075,-1405r0,297r-682,340r681,338r0,295r-996,-508r0,-252","w":1153},"=":{"d":"1706,-743r0,305r-1210,0r0,-305r1210,0xm1706,-1227r0,309r-1210,0r0,-309r1210,0","w":2202},">":{"d":"78,-135r0,-297r682,-338r-682,-340r0,-295r997,510r0,252","w":1153,"k":{"\u00c1":40,"\u00c6":43,"\u00c5":40,"\u00c4":40,"Y":170,"W":67,"V":112,"T":98,"A":40}},"?":{"d":"568,-1567v249,-8,466,189,466,434v0,176,-106,307,-235,372v-33,17,-81,34,-146,53r0,231r-285,0r0,-440v193,38,366,-54,371,-223v2,-99,-79,-179,-178,-179v-97,0,-177,82,-162,193r-299,0v-5,-274,200,-432,468,-441xm333,-148v0,-100,82,-182,182,-182v95,0,179,85,179,181v0,96,-84,180,-180,180v-95,0,-181,-83,-181,-179","w":1126},"@":{"d":"449,-737v0,-247,177,-452,419,-452v111,0,194,32,251,96r10,-78r192,0r-61,524v-5,45,-8,79,-8,103v0,73,49,73,92,47v96,-57,162,-217,162,-371v0,-316,-266,-537,-586,-537v-352,0,-637,284,-637,635v0,284,186,523,413,595v150,48,424,43,556,-13r170,-74r22,-13r66,169v-10,5,-20,9,-31,14v-107,45,-169,73,-188,78v-267,80,-599,60,-810,-60v-219,-125,-392,-376,-397,-696v-6,-346,231,-640,515,-744v242,-89,528,-70,734,50v193,112,345,311,345,591v0,163,-46,302,-137,417v-78,98,-169,147,-272,147v-81,0,-140,-39,-177,-117v-71,73,-138,120,-261,121v-228,2,-382,-199,-382,-432xm839,-504v137,3,262,-142,253,-299v-6,-99,-99,-186,-207,-186v-132,0,-219,119,-219,259v0,119,63,224,173,226","w":1761},"A":{"d":"1042,0r-51,-254r-573,0r-125,254r-326,0r770,-1536r289,0r323,1536r-307,0xm821,-1126r-283,598r400,0","w":1413,"k":{"\u00d9":39,"\u00db":39,"\u00da":39,"<":18,"\u00ab":22,"\u00e7":-3,"\u00dc":39,"\u00d6":40,"\u00c7":40,"y":14,"v":8,"u":1,"t":-22,"q":-11,"o":-2,"g":-8,"e":-5,"d":-12,"c":-2,"b":-19,"a":-9,"Y":126,"W":46,"V":81,"U":39,"T":74,"Q":40,"O":40,"G":41,"C":41,".":-54,"-":-95,",":-104}},"B":{"d":"883,-803v72,17,123,31,153,44v119,51,179,153,179,304v0,233,-144,398,-367,436v-175,30,-511,15,-735,19r186,-1536v210,3,496,-12,642,35v138,44,233,165,233,338v0,119,-39,214,-118,283v-29,26,-87,52,-173,77xm881,-1114v0,-139,-75,-167,-231,-170r-84,0r-47,393v77,1,204,-2,237,-17v82,-37,125,-103,125,-206xm896,-477v-6,-154,-98,-183,-291,-183r-115,0r-49,406v105,0,279,1,330,-24v68,-33,129,-107,125,-199","w":1307,"k":{"\u00d2":11,"\u00d4":11,"\u00d3":11,"\u00c1":20,"\u00c2":20,"\u00c3":20,"\u00d8":-6,"\u00c6":21,"\u00d6":11,"\u00c5":20,"\u00c4":20,"Y":90,"W":19,"V":52,"O":11,"A":20}},"C":{"d":"829,31v-413,0,-704,-333,-704,-754v0,-337,173,-603,399,-736v214,-126,523,-144,757,-40v61,27,89,42,85,74r-35,276v-6,41,-26,16,-39,4v-77,-71,-185,-111,-331,-111v-293,0,-517,248,-517,532v0,256,172,440,426,440v136,0,256,-49,347,-119v5,-9,27,-9,24,12r-37,299v-2,21,-30,43,-84,66v-91,38,-188,57,-291,57","w":1356,"k":{"\u00d3":16,"\u00c1":-11,"\u00c6":-11,"\u00d6":16,"\u00c5":-11,"\u00c4":-11,"O":16,"K":-3,"H":-3,"A":-11}},"D":{"d":"299,-1536v221,3,520,-13,691,24v290,63,438,315,438,669v0,354,-162,660,-415,771v-193,85,-594,70,-900,72xm1111,-867v-4,-314,-129,-397,-459,-401r-86,0r-123,1000v157,3,320,-11,402,-51v170,-83,270,-288,266,-548","w":1489,"k":{"\u00c1":65,"\u00c2":65,"\u00c3":65,"\u00c0":65,"\u00c5":65,"\u00c4":65,"Y":96,"X":52,"W":12,"V":45,"T":36,"J":11,"A":65}},"E":{"d":"1053,-1262r-489,0r-43,353r469,0r-33,274r-469,0r-45,361r487,0r-33,274r-784,0r186,-1536r785,0","w":1067},"F":{"d":"983,-1262r-419,0r-43,353r417,0r-30,274r-420,0r-78,635r-297,0r186,-1536r717,0","w":969,"k":{"\u00c1":78,"\u00c2":78,"\u00c3":78,"\u00c0":78,"\u00f8":20,"\u00e6":35,"\u00f6":-11,"\u00f3":-11,"\u00e9":-10,"\u00e5":-6,"\u00e4":-6,"\u00e1":-6,"\u00d6":-9,"\u00c5":78,"\u00c4":78,"u":16,"r":17,"o":-11,"j":-1,"i":1,"e":-11,"a":-6,"O":-9,"J":93,"A":78,".":107,"-":-64,",":55}},"G":{"d":"444,-722v0,267,164,464,425,458v192,-4,295,-74,337,-257r-391,0r35,-274r729,0v-13,351,-127,594,-358,727v-114,65,-241,99,-383,99v-421,0,-713,-323,-713,-750v0,-339,173,-613,403,-742v121,-68,252,-104,396,-104v201,0,364,65,488,196v34,35,74,90,120,163r-256,147v-37,-53,-64,-87,-79,-102v-73,-71,-163,-107,-272,-107v-283,-1,-481,256,-481,546","w":1649,"k":{"\u00c1":58,"\u00c2":58,"\u00c3":58,"\u00c0":58,"\u00c6":60,"\u00c5":58,"\u00c4":58,"Y":97,"W":27,"V":61,"T":37,"A":58}},"H":{"d":"1276,0r-297,0r80,-644r-571,0r-78,644r-297,0r186,-1536r297,0r-75,618r571,0r76,-618r297,0","w":1516},"I":{"d":"410,0r-297,0r186,-1536r297,0","w":647},"J":{"d":"904,-1536r-138,1137v-21,174,-72,293,-152,359v-58,47,-136,71,-237,71v-137,0,-240,-45,-308,-134v-25,-33,-53,-93,-83,-178r229,-118v21,67,61,140,133,133v107,-10,107,-74,123,-201r131,-1069r302,0","w":956,"k":{"\u00c6":55,"\u00c5":55,"\u00c4":55,"A":55}},"K":{"d":"815,-774r474,774r-371,0r-416,-760r-92,760r-297,0r186,-1536r297,0r-88,713r523,-713r342,0","w":1350,"k":{"\u00d3":82,"\u00e6":30,"\u00fc":75,"\u00f6":77,"\u00f3":77,"\u00e5":62,"\u00e4":62,"\u00d6":82,"y":96,"u":75,"o":77,"e":73,"a":62,"T":-35,"S":-19,"O":82,"G":83,"C":82,"-":-3}},"L":{"d":"873,0r-760,0r186,-1536r297,0r-153,1262r463,0","w":965,"k":{"\u00d2":61,"\u00d4":61,"\u00d3":61,"\u00c1":-63,"\u00d5":61,"\u00c6":-63,"\u00fc":8,"\u00dc":35,"\u00d6":61,"\u00c7":63,"\u00c5":-63,"\u00c4":-63,"y":53,"u":8,"Y":149,"W":84,"V":121,"U":35,"T":84,"S":-40,"O":61,"G":62,"C":63,"A":-63,"-":-72}},"M":{"d":"1452,0r0,-942r-448,942r-203,0r-172,-936r-289,936r-297,0r471,-1536r279,0r180,1010r495,-1010r285,0r0,1536r-301,0","w":1913},"N":{"d":"1475,0r-301,0r-637,-1047r-127,1047r-297,0r186,-1536r303,0r633,1057r129,-1057r297,0","w":1712,"k":{"\u00d3":5,"\u00c1":10,"\u00f8":21,"\u00e6":1,"\u00c6":10,"\u00fc":7,"\u00f6":4,"\u00f3":4,"\u00e9":2,"\u00d6":5,"\u00c7":6,"\u00c5":10,"\u00c4":10,"u":7,"o":4,"e":2,"O":5,"G":6,"C":6,"A":10,".":-3,",":-55}},"O":{"d":"861,31v-436,0,-747,-314,-736,-766v8,-334,176,-597,405,-725v125,-70,263,-107,416,-107v434,0,733,306,733,743v0,344,-177,620,-411,750v-123,68,-258,105,-407,105xm1360,-816v0,-260,-154,-454,-416,-454v-288,0,-500,252,-500,546v0,262,171,458,427,458v288,0,489,-256,489,-550","w":1741,"k":{"\u00c1":70,"\u00c6":72,"\u00c5":70,"\u00c4":70,"Y":102,"X":58,"W":17,"V":51,"T":50,"A":70}},"P":{"d":"1229,-1079v-3,344,-221,514,-610,497r-137,0r-72,582r-297,0r186,-1536v237,3,569,-14,716,53v135,61,216,211,214,404xm510,-838v102,1,246,-3,290,-32v61,-41,110,-117,110,-213v0,-91,-41,-157,-121,-172v-42,-8,-158,-7,-225,-7","w":1223,"k":{"\u00c1":116,"\u00f8":56,"\u00e6":29,"\u00c6":121,"\u00f6":27,"\u00f3":27,"\u00e9":24,"\u00e5":27,"\u00e4":27,"\u00e1":27,"\u00c5":116,"\u00c4":116,"o":25,"e":23,"a":26,"J":125,"A":116,".":194,"-":11,",":142}},"Q":{"d":"946,-1565v433,0,731,308,731,743v0,159,-33,301,-100,424v-29,53,-79,121,-152,205r125,162r-192,135r-121,-159v-125,63,-215,83,-368,86v-441,8,-744,-303,-744,-746v0,-342,171,-612,403,-742v126,-70,264,-108,418,-108xm444,-721v0,275,174,456,454,453v45,0,95,-10,149,-31r-142,-184r189,-144r139,183v80,-114,123,-225,127,-380v5,-253,-166,-444,-417,-444v-289,0,-499,253,-499,547","w":1739},"R":{"d":"873,0r-385,-652r-78,652r-297,0r186,-1536v240,4,582,-18,724,58v110,60,184,182,184,349v0,203,-102,377,-261,446v-20,9,-59,18,-114,29r387,654r-346,0xm888,-1080v0,-135,-58,-183,-212,-182r-112,0r-54,424r103,0v183,0,275,-81,275,-242","w":1309,"k":{"\u00d3":38,"\u00e6":36,"\u00fc":45,"\u00fa":45,"\u00f6":46,"\u00f3":46,"\u00e9":44,"\u00e5":39,"\u00e4":39,"\u00e1":39,"\u00dc":40,"\u00d6":38,"\u00c7":38,"y":-1,"u":45,"o":46,"e":43,"a":39,"Y":78,"W":34,"V":58,"U":40,"T":19,"O":38,"G":39,"C":39,"-":-3}},"S":{"d":"181,-1090v-7,-273,217,-483,492,-477v174,5,273,45,401,131r-136,267v-105,-67,-196,-101,-272,-101v-113,0,-202,102,-149,207v39,78,135,113,229,180v144,102,261,202,264,408v5,350,-357,596,-731,478v-47,-14,-131,-53,-252,-116r154,-252v116,66,218,99,305,99v146,0,259,-136,171,-258v-17,-39,-268,-212,-305,-245v-107,-97,-167,-154,-171,-321","w":1087,"k":{"\u00c1":16,"\u00c6":17,"\u00c5":16,"\u00c4":16,"t":-18,"Y":-9,"W":-13,"V":-10,"T":-20,"A":16}},"T":{"d":"1009,-1262r-293,0r-153,1262r-297,0r153,-1262r-315,0r33,-274r905,0","w":934,"k":{"\u00d2":11,"\u00d4":11,"\u00d3":11,"\u00c1":76,"\u00c2":76,"<":91,"\u00d5":11,"\u00c3":76,"\u00c0":76,"\u00ab":95,"\u00f8":88,"\u00e6":68,"\u00d8":9,"\u00c6":76,"\u00d6":11,"\u00c5":76,"\u00c4":76,"y":60,"w":59,"v":59,"u":74,"s":54,"r":59,"o":72,"j":-31,"i":-29,"g":66,"e":69,"c":73,"a":66,"Y":-88,"W":-81,"V":-81,"S":-28,"O":11,"J":69,"G":12,"C":11,"A":76,";":103,":":95,".":61,"-":-20,",":10}},"U":{"d":"479,-530v-14,171,87,264,257,264v110,0,189,-32,237,-96v43,-58,74,-169,94,-332r102,-842r297,0r-108,903v-36,284,-71,443,-249,565v-98,67,-229,99,-389,99v-337,0,-541,-139,-546,-459v0,-47,7,-126,20,-238r107,-870r297,0r-113,924v-3,28,-5,55,-6,82","w":1520,"k":{"\u00c1":71,"\u00c2":71,"\u00c3":71,"\u00c6":76,"\u00c5":71,"\u00c4":71,"r":11,"p":13,"n":11,"m":11,"A":71,".":35,",":-16}},"V":{"d":"707,0r-238,0r-344,-1536r303,0r229,1030r506,-1030r318,0","w":1356,"k":{"\u00d2":50,"\u00d4":50,"\u00d3":50,"\u00c1":127,"\u00c2":127,"<":133,"\u00d5":50,"\u00c3":127,"\u00c0":127,"\u00ab":136,"\u00f8":132,"\u00e6":106,"\u00d8":47,"\u00c6":132,"\u00d6":50,"\u00c5":127,"\u00c4":127,"y":18,"u":86,"r":87,"o":113,"i":-21,"g":109,"e":112,"a":109,"T":-86,"S":13,"O":50,"G":51,"C":50,"A":127,";":112,":":93,".":154,"-":28,",":102}},"W":{"d":"1475,0r-275,0r-143,-1038r-449,1038r-272,0r-211,-1536r297,0r139,1012r426,-1012r273,0r137,1010r428,-1010r307,0","w":2007,"k":{"\u00d2":36,"\u00d4":36,"\u00d3":36,"\u00c1":98,"\u00c2":98,"<":95,"\u00d5":36,"\u00c3":98,"\u00c0":98,"\u00ab":98,"\u00f8":94,"\u00e6":74,"\u00d8":19,"\u00c6":103,"\u00d6":36,"\u00c5":98,"\u00c4":98,"y":-1,"u":66,"r":65,"o":76,"i":-21,"g":71,"e":74,"a":71,"T":-85,"S":6,"O":36,"G":37,"C":36,"A":98,";":92,":":72,".":106,"-":-10,",":54}},"X":{"d":"873,-780r426,780r-340,0r-285,-506r-344,506r-338,0r532,-795r-401,-741r340,0r258,473r318,-473r339,0","w":1346,"k":{"\u00d6":63,"y":75,"u":61,"o":59,"e":56,"a":51,"Q":64,"O":64,"C":64,"-":-26}},"Y":{"d":"816,-676r-84,676r-297,0r82,-674r-408,-862r338,0r235,535r355,-535r360,0","w":1274,"k":{"\u00d2":80,"\u00d4":80,"\u00d3":80,"\u00c1":153,"\u00c2":153,"<":164,"\u00d5":80,"\u00c3":153,"\u00c0":153,"\u00ab":167,"\u00f8":160,"\u00e6":140,"\u00d8":76,"\u00c6":158,"\u00d6":80,"\u00c5":153,"\u00c4":153,"v":69,"u":135,"p":133,"o":144,"i":-15,"g":139,"e":142,"a":139,"T":-86,"S":28,"O":80,"G":81,"C":80,"A":153,";":162,":":144,".":147,"-":64,",":96}},"Z":{"d":"547,-274r626,0r-32,274r-1096,0r705,-1262r-586,0r33,-274r1058,0","w":1247,"k":{"y":51,"v":45}},"[":{"d":"60,287r0,-2091r448,0r0,238r-207,0r0,1615r207,0r0,238r-448,0","w":428},"\\":{"d":"1092,223r-834,-1999r272,0r830,1999r-268,0","w":1595},"]":{"d":"-48,287r0,-238r210,0r0,-1615r-211,0r0,-238r451,0r0,2091r-450,0","w":430},"^":{"d":"852,-770r-256,-551r-258,551r-299,0r365,-774r385,0r364,774r-301,0","w":1135},"_":{"d":"30,375r0,-268r1142,0r0,268r-1142,0","w":1143},"`":{"d":"649,-1174r-338,-311r195,-125r268,348","w":1122},"a":{"d":"538,-998v158,5,221,57,314,183r17,-150r270,0r-113,965r-278,0r28,-152v-96,117,-173,180,-331,185v-232,7,-371,-204,-371,-457v0,-298,186,-583,464,-574xm819,-530v0,-137,-65,-239,-197,-241v-145,-3,-251,152,-251,312v0,135,70,237,198,240v149,3,250,-149,250,-311","w":1223,"k":{"y":-14,"w":-15,"v":-15,"j":-8}},"b":{"d":"1125,-530v0,298,-179,565,-459,563v-73,0,-141,-22,-205,-66v-25,-17,-59,-55,-102,-114r-17,147r-272,0r182,-1536r273,0r-88,737v87,-113,165,-193,325,-195v231,-2,363,212,363,464xm830,-512v0,-134,-68,-234,-199,-236v-144,-2,-248,149,-248,307v0,133,72,240,196,240v145,0,251,-153,251,-311","w":1204,"k":{"y":15,"v":9}},"c":{"d":"70,-450v0,-337,310,-625,681,-531v31,8,73,23,126,45r-47,258v-74,-33,-138,-50,-192,-50v-156,-3,-265,119,-265,275v0,135,96,222,231,220v49,0,115,-19,199,-56r-53,285v-85,25,-154,37,-207,37v-268,0,-473,-215,-473,-483","w":895,"k":{"k":-12,"h":-12}},"d":{"d":"527,-994v159,4,233,58,319,185r86,-727r273,0r-183,1536r-272,0r20,-160r-71,86v-71,71,-157,107,-258,107v-243,0,-373,-199,-373,-455v0,-296,183,-579,459,-572xm811,-526v0,-134,-70,-237,-201,-239v-142,-2,-247,150,-247,307v0,134,73,243,197,243v144,0,251,-155,251,-311","w":1196},"e":{"d":"72,-452v0,-307,212,-546,515,-546v190,0,352,122,406,271v27,74,33,192,31,305r-684,0v-11,130,87,209,216,209v78,0,115,-27,169,-68r236,99v-84,145,-218,212,-411,215v-289,5,-478,-196,-478,-485xm782,-610v-10,-120,-59,-177,-177,-177v-120,0,-201,59,-242,177r419,0","w":1102,"k":{"y":25,"x":25,"w":15,"v":22,"t":3}},"f":{"d":"709,-1274v-54,-7,-128,-11,-157,19v-44,46,-31,64,-54,183r-16,111r196,0r-24,217r-197,0r-88,744r-272,0r88,-744r-115,0r25,-217r114,0v17,-164,51,-387,107,-466v77,-108,245,-130,422,-89","w":625,"k":{"\u00e6":2,"\u00f6":-30,"\u00f3":-30,"\u00e9":-32,"\u00e5":-27,"\u00e4":-27,"\u00e1":-27,"t":-67,"s":-45,"o":-31,"l":-14,"j":-27,"i":-25,"f":-57,"e":-32,"a":-28}},"g":{"d":"65,-419v0,-292,191,-579,463,-577v87,0,161,31,223,93v18,18,46,61,84,129r21,-191r272,0r-108,930v-29,252,-72,355,-232,458v-88,57,-196,81,-319,81v-250,0,-381,-102,-414,-334r274,0v24,87,67,120,172,123v134,3,210,-90,230,-232r26,-182v-66,65,-149,127,-290,127v-258,0,-402,-161,-402,-425xm807,-503v0,-134,-68,-237,-200,-239v-143,-2,-247,149,-247,307v0,135,71,244,197,244v146,0,250,-154,250,-312","w":1212,"k":{"\u00e6":-1,"\u00f6":1,"\u00f3":1,"\u00e5":-2,"\u00e4":-2,"r":-7,"l":-7,"e":-1,"a":-3}},"h":{"d":"738,-618v0,-76,-53,-120,-133,-120v-77,0,-132,37,-168,109v-16,33,-31,100,-43,203r-52,426r-272,0r182,-1536r273,0r-84,710v93,-96,171,-165,319,-168v156,-4,264,92,264,247r-8,114r-76,633r-272,0","w":1139,"k":{"y":18}},"i":{"d":"203,-1375v0,-89,77,-169,168,-169v89,0,168,79,168,167v0,90,-78,169,-167,169v-91,0,-169,-76,-169,-167xm342,0r-272,0r113,-961r272,0","w":545,"k":{"j":-8,"T":-23}},"j":{"d":"202,-1375v0,-89,77,-169,168,-169v88,0,168,80,168,168v0,89,-78,168,-167,168v-91,0,-169,-76,-169,-167xm288,444r-272,0r166,-1407r272,0","w":545},"k":{"d":"676,-500r320,500r-328,0r-266,-510r-60,510r-272,0r182,-1536r273,0r-117,973r313,-398r328,0","w":1047,"k":{"\u00e6":26,"\u00fc":12,"\u00f6":35,"\u00f3":35,"\u00e9":31,"\u00e5":28,"\u00e4":28,"\u00e1":28,"u":12,"s":-16,"o":33,"g":28,"e":31,"a":27,".":5,"-":1,",":-48}},"l":{"d":"342,0r-272,0r182,-1536r273,0","w":516,"k":{"y":-28,"v":-29}},"m":{"d":"761,-998v134,5,203,52,251,170v85,-102,162,-167,319,-170v175,-2,295,94,296,264v1,0,-4,72,-9,115r-73,619r-273,0r62,-541v29,-110,-15,-206,-127,-201v-147,7,-189,110,-209,271r-58,471r-272,0r70,-620v0,-74,-57,-122,-134,-122v-90,0,-162,60,-181,140v-40,168,-54,414,-81,602r-272,0r113,-965r272,0r-20,158v75,-102,178,-196,326,-191","w":1743,"k":{"y":20,"w":5,"v":14,"p":1}},"n":{"d":"736,-574v19,-99,-28,-173,-125,-168v-152,8,-188,91,-209,265r-58,477r-274,0r113,-965r272,0r-20,158v93,-114,168,-191,315,-191v155,0,283,83,274,246v-14,255,-57,504,-82,752r-272,0","w":1139,"k":{"y":17,"w":2,"v":11,"T":78}},"o":{"d":"72,-456v0,-301,228,-542,533,-542v279,0,487,216,487,498v0,293,-226,533,-519,533v-287,0,-501,-203,-501,-489xm797,-503v0,-134,-72,-242,-203,-243v-136,-1,-227,134,-227,282v0,135,73,245,200,245v139,0,230,-135,230,-284","w":1176,"k":{"y":25,"x":20,"w":9,"v":19,"t":-2,"T":85}},"p":{"d":"678,29v-164,-3,-221,-72,-316,-183r-74,654r-272,0r170,-1465r272,0r-20,158v114,-122,161,-184,330,-191v237,-9,374,203,374,456v0,298,-185,577,-464,571xm845,-515v0,-133,-68,-241,-198,-243v-143,-3,-248,156,-248,313v0,135,69,235,197,238v145,3,249,-151,249,-308","w":1225,"k":{"y":17,"t":-10}},"q":{"d":"532,-998v160,3,239,59,316,183r17,-150r272,0r-172,1465r-272,0r79,-680v-76,115,-166,206,-331,209v-235,5,-371,-205,-371,-461v0,-297,187,-572,462,-566xm815,-538v0,-139,-66,-236,-198,-239v-142,-3,-250,152,-250,308v0,136,72,241,201,242v150,2,247,-149,247,-311","w":1219,"k":{"u":4}},"r":{"d":"430,-760v93,-136,161,-243,334,-236v4,2,8,4,15,3r-33,288v-152,-40,-285,7,-322,123v-50,160,-54,397,-82,582r-272,0r113,-965r272,0","w":750,"k":{"\u00f8":12,"\u00e6":19,"\u00f6":-18,"\u00f4":-18,"\u00f2":-18,"\u00f3":-18,"\u00ea":-19,"\u00e8":-19,"\u00e9":-19,"\u00e7":-12,"\u00e5":-14,"\u00e4":-14,"\u00e2":-14,"\u00e0":-14,"\u00e1":-14,"z":-42,"y":-71,"x":-58,"w":-72,"v":-72,"t":-53,"s":-30,"q":-15,"p":1,"o":-19,"j":-2,"g":-19,"f":-43,"e":-19,"d":-17,"c":-16,"a":-16,";":19,":":-1,".":107,"-":23,",":56}},"s":{"d":"92,-656v-4,-213,150,-345,368,-340v133,3,206,29,324,88r-94,199v-87,-52,-163,-78,-228,-78v-77,0,-116,30,-116,90v0,74,50,74,133,97v158,44,280,90,280,283v0,218,-148,350,-371,350v-123,0,-245,-31,-368,-94r66,-226v97,50,160,101,278,101v85,0,127,-29,127,-88v0,-81,-98,-88,-172,-119v-139,-59,-224,-96,-227,-263","w":848,"k":{"t":-16}},"t":{"d":"571,-746r-127,0r-88,746r-272,0r88,-746r-119,0r25,-217r118,0r39,-327r273,0r-39,327r127,0","w":582,"k":{"\u00e6":-2,"\u00f6":-9,"\u00f3":-9,"\u00e9":-11,"\u00e5":-6,"\u00e4":-6,"\u00e1":-6,"o":-10,"h":-12,"e":-11,"a":-7,"S":7,";":25,":":4}},"u":{"d":"398,-451v-31,130,23,239,153,236v147,-4,171,-104,189,-252r59,-498r272,0v-33,239,-44,534,-105,740v-52,173,-195,258,-420,258v-265,1,-429,-123,-429,-380v0,-206,47,-418,68,-618r272,0","w":1155},"v":{"d":"557,0r-243,0r-283,-965r274,0r170,598r326,-598r283,0","w":1024,"k":{"\u00f8":43,"\u00e6":2,"\u00f6":14,"\u00f2":14,"\u00f3":14,"\u00ea":12,"\u00e8":12,"\u00e9":12,"\u00e5":16,"\u00e3":16,"\u00e4":16,"\u00e2":16,"\u00e0":16,"\u00e1":16,"s":-16,"o":12,"l":-15,"g":12,"e":11,"c":15,"a":15,";":6,":":-13,".":91,"-":-44,",":42}},"w":{"d":"1209,0r-220,0r-153,-615r-109,189r-233,426r-219,0r-244,-965r268,0r148,584r321,-584r219,0r148,584r321,-584r281,0","w":1677,"k":{"\u00f8":45,"\u00e6":3,"\u00f6":16,"\u00f2":16,"\u00f3":16,"\u00ea":14,"\u00e8":14,"\u00e9":14,"\u00e5":17,"\u00e3":17,"\u00e4":17,"\u00e2":17,"\u00e0":17,"\u00e1":17,"s":-15,"o":14,"l":-14,"g":13,"e":13,"c":17,"a":16,";":7,":":-12,".":93,"-":-43,",":44}},"x":{"d":"633,-496r303,496r-317,0r-162,-301r-205,301r-313,0r383,-514r-268,-451r311,0r125,270r172,-270r330,0","w":977,"k":{"\u00e9":21,"q":15,"o":23,"e":21,"c":24,"a":16}},"y":{"d":"365,500r-285,0r248,-531r-297,-934r291,0r170,619r276,-619r289,0","w":997,"k":{"\u00f8":29,"\u00e6":2,"\u00f6":7,"\u00f2":7,"\u00f3":7,"\u00ea":5,"\u00e8":5,"\u00e9":5,"\u00e5":6,"\u00e3":6,"\u00e4":6,"\u00e2":6,"\u00e0":6,"\u00e1":6,"s":-18,"o":6,"l":-15,"g":5,"e":5,"c":9,"a":5,";":6,":":-13,".":64,"-":-61,",":14}},"z":{"d":"424,-225r375,0r-27,225r-768,0r430,-740r-362,0r26,-225r756,0","w":872},"{":{"d":"447,-26v-1,149,27,193,170,188r0,226r-152,3v-206,-7,-268,-104,-268,-327r0,-488v-3,-87,-53,-122,-129,-149r0,-219v95,-33,127,-64,127,-193r0,-442v-12,-281,145,-332,422,-311r0,227v-161,3,-168,27,-168,207r0,354v-8,174,-34,202,-145,276v86,59,143,106,143,218r0,430","w":575},"|":{"d":"342,0r-272,0r182,-1536r273,0","w":627},"}":{"d":"412,-927v3,91,53,120,129,149r0,219v-98,34,-127,63,-127,193r0,442v12,282,-144,333,-422,312r0,-226v160,-2,168,-29,168,-209r0,-354v3,-169,30,-199,145,-275v-88,-58,-143,-106,-143,-219r0,-430v2,-149,-29,-191,-170,-186r0,-228v95,0,230,-7,287,22v101,52,133,136,133,302r0,488","w":575},"~":{"d":"1016,-1604v90,0,125,-40,166,-116r162,96v-37,77,-65,129,-85,157v-91,122,-216,187,-370,134r-284,-97v-109,-23,-179,46,-213,138r-156,-107v59,-155,141,-312,340,-319v62,-2,244,63,338,96v36,12,70,18,102,18","w":1522},"\u00c4":{"d":"1042,0r-51,-254r-573,0r-125,254r-326,0r770,-1534r289,0r323,1534r-307,0xm821,-1124r-283,598r400,0xm923,-1746v0,-79,69,-149,150,-149v80,0,150,69,150,150v0,81,-69,150,-150,150v-80,0,-150,-70,-150,-151xm549,-1746v0,-80,68,-149,149,-149v80,0,151,69,151,149v0,81,-70,151,-150,151v-82,0,-150,-69,-150,-151","w":1413,"k":{"<":18,"\u00ab":22,"y":14,"v":8,"u":1,"t":-22,"q":-11,"o":-2,"g":-8,"d":-12,"c":-2,"b":-19,"a":-9,"Y":126,"W":46,"V":81,"U":39,"T":74,"Q":40,"O":40,"G":41,"C":41,".":-54,"-":-95,",":-104}},"\u00c5":{"d":"1042,0r-51,-254r-573,0r-125,254r-326,0r770,-1534r289,0r323,1534r-307,0xm821,-1124r-283,598r400,0xm747,-1762v0,-89,71,-163,161,-163v85,0,159,75,159,160v0,86,-72,161,-160,161v-86,0,-160,-73,-160,-158xm973,-1766v0,-33,-31,-63,-66,-63v-34,0,-66,29,-66,64v0,35,30,65,66,65v36,0,66,-30,66,-66","w":1413,"k":{"<":18,"\u00ab":22,"y":14,"v":8,"u":1,"t":-22,"q":-11,"o":-2,"g":-8,"e":-5,"d":-12,"c":-2,"b":-19,"a":-9,"Y":126,"W":46,"V":81,"U":39,"T":74,"Q":40,"O":40,"G":41,"C":41,".":-54,"-":-95,",":-104}},"\u00c7":{"d":"447,-720v0,264,167,457,427,453v150,-2,231,-50,340,-129v21,-16,27,4,24,29r-34,276v-1,15,-17,33,-50,52v-53,30,-129,50,-228,65r-15,121r-239,0r14,-129v-192,-47,-311,-129,-418,-265v-186,-235,-182,-663,-25,-930v131,-223,373,-389,704,-390v119,0,238,25,355,80v46,22,67,34,64,64r-29,253v-7,52,-11,48,-43,23v-99,-82,-213,-123,-342,-123v-292,0,-505,252,-505,550","w":1354,"k":{"A":-13}},"\u00c9":{"d":"1053,-1262r-489,0r-43,353r469,0r-33,274r-469,0r-45,361r487,0r-33,274r-784,0r186,-1536r133,0r46,-63r514,0r-48,63r140,0","w":1067},"\u00d1":{"d":"1475,0r-301,0r-529,-874v-45,-83,-95,-186,-106,-239r-27,0v13,89,16,157,7,230r-109,883r-297,0r186,-1534r303,0r551,922v33,60,61,126,80,200r29,-6v-20,-97,-10,-195,0,-276r102,-840r297,0xm875,-1678v-48,4,-64,33,-82,76r-143,0v21,-140,92,-254,222,-262v64,-4,210,82,297,82v56,0,63,-30,89,-78r145,0v-39,175,-122,262,-247,262v-52,0,-235,-84,-281,-80","w":1712},"\u00d6":{"d":"861,31v-435,0,-748,-313,-736,-764v9,-334,176,-597,405,-725v126,-70,264,-107,416,-107v434,0,733,307,733,741v0,344,-177,620,-411,750v-123,68,-258,105,-407,105xm1360,-816v0,-260,-155,-452,-416,-452v-287,0,-500,252,-500,545v0,261,172,457,427,457v288,0,489,-256,489,-550xm621,-1745v0,-81,69,-150,151,-150v78,0,149,70,149,146v0,68,-83,152,-154,154v-78,3,-146,-70,-146,-150xm995,-1746v0,-79,69,-149,150,-149v80,0,150,69,150,150v0,81,-69,150,-150,150v-81,0,-150,-70,-150,-151","w":1741,"k":{"Y":103,"X":58,"W":18,"V":52,"T":51,"A":70}},"\u00dc":{"d":"485,-610v-38,210,47,344,251,344v110,0,189,-32,237,-96v43,-58,74,-168,94,-330r102,-842r297,0r-108,903v-36,278,-72,444,-248,563v-99,67,-230,99,-390,99v-337,0,-541,-139,-546,-459v0,-47,7,-127,20,-238r107,-868r297,0xm559,-1745v0,-81,69,-150,151,-150v78,0,149,70,149,146v0,68,-83,152,-154,154v-78,3,-146,-70,-146,-150xm934,-1746v0,-79,69,-149,150,-149v81,0,150,69,150,150v0,80,-68,150,-150,150v-81,0,-150,-70,-150,-151","w":1520,"k":{"r":11,"p":13,"n":11,"m":11,"b":10,"A":71,".":35,",":-16}},"\u00e1":{"d":"74,-422v0,-298,186,-574,465,-572v71,0,138,21,203,64v22,14,59,53,110,117r17,-148r270,0r-113,961r-278,0r28,-152v-95,116,-173,180,-331,185v-231,7,-371,-204,-371,-455xm819,-528v0,-137,-65,-239,-197,-241v-144,-4,-251,153,-251,311v0,135,72,237,199,239v151,3,249,-147,249,-309xm684,-1155r-112,-111r311,-241r160,182","w":1223,"k":{"y":-14,"w":-15,"v":-15}},"\u00e0":{"d":"74,-422v0,-298,186,-574,465,-572v71,0,138,21,203,64v22,14,59,53,110,117r17,-148r270,0r-113,961r-278,0r28,-152v-95,116,-173,180,-331,185v-231,7,-371,-204,-371,-455xm819,-528v0,-137,-65,-239,-197,-241v-144,-4,-251,153,-251,311v0,135,72,237,199,239v151,3,249,-147,249,-309xm373,-1368r172,-141r285,276r-111,100","w":1223,"k":{"y":-14,"w":-15,"v":-15}},"\u00e2":{"d":"74,-422v0,-298,186,-574,465,-572v71,0,138,21,203,64v22,14,59,53,110,117r17,-148r270,0r-113,961r-278,0r28,-152v-95,116,-173,180,-331,185v-231,7,-371,-204,-371,-455xm819,-528v0,-137,-65,-239,-197,-241v-144,-4,-251,153,-251,311v0,135,72,237,199,239v151,3,249,-147,249,-309xm346,-1255r385,-289r322,289r-143,122r-205,-190r-248,190","w":1223},"\u00e4":{"d":"74,-422v0,-297,186,-574,463,-572v74,0,142,20,202,60v22,15,60,56,113,121r17,-148r270,0r-113,961r-278,0r28,-152v-95,116,-173,180,-331,185v-231,7,-371,-204,-371,-455xm819,-528v0,-137,-65,-239,-197,-241v-145,-3,-251,152,-251,311v0,135,72,237,199,239v151,3,249,-147,249,-309xm738,-1293v0,-80,68,-150,150,-150v79,0,150,70,150,149v0,81,-69,151,-150,151v-81,0,-150,-69,-150,-150xm363,-1293v0,-80,69,-150,150,-150v79,0,150,70,150,149v0,81,-69,151,-151,151v-81,0,-149,-68,-149,-150","w":1223,"k":{"y":-14,"w":-15,"v":-15}},"\u00e3":{"d":"74,-422v0,-297,186,-574,463,-572v74,0,142,20,202,60v22,15,60,56,113,121r17,-148r270,0r-113,961r-278,0r28,-152v-95,116,-173,180,-331,185v-231,7,-371,-204,-371,-455xm819,-528v0,-137,-65,-239,-197,-241v-145,-3,-251,152,-251,311v0,135,72,237,199,239v151,3,249,-147,249,-309xm828,-1155v-50,0,-237,-80,-280,-80v-33,0,-61,25,-83,76r-141,0v18,-139,94,-258,221,-262v41,-1,166,40,238,72v16,7,35,10,57,10v57,0,65,-31,92,-78r143,0v-39,175,-122,262,-247,262","w":1223},"\u00e5":{"d":"74,-422v0,-298,186,-574,465,-572v71,0,138,21,203,64v22,14,59,53,110,117r17,-148r270,0r-113,961r-278,0r28,-152v-95,116,-173,180,-331,185v-231,7,-371,-204,-371,-455xm819,-528v0,-138,-66,-236,-197,-239v-144,-3,-251,150,-251,309v0,134,72,237,199,239v151,2,249,-147,249,-309xm711,-1141v-87,0,-160,-69,-160,-157v0,-94,70,-162,160,-164v86,-1,160,74,160,160v0,85,-73,161,-160,161xm777,-1302v0,-34,-31,-66,-66,-66v-33,0,-66,33,-66,66v0,35,30,65,66,65v36,0,66,-30,66,-65","w":1223,"k":{"y":-14,"w":-15,"v":-15}},"\u00e7":{"d":"373,-453v0,133,96,222,231,219v49,0,115,-18,199,-55r-53,284v-33,10,-72,19,-115,27r-14,84r-186,0r14,-82v-235,-52,-373,-209,-379,-474v-7,-337,310,-625,681,-531v31,8,73,23,126,45r-47,258v-73,-33,-137,-50,-192,-50v-156,-3,-265,119,-265,275","w":895},"\u00e9":{"d":"586,-994v279,0,442,202,438,492r0,82r-684,0v16,103,22,128,85,172v36,25,80,35,131,35v79,0,113,-26,169,-68r236,99v-83,144,-219,212,-411,215v-292,4,-478,-192,-478,-483v0,-307,212,-544,514,-544xm782,-608v-25,-121,-54,-177,-177,-177v-133,0,-187,59,-242,177r419,0xm633,-1155r-112,-111r311,-241r160,182","w":1102,"k":{"y":27,"w":15,"v":24}},"\u00e8":{"d":"586,-994v279,0,442,202,438,492r0,82r-684,0v16,103,22,128,85,172v36,25,80,35,131,35v79,0,113,-26,169,-68r236,99v-83,144,-219,212,-411,215v-292,4,-478,-192,-478,-483v0,-307,212,-544,514,-544xm782,-608v-25,-121,-54,-177,-177,-177v-133,0,-187,59,-242,177r419,0xm318,-1366r172,-141r284,276r-110,101","w":1102},"\u00ea":{"d":"586,-994v279,0,442,202,438,492r0,82r-684,0v16,103,22,128,85,172v36,25,80,35,131,35v79,0,113,-26,169,-68r236,99v-83,144,-219,212,-411,215v-292,4,-478,-192,-478,-483v0,-307,212,-544,514,-544xm782,-608v-25,-121,-54,-177,-177,-177v-133,0,-187,59,-242,177r419,0xm287,-1249r385,-289r322,289r-144,123r-205,-191r-247,191","w":1102,"k":{"y":27,"w":15,"v":24}},"\u00eb":{"d":"586,-994v279,0,442,202,438,492r0,80r-684,0v9,143,79,209,216,209v78,0,115,-27,169,-68r236,99v-84,145,-218,212,-411,215v-292,5,-478,-192,-478,-483v0,-307,212,-544,514,-544xm782,-608v-25,-121,-54,-177,-177,-177v-133,0,-187,59,-242,177r419,0xm682,-1289v0,-80,68,-150,150,-150v79,0,150,70,150,149v0,81,-70,151,-150,151v-81,0,-150,-69,-150,-150xm308,-1289v0,-80,68,-150,150,-150v79,0,150,70,150,149v0,82,-69,151,-151,151v-81,0,-149,-68,-149,-150","w":1102},"\u00ed":{"d":"342,0r-272,0r113,-961r272,0xm340,-1155r-112,-111r311,-241r160,182","w":535},"\u00ec":{"d":"340,0r-272,0r113,-961r272,0xm29,-1366r172,-141r285,276r-111,101","w":532},"\u00ee":{"d":"340,0r-273,0r113,-961r273,0xm4,-1255r385,-289r322,289r-144,122r-205,-190r-247,190","w":532},"\u00ef":{"d":"345,0r-273,0r113,-961r272,0xm398,-1289v0,-80,68,-150,150,-150v79,0,150,70,150,149v0,81,-70,151,-150,151v-81,0,-150,-69,-150,-150xm23,-1289v0,-80,68,-150,150,-150v79,0,150,70,150,149v0,81,-70,151,-150,151v-82,0,-150,-68,-150,-150","w":541},"\u00f1":{"d":"736,-572v20,-99,-30,-174,-126,-168v-146,9,-187,94,-208,265r-58,475r-274,0r113,-961r272,0r-20,158v91,-114,166,-187,321,-191v163,-4,268,84,268,244v0,254,-57,503,-82,750r-272,0xm781,-1155v-50,0,-237,-80,-280,-80v-33,0,-61,25,-83,76r-141,0v18,-139,94,-258,221,-262v41,-1,166,40,238,72v16,7,35,10,57,10v57,0,65,-31,92,-78r143,0v-39,175,-122,262,-247,262","w":1137},"\u00f3":{"d":"72,-454v0,-299,229,-540,533,-540v279,0,487,215,487,496v0,292,-226,531,-519,531v-285,0,-501,-202,-501,-487xm797,-501v0,-136,-71,-239,-203,-241v-135,-2,-227,134,-227,281v0,135,71,240,199,242v140,3,231,-132,231,-282xm660,-1155r-113,-111r311,-241r160,182","w":1176,"k":{"y":25,"w":10,"v":19}},"\u00f2":{"d":"72,-454v0,-299,229,-540,533,-540v279,0,487,215,487,496v0,292,-226,531,-519,531v-285,0,-501,-202,-501,-487xm797,-501v0,-136,-71,-239,-203,-241v-135,-2,-227,134,-227,281v0,135,71,240,199,242v140,3,231,-132,231,-282xm344,-1366r172,-141r285,276r-111,101","w":1176,"k":{"y":25,"w":10,"v":19}},"\u00f4":{"d":"72,-454v0,-299,229,-540,533,-540v279,0,487,215,487,496v0,292,-226,531,-519,531v-285,0,-501,-202,-501,-487xm797,-501v0,-136,-71,-239,-203,-241v-135,-2,-227,134,-227,281v0,135,71,240,199,242v140,3,231,-132,231,-282xm324,-1249r385,-289r321,289r-143,123r-205,-191r-248,191","w":1176,"k":{"t":-2}},"\u00f6":{"d":"72,-454v0,-299,229,-540,533,-540v279,0,487,215,487,496v0,292,-226,531,-519,531v-285,0,-501,-202,-501,-487xm797,-501v0,-134,-72,-242,-203,-243v-136,-1,-227,134,-227,283v0,135,71,240,199,242v140,3,231,-132,231,-282xm717,-1289v0,-80,68,-150,150,-150v79,0,150,70,150,149v0,81,-70,151,-150,151v-81,0,-150,-69,-150,-150xm342,-1289v0,-80,68,-150,150,-150v79,0,150,70,150,149v0,82,-69,151,-151,151v-81,0,-149,-68,-149,-150","w":1176,"k":{"y":25,"x":20,"w":10,"v":19,"t":-2}},"\u00f5":{"d":"72,-454v0,-299,229,-540,533,-540v279,0,487,215,487,496v0,292,-226,531,-519,531v-285,0,-501,-202,-501,-487xm797,-501v0,-134,-72,-242,-203,-243v-136,-1,-227,134,-227,283v0,135,71,240,199,242v140,3,231,-132,231,-282xm802,-1155v-52,0,-236,-80,-281,-80v-33,0,-60,25,-82,76r-142,0v20,-138,94,-259,221,-262v42,-1,166,39,238,72v16,7,35,10,58,10v56,0,65,-31,92,-78r143,0v-40,175,-122,262,-247,262","w":1174},"\u00fa":{"d":"398,-449v-31,130,24,239,154,234v140,-5,170,-98,188,-250r59,-496r272,0v-33,238,-44,534,-105,738v-51,172,-195,256,-420,256v-265,0,-429,-123,-429,-378v0,-206,47,-417,68,-616r272,0xm647,-1155r-112,-111r311,-241r160,182","w":1155},"\u00f9":{"d":"398,-449v-31,130,24,239,154,234v140,-5,170,-98,188,-250r59,-496r272,0v-33,238,-44,534,-105,738v-51,172,-195,256,-420,256v-265,0,-429,-123,-429,-378v0,-206,47,-417,68,-616r272,0xm334,-1366r172,-141r285,276r-111,101","w":1155},"\u00fb":{"d":"398,-449v-31,130,24,239,154,234v140,-5,170,-98,188,-250r59,-496r272,0v-33,238,-44,534,-105,738v-51,172,-195,256,-420,256v-265,0,-429,-123,-429,-378v0,-206,47,-417,68,-616r272,0xm307,-1255r385,-289r322,289r-143,122r-205,-190r-248,190","w":1155},"\u00fc":{"d":"398,-449v-31,130,24,239,154,234v140,-5,170,-98,188,-250r59,-496r272,0v-33,238,-44,534,-105,738v-51,172,-195,256,-420,256v-265,0,-429,-123,-429,-378v0,-206,47,-417,68,-616r272,0xm705,-1289v0,-80,68,-150,150,-150v81,0,150,69,150,149v0,81,-70,151,-150,151v-81,0,-150,-69,-150,-150xm330,-1289v0,-80,68,-150,150,-150v79,0,150,70,150,149v0,81,-70,151,-151,151v-81,0,-149,-68,-149,-150","w":1155},"\u00b0":{"d":"436,-1258v0,-168,136,-309,305,-309v162,0,301,144,301,307v0,162,-139,307,-301,307v-165,0,-305,-139,-305,-305xm899,-1260v0,-85,-73,-162,-162,-162v-84,0,-156,77,-156,162v0,85,73,160,158,160v86,0,160,-74,160,-160","w":1298},"\u00a2":{"d":"621,-721v3,156,100,242,239,242v85,0,163,-33,234,-100r-35,284v-70,26,-132,41,-186,46r-25,192r-143,0r23,-186v-175,-29,-267,-91,-343,-208v-78,-120,-84,-367,-4,-514v98,-179,237,-282,476,-329r20,-172r146,0r-23,180v54,8,132,24,174,48r-33,282v-62,-63,-98,-98,-203,-100v-182,-3,-321,153,-317,335","w":1300},"\u00a3":{"d":"246,-1123v0,-266,259,-444,547,-444v173,0,313,56,422,168v29,29,63,81,102,154r-244,133v-49,-121,-131,-193,-272,-197v-158,-4,-262,109,-225,268r52,138v11,26,19,48,23,65r381,0r-22,188r-322,0v17,94,3,146,-42,216v-26,41,-79,90,-156,149v35,5,61,6,96,13v75,15,189,36,261,34v105,-2,157,-19,243,-63r69,264v-200,104,-406,64,-639,12v-97,-22,-224,-42,-333,-18v-37,7,-85,20,-146,39r29,-250v102,-37,177,-74,223,-114v98,-85,133,-150,121,-282r-303,0r22,-188r205,0v-42,-77,-92,-199,-92,-285","w":1292},"\u00a7":{"d":"602,-1524v-88,-3,-167,69,-164,156v5,131,135,167,248,213v220,90,396,191,396,442v0,113,-42,210,-125,292v-29,29,-80,63,-152,102v139,64,214,149,217,311v5,236,-198,402,-440,399v-263,-4,-416,-157,-426,-428r274,0v10,134,66,201,167,201v137,0,227,-157,144,-274v-64,-90,-195,-114,-309,-156v-182,-67,-311,-191,-311,-419v0,-195,91,-326,274,-374v-131,-57,-214,-152,-215,-314v-2,-232,173,-370,410,-370v209,0,383,104,428,270v7,27,11,73,14,136r-268,0v-16,-113,-53,-183,-162,-187xm797,-688v0,-108,-87,-207,-197,-207v-109,0,-198,96,-198,207v0,110,89,207,196,207v108,0,199,-99,199,-207","w":1186},"\u00b6":{"d":"424,-784v-204,14,-306,-142,-307,-346v0,-271,163,-406,489,-406r744,0r-31,252r-168,0r-182,1495r-229,0r184,-1495r-209,0r-184,1495r-228,0","w":1300},"\u00df":{"d":"876,-1325v1,-110,-76,-178,-184,-176v-121,2,-195,69,-222,181v-9,32,-19,93,-30,183r-141,1137r-281,0r156,-1255v36,-318,219,-486,551,-498v234,-8,423,136,423,357v0,247,-75,308,-229,419v169,69,258,192,258,389v0,107,-26,208,-78,303v-122,218,-325,323,-626,318r32,-252v217,-10,357,-125,381,-311v19,-148,-74,-262,-192,-293v-24,-6,-62,-11,-113,-15r29,-239v161,-10,264,-90,266,-248","w":1300},"\u00ae":{"d":"620,-1529v224,-73,459,-46,652,64v221,125,401,377,401,698v0,317,-181,569,-399,695v-242,140,-552,139,-794,0v-221,-127,-397,-375,-402,-696v-6,-349,243,-663,542,-761xm1468,-524v169,-446,-158,-915,-590,-904v-372,9,-630,279,-640,659v-9,349,291,661,638,661v272,0,507,-192,592,-416xm1217,-972v0,151,-85,250,-217,282r245,383r-260,0r-217,-340r-43,340r-221,0r115,-922r247,0v228,-4,351,59,351,257xm990,-948v0,-96,-75,-97,-173,-95r-28,224v120,8,201,-27,201,-129","w":1751},"\u00a9":{"d":"620,-1529v224,-73,459,-46,652,64v221,125,401,377,401,698v0,317,-181,569,-399,695v-242,140,-552,139,-794,0v-221,-127,-397,-375,-402,-696v-6,-349,243,-663,542,-761xm1468,-524v169,-446,-158,-915,-590,-904v-372,9,-630,279,-640,659v-9,349,291,661,638,661v272,0,507,-192,592,-416xm662,-742v0,142,102,244,244,244v79,0,180,-45,257,-104r-30,246v-64,41,-149,67,-249,67v-258,0,-458,-195,-458,-453v0,-287,229,-505,518,-505v90,0,195,27,289,78r-29,235v-70,-56,-172,-104,-254,-104v-163,0,-288,132,-288,296","w":1751},"\u00b4":{"d":"885,-1483r-344,312r-135,-93r272,-348","w":897},"\u00a8":{"d":"725,-1243v0,-80,72,-152,153,-152v80,0,150,72,150,152v0,81,-68,151,-149,151v-84,0,-154,-69,-154,-151xm295,-1242v0,-81,71,-152,153,-152v80,0,149,69,149,150v0,82,-67,152,-149,152v-81,0,-153,-68,-153,-150","w":1145},"\u00c6":{"d":"1097,0r-55,-248r-631,0r-122,248r-322,0r791,-1536r802,0r70,274r-510,0r78,357r514,0r67,276r-516,0r78,355r527,0r67,274r-838,0xm850,-1139r-301,615r434,0","w":2046},"\u00d8":{"d":"871,-266v334,-3,550,-323,472,-695r-755,592v79,69,173,103,283,103xm948,-1270v-341,-3,-580,336,-483,699r762,-596v-80,-69,-173,-103,-279,-103xm125,-705v0,-491,350,-862,821,-862v210,0,387,68,531,205r151,-119r146,185r-164,127v110,260,83,576,-50,804v-130,224,-370,396,-698,396v-207,0,-383,-68,-528,-203r-144,113r-145,-185r154,-121v-49,-103,-74,-216,-74,-340","w":1847,"k":{"A":109}},"\u00b1":{"d":"137,-856r420,0r0,-422r184,0r0,422r422,0r0,184r-422,0r0,404r-184,0r0,-404r-420,0r0,-184xm137,-137r1026,0r0,182r-1026,0r0,-182","w":1300},"\u00a5":{"d":"531,-833r-289,0r27,-207r163,0r-227,-490r328,0r241,533r367,-533r332,0r-356,490r172,0r-25,207r-299,0r-98,143r379,0r-27,211r-377,0r-59,479r-275,0r58,-479r-367,0r27,-211r366,0","w":1300},"\u00b5":{"d":"980,-77v-129,109,-409,149,-590,65r-43,542r-279,0r188,-1525r277,0r-70,569v-4,59,12,144,30,164v33,36,79,57,144,57v134,0,211,-76,230,-227r69,-561r281,0r-76,608v-17,132,-72,233,-161,308","w":1227},"\u00aa":{"d":"197,-1173v0,-184,144,-357,328,-357v73,0,135,32,186,97r10,-78r164,0r-72,593r-166,0r11,-78v-57,61,-107,96,-206,98v-153,3,-255,-114,-255,-275xm174,-829r625,0r-14,125r-627,0xm699,-1233v0,-84,-62,-145,-145,-145v-96,0,-185,91,-185,185v0,84,64,145,145,145v97,0,185,-87,185,-185","w":778},"\u00ba":{"d":"195,-1166v0,-211,169,-364,382,-364v151,0,271,80,294,208v44,246,-146,425,-375,425v-171,0,-301,-104,-301,-269xm184,-829r627,0r-16,125r-625,0xm702,-1230v0,-86,-65,-148,-148,-148v-94,0,-185,90,-185,181v0,87,62,149,146,149v96,0,187,-89,187,-182","w":772},"\u00e6":{"d":"1239,-998v292,0,434,240,407,570r-685,0v-2,176,64,254,218,254v119,0,149,-44,220,-131r197,78v-75,124,-135,184,-248,231v-49,21,-106,29,-169,29v-168,0,-269,-50,-357,-162v-117,111,-192,157,-373,162v-227,6,-413,-123,-410,-333v3,-206,171,-342,384,-335v151,5,227,45,321,143v0,-55,1,-141,-11,-173v-45,-119,-220,-166,-378,-122v-19,4,-108,33,-158,52r25,-205v111,-41,170,-58,285,-58v190,0,302,53,376,193v88,-124,194,-193,356,-193xm1393,-600v4,-140,-40,-197,-155,-197v-128,0,-184,84,-232,197r387,0xm697,-305v1,-84,-101,-121,-206,-121v-101,0,-210,37,-210,127v0,176,414,164,416,-6","w":1724,"k":{"y":25,"w":10,"v":19}},"\u00f8":{"d":"186,-227v-169,-368,98,-771,477,-771v132,0,246,43,343,129r116,-92r105,131r-123,97v168,365,-92,766,-467,766v-135,0,-252,-42,-350,-127r-101,80r-104,-133xm630,-219v150,0,247,-152,228,-322r-352,277v35,30,77,45,124,45xm658,-746v-148,-2,-244,149,-226,326r355,-279v-37,-31,-80,-47,-129,-47","w":1298},"\u00bf":{"d":"354,-1030v0,-98,77,-178,175,-178v93,0,177,84,177,178v0,92,-83,174,-176,174v-97,0,-176,-76,-176,-174xm481,147v95,-1,183,-77,172,-184r-4,-8r287,0v34,159,-97,302,-210,364v-81,45,-166,68,-255,68v-242,0,-453,-192,-453,-433v0,-141,61,-254,183,-340v37,-25,102,-52,196,-81r0,-194r274,0r0,389r-86,0v-147,-4,-284,93,-284,232v0,99,82,188,180,187","w":1075},"\u00a1":{"d":"109,-1012v0,-98,81,-179,180,-179v95,0,177,82,177,178v0,95,-83,179,-179,179v-94,0,-178,-83,-178,-178xm146,-723r283,0r0,1090r-283,0r0,-1090","w":573},"\u00ac":{"d":"804,0r0,-352r-700,0r0,-262r991,0r0,614r-291,0","w":1145},"\u00ab":{"d":"879,-14r-356,-486r356,-492r149,109r-276,383r281,373xm426,-14r-354,-486r354,-492r152,109r-277,383r281,373","w":1090},"\u00bb":{"d":"653,-14r-153,-113r280,-373r-278,-383r151,-109r355,492xm203,-14r-156,-113r281,-373r-277,-383r152,-109r354,492","w":1090},"\u00c0":{"d":"1042,0r-51,-254r-573,0r-125,254r-326,0r770,-1534r289,0r323,1534r-307,0xm821,-1124r-283,598r400,0xm708,-1831r172,-143r287,276r-110,103","w":1413,"k":{"Y":126,"W":46,"V":81,"U":39,"T":74,"Q":40,"O":40,"G":41,"C":41,".":-54,",":-104}},"\u00c3":{"d":"1042,0r-51,-254r-573,0r-125,254r-326,0r770,-1534r289,0r323,1534r-307,0xm821,-1124r-283,598r400,0xm711,-1678v-48,4,-64,33,-82,76r-144,0v23,-140,91,-255,223,-262v75,-4,206,82,296,82v56,0,64,-30,89,-78r146,0v-40,175,-122,262,-247,262v-53,0,-236,-84,-281,-80","w":1413,"k":{"Y":126,"W":46,"V":81,"U":39,"T":74,"Q":40,"O":40,"G":41,"C":41,".":-54,",":-104}},"\u00d5":{"d":"861,31v-435,0,-748,-313,-736,-764v9,-334,176,-597,405,-725v126,-70,264,-107,416,-107v434,0,733,307,733,741v0,344,-177,620,-411,750v-123,68,-258,105,-407,105xm1360,-817v0,-260,-156,-451,-416,-451v-287,0,-500,252,-500,545v0,261,172,457,427,457v288,0,489,-258,489,-551xm854,-1678v-48,4,-64,33,-82,76r-143,0v22,-141,91,-254,223,-262v63,-4,209,82,296,82v56,0,64,-30,89,-78r145,0v-39,175,-122,262,-247,262v-52,0,-235,-84,-281,-80","w":1741,"k":{"Y":103,"V":52,"T":51}},"\u00f7":{"d":"670,-1410v0,-95,82,-178,179,-178v92,0,174,84,174,177v0,94,-81,176,-176,176v-95,0,-177,-79,-177,-175xm123,-688r0,-301r1448,0r0,301r-1448,0xm674,-277v0,-95,82,-178,179,-178v94,0,174,82,174,176v0,95,-80,177,-175,177v-97,0,-178,-79,-178,-175","w":1632},"\u00ff":{"d":"391,424r-284,0r221,-455r-297,-899r291,0r170,598r276,-598r289,0xm629,-1250v0,-80,69,-150,150,-150v80,0,150,69,150,149v0,81,-70,151,-150,151v-81,0,-150,-69,-150,-150xm254,-1250v0,-80,68,-150,150,-150v79,0,150,70,150,149v0,81,-70,151,-151,151v-81,0,-149,-69,-149,-150","w":997},"\u00a4":{"d":"1090,-389v-208,136,-449,132,-648,2r-235,233r-162,-159r238,-238v-141,-199,-130,-453,2,-631r-242,-237r164,-164r237,240v100,-63,182,-103,322,-103v134,0,222,40,315,100r236,-235r160,162r-234,233v66,106,107,179,107,320v0,132,-41,219,-103,313r238,236r-160,163xm1076,-864v0,-167,-141,-316,-311,-316v-168,0,-311,146,-311,315v0,169,144,312,312,312v168,0,310,-144,310,-311","w":1530},"\u00c2":{"d":"1042,0r-51,-254r-573,0r-125,254r-326,0r770,-1534r289,0r323,1534r-307,0xm821,-1124r-283,598r400,0xm549,-1708r387,-289r321,289r-145,123r-205,-191r-248,191","w":1413,"k":{"Y":126,"W":46,"V":81,"U":39,"T":74,"Q":40,"O":40,"G":41,"C":41,".":-54,",":-104}},"\u00ca":{"d":"1053,-1262r-489,0r-43,353r469,0r-33,274r-469,0r-45,361r487,0r-33,274r-784,0r186,-1536r133,0r46,-63r432,0r43,63r131,0","w":1067},"\u00c1":{"d":"782,-1661r-113,-111r312,-241r160,182xm1042,0r-51,-254r-573,0r-125,254r-326,0r770,-1536r289,0r323,1536r-307,0xm821,-1126r-283,598r400,0","w":1413,"k":{"<":18,"\u00ab":22,"y":14,"v":8,"u":1,"t":-22,"q":-11,"o":-2,"g":-8,"e":-5,"d":-12,"c":-2,"b":-19,"a":-9,"Y":126,"W":46,"V":81,"U":39,"T":74,"Q":40,"O":40,"G":41,"C":41,".":-54,"-":-95,",":-104}},"\u00cb":{"d":"1053,-1260r-489,0r-43,353r469,0r-33,272r-469,0r-45,361r487,0r-33,274r-784,0r186,-1534r785,0xm383,-1745v0,-81,69,-150,151,-150v78,0,149,70,149,146v0,68,-83,152,-154,154v-78,2,-146,-70,-146,-150xm758,-1746v0,-79,69,-149,150,-149v80,0,150,69,150,150v0,81,-69,150,-150,150v-81,0,-150,-70,-150,-151","w":1069},"\u00c8":{"d":"1053,-1262r-489,0r-43,353r469,0r-33,274r-469,0r-45,361r487,0r-33,274r-784,0r186,-1536r142,0r-47,-63r516,0r43,63r131,0","w":1067},"\u00cd":{"d":"686,-1823r-373,234r-98,-101r317,-274xm542,-1530r-188,1530r-299,0r188,-1530r299,0","w":649},"\u00ce":{"d":"409,0r-297,0r187,-1534r297,0xm102,-1708r387,-289r322,289r-146,123r-205,-191r-247,191","w":647},"\u00cf":{"d":"410,0r-297,0r186,-1534r297,0xm109,-1745v0,-81,69,-150,151,-150v78,0,149,70,149,146v0,68,-83,152,-154,154v-78,3,-146,-70,-146,-150xm484,-1746v0,-79,69,-149,150,-149v81,0,150,69,150,150v0,80,-68,150,-150,150v-80,0,-150,-70,-150,-151","w":651},"\u00cc":{"d":"410,0r-297,0r186,-1534r297,0xm306,-1831r172,-143r286,276r-110,103","w":645},"\u00d3":{"d":"1010,-1661r-113,-111r313,-241r158,182xm861,31v-435,0,-748,-313,-736,-764v9,-334,176,-597,405,-725v126,-70,264,-107,416,-107v434,0,733,307,733,741v0,344,-177,620,-411,750v-123,68,-258,105,-407,105xm1360,-816v0,-260,-155,-452,-416,-452v-287,0,-500,252,-500,545v0,261,172,457,427,457v288,0,489,-256,489,-550","w":1741,"k":{"Y":103,"W":18,"V":52,"T":51,"A":70}},"\u00d4":{"d":"861,31v-435,0,-748,-313,-736,-764v9,-334,176,-597,405,-725v126,-70,264,-107,416,-107v434,0,733,307,733,741v0,344,-177,620,-411,750v-123,68,-258,105,-407,105xm1360,-816v0,-260,-155,-452,-416,-452v-287,0,-500,252,-500,545v0,261,172,457,427,457v288,0,489,-256,489,-550xm614,-1708r388,-289r321,289r-145,123r-205,-191r-248,191","w":1741,"k":{"Y":103,"V":52,"T":51}},"\u00d2":{"d":"1040,-1661r-358,-170r160,-182r311,241xm861,31v-435,0,-748,-313,-736,-764v9,-334,176,-597,405,-725v126,-70,264,-107,416,-107v434,0,733,307,733,741v0,344,-177,620,-411,750v-123,68,-258,105,-407,105xm1360,-816v0,-260,-155,-452,-416,-452v-287,0,-500,252,-500,545v0,261,172,457,427,457v288,0,489,-256,489,-550","w":1741,"k":{"Y":103,"V":52,"T":51}},"\u00da":{"d":"901,-1661r-113,-111r314,-241r157,182xm485,-610v-38,210,47,344,251,344v110,0,189,-32,237,-96v43,-58,74,-168,94,-330r102,-842r297,0r-108,903v-36,278,-72,444,-248,563v-99,67,-230,99,-390,99v-337,0,-541,-139,-546,-459v0,-47,7,-127,20,-238r107,-868r297,0","w":1520,"k":{"r":11,"p":13,"n":11,"m":11,"A":71,".":35,",":-16}},"\u00db":{"d":"485,-610v-38,210,47,344,251,344v110,0,189,-32,237,-96v43,-58,74,-168,94,-330r102,-842r297,0r-108,903v-36,278,-72,444,-248,563v-99,67,-230,99,-390,99v-337,0,-541,-139,-546,-459v0,-47,7,-127,20,-238r107,-868r297,0xm553,-1708r387,-289r321,289r-145,123r-205,-191r-248,191","w":1520,"k":{"A":71}},"\u00d9":{"d":"485,-610v-38,210,47,344,251,344v110,0,189,-32,237,-96v43,-58,74,-168,94,-330r102,-842r297,0r-108,903v-36,278,-72,444,-248,563v-99,67,-230,99,-390,99v-337,0,-541,-139,-546,-459v0,-47,7,-127,20,-238r107,-868r297,0xm653,-1831r172,-143r287,276r-111,103","w":1520,"k":{"A":71}},"\u00b8":{"d":"834,205r-267,287r-139,-82r227,-306","w":1077},"\u00a0":{"w":575},"\u00a6":{"d":"357,-643r-78,643r-250,0r78,-643r250,0xm471,-1571r-77,643r-250,0r78,-643r249,0","w":500},"\u00ad":{"d":"0,-576r461,0r0,209r-461,0r0,-209","w":461},"\u00b2":{"d":"342,-1571v176,-5,301,173,213,336v-41,77,-150,183,-215,256r250,0r0,117r-502,0r203,-231v58,-67,97,-115,117,-143v29,-41,43,-78,43,-110v2,-58,-50,-104,-108,-104v-57,0,-91,38,-101,113r-144,0v14,-150,103,-230,244,-234","w":709},"\u00b3":{"d":"469,-1072v-1,-68,-52,-118,-131,-108r0,-96v70,8,113,-30,113,-91v1,-56,-38,-96,-93,-95v-51,0,-82,30,-92,90r-127,0v18,-131,98,-196,223,-199v126,-2,218,72,218,196v0,76,-29,108,-80,144v70,30,103,79,104,165v2,135,-105,225,-243,222v-130,-4,-241,-77,-250,-217r135,0v8,69,49,96,112,98v63,2,112,-46,111,-109","w":721},"\u00b7":{"d":"0,-792v0,-75,61,-137,137,-137v74,0,142,62,142,136v0,78,-64,143,-142,143v-77,0,-137,-65,-137,-142","w":276},"\u00b9":{"d":"161,-1454r-98,0r0,-117r233,0r0,690r-135,0r0,-573","w":393},"\u00bc":{"d":"807,-1581r123,70r-911,1574r-121,-69xm162,-1454r-98,0r0,-117r233,0r0,690r-135,0r0,-573xm760,-230r82,0r0,109r-82,0r0,121r-127,0r0,-121r-336,0r0,-62r342,-519r121,0r0,472xm633,-230r0,-274r-176,274r176,0","w":883},"\u00bd":{"d":"807,-1581r123,70r-911,1574r-121,-69xm162,-1454r-98,0r0,-117r233,0r0,690r-135,0r0,-573xm723,-708v175,-6,301,171,213,335v-40,75,-150,183,-215,256r250,0r0,117r-502,0r203,-232v59,-67,98,-115,117,-142v29,-41,43,-78,43,-109v1,-58,-49,-106,-108,-106v-58,0,-92,38,-101,114r-144,0v15,-149,105,-228,244,-233","w":1018},"\u00be":{"d":"1051,-1581r121,70r-909,1574r-123,-69xm1002,-230r82,0r0,109r-82,0r0,121r-125,0r0,-121r-338,0r0,-62r342,-519r121,0r0,472xm877,-230r0,-274r-178,274r178,0xm469,-1072v-1,-68,-52,-118,-131,-108r0,-96v70,8,113,-30,113,-91v1,-56,-38,-96,-93,-95v-51,0,-82,30,-92,90r-127,0v18,-131,98,-196,223,-199v126,-2,218,72,218,196v0,76,-29,108,-80,144v70,30,103,79,104,165v2,135,-105,225,-243,222v-130,-4,-241,-77,-250,-217r135,0v8,69,49,96,112,98v63,2,112,-46,111,-109","w":1249},"\u00d0":{"d":"1118,-832v0,-290,-183,-453,-516,-444r-80,0r-47,389r455,0r-21,164r-454,0r-55,463v168,4,320,-15,420,-67v155,-82,298,-278,298,-505xm14,-887r162,0r80,-649r438,0v390,4,680,197,727,541v27,198,-20,405,-110,551v-159,260,-405,444,-807,444r-436,0r88,-723r-162,0","w":1516},"\u00d7":{"w":0},"\u00dd":{"d":"1152,-6v-522,161,-947,-213,-947,-714v0,-336,173,-605,400,-737v191,-111,452,-140,682,-67v39,13,96,39,173,80r-38,274v-11,63,-58,4,-80,-10v-65,-42,-194,-80,-303,-80v-291,0,-504,247,-504,542v0,262,163,442,424,442v111,0,224,-35,337,-107v20,-13,35,-11,31,20r-37,291v-53,32,-99,54,-138,66xm6330,-285r429,0v21,0,31,14,28,37v-11,78,-16,169,-35,239v-4,6,-13,9,-26,9r-695,0v-26,0,-39,-11,-36,-35r176,-1464v1,-25,15,-37,41,-37r237,0v20,-1,33,14,27,31xm1415,0v-23,1,-23,-15,-16,-29r754,-1489v5,-12,14,-18,28,-18r250,0v17,0,27,10,31,29r315,1476v1,18,-2,32,-20,31r-260,0v-16,0,-34,-13,-37,-27r-45,-225r-568,0r-114,232v-7,13,-17,20,-31,20r-287,0xm4055,-496r127,-1015v2,-17,12,-25,29,-25r256,0v14,0,22,8,20,25r-182,1486v0,12,-14,25,-27,25r-260,0v-15,0,-28,-9,-39,-28r-614,-1002r-125,1007v-2,15,-10,23,-24,23r-263,0v-13,0,-20,-12,-18,-29r182,-1481v2,-17,12,-26,29,-26r262,0v13,1,24,7,31,18xm5477,-252r-568,0r-115,232v-6,13,-16,20,-30,20r-289,0v-23,1,-21,-20,-13,-36r750,-1480v7,-13,17,-20,31,-20r250,0v17,0,27,10,31,29r315,1476v1,19,-2,32,-21,31r-260,0v-15,1,-33,-13,-36,-27xm6793,-964v1,-27,3,-28,31,-29r569,0v22,1,33,-9,33,-30r0,-519v1,-19,11,-27,31,-27r241,0v19,0,29,10,29,31r0,521v0,17,8,24,23,24r571,0v19,1,29,8,29,23r0,255v-1,21,-12,31,-33,31r-563,0v-19,0,-29,10,-29,31r0,616v-1,25,-11,37,-31,37r-239,0v-18,0,-27,-9,-27,-27r0,-626v0,-21,-10,-31,-31,-31r-573,0v-21,0,-31,-9,-31,-27r0,-253xm2359,-535r-113,-573r-272,573r385,0xm5421,-535r-113,-573r-272,573r385,0","w":8555},"\u00de":{"d":"205,516r0,-2513r9996,0r0,2513r-9996,0xm3551,-18r-305,-1485v-5,-21,-16,-33,-35,-33r-473,0v-33,0,-35,5,-47,29r-729,1474v-6,12,-8,33,12,33r398,0v24,0,40,-8,49,-25r102,-210v9,-16,22,-25,41,-25r500,0v20,1,29,10,33,27r53,213v4,13,14,20,29,20r354,0v12,0,18,-6,18,-18xm3746,-29v0,29,3,29,35,29r342,0v19,0,30,-10,33,-29r122,-876v6,-38,8,-33,23,-6r505,888v11,15,26,23,46,23r350,0v24,0,37,-8,39,-25r205,-1488v-1,-15,-10,-23,-27,-23r-362,0v-33,1,-37,4,-41,31r-111,794v-4,30,-9,42,-21,21r-476,-833v-7,-9,-20,-13,-39,-13r-390,0v-19,0,-30,9,-32,27xm5436,0r393,0v21,0,36,-8,43,-23r110,-214v12,-21,12,-23,43,-23r474,0v32,3,36,2,43,33r38,198v3,19,16,29,39,29r351,0v26,1,26,-13,22,-33r-309,-1472v-7,-27,-9,-31,-37,-31r-451,0v-30,1,-34,4,-45,27r-725,1480v-10,19,-6,29,11,29xm7658,-368r154,-1150v-1,-11,-8,-18,-21,-18r-387,0v-14,1,-23,12,-26,33r-213,1487v-1,11,5,16,18,16r860,0v18,0,28,-8,31,-25r41,-300v-1,-13,-8,-21,-21,-21r-411,0v-17,0,-27,-7,-25,-22xm9190,-579v1,-23,3,-26,27,-27r507,0v14,1,22,-7,22,-24r0,-419v-1,-17,-8,-26,-22,-26r-514,0v-14,0,-20,-9,-20,-28r0,-474v-1,-13,-10,-21,-27,-21r-417,0v-15,0,-21,7,-21,21r0,474v-1,19,-9,28,-24,28r-549,0v-15,1,-23,8,-23,23r0,420v0,18,8,26,25,26r544,0v18,0,27,10,27,31r0,550v-1,17,7,25,23,25r419,0v15,0,23,-10,23,-29r0,-550xm1104,-749v0,-271,208,-455,479,-455v135,0,255,36,365,103v28,17,35,26,54,16v27,-101,69,-223,69,-334v0,-12,-4,-21,-13,-28v-109,-79,-339,-143,-529,-143v-351,0,-638,179,-772,419v-73,131,-112,276,-112,437v0,478,352,802,836,802v144,0,254,-25,330,-76v10,-7,17,-25,22,-55r41,-283v5,-32,3,-48,-4,-49v-61,25,-257,74,-353,74v-237,0,-413,-188,-413,-428xm2908,-1067r109,454v0,6,-7,9,-21,9r-297,0v-16,-2,-17,-2,-10,-18r199,-450v8,-23,15,-18,20,5xm6353,-1106r8,19r99,448v4,22,4,35,-21,35r-276,0v-29,0,-33,-9,-23,-30r201,-453v5,-13,9,-19,12,-19","w":10406},"\u00f0":{"d":"-8,-309v-85,-358,191,-666,519,-666v161,0,231,73,331,176v-29,-89,-52,-149,-67,-180v-53,-104,-154,-188,-301,-252r-314,276r-80,-90r260,-227r-149,-23r61,-223v109,13,208,32,299,59r250,-219r78,88r-201,179v257,122,417,351,417,672v0,421,-245,754,-642,759v-227,3,-415,-136,-461,-329xm783,-527v0,-149,-106,-253,-260,-233v-157,21,-267,143,-267,308v0,140,92,238,228,238v164,0,299,-150,299,-313","w":1147},"\u00fd":{"d":"424,-145r-368,-820r325,0r232,549r352,-549r317,0r-977,1465r-315,0xm1000,-1401r-346,236r-111,-101r283,-276","w":1227},"\u00fe":{"d":"932,-512v0,-141,-110,-240,-247,-240v-110,0,-200,50,-269,150r-29,237v43,101,120,152,231,152v160,0,314,-143,314,-299xm672,31v-142,-2,-240,-53,-316,-156r-75,625r-281,0r250,-2036r280,0r-86,696v79,-90,212,-156,350,-156v206,0,366,131,414,305v9,32,13,78,13,139v0,305,-245,588,-549,583","w":1309}}});
/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();function Set_Cookie( name, value, expires, path, domain, secure ) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );

	/*
	if the expires variable is set, make the correct
	expires time, the current script below will set
	it for x number of days, to make it for hours,
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires ){
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" +escape( value ) +
			( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
			( ( path ) ? ";path=" + path : "" ) +
			( ( domain ) ? ";domain=" + domain : "" ) +
			( ( secure ) ? ";secure" : "" );
}

function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );


		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
