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

/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* $LastChangedDate: 2007-07-22 01:45:56 +0200 (Son, 22 Jul 2007) $
* $Rev: 2447 $
*
* Version 2.1.1
*/
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);

/**
* Ajax Queue Plugin
* 
* Homepage: http://jquery.com/plugins/project/ajaxqueue
* Documentation: http://docs.jquery.com/AjaxQueue
*/

/**

<script>
$(function(){
jQuery.ajaxQueue({
url: "test.php",
success: function(html){ jQuery("ul").append(html); }
});
jQuery.ajaxQueue({
url: "test.php",
success: function(html){ jQuery("ul").append(html); }
});
jQuery.ajaxSync({
url: "test.php",
success: function(html){ jQuery("ul").append("<b>"+html+"</b>"); }
});
jQuery.ajaxSync({
url: "test.php",
success: function(html){ jQuery("ul").append("<b>"+html+"</b>"); }
});
});
</script>
<ul style="position: absolute; top: 5px; right: 5px;"></ul>

*/
/*
* Queued Ajax requests.
* A new Ajax request won't be started until the previous queued 
* request has finished.
*/

/*
* Synced Ajax requests.
* The Ajax request will happen as soon as you call this method, but
* the callbacks (success/error/complete) won't fire until all previous
* synced requests have been completed.
*/

(function($) {

var ajax = $.ajax;

var pendingRequests = {};

var synced = [];
var syncedData = [];

$.ajax = function(settings) {
// create settings for compatibility with ajaxSetup
settings = jQuery.extend(settings, jQuery.extend({}, jQuery.ajaxSettings, settings));

var port = settings.port;

switch(settings.mode) {
case "abort": 
if ( pendingRequests[port] ) {
pendingRequests[port].abort();
}
return pendingRequests[port] = ajax.apply(this, arguments);
case "queue": 
var _old = settings.complete;
settings.complete = function(){
if ( _old )
_old.apply( this, arguments );
jQuery([ajax]).dequeue("ajax" + port );;
};

jQuery([ ajax ]).queue("ajax" + port, function(){
ajax( settings );
});
return;
case "sync":
var pos = synced.length;

synced[ pos ] = {
error: settings.error,
success: settings.success,
complete: settings.complete,
done: false
};

syncedData[ pos ] = {
error: [],
success: [],
complete: []
};

settings.error = function(){ syncedData[ pos ].error = arguments; };
settings.success = function(){ syncedData[ pos ].success = arguments; };
settings.complete = function(){
syncedData[ pos ].complete = arguments;
synced[ pos ].done = true;

if ( pos == 0 || !synced[ pos-1 ] )
for ( var i = pos; i < synced.length && synced[i].done; i++ ) {
if ( synced[i].error ) synced[i].error.apply( jQuery, syncedData[i].error );
if ( synced[i].success ) synced[i].success.apply( jQuery, syncedData[i].success );
if ( synced[i].complete ) synced[i].complete.apply( jQuery, syncedData[i].complete );

synced[i] = null;
syncedData[i] = null;
}
};
}
return ajax.apply(this, arguments);
};

})(jQuery);

/*
* Autocomplete - jQuery plugin 1.0.2
*
* Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, JÃ¶rn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.js 5747 2008-06-25 18:30:55Z joern.zaefferer $
*
*/

; (function($) {

$.fn.extend({
autocomplete: function(urlOrData, options) {
var isUrl = typeof urlOrData == "string";
options = $.extend({},
$.Autocompleter.defaults, {
url: isUrl ? urlOrData: null,
data: isUrl ? null: urlOrData,
delay: isUrl ? $.Autocompleter.defaults.delay: 10,
max: options && !options.scroll ? 10: 150
},
options);

// if highlight is set to false, replace it with a do-nothing function
options.highlight = options.highlight ||
function(value) {
return value;
};

// if the formatMatch option is not specified, then use formatItem for backwards compatibility
options.formatMatch = options.formatMatch || options.formatItem;

return this.each(function() {
new $.Autocompleter(this, options);
});
},
result: function(handler) {
return this.bind("result", handler);
},
search: function(handler) {
return this.trigger("search", [handler]);
},
flushCache: function() {
return this.trigger("flushCache");
},
setOptions: function(options) {
return this.trigger("setOptions", [options]);
},
unautocomplete: function() {
return this.trigger("unautocomplete");
}
});

$.Autocompleter = function(input, options) {

var KEY = {
UP: 38,
DOWN: 40,
DEL: 46,
TAB: 9,
RETURN: 13,
ESC: 27,
COMMA: 188,
PAGEUP: 33,
PAGEDOWN: 34,
BACKSPACE: 8
};

// Create $ object for input element
var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);

var timeout;
var previousValue = "";
var cache = $.Autocompleter.Cache(options);
var hasFocus = 0;
var lastKeyPressCode;
var config = {
mouseDownOnSelect: false
};
var select = $.Autocompleter.Select(options, input, selectAndSearchCurrent, config);

var blockSubmit;

// prevent form submit in opera when selecting with return key
$.browser.opera && $(input.form).bind("submit.autocomplete",
function() {
if (blockSubmit) {
blockSubmit = false;
return false;
}
});

// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
$input.bind(($.browser.opera ? "keypress": "keydown") + ".autocomplete",
function(event) {
// track last key pressed
lastKeyPressCode = event.keyCode;
switch (event.keyCode) {

case KEY.UP:
event.preventDefault();
if (select.visible()) {
select.prev();
} else {
onChange(0, true);
}
selectCurrent();
break;

case KEY.DOWN:
event.preventDefault();
if (select.visible()) {
select.next();
} else {
onChange(0, true);
}
selectCurrent();
break;

case KEY.PAGEUP:
event.preventDefault();
if (select.visible()) {
select.pageUp();
} else {
onChange(0, true);
}
selectCurrent();
break;

case KEY.PAGEDOWN:
event.preventDefault();
if (select.visible()) {
select.pageDown();
} else {
onChange(0, true);
}
selectCurrent();
break;

// matches also semicolon
case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
case KEY.TAB:
case KEY.RETURN:
if (searchCurrent()) {
// stop default to prevent a form submit, Opera needs special handling
event.preventDefault();
blockSubmit = true;
return false;
}
break;

case KEY.ESC:
select.hide();
break;

default:
clearTimeout(timeout);
timeout = setTimeout(onChange, options.delay);
break;
}
}).focus(function() {
// track whether the field has focus, we shouldn't process any
// results if the field no longer has focus
hasFocus++;
}).blur(function() {
hasFocus = 0;
if (!config.mouseDownOnSelect) {
hideResults();
}
}).click(function() {
// show select when clicking in a focused field
if (hasFocus++>1 && !select.visible()) {
onChange(0, true);
}
}).bind("search",
function() {
// TODO why not just specifying both arguments?
var fn = (arguments.length > 1) ? arguments[1] : null;
function findValueCallback(q, data) {
var result;
if (data && data.length) {
for (var i = 0; i < data.length; i++) {
if (data[i].result.toLowerCase() == q.toLowerCase()) {
result = data[i];
break;
}
}
}
if (typeof fn == "function") fn(result);
else $input.trigger("result", result && [result.data, result.value]);
}
$.each(trimWords($input.val()),
function(i, value) {
request(value, findValueCallback, findValueCallback);
});
}).bind("flushCache",
function() {
cache.flush();
}).bind("setOptions",
function() {
$.extend(options, arguments[1]);
// if we've updated the data, repopulate
if ("data" in arguments[1])
cache.populate();
}).bind("unautocomplete",
function() {
select.unbind();
$input.unbind();
$(input.form).unbind(".autocomplete");
});

function selectAndSearchCurrent() {
selectCurrent();
searchCurrent();
}

function searchCurrent() {
var selected = select.selected();
if (!selected)
return false;

hideResultsNow();
$input.trigger("result", [selected.data, selected.value]);
return true;
}

function selectCurrent() {
var selected = select.selected();
if (!selected)
return false;

var v = selected.result;
previousValue = v;

if (options.multiple) {
var words = trimWords($input.val());
if (words.length > 1) {
v = words.slice(0, words.length - 1).join(options.multipleSeparator) + options.multipleSeparator + v;
}
v += options.multipleSeparator;
}

$input.val(v);
}

function onChange(crap, skipPrevCheck) {
if (lastKeyPressCode == KEY.DEL) {
select.hide();
return;
}

var currentValue = $input.val();

if (!skipPrevCheck && currentValue == previousValue)
return;

previousValue = currentValue;

currentValue = lastWord(currentValue);
if (currentValue.length >= options.minChars) {
$input.addClass(options.loadingClass);
if (!options.matchCase)
currentValue = currentValue.toLowerCase();
request(currentValue, receiveData, hideResultsNow);
} else {
stopLoading();
select.hide();
}
};

function trimWords(value) {
if (!value) {
return [""];
}
var words = value.split(options.multipleSeparator);
var result = [];
$.each(words,
function(i, value) {
if ($.trim(value))
result[i] = $.trim(value);
});
return result;
}

function lastWord(value) {
if (!options.multiple)
return value;
var words = trimWords(value);
return words[words.length - 1];
}

// fills in the input box w/the first match (assumed to be the best match)
// q: the term entered
// sValue: the first matching result
function autoFill(q, sValue) {
// autofill in the complete box w/the first match as long as the user hasn't entered in more data
// if the last user key pressed was backspace, don't autofill
if (options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE) {
// fill in the value (keep the case the user has typed)
$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
// select the portion of the value not typed by the user (so the next character will erase)
$.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
}
};

function hideResults() {
clearTimeout(timeout);
timeout = setTimeout(hideResultsNow, 200);
};

function hideResultsNow() {
var wasVisible = select.visible();
select.hide();
clearTimeout(timeout);
stopLoading();
if (options.mustMatch) {
// call search and run callback
$input.search(
function(result) {
// if no value found, clear the input box
if (!result) {
if (options.multiple) {
var words = trimWords($input.val()).slice(0, -1);
$input.val(words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator: ""));
}
else
$input.val("");
}
}
);
}
if (wasVisible)
// position cursor at end of input field
$.Autocompleter.Selection(input, input.value.length, input.value.length);
};

function receiveData(q, data) {
if (data && data.length && hasFocus) {
stopLoading();
select.display(data, q);
autoFill(q, data[0].value);
select.show();
} else {
hideResultsNow();
}
};

function request(term, success, failure) {
if (!options.matchCase)
term = term.toLowerCase();
var data = cache.load(term);
// recieve the cached data
if (data && data.length) {
success(term, data);
// if an AJAX url has been supplied, try loading the data now
} else if ((typeof options.url == "string") && (options.url.length > 0)) {

var extraParams = {};

$.each(options.extraParams,
function(key, param) {
extraParams[key] = typeof param == "function" ? param() : param;
});

if(options.jsonpCallback) {
extraParams['callback'] = options.jsonpCallback;

/* define global function to handle callback */
window[options.jsonpCallback] = function(data) {
var parsed = options.parse && options.parse(data) || parse(data);
cache.add(term, parsed);
success(term, parsed);
}

}

var dataType = options.jsonpCallback ? "script" : options.dataType;

onSuccess = options.jsonpCallback ? function(){} : function (data) {
var parsed = options.parse && options.parse(data) || parse(data);
cache.add(term, parsed);
success(term, parsed);
}

$.ajax({
// try to leverage ajaxQueue plugin to abort previous requests
mode: "abort",
// limit abortion to this input
port: "autocomplete" + input.name,
dataType: dataType,
url: options.url,
data: $.extend({
q: lastWord(term),
limit: options.max
},
extraParams),
beforeSend: options.beforeSend,
complete: options.complete,
success: onSuccess
});

} else {
// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
select.emptyList();
failure(term);
}
};

function parse(data) {
var parsed = [];
var rows = data.split("\n");
for (var i = 0; i < rows.length; i++) {
var row = $.trim(rows[i]);
if (row) {
row = row.split("|");
parsed[parsed.length] = {
data: row,
value: row[0],
result: options.formatResult && options.formatResult(row, row[0]) || row[0]
};
}
}
return parsed;
};

function stopLoading() {
$input.removeClass(options.loadingClass);
};

};

$.Autocompleter.defaults = {
inputClass: "ac_input",
resultsClass: "ac_results",
loadingClass: "ac_loading",
minChars: 1,
delay: 400,
beforeSend: function() {},
complete: function() {},
matchCase: false,
matchSubset: true,
matchContains: false,
cacheLength: 10,
max: 100,
mustMatch: false,
extraParams: {},
selectFirst: true,
formatItem: function(row) {
return row[0];
},
formatMatch: null,
autoFill: false,
width: 0,
multiple: false,
multipleSeparator: ", ",
highlight: function(value, term) {
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
},
scroll: true,
scrollHeight: 180
};

$.Autocompleter.Cache = function(options) {

var data = {};
var length = 0;

function matchSubset(s, sub) {
if (!options.matchCase)
s = s.toLowerCase();
var i = s.indexOf(sub);
if (i == -1) return false;
return i == 0 || options.matchContains;
};

function add(q, value) {
if (length > options.cacheLength) {
flush();
}
if (!data[q]) {
length++;
}
data[q] = value;
}

function populate() {
if (!options.data) return false;
// track the matches
var stMatchSets = {},
nullData = 0;

// no url was specified, we need to adjust the cache length to make sure it fits the local data store
if (!options.url) options.cacheLength = 1;

// track all options for minChars = 0
stMatchSets[""] = [];

// loop through the array and create a lookup structure
for (var i = 0, ol = options.data.length; i < ol; i++) {
var rawValue = options.data[i];
// if rawValue is a string, make an array otherwise just reference the array
rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;

var value = options.formatMatch(rawValue, i + 1, options.data.length);
if (value === false)
continue;

var firstChar = value.charAt(0).toLowerCase();
// if no lookup array for this character exists, look it up now
if (!stMatchSets[firstChar])
stMatchSets[firstChar] = [];

// if the match is a string
var row = {
value: value,
data: rawValue,
result: options.formatResult && options.formatResult(rawValue) || value
};

// push the current match into the set list
stMatchSets[firstChar].push(row);

// keep track of minChars zero items
if (nullData++<options.max) {
stMatchSets[""].push(row);
}
};

// add the data items to the cache
$.each(stMatchSets,
function(i, value) {
// increase the cache size
options.cacheLength++;
// add to the cache
add(i, value);
});
}

// populate any existing data
setTimeout(populate, 25);

function flush() {
data = {};
length = 0;
}

return {
flush: flush,
add: add,
populate: populate,
load: function(q) {
if (!options.cacheLength || !length)
return null;
/* 
* if dealing w/local data and matchContains than we must make sure
* to loop through all the data collections looking for matches
*/
if (!options.url && options.matchContains) {
// track all matches
var csub = [];
// loop through all the data grids for matches
for (var k in data) {
// don't search through the stMatchSets[""] (minChars: 0) cache
// this prevents duplicates
if (k.length > 0) {
var c = data[k];
$.each(c,
function(i, x) {
// if we've got a match, add it to the array
if (matchSubset(x.value, q)) {
csub.push(x);
}
});
}
}
return csub;
} else
// if the exact item exists, use it
if (data[q]) {
return data[q];
} else
if (options.matchSubset) {
for (var i = q.length - 1; i >= options.minChars; i--) {
var c = data[q.substr(0, i)];
if (c) {
var csub = [];
$.each(c,
function(i, x) {
if (matchSubset(x.value, q)) {
csub[csub.length] = x;
}
});
return csub;
}
}
}
return null;
}
};
};

$.Autocompleter.Select = function(options, input, select, config) {
var CLASSES = {
ACTIVE: "ac_over"
};

var listItems,
active = -1,
data,
term = "",
needsInit = true,
element,
list;

// Create results
function init() {
if (!needsInit)
return;
element = $("<div/>")
.hide()
.addClass(options.resultsClass)
.css("position", "absolute")
.appendTo(document.body);

list = $("<ul/>").appendTo(element).mouseover(function(event) {
if (target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
$(target(event)).addClass(CLASSES.ACTIVE);
}
}).click(function(event) {
$(target(event)).addClass(CLASSES.ACTIVE);
select();
// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
input.focus();
return false;
}).mousedown(function() {
config.mouseDownOnSelect = true;
}).mouseup(function() {
config.mouseDownOnSelect = false;
});

if (options.width > 0)
element.css("width", options.width);

needsInit = false;
}

function target(event) {
var element = event.target;
while (element && element.tagName != "LI")
element = element.parentNode;
// more fun with IE, sometimes event.target is empty, just ignore it then
if (!element)
return [];
return element;
}

function moveSelect(step) {
listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
movePosition(step);
var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
if (options.scroll) {
var offset = 0;
listItems.slice(0, active).each(function() {
offset += this.offsetHeight;
});
if ((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
} else if (offset < list.scrollTop()) {
list.scrollTop(offset);
}
}
};

function movePosition(step) {
active += step;
if (active < 0) {
active = listItems.size() - 1;
} else if (active >= listItems.size()) {
active = 0;
}
}

function limitNumberOfItems(available) {
return options.max && options.max < available
? options.max
: available;
}

function fillList() {
list.empty();
var max = limitNumberOfItems(data.length);
for (var i = 0; i < max; i++) {
if (!data[i])
continue;
var formatted = options.formatItem(data[i].data, i + 1, max, data[i].value, term);
if (formatted === false)
continue;
var li = $("<li/>").html(options.highlight(formatted, term)).addClass(i % 2 == 0 ? "ac_even": "ac_odd").appendTo(list)[0];
$.data(li, "ac_data", data[i]);
}
listItems = list.find("li");
if (options.selectFirst) {
listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
active = 0;
}
// apply bgiframe if available
if ($.fn.bgiframe)
list.bgiframe();
}

return {
display: function(d, q) {
init();
data = d;
term = q;
fillList();
},
next: function() {
moveSelect(1);
},
prev: function() {
moveSelect( - 1);
},
pageUp: function() {
if (active != 0 && active - 8 < 0) {
moveSelect( - active);
} else {
moveSelect( - 8);
}
},
pageDown: function() {
if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
moveSelect(listItems.size() - 1 - active);
} else {
moveSelect(8);
}
},
hide: function() {
element && element.hide();
listItems && listItems.removeClass(CLASSES.ACTIVE);
active = -1;
},
visible: function() {
return element && element.is(":visible");
},
current: function() {
return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
},
show: function() {
var offset = $(input).offset();
element.css({
width: typeof options.width == "string" || options.width > 0 ? options.width: $(input).width(),
top: offset.top + input.offsetHeight + (options.offsetTop || 0),
left: offset.left + (options.offsetLeft || 0)
}).show();
if (options.scroll) {
list.scrollTop(0);
list.css({
maxHeight: options.scrollHeight,
overflow: 'auto'
});

if ($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
var listHeight = 0;
listItems.each(function() {
listHeight += this.offsetHeight;
});
var scrollbarsVisible = listHeight > options.scrollHeight;
list.css('height', scrollbarsVisible ? options.scrollHeight: listHeight);
if (!scrollbarsVisible) {
// IE doesn't recalculate width when scrollbar disappears
listItems.width(list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")));
}
}

}
},
selected: function() {
/* var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);*/
var selected = listItems && listItems.filter("." + CLASSES.ACTIVE);
return selected && selected.length && $.data(selected[0], "ac_data");
},
emptyList: function() {
list && list.empty();
},
unbind: function() {
element && element.remove();
}
};
};

$.Autocompleter.Selection = function(field, start, end) {
if (field.createTextRange) {
var selRange = field.createTextRange();
selRange.collapse(true);
selRange.moveStart("character", start);
selRange.moveEnd("character", end);
selRange.select();
} else if (field.setSelectionRange) {
field.setSelectionRange(start, end);
} else {
if (field.selectionStart) {
field.selectionStart = start;
field.selectionEnd = end;
}
}
field.focus();
};

})(jQuery);

(function($j){
$j.fn.jTruncate = function(options) {

var defaults = {
length: 300,
minTrail: 20,
moreText: "Read Full Summary" + String.fromCharCode (187),
lessText: String.fromCharCode (171) + "Hide Full Summary" ,
ellipsisText: "...",
moreAni: "",
lessAni: ""
};

var options = $j.extend(defaults, options);

return this.each(function() {
obj = $j(this);
var body = obj.html();

if(body.length > options.length + options.minTrail) {
var splitLocation = body.indexOf(' ', options.length);
if(splitLocation != -1) {
// truncate tip
var splitLocation = body.indexOf(' ', options.length);
var str1 = body.substring(0, splitLocation);
var str2 = body.substring(splitLocation, body.length - 1);
obj.html(str1 + '<span class="truncate_ellipsis">' + options.ellipsisText + 
'</span>' + '<span class="truncate_more">' + str2 + '</span>');
obj.find('.truncate_more').css("display", "none");

// insert more link
obj.append(
' <a href="#" class="truncate_more_link">' + options.moreText +'</a>'
);

// set onclick event for more/less link
var moreLink = $j('.truncate_more_link', obj);
var moreContent = $j('.truncate_more', obj);
var ellipsis = $j('.truncate_ellipsis', obj);
moreLink.click(function() {
if(moreLink.text() == options.moreText) {
moreContent.show(options.moreAni);
moreLink.text(options.lessText);
ellipsis.css("display", "none");
} else {
moreContent.hide(options.lessAni);
moreLink.text(options.moreText);
ellipsis.css("display", "inline");
}
return false;
});
}
} // end if

});
};
})(jQuery);

var $j = jQuery.noConflict();

$j.ajaxSetup({
'cache' : true
});

$j(document).ready(function(){
MTV.init();
});

MTV = new function(){
this.initArray = new Array();
var hat;
var theme;

this.init = function(){

MTV.Events.addLinkEvents();
MTV.Voting.init();
MTV.Typeahead.init();
MTV.Search.init();	

for(var i=0; i<MTV.initArray.length; i++){
MTV.initArray[i]();
}

return true;
}

this.hatTrick = function(hatNumber) {
if(hat != undefined) hatNumber = hat;
var total = 66;
var bodyTag = document.getElementsByTagName('body')[0];
var classList = bodyTag.className;

if (classList.indexOf("hat") > -1) {	
var tempClasses = new Array();
var classes = classList.split(" ");
var j = 0;
for(i = 0; i < classes.length; i++) {
if(classes[i].substr(0,3) != "hat") tempClasses[j++] = classes[i];
}
classList = tempClasses.join(" ");
}
if (!hatNumber) hatNumber = Math.floor(total*Math.random());
var newHat = (hat) ? " " + hatNumber : " hat" + hatNumber;
bodyTag.className = classList + newHat + "";
}

this.setHat = function(h){
hat = h;
}
this.getHat = function(){
return hat;
}

this.setTheme = function(t){
theme = t;
}
this.getTheme = function(){
return theme;
}

}

