/*
 *	MySpace "Video" JavaScript Library
 *
 *   ______           _                           _______     
 *  |  ___ \         | |                         (_______)    
 *  | | _ | |_   _    \ \  ____   ____  ____ ____ _     _   _ 
 *  | || || | | | |    \ \|  _ \ / _  |/ ___) _  ) |   | | | |
 *  | || || | |_| |_____) ) | | ( ( | ( (__( (/ /| |____\ V / 
 *  |_||_||_|\__  (______/| ||_/ \_||_|\____)____)\______)_/  
 *          (____/        |_|                                 
 *
 *	Usage
 *	This file holds the main functionality that's shared amongst controls. This file will not
 *	have any other dependencies on any other javascript function outside of here or the ECMAScript 
 *	standard. 
 *
 *	Test
 *	In Progress... Soon a standard test environment will be used, till then, always code check with 
 *	a member on myspace tv, including myself -andrew
 *
 *	Xml Doc for JavaScript:  
 *	http://weblogs.asp.net/bleroy/archive/2007/04/23/the-format-for-javascript-doc-comments.aspx  
 *	http://blogs.msdn.com/webdevtools/archive/2007/03/02/jscript-intellisense-in-orcas.aspx
 *
 *	Rules: 
 *	Do not use spaces for indentation, use tabs.
 *	Use Tabs for indentation, not spaces.
 *	Use XML documentation for comments. 
 *		VS2008 has better javascript intellisense which we use at MySpace.
 *		The comments might be verbose, but help reduce errors in a shop full of .net devs.
 *		I like JSDoc too, but it only produces documentation afterwards, not instanteously, like VS does.
 *	Always use parseInt() with a radix. It stops at the first non-digit character.
 *		parseInt("08") === 0
 *		parseInt("08",10) === 8
 *	NaN - Special number: Not a number. NaN is not equal to anything, including NaN.
 *	null - A value that isn't anything.
 *	undefined - A value that isn't even that. The default value for vars and params.
 *	Falsy values - false, null, undefined, "" (empty string), 0, NaN
 *	Truthy values - All other values (including all objects) are truthy. 
 *	== != - Equal and nto equal
 *		These operators can do type coercion, it's better to use === and !== which do not. 
 *		1 == true is true, but 1 === true is false. 
 *		"" == false is true, but "" === false is false.
 *		The == operator can hide type errors.
 *
 */
mySpaceTv.extend(mySpaceTv,function(){var listEvents=[];return{getElementsByTagNames:function(){var els,i,results=[];if(document.evaluate){var _tagNames=[];for(i=0;i<arguments.length;i++){_tagNames.push(".//"+arguments[i])}els=document.evaluate(_tagNames.join("|"),this,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(i=0;i<els.snapshotLength;i++){results.push(els.snapshotItem(i))}}else{for(i=0;i<arguments.length;i++){els=this.getElementsByTagName(arguments[i]);for(var j=0;j<els.length;j++){results.push(els[j])}}}return results},getElementsByClassName:function(oElm,strTagName,strClassName){var arrElements=(strTagName=="*"&&oElm.all)?oElm.all:oElm.getElementsByTagName(strTagName);var arrReturnElements=new Array();strClassName=strClassName.replace(/\-/g,"\\-");var oRegExp=new RegExp("(^|\\s)"+strClassName+"(\\s|$)");var oElement;for(var i=0;i<arrElements.length;i++){oElement=arrElements[i];if(oRegExp.test(oElement.className)){arrReturnElements.push(oElement)}}return(arrReturnElements)},extractId:function(e){var chunks=e.id.split("-");if(chunks.length<=1){return 0}else{return parseInt(chunks[chunks.length-1],10)}},showLoading:function(div_id){var temp_HTML="<br><br><br><br><br><center><img src='http://x.myspacecdn.com/modules/videos/static/img/comment/white_loading.gif'></center><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>";$$(div_id).innerHTML=temp_HTML;document.body.focus()},hideDiv:function(divName){return Element.hide(divName)},showDiv:function(divName){return Element.show(divName)},togglePanel:function(panel){if(typeof(panel)=="string"){panel=$$(panel)}if(this.isPanelExpanded(panel)){this.collapsePanel(panel)}else{this.expandPanel(panel)}},getDisplayStyleByTagName:function(o){var n=o.nodeName.toLowerCase();return(n=="span"||n=="img"||n=="a")?"inline":(n=="tr"||n=="td"?"":"block")},toggleClass:function(element,className){return Element.toggleClassName(element,className)},hasClass:function(element,_className){return Element.hasClassName(element,_className)},addClass:function(element,_class){return Element.addClassName(element,_class)},removeClass:function(element,_class){return Element.removeClassName(element,_class)},isPanelExpanded:function(panel){return this.hasClass(panel,"expanded")},expandPanel:function(panel){if(!this.isPanelExpanded(panel)){this.addClass(panel,"expanded")}},collapsePanel:function(panel){if(this.isPanelExpanded(panel)){this.removeClass(panel,"expanded")}},setInnerHTML:function(div_id,value){var dstDiv=$$(div_id);dstDiv.innerHTML=value},buildUrl:function(url,params){var pairs=new Array();var result=url;if(params){for(var key in params){pairs.push(key+"="+encodeURIComponent(params[key].toString()))}result+="?"+pairs.join("&")}return result},stopPropagation:function(e){if(e===null){return}if(!e){e=window.event}if(e.preventDefault){e.preventDefault();e.stopPropagation()}else{e.returnValue=false;e.cancelBubble=true}},enforceLogin:function(){var d=new Date();var ajaxUrl="/index.cfm?fuseaction=vids.ajaxAction&action=ENFORCELOGIN&"+d.getTime();mySpaceTv.getAjaxRequest(ajaxUrl,function(xmlHttpReq){var obj=eval("("+xmlHttpReq+")");if(obj.ServerResponse.IsRequestSuccessful){location.href=obj.ServerResponse.DisplayText}})},onCommentsClicked:function(){Element.scrollTo(document,$$("ivpComments"))},$:function(){var elements=[];for(var i=0;i<arguments.length;i++){var element=arguments[i];if(typeof element=="string"){element=document.getElementById(element)}if(arguments.length==1){return element}elements.push(element)}return elements},addLoadEvent:function(func){this.onReady(func)},addEvent:function(elm,evType,fn,useCapture){useCapture=useCapture||false;if(elm.addEventListener){if(evType==="mouseenter"){elm.addEventListener("mouseover",mouseEnter(fn),useCapture)}else{if(evType==="mouseleave"){elm.addEventListener("mouseout",mouseEnter(fn),useCapture)}}elm.addEventListener(evType,fn,useCapture);this.eventCacheAdd(elm,evType,fn);return true}else{if(elm.attachEvent){elm["e"+evType+fn]=fn;elm[evType+fn]=function(){elm["e"+evType+fn](window.event)};var r=elm.attachEvent("on"+evType,elm[evType+fn]);this.eventCacheAdd(elm,evType,fn);return r}else{elm["on"+evType]=elm["e"+evType+fn]}}function mouseEnter(fn){return function(evt){var relTarget=evt.relatedTarget;if(this===relTarget||isAChildOf(this,relTarget)){return}fn.call(this,evt)}}function isAChildOf(parent,child){if(parent===child){return false}while(child&&child!==parent){child=child.parentNode}return child===parent}},removeEvent:function(elm,evType,fn,useCapture){useCapture=useCapture||false;if(elm.removeEventListener){elm.removeEventListener(evType,fn,useCapture)}if(evType.substring(0,2)!="on"){evType="on"+evType}if(elm.detachEvent){elm.detachEvent(evType,fn)}elm[evType]=null},eventCacheAdd:function(node,sEventName,fHandler){listEvents.push(arguments)},eventCacheFlush:function(){var i,item;for(i=listEvents.length-1;i>=0;i=i-1){item=listEvents[i];if(item[0].removeEventListener){item[0].removeEventListener(item[1],item[2],item[3])}if(item[1].substring(0,2)!="on"){item[1]="on"+item[1]}if(item[0].detachEvent){item[0].detachEvent(item[1],item[2])}item[0][item[1]]=null}},padZeros:function(num,totalLen){var numStr=num.toString();var numZeros=totalLen-numStr.length;for(var i=1;i<=numZeros;i++){numStr="0"+numStr}return numStr},formatNumber:function(num,prefix){prefix=prefix||"";num+="";var splitStr=num.split(".");var splitLeft=splitStr[0];var splitRight=splitStr.length>1?"."+splitStr[1]:"";var regx=/(\d+)(\d{3})/;while(regx.test(splitLeft)){splitLeft=splitLeft.replace(regx,"$1,$2")}return prefix+splitLeft+splitRight},unformatNumber:function(num){return num.replace(/([^0-9\.\-])/g,"")*1},isArray:function(testObject){return testObject&&!(testObject.propertyIsEnumerable("length"))&&typeof testObject==="object"&&typeof testObject.length==="number"},wordWrap:function(str,int_width,str_break,cut){var m=((arguments.length>=2)?arguments[1]:75);var b=((arguments.length>=3)?arguments[2]:"\n");var c=((arguments.length>=4)?arguments[3]:false);var i,j,l,s,r;if(m<1){return str}for(i=-1,l=(r=str.split("\n")).length;++i<l;r[i]+=s){for(s=r[i],r[i]="";s.length>m;r[i]+=s.slice(0,j)+((s=s.slice(j)).length?b:"")){j=c==2||(j=s.slice(0,m+1).match(/\S*(\s)?$/))[1]?m:j.input.length-j[0].length||c==1&&m||j.input.length+(j=s.slice(m).match(/^\S*/)).input.length}}return r.join("\n")},getElementsByClass:function(searchClass,tag,node){var classElements=new Array();if(node==null){node=document}if(tag==null){tag="*"}var els=node.getElementsByTagName(tag);var elsLen=els.length;var pattern=new RegExp("(^|\\\\s)"+searchClass+"(\\\\s|$)");for(i=0,j=0;i<elsLen;i++){if(pattern.test(els[i].className)){classElements[j]=els[i];j++}}return classElements},toggle:function(obj){var el=document.getElementById(obj);if(el.style.display!="none"){el.style.display="none"}else{el.style.display=""}},insertAfter:function(parent,node,referenceNode){parent.insertBefore(node,referenceNode.nextSibling)},getEventTarget:function(e){var targ;if(!e){e=window.event}if(e.target){targ=e.target}else{if(e.srcElement){targ=e.srcElement}}if(targ.nodeType==3){targ=targ.parentNode}return targ},parseUri:function(str){var o={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/};var m=o.parser.exec(str),uri={},i=14;while(i--){uri[o.key[i]]=m[i]||""}uri[o.q.name]={};uri[o.key[12]].replace(o.q.parser,function($0,$1,$2){if($1){uri[o.q.name][$1]=$2}});return uri},createPostVars:function(nameValuePairsArray){var postVars="";if(!(nameValuePairsArray&&!(nameValuePairsArray.propertyIsEnumerable("length"))&&typeof nameValuePairsArray==="object"&&typeof nameValuePairsArray.length==="number")){return""}for(var i=0;i<nameValuePairsArray.length;i++){postVars+=nameValuePairsArray[i][0]+"="+escape(nameValuePairsArray[i][1]);if(i!=(nameValuePairsArray.length-1)){postVars+="&"}}return postVars},postAjaxRequest:function(url,vars,callbackFunction){var request=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("MSXML2.XMLHTTP.3.0");request.open("POST",url,true);request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");request.setRequestHeader("Content-length",vars.length);request.setRequestHeader("Connection","close");request.onreadystatechange=function(){if(request.readyState==4&&request.status==200){if(request.responseText){callbackFunction(request.responseText)}}else{if(request.readyState==4&&request.status!=200){callbackFunction("<response><status>-1</status><message>failed connection</message><response>")}}};request.send(vars)},getAjaxRequest:function(url,callbackFunction){var request=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("MSXML2.XMLHTTP.3.0");request.open("GET",url,true);request.onreadystatechange=function(){if(request.readyState==4){if(request.status==200){if(request.responseText){callbackFunction(request.responseText)}else{callbackFunction("<response><status>-1</status><message>no response text was received</message><response>")}}else{callbackFunction("<response><status>-1</status><message>request failed</message><response>")}}};request.send(null)},getXmlDoc:function(xml){var xmlDoc;if(window.ActiveXObject){xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.loadXML(xml)}else{if(document.implementation.createDocument){var parser=new DOMParser();xmlDoc=parser.parseFromString(xml,"text/xml")}else{alert("Your browser cannot handle this script");return}}return xmlDoc},overlayDialog:function(title,message,buttons,defaultButton,cancelButton,state,callback){var p=MySpace.UI.Popup.create("","");p._element.innerHTML="<div class='tv_vid_popup_box2'><a class='tv_vid_popup_ex'></a><div class='tv_vid_popup_title'></div><div class='tv_vid_popupcontent2'></div><div class='tv_vid_popup_buttons'></div></div>";p._box=p._element.firstChild;p.set_content(message);p.set_title(title);for(var i=0;i<buttons.length;i++){var button=buttons[i];if((button==defaultButton)&&(button==cancelButton)){p.add_button(button,true).isCancel=true}else{if(button==defaultButton){p.add_button(button,true)}else{if(button==cancelButton){p.add_button(button).isCancel=true}else{p.add_button(button)}}}}p.set_state(state);p.show(callback)},overlayAlert:function(title,message){this.overlayDialog(title,message,["Ok"],"Ok","",null,null)},makeBeaconRequest:function(videoid,userId,eventtype,eventvalue){var beacon=MySpace.Application.keyDisabled("MSV_IVP_DWBeacon");if(!beacon){MySpace.Beacon.Request({ivvid:videoid,ivuid:userId,ivet:eventtype,ivev:eventvalue})}}}}());mySpaceTv.extend(String.prototype,{camelize:function(){var D=this.split("-"),A=D.length;if(A==1){return D[0]}var C=this.charAt(0)=="-"?D[0].charAt(0).toUpperCase()+D[0].substring(1):D[0];for(var B=1;B<A;B++){C+=D[B].charAt(0).toUpperCase()+D[B].substring(1)}return C},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)})},extractScripts:function(){var B=new RegExp(ScriptFragment,"img");var A=new RegExp(ScriptFragment,"im");return(this.match(B)||[]).map(function(C){return(C.match(A)||["",""])[1]})},include:function(A){return this.indexOf(A)>-1},interpolate:function(B){var C=this;for(i in B){if(B.hasOwnProperty(i)){var A=new RegExp("#{"+i+"}","g");C=C.replace(A,B[i])}}return C},multiReplace:function(B){var C=this,A;for(A in B){C=C.replace(new RegExp(A,"g"),B[A])}return C},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripScripts:function(){return this.replace(new RegExp(ScriptFragment,"img"),"")},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()}});mySpaceTv.extend(Function.prototype,{argumentNames:function(){var A=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");return A.length==1&&!A[0]?[]:A},bind:function(){if(arguments.length<2&&typeof arguments[0]=="undefined"){return this}var A=this,C=$A(arguments),B=C.shift();return function(){return A.apply(B,C.concat($A(arguments)))}},bindAsEventListener:function(){var A=this,C=$A(arguments),B=C.shift();return function(D){return A.apply(B,[D||window.event].concat(C))}}});mySpaceTv.extend(Array.prototype,{});if(!Array.prototype.map){Array.prototype.map=function(B){var A=this.length;if(typeof B!="function"){throw new TypeError()}var E=new Array(A);var D=arguments[1];for(var C=0;C<A;C++){if(C in this){E[C]=B.call(D,this[C],C,this)}}return E}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(C,A){A||(A=0);var B=this.length;if(A<0){A=B+A}for(;A<B;A++){if(this[A]===C){return A}}return -1}}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(B,A){A=isNaN(A)?this.length:(A<0?this.length+A:A)+1;var C=this.slice(0,A).reverse().indexOf(B);return(C<0)?C:A-C-1}}var Element=function(){var A={};return{addClassName:function(B,C){if(!(B=$$(B))){return}if(!Element.hasClassName(B,C)){B.className+=(B.className?" ":"")+C}return B},cumulativeOffset:function(C){var B=0,D=0;do{B+=C.offsetTop||0;D+=C.offsetLeft||0;C=C.offsetParent}while(C);return Element._returnOffset(D,B)},cumulativeScrollOffset:function(C){var B=0,D=0;do{B+=C.scrollTop||0;D+=C.scrollLeft||0;C=C.parentNode}while(C);return Element._returnOffset(D,B)},ellipsis:function(C,E){var B=E.lines||1;var M=E.enableUpdating||false;var L=E.optimize||0;var P=document.documentElement.style;if(!("textOverflow" in P||"OTextOverflow" in P)){if(!(C=$$(C))){return}var V=C.innerHTML;var R=Element.getStyle(C,"display");if(R!="none"&&R!=null){var K=C.offsetWidth}else{var K=Element.getDimensions(C).width}var N=$$("_ellipsis_calc");var T=(N==null);if(T){N=document.createElement("span");N.style.display="none";N.id="_ellipsis_calc";N.innerHTML=V;document.body.appendChild(N)}var F=Element.getStyle(C,"fontSize");N.style.fontSize=F;var S=Element.getStyle(C,"fontWeight");N.style.fontWeight=S;var O=V;N.style.display="inline";var U=F.substr(0,F.length-2);var Q=(typeof E.padding=="undefined")?U:E.padding;var H=((B*K)-(B*Q));var J=false,D=L;N.innerHTML="";var G=true;if(O.length<D){N.innerHTML=O.substr(0,D);G=false}if(G){N.innerHTML=O;if(N.offsetWidth<=H){G=false}}if(G){N.innerHTML="";while(D<O.length&&N.offsetWidth<H){if(O[D]=="<"){J=true}if(O[D]==">"&&J){J=false}if(J){N.innerHTML=O.substr(0,D)}else{N.innerHTML=(O.substr(0,D)+"\u2026")}D++}}N.style.display="none";C.innerHTML=N.innerHTML;if(M==true){var I=Element.getDimensions(C).width;mySpaceTv.addEvent(window,"resize",function(){if(Element.getDimensions(C).width!=I){I=Element.getDimensions(C).width;C.innerHTML=V;Element.ellipsis(C)}})}}else{return element}},getDimensions:function(D){D=$$(D);var H=this.getStyle(D,"display");if(H!="none"&&H!=null){return{width:D.offsetWidth,height:D.offsetHeight}}var C=D.style;var G=C.visibility;var E=C.position;var B=C.display;C.visibility="hidden";C.position="absolute";C.display="block";var I=D.clientWidth;var F=D.clientHeight;C.display=B;C.position=E;C.visibility=G;return{width:I,height:F}},getOffsetParent:function(B){if(B.offsetParent){return $$(B.offsetParent)}if(B==document.body){return $$(B)}while((B=B.parentNode)&&B!=document.body){if(Element.getStyle(B,"position")!="static"){return $(B)}}return $$(document.body)},getStyle:function(C,D){if(!(C=$$(C))){return}D=D=="float"?"cssFloat":D.camelize();var E;if(C.currentStyle){E=C.currentStyle[D]}else{if(window.getComputedStyle){var B=document.defaultView.getComputedStyle(C,"");E=B?B.getPropertyValue(D):null}else{if(C.style){E=C.style[D]}}}if(D=="opacity"){return E?parseFloat(E):1}return E=="auto"?null:E},hasClassName:function(B,C){if(!(B=$$(B))){return}if(!B.className){return}var D=B.className;return(D.length>0&&(D==C||new RegExp("(^|\\s)"+C+"(\\s|$)").test(D)))},hide:function(B){if(!(B=$$(B))){return}if(B.style.display=="inline"){this.addClassName(B,"wasinline")}else{if(B.style.display=="block"){this.addClassName(B,"wasblock")}else{if(B.style.display=="list-item"){this.addClassName(B,"waslistitem")}}}B.style.display="none";return B},positionedOffset:function(C){var B=0,E=0;do{B+=C.offsetTop||0;E+=C.offsetLeft||0;C=C.offsetParent;if(C){if(C.tagName=="BODY"){break}var D=Element.getStyle(C,"position");if(D!=="static"){break}}}while(C);return Element._returnOffset(E,B)},readAttribute:function(D,B){D=$$(D);if(Browser.msie){var C={names:{"class":"className","for":"htmlFor"},values:{style:function(E){return E.style.cssText.toLowerCase()},title:function(E){return E.title}}};if(C.values[B]){return C.values[B](D,B)}if(C.names[B]){B=C.names[B]}if(B.include(":")){return(!D.attributes||!D.attributes[B])?null:D.attributes[B].value}}return D.getAttribute(B)},remove:function(B){B=$$(B);B.parentNode.removeChild(B);return B},removeClassName:function(B,C){if(!(B=$$(B))){return}B.className=B.className.replace(new RegExp("(^|\\s+)"+C+"(\\s+|$)")," ").strip();return B},replace:function(C,D){C=$$(C);if(D&&D.toElement){D=D.toElement()}else{if(!(D&&D.nodeType==1)){D.toHTML?D.toHTML():String(D);var B=C.ownerDocument.createRange();B.selectNode(C);D=B.createContextualFragment(D.stripScripts())}}C.parentNode.replaceChild(D,C);return C},scrollTo:function(B,G,C){var H=function(K){return typeof K=="object"?K:{top:K,left:K}};var I=function(){return B.map(function(){var L=arguments[0],K=!L.nodeName||$A(["iframe","#document","html","body"]).indexOf(L.nodeName.toLowerCase())>0;if(!K){return L}var M=(L.contentWindow||L).document||L.ownerDocument||L;return Browser.safari||M.compatMode=="BackCompat"?M.body:M.documentElement})};var E=function(L){for(var K in L){if(typeof L[K]=="string"){var M=L[K].indexOf("px");if(M>0){L[K]=L[K].substring(0,M)}}}};var D={axis:"xy",margin:false,offset:0,over:0};C=mySpaceTv.extend(mySpaceTv.extend({},D),arguments[2]||{});C.offset=H(C.offset);C.over=H(C.over);if(!B.length){B=new Array(B)}if(G=="max"){G=9000000000}var J=I();for(var F=0;F<J.length;F++){(function(){var Q=J[F],M=$$(Q),P=G,L,K={},R=/^body|html$/i.test(Q.tagName)?true:false;switch(typeof P){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px)?$/.test(P)){P=H(P);E(P);break}P=$CSS(P)[0];case"object":if(P.nodeName){P=$$(P);L=Element.cumulativeOffset(P)}else{E(P)}}var O=C.axis.split("");for(var N=0;N<O.length;N++){(function(W){var X=W=="x"?"Left":"Top",Y=X.toLowerCase(),V="scroll"+X,T=Q[V],U=W=="x"?"Width":"Height";if(L){K[V]=L[Y]+(R?0:0-Element.cumulativeOffset(Q)[Y]);if(C.margin){K[V]-=parseInt(Element.getStyle(P,"margin"+X))||0;K[V]-=parseInt(Element.getStyle(P,"border"+X+"Width"))||0}K[V]+=C.offset[Y]||0;if(C.over[Y]){K[V]+=Element.getDimensions(P)[U.toLowerCase()]*C.over[Y]}}else{K[V]=P[Y]}if(/^\d+$/.test(K[V])){K[V]=K[V]<=0?0:Math.min(K[V],S(U))}M[V]=K[V];function S(g){var b="scroll"+g;if(!R){return Q[b]}var f="client"+g,d=Q.ownerDocument.documentElement,Z=Q.ownerDocument.body;return Math.max(d[b],Z[b])-Math.min(d[f],Z[f])}})(O[N])}})()}},show:function(B){if(!(B=$$(B))){return}if(this.hasClassName(B,"wasinline")){B.style.display="inline";this.removeClassName(B,"wasinline")}else{if(this.hasClassName(B,"wasblock")){B.style.display="block";this.removeClassName(B,"block")}else{if(this.hasClassName(B,"waslistitem")){B.style.display="list-item";this.removeClassName(B,"waslistitem")}else{B.style.display=mySpaceTv.getDisplayStyleByTagName(B)}}}return B},toggle:function(B){B=$$(B);Element[Element.visible(B)?"hide":"show"](B);return B},toggleClassName:function(B,C){if(!(B=$$(B))){return}if(this.hasClassName(B,C)){this.removeClassName(B,C)}else{this.addClassName(B,C)}return B},viewportOffset:function(E){var B=0,D=0;var C=E;do{B+=C.offsetTop||0;D+=C.offsetLeft||0;if(C.offsetParent==document.body&&this.getStyle(C,"position")=="absolute"){break}}while(C=C.offsetParent);C=E;do{if(!Browser.opera||C.tagName=="BODY"){B-=C.scrollTop||0;D-=C.scrollLeft||0}}while(C=C.parentNode);return Element._returnOffset(D,B)},visible:function(B){if(!(B=$$(B))){return}if(this.getStyle(B,"visibility")=="hidden"||this.getStyle(B,"display")=="none"){return false}else{return true}},writeAttribute:function(F,D,G){F=$$(F);var C={},E={names:{className:"class",htmlFor:"for"},values:{}};if(Browser.msie){E={names:mySpaceTv.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},E.names),values:{checked:function(H,I){H.checked=!!I},style:function(H,I){H.style.cssText=I?I:""}}}}if(typeof D=="object"){C=D}else{C[D]=(typeof G=="undefined")?true:G}for(var B in C){D=E.names[B]||B;G=C[B];if(E.values[B]){D=E.values[B](F,G)}if(G===false||G===null){F.removeAttribute(D)}else{if(G===true){F.setAttribute(D,D)}else{F.setAttribute(D,G)}}}return F},_endMarker:function(){alert("end")}}}();Element._returnOffset=function(B,C){var A=[B,C];A.left=B;A.top=C;return A};if(Browser.msie){Element.getStyle=function(A,B){A=$$(A);B=(B=="float"||B=="cssFloat")?"styleFloat":B.camelize();var C=A.style[B];if(!C&&A.currentStyle){C=A.currentStyle[B]}if(B=="opacity"){if(C=(A.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(C[1]){return parseFloat(C[1])/100}}return 1}if(C=="auto"){if((B=="width"||B=="height")&&(A.getStyle("display")!="none")){return A["offset"+B.capitalize()]+"px"}return null}return C};Element.setOpacity=function(B,E){function F(G){return G.replace(/alpha\([^\)]*\)/gi,"")}B=$$(B);var A=B.currentStyle;if((A&&!A.hasLayout)||(!A&&B.style.zoom=="normal")){B.style.zoom=1}var D=B.getStyle("filter"),C=B.style;if(E==1||E===""){(D=F(D))?C.filter=D:C.removeAttribute("filter");return B}else{if(E<0.00001){E=0}}C.filter=F(D)+"alpha(opacity="+(E*100)+")";return B}}else{if(Browser.safari){Element.setOpacity=function(A,B){A=$$(A);A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;if(B==1){if(A.tagName=="IMG"&&A.width){A.width++;A.width--}else{try{var D=document.createTextNode(" ");A.appendChild(D);A.removeChild(D)}catch(C){}}}return A}}}document.viewport={getDimensions:function(){var C={};var G=Browser;var F=["width","height"];for(var A=0;A<F.length;A++){var E=F[A].capitalize();C[F[A]]=(G.safari&&!document.evaluate)?self["inner"+E]:(G.opera)?document.body["client"+E]:document.documentElement["client"+E]}return C},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};Object.Event={extend:function(A){A._objectEventSetup=function(B){this._observers=this._observers||{};this._observers[B]=this._observers[B]||[]};A.observe=function(D,B){if(typeof(D)=="string"&&typeof(B)!="undefined"){this._objectEventSetup(D);if(!this._observers[D].indexOf(B)>-1){this._observers[D].push(B)}}else{for(var C in D){this.observe(C,D[C])}}};A.stopObserving=function(C,B){this._objectEventSetup(C);if(C&&B){this._observers[C]=this._observers[C].without(B)}else{if(C){this._observers[C]=[]}else{this._observers={}}}};A.observeOnce=function(D,C){var B=function(){C.apply(this,arguments);this.stopObserving(D,B)}.bind(this);this._objectEventSetup(D);this._observers[D].push(B)};A.notify=function(F){this._objectEventSetup(F);var D=[];var B=$A(arguments).slice(1);try{for(var C=0;C<this._observers[F].length;++C){D.push(this._observers[F][C].apply(this._observers[F][C],B)||null)}}catch(E){if(E==$break){return false}else{throw E}}return D};if(A.prototype){A.prototype._objectEventSetup=A._objectEventSetup;A.prototype.observe=A.observe;A.prototype.stopObserving=A.stopObserving;A.prototype.observeOnce=A.observeOnce;A.prototype.notify=function(F){if(A.notify){var B=$A(arguments).slice(1);B.unshift(this);B.unshift(F);A.notify.apply(A,B)}this._objectEventSetup(F);var B=$A(arguments).slice(1);var D=[];try{if(this.options&&this.options[F]&&typeof(this.options[F])=="function"){D.push(this.options[F].apply(this,B)||null)}for(var C=0;C<this._observers[F].length;++C){D.push(this._observers[F][C].apply(this._observers[F][C],B)||null)}}catch(E){if(E==$break){return false}else{throw E}}return D}}}};Object.Event.extend(mySpaceTv);
/*
 * Expando
 *	
 *  ______                            _       
 * |  ____|                          | |      
 * | |__  __  ___ __   __ _ _ __   __| | ___  
 * |  __| \ \/ / '_ \ / _` | '_ \ / _` |/ _ \ 
 * | |____ >  <| |_) | (_| | | | | (_| | (_) |
 * |______/_/\_\ .__/ \__,_|_| |_|\__,_|\___/ 
 *             | |                            
 *             |_|       
 *	
 *	  	   
 * This custom object stores data for elements: storing data directly in elements
 * (DomElement.customData = foobar;) isn't a good idea. It would lead to conflicts
 * in form elements, when the form has a child with name="foobar". Therefore, this
 * solution follows the approach of jQuery: the data is stored in an object and
 * referenced by a unique attribute of the element. The attribute has a name that 
 * is built by the prefix "MySpaceExpando_" and a random number, so if the very
 * very rare case occurs, that there's already an attribute with the same name, a
 * simple reload is enough to make it function.
 *
 */
var Expando=(function(){var A={},B="MySpaceExpando_"+Math.random(),C=0;return{getDataForElem:function(D){return A[D[B]]},setDataForElem:function(D,E){var F;if(D[B]&&D[B]!==""){F=D[B]}else{F=C++;D[B]=F}A[F]=E},appendDataForElem:function(E,F){var D;for(D in F){if(F.hasOwnProperty(D)){A[E[B]][D]=F[D]}}},delDataOfElem:function(D){delete A[D[B]]}}}());mySpaceTv.addEvent(window,"unload",mySpaceTv.eventCacheFlush.bind(mySpaceTv));var Form=function(){var A={input:function(B,C){switch(B.type.toLowerCase()){case"checkbox":case"radio":return this.inputSelector(B,C);default:return this.textarea(B,C)}},inputSelector:function(B,C){if(typeof(C)=="undefined"){return B.checked?B.value:null}else{B.checked=!!C}},textarea:function(B,C){if(typeof(C)=="undefined"){return B.value}else{B.value=C}},select:function(E,B){if(typeof(B)=="undefined"){return this[E.type=="select-one"?"selectOne":"selectMany"](E)}else{var D,G,H=!Object.isArray(B);for(var C=0,F=E.length;C<F;C++){D=E.options[C];G=this.optionValue(D);if(H){if(G==B){D.selected=true;return}}else{D.selected=B.include(G)}}}},selectOne:function(C){var B=C.selectedIndex;return B>=0?this.optionValue(C.options[B]):null},selectMany:function(E){var B=[];var F=E.length;if(!F){return null}for(var D=0;D<F;D++){var C=E.options[D];if(C.selected){B.push(this.optionValue(C))}}return B},optionValue:function(C){var B=false;if(C.hasAttribute){B=C.hasAttribute("value")}else{B=this.hasAttribute(C,"value")}return B?C.value:C.text},hasAttribute:function(B,D){var C=$$(B).getAttributeNode(D);return C&&C.specified}};return{serialize:function(B){B=$$(B);if(!B.disabled&&B.name){var C=this.getValue(B);if(typeof(C)!=undefined){var D={};D[B.name]=C;return Form.toQueryString(D)}}return""},toQueryString:function(D){var B=encodeURIComponent(D.key),C=D.value;if(typeof(C)=="undefined"){return B}return B+"="+encodeURIComponent(C)},getFormFields:function(B){B=$$(B);return mySpaceTv.getElementsByTagNames.apply(B,["input","select","textarea"])},getValue:function(B){B=$$(B);var C=B.tagName.toLowerCase();return A[C](B)},setValue:function(B,C){B=$$(B);var D=B.tagName.toLowerCase();A[D](B,C);return B},clear:function(B){$$(B).value="";return B},present:function(B){return $$(B).value!==""},focus:function(B){if(!(B=$$(B))){return}if(B.autofocus===false||B.autofocus===true){return}B.autofocus=true;if(B.disabled){return}var C=B;while(C&&C.nodeType==1){if(!Element.visible(C)){return}C=C.parentNode}B.focus();return B},select:function(B){$$(B).select();return B},activate:function(B){B=$$(B);try{this.focus(B);if(B.select&&(B.tagName.toLowerCase()!="input")){B.select()}}catch(C){}return B},disable:function(B){B=$$(B);B.blur();if(B.disable){B.disable()}B.disabled=true;return B},enable:function(B){B=$$(B);if(B.enable){B.enable()}B.disabled=false;return B}}}();var cd=function(){var localize={subscribe_text:"Subscribe",unsubscribe_text:"Unsubscribe",login_alert:"You must be logged-in to do that! Do you wish to login?"};var options={contributorId:0,userId:-1,isLoggedIn:false,subscribe_hash:null,eleSubscribeBtnId:null,isSubscribed:false};var eleSubscribeBtn;var eleText;return{init:function(){mySpaceTv.extend(options,arguments[0]||{});mySpaceTv.extend(localize,arguments[1]||{});eleSubscribeBtn=$$(options.eleSubscribeBtnId);if(eleSubscribeBtn){mySpaceTv.addEvent(eleSubscribeBtn,"click",this.subscribeChannel.bindAsEventListener(this));eleText=$CSS("#"+options.eleSubscribeBtnId+" .tv-imageless-button-content");if(eleText){eleText=eleText[0]}}},subscribeChannel:function(e,rating){if(!options.isLoggedIn){return this.loginAlert()}var action="SUBSCRIBECHANNEL";if(options.isSubscribed){action="UNSUBSCRIBECHANNEL"}var d=new Date();var ajaxUrl="/index.cfm?fuseaction=vids.ajaxAction&action="+action+"&id="+options.contributorId+"&h="+encodeURIComponent(options.subscribe_hash)+"&"+d.getTime();mySpaceTv.getAjaxRequest(ajaxUrl,function(response){var json=eval("("+response+")");if(json.ServerResponse.IsRequestSuccessful){options.isSubscribed=!options.isSubscribed;if(eleText){if(options.isSubscribed){eleText.innerHTML=localize.unsubscribe_text}else{eleText.innerHTML=localize.subscribe_text}}}else{mySpaceTv.overlayAlert("Error",json.ServerResponse.DisplayText)}}.bind(this))},loginAlert:function(){if(confirm(localize.login_alert)){return mySpaceTv.enforceLogin()}else{return false}}}}();
/*
 *	MySpace Video "Favored Videos" JS Library
 *	
 *  ______                            _  __      ___     _                
 * |  ____|                          | | \ \    / (_)   | |               
 * | |__ __ ___   _____  _ __ ___  __| |  \ \  / / _  __| | ___  ___  ___ 
 * |  __/ _` \ \ / / _ \| '__/ _ \/ _` |   \ \/ / | |/ _` |/ _ \/ _ \/ __|
 * | | | (_| |\ V / (_) | | |  __/ (_| |    \  /  | | (_| |  __/ (_) \__ \
 * |_|  \__,_| \_/ \___/|_|  \___|\__,_|     \/   |_|\__,_|\___|\___/|___/
 * 
 *	
 *	See: 
 *
 *	Notes: 
 *	1. This class participates with the Thumbnail Manager.
 *			It listens for the 'ThumbnailManager:Init' event to register our thumbnails with it. 
 *
 */
(function(){var A={};var C={};var B;return{init:function(){mySpaceTv.observe("ThumbnailManager:Init",this.onThumbnailManagerInit.bind(this));return this},onThumbnailManagerInit:function(D){if(!D){return}B=D;if(B){if(B.useRotatingThumbs()||B.useContributorPopup()){var E=$$("featuredVideosModule");B.registerThumbs($CSS(".v120Inner a img",E),{})}}}}}().init());var fv=function(){var submitData=function(url,data){var form=document.createElement("form");form.action=url;form.method="post";for(var i in data){addParam(form,i,data[i])}form.style.display="none";document.body.appendChild(form);form.submit()};var addParam=function(form,key,value){var input=document.createElement("input");input.name=key;input.value=value;form.appendChild(input)};var localize={add_to_profile:"Add to Profile",confirm_add_to_profile:"Are you sure you want to add this to your Profile?",yes:"Yes",no:"No",success_add_to_profile:"You have successfully added this video to your Profile.",return_to_video:"Return to video",goto_myprofile:"Go to My Profile",error_title:"",save_to_favorites:"Save to Favorites",confirm_save_to_favorites:"Are you sure you want to save this as a Favorite?",success_save_to_favorites:"You have successfully added this video to your Favorites.",goto_myfavorites:"Go to My Favorites",flag_confirm:"Are you sure you want to flag this video as inappropriate?",login_alert:"You must be logged-in to do that! Do you wish to login?"};var options={videoId:0,releaseId:0,userId:-1,isLoggedIn:false,rate_hash:null,fav_hash:null,profile_hash:null,flag_hash:null,allowRating:false,eleRatingUpId:null,eleRatingDownId:null,eleAddToProfileId:null,eleSaveToFavoritesId:null,eleReportAbuseId:null,eleBlogThisId:null,eleBulletinThisId:null,eleEmailThisId:null,emailVideoUrl:null,blogAction:null,bulletinAction:null,share_subject:null,share_body:null};var eleReportAbuse;var eleRatingUp;var eleRatingDown;var eleAddToProfile;var eleSaveToFavorites;var eleReportAbuse;var eleBlogThis;var eleBulletinThis;var eleEmailThis;var eleViewMore;var eleViewLess;var eleFullDescription;var eleTrucDescription;return{init:function(){mySpaceTv.extend(options,arguments[0]||{});mySpaceTv.extend(localize,arguments[1]||{});eleFullDescription=$$("full_description");eleTrucDescription=$$("truncated_description");eleViewMore=$$("view_more");if(eleViewMore){mySpaceTv.addEvent(eleViewMore,"click",this.showMore.bindAsEventListener(this))}eleViewLess=$$("view_less");if(eleViewLess){mySpaceTv.addEvent(eleViewLess,"click",this.showLess.bindAsEventListener(this))}eleRatingUp=$$(options.eleRatingUpId);if(eleRatingUp&&options.allowRating){mySpaceTv.addEvent(eleRatingUp,"click",this.rateVideo.bindAsEventListener(this,100))}eleRatingDown=$$(options.eleRatingDownId);if(eleRatingDown&&options.allowRating){mySpaceTv.addEvent(eleRatingDown,"click",this.rateVideo.bindAsEventListener(this,0))}eleAddToProfile=$$(options.eleAddToProfileId);if(eleAddToProfile){mySpaceTv.addEvent(eleAddToProfile,"click",this.addToProfile.bindAsEventListener(this))}eleSaveToFavorites=$$(options.eleSaveToFavoritesId);if(eleSaveToFavorites){mySpaceTv.addEvent(eleSaveToFavorites,"click",this.saveToFavorites.bindAsEventListener(this))}eleReportAbuse=$$(options.eleReportAbuseId);if(eleReportAbuse){mySpaceTv.addEvent(eleReportAbuse,"click",this.flagVideo.bindAsEventListener(this))}eleBlogThis=$$(options.eleBlogThisId);if(eleBlogThis){mySpaceTv.addEvent(eleBlogThis,"click",this.blogThis.bindAsEventListener(this))}eleBulletinThis=$$(options.eleBulletinThisId);if(eleBulletinThis){mySpaceTv.addEvent(eleBulletinThis,"click",this.bulletinThis.bindAsEventListener(this))}eleEmailThis=$$(options.eleEmailThisId);if(eleEmailThis){mySpaceTv.addEvent(eleEmailThis,"click",this.emailThis.bindAsEventListener(this))}},showMore:function(e){Element.hide(eleTrucDescription);Element.show(eleFullDescription)},showLess:function(e){Element.hide(eleFullDescription);Element.show(eleTrucDescription)},addToProfile:function(){if(!options.isLoggedIn){return this.loginAlert()}mySpaceTv.overlayDialog(localize.add_to_profile,localize.confirm_add_to_profile,[localize.yes,localize.no],localize.no,localize.no,{},this.doAddToProfile.bind(this))},doAddToProfile:function(sender,args){if(args.target.isCancel){return}var d=new Date();var ajaxUrl="/index.cfm?fuseaction=vids.ajaxAction&action=ADDTOPROFILE&videoid="+options.videoId+"&releaseid="+options.releaseId+"&h="+encodeURIComponent(options.profile_hash)+"&"+d.getTime();mySpaceTv.getAjaxRequest(ajaxUrl,function(xmlHttpReq){var json=eval("("+xmlHttpReq+")");if(json.ServerResponse.IsRequestSuccessful){mySpaceTv.overlayDialog(localize.add_to_profile,localize.success_add_to_profile,[localize.return_to_video,localize.goto_myprofile],localize.return_to_video,localize.return_to_video,{},this.addToProfileComplete.bind(this));mySpaceTv.makeBeaconRequest(options.videoId,options.userId,"55","")}else{mySpaceTv.overlayAlert("Error",json.ServerResponse.DisplayText)}}.bind(this))},addToProfileComplete:function(sender,args){if(args.target.isCancel){return}window.location.href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendId="+options.userId},saveToFavorites:function(){if(!options.isLoggedIn){return this.loginAlert()}mySpaceTv.overlayDialog(localize.save_to_favorites,localize.confirm_save_to_favorites,[localize.yes,localize.no],localize.no,localize.no,{},this.doSaveToFavorites.bind(this))},doSaveToFavorites:function(sender,args){if(args.target.isCancel){return}var d=new Date();var ajaxUrl="/index.cfm?fuseaction=vids.ajaxAction&action=SAVETOFAVOURITE&videoid="+options.videoId+"&releaseid="+options.releaseId+"&h="+encodeURIComponent(options.fav_hash)+"&"+d.getTime();mySpaceTv.getAjaxRequest(ajaxUrl,function(xmlHttpReq){var json=eval("("+xmlHttpReq+")");if(json.ServerResponse.IsRequestSuccessful){mySpaceTv.overlayDialog(localize.save_to_favorites,localize.success_save_to_favorites,[localize.return_to_video,localize.goto_myfavorites],localize.return_to_video,localize.return_to_video,null,this.saveToFavoritesComplete.bind(this))}else{mySpaceTv.overlayAlert("Error",json.ServerResponse.DisplayText)}}.bind(this))},saveToFavoritesComplete:function(sender,args){if(args.target.isCancel){return}window.location.href="/index.cfm?fuseaction=vids.myFavorites"},blogThis:function(e){if(!options.isLoggedIn){return this.loginAlert()}var action=options.blogAction;var postparams={subject:options.share_subject,body:unescape(options.share_body)};submitData(action,postparams)},bulletinThis:function(e){if(!options.isLoggedIn){return this.loginAlert()}var action=options.bulletinAction;var postparams={subject:options.share_subject,body:unescape(options.share_body)};submitData(action,postparams)},emailThis:function(e){var url=unescape(options.emailVideoUrl);url=url.interpolate({videoid:options.videoId});mySpaceTv.makeBeaconRequest(options.videoId,options.userId,"1004","");window.location.href=url},rateVideo:function(e,rating){if(!options.isLoggedIn){return this.loginAlert()}var d=new Date();var ajaxUrl="/index.cfm?fuseaction=vids.ajaxAction&action=RATING&videoid="+options.videoId+"&releaseid="+options.releaseId+"&rating="+rating+"&h="+encodeURIComponent(options.rate_hash)+"&"+d.getTime();mySpaceTv.getAjaxRequest(ajaxUrl,function(response){var json=eval("("+response+")");if(json.ServerResponse.IsRequestSuccessful){if(rating===0){mySpaceTv.makeBeaconRequest(options.videoId,options.userId,"1002","")}else{mySpaceTv.makeBeaconRequest(options.videoId,options.userId,"1001","")}}else{mySpaceTv.overlayAlert("Error",json.ServerResponse.DisplayText)}}.bind(this))},flagVideo:function(){if(!options.isLoggedIn){return this.loginAlert()}if(confirm(localize.flag_confirm)){var d=new Date();var ajaxUrl="/index.cfm?fuseaction=vids.ajaxAction&action=FLAGVIDEO&videoId="+options.videoId+"&releaseId="+options.releaseId+"&h="+encodeURIComponent(options.flag_hash)+"&"+d.getTime();mySpaceTv.getAjaxRequest(ajaxUrl,function(xmlHttpReq){var obj=eval("("+xmlHttpReq+")");if(obj.ServerResponse.IsRequestSuccessful){}else{}})}},loginAlert:function(){if(confirm(localize.login_alert)){return mySpaceTv.enforceLogin()}else{return false}}}}();
/*
 *	MySpace Video "More Videos" JS Library
 *	
 *  __  __                 __      ___     _                
 * |  \/  |                \ \    / (_)   | |               
 * | \  / | ___  _ __ ___   \ \  / / _  __| | ___  ___  ___ 
 * | |\/| |/ _ \| '__/ _ \   \ \/ / | |/ _` |/ _ \/ _ \/ __|
 * | |  | | (_) | | |  __/    \  /  | | (_| |  __/ (_) \__ \
 * |_|  |_|\___/|_|  \___|     \/   |_|\__,_|\___|\___/|___/
 *                                                              
 *	
 *  TODO
 *   1. Start using jsdoc-toolkit, "A documentation generator for JavaScript"
 *			a. The MySpace Developer Platform uses it now, 
 * 						http://developer.myspace.com/community/myspace/myopenspace.aspx 
 *			b. http://code.google.com/p/jsdoc-toolkit/
 *
 *	Notes
 *	1. This class participates with the Thumbnail Manager.
 *			It listens for the 'ThumbnailManager:Init' event to register our thumbnails with it.
 *
 */
(function(){MoreVideosFlap=function(A,B){this.localize={};this.options={flapViewJS:null,flapContainerId:"",dataSource:"",loaded:false,contributorid:""};this.flap;this.tabClicked=0;this.myThumbs;this.myContributors;this.thumbnailMgr;return this.init(A,B)};MoreVideosFlap.prototype={init:function(A,C){this.options=mySpaceTv.extend(this.options,arguments[0]||{});this.localize=mySpaceTv.extend(this.localize,arguments[1]||{});var B=this.options.flapViewJS;if(typeof(B)!="undefined"){B.observe("beforeChange",this.onBeforeChanging.bind(this));B.observe("afterChange",this.onAfterChanging.bind(this))}this.flap=$$(this.options.flapContainerId);mySpaceTv.observe("ThumbnailManager:Init",this.onThumbnailManagerInit.bind(this));return this},showLoading:function(){this.flap.innerHTML="<br/><br/><br/><br/><br/><center><img src='http://x.myspacecdn.com/modules/videos/static/img/mysubs/white_loading.gif'></center>";this.flap.focus()},showError:function(A){alert("morevideos.js says:\n\nAn Error ocurred:\n"+A.message)},makeAjaxRequest:function(){var B=new Date();var A="/index.cfm?fuseaction=vids.ajaxAction&action=GETSORTEDVIDEOS&sb="+this.options.dataSource+"&channelid="+this.options.contributorid+"&"+B.getTime();mySpaceTv.getAjaxRequest(A,function(C){this.flap.innerHTML=C}.bind(this))},onThumbnailManagerInit:function(A){if(!A){return}this.thumbnailMgr=A;this.registerThumbs()},registerThumbs:function(){if(!this.thumbnailMgr){return}var A=this.thumbnailMgr;if(A&&this.options.loaded){if(A.useRotatingThumbs()||A.useContributorPopup()){this.myThumbs=$CSS(".v120Inner a img",this.flap);A.registerThumbs(this.myThumbs,{})}if(A.useContributorPopup()){this.myContributors=$CSS(".vpublisher a",this.flap);A.registerContributors(this.myContributors,{})}}},unregisterThumbs:function(){if(!this.thumbnailMgr){return}var A=this.thumbnailMgr;if(A&&A.useRotatingThumbs()&&this.options.loaded){A.unRegisterThumbs(this.myThumbs)}},onBeforeChanging:function(B,A){if(this.options.flapContainerId==B){if(this.tabClicked>1&&this.options.loaded){this.unregisterThumbs();this.options.loaded=false}}},onAfterChanging:function(B,A){if(this.options.flapContainerId==A){if(this.tabClicked>1||!this.options.loaded){this.showLoading();this.makeAjaxRequest();this.options.loaded=true;window.setTimeout(this.registerThumbs.bind(this),1000);this.tabClicked=0}else{this.tabClicked+=1}}}}})();Object.Event.extend(MoreVideosFlap);(function(){var B=[];var A=function(){for(var D=0;D<B.length;D=D+2){var E=B[D];var C=B[D+1];mySpaceTv.removeEvent(E,"mousedown",C.onActiveEvent);mySpaceTv.removeEvent(E,"mouseup",C.offActiveEvent);mySpaceTv.removeEvent(E,"mouseover",C.onHover);mySpaceTv.removeEvent(E,"mouseout",C.offHover)}};_clearTimeout=function(C){clearTimeout(C);clearInterval(C);return null};ImagelessButton=function(C,D){this.options={};this.el;this.disabled=false;return this.init(C,D)};ImagelessButton.prototype={init:function(C,D){this.el=$$(arguments[0]);if(!this.el){return this}this.options=mySpaceTv.extend(mySpaceTv.extend({},this.options),arguments[1]||{});this.onActiveEvent=this.onActive.bindAsEventListener(this);this.offActiveEvent=this.offActive.bindAsEventListener(this);this.onHoverEvent=this.onHover.bindAsEventListener(this);this.offHoverEvent=this.offHover.bindAsEventListener(this);mySpaceTv.addEvent(this.el,"mousedown",this.onActiveEvent);mySpaceTv.addEvent(this.el,"mouseup",this.offActiveEvent);mySpaceTv.addEvent(this.el,"mouseover",this.onHoverEvent);mySpaceTv.addEvent(this.el,"mouseout",this.offHoverEvent);B.push(this.el,this);this.el.disable=this.disable.bind(this);this.el.enable=this.enable.bind(this);return this},disable:function(){Element.addClassName(this.el,"tv-imageless-button-disabled");this.disabled=true},enable:function(){Element.removeClassName(this.el,"tv-imageless-button-disabled");this.disabled=false},onHover:function(){if(!this.disabled){Element.addClassName(this.el,"tv-imageless-button-hover")}},offHover:function(){if(!this.disabled){Element.removeClassName(this.el,"tv-imageless-button-hover")}},onFocus:function(){if(!this.disabled){Element.addClassName(this.el,"tv-imageless-button-focused")}},offFocus:function(){if(!this.disabled){Element.removeClassName(this.el,"tv-imageless-button-focused")}},onActive:function(){if(!this.disabled){Element.addClassName(this.el,"tv-imageless-button-active")}},offActive:function(){if(!this.disabled){Element.removeClassName(this.el,"tv-imageless-button-active")}}};ImagelessButton.removeButtons=function(){A()}})();(function(){var B=[];var A=function(){for(var D=0;D<B.length;D=D+2){var E=B[D];var C=B[D+1];mySpaceTv.removeEvent(E,"mousedown",C.onActiveEvent);mySpaceTv.removeEvent(E,"mouseup",C.offActiveEvent);mySpaceTv.removeEvent(E,"mouseover",C.onHover);mySpaceTv.removeEvent(E,"mouseout",C.offHover)}};_clearTimeout=function(C){clearTimeout(C);clearInterval(C);return null};ImageButton=function(C,D){this.options={};this.el;this.disabled=false;return this.init(C,D)};ImageButton.prototype={init:function(C,D){this.el=$$(arguments[0]);this.options=mySpaceTv.extend(mySpaceTv.extend({},this.options),arguments[1]||{});this.onActiveEvent=this.onActive.bindAsEventListener(this);this.offActiveEvent=this.offActive.bindAsEventListener(this);this.onHoverEvent=this.onHover.bindAsEventListener(this);this.offHoverEvent=this.offHover.bindAsEventListener(this);mySpaceTv.addEvent(this.el,"mousedown",this.onActiveEvent);mySpaceTv.addEvent(this.el,"mouseup",this.offActiveEvent);mySpaceTv.addEvent(this.el,"mouseover",this.onHoverEvent);mySpaceTv.addEvent(this.el,"mouseout",this.offHoverEvent);B.push(this.el,this);this.el.disable=this.disable.bind(this);this.el.enable=this.enable.bind(this);return this},disable:function(){Element.addClassName(this.el,"tv-image-button-disabled");this.disabled=true},enable:function(){Element.removeClassName(this.el,"tv-image-button-disabled");this.disabled=false},onHover:function(){if(!this.disabled){Element.addClassName(this.el,"tv-image-button-hover")}},offHover:function(){if(!this.disabled){Element.removeClassName(this.el,"tv-image-button-hover")}},onFocus:function(){if(!this.disabled){Element.addClassName(this.el,"tv-image-button-focused")}},offFocus:function(){if(!this.disabled){Element.removeClassName(this.el,"tv-image-button-focused")}},onActive:function(){if(!this.disabled){Element.addClassName(this.el,"tv-image-button-active")}},offActive:function(){if(!this.disabled){Element.removeClassName(this.el,"tv-image-button-active")}}};ImageButton.removeButtons=function(){A()}})();var mstv_href=window.location.href;var mstv_hashIndex=mstv_href.indexOf("#");if(mstv_hashIndex!=-1){mstv_href=mstv_href.substring(0,mstv_hashIndex)}if(typeof(mstv_container_id)=="undefined"){mstv_container_id="mstv_thread"}(function(){var KEY_BACKSPACE=8;var KEY_DELETE=46;var KEY_LEFT=37;var KEY_UP=38;var KEY_RIGHT=39;var KEY_DOWN=40;var KEY_HOME=36;var KEY_END=35;var ALLOWED_KEYS=[KEY_BACKSPACE,KEY_DELETE,KEY_LEFT,KEY_UP,KEY_RIGHT,KEY_DOWN,KEY_HOME,KEY_END];function MsTvComment(id){this.id=id;this.container=$$("mstv_comment-"+id);this.header=$$("mstv_comment-header-"+id);this.avatar=$$("mstv_avatar-"+id);this.datetime=$$("mstv_time-"+id);this.footer=$$("mstv_comment-footer-"+id);this.flag_span=$$("mstv_post-report-"+id);this.flag_link=$$("mstv_post-report-a-"+id);this.remove=$$("mstv_remove-"+id);this.remove_span=$$("mstv_remove-wrap"+id);this.login_link=$$("mstv_login-link"+id);this.reply_link=$$("mstv_reply-link-"+id);this.avatar_img=$$("mstv_avatar-img-"+id);this.author_id=$$("mstv_author_id-"+id).innerHTML;this.owner_id=$$("mstv_owner_id-"+id).innerHTML}ThreadedComments=function(opts,resources,content,thread){this.localize={post:"Add Comment",discard:"Cancel",exceeded:"Number of characters over the limit: ",remaining:"Remaining character count: ",add:"Adding comment...",delete_confirm:"Are you sure you want to delete this comment?",report_confirm:"Are you sure you want to report this comment as spam?",message:"Type your comment here.",alert1:"Please enter a comment to post.",alert2:"Your comment must have at least 2 characters.",alert3:"The text you entered does not match the text from the image. Please try again.",captcha_enter:"Please enter the text from the image (numbers and letters only, no spaces and not case-sensitive).",captcha_input:"Image Text",login_alert:"You must be logged-in to do that! Do you wish to login?",comment_message:"Type your comment here."};this.options={startRow:6,totalRows:200,currentPage:0,pageSize:5,maxChars:300,commentDivId:"mstv_comments",resourceId:0,isLoggedIn:false,commentClass:"mstv_comment",lastCommentAuthorId:null,authorId:null,failedImage:"http://x.myspacecdn.com/modules/common/static/img/no_pic.gif",cDigest:null,actionAddCommentNoCaptcha:"",actionAddCommentWithCaptcha:"",actionAppendPage:"",actionMarkAsSpam:"",deleteComment:"",topForm:null,bottomForm:null};this.captcha={guid:null,url:null};this.eleContent=$$(content);this.eleThread=$$(thread);return this.init(opts,resources)};ThreadedComments.prototype={init:function(opts,resources){this.options=mySpaceTv.extend(this.options,arguments[0]||{});this.localize=mySpaceTv.extend(this.localize,arguments[1]||{});if(this.eleContent){this.eleContent.className="clearfix"}this.initContainerEvents();this.enableForm();this.initComments();mySpaceTv.observe("OEmbed:Init",this.onOEmbedManagerInit.bind(this));return this},onOEmbedManagerInit:function(instance){if(!instance){return}this.oembedMgr=instance;window.setTimeout(this.registerOEmbeds.bind(this),1000)},registerOEmbeds:function(){if(!this.oembedMgr){return}var oembed=this.oembedMgr;if(oembed){if(oembed.useOEmbed()){this.myOEmbeds=$CSS("a.oembed",this.eleThread);oembed.registerOEmbeds(this.myOEmbeds)}}},unregisterOEmbeds:function(){if(!this.oembedMgr){return}var oembed=this.oembedMgr;if(oembed&&oembed.useOEmbed()){oembed.unRegisterOEmbeds(this.myOEmbeds)}},initContainerEvents:function(){var post_comment=$$("add_comment_btn");if(post_comment){mySpaceTv.addEvent(post_comment,"click",this.toggleTopCommentForm.bindAsEventListener(this))}var refreshTop=$$(this.options.topForm.refreshId);if(refreshTop){mySpaceTv.addEvent(refreshTop,"click",this.refreshCaptcha.bindAsEventListener(this,this.options.topForm.captchaImgId))}var refreshBottom=$$(this.options.bottomForm.refreshId);if(refreshBottom){mySpaceTv.addEvent(refreshBottom,"click",this.refreshCaptcha.bindAsEventListener(this,this.options.bottomForm.captchaImgId))}this.eleTopDiscard=$$(this.options.topForm.cancelBtnId);this.eleTopPost=$$(this.options.topForm.submitBtnId);this.eleBottomDiscard=$$(this.options.bottomForm.cancelBtnId);this.eleBottomPost=$$(this.options.bottomForm.submitBtnId);this.addTextBoxEvents($$(this.options.bottomForm.textboxId));this.addTextBoxEvents($$(this.options.topForm.textboxId));this.eleTopMainComment=$CSS("#main_comment_top .main_comment")[0];this.eleTopCaptcha=$CSS("#main_comment_top .main_captcha")[0];this.eleBottomMainComment=$CSS("#main_comment_bottom .main_comment")[0];this.eleBottomCaptcha=$CSS("#main_comment_bottom .main_captcha")[0]},addTextBoxEvents:function(ele){if(ele){mySpaceTv.addEvent(ele,"focus",this.handleOnFocus.bindAsEventListener(this,ele,this.localize.comment_message));mySpaceTv.addEvent(ele,"blur",this.handleOnBlur.bindAsEventListener(this,ele,this.localize.comment_message));mySpaceTv.addEvent(ele,"keydown",this.onKeyDown.bindAsEventListener(this,this.options.maxChars));if(Browser.msie){mySpaceTv.addEvent(ele,"paste",this.onAfterPaste.bindAsEventListener(this,this.options.maxChars));mySpaceTv.addEvent(ele,"beforepaste",this.onBeforePaste.bindAsEventListener(this))}else{mySpaceTv.addEvent(ele,"input",this.checkForPaste.bindAsEventListener(this,this.options.maxChars))}}},initComments:function(){var p={};var comments=mySpaceTv.getElementsByClassName(this.eleThread,"li",this.options.commentClass);for(var i=0;i<comments.length;i++){var id=comments[i].id.split("-")[1];var post_meta=p[id];var post=new MsTvComment(id);this.addEvents(post)}var pageElements=$CSS("a",document.getElementById("mstv_pagination_top"));if(pageElements){for(var i=0,l=pageElements.length;i<l;i++){var pageNumber=parseInt(mySpaceTv.parseUri(pageElements[i].href).queryKey.page,10);mySpaceTv.addEvent(pageElements[i],"click",this.appendPage.bindAsEventListener(this,pageNumber,false))}}pageElements=$CSS("a",document.getElementById("mstv_pagination_bottom"));if(pageElements){for(var i=0,l=pageElements.length;i<l;i++){var pageNumber=parseInt(mySpaceTv.parseUri(pageElements[i].href).queryKey.page,10);mySpaceTv.addEvent(pageElements[i],"click",this.appendPage.bindAsEventListener(this,pageNumber,false))}}},addEvents:function(post){if(post.remove){mySpaceTv.addEvent(post.remove,"click",this.removePost.bindAsEventListener(this,post))}if(post.flag_link){mySpaceTv.addEvent(post.flag_link,"click",this.report.bindAsEventListener(this,post))}if(post.login_link){mySpaceTv.addEvent(post.login_link,"click",mySpaceTv.enforceLogin.bindAsEventListener(this,post.id))}},showLoading:function(){this.flap.innerHTML="<br/><br/><br/><br/><br/><br/><br/><center><img src='/modules/videos/static/img/mysubs/white_loading.gif'></center>";this.flap.focus()},getEventTarget:function(e){var targ;if(!e){e=window.event}if(e.target){targ=e.target}else{if(e.srcElement){targ=e.srcElement}}if(targ.nodeType==3){targ=targ.parentNode}return targ},onKeyDown:function(e,max){if(!e){e=window.event}var charCode=e.keyCode;if(ALLOWED_KEYS.indexOf(charCode)<0){var node=e.target;var elt=$$(this.getEventTarget(e));var value=Form.getValue(elt);if(value.length>max-1){mySpaceTv.stopPropagation(e)}else{return true}}},checkForPaste:function(e,max){if(!e){e=window.event}var node=e.target;var elt=$$(this.getEventTarget(e));var value=Form.getValue(elt);if((elt.previousValue&&elt.value.length>elt.previousValue.length+1)||(!elt.previousValue&&elt.value.length>1)){if(value.length>max-1){elt.value=elt.value.substr(0,max);mySpaceTv.stopPropagation(e)}}elt.previousValue=elt.value},onBeforePaste:function(e){mySpaceTv.stopPropagation(e)},onAfterPaste:function(e,max){if(!e){e=window.event}var node=e.target;var elt=$$(this.getEventTarget(e));var value=Form.getValue(elt);mySpaceTv.stopPropagation(e);var oTR=elt.document.selection.createRange();var iInsertLength=max-value.length+oTR.text.length;var sData=window.clipboardData.getData("Text").substr(0,iInsertLength);oTR.text=sData},updateCharCount:function(e,charCount_id,label_id,textArea){if(textArea.value.length>this.options.maxChars){if($$(label_id).innerHTML!=mt.localize.exceeded){$$(label_id).innerHTML=mt.localize.exceeded}$$(charCount_id).value=textArea.value.length-mt.options.maxChars}else{if($$(label_id).innerHTML!=mt.localize.remaining){$$(label_id).innerHTML=mt.localize.remaining}$$(charCount_id).value=mt.options.maxChars-textArea.value.length}},hideCommentForm:function(){var form=$$(this.options.bottomForm.textboxId);if(form){form.value=this.localize.message}Element.show(this.eleBottomMainComment);Element.hide(this.eleBottomCaptcha);if(typeof(this.bottomAddCommentOnClick)!=="undefined"){this.eleBottomPost.onclick=this.bottomAddCommentOnClick}},hideTopCommentForm:function(){var form=$$(this.options.topForm.textboxId);if(form){form.value=this.localize.message}Element.show(this.eleTopMainComment);Element.hide(this.eleTopCaptcha);if(typeof(this.topAddCommentOnClick)!=="undefined"){this.eleTopPost.onclick=this.topAddCommentOnClick}},toggleTopCommentForm:function(e){mySpaceTv.stopPropagation(e);var div_id=$$("main_comment_top");if(div_id.style.display=="block"||div_id.style.display===""&&div_id.className.indexOf("hid")===0){Element.hide(div_id)}else{if(div_id.style.display=="none"||div_id.className.indexOf("hid")!==0){if(!this.options.isLoggedIn){if(confirm(this.localize.login_alert)){mySpaceTv.enforceLogin()}return false}Element.show(div_id)}}},hideTopCommentPanel:function(){Element.hide("main_comment_top")},handleOnFocus:function(e,el,defaultValue){if(el.value==defaultValue){el.value=""}el.style.color="#333"},handleOnBlur:function(e,el,defaultValue){if(el.value===""){el.value=defaultValue;el.style.color="#888"}else{el.style.color="#333"}},postTopComment:function(){var retval=this.validateSubmit(false,this.options.topForm.textboxId);if(retval){if(this.options.cDigest!==null&&this.options.cDigest!==""){this.nonCaptchaSubmit(this.options.topForm)}else{this.refreshCaptcha(null,this.options.topForm.captchaImgId);Element.hide(this.eleTopMainComment);Element.show(this.eleTopCaptcha);$$(this.options.topForm.captchaTextId).value="";$$(this.options.topForm.captchaTextId).focus();this.topAddCommentOnClick=this.eleTopPost.onclick;this.eleTopPost.onclick=function(event){this.captchaSubmit(this.options.topForm,this.eleTopMainComment,this.eleTopCaptcha)}.bind(this)}}},postComment:function(){var retval=this.validateSubmit(false,this.options.bottomForm.textboxId);if(retval){if(this.options.cDigest!==null&&this.options.cDigest!==""){this.nonCaptchaSubmit(this.options.bottomForm)}else{this.refreshCaptcha(null,this.options.bottomForm.captchaImgId);Element.hide(this.eleBottomMainComment);Element.show(this.eleBottomCaptcha);$$(this.options.bottomForm.captchaTextId).value="";$$(this.options.bottomForm.captchaTextId).focus();this.bottomAddCommentOnClick=this.eleBottomPost.onclick;this.eleBottomPost.onclick=function(event){this.captchaSubmit(this.options.bottomForm,this.eleBottomMainComment,this.eleBottomCaptcha)}.bind(this)}}},nonCaptchaSubmit:function(opts){var form=$$(opts.textboxId);var default_message=this.localize.message;if(typeof(form.value)!="undefined"){var message=form.value}else{var message=false}var d=new Date();var vars="spinner="+encodeURIComponent(opts.spinner)+"&random="+opts.random+"&lcaid="+this.options.lastCommentAuthorId+"&d="+encodeURIComponent(this.options.cDigest);var formFields=Form.getFormFields(opts.formId);for(var i=0,l=formFields.length;i<l;i++){var id=formFields[i].getAttribute("id");var value=Form.getValue(formFields[i]);vars+=("&"+encodeURIComponent(id)+"="+encodeURIComponent(value))}var ajaxUrl="/index.cfm?fuseaction=vids.ajaxAction&action="+this.options.actionAddCommentNoCaptcha+"&id="+this.options.resourceId+"&"+d.getTime();this.disableForm();mySpaceTv.postAjaxRequest(ajaxUrl,vars,function(xmlHttpReq){var obj=eval("("+xmlHttpReq+")");if(obj.ServerResponse.IsRequestSuccessful){this.hideTopCommentPanel();this.enableForm();this.options.totalRows++;mySpaceTv.notify("CommentAdded",this,this.options.totalRows);this.appendPage(null,0,true);form.value=default_message}else{alert(obj.ServerResponse.DisplayText);this.enableForm()}}.bind(this))},captchaSubmit:function(opts,eleComment,eleCaptcha){var default_message=this.localize.message;var form=$$(opts.textboxId);if(typeof(form.value)!="undefined"){var message=form.value}else{var message=false}var captchaValueEle=$$(opts.captchaTextId);if(captchaValueEle){var userCaptchaValue=captchaValueEle.value}if(userCaptchaValue===""||userCaptchaValue.length===0){alert(this.localize.alert3);$$(opts.captchaTextId).focus();return false}var d=new Date();var vars="spinner="+encodeURIComponent(opts.spinner)+"&random="+opts.random+"&lcaid="+this.options.lastCommentAuthorId+"&ctext="+encodeURIComponent(userCaptchaValue)+"&cguid="+encodeURIComponent(this.captcha.guid)+"&d="+encodeURIComponent(this.options.cDigest);var formFields=Form.getFormFields(opts.formId);for(var i=0,l=formFields.length;i<l;i++){var id=formFields[i].getAttribute("id");var value=Form.getValue(formFields[i]);vars+=("&"+encodeURIComponent(id)+"="+encodeURIComponent(value))}var ajaxUrl="/index.cfm?fuseaction=vids.ajaxAction&action="+this.options.actionAddCommentWithCaptcha+"&id="+this.options.resourceId+"&"+d.getTime();this.disableForm();mySpaceTv.postAjaxRequest(ajaxUrl,vars,function(xmlHttpReq){var obj=eval("("+xmlHttpReq+")");if(obj.ServerResponse.IsRequestSuccessful){Element.show(eleComment);Element.hide(eleCaptcha);this.enableForm();this.options.totalRows++;mySpaceTv.notify("CommentAdded",this,this.options.totalRows);this.appendPage(null,0,true);form.value=default_message}else{Element.show(eleComment);Element.hide(eleCaptcha);alert(obj.ServerResponse.DisplayText);this.enableForm()}if(opts.textboxId==this.options.topForm.textboxId){if(typeof(this.eleTopPost.onclick)!="undefined"){this.eleTopPost.onclick=function(event){this.postTopComment()}.bind(this)}}if(opts.textboxId==this.options.bottomForm.textboxId){if(typeof(this.eleBottomPost.onclick)!="undefined"){this.eleBottomPost.onclick=function(event){this.postComment()}.bind(this)}}}.bind(this))},validateSubmit:function(is_video,txt_id){is_video=is_video||false;var form=$$(txt_id);if(typeof(form.value)!="undefined"){var message=form.value}else{var message=false}if(!is_video){if(message.length>mt.options.maxChars){var alertMsg=this.localize.exceeded+(message.length-mt.options.maxChars);alert(alertMsg);return false}if(message==this.localize.message){alert(this.localize.alert1);return false}else{if(!message||message.length<2){alert(this.localize.alert2);return false}}}return true},report:function(e,post){mySpaceTv.stopPropagation(e);if(!this.options.isLoggedIn){return this.loginAlert()}else{if(confirm(this.localize.report_confirm)){var d=new Date();var ajaxUrl="/index.cfm?fuseaction=vids.ajaxAction&action="+this.options.actionMarkAsSpam+"&id="+this.options.resourceId+"&commentid="+post.id+"&ownerId="+post.owner_id+"&authorId="+post.author_id+"&"+d.getTime();mySpaceTv.getAjaxRequest(ajaxUrl,function(xmlHttpReq){var obj=eval("("+xmlHttpReq+")");if(obj.ServerResponse.IsRequestSuccessful){$$("mstv_post-report-"+post.id).innerHTML=obj.ServerResponse.DisplayText}else{$$("mstv_post-report-"+post.id).innerHTML=obj.ServerResponse.DisplayText}}.bind(this))}}},removePost:function(e,post){mySpaceTv.stopPropagation(e);if(!this.options.isLoggedIn){return this.loginAlert()}else{if(confirm(this.localize.delete_confirm)){var d=new Date();var ajaxUrl="/index.cfm?fuseaction=vids.ajaxAction&action="+this.options.deleteComment+"&id="+this.options.resourceId+"&commentid="+post.id+"&ownerId="+post.owner_id+"&authorId="+post.author_id+"&"+d.getTime();mySpaceTv.getAjaxRequest(ajaxUrl,function(xmlHttpReq){var obj=eval("("+xmlHttpReq+")");if(obj.ServerResponse.IsRequestSuccessful){this.options.totalRows--;mySpaceTv.notify("CommentRemoved",this,this.options.totalRows);$$("mstv_remove-wrap-"+post.id).innerHTML=obj.ServerResponse.DisplayText;if(this.options.currentPage>0){if(this.options.totalRows%this.options.pageSize==0){this.options.currentPage--}}this.appendPage(null,this.options.currentPage,true)}else{$$("mstv_remove-wrap-"+post.id).innerHTML=obj.ServerResponse.DisplayText}}.bind(this))}}},loginAlert:function(){if(confirm(this.localize.login_alert)){return mySpaceTv.enforceLogin()}else{return false}},appendPage:function(e,page,forceDb){mySpaceTv.stopPropagation(e);var comments=mySpaceTv.getElementsByClassName($$(mstv_container_id),"li","mstv_comment");var firstCommentId="";var lastCommentId="";forceDb=forceDb||false;if(comments&&comments.length>0){firstCommentId=comments[0].id.split("-")[1];lastCommentId=comments[comments.length-1].id.split("-")[1]}var div_id=$$(this.options.commentDivId);mySpaceTv.showLoading(div_id);var d=new Date();var forceIt=forceDb?1:0;var ajaxUrl="/index.cfm?fuseaction=vids.ajaxAction&action="+this.options.actionAppendPage+"&id="+this.options.resourceId+"&vaid="+this.options.authorId+"&rpn="+(this.options.currentPage+1)+"&cpn="+(page+1)+"&lcid="+lastCommentId+"&fcid="+firstCommentId+"&ps="+this.options.pageSize+"&db="+forceIt+"&"+d.getTime();this.unregisterOEmbeds();mySpaceTv.getAjaxRequest(ajaxUrl,function(xmlHttpObj){this.options.currentPage=page;$$(this.options.commentDivId).innerHTML=xmlHttpObj;this.initComments();this.registerOEmbeds()}.bind(this))},refreshCaptcha:function(e,opt_img){mySpaceTv.stopPropagation(e);var d=new Date();var ajaxUrl="/index.cfm?fuseaction=vids.ajaxAction&action=CHECKWHETHERTODISPLAYCAPTCHA&"+d.getTime();mySpaceTv.getAjaxRequest(ajaxUrl,function(xmlHttpReq){var obj=eval("("+xmlHttpReq+")");if(obj.ServerResponse.IsRequestSuccessful){this.captcha.url=obj.ServerResponse.CaptchaUrl;this.captcha.guid=obj.ServerResponse.CaptchaGuid;var l=this.captcha.url.indexOf("localhost");if(l>0){this.captcha.url="http://security.myspace.com"+this.captcha.url.substring(16)}if(opt_img!=+null){$$(opt_img).src=this.captcha.url}}}.bind(this))},disableForm:function(){if(this.options.isLoggedIn){Form.disable(this.eleTopDiscard);Form.disable(this.eleTopPost);Form.disable(this.eleBottomDiscard);Form.disable(this.eleBottomPost);$$(this.options.topForm.textboxId).disabled="true";$$(this.options.bottomForm.textboxId).disabled="true";this.eleTopDiscard.onclick=null;this.eleTopPost.onclick=null;this.eleBottomDiscard.onclick=null;this.eleBottomPost.onclick=null}},enableForm:function(){if(this.options.isLoggedIn){Form.enable(this.eleTopDiscard);Form.enable(this.eleTopPost);Form.enable(this.eleBottomDiscard);Form.enable(this.eleBottomPost);$$(this.options.topForm.textboxId).disabled="";$$(this.options.bottomForm.textboxId).disabled="";this.eleTopDiscard.onclick=function(event){this.hideTopCommentForm()}.bind(this);this.eleTopPost.onclick=function(event){this.postTopComment()}.bind(this);this.eleBottomDiscard.onclick=function(event){this.hideCommentForm()}.bind(this);this.eleBottomPost.onclick=function(event){this.postComment()}.bind(this)}}}})();(function(){CommentsTitleBar=function(A,B){this.localize={be_the_first:""};this.options={titleHeaderId:".tv_titlebar h3 span"};this.eleHeader=$CSS(this.options.titleHeaderId)[0];return this.init(A,B)};CommentsTitleBar.prototype={init:function(A,B){mySpaceTv.extend(this.options,A||{});mySpaceTv.extend(this.localize,B||{});mySpaceTv.observe("CommentRemoved",this.onCommentRemoved.bind(this));mySpaceTv.observe("CommentAdded",this.onCommentAdded.bind(this));return this},onCommentRemoved:function(A,B){if(this.eleHeader){this.eleHeader.innerHTML="("+B+")"}if(B===0){var C=$$("mstv_alerts");if(C){C.innerHTML=this.localize.be_the_first;Element.show(C)}}},onCommentAdded:function(A,B){if(this.eleHeader){this.eleHeader.innerHTML="("+B+")"}if(B===1){var C=$$("mstv_alerts");if(C){Element.hide(C)}}}}})();
/*
 *	MySpace Video "OEmbed Manager" JavaScript Library
 * 
 *   ____  ______           _              _ 
 *  / __ \|  ____|         | |            | |
 * | |  | | |__   _ __ ___ | |__   ___  __| |
 * | |  | |  __| | '_ ` _ \| '_ \ / _ \/ _` |
 * | |__| | |____| | | | | | |_) |  __/ (_| |
 *  \____/|______|_| |_| |_|_.__/ \___|\__,_|
 *                                           
 *                                           
 *  __  __                                   
 * |  \/  |                                  
 * | \  / | __ _ _ __   __ _  __ _  ___ _ __ 
 * | |\/| |/ _` | '_ \ / _` |/ _` |/ _ \ '__|
 * | |  | | (_| | | | | (_| | (_| |  __/ |   
 * |_|  |_|\__,_|_| |_|\__,_|\__, |\___|_|   
 *                            __/ |          
 *                           |___/    
 * 
 *	
 *	Notes   
 *  1. If we were to write our own proxy service, 
 *     then the jsonp oohembed call can all go away, 
 *		 including the jXHR code.
 *  2. For phase 2 we could add support for click
 *		 then playing of a video instead of just embedding it.
 * 	3. We could also add additional support for other 
 *		 oembed providers but we'd also have to add them 
 *		 to the whitelist in Markdown.cs
 * 
 */
var OEmbed=(function(){var A={};var B={useOEmbed:false,maxWidth:null,maxHeight:null,embedMethod:"append"};var C=function(F,G,I,H){this.name=F;this.urlPattern=G;this.oEmbedUrl=(I!=null)?I:"http://oohembed.com/oohembed/";this.callbackparameter=(H!=null)?H:"callback";this.maxWidth=500;this.maxHeight=400;this.matches=function(J){return J.indexOf(this.urlPattern)>=0};this.getRequestUrl=function(M){var K=this.oEmbedUrl;if(K.indexOf("?")<=0){K=K+"?"}var J="";for(var L in this.params){if(L==this.callbackparameter){continue}if(this.params[L]!=null){J+="&"+escape(L)+"="+this.params[L]}}K+="format=json";if(this.maxWidth!=null){K+="&maxwidth="+this.maxWidth}if(this.maxHeight!=null){K+="&maxheight="+this.maxHeight}K+="&url="+escape(M)+J+"&"+this.callbackparameter+"=?";return K};this.embedCode=function(J,M,N){var L=this.getRequestUrl(M);var K=new jXHR();K.onreadystatechange=function(O){if(K.readyState===4){var Q,P=O.type;switch(P){case"photo":O.code=OEmbed.getPhotoCode(M,O);break;case"video":O.code=OEmbed.getVideoCode(M,O);break;case"rich":O.code=OEmbed.getRichCode(M,O);break;default:O.code=OEmbed.getGenericCode(M,O);break}N(J,O)}}.bind(this);K.open("GET",L+"&_="+Math.random());K.send()}};var D=[new C("youtube","youtube.com"),new C("myspace","myspace.com","http://vids.myspace.com/index.cfm?fuseaction=oembed&","callback")];var E=function(F){for(var G=0;G<D.length;G++){if(D[G].matches(F)){return D[G]}}return null};return{init:function(){B=mySpaceTv.extend(B,arguments[0]||{});A=mySpaceTv.extend(A,arguments[1]||{});mySpaceTv.onReady(function(){mySpaceTv.notify("OEmbed:Init",OEmbed)});return this},useOEmbed:function(){return B.useOEmbed},isAvailable:function(F){var G=E(F);return(G!=null)},getGenericCode:function(F,H){var I=(H.title!=null)?H.title:F,G='<a href="'+F+'">'+I+"</a>";if(H.html){G+="<div>"+H.html+"</div>"}return G},getRichCode:function(F,H){var G=H.html;return G},getVideoCode:function(F,H){var G=H.html;return G},getPhotoCode:function(F,H){var I=H.title?H.title:"";I+=H.author_name?" - "+H.author_name:"";I+=H.provider_name?" - "+H.provider_name:"";var G='<div><a href="'+F+'" target="_blank"><img src="'+H.url+'" alt="'+I+'"/></a></div>';if(H.html){G+="<div>"+H.html+"</div>"}return G},insertCode:function(G,I,F){switch(I){case"auto":var H=Element.readAttribute(G,"href");if(H!=null){insertCode(G,"append",F)}else{insertCode(G,"replace",F)}break;case"replace":Element.replace(G,F.code);break;case"fill":G.innerHTML=F.code;break;case"append":var J=G.nextSibling;if(J==null||!Element.hasClassName(J,"oembed-container")){J=document.createElement("div");J.className="oembed-container";G.parentNode.insertBefore(J,G.nextSibling);if(F!=null&&F.provider_name!=null){Element.toggleClassName(J,"oembed-container-"+F.provider_name)}}J.innerHTML=F.code;break}},registerOEmbeds:function(F,G,N){if(!F){return}if(F.length==0){return}for(var K=0,J=F.length;K<J;K++){var I=$$(F[K]);var H=Element.readAttribute(I,"href");var L=(G!=null)?G:H;var M;if(!N){N=function(P,O){this.insertCode(P,B.embedMethod,O)}.bind(this)}if(L!=null){M=E(L);if(M!=null){M.maxWidth=B.maxWidth;M.maxHeight=B.maxHeight;M.params=B[M.name]||{};M.embedCode(I,L,N);continue}}}},unRegisterOEmbeds:function(H){if(!H){return}for(var G=0,F=H.length;G<F;G++){}}}}());(function(C){var B=C.setTimeout,D=C.document,A=0;C.jXHR=function(){var E,G,N,H,M=null;function L(){try{H.parentNode.removeChild(H)}catch(O){}}function K(){G=false;E="";L();H=null;I(0)}function F(P){try{M.onerror.call(M,P,E)}catch(O){throw new Error(P)}}function J(){if((this.readyState&&this.readyState!=="complete"&&this.readyState!=="loaded")||G){return}this.onload=this.onreadystatechange=null;G=true;if(M.readyState!==4){F("Script failed to load ["+E+"].")}L()}function I(O,P){P=P||[];M.readyState=O;if(typeof M.onreadystatechange==="function"){M.onreadystatechange.apply(M,P)}}M={onerror:null,onreadystatechange:null,readyState:0,open:function(P,O){K();internal_callback="cb"+(A++);(function(Q){C.jXHR[Q]=function(){try{I.call(M,4,arguments)}catch(R){M.readyState=-1;F("Script failed to run ["+E+"].")}C.jXHR[Q]=null}})(internal_callback);E=O.replace(/=\?/,"=jXHR."+internal_callback);I(1)},send:function(){B(function(){H=D.createElement("script");H.setAttribute("type","text/javascript");H.onload=H.onreadystatechange=function(){J.call(H)};H.setAttribute("src",E);D.getElementsByTagName("head")[0].appendChild(H)},0);I(2)},setRequestHeader:function(){},getResponseHeader:function(){return""},getAllResponseHeaders:function(){return[]}};K();return M}})(window);(function(){FlapView=function(A,B){this.options={flapViewClass:"flap_view",flapTabHeadersClass:"flap_header",flapPagesClass:"flap_pages",flapPageClass:"flap_page",flapPageActive:"flap_page_active",flapPageIds:[],flapHeaderIds:[],activeFlap:-1,useCookie:false,cookieName:"",cookiePersistance:false,flapHeaderActive:"tv-imageless-button-active"};this.currentFlapIndex;this.el;return this.init(A,B)};FlapView.prototype={init:function(B,C){this.el=$$(arguments[0]);this.options=mySpaceTv.extend(mySpaceTv.extend({},this.options),arguments[1]||{});Object.Event.extend(this);if(this.options.activeFlap>=0){this.currentFlapIndex=this.options.activeFlap;this.showSelectedFlap(this.options.activeFlap)}var D=this.options.flapHeaderIds;for(var A=0;A<D.length;A++){mySpaceTv.addEvent($$(D[A]),"click",this.onFlapClick.bindAsEventListener(this,A))}return this},clearFlaps:function(){var B=this.options.flapHeaderIds;for(var A=0;A<B.length;A++){Element.removeClassName(B[A],this.options.flapHeaderActive)}},clearFlapPages:function(){var B=this.options.flapPageIds;for(var A=0;A<B.length;A++){Element.removeClassName(B[A],this.options.flapPageActive)}},showFirstFlap:function(){this.showSelectedFlap(0)},onFlapClick:function(B,A){this.showSelectedFlap(A)},showSelectedFlap:function(A,C){var D=$$(this.options.flapHeaderIds[A]);var B=$$(this.options.flapPageIds[A]);C=C||false;if(D){this.notifyBeforeFlapChanged(this.options.flapPageIds[this.currentFlapIndex],this.options.flapPageIds[A],C);this.clearFlaps();this.clearFlapPages();Element.addClassName(B,this.options.flapPageActive);Element.addClassName(D,this.options.flapHeaderActive);this.notifyAfterFlapChanged(this.options.flapPageIds[this.currentFlapIndex],this.options.flapPageIds[A],C);this.currentFlapIndex=A}},refreshSelectedFlap:function(){this.showSelectedFlap(this.currentFlapIndex,true)},selectFlapFromCookie:function(){},notifyBeforeFlapChanged:function(B,A,C){if(this.notify("beforeChange",B,A,C)===false){return false}},notifyAfterFlapChanged:function(B,A,C){if(this.notify("afterChange",B,A,C)===false){return false}}}})();(function(){var A=13;SearchControl=function(C,B){this.localize={defaultSearchText:"",searchError:""};this.options={linkId:"searchSubmit",textId:"searchText",onInputError:null,orig:null};this.eleLink;this.eleText;return this.init(C,B)};SearchControl.prototype={init:function(C,B){this.options=mySpaceTv.extend(this.options,arguments[0]||{});this.localize=mySpaceTv.extend(this.localize,arguments[1]||{});this.eleLink=$$(this.options.linkId);this.eleText=$$(this.options.textId);if(this.eleText){mySpaceTv.addEvent(this.eleText,"keypress",this.textOnKeyPress.bindAsEventListener(this));if(this.localize.defaultSearchText!==""){mySpaceTv.addEvent(this.eleText,"focus",this.onFocus.bind(this));mySpaceTv.addEvent(this.eleText,"blur",this.onBlur.bind(this))}}if(this.eleLink){mySpaceTv.addEvent(this.eleLink,"click",this.subminOnClick.bindAsEventListener(this))}return this},trim:function(B){return B.replace(/^([ \t\r\n\f])*/gi,"")},onFocus:function(){var B=this.trim(this.eleText.value);if(B===this.localize.defaultSearchText){this.eleText.value=""}},onBlur:function(){var B=this.trim(this.eleText.value);if(B.length<1){this.eleText.value=this.localize.defaultSearchText}},textOnKeyPress:function(C){if(!C){C=window.event}var B=C.keyCode;if(B==A){mySpaceTv.stopPropagation(C);this.doSearch(C)}},subminOnClick:function(B){this.doSearch(B)},doSearch:function(C){var D=this.trim(this.eleText.value);if(this.localize.defaultSearchText!==""&&D===this.localize.defaultSearchText){if(this.options.onInputError){this.options.onInputError(this.localize.searchError)}mySpaceTv.stopPropagation(C)}else{if(D===""){if(this.options.onInputError){this.options.onInputError(this.localize.searchError)}mySpaceTv.stopPropagation(C)}else{var B="http://searchservice.myspace.com/index.cfm?fuseaction=sitesearch.results&type=MySpaceTV&submit=+Search+&orig="+this.options.orig+"&qry="+D;window.location.href=B}}}}})();(function(){var A=[];var B=function(){for(var D=0;D<A.length;D=D+2){var E=A[D];var C=A[D+1];E.title=C.content;mySpaceTv.removeEvent(E,"mousemove",C.updateEvent);mySpaceTv.removeEvent(E,"mouseover",C.showEvent);mySpaceTv.removeEvent(E,"mouseout",C.hideEvent)}};_clearTimeout=function(C){clearTimeout(C);clearInterval(C);return null};ImagelessTooltip=function(D,C){this.options={maxWidth:230,delay:50,mouseFollow:true,useClose:false,theme:"canary",width:null,target:null,hook:null,stem:null,useEvents:true};this.eleTarget;this.xCord=0;this.yCord=0;this.eleTooltip;this.initialized=false;this.useHookPositioning=false;this.useStem=false;this.is_first=true;return this.init(D,C)};ImagelessTooltip.prototype={init:function(){this.options=mySpaceTv.extend(mySpaceTv.extend({},this.options),arguments[1]||{});this.eleTooltip=$$(arguments[0]);this.eleTarget=$$(this.options.target);if(!this.eleTarget){return}if(this.options.width&&this.options.width!=null){this.eleTooltip.style.width=this.options.width}if(this.options.hook&&this.options.hook!=null){this.useHookPositioning=true;if(this.options.hook.location){this.target=$$(this.options.hook.location)}else{this.target=this.eleTarget}}if(this.options.stem&&this.options.stem!=null){this.useStem=true;this.getStemVars()}if(this.options.useEvents){this.updateEvent=this.update.bindAsEventListener(this);this.showEvent=this.show.bindAsEventListener(this);this.hideEvent=this.hide.bindAsEventListener(this);mySpaceTv.addEvent(this.eleTarget,"mouseover",this.showEvent);if(this.options.useClose){var C=$$(arguments[0]+"-close");mySpaceTv.addEvent(C,"click",this.hideEvent);mySpaceTv.addEvent(this.target,"click",this.hideEvent)}else{mySpaceTv.addEvent(this.eleTarget,"mouseout",this.hideEvent)}}this.content=this.eleTarget.title;this.eleTarget.title="";A.push(this.eleTarget,this);return this},setText:function(C){if(Browser.msie){if(this.is_first){this.original_html=this.eleTooltip.innerHTML;this.is_first=false}this.eleTooltip.innerHTML=C+this.original_html}else{this.eleTooltip.firstChild.textContent=C}},updateXY:function(C){if(!this.useHookPositioning){if(document.captureEvents){this.xCord=C.pageX;this.yCord=C.pageY}else{if(window.event.clientX){this.xCord=window.event.clientX+document.documentElement.scrollLeft;this.yCord=window.event.clientY+document.documentElement.scrollTop}}}else{this.xCord=Element.cumulativeOffset(this.target).left;this.yCord=Element.cumulativeOffset(this.target).top}},show:function(C){this.updateXY(C);if(!this.initialized){this.timeout=window.setTimeout(this.appear.bind(this),this.options.delay)}},hide:function(C){mySpaceTv.stopPropagation(C);if(this.initialized){if(this.options.mouseFollow&&!this.useHookPositioning){mySpaceTv.removeEvent(this.eleTarget,"mousemove",this.updateEvent)}Element.hide(this.eleTooltip)}_clearTimeout(this.timeout);this.initialized=false},update:function(C){this.updateXY(C);this.setup()},appear:function(){var E=this.stemPosition;var D=this.options.theme;if(!this.eleTooltip){this.eleTooltip=document.createElement("div");this.eleTooltip.className="tv-tooltip tv-tooltip-"+E.y+" corner-all "+D;if(this.useStem){if(this.stemPosition.x=="left"){this.eleTooltip.style.textAlign="left"}else{if(this.stemPosition.x=="right"){this.eleTooltip.style.textAlign="right"}}}var C="	"+this.content+'  <div class="tv-tooltip-pointer-'+E.x+" "+D+'">	  <div class="tv-tooltip-pointer-'+E.x+'-inner">	    <div class=""></div>	  </div>	</div>';this.eleTooltip.innerHTML=C;document.body.insertBefore(this.eleTooltip,document.body.childNodes[0])}else{Element.show(this.eleTooltip)}this.tooltipWidth=Element.getDimensions(this.eleTooltip).width;if(Browser.msie){this.eleTooltip.style.width=this.tooltipWidth+"px"}this.setup();if(this.options.mouseFollow&&!this.useHookPositioning){mySpaceTv.addEvent(this.eleTarget,"mousemove",this.updateEvent)}this.initialized=true},getStemVars:function(){this.stemTarget=this.options.stem.target;this.stemPosition;if(this.stemTarget.startsWith("left")){this.stemPosition={x:"left",y:this.stemTarget.substring(4).toLowerCase()}}else{if(this.stemTarget.startsWith("top")){this.stemPosition={x:"top",y:this.stemTarget.substring(3).toLowerCase()}}else{if(this.stemTarget.startsWith("right")){this.stemPosition={x:"right",y:this.stemTarget.substring(5).toLowerCase()}}else{if(this.stemTarget.startsWith("bottom")){this.stemPosition={x:"bottom",y:this.stemTarget.substring(6).toLowerCase()}}}}}},setup:function(){if(this.tooltipWidth>this.options.maxWidth){this.eleTooltip.style.width=this.options.maxWidth+"px"}if(!this.useHookPositioning){if(this.xCord+this.tooltipWidth>=Element.getDimensions(document.body).width){this.options.align="right";this.xCord=this.xCord-this.tooltipWidth+20}}else{var F=this.getHookElementPos(this.target,this.options.hook.target);var E=this.getHookElementPos(this.eleTooltip,this.options.hook.tip);var C=this.xCord;var G=this.yCord;C+=F.x;G+=F.y;C-=E.x;G-=E.y;if(this.options.hook.offset){C+=this.options.hook.offset.x;G+=this.options.hook.offset.y}if(this.useStem){var D=this.getStemOffset();C-=D.x;G-=D.y}this.xCord=C;this.yCord=G}this.eleTooltip.style.left=this.xCord+"px";this.eleTooltip.style.top=this.yCord+"px"},getHookElementPos:function(C,E){var D=Element.getDimensions(C);if(E.startsWith("top")){if(E.endsWith("Left")){return{x:0,y:0}}else{if(E.endsWith("Middle")){return{x:Math.round(D.width/2),y:0}}else{if(E.endsWith("Right")){return{x:D.width,y:0}}}}}else{if(E.startsWith("right")){if(E.endsWith("Top")){return{x:D.width,y:0}}else{if(E.endsWith("Middle")){return{x:D.width,y:Math.round(D.height/2)}}else{if(E.endsWith("Bottom")){return{x:D.width,y:D.height}}}}}else{if(E.startsWith("bottom")){if(E.endsWith("Right")){return{x:D.width,y:D.height}}else{if(E.endsWith("Middle")){return{x:Math.round(D.width/2),y:D.height}}else{if(E.endsWith("Left")){return{x:0,y:D.height}}}}}else{if(E.startsWith("left")){if(E.endsWith("Bottom")){return{x:0,y:D.height}}else{if(E.endsWith("Middle")){return{x:0,y:Math.round(D.height/2)}}else{if(E.endsWith("Top")){return{x:0,y:0}}}}}}}}},getStemOffset:function(){var C;if(this.stemPosition.x=="left"){C={x:-14,y:0}}else{if(this.stemPosition.x=="right"){C={x:14,y:0}}else{if(this.stemPosition.x=="top"){C={x:0,y:-14}}else{if(this.stemPosition.x=="bottom"){C={x:0,y:14}}}}}return C}};ImagelessTooltip.removeTips=function(){B()}})();if(!window._ate){var _atd="www.addthis.com/",_atr="//s7.addthis.com/",_euc=encodeURIComponent,_duc=decodeURIComponent,_atu="undefined",_atc={dr:0,ver:250,loc:0,enote:"",cwait:500,tamp:1,samp:0.01,camp:1,vamp:1,addr:-1,addt:1,xfl:!!window.addthis_disable_flash,abf:!!window.addthis_do_ab};(function(){try{var O=window.location;if(O.protocol.indexOf("file")===0){_atr="http:"+_atr}if(O.hostname.indexOf("localhost")!=-1){_atc.loc=1}}catch(T){}var S=navigator.userAgent.toLowerCase(),U=document,H=window,G=H.addEventListener,C=H.attachEvent,Q=U.location,W={win:/windows/.test(S),chr:/chrome/.test(S),iph:/iphone/.test(S),saf:(/webkit/.test(S))&&!(/chrome/.test(S)),web:/webkit/.test(S),opr:/opera/.test(S),msi:(/msie/.test(S))&&!(/opera/.test(S)),ffx:/firefox/.test(S),ie6:/msie 6.0/.test(S),ie7:/msie 7.0/.test(S),mod:-1},B={isBound:false,isReady:false,readyList:window.addthis_onload||[],onReady:function(){if(!B.isReady){B.isReady=true;var Y=B.readyList;for(var Z=0;Z<Y.length;Z++){Y[Z].call(window)}B.readyList=[]}},addLoad:function(Z){var Y=H.onload;if(typeof H.onload!="function"){H.onload=Z}else{H.onload=function(){if(Y){Y()}Z()}}},bindReady:function(){if(J.isBound){return}J.isBound=true;if(U.addEventListener&&!W.opr){U.addEventListener("DOMContentLoaded",J.onReady,false)}var Y=window.addthis_product;if(Y&&Y.indexOf("f")>-1){J.onReady();return}if(W.msi&&window==top){(function(){if(J.isReady){return}try{U.documentElement.doScroll("left")}catch(b){setTimeout(arguments.callee,0);return}J.onReady()})()}if(W.opr){U.addEventListener("DOMContentLoaded",function(){if(J.isReady){return}for(var b=0;b<U.styleSheets.length;b++){if(U.styleSheets[b].disabled){setTimeout(arguments.callee,0);return}}J.onReady()},false)}if(W.saf){var Z;(function(){if(J.isReady){return}if(U.readyState!="loaded"&&U.readyState!="complete"){setTimeout(arguments.callee,0);return}if(Z===undefined){var f=U.gn("link");for(var b=0;b<f.length;b++){if(f[b].getAttribute("rel")=="stylesheet"){Z++}}var d=U.gn("style");Z+=d.length}if(U.styleSheets.length!=Z){setTimeout(arguments.callee,0);return}J.onReady()})()}J.addLoad(J.onReady)},append:function(Z,Y){J.bindReady();if(J.isReady){Z.call(window,[])}else{J.readyList.push(function(){return Z.call(window,[])})}}},J=B,A={vst:[],rev:"$Rev: 68150 $",bro:W,clck:1,show:1,dl:Q,camp:_atc.camp-Math.random(),samp:_atc.samp-Math.random(),vamp:_atc.vamp-Math.random(),tamp:_atc.tamp-Math.random(),ab:"-",scnt:1,seq:1,inst:1,wait:500,tmo:null,cvt:[],svt:[],sttm:new Date().getTime(),max:268435455,pix:"tev",sid:0,sub:!!window.at_sub,uid:null,oot:null,swf:"//bin.clearspring.com/at/v/1/button1.6.swf",evu:"//e1.clearspring.com/at/",ifpp:null,ifm:function(Y){if(addthis_wpl){var Z=(addthis_wpl.split("#"))[0];window.parent.location.href=Z+"#at"+Y}return false},hash:window.location.hash,ifp:function(){var Z=A,Y=window.location.hash,b=0;if(Y&&Y.indexOf("#atssh-")>-1){Y=Y.substr(7);if(!Z.hash.length||Z.hash==""){Z.hash="#"}window.location.hash=Z.hash;clearInterval(Z.ifpp);Z.ssh(Y)}},pmh:function(Y){if(Y.origin.substr(Y.origin.length-12)==".addthis.com"){A.ssh(Y.data.substr(4))}},ssh:function(Y){window.addthis_ssh=_duc(Y);U.body.removeChild(U.getElementById("_atssh"))},mun:function(b){var Y=291;if(b){for(var Z=0;Z<b.length;Z++){Y=(Y*(b.charCodeAt(Z)+Z)+3)&1048575}}return(Y&16777215).toString(32)},off:function(){return Math.floor((new Date().getTime()-A.sttm)/100).toString(16)},ran:function(){return Math.floor(Math.random()*4294967295).toString(36)},srd:function(){if(A.dr){return"&pre="+_euc(A.dr)}else{return""}},cst:function(Y){return"CXNID=2000001.521545608054043907"+(Y||2)+"NXC"},hrr:function(Z){if(Z&&Z.urls&&Z.urls instanceof Array){for(var Y=0;Y<Z.urls.length;Y++){new Image().src=Z.urls[Y]}}},img:function(Z,d){if(!window.at_sub){var Y=A,b=Y.dr;if(b){b=(b.split("?")).shift();b=(b.split("http://")).pop();if(b.length>25){b=b.substr(0,25)}}new Image().src=_atr+"live/t00/"+Z+".gif?"+(Y.uid!==null?"uid="+Y.uid+"&":"")+Y.ran()+"&"+Y.cst(d)+(Y.pub()?"&pub="+Y.pub():"")+(b?"&dr="+_euc(b):"")}},cuid:function(){return(A.sttm&A.max).toString(16)+(Math.floor(Math.random()*A.max)).toString(16)},ssid:function(){if(A.sid===0){A.sid=A.cuid()}return A.sid},sev:function(Z,Y){A.pix="sev-"+(typeof(Z)!=="number"?_euc(Z):Z);A.svt.push(Z+";"+A.off());if(Y===1){A.xmi(true)}else{A.sxm(true)}},cev:function(Z,Y){A.pix="cev-"+_euc(Z);A.cvt.push(_euc(Z)+"="+_euc(Y)+";"+A.off());A.sxm(true)},sxm:function(Y){if(A.tmo!==null){clearTimeout(A.tmo)}if(Y){A.tmo=A.sto("_ate.xmi(false)",A.wait)}},sto:function(Z,Y){return setTimeout(Z,Y)},sta:function(){var Y=A;return"AT-"+(Y.pub()?Y.pub():"unknown")+"/-/"+Y.ab+"/"+Y.ssid()+"/"+(Y.seq++)+(Y.uid!==null?"/"+Y.uid:"")},xmi:function(Z){var Y=A,g=Y.dl?Y.dl.hostname:"";if(!Y.uid){Y.dck("X"+Y.cuid())}else{Y.coo()}if(Y.cvt.length+Y.svt.length>0){Y.sxm(false);if(Y.seq===1){Y.cev("pin",Y.inst)}if(_atc.xtr){return}if(g.indexOf(".gov")>-1||g.indexOf(".mil")>-1){_atc.xck=1}var l=Y.pix+"-"+Y.ran()+".png?ev="+A.sta()+"&se="+Y.svt.join(",")+"&ce="+Y.cvt.join(",")+(_atc.xck?"&xck=1":""),b=Y.evu+l;Y.cvt=[];Y.svt=[];if(Z){var k=document,f=k.ce("iframe");f.id="_atf";f.src=b;A.opp(f.style);k.body.appendChild(f);f=k.getElementById("_atf")}else{(new Image()).src=b}}},loc:function(){return _atc.loc},opp:function(Y){Y.width="1px";Y.height="1px";Y.position="absolute";Y.zIndex=100000},pub:function(){return window.addthis_config&&addthis_config.username?_euc(addthis_config.username):(window.addthis_pub||"")},plo:[],lad:function(Y){A.plo.push(Y)},lng:function(Y){var b=document;if(Y&&(Y.toLowerCase()).indexOf("en")!==0&&!A.pll){var Z=b.ce("script");Z.src=_atr+"static/r07/lang01.js";b.gn("head")[0].appendChild(Z);A.pll=Z}},jlo:function(){try{var f=document,b=(window.addthis_language||addthis_config.ui_language||(A.bro.msi?navigator.userLanguage:navigator.language));A.lng(b);if(!A.pld){var Y=f.ce("script");Y.src=_atr+"static/r07/menu31.js";f.gn("head")[0].appendChild(Y);A.pld=Y}}catch(Z){}},igv:function(Y,Z){if(!H.addthis_share){H.addthis_share={url:H.addthis_url||Y,title:H.addthis_title||Z}}if(!H.addthis_config){H.addthis_config={username:H.addthis_pub}}else{if(addthis_config.data_use_flash===false){_atc.xfl=1}if(addthis_config.data_use_cookies===false){_atc.xck=1}}},lod:function(Z){try{var d=window,Ac=A,Y=0,y=((Z===1||d.addthis_load_flash)&&!_atc.abf),m=U.referer||U.referrer||"",k=Q?Q.href:null,Ab=k?k.indexOf("sms_ss"):-1,b=U.ce("iframe"),r=((d.addthis_language||(d.addthis_config?d.addthis_config.ui_language:null)||(A.bro.msi?navigator.userLanguage:navigator.language)).split("-"))[0],v=0,u=U.getElementsByTagName("link");for(var x=0;x<u.length;x++){var q=u[x];if(q.rel&&q.rel=="canonical"&&q.href){k=q.href}}Ac.igv(k,U.title||"");A.gov();Ac.dr=m;Ac.ab="~";if(Q.href.indexOf(_atr)==-1){b.id="_atssh";b.style.width=b.style.height=1;b.width=b.height=1;b.frameborder=b.style.border=0;b.src=_atr+"static/r07/sh00.html?wpl="+_euc(Q.href);if(window.postMessage){if(A.bro.msi){window.attachEvent("onmessage",Ac.pmh)}else{window.addEventListener("message",Ac.pmh,false)}}else{if(Ac.ifpp){clearInterval(Ac.ifpp)}Ac.ifpp=setInterval(function(){A.ifp()},100)}b=U.body.appendChild(b);Ac.sifr=b}if(!y){if(Ac.samp>=0&&!Ac.sub){Ac.sev("20");Ac.cev("plo",Math.round(1/_atc.samp));if(Ac.dr){Ac.cev("pre",Ac.dr);Y=1}}if(Ac.camp>=0&&k&&Q&&Q.protocol&&(m.indexOf(".com")>-1)&&(Q.protocol.indexOf("https")==-1)){if(m&&m.match(/ws\/results\/(Web|Images|Video|News)/)){v=1}else{if(m.indexOf(".com/search")>-1){var h=m.split("?").pop().split("&");for(var x=0;x<h.length;x++){if(h[x].indexOf("q=")==0||h[x].indexOf("p=")==0||h[x].indexOf("query")==0||h[x].indexOf("qry")==0||h[x].indexOf("text")==0){v=1;break}}}}if(!_atc.xtr&&!_atc.xck&&v&&Ac.mun(Ac.pub())!=="mu2r"){var n=U.ce("script");n.src="//cf.addthis.com/red/p.json?callback=_ate.hrr"+(Ac.pub()?"&pub="+Ac.pub():"")+(Ac.uid&&Ac.uid!=="anonymous"?"&uid="+_euc(Ac.uid):"")+"&url="+_euc(k)+"&ref="+_euc((U.referer||U.referrer));U.gn("head")[0].appendChild(n)}}if(Ab>-1){var z=k.substr(Ab),p=z.indexOf("&");if(p>-1){z=z.substr(0,p)}z=(z.split("="))[1];if(Ac.vamp>=0&&!Ac.sub&&z.length){Ac.cev("plv",Math.round(1/_atc.vamp));Ac.cev("rsc",z)}}Ac.img(_atc.ver+"lo","2")}if(Ac.plo.length>0){Ac.jlo()}if(Ac.swf&&!_atc.xfl&&!(Ac.loc())&&!_atc.abf&&(y||Ac.uid===null||(Ac.uid!=="anonymous"&&Ac.oot&&((new Date()).getTime()-Ac.oot>60480000)))){Ac.uoo();var g=function(l,w,f){var t=U.createElement("param");t.name=w;t.value=f;l.appendChild(t)};var n=U.createElement("object");Ac.opp(n.style);n.id="atff";if(W.msi){n.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";g(n,"movie",Ac.swf)}else{n.data=Ac.swf;n.quality="high";n.type="application/x-shockwave-flash"}g(n,"wmode","transparent");g(n,"allowScriptAccess","always");U.body.insertBefore(n,U.body.firstChild);if(W.msi){n.outerHTML+=" "}}}catch(Aa){}},unl:function(){var Y=A;if(Y.samp>=0&&!Y.sub&&!_atc.abf){Y.sev("21",1);Y.cev("pun",1/_atc.samp)}return true},kck:function(Y){var Z=document;if(Z.cookie){Z.cookie=Y+"= ; expires=Tue, 31 Mar 2009 05:47:11 UTC; path=/"}},rck:function(b){var g=document;if(g.cookie){var Z=g.cookie.split(";");for(var f=0;f<Z.length;f++){var h=Z[f],Y=h.indexOf(b+"=");if(Y>=0){return h.substring(Y+(b.length+1))}}}return},uoo:function(){A.sck("_csoot",(new Date().getTime()))},coo:function(Y){if(A.uid=="anonymous"&&!A.oot){A.xck=1;A.uoo()}},dck:function(Y){A.uid=Y;A.sck("_csuid",Y);A.coo()},gov:function(){var Z=A.dl?A.dl.hostname:"";if(Z.indexOf(".gov")>-1||Z.indexOf(".mil")>-1){_atc.xck=1;_atc.xfl=1}var b=A.pub(),Y=["usarmymedia","gobiernousa","govdelivery"];for(R in Y){if(b==Y[R]){_atc.xck=1;_atc.xfl=1;break}}},sck:function(Z,Y,b){A.gov();if(!_atc.xck){U.cookie=Z+"="+Y+(!b?"; expires=Wed, 04 Oct 2028 03:19:53 GMT":"")+"; path=/"}},fcl:null,asetup:function(Y){var Z=A;try{if(Y!==null&&Y!==_atu){Z.dck(Y)}if(Z.fcl){Z.fcl()}}catch(b){}return Y},ao:function(b,Z,g,Y,f,d){A.lad(["open",b,Z,g,Y,f,d]);A.jlo();return false},ac:function(){},as:function(Z,b,Y){A.lad(["send",Z,b,Y]);A.jlo()}},X=A;H._ate=X;H._adr=J;U.ce=U.createElement;U.gn=U.getElementsByTagName;J.bindReady();if(G){G("unload",X.unl,false)}else{if(C){C("onunload",X.unl)}else{H.onunload=X.unl}}if(!_atc.ost){if(!H.addthis_conf){H.addthis_conf={}}for(var R in addthis_conf){_atc[R]=addthis_conf[R]}_atc.ost=1}J.append(X.lod);if(U.cookie){var E=U.cookie.split(";");for(var R=0;R<E.length;R++){var V=E[R],F=V.indexOf("_csuid="),D=V.indexOf("_csoot=");if(F>=0){A.uid=V.substring(F+7)}else{if(D>=0){A.oot=V.substring(D+7)}}}}try{var O=U.ce("link");O.rel="stylesheet";O.type="text/css";O.href=_atr+"static/r07/widget16.css";O.media="all";U.gn("head")[0].appendChild(O)}catch(T){}var N=U.gn("script"),I=N[N.length-1],K=I.src.replace(/^[^\?]+\??/,""),P=function(f){var g={};if(!f){return g}var h=f.split(/[;&]/);for(var b=0;b<h.length;b++){var d=h[b].split("=");if(!d||d.length!=2){continue}var Z=_duc(d[0]),Y=_duc(d[1]);Y=Y.replace(/\+/g," ");h[Z]=Y}return h},L=P(K);if(L.pub){H.addthis_pub=_duc(L.pub);if(H.addthis_config){H.addthis_config.username=H.addthis_pub}}else{if(L.username){H.addthis_pub=_duc(L.username);if(H.addthis_config){H.addthis_config.username=H.addthis_pub}}}if(L.domready){_atc.dr=1}try{if(_atc.ver===120){var M="atb"+H._ate.cuid();U.write('<span id="'+M+'"></span>');H._ate.igv();H._ate.lad(["span",M,addthis_share.url||"[url]",addthis_share.title||"[title]"])}if(H.addthis_clickout){A.lad(["cout"])}}catch(T){}})();function addthis_open(A,B,F,E,D,C){if(typeof D=="string"){D=null}return _ate.ao(A,B,F,E,D,C)}function addthis_close(){_ate.ac()}function addthis_sendto(B,C,A){_ate.as(B,C,A);return false}if(_atc.dr){_adr.onReady()}}else{_ate.inst++}if(_atc.abf){addthis_open(document.getElementById("ab"),"emailab",window.addthis_url||"[URL]",window.addthis_title||"[TITLE]")}if(!window.addthis||window.addthis.nodeType!==undefined){window.addthis={ost:0,cache:{},plo:[],links:[],ems:[],button:function(){this.plo.push({call:"button",args:arguments})},toolbox:function(){this.plo.push({call:"toolbox",args:arguments})},update:function(){this.plo.push({call:"update",args:arguments})}}}_adr.append((function(){if(!window.addthis.ost){var d=document,u=undefined,w=window,_4=w.addthis_config,_5=w.addthis_share,_6={},_7={},_8=d.gn("body").item(0),_9=function(o,n){if(n&&o!==n){for(var k in n){if(o[k]===u){o[k]=n[k]}}}},_d=function(o,n){var r={};for(var k in o){if(n[k]){r[k]=n[k]}else{r[k]=o[k]}}return r},_12=window.addthis,_13=function(_14){return"mailto:?subject="+(_14.title?_14.title:"%20")+"&body="+(_14.title?_14.title+"%0D%0A":"")+(_14.url)+"%0D%0A%0D%0AShared via AddThis.com"},_15=function(_16,tag,_18,_19){tag=tag.toUpperCase();var els=(_16==_8&&_12.cache[tag]?_12.cache[tag]:(_16||_8).getElementsByTagName(tag)),rv=[],o;if(_16==_8){_12.cache[tag]=els}_18=_18.replace(/\-/g,"\\-");var rx=new RegExp("(^|\\s)"+_18+(_19?"\\w*":"")+"(\\s|$)");for(var i=0;i<els.length;i++){o=els[i];if(rx.test(o.className)){rv.push(o)}}return(rv)},_1f={aim:"AIM",kirtsy:"kIRTSY",linkagogo:"Link-a-Gogo",meneame:"Men&eacute;ame",misterwong:"Mister Wong",myaol:"myAOL",myspace:"MySpace",yahoobkm:"Y! Bookmarks",typepad:"TypePad",wordpress:"WordPress"},_20={email:"Email",print:"Print",favorites:"Save to Favorites",twitter:"Tweet This",digg:"Digg This"},_21={services_custom:1},_22={more:1,email:1},_23={email:1,print:1,more:1,favorites:1},_24=["username","services_custom","services_custom_name","services_custom_url","services_custom_title","services_exclude","services_compact","services_expanded","ui_click","ui_hide_embed","ui_delay","ui_hover_direction","ui_language","ui_offset_top","ui_offset_left","ui_header_color","ui_header_background","ui_icons","ui_cobrand","data_use_flash","data_use_cookies","data_track_linkback"],_25=["url","title","templates","description","content"],_26=d.getElementsByClassname||_15,_27=function(_28,_29){var sv=_28.services instanceof Array?_28.services[0]:_28.services||"";return"http://"+_atd+"bookmark.php?v="+_atc.ver+"&pub="+_euc(_ate.pub())+"&s="+sv+(_29.url?"&url="+_euc(_29.url):"")+(_29.title?"&title="+_euc(_29.title):"")},_2b=function(_2c){if(typeof _2c=="string"){var c=_2c.substr(0,1);if(c=="#"){_2c=d.getElementById(_2c.substr(1))}else{if(c=="."){_2c=_26(_8,"*",_2c.substr(1))}else{}}}if(!(_2c instanceof Array)){_2c=[_2c]}return _2c},_2e=function(el,_30,_31,_32){var rv={};_31=_31||{};for(var i=0;i<_30.length;i++){if(_31[_30[i]]&&!_32){rv[_30[i]]=_31[_30[i]]}else{if(el){var p="addthis:"+_30[i],v=el.getAttribute?el.getAttribute(p)||el[p]:el[p];if(v){rv[_30[i]]=v}else{if(_31[_30[i]]){rv[_30[i]]=_31[_30[i]]}}}}if(rv[_30[i]]!==undefined&&_21[_30[i]]&&(typeof rv[_30[i]]=="string")){eval("var e = "+rv[_30[i]]);rv[_30[i]]=e}}return rv},_37=function(el,_39,_3a,_3b){var rv={conf:_39||{},share:_3a||{}};rv.conf=_2e(el,_24,_39,_3b);rv.share=_2e(el,_25,_3a,_3b);return rv},_3d=function(_3e,_3f,_40){if(_3e){_3f=_3f||{};_40=_40||{};var _41=_3f.conf||_4,_42=_3f.share||_5;var _43=_40.onmouseover,_44=_40.onmouseout,_45=_40.onclick,_46=_40.internal,ss=_40.singleservice;if(ss){_41.product="tbx-"+_atc.ver;if(_45===u){_45=_22[ss]?function(el,_49,_4a){var s=_d(_4a,_7);return addthis_open(el,ss,s.url,s.title,_d(_49,_6),s)}:_23[ss]?function(el,_4d,_4e){var s=_d(_4e,_7);return addthis_sendto(ss,_d(_4d,_6),s)}:null}}else{if(!_40.noevents){if(!_40.nohover&&(!_41||!_41.ui_click)){if(_43===u){_43=function(el,_51,_52){return addthis_open(el,"",null,null,_51,_52)}}if(_44===u){_44=function(el){return addthis_close()}}if(_45===u){_45=function(el,_55,_56){return addthis_sendto("more",_55,_56)}}}else{if(!_41||!_41.ui_click){if(_45===u){_45=function(el,_58,_59){return addthis_open(el,"more")}}}else{if(_45===u){_45=function(el,_5b,_5c){return addthis_open(el,"",null,null,_5b,_5c)}}}}}}_3e=_2b(_3e);for(var i=0;i<_3e.length;i++){var o=_3e[i],_5f=_37(o,_41,_42,true)||{};_9(_5f.conf,_4);_9(_5f.share,_5);o.conf=_5f.conf;o.share=_5f.share;if(o.conf.ui_language){_ate.lng(o.conf.ui_language)}if(_43){o.onmouseover=function(){return _43(this,this.conf,this.share)}}if(_44){o.onmouseout=function(){return _44(this)}}if(_45){o.onclick=function(){return _45(this,this.conf,this.share)}}if(o.tagName.toLowerCase()=="a"){if(ss){o.conf.product="tbx-"+_atc.ver;if((_ate.bro.ffx||_ate.bro.chr||_ate.bro.iph)&&!_23[ss]){var _60=o.share.templates&&o.share.templates[ss]?o.share.templates[ss]:"";o.href="//"+_atd+"bookmark.php?pub="+_euc(addthis_config.username||o.conf.username||_ate.pub())+"&v="+_atc.ver+"&source=tbx-"+_atc.ver+"&s="+ss+"&url="+_euc(_5f.share.url||addthis_share.url||"")+"&title="+_euc(_5f.share.title||addthis_share.title||"")+"&content="+_euc(_5f.share.content||addthis_share.content||"")+(_60?"&template="+_euc(_60):"")+(o.conf.data_track_linkback?"&sms_ss=1":"");o.target="_blank";_12.links.push(o)}else{if(!_23[ss]){o.onclick=function(){return addthis_sendto.call(this,ss,_d(this.conf,_6),_d(this.share,_7))}}else{if(ss=="email"&&(o.conf.ui_use_mailto||_ate.bro.iph)){o.href=_13(o.share);o.onclick=null;_12.ems.push(o)}}}if(!o.title){o.title=_20[ss]?_20[ss]:"Send to "+(_1f[ss]?_1f[ss]:ss.substr(0,1).toUpperCase()+ss.substr(1))}}}if(_46){var app=_46;if(!o.hasChildNodes()){if(_46=="img"){var img=d.ce("img");img.width=125;img.height=16;img.border=0;img.alt="Share";img.src="//s7.addthis.com/static/btn/v2/lg-share-en.gif";app=img}o.appendChild(app)}}}}},_63=_15(_8,"A","addthis_button_",true),_64=function(_65,_66,_67,_68){for(var i=0;i<_65.length;i++){var b=_65[i];if(b==null){continue}if(_68!==false||!b.ost){var _66=_66||_4;_67=_67||_5;attr=_37(b,_66,_67,true),hc=0,a="at300";c=b.className||"",s=c.match(/addthis_button_(\w+)(?:\s|$)/),opts=u,sv=s&&s.length?s[1]:0;if(sv){if(!b.childNodes.length){var sp=d.ce("span");b.appendChild(sp);sp.className=a+"bs at15t_"+sv}else{if(b.childNodes.length==1){var cn=b.childNodes[0];if(cn.nodeType==3){var sp=d.ce("span"),tv=cn.nodeValue;b.insertBefore(sp,cn);sp.className=a+"bs at15t_"+sv}}else{hc=1}}if(sv==="compact"){if(!hc&&c.indexOf(a)==-1){b.className+=" "+a+"m"}}else{if(sv==="expanded"){if(!hc&&c.indexOf(a)==-1){b.className+=" "+a+"m"}opts={nohover:true}}else{if(!hc&&c.indexOf(a)==-1){b.className+=" "+a+"b"}opts={singleservice:sv}}}_3d([b],attr,opts);b.ost=1}}}};_12.update=function(_6e,_6f,_70){if(_6e=="share"){if(!window.addthis_share){window.addthis_share={}}window.addthis_share[_6f]=_70;_7[_6f]=_70;for(var i in _12.links){var o=_12.links[i],rx=new RegExp("&"+_6f+"=(.*)&"),ns="&"+_6f+"="+_euc(_70)+"&";o.href=o.href.replace(rx,ns);if(o.href.indexOf(_6f)==-1){o.href+=ns}}for(var i in _12.ems){var o=_12.ems[i];o.href=_13(addthis_share)}}else{if(_6e=="config"){if(!window.addthis_config){window.addthis_config={}}window.addthis_config[_6f]=_70;_6[_6f]=_70}}};_12.button=function(_75,_76,_77){_3d(_75,{conf:_76,share:_77},{internal:"img"})};_12.toolbox=function(_78,_79,_7a){var _7b=_2b(_78);for(var i=0;i<_7b.length;i++){var tb=_7b[i],_7e=_37(tb,_79,_7a),sp=d.ce("div"),c=tb.getElementsByTagName("a");if(c){_64(c,_7e.conf,_7e.share)}tb.appendChild(sp);sp.className="atclear"}};_12.ready=function(){if(this.ost){return}this.ost=1;var a=".addthis_";_12.toolbox(a+"toolbox");_12.button(a+"button");_64(_63,null,null,false);for(var i=0;i<this.plo.length;i++){_12[this.plo[i].call].apply(this,this.plo[i].args)}};window.addthis=_12;window.addthis.ready()}}));
/*
 *	MySpace Video "Thumbnail Manager" JavaScript Library
 * 
 *  _______ _                     _                 _ _ 
 * |__   __| |                   | |               (_) |
 *    | |  | |__  _   _ _ __ ___ | |__  _ __   __ _ _| |
 *    | |  | '_ \| | | | '_ ` _ \| '_ \| '_ \ / _` | | |
 *    | |  | | | | |_| | | | | | | |_) | | | | (_| | | |
 *    |_|  |_| |_|\__,_|_| |_| |_|_.__/|_| |_|\__,_|_|_|
 *                                                      
 *                                                      
 *  __  __                                   
 * |  \/  |                                  
 * | \  / | __ _ _ __   __ _  __ _  ___ _ __ 
 * | |\/| |/ _` | '_ \ / _` |/ _` |/ _ \ '__|
 * | |  | | (_| | | | | (_| | (_| |  __/ |   
 * |_|  |_|\__,_|_| |_|\__,_|\__, |\___|_|   
 *                            __/ |          
 *                           |___/
 * 
 *	
 *	Notes
 *  1. Each page can have a given amount of dom elements on it representing a thumbnail.
 *  2. Each DOM element represents a unique video id.
 *  3. Remember that 2 or more DOM elements can share the same video id.
 *  4. Each page will have an instance of a thumbnail manager on it.
 *  5. The thumbnail manager will provide the following api.
 *      a. registerElements([dom1, dom2,...])
 *      b. unregisterElements([dom1, dom2, ...])
 *      c. getElements(videoId)
 *  6. A page contains n amount of modules. Each module can contain x amount of thumbnails
 *  7. Each module on a page will be responsible for its thumbnails.
 *  8. Each module will pass in the list of thumbnails to the thumbnail manager to register/unregister them.
 *
 *  The trick part is how to get each module's object to talk to the thumbnail manager in a loosely coupled way.    
 *        
 *
 *  The Thumbnail Manager:
 *  The thumbnail manager will keep a hash of {videoId1: [dom1, dom2,..], videoId2: [dom1, dom2,...]}
 *    a. When a list of thumbnails are registered, each  
 * 
 */
(function(){var B=[];var A=function(){for(var D=0,C=B.length;D<C;D++){}};_clearTimeout=function(C){window.clearTimeout(C);window.clearInterval(C);return true};VideoThumbnail=function(D,C){this.options={blank:0,interval:500,delay:250};this.eleThumbnail;this.initialized=false;this.isHot=false;this.xCord=0;this.yCord=0;this.mouseTimeout=null;this.timeout=null;this.state=1;this.srcImg;return this.init(D,C)};VideoThumbnail.prototype={init:function(){this.options=mySpaceTv.extend(this.options,arguments[1]||{});this.interval=this.options.interval;this.eleThumbnail=$$(arguments[0]);if(this.eleThumbnail){this.srcImg=this.eleThumbnail.src;this.mouseOverHandler=this.onMouseOver.bindAsEventListener(this);this.mouseOutHandler=this.onMouseOut.bindAsEventListener(this);mySpaceTv.addEvent(this.eleThumbnail,"mouseover",this.mouseOverHandler);mySpaceTv.addEvent(this.eleThumbnail,"mouseout",this.mouseOutHandler);Expando.setDataForElem(this.eleThumbnail,{VideoThumbnailInstance:this})}return this},dispose:function(){mySpaceTv.removeEvent(this.eleThumbnail,"mouseover",this.mouseOverHandler);mySpaceTv.removeEvent(this.eleThumbnail,"mouseout",this.mouseOutHandler)},onMouseOver:function(C){this.isHot=true;if(!this.updateTimeout){this.updateTimeout=window.setTimeout(this.updateThumbnail.bind(this,C),this.options.delay)}this.preCacheNextImg()},onMouseOut:function(C){this.isHot=false;this.interval=this.options.interval;_clearTimeout(this.updateTimeout);this.updateTimeout=null},updateThumbnail:function(F){_clearTimeout(this.updateTimeout);this.updateTimeout=null;this.interval-=this.options.delay;if(this.interval<=0){this.interval=this.options.interval;var E=/([\w\d:\/\.-]*thumb)(\d?)(.*)/i.exec(this.srcImg);var C=(this.state%3)+1;if(E){var D=E[1]+C+E[3];this.eleThumbnail.src=D;this.state++;this.preCacheNextImg()}}if(!this.updateTimeout){this.updateTimeout=window.setTimeout(this.updateThumbnail.bind(this,F),this.options.delay)}},preCacheNextImg:function(){if(this.state>3){return}var F=new Image();var E=/([\w\d:\/\.-]*thumb)(\d?)(.*)/i.exec(this.srcImg);var C=(this.state%3)+1;if(E){var D=E[1]+C+E[3];F.src=D}}}})();(function(){_clearTimeout=function(A){window.clearTimeout(A);window.clearInterval(A);return true};VideoContributor=function(B,A){this.options={interval:500,delay:500};this.eleContributor;this.popupTimeout=null;this.contributorId;return this.init(B,A)};VideoContributor.prototype={init:function(){this.options=mySpaceTv.extend(this.options,arguments[1]||{});this.eleContributor=$$(arguments[0]);if(this.eleContributor){this.contributorId=Element.readAttribute(this.eleContributor,"cid");this.mouseOverHandler=this.onMouseOver.bindAsEventListener(this);this.mouseOutHandler=this.onMouseOut.bindAsEventListener(this);mySpaceTv.addEvent(this.eleContributor,"mouseover",this.mouseOverHandler);mySpaceTv.addEvent(this.eleContributor,"mouseout",this.mouseOutHandler);Expando.setDataForElem(this.eleContributor,{VideoContributorInstance:this})}return this},dispose:function(){mySpaceTv.removeEvent(this.eleContributor,"mouseover",this.mouseOverHandler);mySpaceTv.removeEvent(this.eleContributor,"mouseout",this.mouseOutHandler)},onMouseOver:function(A){if(!this.popupTimeout){this.popupTimeout=window.setTimeout(this.showPopup.bind(this,A),this.options.delay)}},onMouseOut:function(A){_clearTimeout(this.popupTimeout);this.popupTimeout=null},showPopup:function(A){_clearTimeout(this.popupTimeout);this.popupTimeout=null}}})();var ThumbnailManager=(function(){var C={};var E={useRotatingThumbs:false,useContributorPopup:false,useTrendThumbs:false};var B={};var A=function(G){return G!=null&&typeof G=="object"&&"splice" in G&&"join" in G};var D=function(J,I){if(B.hasOwnProperty(J)){var G=B[J];if(A(G)){G[G.length]=I}else{var H=new Array(2);H[0]=G;H[1]=I;B[J]=H}}else{B[J]=I}};var F=function(J,I){if(B.hasOwnProperty(J)){var H=B[J];if(A(H)){var G=H.indexOf(I);if(G>=0){H.splice(G,1);if(H.length==1){B[J]=H[0]}}}else{delete B[J]}}};return{init:function(){E=mySpaceTv.extend(E,arguments[0]||{});C=mySpaceTv.extend(C,arguments[1]||{});mySpaceTv.onReady(function(){mySpaceTv.notify("ThumbnailManager:Init",ThumbnailManager)});return this},useRotatingThumbs:function(){return E.useRotatingThumbs},useContributorPopup:function(){return E.useContributorPopup},useTrendThumbs:function(){return E.useTrendThumbs},getThumbs:function(H){var G=B[H];if(!G){return[]}if(A(G)){return G}else{return[G]}},registerContributors:function(J,I){if(!J){return}if(J.length==0){return}for(var H=0,G=J.length;H<G;H++){new VideoContributor(J[H],I)}Expando.appendDataForElem(J[J.length-1],{isLast:true})},unRegisterContributors:function(K,I){if(!K){return}for(var H=0,G=K.length;H<G;H++){var I=Expando.getDataForElem(K[H]);if(I&&I.hasOwnProperty("VideoContributorInstance")){var J=I.VideoContributorInstance;if(J&&J.dispose){J.dispose()}}Expando.delDataOfElem(K[H])}},registerThumbs:function(J,I){if(!J){return}if(J.length==0){return}for(var H=0,G=J.length;H<G;H++){new VideoThumbnail(J[H],I);var K=Element.readAttribute(J[H],"vid");if(typeof(K)!="undefined"){D(K,J[H])}}Expando.appendDataForElem(J[J.length-1],{isLast:true})},unRegisterThumbs:function(K){if(!K){return}for(var I=0,G=K.length;I<G;I++){var J=Expando.getDataForElem(K[I]);if(J&&J.hasOwnProperty("VideoThumbnailInstance")){var H=J.VideoThumbnailInstance;if(H&&H.dispose){H.dispose()}}var L=Element.readAttribute(K[I],"vid");if(typeof(L)!="undefined"){F(L,K[I])}Expando.delDataOfElem(K[I])}}}}());