// Source: CODA/builds/mtv.com/CODA.js
// CODA 2.21 dated 15-Mar-2010 Mon 12:51 PM
//CODA-2.21.332.js
var mtvn=typeof mtvn==='object'?mtvn:{};mtvn.btg=typeof mtvn.btg==='object'?mtvn.btg:{};mtvn.btg.config=typeof mtvn.btg.config==='object'?mtvn.btg.config:{};mtvn.btg.ads=typeof mtvn.btg.ads==='object'?mtvn.btg.ads:{};mtvn.btg.reporting=typeof mtvn.btg.reporting==='object'?mtvn.btg.reporting:{};mtvn.btg.reporting.omniture=typeof mtvn.btg.reporting.omniture==='object'?mtvn.btg.reporting.omniture:{};mtvn.btg.util=typeof mtvn.btg.util==='object'?mtvn.btg.util:{};mtvn.btg.globalvars=typeof mtvn.btg.globalvars==='object'?mtvn.btg.globalvars:{};mtvn.btg.globalvars={IS_TOP_ACCESSIBLE:function(){try{return(typeof top.location.search!='unknown');}catch(e){return false;}}(),PAGE_URL:function(){try{var retVal='';retVal=self.location.pathname;if(retVal=='')retVal='/';return retVal;}catch(e){}}(),IS_UNIT_TEST:function(){try{return(location.href.toLowerCase().indexOf("/api/jsunittest/tests/")!=-1);}catch(e){return false}}()};mtvn.btg.Controller=new function(){var hasReporting=false;var hasAds=false;var reportingData;var adsData;var defaultPageName="";this.init=function(){defaultPageName=(typeof mtvn.btg.globalvars.PAGE_URL=="string"&&mtvn.btg.globalvars.PAGE_URL!="")?mtvn.btg.globalvars.PAGE_URL:location.pathname;if(defaultPageName.charAt(defaultPageName.length-1)=="/"){defaultPageName+=typeof mtvn.btg.config.ReportSettings.indexFileName=="string"?mtvn.btg.config.ReportSettings.indexFileName:"index";}
if(mtvn.btg.config.ReportSettings){mtvn.btg.config.ReportSettings._defaultPageName=defaultPageName;mtvn.btg.reporting.ReportingManager.init();hasReporting=true;}
if(mtvn.btg.config.AdSettings){mtvn.btg.config.AdSettings.defaultPageName=defaultPageName;mtvn.btg.ads.AdManager.init();hasAds=true;}
return true;};this.sendPageCall=function(data){if(hasReporting){if(typeof data=="undefined"||!data)data={};mtvn.btg.reporting.ReportingManager.sendPageCall(data);reportingData=mtvn.btg.reporting.ReportingManager.getData();}};this.sendLinkEvent=function(data){if(hasReporting){mtvn.btg.reporting.ReportingManager.sendLinkEvent(data);}};this.placeAd=function(data){if(hasAds){mtvn.btg.ads.AdManager.placeAd(data);adsData=mtvn.btg.ads.AdManager.getData();}};this.getAdUrl=function(data){if(hasAds){return mtvn.btg.ads.AdManager.getAdUrl(data);}};};mtvn.btg.util.Beacon=function(url){this.url=url;this.data=null;};mtvn.btg.util.Beacon.prototype={setData:function(data){this.data=mtvn.btg.util.Object.toString(data,'&');},formatSrc:function(){if(this.data){if(this.url.indexOf('?')>-1){this.url+='&'+this.data;}else{this.url+='?'+this.data;}}
return this.url;},send:function(){var http=new Image(1,1);http.src=this.formatSrc();http.onload=function(){return;};http.onabort=function(){return;};http.onerror=function(){return;};}};mtvn.btg.util.Cookie={read:function(name){var name=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1,c.length)};if(c.indexOf(name)==0){return c.substring(name.length,c.length)};}
return null;},set:function(name,value,expy){var cookie=name+"="+value+"; path=/";if(expy)cookie+=";expires="+expy;document.cookie=cookie;},remove:function(name){document.cookie=name+'=;expires=Thu, 01-Jan-1970 00:00:01 GMT;path=/';}};mtvn.btg.util.Events={addListener:function(obj,type,fn){if(obj.attachEvent)
obj.attachEvent('on'+type,fn);else if(obj.addEventListener)
obj.addEventListener(type,fn,false);else obj['on'+type]=fn;},removeListener:function(obj,type,fn){if(obj.detachEvent)
obj.detachEvent('on'+type,fn);else if(obj.removeEventListener)
obj.removeEventListener(type,fn,false);else obj['on'+type]=null;}}
if(!this.mtvn.btg.util.JSON){mtvn.btg.util.JSON=function(){function f(n){return n<10?'0'+n:n;}
Date.prototype.toJSON=function(){return this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z';};var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};function stringify(value,whitelist){var a,i,k,l,r=/["\\\x00-\x1f\x7f-\x9f]/g,v;switch(typeof value){case'string':return r.test(value)?'"'+value.replace(r,function(a){var c=m[a];if(c){return c;}
c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+
(c%16).toString(16);})+'"':'"'+value+'"';case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
if(typeof value.toJSON==='function'){return stringify(value.toJSON());}
a=[];if(typeof value.length==='number'&&!(value.propertyIsEnumerable('length'))){l=value.length;for(i=0;i<l;i+=1){a.push(stringify(value[i],whitelist)||'null');}
return'['+a.join(',')+']';}
if(whitelist){l=whitelist.length;for(i=0;i<l;i+=1){k=whitelist[i];if(typeof k==='string'){v=stringify(value[k],whitelist);if(v){a.push(stringify(k)+':'+v);}}}}else{for(k in value){if(typeof k==='string'){v=stringify(value[k],whitelist);if(v){a.push(stringify(k)+':'+v);}}}}
return'{'+a.join(',')+'}';}}
return{stringify:stringify,parse:function(text,filter){var j;function walk(k,v){var i,n;if(v&&typeof v==='object'){for(i in v){if(Object.prototype.hasOwnProperty.apply(v,[i])){n=walk(i,v[i]);if(n!==undefined){v[i]=n;}}}}
return filter(k,v);}
if(/^[\],:{}\s]*$/.test(text.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(:?[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof filter==='function'?walk('',j):j;}
throw new SyntaxError('parseJSON');}};}();}
mtvn.btg.util.Math={random:function(){var min;var max;if(arguments.length>1){min=arguments[0];max=arguments[1];}else{min=0;max=arguments[0];}
return Math.floor(Math.random()*(max-min+1)+min);}};mtvn.btg.util.Object={isDefined:function(object){return typeof object=="object"?true:false;},toString:function(object,delimiter){var delimiter=delimiter?delimiter:',';var array=[];for(var i in object){if(mtvn.btg.util.String.isDefined(object[i])){array.push(i+"="+object[i]);}}
return array.join(delimiter);},copyProperties:function(a_sourceObj,a_destinationObj,a_forceOverwrite){if(this.isDefined(a_sourceObj)&&this.isDefined(a_destinationObj)){for(var i in a_sourceObj){if(this.isDefined(a_destinationObj[i])||mtvn.btg.util.String.isDefined(a_destinationObj[i])){if(a_forceOverwrite=="forceOverwrite")a_destinationObj[i]=a_sourceObj[i];}
else{a_destinationObj[i]=a_sourceObj[i];}}}}};mtvn.btg.util.Sections={getAdSections:function(){var retVal=self.location.pathname;if(retVal=='')retVal='/';if(retVal.lastIndexOf("/")==(retVal.length-1)){retVal+=(mtvn.btg.util.Object.isDefined(mtvn.btg.config.AdSettings)&&mtvn.btg.util.String.isDefined(mtvn.btg.config.AdSettings.defaultIndexFileName))?mtvn.btg.config.AdSettings.defaultIndexFileName:"index";}
if(retVal!='/'&&retVal.indexOf('/')==0)retVal=retVal.substring(1);return retVal;},getReportingSections:function(){return self.location.pathname;}};mtvn.btg.util.Session={Variables:{config:[],add:function(config){if(typeof config=="undefined")return false;for(var c1=0;c1<this.config.length;c1++){if(typeof this.config[c1].varName!="string")continue;for(var c2=0;c2<config.length;c2++){if(typeof config[c2].varName!="string")continue;if(config[c2].varName==this.config[c1].varName)this.config.splice(c1,1);}}
this.config=this.config.concat(config);return true;},setData:function(data){if(!mtvn.btg.util.String.isDefined(data))return null;for(c=0;c<this.config.length;c++){var _config=this.config[c];if(typeof data[_config.varName]!="undefined"){data[_config.varName]=this.saveToCookie(_config,data[_config.varName]);}
else{var cookieName=mtvn.btg.util.String.isDefined(_config.cookieName)?_config.cookieName:"mtvn_btg_"+_config.varName;var cookie=mtvn.btg.util.Cookie.read(cookieName);if(mtvn.btg.util.String.isDefined(cookie)){cookie=cookie.replace(/\+/gim,";");data[_config.varName]=cookie;}}}
return data;},saveToCookie:function(config,value){if(typeof value=="string"&&typeof config.varName=="string"){value=value.replace(/\;/gim,"+");var varName=config.varName;var cookieName=typeof config.cookieName=="string"?config.cookieName:"mtvn_btg_"+varName;var neverDie=typeof config.neverDie=="boolean"?config.neverDie:0;var appendOnly=typeof config.appendOnly=="boolean"||typeof config.appendOnly=="number"?config.appendOnly:0;if(appendOnly){var cookie=mtvn.btg.util.Cookie.read(cookieName);if(mtvn.btg.util.String.isDefined(cookie)){values=value.split(",");for(v=0;v<values.length;v++){var current_value=values[v];if(!mtvn.btg.util.String.isDefined(current_value))continue;if(cookie.indexOf(current_value)>-1)continue;if(cookie.length>0)cookie+=",";cookie+=current_value;}
value=cookie;}}
var year=new Date().getYear();var expy=neverDie?"Thu, 01-Jan-"+(year+10)+" 23:59:59 GMT":null;mtvn.btg.util.Cookie.set(cookieName,value,expy);}
return mtvn.btg.util.String.isDefined(value)?value.replace(/\+/gim,";"):null;}}}
mtvn.btg.util.String={isDefined:function(value){if(typeof value==='undefined'||value===null||value==''||value==='undefined'){return false;}else{return true;}},random:function(length){var chars='ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';var string='';length=length?length:8;for(var x=0;x<length;x++){var num=Math.floor(Math.random()*chars.length);string+=chars.substring(num,num+1);}
return string;},toObject:function(string,delimiter){var delimiter=delimiter?delimiter:',';var array=string.split(delimiter);var object={};for(var x=0;x<array.length;x++){var pairs=array[x].split('=');object[pairs[0]]=pairs[1];}
return object;},queryStringToObject:function(string){var string=string.indexOf('?')>-1?string.split('?')[1]:string;return this.toObject(string,'&');},stripFileExtension:function(string){var lastIndex=string.lastIndexOf('.');if(lastIndex>0){return string.substring(0,lastIndex);}else{return string;}},charLtrim:function(string,character){var trimIndex=string.indexOf(character)
if(trimIndex==0){string=string.substring(1);}
return string;},charRtrim:function(string,character){var trimIndex=string.lastIndexOf(character);var stringLength=string.length;if(trimIndex==stringLength-1){string=string.substring(0,stringLength-1);}
return string;},charTrim:function(string,character){string=this.charLtrim(string,character);string=this.charRtrim(string,character);return string;},mockItUp:function(string){string=string.replace(/[<]/g,"&lt;");string=string.replace(/[>]/g,"&gt;");return string;},getFileName:function(a_pathString){var retVal=(mtvn.btg.util.String.isDefined(a_pathString))?a_pathString:'';retVal=retVal.substring(retVal.lastIndexOf('/')+1);return retVal;}};mtvn.btg.util.Window={getNodeLinkName:function(node){var linkName=null;for(var x=0;x<node.childNodes.length;x++){var childnode=node.childNodes[x];switch(childnode.nodeType){case 3:linkName=childnode.nodeValue;break;case 1:if(node.attributes['title']&&node.attributes['title'].nodeValue!=''){linkName=node.attributes['title'].nodeValue;}else if(node.attributes['alt']&&node.attributes['alt'].nodeValue!=''){linkName=node.attributes['alt'].nodeValue;}
break;};}
return linkName;},debug:function(message){var debugElement=document.getElementById("debug");if(!debugElement){debugElement=document.createElement("div");debugElement.setAttribute("id","debug");document.getElementsByTagName("body")[0].appendChild(debugElement);}
debugElement.innerHTML=debugElement.innerHTML+message+"<br>";}};mtvn.btg.reporting.ComScore=function(config){var isDefined=mtvn.btg.util.String.isDefined;this.config=config;this.c1=(isDefined(this.config.c1))?this.config.c1:"2";this.c2=(isDefined(this.config.c2))?this.config.c2:"6036034";this.c3=(isDefined(this.config.c3))?this.config.c3:'';this.c4=(isDefined(this.config.c4))?this.config.c4:(mtvn.btg.util.Object.isDefined(mtvn.btg.util.Sections))?mtvn.btg.util.Sections.getReportingSections():(mtvn.btg.globalvars.IS_TOP_ACCESSIBLE)?escape(top.document.location.hostname+top.document.location.pathname):escape(document.location.hostname+document.location.pathname);this.c5=(isDefined(this.config.c5))?this.config.c5:'20000';this.c6=(isDefined(this.config.c6))?this.config.c6:'';this.c15=(isDefined(this.config.c15))?this.config.c15:'';};mtvn.btg.reporting.ComScore.prototype={sendPageCall:function(data){var isDefined=mtvn.btg.util.String.isDefined;if(typeof(data)==='object'){if(isDefined(data.comScore1))this.c1=data.comScore1;if(isDefined(data.comScore2))this.c2=data.comScore2;if(isDefined(data.comScore3))this.c3=data.comScore3;if(isDefined(data.comScore4))this.c4=data.comScore4;if(isDefined(data.comScore5))this.c5=data.comScore5;if(isDefined(data.comScore6))this.c6=data.comScore6;if(isDefined(data.comScore15))this.c15=data.comScore15;}
var cs_params=["c1=",this.c1,"&c2=",this.c2,"&c3=",this.c3,"&c4=",this.c4,"&c5=",this.c5,"&c6=",this.c6,"&c15=",this.c15].join('');try{if(!mtvn.btg.globalvars.IS_UNIT_TEST&&!mtvn.btg.reporting.ReportingManager.isScriptIncluded.comscore){document.write(unescape("%3Cscript src='"+(document.location.protocol=="https:"?"https://sb":"http://b")+".scorecardresearch.com/beacon.js?"+cs_params+"' %3E%3C/script%3E"));mtvn.btg.reporting.ReportingManager.isScriptIncluded.comscore=true;}}catch(e){}}};mtvn.btg.reporting.FluxHosted={sendCall:function(){var _chkContextObjectExists=function(){if(typeof Flux!="object"||typeof Flux.Context!="object")return false;return true;};var _chkCommunityObjectsExist=function(){if(typeof FluxReporting!="object"||typeof FluxReporting.Standard!="object")return false;return true;};var _getMemberState=function(){if(!_chkContextObjectExists())return null;return Flux.Context.isCommunityMember()?"member":"non-member";};var _getLoginState=function(){if(!_chkContextObjectExists())return null;return Flux.Context.isUserAuthenticated()?"logged-in":"not logged-in";};var _mapVars=function(){var _data={};if(!_chkContextObjectExists()&&!_chkCommunityObjectsExist())return false;var pageName=location.pathname.substring(1);pageName=pageName=="/"||pageName==""?"main.aspx":pageName;pageName=pageName.substring(0,2)=='-/'?pageName.substring(2):pageName;var pathsToTrim=["/profile","/Topic"];for(i=0;i<pathsToTrim.length;i++){if(pageName.indexOf(pathsToTrim[i])>-1){pageName=pageName.substring(0,pageName.indexOf(pathsToTrim[i])+pathsToTrim[i].length);}}
_data["pageName"]=_data["hier1"]=pageName;if(_chkContextObjectExists()){_data["prop10"]=_data["eVar10"]=_getMemberState();_data["prop11"]=_data["eVar11"]=_getLoginState();};if(_chkCommunityObjectsExist()){_data["prop3"]=_data["eVar3"]=(mtvn.btg.util.String.isDefined(FluxReporting.Standard.Community_Name)?FluxReporting.Standard.Community_Name:null);_data["prop4"]=_data["eVar4"]=(mtvn.btg.util.String.isDefined(FluxReporting.Standard.Content_UCID)?FluxReporting.Standard.Content_UCID:null);_data["prop5"]=_data["eVar5"]=(mtvn.btg.util.String.isDefined(FluxReporting.Standard.Content_Title)?FluxReporting.Standard.Content_Title:null);_data["prop6"]=_data["eVar6"]=(mtvn.btg.util.String.isDefined(FluxReporting.Standard.Content_Section)?FluxReporting.Standard.Content_Section:null);_data["prop7"]=_data["eVar7"]=(mtvn.btg.util.String.isDefined(FluxReporting.Standard.Content_Page)?FluxReporting.Standard.Content_Page:null);_data["prop8"]=_data["eVar8"]=(mtvn.btg.util.String.isDefined(FluxReporting.Standard.Content_Details)?FluxReporting.Standard.Content_Details:null);_data["prop9"]=_data["eVar9"]=(mtvn.btg.util.String.isDefined(FluxReporting.Standard.Content_Subtype)?FluxReporting.Standard.Content_Subtype:null);};_data["prop12"]=_data["eVar12"]=location.host;if(typeof FluxReporting.Overrides!="undefined"){for(i in FluxReporting.Overrides){_data[i]=FluxReporting.Overrides[i];}}
return _data;};var data=_mapVars();var oldConfig=mtvn.btg.config.ReportSettings;mtvn.btg.config.ReportSettings={Omniture:{enabled:true,account:'viafluxrollup',dynamicAccountSelection:'true',dynamicAccountList:'viafluxrollupdev=mtv-d,mtv-q,mtvi.com',linkInternalFilters:'javascript:,flux.com,mtvi.com,'+location.hostname,trackExternalLinks:true,trackDownloadLinks:true,isFluxHosted:true},GoogleAnalytics:{enabled:false},Comscore:{enabled:false},QuantCast:{enabled:false},Nielsen:{enabled:false}};mtvn.btg.Controller.init();mtvn.btg.Controller.sendPageCall(data);mtvn.btg.config.ReportSettings=oldConfig;return true;}};if(typeof FluxReporting!="undefined"){mtvn.btg.util.Events.addListener(window,"load",function(){mtvn.btg.reporting.FluxHosted.sendCall();})};mtvn.btg.reporting.FluxState=new function(){var _chkFluxVersion=function(){if(typeof Flux!="object"||Flux==null){return null;}
else if(typeof Flux.context=="object"&&Flux.context!=null&&typeof Flux.context.user=="object"&&Flux.context.user!=null){return 3;}
else if(typeof Flux.Context=="object"&&Flux.Context!=null){return 2;}
return null;};var _getMemberState=function(){var fv=_chkFluxVersion();var memberState=null;switch(fv){case 3:memberState=Flux.context.user.communityMember;break;case 2:memberState=Flux.Context.isCommunityMember();break;}
return memberState?"member":"non-member";};var _getLoginState=function(context){var fv=_chkFluxVersion();var loginState=null;switch(fv){case 3:if(Flux.context.user.facebookOnly){loginState="FB Only";mtvn.btg.reporting.UserSegment.add(context,"FB Connect Only User");}
else if(Flux.context.user.facebookConnected){loginState="Flux + FB";mtvn.btg.reporting.UserSegment.add(context,"Flux & FB Connect User");}
else if(typeof Flux.context.user.ucid=="string"&&Flux.context.user.ucid.length>0){loginState="Flux Only";mtvn.btg.reporting.UserSegment.add(context,"Flux Only User");}
else loginState="not logged-in";break;case 2:loginState=Flux.Context.isUserAuthenticated()?"logged-in":"not logged-in";break;default:loginState="not logged-in";}
if(loginState&&loginState!="not logged-in")mtvn.btg.reporting.UserSegment.add(context,"LoggedIn");return loginState;};this.setData=function(context,data){data[context.config.fluxVarMap.memberState]=_getMemberState();data[context.config.fluxVarMap.loginState]=_getLoginState(context);return data;};};mtvn.btg.reporting.GoogleAnalytics=function(config){this.config=config;if(config.reportMode=='iframe'){document.write(unescape("%3Cdiv id='btg_ga_div'%3E%3C/div%3E"));}else{var gaJsHost=(("https:"==document.location.protocol)?"https://ssl.":"http://www.");if(!mtvn.btg.globalvars.IS_UNIT_TEST&&!mtvn.btg.reporting.ReportingManager.isScriptIncluded.googleAnalytics){document.write(unescape("%3Cscript src='"+gaJsHost+"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));mtvn.btg.reporting.ReportingManager.isScriptIncluded.googleAnalytics=true;}}
this.account=config.account;};mtvn.btg.reporting.GoogleAnalytics.prototype={sendPageCall:function(data){if(this.config.reportMode=='iframe'){var _div=document.getElementById("btg_ga_div");var _wl=window.location;var uri=data.pageName;var _uri=uri.substring(0,1)!="/"?"/"+uri:uri;var _refer=document.referrer;var _ga="//media.mtvnservices.com/metrics/ga.html?uri=";_refer="&ref="+escape(_refer);if(_div){var newChild=document.createElement("iframe");newChild.src=_wl.protocol+_ga+_wl.hostname+_uri+_refer;newChild.style.width=1+'px';newChild.style.height=1+'px';newChild.style.visibility='hidden';newChild.style.left=-50+'px';newChild.style.top=-50+'px';newChild.style.position='absolute';_div.appendChild(newChild);}}else{try
{if(!mtvn.btg.globalvars.IS_UNIT_TEST){document.write(unescape("%3Cscript type='text/javascript'%3E")+'var pageTracker = _gat._getTracker("'+this.account+'");pageTracker._trackPageview("'+data.pageName+'");'+unescape("%3C/script%3E"));}}
catch(e){}}}};mtvn.btg.reporting.MediaPlayer={context:null,init:function(context){this.context=context;},players:[],addPlayer:function(id){this.players[id]=new this.Player(id);return this.players[id];},Player:function(id){var config=mtvn.btg.config.ReportSettings;this.id=id;this.lastGuid=null;this.swf=null;this.onLoaded=function(){this.swf=document.getElementById(this.id);this.swf.addEventListener('METADATA','mtvn.btg.reporting.MediaPlayer.players[\"'+this.id+'\"].onMetaData');this.swf.addEventListener('ENDSLATE_CLICK','mtvn.btg.reporting.MediaPlayer.players[\"'+this.id+'\"].onEndslateLoad');};this.onMetaData=function(metadata){if(location.search.match(/showMetaData\=true/)){str="";for(m in metadata)str+=m+": "+metadata[m]+"\n";alert(this.lastGuid+"\n\n\n"+str);};var esCampaign="";var url=document.location.search;var isEndSlate=(url.toLowerCase().indexOf("xrs=mpes_")!=-1?true:false);if(isEndSlate){var paramArr=url.replace(/^\?/g,'').split("&");for(var i=0;i<paramArr.length;i++){if(paramArr[i].split('=')[0]=='xrs'){esCampaign=(mtvn.btg.util.String.isDefined(paramArr[i].split('=')[1])?paramArr[i].split('=')[1]:"");}}}
if(metadata["guid"]&&this.lastGuid!==metadata["guid"]){var _data={linkName:"Video View",linkType:"o",eVar28:metadata["contentType"],events:"event15",campaign:esCampaign};if(typeof mtvn.btg.reporting.UserSegment!="undefined"){mtvn.btg.reporting.UserSegment.add(mtvn.btg.reporting.MediaPlayer.context,"VideoViewer");}
if(typeof mtvn.btg.config.ReportSettings.Omniture.videoViewEventDisable!="undefined"&&mtvn.btg.config.ReportSettings.Omniture.videoViewEventDisable){_data.events="";}
mtvn.btg.Controller.sendLinkEvent(_data);};this.lastGuid=metadata["guid"];};this.onEndslateLoad=function(){var _data={linkName:"Endslate View",linkType:"o"};if(typeof mtvn.btg.reporting.UserSegment!="undefined"){mtvn.btg.reporting.UserSegment.add(mtvn.btg.reporting.MediaPlayer.context,"EndslateViewer");}
mtvn.btg.Controller.sendLinkEvent(_data);};},onWindowLoaded:function(e){var oldMtvnPlayerLoaded=window["mtvnPlayerLoaded"];var mtvnPlayerLoaded=function(id){if(typeof oldMtvnPlayerLoaded!="undefined")oldMtvnPlayerLoaded(id);if(typeof document.getElementById(id)=="undefined")return;mtvn.btg.reporting.MediaPlayer.addPlayer(id);mtvn.btg.reporting.MediaPlayer.players[id].onLoaded();};window["mtvnPlayerLoaded"]=mtvnPlayerLoaded;}};try{mtvn.btg.util.Events.addListener(window,"load",mtvn.btg.reporting.MediaPlayer.onWindowLoaded);}catch(e){}
mtvn.btg.reporting.Nielsen=function(config){var isDefined=mtvn.btg.util.String.isDefined;this.config=config;this.url="http://secure-us.imrworldwide.com/cgi-bin/m";};mtvn.btg.reporting.Nielsen.prototype={formatData:function(data){var retVal={};var isDefined=mtvn.btg.util.String.isDefined;var data=(isDefined(data)?data:{});this.ci=(isDefined(data.nielsen_cid))?data.nielsen_cid:(isDefined(this.config.cid))?this.config.cid:"";if(isDefined(this.ci)){retVal.ci=this.ci;retVal.cg=(isDefined(data.nielsen_content))?data.nielsen_content:(isDefined(this.config.content))?this.config.content:"0";retVal.ca=(isDefined(data.nielsen_campaign))?data.nielsen_campaign:(isDefined(this.config.campaign))?this.config.campaign:"";retVal.cr=(isDefined(data.nielsen_creative))?data.nielsen_creative:(isDefined(this.config.creative))?this.config.creative:"";retVal.ce=(isDefined(data.nielsen_execution))?data.nielsen_execution:(isDefined(this.config.execution))?this.config.execution:"";retVal.pc=(isDefined(data.nielsen_placement))?data.nielsen_placement:(isDefined(this.config.placement))?this.config.placement:"";retVal.rt=(isDefined(data.nielsen_result))?data.nielsen_result:(isDefined(this.config.result))?this.config.result:"";retVal.rf=(isDefined(data.nielsen_resultFlag))?data.nielsen_resultFlag:(isDefined(this.config.resultFlag))?this.config.resultFlag:"";retVal.rv=(isDefined(data.nielsen_revenue))?data.nielsen_revenue:(isDefined(this.config.revenue))?this.config.revenue:"";retVal.ou=(isDefined(data.nielsen_ownership))?data.nielsen_ownership:(isDefined(this.config.ownership))?this.config.ownership:"";retVal.sd=(isDefined(data.nielsen_streamDuration))?data.nielsen_streamDuration:(isDefined(this.config.streamDuration))?this.config.streamDuration:"";retVal.pg=(isDefined(data.nielsen_primaryGroup))?data.nielsen_primaryGroup:(isDefined(this.config.primaryGroup))?this.config.primaryGroup:"";retVal.si=(isDefined(data.nielsen_pageName))?data.nielsen_pageName:(isDefined(this.config.pageName))?this.config.pageName:document.location.href;retVal.rp=(isDefined(data.nielsen_referrer))?data.nielsen_referrer:(isDefined(this.config.referrer))?this.config.referrer:document.referrer;retVal.ss=(isDefined(data.nielsen_sampleSize))?data.nielsen_sampleSize:(isDefined(this.config.sampleSize))?this.config.sampleSize:"";retVal.sv=(isDefined(data.nielsen_survey))?data.nielsen_survey:(isDefined(this.config.survey))?this.config.survey:"";retVal.rnd=new Date().getTime();}
return retVal;},sendPageCall:function(data){var isDefined=mtvn.btg.util.String.isDefined;var beacon=new mtvn.btg.util.Beacon(this.url);beacon.setData(this.formatData(data));if(isDefined(this.ci))beacon.send();}};mtvn.btg.reporting.Omniture=function(config){this.pageViewEventSet=false;this.name="Omniture";this.values=[];this.newRepeatProp=mtvn.btg.util.String.isDefined(config.newRepeatProp)?config.newRepeatProp:"prop41";this.config=config;this.hcode=mtvn.btg.reporting.omniture.Hcode;this.hcode.setAccount(this.config.account);for(var i in this.config)this.hcode[i]=this.config[i];this.url="http"+(this.hcode.ssl?"s":"")+"://"+this.hcode.un+".112.2o7.net/b/ss/"+this.hcode.un+"/1/";if(typeof this.config.userSegmentVarMap=="undefined"){this.config.userSegmentVarMap={traffic:"prop31",commerce:"products"}
mtvn.btg.config.ReportSettings.Omniture.userSegmentVarMap=this.config.userSegmentVarMap;}
if(typeof mtvn.btg.reporting.UserSegment=="object")
mtvn.btg.reporting.UserSegment.init(this);if(typeof this.config.fluxVarMap=="undefined"){this.config.fluxVarMap={memberState:"prop5",loginState:"prop6"}
mtvn.btg.config.ReportSettings.Omniture.fluxVarMap=this.config.fluxVarMap;}
if(typeof this.config.timePartingVarMap=="undefined"){this.config.timePartingVarMap={trafficDay:"prop33",trafficHour:"prop34",commerceDay:"eVar45",commerceHour:"eVar46"}}
if(typeof this.config.ESIVarMap=="undefined"){this.config.ESIVarMap={asnum:"eVar47",network:"eVar48"}}
if(typeof this.config.pageViewEvent!="string"){this.config.pageViewEvent="event16";};if(typeof mtvn.btg.reporting.Search=="object")
mtvn.btg.reporting.Search.init(this);if(typeof mtvn.btg.reporting.MediaPlayer=="object")
mtvn.btg.reporting.MediaPlayer.init(this);if(typeof this.config.sessionVars!="undefined")mtvn.btg.util.Session.Variables.add(this.config.sessionVars);};mtvn.btg.reporting.Omniture.prototype={setAttribute:function(k,v){if(mtvn.btg.util.String.isDefined(k)){this.hcode[k]=(mtvn.btg.util.String.isDefined(v)?v:'');return true;}
else{return false;}},getAttribute:function(k){return this.hcode[k];},setValues:function(data){for(var i in data){this.setAttribute(i,data[i]);this.values.push(i);}
return true;},clearValues:function(){for(x=0;x<this.values.length;x++){if(this.values[x]!="pageName"){this.setAttribute(this.values[x],"");}}
this.clearNewRepeat();this.values=this.getPageName()?["pageName"]:[];return true;},setNewRepeat:function(){this.setAttribute(this.newRepeatProp,this.hcode.getNewRepeat());return true;},clearNewRepeat:function(){this.setAttribute(this.newRepeatProp,"");return true;},getValOnce:function(v,c,e){return this.hcode.getValOnce(v,c,e);},getNewRepeat:function(){return this.hcode.getNewRepeat();},getPageName:function(){return this.getAttribute("pageName");},preprocessData:function(data){if(typeof mtvn.btg.reporting.UserSegment!="undefined"){data=mtvn.btg.reporting.UserSegment.setData(this,data);}
data=mtvn.btg.util.Session.Variables.setData(data);return data;},sendPageCall:function(data){data=typeof data!="object"?{}:data;if(typeof data.pageName!="string"||data.pageName==""){data.pageName=typeof this.hcode.pageName==="string"&&this.hcode.pageName!=""?this.hcode.pageName:mtvn.btg.config.ReportSettings._defaultPageName;}
if(typeof this.config.noPagenameSlash!="undefined"&&this.config.noPagenameSlash&&data.pageName.charAt(0)=="/"){data.pageName=data.pageName.substring(1);}
if(typeof this.config.defaultHier=="string"&&this.config.defaultHier!=""){if(typeof data[this.config.defaultHier]!=="string"||data[this.config.defaultHier]==""){if(this.hcode[this.config.defaultHier]==="string"&&this.hcode[this.config.defaultHier]!="")
var _hier=this.hcode[this.config.defaultHier];else if(typeof data.docHierarchy==="string"&&data.docHierarchy!="")
var _hier=data.docHierarchy;else var _hier=data.pageName;if(_hier.charAt(_hier.length-1)=="/"){if(typeof mtvn.btg.config.ReportSettings.indexFileName==="string")
data[this.config.defaultHier]=_hier+mtvn.btg.config.ReportSettings.indexFileName;else
data[this.config.defaultHier]=_hier+"index";}
else data[this.config.defaultHier]=_hier;data[this.config.defaultHier]=mtvn.btg.util.String.charLtrim(data[this.config.defaultHier],"/");}}
if(typeof data.channel!="string"||data.channel==""){if(typeof this.hcode.channel=="string"){data.channel=this.hcode.channel;}
else if(data.pageName=="/"){data.channel=data.pageName;}else{var parts=data.pageName.split("/");for(var p=0;p<parts.length;p++){if(parts[p]!=""){data.channel=parts[p];break;}}}}
if(typeof data.channel=="string")data["eVar49"]=data["channel"];if(typeof mtvn.btg.reporting.SEO!="undefined")data=mtvn.btg.reporting.SEO.setData(this,data);if(typeof mtvn.btg.reporting.BrowserToolbar!="undefined")data=mtvn.btg.reporting.BrowserToolbar.setData(this,data);if((typeof this.config.isFluxHosted=="undefined"||(typeof this.config.isFluxHosted!="undefined"&&this.config.isFluxHosted!=true))&&typeof mtvn.btg.reporting.FluxState!="undefined")data=mtvn.btg.reporting.FluxState.setData(this,data);if(typeof mtvn.btg.reporting.Search!="undefined")data=mtvn.btg.reporting.Search.setData(data);if(typeof mtvn.btg.reporting.Photos!="undefined")data=mtvn.btg.reporting.Photos.setData(this,data);if(typeof mtvn.btg.reporting.Search!="undefined")data=mtvn.btg.reporting.Search.chkConversions(data);if(typeof mtvn.btg.reporting.RecsABTesting!="undefined")data=mtvn.btg.reporting.RecsABTesting.setData(this,data);if(typeof mtvn.btg.reporting.ESIVars!="undefined")data=mtvn.btg.reporting.ESIVars.setData(this,data);if(typeof this.config.enableTimeParting!="undefined"&&this.config.enableTimeParting==true&&typeof this.config.timePartingVarMap!="undefined"){var now=new Date();var year=now.getYear();year=year<2000?year+=1900:year;var tz=(now.getTimezoneOffset()/-60);data[this.config.timePartingVarMap.commerceHour]=data[this.config.timePartingVarMap.trafficHour]=this.hcode.getTimeParting('h',tz,year);data[this.config.timePartingVarMap.commerceDay]=data[this.config.timePartingVarMap.trafficDay]=this.hcode.getTimeParting('d',tz,year);}
if(!this.pageViewEventSet){var _events=typeof data["events"]==="string"?data["events"]:"";if(typeof this.config.pageViewEvent==="string"&&_events.indexOf(this.config.pageViewEvent)<0){if(_events!="")_events+=",";_events+=this.config.pageViewEvent;data["events"]=_events;this.pageViewEventSet=true;}}
this.preprocessData(data);this.setValues(data);this.setNewRepeat();this.attachLoggedEvent();this.hcode.t();this.clearValues();return true;},sendLinkEvent:function(data){data=typeof data!="object"?{}:data;var sessionPageName=this.getPageName();data.lnk=data.lnk?this.hcode.co(data.lnk):true;data.linkType=data.linkType?data.linkType:"o";data.referrer=location.href;this.preprocessData(data);this.setValues(data);this.setAttribute("pageName","");this.attachLoggedEvent();this.hcode.t();this.clearValues();this.setAttribute("pageName",sessionPageName);return true;},setAccountVars:function(o){this.setAttribute("un",o.name);this.setAttribute("dynamicAccountSelection",o.dynamic);this.setAttribute("dynamicAccountList",o.list);this.setAttribute("linkInternalFilters",o.filters);this.setAttribute("charSet",o.chartset);for(var i in o){if(mtvn.btg.util.String.isDefined(i))
this.setAttribute(i,(mtvn.btg.util.String.isDefined(o[i])?o[i]:''));};},logEvent:function(data){if(mtvn.btg.util.String.isDefined(data)){if(mtvn.btg.util.String.isDefined(data['UIEvent'])){mtvn.btg.util.Cookie.set('UIEvent',data['UIEvent']);}
if(mtvn.btg.util.String.isDefined(data['UIEventName'])){mtvn.btg.util.Cookie.set('UIEventName',data['UIEventName']);}
if(mtvn.btg.util.String.isDefined(data['UITrackingCode'])){mtvn.btg.util.Cookie.set('UITrackingCode',data['UITrackingCode']);}}},attachLoggedEvent:function(){if(mtvn.btg.util.String.isDefined(mtvn.btg.util.Cookie.read('UIEvent'))){this.setAttribute('events',mtvn.btg.util.Cookie.read('UIEvent'));mtvn.btg.util.Cookie.remove('UIEvent');}
if(mtvn.btg.util.String.isDefined(mtvn.btg.util.Cookie.read('UIEventName'))){this.setAttribute('eVar40',mtvn.btg.util.Cookie.read('UIEventName'));mtvn.btg.util.Cookie.remove('UIEventName');}
if(mtvn.btg.util.String.isDefined(mtvn.btg.util.Cookie.read('UITrackingCode'))){this.setAttribute('campaign',mtvn.btg.util.Cookie.read('UITrackingCode'));mtvn.btg.util.Cookie.remove('UITrackingCode');}
return true;},clearAllVars:function(){for(var i=1;i<=50;i++){this.setAttribute("eVar"+i,'');this.setAttribute("prop"+i,'');if(i<6){this.setAttribute("hier"+i,"");}}
this.setAttribute("pageName","");this.setAttribute("channel","");return true;}};mtvn.btg.reporting.QuantCast=function(config){this.labels="";this.config=config;var _qacct="p-94wNw88f65Rhk";var qcHost=(("https:"==document.location.protocol)?"https://secure":"http://edge");if(!mtvn.btg.globalvars.IS_UNIT_TEST&&!mtvn.btg.reporting.ReportingManager.isScriptIncluded.quantcast)
{document.write(unescape("%3Cscript src='"+qcHost+".quantserve.com/quant.js' type='text/javascript'%3E%3C/script%3E"));if(!mtvn.btg.util.String.isDefined(mtvn.btg.util.Cookie.read('qcDemo'))){document.write(unescape("%3Cscript src='"+"http://pixel.quantserve.com/api/segments.json?a="+_qacct+"&callback=mtvn.btg.reporting.QuantCast.Ads.setCookieDemoTargetVal' type='text/javascript'%3E%3C/script%3E"));}
mtvn.btg.reporting.ReportingManager.isScriptIncluded.quantcast=true;}
this.labels=this.config.labels;};mtvn.btg.reporting.QuantCast.prototype={sendPageCall:function(data){if(this.config.reportMode=='direct')
{try
{_qoptions={labels:this.labels};_qacct="p-94wNw88f65Rhk";quantserve();}
catch(e){};}}};mtvn.btg.reporting.QuantCast.Ads=new function(){this.setLabels=function(data,adsections){try{var _labels="";var dartSite="";var sections="";dartSite=data.dartSite.replace(/\./g,'_');sections=adsections.replace(/^\//m,'');sections=sections.replace(/\//g,'.');_labels=mtvn.btg.config.ReportSettings.QuantCast.labels+",Viacom Global Digital Network.MTVN Digital Ad Sales.Content.Pages."+dartSite+"."+sections;_qoptions={labels:_labels};_qacct="p-94wNw88f65Rhk";quantserve();}
catch(e){};};this.setCookieDemoTargetVal=function(result){var demoTokenStr=[];for(var i=0;i<result.segments.length;i++)
demoTokenStr[i]="demo="+result.segments[i].id;mtvn.btg.util.Cookie.set('qcDemo',escape(demoTokenStr.join(";")));};};mtvn.btg.reporting.ReportingManager=new function(){var hasOmniture=false;var hasNielsen=false;var hasQuantCast=false;var hasComScore=false;var hasGoogleAnalytics=false;var pageName;var config;var omniture;var nielsen;var quantcast;var comscore;var googleAnalytics;this.isScriptIncluded={comscore:false,quantcast:false,googleAnalytics:false};this.init=function(){config=mtvn.btg.config.ReportSettings;if(config.Omniture){if(config.Omniture.enabled){omniture=new mtvn.btg.reporting.Omniture(config.Omniture);hasOmniture=true;}}
if(config.Nielsen){if(config.Nielsen.enabled){nielsen=new mtvn.btg.reporting.Nielsen(config.Nielsen);hasNielsen=true;}}
if(config.GoogleAnalytics){if(config.GoogleAnalytics.enabled){googleAnalytics=new mtvn.btg.reporting.GoogleAnalytics(config.GoogleAnalytics);hasGoogleAnalytics=true;}}
if(config.QuantCast){if(config.QuantCast.enabled){quantcast=new mtvn.btg.reporting.QuantCast(config.QuantCast);hasQuantCast=true;}}
if(config.ComScore){if(config.ComScore.enabled){comscore=new mtvn.btg.reporting.ComScore(config.ComScore);hasComScore=true;}}};this.sendPageCall=function(data){if(hasOmniture){omniture.sendPageCall(data);pageName=omniture.getPageName();}
if(hasNielsen){nielsen.sendPageCall(data);}
if(hasQuantCast){quantcast.sendPageCall(data);}
if(hasGoogleAnalytics){googleAnalytics.sendPageCall(data);}
if(hasComScore){comscore.sendPageCall(data);}};this.sendLinkEvent=function(data){if(hasOmniture){omniture.sendLinkEvent(data);}};this.getData=function(){return{pageName:pageName};};};mtvn.btg.reporting.Search={events:"",init:function(context){this.context=context;},setData:function(_data){if(typeof com_mtvi_SSDC!="object")return _data;var linkTrackVars="events,prop31";this._setEvent("event36");_data["eVar3"]=typeof com_mtvi_SSDC.srchtype=="string"?com_mtvi_SSDC.srchtype:"GENERAL";if(typeof com_mtvi_SSDC.srchsyn!="undefined"){this._setEvent("event33");if(typeof com_mtvi_SSDC.srchsyn=="object"){for(s=0;s<com_mtvi_SSDC.srchsyn.length;s++)com_mtvi_SSDC.srchsyn[s]=com_mtvi_SSDC.srchsyn[s].replace(/\,/,"");com_mtvi_SSDC.srchsyn=com_mtvi_SSDC.srchsyn.join(",");}
_data["eVar2"]=com_mtvi_SSDC.srchterm;_data["eVar36"]=com_mtvi_SSDC.srchsyn;linkTrackVars+=",eVar36";}
else if(typeof com_mtvi_SSDC.srchterm=="string"){this._setEvent("event38");_data["eVar2"]=com_mtvi_SSDC.srchterm;linkTrackVars+=",eVar2";}
else if(typeof com_mtvi_SSDC.srchfail=="string"){this._setEvent("event37");_data["eVar4"]=typeof com_mtvi_SSDC.appfailure=="boolean"&&com_mtvi_SSDC.appfailure?"APP_FAILURE":com_mtvi_SSDC.srchfail;linkTrackVars+=",eVar4";}
mtvn.btg.reporting.UserSegment.add(this.context,"SiteSearcher");_data["linkTrackVars"]=linkTrackVars;_data["linkTrackEvents"]=this.events;return _data;},sendLinkEvent:function(){if(!com_mtvi_SSDC)return false;var _data={linkName:"SITE_SEARCH_RESULTS",linkType:"o"}
_data=this.setData(_data);mtvn.btg.Controller.sendLinkEvent(_data);return true;},_setEvent:function(evt){if(this.events.indexOf(evt)<0){if(this.events!="")this.events+=",";this.events+=evt;}
return this.events;},chkConversions:function(_data){if(typeof _data.events=="string")this.events=_data.events;if(mtvn.btg.util.Cookie.read("mtvn_btg_SSDC_conv")){this._setEvent("event35");mtvn.btg.util.Cookie.remove("mtvn_btg_SSDC_conv");}
if(mtvn.btg.util.Cookie.read("mtvn_btg_SSDC_syn_conv")){this._setEvent("event34");mtvn.btg.util.Cookie.remove("mtvn_btg_SSDC_syn_conv");}
if(mtvn.btg.util.Cookie.read("mtvn_btg_SSDC_typeahead_conv")){this._setEvent("event39");mtvn.btg.util.Cookie.remove("mtvn_btg_SSDC_typeahead_conv");}
_data.events=this.events;return _data;},setConversion:function(){mtvn.btg.util.Cookie.set("mtvn_btg_SSDC_conv",1);},setSynConversion:function(){mtvn.btg.util.Cookie.set("mtvn_btg_SSDC_syn_conv",1);},setTypeAheadConversion:function(){mtvn.btg.util.Cookie.set("mtvn_btg_SSDC_typeahead_conv",1);}};mtvn.btg.reporting.SEO={setData:function(context,data){this.setUserSegments(context);return data;},setUserSegments:function(context){var engines=[["google.com","GoogleUser"],["msn.com","MSNUser"],["yahoo.com","YahooUser"]];for(e=0;e<engines.length;e++){var referrer=document.referrer;if(referrer.indexOf(engines[e][0])>-1){if(typeof mtvn.btg.reporting.UserSegment!="undefined"){mtvn.btg.reporting.UserSegment.add(context,engines[e][1]);}}}}};mtvn.btg.reporting.UserSegment={init:function(context){context._UserSegment={};context._UserSegment.segments=[];if(typeof mtvn.btg.util.Session=="object"){mtvn.btg.util.Session.Variables.add([{varName:context.config.userSegmentVarMap.traffic,appendOnly:1},{varName:context.config.userSegmentVarMap.commerce,appendOnly:1}]);}
return true;},add:function(context,segment){for(s=0;s<context._UserSegment.segments.length;s++){if(context._UserSegment.segments[s]==segment)return false;}
context._UserSegment.segments[context._UserSegment.segments.length]=segment;return true;},getArr:function(context){return context._UserSegment.segments},getStr:function(context,pre,post){if(!pre)pre="";if(!post)post="";var str=typeof context._UserSegment.segments=="object"&&context._UserSegment.segments.length>0?pre+context._UserSegment.segments.join(post+","+pre)+post:null;return str;},setData:function(context,data){data[context.config.userSegmentVarMap.traffic]=this.getStr(context);data[context.config.userSegmentVarMap.commerce]=this.getStr(context,";");return data;}}
mtvn.btg.reporting.RecsABTesting={setData:function(context,data){var vendorCookie=mtvn.btg.util.Cookie.read("RecsVendor");if(mtvn.btg.util.String.isDefined(vendorCookie)){var segment=null;switch(vendorCookie){case"0":segment="RecsAB_ChoiceStream";break;case"1":segment="RecsAB_Control";break;}
if(segment)
mtvn.btg.reporting.UserSegment.add(context,segment);}
if(mtvn.btg.util.String.isDefined(mtvn.btg.util.Cookie.read("RecsConversion"))){mtvn.btg.reporting.UserSegment.add(context,"RecsAB_ChoiceStream_Clickthrough");if(typeof data["events"]==="string"&&data["events"].length>0)data["events"]+=",event40";else data["events"]="event40";mtvn.btg.util.Cookie.remove("RecsConversion");}
return data;},setConversion:function(){mtvn.btg.util.Cookie.set("RecsConversion",1);}};mtvn.btg.reporting.ESIVars=new function(){var _chkObjectExists=function(){if(typeof mtvn_btg_ESIVars!="object")return false;return true;};this.setData=function(context,data){if(!_chkObjectExists())return data;if(typeof context.config.ESIVarMap.network=="string")mtvn.btg.reporting.UserSegment.add(context,mtvn_btg_ESIVars.network);if(typeof context.config.ESIVarMap.asnum=="string")data[context.config.ESIVarMap.asnum]=mtvn_btg_ESIVars.asnum;if(typeof context.config.ESIVarMap.proxy=="string")data[context.config.ESIVarMap.proxy]=mtvn_btg_ESIVars.proxy;if(typeof context.config.ESIVarMap.countryCode=="string")data[context.config.ESIVarMap.countryCode]=mtvn_btg_ESIVars.countryCode;return data;};};mtvn.btg.reporting.BrowserToolbar={setData:function(context,data){var user_cookie=mtvn.btg.util.Cookie.read("mtvn_btg_Toolbar");if(mtvn.btg.util.String.isDefined(user_cookie)){mtvn.btg.reporting.UserSegment.add(context,"Toolbar - Main - User");mtvn.btg.util.Cookie.remove("mtvn_btg_Toolbar");}
var subscriber_cookie=mtvn.btg.util.Cookie.read("mtvn_btg_ToolbarSubscriber");if(mtvn.btg.util.String.isDefined(subscriber_cookie)){mtvn.btg.reporting.UserSegment.add(context,"Toolbar - Main - Subscriber");mtvn.btg.util.Cookie.remove("ToolBarSubscriber");}
var hpuser_cookie=mtvn.btg.util.Cookie.read("mtvn_btg_ToolbarHpUser");if(mtvn.btg.util.String.isDefined(hpuser_cookie)){mtvn.btg.reporting.UserSegment.add(context,"Toolbar - Main - HP User");}
return data;}};var s_code='',s_objectID;function s_gi(un,pg,ss){try{var c="=fun`o(~.substring(~){`Ps=^O~.indexOf(~#2 ~;$2~`b$2~=new Fun`o(~.length~.toLowerCase()~`Ps#8c_#k^an+'],~=new Object~};s.~`YMigrationServer~.toU"
+"pperCase~){$2~','~s.wd~);s.~')q='~=new Array~ookieDomainPeriods~.location~^LingServer~dynamicAccount~var ~link~s.m_~=='~s.apv~BufferedRequests~Element~)$2x^b!Object#WObject.prototype#WObject.protot"
+"ype[x])~etTime~visitor~$w@c(~referrer~else ~s.pt(~s.maxDelay~}c#E(e){~#i+~=''~.lastIndexOf(~^wc_i~}$2~.protocol~=new Date~^wobjectID=s.ppu=$I=$Iv1=$Iv2=$Iv3~for(i=~ction~javaEnabled~onclick~Name~te"
+"rnalFilters~javascript~s.dl~@6s.b.addBehavior(\"# default# ~=parseFloat(~typeof(v)==\"~window~cookie~while(~s.vl_g~Type~;i#U{~tfs~s.un~&&s.~o^woid~browser~.parent~document~colorDepth~String~.host~s"
+".fl(~s.rep(~s.eo~'+tm@S~s.sq~parseInt(~t=s.ot(o)~track~nload~j='1.~this~#PURL~}else{~s.vl_l~lugins~'){q='~dynamicVariablePrefix~');~;for(~Sampling~s.rc[un]~Event~._i~&&(~loadModule~resolution~s.c_r"
+"(~s.c_w(~s.eh~s.isie~\"m_\"+n~Secure~Height~tcf~isopera~ismac~escape(~'s_~.href~screen.~s#8gi(~Version~harCode~variableProvider~.s_~)s_sv(v,n[k],i)}~')>=~){s.~)?'Y':'N'~u=m[t+1](~i)clearTimeout(~e&"
+"&l$bSESSION'~name~home#P~;try{~,$m)~s.ssl~s.oun~s.rl[u~Width~o.type~s.vl_t~=s.sp(~Lifetime~s.gg('objectID~sEnabled~'+n+'~.mrq(@wun+'\"~ExternalLinks~charSet~lnk~onerror~http~currencyCode~.src~disab"
+"le~.get~MigrationKey~(''+~&&!~f',~){t=~r=s[f](~u=m[t](~Opera~Math.~s.ape~s.fsg~s.ns6~conne~InlineStats~&&l$bNONE'~Track~'0123456789~true~+\"_c\"]~s.epa(~t.m_nl~s.va_t~m._d~n=s.oid(o)~,'sqs',q);~Lea"
+"veQuery~?'&~'=')~n){~\"'+~){n=~'_'+~'+n;~\",''),~,255)}~if(~vo)~s.sampled~=s.oh(o);~+(y<1900?~n]=~1);~&&o~:'';h=h?h~;'+(n?'o.~sess~campaign~lif~ in ~s.co(~ffset~s.pe~m._l~s.c_d~s.brl~s.nrs~s[mn]~,'"
+"vo~s.pl~=(apn~space~\"s_gs(\")~vo._t~b.attach~2o7.net'~Listener~Year(~d.create~=s.n.app~)}}}~!='~'||t~)+'/~s()+'~){p=~():''~a['!'+t]~&&c){~://')i+=~){v=s.n.~channel~100~rs,~.target~o.value~s_si(t)~"
+"')dc='1~\".tl(\")~etscape~s_')t=t~omePage~='+~&&t~[b](e);~\"){n[k]~';s.va_~a+1,b):~return~mobile~height~events~random~code~=s_~=un~,pev~'MSIE ~'fun~floor(~atch~transa~s.num(~m._e~s.c_gd~,'lt~tm.g~."
+"inner~;s.gl(~,f1,f2~',s.bc~page~Group,~.fromC~sByTag~')<~++)~)){~||!~+';'~i);~y+=~l&&~''+x~[t]=~[i]=~[n];~' '+~'+v]~>=5)~:'')~+1))~il['+s~!a[t])~~s._c=^pc';`H=`y`5!`H`i@v`H`il`K;`H`in=0;}s^al=`H`il"
+";s^an=`H`in;s^al[s^a$7s;`H`in++;s.an#8an;s.cls`0x,c){`Pi,y`g`5!c)c=^O.an;`n0;i<x`8^3n=x`1i,i+1)`5c`3n)>=0)#Zn}`4y`Cfl`0x,l){`4x?@Ux)`10,l):x`Cco`0o`F!o)`4o;`Pn`B,x^Wx$Fo)$2x`3'select#T0&&x`3'filter"
+"#T0)n[x]=o[x];`4n`Cnum`0x){x`g+x^W`Pp=0;p<x`8;p#U$2(@j')`3x`1p,p#j<0)`40;`41`Crep#8rep;s.sp#8sp;s.jn#8jn;@c`0x`2,h=@jABCDEF',i,c=s.@L,n,l,e,y`g;c=c?c`E$g`5x){x`g+x`5c`SAUTO'^b'').c^uAt){`n0;i<x`8^3"
+"c=x`1i,i+$8n=x.c^uAt(i)`5n>127){l=0;e`g;^0n||l<4){e=h`1n%16,n%16+1)+e;n=(n-n%16)/16;l++}#Z'%u'+e}`6c`S+')#Z'%2B';`b#Z^oc)}x=y^Qx=x?^F^o#b),'+`G%2B'):x`5x&&c^6em==1&&x`3'%u#T0&&x`3'%U#T0){i=x`3'%^V^"
+"0i>=0){i++`5h`18)`3x`1i,i+1)`E())>=0)`4x`10,i)+'u00'+x`1#Yi=x`3'%',i$a}`4x`Cepa`0x`2;`4x?un^o^F#b,'+`G ')):x`Cpt`0x,d,f,a`2,t=x,z=0,y,r;^0t){y=t`3d);y=y<0?t`8:y;t=t`10,y);@Yt,a)`5r)`4r;z+=y+d`8;t=x"
+"`1z,x`8);t=z<x`8?t:''}`4''`Cisf`0t,a){`Pc=a`3':')`5c>=0)a=a`10,c)`5t`10,2)`S$u`12);`4(t!`g$x==a)`Cfsf`0t,a`2`5`ca,`G,'is@Wt))@d+=(@d!`g?`G`ft;`40`Cfs`0x,f`2;@d`g;`cx,`G,'fs@Wf);`4@d`Csi`0wd`2,c`g+s"
+"_gi,a=c`3\"{\"),b=c`h\"}\"),m;c#8fe(a>0&&b>0?c`1#10)`5wd&&wd.^A$iwd.s`Xout(#C`o s_sv(o,n,k){`Pv=o[k],i`5v`F`xstring\"||`xnumber\")n[k]=v;`bif (`xarray$z`K;`n0;i<v`8;i++^x`bif (`xobject$z`B^Wi$Fv^x}"
+"}fun`o $q{`Pwd=`y,s,i,j,c,a,b;wd^wgi`7\"un\",\"pg\",\"ss\",@wc+'\");wd.^s@w@9+'\");s=wd.s;s.sa(@w^5+'\"`I^4=wd;`c^1,\",\",\"vo1\",t`I@M=^G=s.`Q`r=s.`Q^2=`H`m=\\'\\'`5t.m_#a@n)`n0;i<@n`8^3n=@n[i]`5@"
+"vm=t#ec=t[^i]`5m$ic=\"\"+c`5c`3\"fun`o\")>=0){a=c`3\"{\");b=c`h\"}\");c=a>0&&b>0?c`1#10;s[^i@l=c`5#H)s.^c(n)`5s[n])for(j=0;j<$J`8;j#Us_sv(m,s[n],$J[j]$a}}`Pe,o,t@6o=`y.opener`5o$9^wgi@Xo^wgi(@w^5+'"
+"\")`5t)$q}`e}',1)}`Cc_d`g;#If`0t,a`2`5!#Gt))`41;`40`Cc_gd`0`2,d=`H`M^D@4,n=s.fpC`L,p`5!n)n=s.c`L`5d@V$K@xn?^Jn):2;n=n>2?n:2;p=d`h'.')`5p>=0){^0p>=0&&n>1$fd`h'.',p-$8n--}$K=p>0&&`cd,'.`Gc_gd@W0)?d`1"
+"p):d}}`4$K`Cc_r`0k`2;k=@c(k);`Pc=#fs.d.`z,i=c`3#fk+@u,e=i<0?i:c`3';',i),v=i<0?'':@mc`1i+2+k`8,e<0?c`8:e));`4v$b[[B]]'?v:''`Cc_w`0k,v,e`2,d=#I(),l=s.`z@F,t;v`g+v;l=l?@Ul)`E$g`5@3@h@X(v!`g?^Jl?l:0):-"
+"60)`5t){e`l;e.s`X(e.g`X()+(t*$m0))}`jk@h^zd.`z=k+'`Zv!`g?v:'[[B]]')+'; path=/;'+(@3?' expires$we.toGMT^C()#X`f(d?' domain$wd#X:'^V`4^ek)==v}`40`Ceh`0o,e,r,f`2,b=^p'+e+@ys^an,n=-1,l,i,x`5!^gl)^gl`K;"
+"l=^gl;`n0;i<l`8&&n<0;i++`Fl[i].o==o&&l[i].e==e)n=i`jn<0@xi;l[n]`B}x=l#ex.o=o;x.e=e;f=r?x.b:f`5r||f){x.b=r?0:o[e];x.o[e]=f`jx.b){x.o[b]=x.b;`4b}`40`Ccet`0f,a,t,o,b`2,r,^l`5`T>=5^b!s.^m||`T>=7#V^l`7'"
+"s`Gf`Ga`Gt`G`Pe,r@6@Ya)`er=s[t](e)}`4r^Vr=^l(s,f,a,t)^Q$2s.^n^6u`3#B4^y0)r=s[b](a);else{^g(`H,'@N',0,o);@Ya`Ieh(`H,'@N',1)}}`4r`Cg^4et`0e`2;`4s.^4`Cg^4oe`7'e`G`Ac;^g(`y,\"@N\",1`Ie^4=1;c=s.t()`5c)s"
+".d.write(c`Ie^4=0;`4@k'`Ig^4fb`0a){`4`y`Cg^4f`0w`2,p=w^9,l=w`M;s.^4=w`5p&&p`M!=#ap`M^D==l^D^z^4=p;`4s.g^4f(s.^4)}`4s.^4`Cg^4`0`2`5!s.^4^z^4=`H`5!s.e^4)s.^4=s.cet('g^4@Ws.^4,'g^4et',s.g^4oe,'g^4fb')"
+"}`4s.^4`Cmrq`0u`2,l=@A],n,r;@A]=0`5l)for(n=0;n<l`8;n#U{r=l#es.mr(0,0,r.r,0,r.t,r.u)}`Cbr`0id,rs`2`5s.@R`U#W^f^pbr',rs))$L=rs`Cflush`U`0){^O.fbr(0)`Cfbr`0id`2,br=^e^pbr')`5!br)br=$L`5br`F!s.@R`U)^f^"
+"pbr`G'`Imr(0,0,br)}$L=0`Cmr`0$C,q,$nid,ta,u`2,dc=s.dc,t1=s.`N,t2=s.`N^j,tb=s.`NBase,p='.sc',ns=s.`Y`r$R,un=s.cls(u?u:(ns?ns:s.fun)),r`B,l,imn=^pi_'+(un),im,b,e`5!rs`Ft1`Ft2^6ssl)t1=t2^Q$2!tb)tb='$V"
+"`5dc)dc=@Udc)`9;`bdc='d1'`5tb`S$V`Fdc`Sd1$r12';`6dc`Sd2$r22';p`g}t1#9+'.'+dc+'.'+p+tb}rs='@O'+(@8?'s'`f'://'+t1+'/b/ss/'+^5+'/'+(s.#3?'5.1':'1'$dH.20.3/'+$C+'?AQB=1&ndh=1'+(q?q`f'&AQE=1'`5^h@Vs.^n`"
+"F`T>5.5)rs=^E$n4095);`brs=^E$n2047)`jid^zbr(id,rs);#2}`js.d.images&&`T>=3^b!s.^m||`T>=7)^b@e<0||`T>=6.1)`F!s.rc)s.rc`B`5!^Y){^Y=1`5!s.rl)s.rl`B;@An]`K;s`Xout('$2`y`il)`y`il['+s^an+']@J)',750)^Ql=@A"
+"n]`5l){r.t=ta;r.u#9;r.r=rs;l[l`8]=r;`4''}imn+=@y^Y;^Y++}im=`H[imn]`5!im)im=`H[im$7new Image;im^wl=0;im.o^M`7'e`G^O^wl=1;`Pwd=`y,s`5wd`il){s=wd`il['+s^an+'];s@J`Inrs--`5!$M)`Rm(\"rr\")}')`5!$M^znrs="
+"1;`Rm('rs')}`b$M++;im@Q=rs`5rs`3'&pe=^y0^b!ta||ta`S_self$ca`S_top'||(`H.@4$xa==`H.@4)#Vb=e`l;^0!im^w#ae.g`X()-b.g`X()<500)e`l}`4''}`4'<im'+'g sr'+'c=@wrs+'\" width=1 #4=1 border=0 alt=\"\">'`Cgg`0v"
+"`2`5!`H[^p#g)`H[^p#g`g;`4`H[^p#g`Cglf`0t,a`Ft`10,2)`S$u`12);`Ps=^O,v=s.gg(t)`5v)s#cv`Cgl`0v`2`5s.pg)`cv,`G,'gl@W0)`Crf`0x`2,y,i,j,h,l,a,b`g,c`g,t`5x){y`g+x;i=y`3'?')`5i>0){a=y`1i+$8y=y`10,#Yh=y`9;i"
+"=0`5h`10,7)`S@O$j7;`6h`10,8)`S@Os$j8;h=h`1#Yi=h`3\"/\")`5i>0){h=h`10,i)`5h`3'google^y0){a@Ea,'&')`5a`8>1){l=',q,ie,start,search_key,word,kw,cd,'^Wj=0;j<a`8;j++@Xa[j];i=t`3@u`5i>0&&l`3`G+t`10,i)+`G)"
+">=0)b+=(b@t'`ft;`bc+=(c@t'`ft`jb$i#Z'?'+b+'&'+c`5#b!=y)x=y}}}}}}`4x`Chav`0`2,qs`g,fv=s.`Q@iVa$nfe=s.`Q@i^Zs,mn,i`5$I){mn=$I`10,1)`E()+$I`11)`5$N){fv=$N.^LVars;fe=$N.^L^Zs}}fv=fv?fv+`G+^R+`G+^R2:'';"
+"`n0;i<@o`8^3`Pk=@o[i],v=s[k],b=k`10,4),x=k`14),n=^Jx),q=k`5v&&k$b`Q`r'&&k$b`Q^2'`F$I||s.@M||^G`Ffv^b`G+fv+`G)`3`G+k+`G)<0)v`g`5k`S#5'&&fe)v=s.fs(v,fe)`jv`Fk`S^U`JD';`6k`S`YID`Jvid';`6k`S^P^Tg';v=^E"
+"v$1`6k`S`a^Tr';v=^Es.rf(v)$1`6k`Svmk'||k`S`Y@T`Jvmt';`6k`S`D^Tvmf'`5@8^6`D^j)v`g}`6k`S`D^j^Tvmf'`5!@8^6`D)v`g}`6k`S@L^Tce'`5v`E()`SAUTO')v='ISO8859-1';`6s.em==2)v='UTF-8'}`6k`S`Y`r$R`Jns';`6k`Sc`L`"
+"Jcdp';`6k`S`z@F`Jcl';`6k`S^v`Jvvp';`6k`S@P`Jcc';`6k`S$l`Jch';`6k`S#F`oID`Jxact';`6k`S$D`Jv0';`6k`S^d`Js';`6k`S^B`Jc';`6k`S`t^t`Jj';`6k`S`p`Jv';`6k`S`z@H`Jk';`6k`S^8@B`Jbw';`6k`S^8^k`Jbh';`6k`S@f`o^"
+"2`Jct';`6k`S@5`Jhp';`6k`Sp^S`Jp';`6#Gx)`Fb`Sprop`Jc@z`6b`SeVar`Jv@z`6b`Slist`Jl@z`6b`Shier^Th@zv=^Ev$1`jv)qs+='&'+q+'$w(k`10,3)$bpev'?@c(v):v$a`4qs`Cltdf`0t,h@Xt?t`9$A`9:'';`Pqi=h`3'?^Vh=qi>=0?h`10"
+",qi):h`5t&&h`1h`8-(t`8#j`S.'+t)`41;`40`Cltef`0t,h@Xt?t`9$A`9:''`5t&&h`3t)>=0)`41;`40`Clt`0h`2,lft=s.`QDow^MFile^2s,lef=s.`QEx`s,$E=s.`QIn`s;$E=$E?$E:`H`M^D@4;h=h`9`5s.^LDow^MLinks&&lft&&`clft,`G#Jd"
+"@Wh))`4'd'`5s.^L@K&&h`10,1)$b# '^blef||$E)^b!lef||`clef,`G#Je@Wh))^b!$E#W`c$E,`G#Je@Wh)))`4'e';`4''`Clc`7'e`G`Ab=^g(^O,\"`q\"`I@M=$G^O`It(`I@M=0`5b)`4^O$y`4@k'`Ibc`7'e`G`Af,^l`5s.d^6d.all^6d.all.cp"
+"pXYctnr)#2;^G=e@Q`V?e@Q`V:e$o;^l`7\"s\",\"`Pe@6$2^G^b^G.tag`r||^G^9`V||^G^9Node))s.t()`e}\");^l(s`Ieo=0'`Ioh`0o`2,l=`H`M,h=o^q?o^q:'',i,j,k,p;i=h`3':^Vj=h`3'?^Vk=h`3'/')`5h^bi<0||(j>=0&&i>j)||(k>=0"
+"&&i>k))$fo`k$9`k`8>1?o`k:(l`k?l`k:'^Vi=l.path@4`h'/^Vh=(p?p+'//'`f(o^D?o^D:(l^D?l^D#i)+(h`10,1)$b/'?l.path@4`10,i<0?0:i$d'`fh}`4h`Cot`0o){`Pt=o.tag`r;t=t$x`E?t`E$g`5t`SSHAPE')t`g`5t`Ft`SINPUT'&&@C&"
+"&@C`E)t=@C`E();`6!t$9^q)t='A';}`4t`Coid`0o`2,^K,p,c,n`g,x=0`5t@V^7$fo`k;c=o.`q`5o^q^bt`SA$c`SAREA')^b!c#Wp||p`9`3'`t#T0))n$5`6c@x^Fs.rep(^Fs.rep@Uc,\"\\r$0\"\\n$0\"\\t$0' `G^Vx=2}`6$p^bt`SINPUT$c`S"
+"SUBMIT')@x$p;x=3}`6o@Q$x`SIMAGE')n=o@Q`5@v^7=^En@7;^7t=x}}`4^7`Crqf`0t,un`2,e=t`3@u,u=e>=0?`G+t`10,e)+`G:'';`4u&&u`3`G+un+`G)>=0?@mt`1e#j:''`Crq`0un`2,c#9`3`G),v=^e^psq'),q`g`5c<0)`4`cv,'&`Grq@Wun)"
+";`4`cun,`G,'rq',0)`Csqp`0t,a`2,e=t`3@u,q=e<0?'':@mt`1e+1)`Isqq[q]`g`5e>=0)`ct`10,e),`G@r`40`Csqs`0un,q`2;^Iu[u$7q;`40`Csq`0q`2,k=^psq',v=^ek),x,c=0;^Iq`B;^Iu`B;^Iq[q]`g;`cv,'&`Gsqp',0`Ipt(^5,`G@rv`"
+"g^Wx$F^Iu`W)^Iq[^Iu[x]]+=(^Iq[^Iu[x]]?`G`fx^Wx$F^Iq`W^6sqq[x]^bx==q||c<2#Vv+=(v@t'`f^Iq[x]+'`Zx);c++}`4^fk,v,0)`Cwdl`7'e`G`Ar=@k,b=^g(`H,\"o^M\"),i,o,oc`5b)r=^O$y`n0;i<s.d.`Qs`8^3o=s.d.`Qs[i];oc=o."
+"`q?\"\"+o.`q:\"\"`5(oc`3$S<0||oc`3\"^woc(\")>=0)$9c`3$s<0)^g(o,\"`q\",0,s.lc);}`4r^V`Hs`0`2`5`T>3^b!^h#Ws.^n||`T#h`Fs.b^6$U^Z)s.$U^Z('`q#O);`6s.b^6b.add^Z$W)s.b.add^Z$W('click#O,false);`b^g(`H,'o^M"
+"',0,`Hl)}`Cvs`0x`2,v=s.`Y^X,g=s.`Y^X#Qk=^pvsn_'+^5+(g?@yg#i,n=^ek),e`l,y=e@S$X);e.set$Xy+10$61900:0))`5v){v*=$m`5!n`F!^fk,x,e))`40;n=x`jn%$m00>v)`40}`41`Cdyasmf`0t,m`Ft&&m&&m`3t)>=0)`41;`40`Cdyasf`"
+"0t,m`2,i=t?t`3@u:-1,n,x`5i>=0&&m){`Pn=t`10,i),x=t`1i+1)`5`cx,`G,'dyasm@Wm))`4n}`40`Cuns`0`2,x=s.`OSele`o,l=s.`OList,m=s.`OM#E,n,i;^5=^5`9`5x&&l`F!m)m=`H`M^D`5!m.toLowerCase)m`g+m;l=l`9;m=m`9;n=`cl,"
+"';`Gdyas@Wm)`5n)^5=n}i=^5`3`G`Ifun=i<0?^5:^5`10,i)`Csa`0un`2;^5#9`5!@9)@9#9;`6(`G+@9+`G)`3`G+un+`G)<0)@9+=`G+un;^5s()`Cm_i`0n,a`2,m,f=n`10,1),r,l,i`5!`Rl)`Rl`B`5!`Rnl)`Rnl`K;m=`Rl[n]`5!a&&m&&#H@Vm^"
+"a)`Ra(n)`5!m){m`B,m._c=^pm';m^an=`H`in;m^al=s^al;m^al[m^a$7m;`H`in++;m.s=s;m._n=n;$J`K('_c`G_in`G_il`G_i`G_e`G_d`G_dl`Gs`Gn`G_r`G_g`G_g1`G_t`G_t1`G_x`G_x1`G_rs`G_rr`G_l'`Im_l[$7m;`Rnl[`Rnl`8]=n}`6m"
+"._r@Vm._m){r=m._r;r._m=m;l=$J;`n0;i<l`8;i#U$2m[l[i]])r[l[i]]=m[l[i]];r^al[r^a$7r;m=`Rl[$7r`jf==f`E())s[$7m;`4m`Cm_a`7'n`Gg`Ge`G$2!g)g=^i;`Ac=s[g@l,m,x,f=0`5!c)c=`H[\"s_\"+g@l`5c&&s_d)s[g]`7\"s\",s_"
+"ft(s_d(c)));x=s[g]`5!x)x=`H[\\'s_\\'+g]`5!x)x=`H[g];m=`Ri(n,1)`5x^b!m^a||g!=^i#Vm^a=f=1`5(\"\"+x)`3\"fun`o\")>=0)x(s);`b`Rm(\"x\",n,x,e)}m=`Ri(n,1)`5@pl)@pl=@p=0;`ut();`4f'`Im_m`0t,n,d,e@X@yt;`Ps=^"
+"O,i,x,m,f=@yt,r=0,u`5`R#a`Rnl)`n0;i<`Rnl`8^3x=`Rnl[i]`5!n||x==@vm=`Ri(x);u=m[t]`5u`F@Uu)`3#C`o^y0`Fd&&e)@Zd,e);`6d)@Zd);`b@Z)}`ju)r=1;u=m[t+1]`5u@Vm[f]`F@Uu)`3#C`o^y0`Fd&&e)@1d,e);`6d)@1d);`b@1)}}m"
+"[f]=1`5u)r=1}}`4r`Cm_ll`0`2,g=`Rdl,i,o`5g)`n0;i<g`8^3o=g[i]`5o)s.^c(o.n,o.u,o.d,o.l,o.e,$8g#d0}`C^c`0n,u,d,l,e,ln`2,m=0,i,g,o=0#N,c=s.h?s.h:s.b,b,^l`5@vi=n`3':')`5i>=0){g=n`1i+$8n=n`10,i)}`bg=^i;m="
+"`Ri(n)`j(l||(n@V`Ra(n,g)))&&u^6d&&c^6$Y`V`Fd){@p=1;@pl=1`jln`F@8)u=^Fu,'@O:`G@Os:^Vi=^ps:'+s^an+':@I:'+g;b='`Ao=s.d@S`VById(@wi+'\")`5s$9`F!o.#a`H.'+g+'){o.l=1`5o.@2o.#Yo.i=0;`Ra(\"@I\",@wg+'@w(e?'"
+",@we+'\"'`f')}';f2=b+'o.c++`5!`d)`d=250`5!o.l$9.c<(`d*2)/$m)o.i=s`Xout(o.f2@7}';f1`7'e',b+'}^V^l`7's`Gc`Gi`Gu`Gf1`Gf2`G`Pe,o=0@6o=s.$Y`V(\"script\")`5o){@C=\"text/`t\"$Bid=i;o.defer=@k;o.o^M=o.onre"
+"adystatechange=f1;o.f2=f2;o.l=0;'`f'o@Q=u;c.appendChild(o)$Bc=0;o.i=s`Xout(f2@7'`f'}`eo=0}`4o^Vo=^l(s,c,i,u#N)^Qo`B;o.n=n+':'+g;o.u=u;o.d=d;o.l=l;o.e=e;g=`Rdl`5!g)g=`Rdl`K;i=0;^0i<g`8&&g[i])i++;g#d"
+"o}}`6@vm=`Ri(n);#H=1}`4m`Cvo1`0t,a`Fa[t]||$h)^O#ca[t]`Cvo2`0t,a`F#l{a#c^O[t]`5#l$h=1}`Cdlt`7'`Ad`l,i,vo,f=0`5`ul)`n0;i<`ul`8^3vo=`ul[i]`5vo`F!`Rm(\"d\")||d.g`X()-$T>=`d){`ul#d0;s.t($3}`bf=1}`j`u@2`"
+"ui`Idli=0`5f`F!`ui)`ui=s`Xout(`ut,`d)}`b`ul=0'`Idl`0vo`2,d`l`5!$3vo`B;`c^1,`G$O2',$3;$T=d.g`X()`5!`ul)`ul`K;`ul[`ul`8]=vo`5!`d)`d=250;`ut()`Ct`0vo,id`2,trk=1,tm`l,sed=Math&&@b#6?@b#D@b#6()*$m000000"
+"00000):#K`X(),$C='s'+@b#D#K`X()/10800000)%10+sed,y=tm@S$X),vt=tm@SDate($d^HMonth($d'$6y+1900:y)+' ^HHour$e:^HMinute$e:^HSecond$e ^HDay()+#f#K`XzoneO$H(),^l,^4=s.g^4(),ta`g,q`g,qs`g,#7`g,vb`B#M^1`Iu"
+"ns(`Im_ll()`5!s.td){`Ptl=^4`M,a,o,i,x`g,c`g,v`g,p`g,bw`g,bh`g,^N0',k=^f^pcc`G@k',0@0,hp`g,ct`g,pn=0,ps`5^C&&^C.prototype){^N1'`5j.m#E){^N2'`5tm.setUTCDate){^N3'`5^h^6^n&&`T#h^N4'`5pn.toPrecisio@v^N"
+"5';a`K`5a.forEach){^N6';i=0;o`B;^l`7'o`G`Pe,i=0@6i=new Iterator(o)`e}`4i^Vi=^l(o)`5i&&i.next)^N7'}}}}`j`T>=4)x=^rwidth+'x'+^r#4`5s.isns||s.^m`F`T>=3$k`p(@0`5`T>=4){c=^rpixelDepth;bw=`H#L@B;bh=`H#L^"
+"k}}$P=s.n.p^S}`6^h`F`T>=4$k`p(@0;c=^r^B`5`T#h{bw=s.d.^A`V.o$H@B;bh=s.d.^A`V.o$H^k`5!s.^n^6b){^l`7's`Gtl`G`Pe,hp=0`vh$v\");hp=s.b.isH$v(tl)?\"Y\":\"N\"`e}`4hp^Vhp=^l(s,tl);^l`7's`G`Pe,ct=0`vclientCa"
+"ps\");ct=s.b.@f`o^2`e}`4ct^Vct=^l(s$a`br`g`j$P)^0pn<$P`8&&pn<30){ps=^E$P[pn].@4@7#X`5p`3ps)<0)p+=ps;pn++}s.^d=x;s.^B=c;s.`t^t=j;s.`p=v;s.`z@H=k;s.^8@B=bw;s.^8^k=bh;s.@f`o^2=ct;s.@5=hp;s.p^S=p;s.td="
+"1`j$3{`c^1,`G$O2',vb`Ipt(^1,`G$O1',$3`js.useP^S)s.doP^S(s);`Pl=`H`M,r=^4.^A.`a`5!s.^P)s.^P=l^q?l^q:l`5!s.`a@Vs._1_`a^z`a=r;s._1_`a=1`j(vo&&$T)#W`Rm('d'#V`Rm('g')`5s.@M||^G){`Po=^G?^G:s.@M`5!o)`4'';"
+"`Pp=s.#P`r,w=1,^K,@q,x=^7t,h,l,i,oc`5^G$9==^G){^0o@Vn$x$bBODY'){o=o^9`V?o^9`V:o^9Node`5!o)`4'';^K;@q;x=^7t}oc=o.`q?''+o.`q:''`5(oc`3$S>=0$9c`3\"^woc(\")<0)||oc`3$s>=0)`4''}ta=n?o$o:1;h$5i=h`3'?^Vh="
+"s.`Q@s^C||i<0?h:h`10,#Yl=s.`Q`r;t=s.`Q^2?s.`Q^2`9:s.lt(h)`5t^bh||l))q+='&pe=@M_'+(t`Sd$c`Se'?@c(t):'o')+(h@tpev1`Zh)`f(l@tpev2`Zl):'^V`btrk=0`5s.^L@g`F!p$fs.^P;w=0}^K;i=o.sourceIndex`5@G')@x@G^Vx=1"
+";i=1`jp&&n$x)qs='&pid`Z^Ep,255))+(w@tpidt$ww`f'&oid`Z^En@7)+(x@toidt$wx`f'&ot`Zt)+(i@toi$wi#i}`j!trk@Vqs)`4'';$4=s.vs(sed)`5trk`F$4)#7=s.mr($C,(vt@tt`Zvt)`fs.hav()+q+(qs?qs:s.rq(^5)),0,id,ta);qs`g;"
+"`Rm('t')`5s.p_r)s.p_r(`I`a`g}^I(qs);^Q`u($3;`j$3`c^1,`G$O1',vb`I@M=^G=s.`Q`r=s.`Q^2=`H`m`g`5s.pg)`H^w@M=`H^weo=`H^w`Q`r=`H^w`Q^2`g`5!id@Vs.tc^ztc=1;s.flush`U()}`4#7`Ctl`0o,t,n,vo`2;s.@M=$Go`I`Q^2=t"
+";s.`Q`r=n;s.t($3}`5pg){`H^wco`0o){`P^s\"_\",1,$8`4$Go)`Cwd^wgs`0u@v`P^sun,1,$8`4s.t()`Cwd^wdc`0u@v`P^sun,$8`4s.t()}}@8=(`H`M`k`9`3'@Os^y0`Id=^A;s.b=s.d.body`5s.d@S`V#S`r^zh=s.d@S`V#S`r('HEAD')`5s.h"
+")s.h=s.h[0]}s.n=navigator;s.u=s.n.userAgent;@e=s.u`3'N$t6/^V`Papn$Z`r,v$Z^t,ie=v`3#B'),o=s.u`3'@a '),i`5v`3'@a^y0||o>0)apn='@a';^h$Q`SMicrosoft Internet Explorer'`Iisns$Q`SN$t'`I^m$Q`S@a'`I^n=(s.u`"
+"3'Mac^y0)`5o>0)`T`ws.u`1o+6));`6ie>0){`T=^Ji=v`1ie+5))`5`T>3)`T`wi)}`6@e>0)`T`ws.u`1@e+10));`b`T`wv`Iem=0`5^C#R^u){i=^o^C#R^u(256))`E(`Iem=(i`S%C4%80'?2:(i`S%U0$m'?1:0))}s.sa(un`Ivl_l='^U,`YID,vmk,"
+"`Y@T,`D,`D^j,ppu,@L,`Y`r$R,c`L,`z@F,#P`r,^P,`a,@P#0l@E^R,`G`Ivl_t=^R+',^v,$l,server,#P^2,#F`oID,purchaseID,$D,state,zip,#5,products,`Q`r,`Q^2'^W`Pn=1;n<51;n#U@D+=',prop@I,eVar@I,hier@I,list@z^R2=',"
+"tnt,pe#A1#A2#A3,^d,^B,`t^t,`p,`z@H,^8@B,^8^k,@f`o^2,@5,p^S';@D+=^R2;@o@E@D,`G`Ivl_g=@D+',`N,`N^j,`NBase,fpC`L,@R`U,#3,`Y^X,`Y^X#Q`OSele`o,`OList,`OM#E,^LDow^MLinks,^L@K,^L@g,`Q@s^C,`QDow^MFile^2s,`"
+"QEx`s,`QIn`s,`Q@iVa$n`Q@i^Zs,`Q`rs,@M,eo,_1_`a#0g@E^1,`G`Ipg=pg#M^1)`5!ss)`Hs()",w=window,l=w.s_c_il,n=navigator,u=n.userAgent,v=n.appVersion,e=v.indexOf('MSIE '),m=u.indexOf('Netscape6/'),a,i,s;if(un){un=un.toLowerCase();if(l)for(i=0;i<l.length;i++){s=l[i];if(!s._c||s._c=='s_c'){if(s.oun==un)return s;else if(s.fs&&s.sa&&s.fs(s.oun,un)){s.sa(un);return s}}}}w.s_an='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';w.s_sp=new Function("x","d","var a=new Array,i=0,j;if(x){if(x.split)a=x.split(d);else if(!d)for(i=0;i<x.length;i++)a[a.length]=x.substring(i,i+1);else while(i>=0){j=x.indexOf(d,i);a[a.length]=x.subst"
+"ring(i,j<0?x.length:j);i=j;if(i>=0)i+=d.length}}return a");w.s_jn=new Function("a","d","var x='',i,j=a.length;if(a&&j>0){x=a[0];if(j>1){if(a.join)x=a.join(d);else for(i=1;i<j;i++)x+=d+a[i]}}return x");w.s_rep=new Function("x","o","n","return s_jn(s_sp(x,o),n)");w.s_d=new Function("x","var t='`^@$#',l=s_an,l2=new Object,x2,d,b=0,k,i=x.lastIndexOf('~~'),j,v,w;if(i>0){d=x.substring(0,i);x=x.substring(i+2);l=s_sp(l,'');for(i=0;i<62;i++)l2[l[i]]=i;t=s_sp(t,'');d"
+"=s_sp(d,'~');i=0;while(i<5){v=0;if(x.indexOf(t[i])>=0) {x2=s_sp(x,t[i]);for(j=1;j<x2.length;j++){k=x2[j].substring(0,1);w=t[i]+k;if(k!=' '){v=1;w=d[b+l2[k]]}x2[j]=w+x2[j].substring(1)}}if(v)x=s_jn("
+"x2,'');else{w=t[i]+' ';if(x.indexOf(w)>=0)x=s_rep(x,w,t[i]);i++;b+=62}}}return x");w.s_fe=new Function("c","return s_rep(s_rep(s_rep(c,'\\\\','\\\\\\\\'),'\"','\\\\\"'),\"\\n\",\"\\\\n\")");w.s_fa=new Function("f","var s=f.indexOf('(')+1,e=f.indexOf(')'),a='',c;while(s>=0&&s<e){c=f.substring(s,s+1);if(c==',')a+='\",\"';else if((\"\\n\\r\\t \").indexOf(c)<0)a+=c;s++}return a?'\"'+a+'\"':"
+"a");w.s_ft=new Function("c","c+='';var s,e,o,a,d,q,f,h,x;s=c.indexOf('=function(');while(s>=0){s++;d=1;q='';x=0;f=c.substring(s);a=s_fa(f);e=o=c.indexOf('{',s);e++;while(d>0){h=c.substring(e,e+1);if(q){i"
+"f(h==q&&!x)q='';if(h=='\\\\')x=x?0:1;else x=0}else{if(h=='\"'||h==\"'\")q=h;if(h=='{')d++;if(h=='}')d--}if(d>0)e++}c=c.substring(0,s)+'new Function('+(a?a+',':'')+'\"'+s_fe(c.substring(o+1,e))+'\")"
+"'+c.substring(e+1);s=c.indexOf('=function(')}return c;");c=s_d(c);if(e>0){a=parseInt(i=v.substring(e+5));if(a>3)a=parseFloat(i)}else if(m>0)a=parseFloat(u.substring(m+10));else a=parseFloat(v);if(a>=5&&v.indexOf('Opera')<0&&u.indexOf('Opera')<0){w.s_c=new Function("un","pg","ss","var s=this;"+c);return new s_c(un,pg,ss)}else s=new Function("un","pg","ss","var s=new Object;"+s_ft(c)+";return s");return s(un,pg,ss);}catch(e){}}
mtvn.btg.reporting.omniture.Hcode=s_gi("");if(typeof mtvn.btg.reporting.omniture.Hcode==="object")
{mtvn.btg.reporting.omniture.Hcode.setAccount=function(account){this.un=account;};}
if(typeof mtvn.btg.reporting.omniture.Hcode==="object"){mtvn.btg.reporting.omniture.Hcode.getNewRepeat=new Function(""
+"var s=this,e=new Date(),cval,ct=e.getTime(),y=e.getYear();e.setTime"
+"(ct+30*24*60*60*1000);cval=s.c_r('s_nr');if(cval.length==0){s.c_w("
+"'s_nr',ct,e);return 'New';}if(cval.length!=0&&ct-cval<30*60*1000){s"
+".c_w('s_nr',ct,e);return 'New';}if(cval<1123916400001){e.setTime(cv"
+"al+30*24*60*60*1000);s.c_w('s_nr',ct,e);return 'Repeat';}else retur"
+"n 'Repeat';");}
if(typeof mtvn.btg.reporting.omniture.Hcode==="object"){mtvn.btg.reporting.omniture.Hcode.getTimeParting=new Function("t","z","y",""
+"dc=new Date('1/1/2000');f=15;ne=8;if(dc.getDay()!=6||"
+"dc.getMonth()!=0){return'Data Not Available'}else{;z=parseInt(z);"
+"if(y=='2009'){f=8;ne=1};gmar=new Date('3/1/'+y);dsts=f-gmar.getDay("
+");gnov= new Date('11/1/'+y);dste=ne-gnov.getDay();spr=new Date('3/'"
+"+dsts+'/'+y);fl=new Date('11/'+dste+'/'+y);cd=new Date();"
+"if(cd>spr&&cd<fl){z=z+1}else{z=z};utc=cd.getTime()+(cd.getTimezoneO"
+"ffset()*60000);tz=new Date(utc + (3600000*z));thisy=tz.getFullYear("
+");var days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Fr"
+"iday','Saturday'];if(thisy!=y){return'Data Not Available'}else{;thi"
+"sh=tz.getHours();thismin=tz.getMinutes();thisd=tz.getDay();var dow="
+"days[thisd];var ap='AM';var dt='Weekday';var mint='00';if(thismin>3"
+"0){mint='30'}if(thish>=12){ap='PM';thish=thish-12};if (thish==0){th"
+"ish=12};if(thisd==6||thisd==0){dt='Weekend'};var timestring=thish+'"
+":'+mint+ap;var daystring=dow;var endstring=dt;if(t=='h'){return tim"
+"estring}if(t=='d'){return daystring};if(t=='w'){return en"
+"dstring}}};");}
if(typeof mtvn.btg.reporting.omniture.Hcode==="object"){mtvn.btg.reporting.omniture.Hcode.getValOnce=new Function("v","c","e",""
+"var s=this,k=s.c_r(c),a=new Date;e=e?e:0;if(v){a.setTime(a.getTime("
+")+e*86400000);s.c_w(c,v,e?a:0);}return v==k?'':v");}
mtvn.btg.ads.AdManager=new function(){var hasDoubleClickAd=false;var hasInternationalAd=false;var hasQuantCast=false;var config;var ads=[];var data={};var counter=0;this.reloadableAds={};this.init=function(){config=mtvn.btg.config.AdSettings;var qc_obj={};if(config.DoubleClick){if(config.DoubleClick.enabled){hasDoubleClickAd=true;if(mtvn.btg.util.String.isDefined(config.DoubleClick.sections)){config.DoubleClick.sections=mtvn.btg.util.String.stripFileExtension(config.DoubleClick.sections);qc_obj.sections=config.DoubleClick.sections;}
else{this.setDefaultSections();if(mtvn.btg.util.String.isDefined(data.sections))
qc_obj.sections=data.sections;}
qc_obj.dartSite=config.DoubleClick.dartSite;data.tile=0;data.ord=mtvn.btg.util.Math.random(100000000000000000,999999999999999999);}}
if(config.International){if(config.International.enabled){qc_obj.sections=mtvn.btg.util.Sections.getAdSections();qc_obj.dartSite=config.International.dartSite;hasInternationalAd=true;}}
if(config.QuantCast){if(config.QuantCast.enabled){hasQuantCast=true;}}
if(hasQuantCast){PlatoAd=new mtvn.btg.ads.DoubleClickAd(config.DoubleClick);dmobj={size:'728x90',contentType:"adj"};dmobj.sections=qc_obj.sections;if(mtvn.btg.util.String.isDefined(config.QuantCast.vertical)){PlatoAd.setKeyValues("vertical="+config.QuantCast.vertical);};PlatoAd.init(dmobj);PlatoAd.getUrl();mtvn.btg.reporting.QuantCast.Ads.setLabels(qc_obj,PlatoAd.getSections());}};this.placeAd=function(a_data){if(typeof(mtvn.btg.config.AdSettings.isCodaAdsUsed)!='undefined')
mtvn.btg.config.AdSettings.isCodaAdsUsed=true;var ad=this.getAd(a_data);return ad.placeAd(a_data);};this.placeIFrameAd=function(adHtml,a_data){if(typeof(mtvn.btg.config.AdSettings.isCodaAdsUsed)!='undefined')
mtvn.btg.config.AdSettings.isCodaAdsUsed=true;var containerId="container"+a_data.reloadableAdId;this.reloadableAds[a_data.reloadableAdId]={data:a_data};document.write('<iframe allowtransparency="true" name="'+containerId+'" id="'+containerId+'" src="'+adHtml+'?'+a_data.reloadableAdId+'" width='+a_data.size.split('x')[0]+' height='+a_data.size.split('x')[1]+' marginwidth=0 marginheight=0 frameborder=0 scrolling="no"></iframe>');}
this.getData=function(){return data;};this.setDefaultSections=function(a_defaultSections){sections=(mtvn.btg.util.String.isDefined(a_defaultSections)?a_defaultSections:mtvn.btg.util.Sections.getAdSections());if(mtvn.btg.util.String.isDefined(sections)){data.sections=mtvn.btg.util.String.stripFileExtension(sections);}};this.getAd=function(a_data){var ad;if(hasInternationalAd&&a_data.adType==="InternationalAd"){ad=new mtvn.btg.ads.InternationalAd(config.International);data.tile++;a_data=this.setReloadableAdData(a_data);if(mtvn.btg.util.String.isDefined(a_data.sections)){a_data.sections=mtvn.btg.util.String.stripFileExtension(a_data.sections);}
mtvn.btg.util.Object.copyProperties(data,a_data);ad.init(a_data);ads.push(ad);}
else if(hasDoubleClickAd){ad=new mtvn.btg.ads.DoubleClickAd(config.DoubleClick);data.tile++;a_data=this.setReloadableAdData(a_data);if(mtvn.btg.util.String.isDefined(a_data.sections)){a_data.sections=mtvn.btg.util.String.stripFileExtension(a_data.sections);}
mtvn.btg.util.Object.copyProperties(data,a_data);ad.init(a_data);ads.push(ad);}else{document.write("<!-- [ERROR: Ads not enabled. Please check your config or placeAd() method call!] -->");return null;}
return ad;};this.getAdUrl=function(a_data){return this.getAd(a_data).getUrl();};this.setReloadableAdData=function(a_data)
{if(mtvn.btg.util.String.isDefined(a_data.reloadableAdId)&&mtvn.btg.util.String.isDefined(this.reloadableAds[a_data.reloadableAdId])){++counter;a_data.ord=data.ord=(mtvn.btg.util.String.isDefined(this.reloadableAds[a_data.reloadableAdId].tile)&&this.hasReloadComplete()?mtvn.btg.util.Math.random(100000000000000000,999999999999999999):data.ord);a_data.tile=data.tile=this.reloadableAds[a_data.reloadableAdId].tile=(mtvn.btg.util.String.isDefined(this.reloadableAds[a_data.reloadableAdId].tile)?this.reloadableAds[a_data.reloadableAdId].tile:data.tile);}
if(mtvn.btg.util.String.isDefined(a_data.loadOrder))
a_data.tile=a_data.loadOrder;return a_data;}
this.hasReloadComplete=function(){var totAdCount=0;for(var i in this.reloadableAds)
totAdCount++;if(counter>totAdCount){counter=1;return true;}
return false;}};mtvn.btg.ads.AtomAd=function(config){this.config=config;this.type="AtomAd";};mtvn.btg.ads.AtomAd.prototype={placeAd:function(data){document.write("[mtvn.btg.ads.AtomAd.placeAd() Stub Method]");}};mtvn.btg.ads.DoubleClickAd=function(config){this.config=config;this.type="DoubleClickAd";this.id;this.server="ad.doubleclick.net";this.ssl=false;this.dartSite;this.contentType="adj";this.mediaType="standard";this.sections;this.keyValues="";this.size;this.zoneOverride=null;this.tile;this.positionThreshold;this.ord;this.additionalKeyValues=[];this.position;this.partner;this.exclusions=[];this.reservedKeyValues={};this.autoDcopt=(config.autoDcopt)?true:false;if(mtvn.btg.util.Object.isDefined(mtvn.btg.ads.AdManager)&&!mtvn.btg.ads.AdManager.dcoptOn){mtvn.btg.ads.AdManager.dcoptOn=false;}
this.isDevEnv=false;if(mtvn.btg.globalvars.IS_TOP_ACCESSIBLE&&top.location.hostname.indexOf("mtvi.com")>-1){this.isDevEnv=true;}
for(var i in config){if(mtvn.btg.util.String.isDefined(config[i])&&(typeof(config[i])=='string'||typeof(config[i])=='number')){if(i=="sections"){this.setSections(config[i]);}
else if(i=="keyValues"){this.setKeyValues(config[i]);}
else if(i=="positionThreshold"){this.setPositionThreshold(config[i]);}
else{this[i]=config[i];}}}};mtvn.btg.ads.DoubleClickAd.prototype={setZoneOverride:function(str){this.zoneOverride=str;},setId:function(str){this.id=str;},setServer:function(str){this.server=str;},setSsl:function(){this.ssl=true;},setDartSite:function(str){this.dartSite=str;},setContentType:function(str){this.contentType=str;},setMediaType:function(str){this.mediaType=str;},setPosition:function(str){this.position=str;},setSections:function(str){str=str.replace(/[^\/\w=!;|-]/g,"_");while(str.match(/\/\d/)){str=str.replace(/\/\d/,RegExp.lastMatch.substring(0,1)+"_"+RegExp.lastMatch.substring(1,2));}
str=str.replace(/^\d/,"_"+str.match(/^\d/,"_"));this.sections=str.replace(/^\/+|\/+$/g,'');if(this.sections.indexOf('.')>-1){this.sections=this.sections.split('.')[0];}},setKeyValues:function(str){str=str.replace(/[^\w=!;|-]/g,"_");this.keyValues=str.replace(/^;+|;+$/g,'');if(this.keyValues.indexOf("mtype=")>-1){this.setMediaType(this.getKeyValue("mtype="));}
if(this.keyValues.indexOf("pos=")>-1){this.setPosition(this.getKeyValue("pos="));}else if(this.keyValues.indexOf("threshold=")>-1){this.setPositionThreshold(this.getKeyValue("threshold="));}},setSize:function(str){this.size=str;},setTile:function(num){this.tile=num;},setPositionThreshold:function(num){if(isNaN(parseInt(num))){this.positionThreshold=null;}else{this.positionThreshold=parseInt(num);}},setOrd:function(num){this.ord=num;},setPartner:function(str){this.partner=str;},addExclusionCategory:function(str){str=str.replace(/^;+|;+$/g,'');this.exclusions.push('!category='+str);},addKeyValues:function(str){if(mtvn.btg.util.String.isDefined(str)&&str.indexOf('=')>-1){this.additionalKeyValues.push(str);}},appendKeyValue:function(str1,str2){if(!mtvn.btg.util.String.isDefined(str1))str1="";if(!mtvn.btg.util.String.isDefined(str2))str2="";str1=str1.replace(/^;+|;+$/g,'');str2=str2.replace(/^;+|;+$/g,'');if(str1.indexOf('=')>-1)str2+=";"+str1;str2=str2.replace(/^;+|;+$/g,'');return str2;},getProtocol:function(){return this.ssl?'https://':'http://';},getPosition:function(){var placement="unk";if(mtvn.btg.util.String.isDefined(this.position)){if(this.position.indexOf("atf")>-1){placement="atf";}else if(this.position.indexOf("btf")>-1){placement="btf";}}else{if(mtvn.btg.util.String.isDefined(this.positionThreshold)){placement=(this.tile<=this.positionThreshold)?"atf":"btf";}}
return placement;},getKeyValue:function(key){var value;if(this.keyValues.indexOf(key)>-1){var temp=this.keyValues.split(key);if(temp.length>0){if(temp[1].indexOf(";")>-1){value=temp[1].substring(0,temp[1].indexOf(";"));}else{value=temp[1];}}}
return value;},getSections:function(){return this.sections;},getContentTypeAbbreviation:function(){var abbr="";if(this.contentType=="pfadx")abbr="p";if(this.contentType=="adj")abbr="j";if(this.contentType=="adi")abbr="i";if(this.contentType=="adx")abbr="x";if(this.contentType=="ad")abbr="a";return abbr;},getExclusions:function(){return this.exclusions.join(';');},formatZone:function(){var posTypeTag=this.getPosition()+'_'+this.getContentTypeAbbreviation()+'_'+this.mediaType.substr(0,1);var zoneValues=posTypeTag+"/";var secValues=this.getSections();if(mtvn.btg.util.String.isDefined(this.keyValues)){if(this.keyValues.indexOf("partner=")>-1){var partner=this.getKeyValue("partner=");if(mtvn.btg.util.String.isDefined(partner)){zoneValues+=partner+"/";this.addExclusionCategory(partner);this.addExclusionCategory("partner");}else{this.addKeyValues("partner=null");}}
if(this.keyValues.indexOf("vertical=")>-1){var vertical=this.getKeyValue("vertical=");if(mtvn.btg.util.String.isDefined(vertical)){secValues=vertical+"/"+secValues;this.setSections(secValues);}}
if(this.keyValues.indexOf("synd=")>-1){var synd=this.getKeyValue("synd=");if(mtvn.btg.util.String.isDefined(synd))this.addExclusionCategory(synd);}}
zoneValues=zoneValues.replace(/^\d/,"_"+zoneValues.match(/^\d/,"_"));return zoneValues+secValues;},formatSectionValues:function(){try{var parts=this.sections.split('/');}catch(e){parts=["[ERROR: Sections Not Defined!]"];}
var count=0;var sections=[];for(x=0;x<parts.length;x++){if(mtvn.btg.util.String.isDefined(parts[x])){sections.push('sec'+count+'='+parts[x]);count++;}}
return sections.join(';');},formatKeyValues:function(){var extraKeyVals=this.getAdditionalKeyValues();if(mtvn.btg.util.String.isDefined(extraKeyVals)){this.keyValues+=";"+extraKeyVals;}
if(this.keyValues.indexOf("pos=")==-1){this.keyValues+=";pos="+this.getPosition();}
if(this.keyValues.indexOf("tag=")==-1){this.keyValues+=";tag="+this.contentType;}
if(this.keyValues.indexOf("mtype=")==-1){this.keyValues+=";mtype="+this.mediaType;}
this.keyValues=this.formatReserved();if(mtvn.btg.util.String.isDefined(this.size)&&this.keyValues.indexOf("sz=")==-1){this.keyValues+=";sz="+this.size;}
if(this.tile>=0&&this.keyValues.indexOf("tile=")==-1){this.keyValues+=";tile="+this.tile;}
var demoVal=mtvn.btg.util.Cookie.read('qcDemo');if(mtvn.btg.util.String.isDefined(demoVal)&&this.keyValues.indexOf("demo=D")==-1){this.keyValues+=";"+unescape(demoVal);}
if(mtvn.btg.util.String.isDefined(this.reservedKeyValues.dcmt)){this.keyValues+=";dcmt="+this.reservedKeyValues.dcmt;}
if(this.autoDcopt&&this.tile=="1"){this.keyValues+=";dcopt=ist";mtvn.btg.ads.AdManager.dcoptOn=true;}
if(mtvn.btg.util.String.isDefined(this.reservedKeyValues.dcopt)){if(mtvn.btg.ads.AdManager.dcoptOn){if(this.tile!="1"&&this.isDevEnv){this.keyValues+=";[ERROR: attempt to set dcopt value more than once per page!]";}}
else{this.keyValues+=";dcopt="+this.reservedKeyValues.dcopt;mtvn.btg.ads.AdManager.dcoptOn=true;}}
if(this.exclusions.length>0){this.keyValues+=";"+this.getExclusions();}
if(mtvn.btg.util.String.isDefined(this.reservedKeyValues.dcove)){this.keyValues+=";dcove="+this.reservedKeyValues.dcove;}
this.keyValues=this.keyValues.replace(/^;+|;+$/g,'');return this.keyValues;},formatReserved:function(){var keyvals=this.keyValues;var reserved=["dcmt","dcopt","dcove"];for(var i=0;i<reserved.length;i++){if(keyvals.indexOf(reserved[i]+"=")>-1){var key=this.getKeyValue(reserved[i]+"=");var tempKeys=keyvals.split(reserved[i]+"="+key);for(var x=0;x<tempKeys.length;x++){tempKeys[x]=tempKeys[x].replace(/^;+|;+$/g,'');}
this.reservedKeyValues[reserved[i]]=key;keyvals=tempKeys.join(';');}}
return keyvals;},formatUValues:function(str){var uvals=str;uvals=uvals.replace(/\;/g,'|');uvals=uvals.replace(/\=/g,'-');return uvals;},getAdditionalKeyValues:function(){return this.additionalKeyValues.join(';');},getValues:function(){var zone=mtvn.btg.util.String.isDefined(this.zoneOverride)?this.zoneOverride:this.formatZone();var keyVals=this.formatKeyValues();var secVals=this.formatSectionValues();var uVals=this.formatUValues(keyVals);if(uVals!=""){uVals="u="+uVals;}
return{id:this.id,protocol:this.getProtocol(),server:this.server,dartSite:this.dartSite,contentType:this.contentType,mediaType:this.mediaType,zone:zone,sections:secVals,keyValues:keyVals,uValues:uVals,ord:this.ord};},formatUrl:function(values){var target=[values.protocol+values.server,values.contentType,values.dartSite,values.zone];var url=target.join("/");var vals=[url,values.sections];if(mtvn.btg.util.String.isDefined(values.keyValues)){vals.push(values.keyValues);}
if(mtvn.btg.util.String.isDefined(values.uValues)){vals.push(values.uValues);}
if(values.ord>0){vals.push('ord='+values.ord+"?");}
return vals.join(";");},getWidth:function(){return this.size.substr(0,this.size.indexOf("x"));},getHeight:function(){return this.size.substr(this.size.indexOf("x")+1,this.size.length);},getUrl:function(){return this.formatUrl(this.getValues());},getJson:function(){var values=this.getValues();values.url=this.formatUrl(values);return values;},getXml:function(){var xml=[];var values=this.getValues();values.url=this.formatUrl(values);for(var i in values){if(typeof(values[i]=='string')){xml.push('<'+i+'>'+'</'+values[i]+'>');}}
return'<doubleClickAd>'+xml.join('')+'</doubleClickAd>';},placeAd:function(a_data){if(this.contentType=="adi"){var frameId="ad"+this.tile;var dimensions=this.size.split('x');var htmlOut='<ifr'+'ame allowtransparency="true" id="'+frameId+'" name="'+frameId+'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" width="'+dimensions[0]+'" height="'+dimensions[1]+'" src="'+this.getUrl()+'"><\/ifr'+'ame>';if(mtvn.btg.globalvars.IS_TOP_ACCESSIBLE&&mtvn.btg.util.String.queryStringToObject(top.location.search).mockupMode=='true'){htmlOut=mtvn.btg.util.String.mockItUp(htmlOut);}
if(mtvn.btg.util.String.isDefined(a_data)&&mtvn.btg.util.String.isDefined(a_data.reloadableAdId))
return htmlOut;else if(typeof exposeTestFunctionNames=='undefined')
document.write(htmlOut);}else{var htmlOut='<scr'+'ipt type="text/javascript" src="'+this.getUrl()+'"><\/scr'+'ipt>';if(mtvn.btg.globalvars.IS_TOP_ACCESSIBLE&&mtvn.btg.util.String.queryStringToObject(top.location.search).mockupMode=='true'){htmlOut=mtvn.btg.util.String.mockItUp(htmlOut);}
if(mtvn.btg.util.String.isDefined(a_data)&&mtvn.btg.util.String.isDefined(a_data.reloadableAdId))
return htmlOut;else if(typeof exposeTestFunctionNames=='undefined')
document.write(htmlOut);}},init:function(data){if(typeof(data)==='object'){if(mtvn.btg.util.String.isDefined(data.zoneOverride))this.setZoneOverride(data.zoneOverride);if(mtvn.btg.util.String.isDefined(data.id))this.setId(data.id);if(mtvn.btg.util.String.isDefined(data.server))this.setServer(data.server);if(mtvn.btg.util.String.isDefined(data.ssl))this.setSsl(data.ssl);if(mtvn.btg.util.String.isDefined(data.dartSite))this.setDartSite(data.dartSite);if(mtvn.btg.util.String.isDefined(data.contentType))this.setContentType(data.contentType);if(mtvn.btg.util.String.isDefined(data.mediaType))this.setMediaType(data.mediaType);if(mtvn.btg.util.String.isDefined(data.position))this.setPosition(data.position);if(mtvn.btg.util.String.isDefined(data.sections))this.setSections(data.sections);if(mtvn.btg.util.String.isDefined(data.keyValues))this.setKeyValues(data.keyValues);if(mtvn.btg.util.String.isDefined(data.size)){this.setSize(data.size);}
else{this.setSize("[ERROR: Size Not Defined!]");}
if(mtvn.btg.util.String.isDefined(data.tile))this.setTile(data.tile);if(mtvn.btg.util.String.isDefined(data.positionThreshold))this.setPositionThreshold(data.positionThreshold);if(mtvn.btg.util.String.isDefined(data.ord))this.setOrd(data.ord);if(mtvn.btg.util.String.isDefined(data.partner))this.setPartner(data.partner);}}};mtvn.btg.ads.InternationalAd=function(config){this.config=config;this.type="InternationalAd";this.ad=new mtvn.btg.ads.DoubleClickAd(config);this.logvalue="0";this.demovalue="none";this.eventvalue="none";this.regionvalue="none";this.keywordvalue="none";this.vidvalue="none";this.vid_typevalue="none";this.ad.formatSectionValues=function(){var parts=this.sections.split('/');var sec0="none";var sec1="none";var secn="none";var temparr=[];if(mtvn.btg.util.String.isDefined(parts[0])){sec0=parts[0];}else{sec0="_hp";};if(mtvn.btg.util.String.isDefined(parts[1])){sec1=parts[1];};if(mtvn.btg.util.String.isDefined(parts[2])){for(x=2;x<parts.length;x++){if(mtvn.btg.util.String.isDefined(parts[x])){temparr.push(parts[x]);}}
secn=temparr.join("/");};var result="sec0="+sec0+";sec1="+sec1+";secN="+secn;return result;};this.ad.formatUValues=function(){return"";}
this.init=function(data){}};mtvn.btg.ads.InternationalAd.prototype={placeAd:function(data){this.ad.sections=data.sections;this.ad.setSize(data.size);this.ad.setTile(data.tile);this.ad.setPositionThreshold(data.tile);this.addInternationalValues(data);this.ad.setOrd(data.ord);if(data.getUrl)
{if(typeof exposeTestFunctionNames=='undefined')document.write(this.ad.getUrl());}
else
{var htmlOut='<br><scr'+'ipt type="text/javascript" src="'+this.ad.getUrl()+'"><\/scr'+'ipt>';if(mtvn.btg.globalvars.IS_TOP_ACCESSIBLE&&mtvn.btg.util.String.queryStringToObject(top.location.search).mockupMode=='true'){htmlOut=mtvn.btg.util.String.mockItUp(htmlOut);}
if(typeof exposeTestFunctionNames=='undefined')document.write(htmlOut);}},addInternationalValues:function(data){if(mtvn.btg.util.String.isDefined(data.log)){this.ad.addKeyValues("log="+data.log);};if(mtvn.btg.util.String.isDefined(data.demo)){this.ad.addKeyValues("demo="+data.demo);};if(mtvn.btg.util.String.isDefined(data.event)){this.ad.addKeyValues("event="+data.event);};if(mtvn.btg.util.String.isDefined(data.keyword)){this.ad.addKeyValues("search_kw="+data.keyword);};if(mtvn.btg.util.String.isDefined(data.vid)){this.ad.addKeyValues("vid="+data.vid);};if(mtvn.btg.util.String.isDefined(data.vid_type)){this.ad.addKeyValues("vid_type="+data.vid_type);};if(mtvn.btg.util.String.isDefined(data.region)){this.ad.addKeyValues("region="+data.region);};this.ad.addKeyValues("url="+escape(data.sections));}};var com=typeof com==='object'?com:{};com.mtvi=typeof com.mtvi==='object'?com.mtvi:{};com.mtvi.reporting=typeof com.mtvi.reporting==='object'?com.mtvi.reporting:{};com.mtvi.ads=typeof com.mtvi.ads==='object'?com.mtvi.ads:{};com.mtvi.config=typeof com.mtvi.config==='object'?com.mtvi.config:{};com.mtvi.util=typeof com.mtvi.util==='object'?com.mtvi.util:{};com.mtvi.util.IFrameReloader=typeof com.mtvi.util.IFrameReloader==='object'?com.mtvi.util.IFrameReloader:{};com.mtvi.metadata=typeof com.mtvi.metadata==='object'?com.mtvi.metadata:{};com.mtvi.reporting.Controller=new function(){this.initalized=false;this.initialize=function(){mtvn.btg.Controller.init();this.initalized=true;};this.sendCall=function(data){mtvn.btg.Controller.sendPageCall(data);};this.sendLinkEvent=function(data){mtvn.btg.Controller.sendLinkEvent(data);};this.registerLinks=function(){return true;};this.setConfig=function(data){for(var i in data){mtvn.btg.config.ReportSettings.Omniture[i]=data[i];}
return true};this.addRegisterLinks=function(){return true;}
this.setDefaultData=function(k,v){if(mtvn.btg.util.String.isDefined(k)){mtvn.btg.config.ReportSettings.Omniture[k]=mtvn.btg.util.String.isDefined(v)?v:'';return true}
else{return false;}}};com.mtvi.reporting.Dispatcher=function(){this.getValOnce=function(v,c,e){return true};this.sendCall=function(data){data=(mtvn.btg.util.Object.isDefined(data)?data:(mtvn.btg.util.Object.isDefined(com.mtvi.config.SectionSetup)?com.mtvi.config.SectionSetup:{}));if(!com.mtvi.reporting.Controller.initalized){mtvn.btg.Controller.init();com.mtvi.reporting.Controller.initalized=true;}
mtvn.btg.Controller.sendPageCall(data);this.clearAllVars();};this.sendLinkEvent=function(data){var objOmniture=(com.mtvi.reporting.Controller.initalized?mtvn.btg.reporting.omniture.Hcode:mtvn.btg.config.ReportSettings.Omniture);for(var i=1;i<=50;i++){objOmniture["eVars"+i]='';objOmniture["prop"+i]='';if(i<6){objOmniture["hier"+i]='';}}
objOmniture["pageName"]='';objOmniture["channel"]='';if(!com.mtvi.reporting.Controller.initalized){mtvn.btg.Controller.init();com.mtvi.reporting.Controller.initalized=true;}
mtvn.btg.Controller.sendLinkEvent(data);};this.registerLinks=function(){return true;}
this.setAttribute=function(k,v){if(mtvn.btg.util.String.isDefined(k)){var objOmniture=(com.mtvi.reporting.Controller.initalized?mtvn.btg.reporting.omniture.Hcode:mtvn.btg.config.ReportSettings.Omniture);objOmniture[k]=mtvn.btg.util.String.isDefined(v)?v:'';return true}
else{return false;}};this.getAttribute=function(k){var objOmniture=(com.mtvi.reporting.Controller.initalized?mtvn.btg.reporting.omniture.Hcode:mtvn.btg.config.ReportSettings.Omniture);return objOmniture[k];};this.setValues=function(data){for(var i in data){this.setAttribute(i,data[i]);}
return true};this.setDefaultData=function(){};this.clearProps=function(){try{for(var p=1;p<=50;p++){this.widget.setAttribute("prop"+p,"");}}catch(e){}};this.clearAllVars=function(){var objOmniture=(com.mtvi.reporting.Controller.initalized?mtvn.btg.reporting.omniture.Hcode:mtvn.btg.config.ReportSettings.Omniture);try{for(var p=1;p<=50;p++){objOmniture["prop"+p]="";}
for(var e=1;e<=50;e++){objOmniture["eVars"+e]="";}
for(var h=1;h<=5;h++){objOmniture["hier"+h]="";}
objOmniture["pageName"]="";objOmniture["channel"]="";}catch(e){}}}
com.mtvi.reporting.MediaPlayer={addPlayer:function(id){var player=mtvn.btg.reporting.MediaPlayer.addPlayer(id);return player['id'];}}
com.mtvi.ads.AdManager=new function(){var adType="";var reloadInterval=300000;this.setDartSite=function(a_dartSite){try{if(mtvn.btg.config.AdSettings.DoubleClick.enabled&&!mtvn.btg.util.String.isDefined(mtvn.btg.config.AdSettings.DoubleClick.dartSite)){mtvn.btg.config.AdSettings.DoubleClick.dartSite=a_dartSite;}}
catch(e){}};this.setPositionThreshold=function(a_positionThreshold){try{if(mtvn.btg.config.AdSettings.DoubleClick.enabled&&!mtvn.btg.util.String.isDefined(mtvn.btg.config.AdSettings.DoubleClick.positionThreshold)){mtvn.btg.config.AdSettings.DoubleClick.positionThreshold=a_positionThreshold;}}
catch(e){}};this.setSiteName=function(a_siteName){try{if(mtvn.btg.config.AdSettings.DoubleClick.enabled&&!mtvn.btg.util.String.isDefined(mtvn.btg.config.AdSettings.DoubleClick.siteName)){mtvn.btg.config.AdSettings.DoubleClick.siteName=a_siteName;}}
catch(e){}};this.setDefaultSections=function(a_defaultSections){if(mtvn.btg.util.String.isDefined(a_defaultSections))
mtvn.btg.config.AdSettings.DoubleClick.sections=a_defaultSections;};this.setKeyValues=function(a_keyValues){try{if(mtvn.btg.config.AdSettings.DoubleClick.enabled&&!mtvn.btg.util.String.isDefined(mtvn.btg.config.AdSettings.DoubleClick.keyValues)){mtvn.btg.config.AdSettings.DoubleClick.keyValues=a_keyValues;}}
catch(e){}};this.getFormattedSections=function(a_sections){var retVal=a_sections;try{retVal=(a_sections=='/')?a_sections:mtvn.btg.util.String.charTrim(a_sections,'/');var sectionsLength=a_sections.length;var difn="index";if(mtvn.btg.util.Object.isDefined(com.mtvi.reporting.Account)&&mtvn.btg.util.String.isDefined(com.mtvi.reporting.Account.defaultIndexFileName)){difn=com.mtvi.reporting.Account.defaultIndexFileName;}
if(mtvn.btg.util.Object.isDefined(mtvn.btg.config.AdSettings)&&mtvn.btg.util.String.isDefined(mtvn.btg.config.AdSettings.defaultIndexFileName)){difn=mtvn.btg.config.AdSettings.defaultIndexFileName;}
difn=mtvn.btg.util.String.stripFileExtension(difn);var hpCases=['/',difn,"home/"+difn];for(var i=0;i<hpCases.length;i++){if(a_sections.indexOf(hpCases[i])==0&&sectionsLength==hpCases[i].length){retVal=a_sections.replace(hpCases[i],'_hp');break;}}
if(retVal==''){retVal="_hp";}
var sectionArray=mtvn.btg.util.String.stripFileExtension(retVal).split('/');if(sectionArray.length==2){if(sectionArray[1]==difn){retVal=mtvn.btg.util.String.stripFileExtension(retVal).replace(difn,'_mn');}}}
catch(e){}
return retVal;};this.placeAd=function(a_adParametersObj){try{if(typeof(mtvn.btg.config.AdSettings.isCodaAdsUsed)!='undefined')
mtvn.btg.config.AdSettings.isCodaAdsUsed=true;if(!com.mtvi.reporting.Controller.initalized){mtvn.btg.Controller.init();com.mtvi.reporting.Controller.initalized=true;}
if(!mtvn.btg.util.String.isDefined(a_adParametersObj.sections)){if(mtvn.btg.util.Object.isDefined(mtvn.btg.config.AdSettings.DoubleClick)&&mtvn.btg.util.String.isDefined(mtvn.btg.config.AdSettings.DoubleClick.sections)){a_adParametersObj.sections=mtvn.btg.config.AdSettings.DoubleClick.sections;}
else{a_adParametersObj.sections=mtvn.btg.util.Sections.getAdSections();}}
a_adParametersObj.sections=this.getFormattedSections(a_adParametersObj.sections);mtvn.btg.ads.AdManager.placeAd(a_adParametersObj);}
catch(e){}};this.setServer=function(a_server){try{if(mtvn.btg.config.AdSettings.DoubleClick.enabled&&!mtvn.btg.util.String.isDefined(mtvn.btg.config.AdSettings.DoubleClick.server)){mtvn.btg.config.AdSettings.DoubleClick.server=a_server;}}
catch(e){}};this.setSsl=function(){try{if(mtvn.btg.config.AdSettings.DoubleClick.enabled&&!mtvn.btg.util.String.isDefined(mtvn.btg.config.AdSettings.DoubleClick.ssl)){mtvn.btg.config.AdSettings.DoubleClick.ssl=true;}}
catch(e){}};this.setDefaultContentType=function(a_defaultContentType){try{if(mtvn.btg.config.AdSettings.DoubleClick.enabled&&!mtvn.btg.util.String.isDefined(mtvn.btg.config.AdSettings.DoubleClick.contentType)){mtvn.btg.config.AdSettings.DoubleClick.contentType=a_defaultContentType;}}
catch(e){}};this.setZoneOverride=function(a_zone){try{if(mtvn.btg.config.AdSettings.DoubleClick.enabled&&!mtvn.btg.util.String.isDefined(mtvn.btg.config.AdSettings.DoubleClick.zoneOverride)){mtvn.btg.config.AdSettings.DoubleClick.zoneOverride=a_zone;}}
catch(e){}};this.IFrameAds=[];this.placeIFrameAd=function(a_adParametersObj){try{if(typeof(mtvn.btg.config.AdSettings.isCodaAdsUsed)!='undefined')
mtvn.btg.config.AdSettings.isCodaAdsUsed=true;var ad=this.getAd(a_adParametersObj);var adReloader=new com.mtvi.util.IFrameReloader(a_adParametersObj.containerId);adReloader.src=ad.getUrl();adReloader.width=ad.getWidth();adReloader.height=ad.getHeight();adReloader.write();if(a_adParametersObj.reloadAd){this.IFrameAds.push(adReloader);}}catch(e){}};this.setReloadInterval=function(num){try{reloadInterval=parseInt(num);mtvn.btg.util.Events.addListener(window,"load",function(){try{window.setInterval("com.mtvi.ads.AdManager.reloadIFrameAds()",reloadInterval);}catch(e){}});}catch(e){}};this.setAdClass=function(a_class){if(a_class=="InternationalAd"){adType="InternationalAd";}};this.getAdById=function(a_adId){return null;};this.getDartSite=function(){var retVal=null;try{if(mtvn.btg.util.String.isDefined(mtvn.btg.ads.AdManager.data.dartSite)){retVal=mtvn.btg.ads.AdManager.data.dartSite;}}
catch(e){try{retVal=mtvn.btg.config.AdSettings.DoubleClick.dartSite;}
catch(e){}}
return retVal;};this.getAd=function(a_adParametersObj){var retVal=null;try{retVal=mtvn.btg.ads.AdManager.getAd(a_adParametersObj);}
catch(e){}
return retVal;};this.getReloadInterval=function(){try{return reloadInterval;}catch(e){}};this.reloadIFrameAds=function(){for(var x=0;x<this.IFrameAds.length;x++){this.reloadIFrameAd(x);}};this.reloadIFrameAd=function(index){var src=this.IFrameAds[index].src;if(index==0)ord=Math.random(100000000000000000,999999999999999999);if(src.indexOf("ord=")>-1){src=src.split("ord=")[0]+"ord="+ord+"?";}
this.IFrameAds[index].src=src;this.IFrameAds[index].reload();};this.setZone=function(zone){};this.getNewAd=function(adObject){};this.populateNamesValuesObj=function(nameValues){};}
com.mtvi.ads.DoubleClickAd=function(params){};com.mtvi.ads.DoubleClickAd.prototype={setZoneOverride:function(str){},setDartSite:function(str){},setOrd:function(num){},placeAd:function(){},getXml:function(){return null;},getJson:function(){return null;},getUrl:function(){return null;},getSections:function(){return null;},setSize:function(str){},setSections:function(str){},setContentType:function(str){},setKeyValues:function(str){},setTile:function(num){},setPositionThreshold:function(num){},setServer:function(str){},setSsl:function(){},setMediaType:function(str){},setPosition:function(str){},setPartner:function(str){},setId:function(str){}};com.mtvi.reporting.FluxWidgeted={setVars:function(){return true;}};com.mtvi.reporting.GoogleAnalytics={makeCall:function(id,uri){return true;}};com.mtvi.reporting.QuantCast=new function(){this.sendQuantCastCall=function(a_labels){return true;};};com.mtvi.reporting.Search={setVars:function(obj){return true;},sendLinkEvent:function(obj){return true;},setConversion:function(){return true;},setSynConversion:function(){return true;}};com.mtvi.util={toObject:function(string,delimiter){var delimiter=delimiter?delimiter:',';var array=string.split(delimiter);var object={};for(var x=0;x<array.length;x++){var pairs=array[x].split('=');object[pairs[0]]=pairs[1];}
return object;},queryStringToHash:function(string){return mtvn.btg.util.String.queryStringToObject(string);},isDefined:function(value){return mtvn.btg.util.String.isDefined(value);},readCookie:function(name){return mtvn.btg.util.Cookie.read(name);},deleteCookie:function(name){mtvn.btg.util.Cookie.remove(name);},crawlNodes:function(node){return mtvn.btg.util.Window.getNodeLinkName(node);},addOnloadEvent:function(func){return mtvn.btg.util.Events.addListener(window,"load",func);}}
com.mtvi.reporting.ComScore=new function(){this.sendComScoreCall=function(){}};com.mtvi.metadata={getDefaultPageName:function(){var pageName='';try{pageName=mtvn.btg.config.ReportSettings.defaultPageName;if(pageName.lastIndexOf("/")==(pageName.length-1)){if(mtvn.btg.util.String.isDefined(mtvn.btg.config.ReportSettings.indexFileName)){pageName+=mtvn.btg.config.ReportSettings.indexFileName;}
else{pageName=(pageName!='/')?mtvn.btg.util.String.charRtrim(pageName,'/'):pageName;}}
if(pageName!='/'){pageName=mtvn.btg.util.String.charRtrim(pageName,'/');}
if(pageName!='/'&&pageName.indexOf('/')==0){pageName=pageName.substring(1);}
if(pageName.indexOf('/')==-1&&pageName.indexOf(mtvn.btg.config.ReportSettings.indexFileName)!=-1){pageName='home/'+pageName;}}
catch(e){return null;}
return pageName;},getDefaultHierarchy:function(){try{var hier=this.getDefaultPageName();if(hier=='/')hier='';}
catch(e){return null;}
return hier;},getDefaultChannel:function(){try{var channel=this.getDefaultPageName();if(channel!='/')
channel=channel.split('/')[0];}
catch(e){return null;}
return channel;}};com.mtvi.util.IFrameReloader=function(containerId){try{this.containerId=containerId;this.id="IFrameReloader"+Math.random(0,1000000);this.width;this.height;this.src;this.lastLoaded=0;}catch(e){}};com.mtvi.util.IFrameReloader.prototype={reload:function(){try{var date=new Date();var now=(date.getMinutes()*60000)+(date.getSeconds()*1000);var elapsed=now-this.lastLoaded;if(elapsed>5000){var n=document.getElementById(this.containerId);var i=document.createElement("iframe");i.id=this.id;i.width=this.width;i.height=this.height;i.style.width=this.width;i.style.height=this.height;i.src=this.src;i.frameBorder="0";i.scrolling="no";i.marginheight="0";i.marginwidth="0";i.style.margin="0";i.style.zIndex="99";i.style.border="0";i.style.borderWidth="0px";n.removeChild(document.getElementById(this.id));n.appendChild(i);}
this.lastLoaded=now;}catch(e){}},write:function(){try{var html='<iframe id="'+this.id+'" src="'+this.src+'" width="'+this.width+'" height="'+this.height+'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"><\/iframe>';if(mtvn.btg.globalvars.IS_TOP_ACCESSIBLE&&mtvn.btg.util.String.queryStringToObject(top.location.search).mockupMode=='true'){html=mtvn.btg.util.String.mockItUp(html);}
document.write(html);}catch(e){}}};
mtvn.btg.config.ReportSettings={
version : '2.21',
defaultPageName:mtvn.btg.globalvars.PAGE_URL,
Omniture:{
enabled: true,
account: (typeof com_mtvi_mtv2flag!="undefined"&&com_mtvi_mtv2flag==true?'viamtv,viamtv2onmtv':'viamtv'), 
charSet: 'ISO-8859-1',
dynamicAccountSelection: 'true',
dynamicAccountList: 'devviamtv=mtv-d,mtv-q,mtv-jd,mtv-jq,mtvx-d,mtvx-jd',
linkInternalFilters: 'javascript:,mtv.com,mtvx.com,mtvn.com',
videoViewEventDisable: false,
enableTimeParting: true,
trackInlineStats: true,
defaultHier: 'hier2'
},
Nielsen:{
enabled: false,
cid: 'us-400235',
videoCensusId: 'c02'
},
GoogleAnalytics:{
enabled: false,
account: '',
reportMode: '' // iframe/direct
},
QuantCast:{
enabled: true,
labels: 'MTVN Music and Logo Domestic,MTVN Music,MTVN Global Digital Proper,MTVN Global Digital Network,MTVN Digital Tribes,MTV Site,MTV plus Generation,MTV Digital,MTVN Music and Logo Global Network,MTVN Music and Logo Global Proper,MTVN Music and Logo Tribes',
reportMode: 'ads' //direct/ads
},
ComScore:{
enabled: true
}
};
mtvn.btg.config.AdSettings={
isCodaAdsUsed: false,
DoubleClick:{
enabled: true,
dartSite: 'mtv.mtvi'
},
International:{
enabled: false,
dartSite: ''
},
QuantCast:{ 
enabled: true
}
}; 

MTV.BTG = new function(){
var self = this;

var loc = location.pathname;
this.autoDcopt = true;

/* temp code to support old survey tag */
this.writeSurveyTag = function(dcCallWithPlaceholders) {
var keyVals="";

if (MTVN.Ads.sections == '') {
path = loc;
} else {
path = MTVN.Ads.sections;
}
if (location.pathname.substr(-6) == ".jhtml") {
path = path.substr(0,path.length-6);
}

var parts=path.split("/");
parts = parts.splice(1);

for (var i=0; i < parts.length; i++) {
keyVals += "sec" + i + "=" + parts[i] +";";
}
keyVals = keyVals.substr(0,keyVals.length-1); //remove trailing semi-colon

var dcCall = dcCallWithPlaceholders.replace(/\{pageValsParam\}/, keyVals );
dcCall = dcCall.replace(/\{ord\}/, Math.random() * 1000000000000000000);

var surveyScript = '<ifr' + 'ame src="' + dcCall + '?" width="1" height="1"><\/ifr'+'ame>';

document.write(surveyScript);
};

this.init = function() {

MTVN.Ads.handleAdditionalValues();

mtvn.btg.config.AdSettings.DoubleClick.keyValues = MTVN.Ads.additionalValues.replace("Gracenote", "gn");

if(MTVN.Ads.dartSite.length > 0) {
mtvn.btg.config.AdSettings.DoubleClick.dartSite = MTVN.Ads.dartSite;
}

if(MTVN.Ads.sections.length > 0) {
mtvn.btg.config.AdSettings.DoubleClick.sections = MTVN.Ads.sections;
}

mtvn.btg.config.AdSettings.DoubleClick.positionThreshold="2";
mtvn.btg.config.AdSettings.DoubleClick.autoDcopt=self.autoDcopt;

mtvn.btg.config.ReportSettings.indexFileName = "index.jhtml";
mtvn.btg.config.ReportSettings.Omniture.trackExternalLinks = true; 
mtvn.btg.config.ReportSettings.Omniture.videoViewEventDisable = true;

if(typeof com_mtvi_mtv2flag!="undefined" && com_mtvi_mtv2flag==true) {
mtvn.btg.config.ReportSettings.Omniture.account = 'viamtv,viamtv2onmtv';
}
if(typeof com_mtvi_attpostedflag!="undefined" && com_mtvi_attpostedflag==true) {
mtvn.btg.config.ReportSettings.Omniture.account = 'viamtv,viaposted';
}

mtvn.btg.Controller.init(); 

MTV.BTG.observeDailyFreshClicks();
}

this.observeDailyFreshClicks = function() {
// make sure the DOM is loaded
$j(function(){
// for each feed-wrap - THERE SHOULD ONLY BE ONE
$j('.feed-wrap').each(function(){
var feed_wrap = $j(this);

// add click events to all links within promo modules
feed_wrap.find('.mdl.mdl-rich').each(function(){
var promo = $j(this);

var id = promo.attr('id').replace(/:/g, '/') + '.xml';

promo.find('a').click(function(){
// report click to CODA
// http://confluence.mtvi.com/display/BUSTECH/CODA+Link+Events
mtvn.btg.Controller.sendLinkEvent({
linkName : 'HP:FEED:' + id,
linkType : 'o'
});

return true;
});
});

// add click events to pagination
feed_wrap.find('.feedPagination a').click(function(){
var page_index = parseInt($j(this).text());
// report click to CODA
// http://confluence.mtvi.com/display/BUSTECH/CODA+Link+Events
mtvn.btg.Controller.sendLinkEvent({
linkName : 'HP:FEED:PAGINATION:' + page_index,
linkType : 'o'
});
});
});

})
}

this.setPageUrl = function(pageUrl) {
if (pageUrl.charAt(0) != "/") pageUrl = "/" + pageUrl;

var str = "/news/photos/";
if(pageUrl.substr(0,str.length) == str) {
pageUrl = pageUrl.replace(/\/news\/photos\/.\//, str);
}	

var adPageUrl = pageUrl
.replace(/movieawards/, 'ma')
.replace(/onair|ontv/i, 'shows')
.replace(/home\/index.jhtml/i, '_hp')
.replace(/main\/index.jhtml/i, '_mn');

if (MTVN.Ads.sections == '') MTVN.Ads.sections = adPageUrl;
MTV.Reporting.setPageName(pageUrl);
}

this.pageOverride = function() {
if (arguments.length > 0) {
loc = loc.replace(arguments[0], arguments[1]);
}

var overrides = ["/news/articles/", "/movies/news/articles/"]; 

if(loc.substr(0,overrides[0].length) == overrides[0]) {
loc = loc.replace(/\/news\/articles\/\d*\/\d*\//, overrides[0]);
}
if(loc.substr(0,overrides[1].length) == overrides[1]) {
loc = loc.replace(/\/movies\/news\/articles\/\d*\//, overrides[1]);
}
self.setPageUrl(loc);
}
}

MTV.Reporting = new function(){
var self = this;
var temp;

var isDefined = function(val) {
return !(typeof val == 'undefined');
}

this.dispatcherAttributes = "";
this.qs = mtvn.btg.util.String.queryStringToObject(window.location.search);

this.map = {
artist: "prop1",
fullBlogName: "prop10",
vidOrigin: "prop12",
partner: "prop16",
source: "prop17",
story: "prop18",
storyDate: "prop19",
author: "prop20",
rollUp: "prop28",
bps: "prop24",
fla: "prop25",
betaUsage: "prop34",
gamename: "prop23",
contentType: "prop37",
event: function(val){
if (self.eventNames.join(",").search(val) > 0)
self.data["prop44"] = val;
},

songTitle: function(val){
if(isDefined(val)) {
self.temp = val;
}
}
}	

this.eventNames = ['ma08','ma09','maYAH','VMA','woodiesYAH','woodies','ma10','att10', 'vma10'];

this.data = {
eVar35:(self.qs.cmp?self.qs.cmp:null)	
};

this.setPageName = function(val) {

//replace ontv with onair in ontv urls, Evan Rose 3/18/10 
var newPagenameVal = val
.replace(/ontv/i, 'onair');

self.data.pageName = newPagenameVal;
}

//External Campaign Tracking (SHOULD BE REMOVED WHEN THE NEW USVR IS DEPLOYED!!!)
if(typeof self.qs.sem=="string") mtvn.btg.reporting.campaign = self.qs.sem;
else if(typeof self.qs.extcmp=="string") mtvn.btg.reporting.campaign = self.qs.extcmp;
else mtvn.btg.reporting.campaign = "";
self.data["prop42"] = mtvn.btg.reporting.campaign;
self.data["campaign"] = mtvn.btg.reporting.campaign;
//End External Campaign Tracking

this.report = function() {
self.addAttributes(self.dispatcherAttributes);
self.addAttributes(MTVN.Ads.additionalValues, false);
mtvn.btg.Controller.sendPageCall(self.data);
}

this.addAttributes = function(aString, aPassThru){
if (aString.length < 1)
return false;

var passThru = ((typeof aPassThru != 'undefined')? aPassThru: true);

var attrs = aString.split(";");
for (var i=0; i < attrs.length; i++) {

if(attrs[i]!=""){
var pair = attrs[i].split("=");	
if(typeof self.map[pair[0]] != 'undefined') {
if (typeof self.map[pair[0]] == 'string') {
self.data[self.map[pair[0]]] = pair[1];
} else {
self.map[pair[0]](pair[1]);
}
} else {
if(passThru) {
self.data[pair[0]] = pair[1];	
}
}

}
}
}

this.reportIMX = function(tagUrl, protocol, params){
var imxTag = new Image();
if ((protocol=="flipbook" && !(document.referrer.indexOf("fid="+params) > -1)) || (protocol != 'flipbook')){
imxTag.src = tagUrl;
}
}
}

MTV.Apps = new function(){}

MTV.Apps.Mamabar = new function(){
this.configObj;

this.init = function(){
if(MTV.Apps.Mamabar.configObj != undefined){	
var config = MTV.Apps.Mamabar.configObj;

var attributes = "";	
if(config.search!=undefined) attributes += " search=\"" + config.search + "\"";
if(config.footer!=undefined) attributes += " footer=\"" + config.footer + "\"";
if(config.theme!=undefined) attributes += " theme=\"" + config.theme + "\"";
if(config.head!=undefined) attributes += MTV.Apps.Mamabar.makeLinksObject(config.head, "head");
if(config.footerMidCol!=undefined) attributes += MTV.Apps.Mamabar.makeLinksObject(config.footerMidCol, "foot_midcol");
if(config.footerRightCol!=undefined) attributes += MTV.Apps.Mamabar.makeLinksObject(config.footerRightCol, "foot_rightcol");

var mamabar = "<scr" + "ipt type=\"text/javascript\" src=\"/widgets/scripts/mamma.jhtml\"" + attributes + "><\/scr"+"ipt>";
document.write(mamabar);
}
}

this.makeLinksObject = function(linksObj, name){
var prop = " " + name + "=\"";
prop += "{";
if(linksObj.link instanceof Array){
for (var i=0; i < linksObj.link.length; i++){
prop += MTV.Apps.Mamabar.makeLink(linksObj.link[i]);
if(i < linksObj.link.length-1) prop += ",";
}
}
else {
prop += MTV.Apps.Mamabar.makeLink(linksObj.link);
}
prop += "}\"";
return prop;
}

this.makeLink = function(linkObj){
var link = "";
link += "'" + linkObj.content + "'";
link += ":";
link += "'" + linkObj.args + "'";
return link;
}
}

MTV.Typeahead = new function(){

var default_options = {
minChars: 1,
scrollHeight: 300,
jsonpCallback: 'mtvSearchJSONP',
matchSubset: false,
selectFirst: false,
formatItem: function(item) {
return item;
},
parse: function(data) {
var parsed = [];
$j.each(data, function(i) {
var row = $j.trim(this);
parsed[i] = { data: row, value: row, result: row }
});
return parsed;
}
};

this.init = function(){
MTV.Typeahead.autocomplete('form[name="search"] input[type="text"]');
MTV.Typeahead.autocomplete('form[name="searchF"] input[type="text"]');

}

this.autocomplete = function(selector, options, callback) {

var typehead_options = {};
$j.extend(typehead_options, default_options, options || {});

callback = callback || function(){
var input = $j(this);
/* this blows- too tied to the "search" structure */
input.closest('form').find('button.mtv').click();
};

$j(selector).each(function(){
var input = $j(this);

// we subtract the padding of the autocomplete container class here
// this is defined by .ac_results selector
if (!typehead_options['width']) {
typehead_options['width'] = parseInt(input.outerWidth()) - 8;
}

var url = "http://search.mtvnservices.com/typeahead/suggest/?siteName=mtv&format=json";

input.autocomplete(url, typehead_options).result(callback);
});
}
}
MTV.Search = new function(){

var SEARCH_TERM_REGEX = /q=([^&|\s]+)/;

this.init = function(){
var self = this;
var search_forms = 'form[name="search"], form[name="searchF"]';
$j(search_forms).each(function(){
self.addEventListeners(this);
self.setSearchTerm(this);
});
}

this.setSearchTerm = function(selector) {
var query_string = document.location.search;
if (query_string.length < 1) { return; }

var search_term = query_string.match(SEARCH_TERM_REGEX);
if (search_term) {
search_term = unescape(search_term[1]);
$j(selector).find('input[type="text"]').val(search_term);
}
}

this.addEventListeners = function(selector) {
var self = this;
$j(selector).each(function(){
var form = $j(this);
// deactivate submit
form.submit(function(){
return false;
});

var goButton = form.find('button.mtv');
var webButton = form.find('button.web');
var input = form.find('input[type="text"]');

// clear input on click
input.click(function(){
$j(this).val('');
return false;
});

// watch for user enter
input.keypress(function(event){
if (event.keyCode == 13) {
self.submit(input.val(), 'mtv');
return false;
}
});

// web submit
webButton.click(function(){
self.submit(input.val(), 'web');
});

// mtv submit
goButton.click(function(){
self.submit(input.val(), 'mtv');
});

});
}

this.submit = function(value, type) {
value = value.replace(/^\s*|\s(?=\s)|\s*$/g, "").toLowerCase();
if (value == "search" || value.length == 0) {
return false;
}

if (type == 'web') {
var msUrl ='http://search.live.com/results.aspx?q=' + value + '&amp;mkt=en-us&amp;FORM=VCM004';
var msWindow = window.open(msUrl);
com.mtvi.reporting.Dispatcher.setAttribute("eVar3","web");
com.mtvi.reporting.Dispatcher.sendLinkEvent({linkName:"MSN_Live_Search",linkType:"e",lnk:this});
}
else {
window.location = this.getBaseUrl() + '/search/?q=' + value;
}
return false;
}

this.getBaseUrl = function() {
if(window.location.hostname.match(/(www.mtvx?-j?[dq].mtvi.com)/)){
return '';
}
else{
if( window.location.hostname.indexOf("mtv-d.mtvi.com") != -1 ) {
return 'http://www.mtv-d.mtvi.com';
} else if (window.location.hostname.indexOf("mtv-q.mtvi.com") != -1 ) {
return 'http://www.mtv-q.mtvi.com';
} else {
return 'http://www.mtv.com';
}
}
}
}

MTV.Player = new function(){

var navOverride;
var franchiseLinksUrl;
var tuneInPromo;

this.init = function(){

// handle nav
if(navOverride != undefined){
if($j("#header.franchise").length == 0) {
$j("#navlist-wrap").empty();
$j("#searchmtv, #artistlist,").remove();

// remove elements not required from the global nav and add internical styles to header structure
$j('#mtvSitesNav').remove();
$j('div.memberbarlinks').remove();
$j('#nav #mtvLogo').remove();
$j('#topnavLinks').remove();
$j('#container-inner').addClass('franchise');
$j('#header').addClass('franchise');
$j('#nav').removeClass('globalNav').addClass('franchise-navigation').addClass('franchise');
$j('#header').prepend('<a id="logo-link" href="/">mtv</a>');
$j('#nav').removeClass('hidden');

var scriptUrl = "/videos/scripts/nav.jhtml?nav="+navOverride;
$j.ajax({type: "GET", url: scriptUrl, dataType: "script", cache: true});
}
}
$j("#searchmtv, #artistlist, #navlist-wrap").css("visibility", "visible");
$j('#nav').removeClass('hidden');

}

this.localFeedHandler = function(){
if(MTVN.Player.feed.document.navOverride!=undefined) navOverride = MTVN.Player.feed.document.navOverride;
if(MTVN.Player.feed.document.franchiseLinksUrl!=undefined) franchiseLinksUrl = MTVN.Player.feed.document.franchiseLinksUrl;
if(MTVN.Player.feed.document.tuneInPromo!=undefined) tuneInPromo = MTVN.Player.feed.document.tuneInPromo;
if(MTVN.Player.feed.document.hat!=undefined) MTV.setHat("h-" + MTVN.Player.feed.document.hat);
MTV.setTheme(MTVN.Player.feed.document.theme);

// handle keywords
if(MTVN.Player.feed.document.keywords != undefined){
if(MTVN.Player.feed.document.keywords.indexOf("MTV2") > -1) com_mtvi_mtv2flag = true;
}

if(MTVN.Player.feed.document.mamabar!=undefined) MTV.Apps.Mamabar.configObj = MTVN.Player.feed.document.mamabar;
}

this.localModulesHandler = function(){
if(franchiseLinksUrl != undefined){
var container = $j("#franchiseLinks");
if(container.is("*")){
// get custom franchise link url
$j.get(franchiseLinksUrl, function(data){
container.append(data);
});
}
}
if(tuneInPromo != undefined){
var container = $j(".group-c");
if(container.is("*")){
// get custom franchise link url
$j.get(tuneInPromo, function(data){
container.prepend(data);
});
}
}
}
}

MTV.UI = new function(){
this.iframes = new Array();

this.initIframes = function(){
var parent_doc = parent.document;

for(var i=0; i < MTV.UI.iframes.length; i++){
// update height
var iframe = $j("#"+MTV.UI.iframes[i], parent_doc);
poll_height = $j(".iframe-mdl").height();
iframe.height(poll_height);
}
}
}

MTV.Content = new function(){}

MTV.Content.RSS = new function(){
this.open = function(obj){
var dataUrl = "/rss/xml/detail.jhtml?rssId=" + obj.id;
MTVN.UI.ModalWindow.open(dataUrl, obj.id);
}
}

MTV.Content.Rhapsody = new function(){

/***** ARTIST PAGE TOP SONGS MODULE *****/
this.getRhapTracksRSS = function (xmlstring) {
var xmlDoc;
var parser;
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(xmlstring);
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
parser=new DOMParser();
xmlDoc=parser.parseFromString(xmlstring,"text/xml");
}
catch(e) {}
}
try 
{ 
var trackValTop = "";
var trackValDesc = "";
var trackVal = "";
var songSlat = "";

for (var i=0; i < xmlDoc.getElementsByTagName("guid").length && i < 5; i++) {
var nameList = xmlDoc.getElementsByTagName("title")[i + 2].childNodes[0].nodeValue;
var regexp = new RegExp(" - ");
var songTitle = nameList.split(regexp);
//if (i == 4) {trackVal += '<li class="last">';}
//else {trackVal += '<li>';}

trackVal += '<li><div class="title1"><a href="#" onClick="RhapsodyPlayer.playTrack(\'tra.' + xmlDoc.getElementsByTagName("guid")[i].childNodes[0].nodeValue + '\'); return false;"><span class="icon icon-play-lg">Song:</span> Listen to Song \'' + songTitle[0] + '\'</a><!-- /strong></p --></div></li>';

}

if(trackVal){
songSlat += '<div class="mdl"><div class="h-wrap group"><h2 class="h-sub group"><span>Top Songs</span></h2></div><ol id="copyDesc" class="lst">' + trackVal +'<li class="last"><div>Hear 25 full tracks per month free on mtv.com. <a href="#" onClick="MTVN.UI.ModalWindow.open(&quot;/music/html/rhap25/help.jhtml&quot;,null); return false;">Learn more.</a></div></li></ol></div>' ;

}

document.getElementById("rhapsodySlat").innerHTML = songSlat;

}
catch(e) {}
}
}
MTV.Voting = new function(){

this.init = function(){
if (MTV.Voting.Button.active){
$j("div.vote-btn").each(function(i){
var flashVars = "";
var targetId = this.id;
var embedId = targetId + "Button";

var vars = targetId.split(":"); //get pollId and value
var pollId = vars[0];
var value = vars[1];

flashVars += "cogix=" + MTV.Voting.Button.cogix + "&amp;";
flashVars += "pollid=" + pollId + "&amp;";
flashVars += "answer" + "=" + value + "&amp;";
flashVars += "validator=" + MTV.Voting.Button.validator + "&amp;";
flashVars += "authClass=" + MTV.Voting.Button.authClass;

var so = new SWFObject(MTV.Voting.Button.src, embedId, MTV.Voting.Button.width, MTV.Voting.Button.height, "9", "#000000");
so.addParam("flashVars", flashVars);
so.addParam("AllowScriptAccess", "sameDomain");
so.addParam("wmode", "transparent");
so.useExpressInstall('/sitewide/components/expressInstall/adobeExpressInstall.swf');
so.write(targetId);
});
}
}
}

MTV.Voting.Button = new function(){
this.active = false;
this.src = "/sitewide/components/buttons/vote/voteButton.swf";
this.width = "75";
this.height = "30";
this.cogix = "polling-onair";
this.validator= "timestamp|votes";
this.authClass = "com.mtvnet.auth.dis.HashDigestInputStrategy1";
}

MTV.Events = new function(){
this.addLinkEvents = function(){

$j("a.rssLink").click(function() {
MTV.Content.RSS.open(this);
return false;
});

$j('.user-send-message').each(function() {
if(Flux.Context._isCommunityMember) {
var user_display_name = Flux.Context._currentUserSettings.UserDisplayName;
var community_landing = Flux.Context._communityLandingPage;
var ucid = this.href.match(/\w+$/);
this.href = community_landing + "profile/" + user_display_name + "/Messaging/Mail.aspx?recipient=" + ucid;
}
else {
this.href = Flux.Context._signInUrl + "?returnPath=" + window.location.href;
}
});

}
}
MTV.Community = new function(){
this.host = 'http://community.mtv.com';
}

MTV.Community.Widgets = function(){
this.errorLocation = '';
}

MTV.Flux = new function(){}

MTV.Flux.DAAPI = new function(){
this.initArray = new Array();
this.baseUrl = "http://daapi.flux.com/2.0/00001/JSON/D3FCFFFF0002D51D0002FFFFFCD3";

this.init = function(){
if(communityAccess){
jQuery.each(MTV.Flux.DAAPI.initArray, function (i) {
if(jQuery.isFunction(MTV.Flux.DAAPI.initArray[i])) MTV.Flux.DAAPI.initArray[i]();
});

MTV.Flux.DAAPI.Module.init();
}
}

this.sendRequest = function(feed, callback, params) {
var requestUrl = MTV.Flux.DAAPI.baseUrl + feed;
Flux.Core.executeGetRequest(requestUrl, function(response){
callback(Sys.Serialization.JavaScriptSerializer.deserialize(response), params);
});
}
}

MTV.Flux.DAAPI.Module = new function(){
var config; // the current config - a regular js object
var container; // the current container - a jquery object
var responses = new Array();	// stores DAAPI responses for a module until all tabs are loaded
var responseCounter = 0;

this.configs = new Array(); // queue of module configs

this.init = function(){
if(MTV.Flux.DAAPI.Module.configs.length > 0){
config = MTV.Flux.DAAPI.Module.configs.pop();
MTV.Flux.DAAPI.Module.create();
}
}

this.create = function(){
if($j("#"+config.containerId).is("*")){
container = $j("#"+config.containerId);

if(config.moduleWrapper){
var mdl = $j("<div/>").attr("class","mdl");
container.append(mdl);
container = mdl;
if(config.moduleTitle != undefined){
var title = $j("<div/>").attr("class", "h-wrap group");
title.append($j("<h2/>").attr("class", "h-sub2 group").append($j("<span>" + config.moduleTitle + "</span>")));
container.append(title);
}
}

for(var i=0; i < config.tabs.length; i++){
MTV.Flux.DAAPI.sendRequest(config.tabs[i].url, MTV.Flux.DAAPI.Module.loadData, {position:i});
}
}
else{
MTV.Flux.DAAPI.Module.finish();
}
}

this.finish = function(){
responses = new Array();
responseCounter = 0;
MTV.Flux.DAAPI.Module.init(); // start over for more module configs
}

/* ------------------ */

this.loadData = function(response, paramsObj){
responses[paramsObj.position] = response;
responseCounter++;

if(responseCounter == config.tabs.length){
MTV.Flux.DAAPI.Module.build();
}
}

this.build = function(){
if(config.tabs.length > 1) container.append(MTV.Flux.DAAPI.Module.buildTabNav());

for(var i=0; i<responses.length; i++){
var isFirst = (i==0) ? true : false;
container.append(MTV.Flux.DAAPI.Module.buildTab(responses[i], isFirst));
}

MTV.Flux.DAAPI.Module.finish();
}

this.buildTabNav = function(){
var ul = $j("<ul/>").addClass("mdl-nav group");

for(var x=0; x < config.tabs.length; x++){
var li = $j("<li/>");
if(x==0) li.addClass("active");

var a = $j("<a/>").attr("href", "#").append(config.tabs[x].title);
a.click(function(){
MTVN.UI.MdlTab.open(this);
return false;
});

li.append(a);
ul.append(li);
}
return ul;
}

this.buildTab = function(response, isFirst){
var items = response.Items;
var itemCounter = 0;

if(items.length > 0){
var tab = $j("<div/>").addClass("tab-content");
if(!isFirst) tab.addClass("hide");

for(var r=1; r <= config.rows; r++){
if(itemCounter < items.length){	
var olClass = "lst lst-photos";
if(config.columns==2) olClass += " lst-photos-two";
else if(config.columns==3) olClass += " lst-photos-three";
else if(config.columns==4) olClass += " lst-photos-four";
else if(config.columns==6) olClass += " lst-photos-six";

var list = $j("<ol/>").addClass(olClass);

for(var c=1; c <= config.columns; c++){
var isLast = (c==config.columns) ? true : false;
if(itemCounter < items.length){
list.append(MTV.Flux.DAAPI.Module.buildItem(items[itemCounter],isLast));
itemCounter++;
}
}

tab.append(list);
}
}
return tab;
}
}

this.buildItem = function(Entry, isLast){	
var title = $j("<div/>").addClass("title2");
var titleLink = $j("<a/>").attr("href", Entry.DetailUrl);
titleLink.append($j("<img/>").attr("src", Entry.Thumbnails.Medium).addClass("thumb"));

var icon = "";
switch(Entry.Alias){
case "Video":
icon = $j("<span/>").addClass("icon icon-play").append("Video: ");
break;
default: break;
}

if(icon!=="") titleLink.append(icon);
titleLink.append(Entry.Title);
title.append(titleLink);

var li = $j("<li/>");	
if(isLast) li.addClass("last");
li.append(title);
li.append($j("<p/>").addClass("deck").append(Entry.Creator.Title));

var date = MTV.Flux.DAAPI.Utils.formatDate(Entry.DateCreated);
li.append($j("<p/>").append($j("<span/>").addClass("posted").append("Posted " + date)));

return li;
}
}

MTV.Flux.DAAPI.Utils = new function(){
this.formatDate = function(date){
var m = date.getMonth() + 1;
var d = date.getDate();
var y = date.getFullYear().toString().substr(2,2);

var formattedDate = m + "/" + d + "/" + y;

return formattedDate;
}
}
MTV.Utils = new function(){

this.findMaxZ = function() {
var maxZ = Math.max.apply(null,$j.map($j('body > *'), function(e,n){
if($j(e).css('position')=='absolute') {

return parseInt($j(e).css('z-index'))||1 ;
} else {
return 0;
}
}));
return(maxZ);
}

}

MTV.Utils.Cookies = new function(){
this.create = function(name,value,days){
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

this.read = function(name){
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

this.erase = function(name){
MTV.Utils.Cookies.create(name,"",-1);
}
}

function openAndFocus(url,name,features){
var o = window.open(url, name, features);
o.focus();
}

function runMiniAdBanner()
{
var opaWidth = $j("#ad-728x90").outerWidth();
var jsonUrl = '/global/music/modules/minipromo/json/minipromos.jhtml';
$j.get(jsonUrl, {}, function(data) {

var getData = eval('('+data.toString()+')');
if(getData.module!=undefined && getData.module.items!=null)
{
var total = getData.module.items.item.length;
var index = 0;
var imgSrc,imgUrl = "";

if(total==null)
{
if(getData.module.items.item.images!=null)
imgSrc = getData.module.items.item.images.img.src;

if(getData.module.items.item.link!=null)
imgUrl = getData.module.items.item.link.args;
}
else
{
index = Math.floor(Math.random()*total);

if(getData.module.items.item[index].images!=null)
imgSrc = getData.module.items.item[index].images.img.src;

if(getData.module.items.item[index].link!=null)
imgUrl = getData.module.items.item[index].link.args;
}

//alert(imgSrc+" "+opaWidth+" "+$j("#header.franchise").length);

if ((parseInt(opaWidth) <= 728 && $j("#header.franchise").length == 0) && (imgSrc!=null)) 
{
$j("<div/>").attr("id", "minipromo").prependTo("#adContainer");
$j("<a/>").attr("href", imgUrl).appendTo("#minipromo");
$j("<img/>").attr({"src":imgSrc, "border": 0}).appendTo("#minipromo a");
$j("#minipromo").show(); 
$j("#ad-728x90").css({"padding": "3px 3px 3px 0px","float": "right"});
}
}

});
}

function popFlip(fbKey, obj){

var pWin = false;
if (fbKey.indexOf("fid=")>=0) {
window.location.href = '/photos/?'+fbKey;

}
else {
window.location.href = '/news/photo/';

}
// popCheck(pWin);

}

$j(function()
{
MTV.Navigation=new MtvNavigation();
});

function MtvNavigation()
{
var self=this;
this.init=function()
{
self.meta = {

} 

self.init_triggers();

} 

this.init_triggers=function()
{
// self.init_coda_link_tracking();
self.init_nav_interaction();
}

this.init_coda_link_tracking=function()
{
// override every link in nav menu
$j('#navlist a').click(function(){

// report click to CODA
// http://confluence.mtvi.com/display/BUSTECH/CODA+Link+Events
mtvn.btg.Controller.sendLinkEvent({
linkName : 'GLOBAL_NAV - ' + $j(this).text(),
linkType : 'o'
});

// continue event
return true;
});
}

this.init_nav_interaction=function()
{
$j('#navlist .gridContainer').css({'z-index': MTV.Utils.findMaxZ() + 10});
/* tooltip on logo*/
$j('div#mtvLogo a, .navLogoToolTip').mouseover(function() {
$j('.navLogoToolTip').show();
}).mouseout(function() {
$j('.navLogoToolTip').hide();
}); 
/* mtvsites nav */
$j('.globalNav ul#mtvSitesNav li.topLevel').hover( function() {
$j(this).addClass('hover').children('ul').addClass('hover');
}, function() {
$j(this).removeClass('hover').children('ul').removeClass('hover');
});

/* global Nav */
$j('#navlist li.toplvl').hover( function() {
$j(this).addClass('hover').children('ul.gridContainer').addClass('hover');
}, function() {
$j(this).removeClass('hover').children('ul.gridContainer').removeClass('hover');
});

/* global Nav grid columns height matching */
$j('ul#navlist li.toplvl').each( function(a) {
var maxHeight = 0;
var $columns = $j( $j('ul#navlist li.toplvl')[a] ).find('ul.gridContainer div.grid ul.gridMain, ul.gridContainer div.grid ul.centerCol');
$columns.each( function(e) {
if( $j($columns[e]).height() > maxHeight ) maxHeight = $j($columns[e]).height();
});
$columns.height( maxHeight );
});

}

self.init();
}

// default search text

// event handler
function addEventToObject(obj,evt,func) {
var oldhandler = obj[evt];
obj[evt] = (typeof obj[evt] != 'function') ? func : function(){oldhandler();func();};
}

// lyrics box stuff
var Searchbox = {
init : function()
{
var sBox = document.getElementById('search-lyrics');
if (sBox)
{
addEventToObject(sBox,'onclick',Searchbox.click);
addEventToObject(sBox,'onblur',Searchbox.blur);
}	
},
click : function()
{
var sBox = document.getElementById('search-lyrics');
if (sBox.value == 'Enter lyric, artist name or song title')
{
sBox.value = '';
sBox.style.color = 'black';
}
},
blur : function()
{
var sBox = document.getElementById('search-lyrics');
if (sBox.value == '' || sBox.value == ' ') {sBox.value = 'Enter lyric, artist name or song title'; sBox.style.color = '#999999';}
}
};

// search box stuff
var Searchbar = {
init : function()
{
var sBar = document.getElementById('searchmtv-text');
if (sBar)
{
addEventToObject(sBar,'onclick',Searchbar.click);
addEventToObject(sBar,'onblur',Searchbar.blur);
}	
},
click : function()
{
var sBar = document.getElementById('searchmtv-text');
if (sBar.value == 'Search' || sBar.value == 'SEARCH')
{
sBar.value = '';
}
},
blur : function()
{
var sBar = document.getElementById('searchmtv-text');
if (sBar.value == '' || sBar.value == ' ') {sBar.value = 'SEARCH';}
}
};

// add event onload
addEventToObject(window,'onload',Searchbox.init);
addEventToObject(window,'onload',Searchbar.init);

var Utils = {
show : function(element){
if (element!=null && element.className.indexOf('hide') >= 0){
element.className = element.className.substring(0, element.className.indexOf('hide'));
}
},

hide : function(element){
if (element!=null && element.className.indexOf('hide') < 0){
element.className = element.className + " hide";
}
},

// returns the first parent of a node with a given class
findParent : function(obj, parentClass){
var parent = obj.parentNode;
if (parent.className && parent.className.indexOf(parentClass) != -1)
return parent;
else return this.findParent(parent, parentClass);
},

// returns the first child of a node with a given class
findChild : function(obj, childClass){
var match;
for(var i=0; i<obj.childNodes.length; i++){
var child = obj.childNodes[i];
if (child.className && child.className==childClass)
match = child;
else if(child.childNodes && child.childNodes.length>0){
match = this.findChild(child, childClass);
}
if(match) return match;
}
}
}

var Paginate = {
getPrev : function(obj){
this.page(obj, 'prev');
},

getNext : function(obj){
this.page(obj, 'next');
},

page : function(obj, direction){
var mdl = Utils.findParent(obj, 'mdl');

var pagination = Utils.findChild(mdl, 'pagination');
var pageCount = Utils.findChild(pagination, 'sm');

var count = new Array();
count = pageCount.innerHTML.split(' ');

var current = count[0]*1;
var total = count[2]*1;
var requestPage;

if(direction=='prev'){
if(current==1) requestPage = total;
else requestPage = current - 1;
}
else{
if(current==total) requestPage = 1;
else requestPage = current + 1;
}

var listCount = 0;
for(var i=0; i<mdl.childNodes.length; i++){
var child = mdl.childNodes[i];
if (child.nodeName=='OL' || (child.nodeName=='DIV' && child.className.indexOf('paginationGroup')>-1)){
listCount++;
if (listCount!=requestPage) Utils.hide(child);
else Utils.show(child);
}
}

var newPageCounter = requestPage + " of " + total;
pageCount.replaceChild(document.createTextNode(newPageCounter), pageCount.childNodes[0]);
}
}

$j(document).ready(function(){
MTVN.init();
});

MTVN = new function(){
this.pageTitle = document.title;
this.initArray = new Array();
this.version = 'charlie';

this.init = function(){
document.body.onmousedown = mouseDown;

if (typeof MTVN.Flux != 'undefined') MTVN.Flux.Widgets.loadAll();	
MTVN.UI.initScrollingModules();

for(var i=0; i<MTVN.initArray.length; i++){
MTVN.initArray[i]();
}

return true;
}

this.resetPageTitle = function(){
document.title = MTVN.pageTitle;
}

mouseDown = function(e){
if (MTVN.UI.ModalWindow.isOpen) MTVN.UI.ModalWindow.mouseDownBody(e);
return true;
}
}

MTVN.Apps = new function(){}

MTVN.Constants = new function(){
this.playerChannelDomain = "mtv";
this.playerMediaHost = "http://media.mtvnservices.com";
this.playerBaseUrl = "";	
}

MTVN.Ads = new function(){
this.additionalValues = "";
this.moreAdditionalValues = "";

this.dartSite = "";
this.sections = ""; // right now this is only ever set to vidzone from the player
this.adPageVals = "";
this.autoDcopt = "";

// this is mostly for the video player, ajaxed in values
this.handleAdditionalValues = function(){

if (MTVN.Ads.additionalValues.indexOf("content_id") == -1 
&& MTVN.Player && MTVN.Player.id != undefined)	{	
MTVN.Ads.additionalValues += "content_id=" + MTVN.Player.id + ";";
}

MTVN.Ads.additionalValues += MTVN.Ads.moreAdditionalValues;
}	

}

MTVN.Reporting = new function(){
this.dispatcherAttributes = "";

this.handleDispatcherAttributes = function(){
var attrs = MTVN.Reporting.dispatcherAttributes.split(";");
for (var i=0; i < attrs.length; i++) {

if(attrs[i]!=""){
var pair = attrs[i].split("=");	
dispatcher.setAttribute(pair[0],pair[1]);
}
}
}

this.reportIMX = function(tagUrl, protocol, params){
var imxTag = new Image();
if ((protocol=="flipbook" && !(document.referrer.indexOf("fid="+params) > -1)) || (protocol != 'flipbook')){
imxTag.src = tagUrl;
}
}

this.reportFluxView = function(tagUrl, protocol, params){
var fluxTag = new Image();
fluxTag.src = tagUrl;
}
}
MTVN.UI = new function(){
this.initScrollingModules = function(){
/* handle no max-height in IE 6 */
if(jQuery.browser.msie && jQuery.browser.version.substr(0,1)=="6"){
$j(".scroll-wrap").each(function(){
var sw = $j(this);
var olHeight = sw.children("ol:first").height();
if(olHeight < 370) sw.height("100%");
});
}
}
}

MTVN.UI.Overlay = new function(){
this.active = false;

this.init = function(){
$j("#container-outer").append('<div id="overlay"></div>');
$j("#modalWindow").remove().appendTo("#container-outer");
MTVN.UI.Overlay.active = true;
}

this.open = function(){
$j("#overlay").addClass("open");
$j("#overlay").height(document.body.offsetHeight + "px");
}

this.close = function(){
$j("#overlay").removeClass("open");
$j("#overlay").height("0px");
}
}

MTVN.UI.ModalWindow = new function(){
var modalWindowId = "modalWindow";
var currentLocationId = "";
this.ignoreMouseDownBody = false;
this.isOpen = false;

this.open = function(requestUrl, locationId){
currentLocationId = locationId;

$j.get(requestUrl, function(data){
MTVN.UI.Overlay.open();
$j("#dialogContainer").empty().append(data);
MTVN.UI.ModalWindow.updateLocation();
});
}

this.updateLocation = function(){
var mwElement = document.getElementById(modalWindowId);
var mwLeft = 0;
var mwTop = 0;
var mwWidth = 446;
var bodyWidth = document.body.offsetWidth;

$j("#" + modalWindowId).removeClass("hide");

var wrap = document.getElementById("wrap");
var wrapX = $j("#wrap").offset().left;	
var wrapWidth = wrap.offsetWidth;
var wrapThird = Math.round(wrapWidth/3);	

if(!currentLocationId){
// defaults to centered position
if(MTVN.UI.Overlay.active){
mwLeft = Math.round(bodyWidth/2 - mwWidth/2);
}
else{
mwLeft = Math.round(bodyWidth/2 - mwWidth/2); // centered for 446px-wide modal window
}	
mwTop = Math.round(((document.documentElement.clientHeight - mwElement.offsetHeight)/2) + ($j('html').scrollTop() || $j('body').scrollTop())) - 30; // 30 pixel cheat	
}
else{
//positioning relative to an element

var locElement = document.getElementById(currentLocationId);

var locLeft = $j("#" + currentLocationId).offset().left - wrapX;	//left position relative to wrap instead of the window left
var locTop = $j("#" + currentLocationId).offset().top;

if(locLeft < wrapThird){ mwLeft = wrapX -20; }
else if(locLeft > wrapThird && locLeft < (wrapThird * 2)){ Math.round(bodyWidth/2 - mwWidth/2); }
else{ mwLeft = (wrapX + wrapWidth - mwWidth + 20) ; }

//mwTop = locTop - (mwElement.offsetHeight + 1);
mwTop = locTop + 20;
}

mwElement.style.left = mwLeft + "px";
mwElement.style.top = mwTop + "px";

MTVN.UI.ModalWindow.isOpen = true;
}

this.close = function(){
var mwElement = document.getElementById(modalWindowId);
mwElement.style.left = "-9999px";
MTVN.UI.Overlay.close();
currentLocationId="";
this.isOpen = false;
}

this.mouseDown = function(e){
this.ignoreMouseDownBody = true;
return true;
}

this.mouseDownBody = function(e){
if (!this.ignoreMouseDownBody){
this.close();
}
this.ignoreMouseDownBody = false;
return true;
}
}

MTVN.UI.Tab = new function(){
this.open = function(obj){
var newActiveTabId = obj.parentNode.id;
var newActivePageId = newActiveTabId.substring(0, newActiveTabId.indexOf("Tab"));

var tab = document.getElementById(newActiveTabId);
var tabList = tab.parentNode;
var tabs = tabList.getElementsByTagName("li");

// set new active tab
for(var i=0; i < tabs.length; i++){
var t = tabs[i];

if(t.id == newActiveTabId){
$j(t).addClass("active");
}
else{
$j(t).removeClass("active");
}
}

// set new active page
var page = document.getElementById(newActivePageId);
var pageList = page.parentNode;
var pages = pageList.childNodes;

for(var i=0; i < pages.length; i++){
var p = pages[i];

if(p.nodeName=="DIV" && p.className.indexOf('tab-content') >= 0){
if(p.id == newActivePageId){
$j(p).removeClass("hide");

if(p.className.indexOf('mobileWidget') >= 0){
var tabEvent = $j.Event("showtab");
$j(p).triggerHandler(tabEvent);
}
}
else{
$j(p).addClass("hide");
}
}
}

}

this.openAjax = function(obj, ajaxData, configParams){
var newActiveTabId = obj.parentNode.id;
var newActivePageId = newActiveTabId.substring(0, newActiveTabId.indexOf("Tab"));

var tab = document.getElementById(newActiveTabId);
var tabList = tab.parentNode;
var tabs = tabList.getElementsByTagName("li");
var containerHeight = 10;

// set new active tab
for(var i=0; i < tabs.length; i++){
var t = tabs[i];
if(t.id == newActiveTabId) $j(t).addClass("active");
else $j(t).removeClass("active");
}

// set new active page
var page = document.getElementById(newActivePageId);
var pageList = page.parentNode;
var pages = pageList.childNodes;

for(var i=0; i < pages.length; i++){
var p = pages[i];
if(p.nodeName=="DIV" && p.className.indexOf('tab-content') >= 0 && p.className.indexOf('hide')== -1) containerHeight = $j(p).height();
}

for(var i=0; i < pages.length; i++){
var p = pages[i];

if(p.nodeName=="DIV" && p.className.indexOf('tab-content') >= 0){
if(p.id == newActivePageId){
var container = $j(p);
if (container.is('.loaded')) {
container.removeClass("hide");
}else
{
container.css({'min-height': containerHeight});
container.empty();
container.html('<div class="ajax-loader"><img src="/sitewide/images/charlie/ajax-loader.gif" alt="Loading..."/></div>');
container.removeClass("hide");
$j.get(ajaxData, configParams, function(data){
container.empty();
container.append(data);
container.addClass("loaded");
});
}
}
else{
$j(p).addClass("hide");
}
}
}

}
}

MTVN.UI.MdlTab = new function(){
this.open = function(obj){
var currentTabNavItem = $j(obj).parent();
var position = currentTabNavItem.prevAll().length;

currentTabNavItem.addClass("active");
currentTabNavItem.siblings().removeClass("active");

var mdl = currentTabNavItem.parents(".mdl:first");

var pages = (mdl.children("ol.lst").length >0) ? mdl.children("ol.lst") : mdl.children("div.tab-content");
pages.addClass("hide");
pages.eq(position).removeClass("hide");
}
}

MTVN.UI.RefreshPaginate = new function(){
this.submit = function(form){
var str = $j(form).text();
var maxPages = parseInt(str.substring(str.indexOf("of")+3, str.length));
var val = parseInt(form.page.value);
var baseUrl = form.baseUrl.value;

if(val > 0 && val <= maxPages){
var connector = (baseUrl.indexOf("?") >=0) ? "&" : "?";
var url = (val==1) ? baseUrl : baseUrl + connector + "page=" + val;
window.location.href = url;
}

return false;
}
}

MTVN.UI.AjaxPaginate = new function(){
this.page = function(obj, requestUrl, pageNum){
var paginationDiv = $j(obj).parent();
var container = paginationDiv.parent();
var params = {};
if(pageNum > 1) params.page = pageNum;

$j.get(requestUrl, params, function(data){
container.empty();
container.append(data);
});

}
}

MTVN.UI.Accordion = new function(){
var howMany = "";

this.init = function(){
// remove text nodes
$j("#accordion a.accord-link").each(function(){
for(var i=0; i<this.childNodes.length; i++){
if(this.childNodes[i].nodeType==3) this.removeChild(this.childNodes[i]);
}
});

$j("#accordion > div.accord-slat").bind("mouseenter", function(){ MTVN.UI.Accordion.activate(this); });
howMany = $j("#accordion > div.accord-slat").length;
MTVN.UI.Accordion.positionContent($j("#accordion > div.accord-over"));
}

this.activate = function(obj){
var active = $j(obj);
$j("#accordion > div.accord-slat").removeClass("accord-over");
active.addClass("accord-over");
MTVN.UI.Accordion.positionContent(active);
}

this.positionContent = function(active){
var position = active.prevAll().length + 1;
var gap = howMany - position;

var content = active.children(".accord-content"); // the active content box
var offsetLeft = MTVN.UI.Accordion.getOffsetLeft(active.get(0), active.get(0).offsetLeft); // left side of active item
var contentWidth = content.width() + 30;

var newLeft = (offsetLeft+133) - contentWidth/2;
var newRight = newLeft + contentWidth;

if(newRight > 950){
newLeft = 950 - contentWidth - (10*gap); // 10px for every item
}
else if(newLeft < 0){
newLeft = 10*position;
}

content.css("left", newLeft);
}

this.getOffsetLeft = function(element, offsetLeft){
if(element.offsetParent.className=="mdl mdl-main mdl-accordion"){
return offsetLeft;
}
else{
var parent = element.offsetParent;
var val = element.offsetLeft + parent.offsetLeft;
return MTVN.UI.Accordion.getOffsetLeft(parent, val);
}
}
}

MTVN.UI.InView = new function() {

var elements = [];
var positions = [];
var offsets = [];

var jwin = $j(window);

var init = function() {
jwin.bind("scroll resize", function() {
jwin.unbind("scroll resize");
setTimeout(function() {
checkElements();
}, 500);
});	
}

this.register = function(element, callback) {
var coords = element.offset().left + "x" + element.offset().top;
var offset = $j.grep(positions, function(n, i){
return (n == coords);
});
offsets.push(offset.length * 100);
positions.push(coords);

if(isInView(element, offset.length * 100)) {
callback();
} else {
elements.push(element);
element.one("inView", callback);
init();
}	
}

var checkElements = function () {
var tempElements = [];
$j.each(elements, function(i) {
tempElements.push(this);
if (isInView(this, offsets[i])) {
this.trigger("inView");
tempElements.pop();
}
});
elements = tempElements;
if (elements.length > 0) {
init();
} 
}

var isInView = function(element, offset) {
var viewportHeight = jwin.height();
var docPos = jwin.scrollTop();
var elPos = parseInt(element.offset().top) + offset;
return (elPos < viewportHeight + docPos);
}	
}

// Taken from MTV's sitewide paginate.
MTVN.UI.Paginate = new function() {

this.getPrev = function(obj,animate){
this.page(obj, 'prev', animate);
}

this.getNext = function(obj,animate){
this.page(obj, 'next', animate);
}

this.get = function(mdl, requestPage){
var pagination = MTVN.UI.Paginate.Utils.findChild(mdl, 'pagination');
var pageCount = MTVN.UI.Paginate.Utils.findChild(pagination, 'sm');

var count = new Array();
count = pageCount.innerHTML.split(' ');

var total = count[2]*1;

var listCount = 0;
for(var i=0; i<mdl.childNodes.length; i++){
var child = mdl.childNodes[i];
if (child.nodeName=='OL' || (child.nodeName=='DIV' && child.className.indexOf('paginationGroup')>-1)){
listCount++;
if (listCount!=requestPage) MTVN.UI.Paginate.Utils.hide(child);
else MTVN.UI.Paginate.Utils.show(child);
}
}

var newPageCounter = requestPage + " of " + total;
pageCount.replaceChild(document.createTextNode(newPageCounter), pageCount.childNodes[0]);
}

this.page = function(obj, direction, animate){ 
var paginationDiv = $j(obj).parents('.pagination');
var mdl = $j(obj).parents('.mdl');
var pageCount = paginationDiv.find('.sm'); 

var count = new Array(); 
count = pageCount.html().split(' '); 
current = count[0]*1;
var total = count[2]*1; 
var requestPage;

if(direction=='prev'){
if(current==1) requestPage = total;
else requestPage = current - 1;
}
else{
if(current==total) requestPage = 1;
else requestPage = current + 1;
}

if (animate) this.animateTransition($j(paginationDiv).parent().parent(),current,requestPage);
else this.staticTransition(mdl,current,requestPage);

var newPageCounter = requestPage + " of " + total;
pageCount.empty().append(newPageCounter); 
}

// pagination in list format ( < 1 2 3 4 5 > )
this.page2 = function(obj, direction, newpage){

var paginationDiv = $j(obj).parents('.pagination'); 
var mdl = $j(obj).parents('.mdl'); 
var current = parseInt(paginationDiv.find('.active').find('a').html());
var total = paginationDiv.find('p').length;

var requestPage;
if(direction=='prev'){
if(current==1) requestPage = total;
else requestPage = current - 1;
}
else if (direction=='next'){
if(current==total) requestPage = 1;
else requestPage = current + 1;

}
else requestPage=newpage;
requestPage=requestPage-1;
current=current-1;

paginationDiv.find('.active').removeClass('active');
$j(paginationDiv.find('p')[requestPage]).addClass('active');

this.animateTransition(mdl,current,requestPage);
}

this.animateTransition = function(mdl,current,requestPage) { 
var pagewidth = $j(mdl).find('.pages').find('ol').width()+10;
var jumpto = (current-requestPage)*pagewidth;
$j(mdl).find('.pages').animate({"left":'+='+jumpto},{easing:"swing",duration:"slow"});
}

this.staticTransition = function(mdl,current,requestPage) { 
if (mdl.find('.paginationGroup').length>0) {
hideChild = $j(mdl.find('.paginationGroup')[current-1]);
showChild = $j(mdl.find('.paginationGroup')[requestPage-1]);
}
else {
hideChild = $j(mdl.find('ol')[current-1]); 
showChild = $j(mdl.find('ol')[requestPage-1]);
}
hideChild.addClass('hide');
showChild.removeClass('hide'); 
} 

}

MTVN.UI.Paginate.Utils = new function() {
this.show = function(element){
if (element!=null && element.className.indexOf('hide') >= 0){
element.className = element.className.substring(0, element.className.indexOf('hide'));
}
}

this.hide = function(element){
if (element!=null && element.className.indexOf('hide') < 0){
element.className = element.className + " hide";
}
}

// returns the first parent of a node with a given class
this.findParent = function(obj, parentClass){
var parent = obj.parentNode;
if (parent.className && parent.className.indexOf(parentClass) != -1)
return parent;
else return this.findParent(parent, parentClass);
}

// returns the first child of a node with a given class
this.findChild = function(obj, childClass){
var match;
for(var i=0; i<obj.childNodes.length; i++){
var child = obj.childNodes[i];
if (child.className && child.className==childClass)
match = child;
else if(child.childNodes && child.childNodes.length>0){
match = this.findChild(child, childClass);
}
if(match) return match;
}
}
}

MTVN.UI.GetCurrentServerTime = new function() {

this.date = function() {

return new InitCurrentTime().now;

}

this.raw = function() {

return new InitCurrentTime().rawTime;

}

}

$j(function() {
if($j("div.player-placeholder").length > 0) {
MTVN.LitePlayer.init();
MTVN.LitePlayer.applyClick();
}	
});

MTVN.LitePlayer = new function(){
this.imageServer = "mtv.mtvnimages.com";
this.videoUriPrefix = "mgid:uma:video:mtv.com:";
this.playlistUriPrefix = "mgid:uma:videolist:mtv.com:";

this.affilatedHost = "";

this.active = false;
this.playerUrl = "PLAYER_URL_NOT_SET";
this.configUrl = "CONFIG_URL_NOT_SET";
this.width = "240";
this.height = "211";
this.playerArgs = "";

var _this = this;
var initPlayer = function(){
$j("div.player-placeholder").each(function(i){
$this = $j(this);

var playerArgs = _this.playerArgs;
var flashVars;
var configParams = "";

if (this.id) {
configParams = this.id.replace(/\./g, "&").replace(/:/g,"=");
} else {
if ($this.attr("flashVars").length > 0) {
configParams = $this.attr("flashVars");	
}
}
if (playerArgs.length > 0) {
playerArgs += "&";
}	

playerArgs += configParams;

flashVars = "configParams=" + escape(playerArgs);	

var paramsFromId = {};
var params = configParams.split("&");
var uri;	
$j.each(params, function() {
var pair = this.split("=");
paramsFromId[pair[0]] = pair[1];
});

if(typeof paramsFromId.vid != "undefined") {
uri = _this.videoUriPrefix + paramsFromId.vid;
} else {
if (typeof paramsFromId.id != "undefined") {
uri = _this.playlistUriPrefix + paramsFromId.id;	
}
}
var width = (typeof $this.attr("width") == 'undefined') ? _this.width: $this.attr("width");
var height = (typeof $this.attr("height") == 'undefined') ? _this.height: $this.attr("height");

this.innerHTML = _this.generatePreloadHTML("playerPlaceholder", width, height, uri, flashVars, uri.replace("videolist", "content"));

// Fix for IE breaking when leaving a page where a player has been loaded with litePlayer
(function(){var s=function(){__flash__removeCallback=function(i,n){if(i)i[n]=null;};window.setTimeout(s,10);};s();})();
});
this.init = function(){};
}

this.init = initPlayer;

this.generatePreloadHTML = function(className, width, height, playerUri, flashVars, imageServerUri){

var playButtonCenterX = Math.floor(width / 2) - 46;
var playButtonCenterY = Math.floor(height / 2) - 36;

var controlBarTop = height - 31;

var html = '<div style="position: relative; width: ' + width + 'px; height: ' + height + 'px; cursor: pointer;" class="' + className + '" width="' + width + '" height="' + height + '" id="' + playerUri + '" flashVars="' + flashVars + '">';

html += '<img style="position: absolute; top: ' + playButtonCenterY + 'px; left: ' + playButtonCenterX + 'px;" sr' +'c="'+ MTVN.LitePlayer.affilatedHost +'/global/music/player/images/bttn_play-big.png" />';

html += '<img src="http://' + _this.imageServer + '/uri/' + imageServerUri + '?height=' + controlBarTop + '&width=' + width + '" />';

html += '<img style="position: absolute; left: 0px; bottom:0px;" sr' + 'c="'+ MTVN.LitePlayer.affilatedHost + '/global/music/player/images/bttn_play.gif" />';

html += '<div style="position: absolute; left: 31px; bottom: 0px; width: ' + (width - 31) + 'px; height: 31px; background: url(' + MTVN.LitePlayer.affilatedHost + '/global/music/player/images/control-bar.gif) repeat-x top left"> </div>';

html += '</div>';

return html;
}

this.applyClick = function() {
var h = 0;
var w = 0;
var bgcolor = "#000000";

$j(".playerPlaceholder").one("click", function() {
var $this = $j(this);
var id = this.id;
var flashVars = $this.attr("flashVars");

if (h == 0){
h = $this.attr("height");
w = $this.attr("width");
}

var embed = "";
embed += '<embed src="http://media.mtvnservices.com/'+id+'"';
embed += 'type="application/x-shockwave-flash"';
embed += 'wmode="opaque"';
embed += 'name="'+id+'"';
embed += 'id="'+id+'"';
embed += 'width="'+w+'"';
embed += 'height="'+h+'"';
embed += 'bgcolor="'+bgcolor+'"';
embed += 'allowFullscreen="true"';
embed += 'flashVars="autoPlay=true&'+flashVars+'"';
embed += 'allowScriptAccess="always">';
embed += '</embed>';

$this.html(embed);

});	
}
}

MTVN.LitePlayer.Article = new function(){

this.init = function(){

var pphDivIdVal = $j(".player-placeholder").attr("id");
if (pphDivIdVal.match("^"+"id") == "id")
MTVN.LitePlayer.playerArgs = "instance=fullepisode";

else MTVN.LitePlayer.playerArgs = "instance=news";
var height = 223;
var width = 256;
var styling = {
'background-color': '#000000',
'height': height + 'px',
'width': width + 'px',
'float':'left',
'margin': '0px 10px 10px 0px',
'position' : 'relative',
'cursor' : 'pointer'
}
$j(".player-placeholder").
css(styling).
attr("height",height).
attr("width",width);

MTVN.LitePlayer.init();
}
}

MTVN.Community = new function(){
this.host = 'http://community.mtv.com';
}

MTVN.Community.Widgets = function(){
this.errorLocation = '';
}

MTVN.Flux = new function(){}

MTVN.Flux.DAAPI = new function(){
this.initArray = new Array();
this.baseUrl = "http://daapi.flux.com/2.0/00001/JSON/D3FCFFFF0002D51D0002FFFFFCD3";

this.init = function(){
if(communityAccess){
jQuery.each(MTVN.Flux.DAAPI.initArray, function (i) {
if(jQuery.isFunction(MTVN.Flux.DAAPI.initArray[i])) MTVN.Flux.DAAPI.initArray[i]();
});

MTVN.Flux.DAAPI.Module.init();

//if(typeof FN!='undefined' && typeof FN.init=="function") FN.init();
}
}

this.sendRequest = function(feed, callback, params) {
var requestUrl = MTVN.Flux.DAAPI.baseUrl + feed;
Flux.Core.executeGetRequest(requestUrl, function(response){
callback(Sys.Serialization.JavaScriptSerializer.deserialize(response), params);
});
}
}

MTVN.Flux.DAAPI.Module = new function(){
var config; // the current config - a regular js object
var container; // the current container - a jquery object
var responses = new Array();	// stores DAAPI responses for a module until all tabs are loaded
var responseCounter = 0;

this.configs = new Array(); // queue of module configs

this.init = function(){
if(MTVN.Flux.DAAPI.Module.configs.length > 0){
config = MTVN.Flux.DAAPI.Module.configs.pop();
MTVN.Flux.DAAPI.Module.create();
}
}

this.create = function(){
if($j("#"+config.containerId).is("*")){
container = $j("#"+config.containerId);
for(var i=0; i < config.tabs.length; i++){
MTVN.Flux.DAAPI.sendRequest(config.tabs[i].url, MTVN.Flux.DAAPI.Module.loadData, {position:i});
}
}
else{
MTVN.Flux.DAAPI.Module.finish();
}
}

this.finish = function(){
responses = new Array();
responseCounter = 0;
MTVN.Flux.DAAPI.Module.init(); // start over for more module configs
}

/* ------------------ */

this.loadData = function(response, paramsObj){
responses[paramsObj.position] = response;
responseCounter++;

if(responseCounter == config.tabs.length){
MTVN.Flux.DAAPI.Module.build();
}
}

this.build = function(){
if(config.tabs.length > 1) container.append(MTVN.Flux.DAAPI.Module.buildTabNav());

for(var i=0; i<responses.length; i++){
var isFirst = (i==0) ? true : false;
container.append(MTVN.Flux.DAAPI.Module.buildTab(responses[i], isFirst));
}

MTVN.Flux.DAAPI.Module.finish();
}

this.buildTabNav = function(){
var ul = $j("<ul/>").addClass("mdl-nav group");

for(var x=0; x < config.tabs.length; x++){
var li = $j("<li/>");
if(x==0) li.addClass("active");

var a = $j("<a/>").attr("href", "#").append(config.tabs[x].title);
a.click(function(){
MTVN.UI.MdlTab.open(this);
return false;
});

li.append(a);
ul.append(li);
}
return ul;
}

this.buildTab = function(response, isFirst){
var items = response.Items;
var itemCounter = 0;

if(items.length > 0){
var tab = $j("<div/>").addClass("tab-content");
if(!isFirst) tab.addClass("hide");

for(var r=1; r <= config.rows; r++){
if(itemCounter < items.length){	
var olClass = "lst lst-photos";
if(config.columns==2) olClass += " lst-photos-two";
else if(config.columns==3) olClass += " lst-photos-three";
else if(config.columns==4) olClass += " lst-photos-four";
else if(config.columns==6) olClass += " lst-photos-six";

var list = $j("<ol/>").addClass(olClass);

for(var c=1; c <= config.columns; c++){
var isLast = (c==config.columns) ? true : false;
if(itemCounter < items.length){
list.append(MTVN.Flux.DAAPI.Module.buildItem(items[itemCounter],isLast));
itemCounter++;
}
}

tab.append(list);
}
}
return tab;
}
}

this.buildItem = function(Entry, isLast){	
var title = $j("<div/>").addClass("title2");
var titleLink = $j("<a/>").attr("href", Entry.DetailUrl);
titleLink.append($j("<img/>").attr("src", Entry.Thumbnails.Medium).addClass("thumb"));

var icon = "";
switch(Entry.Alias){
case "Video":
icon = $j("<span/>").addClass("icon icon-play").append("Video: ");
break;
default: break;
}

if(icon!=="") titleLink.append(icon);
titleLink.append(Entry.Title);
title.append(titleLink);

var li = $j("<li/>");	
if(isLast) li.addClass("last");
li.append(title);
li.append($j("<p/>").addClass("deck").append(Entry.Creator.Title));

var date = MTVN.Flux.DAAPI.Utils.formatDate(Entry.DateCreated);
li.append($j("<p/>").append($j("<span/>").addClass("posted").append("Posted " + date)));

return li;
}
}

MTVN.Flux.DAAPI.Utils = new function(){
this.formatDate = function(date){
var m = date.getMonth() + 1;
var d = date.getDate();
var y = date.getFullYear().toString().substr(2,2);

var formattedDate = m + "/" + d + "/" + y;

return formattedDate;
}
}

// included in ../mtvn.jhtml
// depends on community_fulx.jhtml

// Flux Widget Proxy for MTVN
// 

MTVN.Flux.Widgets = new function(){

// you can turn off widgets globally by setting this to false or
// on locally by calling MTVN.Flux.Widgets.enabled = false;
this.enabled = true;

this.create=function(name, options){

if (!(Flux && typeof Flux.createWidget == "function") || !this.enabled) {
return;
}

options = this.getOptionsByName(name, options);
var widgetName = this.getWidgetNameByName(name);
Flux.createWidget(widgetName, options);
}

this.loadAllAttempted = false;
this.loadAll=function() {
if (!MTVN.Flux.Widgets.loadAllAttempted) {
$j(".fluxWidget:not(.delay-load)").each( function() {
MTVN.Flux.Widgets.loadEach(this);
});
MTVN.Flux.Widgets.loadAllAttempted = true;
}
}

this.loadEach = function(el) {
var jsonText = "";
var code = $j(el).find("code");
if (code.get(0).firstChild && code.get(0).firstChild.nodeType == 8) {
jsonText = code.get(0).firstChild.nodeValue;
}

if (jsonText.length > 0) {
var obj = eval("(" + jsonText + ")");
$j(el).empty().removeClass("hide");
MTVN.Flux.Widgets.create(obj.widget, obj.args);
}
}

// set default options based on the name parameter
// passed to the create method
this.getOptionsByName=function(name, options)
{
switch(name) {
case 'Share2' :
var opts = {};
opts.elements = [
{ id: 'Facebook', placeholder: 'service1Element' },
{ id: 'Twitter', placeholder: 'service2Element' },
{ id: 'Myspace', placeholder: 'service3Element' },
{ id: 'More', placeholder: 'moreElement' }
];
return $j.extend(opts, options);
break;
case 'Share' :
var opts = {}
opts.size = 'small';
opts.items = [
{ id: 'share', title: 'Share' },
{ id: 'addToFavorites', title: 'Favorite' }
];
return $j.extend(opts, options);
break;
case 'Rate' :
var opts = {};
opts.size = 'small';
opts.items = [
{ id: 'rate', title: 'Rate This' }
];

return $j.extend(opts, options);
break;
case 'Statistics' :

var opts = {}
opts.size = 'small';

if ( options.hide_titles ) {
opts.items = [
{ id: 'viewCount', title: '' },
{ id: 'commentCount', title: ''},
{ id: 'contentRating', title: { thumbsUpTitle: '', thumbsDownTitle: '' }} 
];
} else {
opts.items = [
{ id: 'viewCount', title: 'Views' },
{ id: 'commentCount', title: 'Comments'},
{ id: 'contentRating', title: { thumbsUpTitle: 'Rating', thumbsDownTitle: 'Rating' }} 
];
}

if (!options.hide_ratings) {
var ratings_title = options.hide_titles ? '' : 'Rate ' + options['ratings_title'];
options['ratings_title'] = null;
options['hide_ratings'] = null;
opts.items.push({ id: 'rate', title: ratings_title });
}

return $j.extend(opts, options);
break;
case 'Usage' :
var opts = {};
opts.layout = 'horizontal';
opts.size = 'small';
opts.items = [
{ id: 'commentCount', title: 'comments' },
{ id: 'contentRating', title: { thumbsUpTitle: 'Rating', thumbsDownTitle: 'Rating' }} 
];
return $j.extend(opts, options);
break;
case 'Rating' :
var opts = {};
opts.layout = 'horizontal';
opts.size = 'small';
opts.items = [
{ id: 'commentCount', title: 'Comments' },
{ id: 'contentRating', title: { thumbsUpTitle: 'Rating', thumbsDownTitle: 'Rating' }},
{ id: 'rate' },
{ id: 'share', title: 'Share' },
{ id: 'addToFavorites', title: 'Favorite' }
];
return $j.extend(opts, options);
break;
case 'QuickMenu' :
var opts = {};
opts.showFBConnectButton = true;
return $j.extend(opts, options);
break;
default :
return options;
break;
}
}

this.getWidgetNameByName=function(name)
{
switch(name) {
case 'Rating' :
case 'Rate' :
case 'Usage' :
case 'Statistics' :
case 'Share' :
return 'ContentAction';
break;
case 'Share2' :
return 'Share';
break;
default :
return name;
break;
}
}
};

$j(function() {
$j('.fluxWidget.delay-load').each(function(){
var widget = $j(this);

MTVN.UI.InView.register(widget, function() {
MTVN.Flux.Widgets.loadEach(widget);
});	
});
});

MTVN.Utils = {}

MTVN.Utils.Cookies = new function(){
this.create = function(name,value,days){
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

this.read = function(name){
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

this.erase = function(name){
MTVN.Utils.Cookies.create(name,"",-1);
}
}

function ThemeScheduler() {
this.scheduledTheme = null;
this.makeSchedule = function() {
var xmlString = "<themes> <theme> <start>07 02 2010 00 00</start> <end>07 03 2010 00 00</end> <pageurl>/</pageurl> <url>/sitewide/css/charlie/themes/hp-takeover/lastairbender/theme.jhtml</url> <oparamName>airbender</oparamName> </theme> <theme> <start>07 06 2010 00 00</start> <end>07 07 2010 00 00</end> <pageurl>/</pageurl> <url>/sitewide/css/charlie/themes/hp-takeover/mcdonalds-burgers/theme.jhtml</url> <oparamName>mcdonalds</oparamName> </theme> </themes>";
var loc = window.location.pathname;
var sn = new Object();
window.location.search.replace( new RegExp( "([^?=&]+)(=([^&]*))?", "g" ), function( $0, $1, $2, $3 ){ sn[ $1 ] = $3; } );
var tm = sn['_testTheme'];
var xmlDoc;
try{ //Internet Explorer
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(xmlString);
}
catch(e){
try{ //Firefox, Mozilla, Opera, etc.
var parser=new DOMParser();
xmlDoc=parser.parseFromString(xmlString,"text/xml");
}
catch(e) {}
}

var now = new InitCurrentTime().now;

var n = new Date(now);
var cd = new Date();//client date
for (var i=0; i < xmlDoc.getElementsByTagName("theme").length; i++) {
var pageurl = xmlDoc.getElementsByTagName("pageurl")[i].childNodes[0].nodeValue;
if(pageurl.indexOf("*") > -1) loc = loc.substring(0,pageurl.indexOf("*"))+'*'; 
if(loc == pageurl){
var cn = {};
var node = xmlDoc.getElementsByTagName("theme")[i];
for(j = 0; j < node.childNodes.length ;j++){
var child = node.childNodes[j];
if(child.nodeType==1){
if(child.childNodes.length)
cn[child.nodeName] = child.childNodes[0].nodeValue;
}
}
if(cn['start'].indexOf(":") < 0){ // mtv format
var sa = cn['start'].split(" "); var ea = cn['end'].split(" ");
cn['start'] = sa[2]+'/'+sa[0]+'/'+sa[1]+' '+ sa[3]+':'+sa[4];
cn['end'] = ea[2]+'/'+ea[0]+'/'+ea[1]+' '+ ea[3]+':'+ea[4];
}
var s = new Date(cn['start']);
var e = new Date(cn['end']);
if(tm==cn['oparamName']||parseInt(tm)==i){ // display datetime for this theme
var h = '<span id="testinfo" style="position:absolute; left:3px; top:3px;padding:3px; background:#ff6600; font-family:helvetica; font-size:11px; z-index:9999999">';
h += cn['start']+'<br>';
h += cn['end']+'<br>';
h += cn['url'];
h += '</span>'
document.write(h);
}
if((n < e && n >= s)||tm==cn['oparamName']||parseInt(tm)==i){
this.scheduledTheme = cn['url'];
if(cn['track']!=null && cn['track']!='' && cn['track']!='undefined'){
var ts = cd.getTime();
var tfp = cn['track'].replace(/\[timestamp\]/, ts);
document.write('<div id="track" style="position:absolute; left:-10; width:1px; height:1px; overflow:hidden;"><img s'+'rc="'+tfp+'" width="1" height="1" border="0"/></div>');
}
break;
}
}
}
}
}

MTVN.DartThemeOverride = function(path) {

if (path != 'no_dart_skin')
MTV.setTheme(path);

}

MTVN.writeDartScriptTag = function(testmodeArg) {

var testmode1 = "";
var testmode2 = "";
var testmode3 = testmodeArg;

if (testmode3 != null) {

testmode1 = "testmode=" + testmode3 + ";";
testmode2 = "%7Ctestmode-" + testmode3 + "%7C";

}

document.write('<script type="' + 'text/javascript');
document.write('"');
document.write(' src="');
document.write('http://ad.doubleclick.net/adj/mtv.mtvi/atf_j_s/_hp;sec0=_hp;!category=_hp;!category=float;!category=pop;!category=video;!category=expand;!category=pointroll;' + testmode1 + 'pos=atf;tag=adj;mtype=standard;sz=3x3;tile=4;demo=D;demo=T;demo=1189;demo=852;demo=845;demo=791;demo=776;dcopt=ist;u=!category-_hp%7C!category-float%7C!category-pop%7C!category-video%7C!category-expand%7C!category-pointroll%7C' + testmode2 + 'pos-atf%7Ctag-adj%7Cmtype-standard%7Csz-3x3%7Ctile-4%7Cdemo-D%7Cdemo-T%7Cdemo-1189%7Cdemo-852%7Cdemo-845%7Cdemo-791%7Cdemo-776%7Cdcopt-ist;ord=' + mtvn.btg.util.Math.random(100000000000000000,999999999999999999) + '?');
document.write('">');
document.write('</script>');

}
