var cookie_domain='youtube.com';
var cookie_prefix='';
(function(){
function d(a,b){return a.className=b}var g=false,i=true,j=window,k=document,l=Array,m="push",o="length",p="prototype",q="replace",s="split",u="stopPropagation",v="indexOf",w="style",x="call",B="forEach",C="contains",E="parentNode",F="event";var aa=aa||{},G=this,ba=function(a,b){var c=a[s]("."),e=G,f;!(c[0]in e)&&e.execScript&&e.execScript("var "+c[0]);while(c[o]&&(f=c.shift()))if(!c[o]&&typeof b!="undefined")e[f]=b;else e=e[f]?e[f]:(e[f]={})};var I=function(a){var b=typeof a;if(b=="object")if(a){if(typeof a[o]=="number"&&typeof a.splice!="undefined"&&!H(a,"length"))return"array";if(typeof a[x]!="undefined")return"function"}else return"null";else if(b=="function"&&typeof a[x]=="undefined")return"object";return b};if(Object[p].propertyIsEnumerable)var H=
function(a,b){return Object[p].propertyIsEnumerable[x](a,b)};else H=function(a,b){if(b in a)for(var c in a)if(c==b&&Object[p].hasOwnProperty[x](a,b))return i;return g};var ca=function(a){var b=I(a);return b=="array"||b=="object"&&typeof a[o]=="number"};var J=function(a){var b=I(a);return b=="object"||b=="array"||b=="function"},da=Date.now||function(){return(new Date).getTime()},K=function(a,b){ba(a,b)};var L={};L.f={};L.H=function(){var a=arguments[o];if(a>1&&typeof arguments[0]=="string")L.f[arguments[0]]=arguments[1];else for(var b=0;b<a;b++)for(var c in arguments[b])L.f[c]=arguments[b][c]};L.S=function(a){return a in L.f};L.B=function(a,b,c){var e=b||{},f=a in L.f?L.f[a]:c;if(f)for(var h in e)f=f[q](new RegExp("\\$"+h,"gi"),e[h]);return f};var ea=function(a,b,c){if(a[v])return a[v](b,c);if(l[v])return l[v](a,b,c);var e=c==null?0:c<0?Math.max(0,a[o]+c):c;for(var f=e;f<a[o];f++)if(f in a&&a[f]===b)return f;return-1},M=function(a,b,c){if(a[B])a[B](b,c);else if(l[B])l[B](a,b,c);else{var e=a[o],f=typeof a=="string"?a[s](""):a;for(var h=0;h<e;h++)h in f&&b[x](c,f[h],h,a)}},N=function(a,b){if(a[C])return a[C](b);return ea(a,b)>-1},fa=function(a){if(I(a)=="array")return a.concat();else{var b=[];for(var c=0,e=a[o];c<e;c++)b[c]=a[c];return b}},
ga=function(a){return l[p].splice.apply(a,O(arguments,1))},O=function(a,b,c){return arguments[o]<=2?l[p].slice[x](a,b):l[p].slice[x](a,b,c)};var P;var Q=function(a){var b=a.className;return b&&typeof b[s]=="function"?b[s](" "):[]},S=function(a){var b=Q(a),c=1;for(var e=1;e<arguments[o];e++)if(N(b,arguments[e]))c&=0;else{b[m](arguments[e]);c&=1}d(a,b.join(" "));return Boolean(c)},T=function(a){var b=Q(a),c=O(arguments,1),e=0;for(var f=0;f<b[o];f++)if(N(c,b[f])){ga(b,f--,1);e++}d(a,b.join(" "));return e==c[o]},U=function(a,b){return N(Q(a),b)},ha=function(a,b,c){c?S(a,b):T(a,b)},ia=function(a,b){var c=!U(a,b);ha(a,b,c);return c};var ja=function(a,b,c){for(var e in a)b[x](c,a[e],e,a)};var ka=function(a){return a[q](/^[\s\xa0]+|[\s\xa0]+$/g,"")},qa=function(a,b){if(b)return a[q](la,"&amp;")[q](ma,"&lt;")[q](na,"&gt;")[q](oa,"&quot;");else{if(!pa.test(a))return a;if(a[v]("&")!=-1)a=a[q](la,"&amp;");if(a[v]("<")!=-1)a=a[q](ma,"&lt;");if(a[v](">")!=-1)a=a[q](na,"&gt;");if(a[v]('"')!=-1)a=a[q](oa,"&quot;");return a}},la=/&/g,ma=/</g,na=/>/g,oa=/\"/g,pa=/[&<>\"]/,ta=function(a){if(a[v]("&")!=-1)return"document"in G&&!(a[v]("<")!=-1)?ra(a):sa(a);return a},ra=function(a){var b=G.document.createElement("a");
b.innerHTML=a;b.normalize&&b.normalize();a=b.firstChild.nodeValue;b.innerHTML="";return a},sa=function(a){return a[q](/&([^;]+);/g,function(b,c){switch(c){case "amp":return"&";case "lt":return"<";case "gt":return">";case "quot":return'"';default:if(c.charAt(0)=="#"){var e=Number("0"+c.substr(1));if(!isNaN(e))return String.fromCharCode(e)}return b}})},ua=function(a,b,c){if(c)a=ta(a);if(a[o]>b)a=a.substring(0,b-3)+"...";if(c)a=qa(a);return a};var va=function(a,b){var c=0,e=ka(String(a))[s]("."),f=ka(String(b))[s]("."),
h=Math.max(e[o],f[o]);for(var n=0;c==0&&n<h;n++){var y=e[n]||"",R=f[n]||"",z=new RegExp("(\\d*)(\\D*)","g"),D=new RegExp("(\\d*)(\\D*)","g");do{var r=z.exec(y)||["","",""],t=D.exec(R)||["","",""];if(r[0][o]==0&&t[0][o]==0)break;var A=r[1][o]==0?0:parseInt(r[1],10),Aa=t[1][o]==0?0:parseInt(t[1],10);c=V(A,Aa)||V(r[2][o]==0,t[2][o]==0)||V(r[2],t[2])}while(c==0)}return c},V=function(a,b){if(a<b)return-1;else if(a>b)return 1;return 0};da();var wa,xa,ya,za,Ba,Ca,W,Da,Ea,Fa,Ga;(function(){var a=g,b=g,c=g,e=g,f=g,h=g,n=g,y=g,R=g,z="";if(G.navigator){var D=G.navigator,r=D.userAgent;a=r[v]("Opera")==0;b=!a&&r[v]("MSIE")!=-1;c=!a&&r[v]("WebKit")!=-1;R=c&&r[v]("Mobile")!=-1;e=!a&&!c&&D.product=="Gecko";f=e&&D.vendor=="Camino";var t,A;if(a)t=G.opera.version();else{if(e)A=/rv\:([^\);]+)(\)|;)/;else if(b)A=/MSIE\s+([^\);]+)(\)|;)/;else if(c)A=/WebKit\/(\S+)/;if(A){A.test(r);t=RegExp.$1}}z=D.platform||"";h=z[v]("Mac")!=-1;n=z[v]("Win")!=-1;y=
z[v]("Linux")!=-1}wa=a;xa=b;ya=e;za=f;Ba=c;Ca=R;W=t;Da=z;Ea=h;Fa=n;Ga=y})();var Ha=xa,Ia=ya;var Y=function(){P||(P=new X);return P},Z=function(a){return typeof a=="string"?k.getElementById(a):a},Ja=function(a,b,c){return Y().o(a,b,c)},La=function(a,b){ja(b,function(c,e){if(e=="style")a[w].cssText=c;else if(e=="class")d(a,c);else if(e=="for")a.htmlFor=c;else if(e in Ka)a.setAttribute(Ka[e],c);else a[e]=c})},Ka={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",height:"height",width:"width",usemap:"useMap",frameborder:"frameBorder"},Ma=
function(){var a=Y();return a.u.apply(a,arguments)},Na=function(a,b){a.appendChild(b)};var Oa=Ba&&va(W,"521")<=0,Pa=function(a,b){if(typeof a[C]!="undefined"&&!Oa&&b.nodeType==1)return a==b||a[C](b);if(typeof a.compareDocumentPosition!="undefined")return a==b||Boolean(a.compareDocumentPosition(b)&16);while(b&&a!=b)b=b[E];return b==a},Qa=function(a){if(a&&typeof a[o]=="number")if(J(a))return typeof a.item=="function"||typeof a.item=="string";else if(I(a)=="function")return typeof a.item=="function";
return g},Ra=function(a,b,c){if(!c)a=a[E];while(a){if(b(a))return a;a=a[E]}return null},X=function(a){this.j=a||G.document||k};X[p].o=function(a,b,c){var e=(c||this.j).getElementsByTagName(a||"*");if(b){var f=[];for(var h=0,n;n=e[h];h++){var y=n.className;typeof y[s]=="function"&&N(y[s](" "),b)&&f[m](n)}return f}else return e};X[p].u=function(a,b){if(Ha&&b&&b.name)a="<"+a+' name="'+qa(b.name)+'">';var c=this.createElement(a);b&&La(c,b);if(arguments[o]>2){function e(n){if(n)this.appendChild(c,typeof n==
"string"?this.createTextNode(n):n)}for(var f=2;f<arguments[o];f++){var h=arguments[f];ca(h)&&!(J(h)&&h.nodeType>0)?M(Qa(h)?fa(h):h,e,this):e[x](this,h)}}return c};X[p].createElement=function(a){return this.j.createElement(a)};X[p].createTextNode=function(a){return this.j.createTextNode(a)};X[p].appendChild=Na;X[p].contains=Pa;L.e={};L.e.p=function(a,b){a=Z(a);b=Z(b);return!!Ra(a,function(c){return c===b},i)};L.e.A=function(a,b,c){var e=Y().o(a,b,c);return e[o]?e[e[o]-1]:null};L.e.R=function(a,b,c,e){var f=L.e.A(a,b,c);if(!f){var h=e||{};d(h,b);f=Ma(a,h);c.appendChild(f)}return f};L.c={};L.c.l=(function(){return j.addEventListener?function(a,b,c){a.addEventListener(b,c,g)}:j.attachEvent?function(a,b,c){var e=function(){c[x](a,j[F])};if(!a.d)a.d={};a.d[b]||(a.d[b]={});a.d[b][c]=e;a.attachEvent("on"+b,e)}:function(a,b,c){a["on"+b]=c}})();L.c.O=(function(){return j.removeEventListener?function(a,b,c){a.removeEventListener(b,c,g)}:j.detachEvent?function(a,b,c){a.d&&a.d[b]&&a.d[b][c]&&a.detachEvent("on"+b,a.d[b][c])}:function(){}})();L.c.C=function(a){var b=a||j[F],c=b.target||
b.srcElement;if(c.nodeType==3)c=c[E];return c};L.c.stopPropagation=function(a){var b=a||j[F];b.cancelBubble=i;b[u]&&b[u]()};L.c.preventDefault=function(a){var b=a||j[F];b.preventDefault&&b.preventDefault();return g};L.n={};L.n.t=function(){var a=j.deconcept,b=a.SWFObjectUtil.getPlayerVersion();if(b.major<9)return g;if(navigator.userAgent[v]("Sony/COM2")>-1){var c=new a.PlayerVersion([9,1,58]);if(!b.versionIsValid(c))return g}return i};var $=function(a,b){a[w].display=b?"":"none"};Ia&&!(va(W,"1.9")>=0);L.style={};L[w].i=function(a,b){a=Z(a);if(!a)return;$(a,b);ha(a,"hid",!b)};L[w].q=function(a){a=Z(a);if(!a)return g;return!(!(a[w].display!="none")||U(a,"hid"))};L[w].K=function(a){a=Z(a);if(!a)return;if(L[w].q(a)){$(a,g);S(a,"hid")}else{$(a,i);T(a,"hid")}};L[w].I=function(a,b){a=Z(a);if(!a)return;a[w].visibility=b?"visible":"hidden"};L[w].r=function(){M(arguments,function(a){L[w].i(a,i)})};L[w].k=function(){M(arguments,function(a){L[w].i(a,g)})};L[w].s=function(){M(arguments,L[w].K)};L[w].D=function(a,
b){j.setTimeout(function(){L[w].k(a)},b)};L.a={};L.a.b={};K("yt",L);K("_gel",Z);K("ref",Z);K("getElementsByTagNameAndClass",Ja);K("each",M);K("arrayEach",M);K("hasAncestor",L.e.p);K("_setmsg",L.H);K("_getmsg",L.B);j.onLoadFunctionList=[];j.onUnloadFunctionList=[];j.gLoadedPage=g;L.a.b.w=function(){for(var a=0,b=j.onLoadFunctionList[o];a<b;a++)j.onLoadFunctionList[a]();j.gLoadedPage=i};L.a.b.z=function(){for(var a=j.onUnloadFunctionList[o]-1;a>=0;a--)j.onUnloadFunctionList[a]()};K("performOnLoadFunctions",L.a.b.w);K("performOnUnloadFunctions",
L.a.b.z);K("addListener",L.c.l);K("removeListener",L.c.O);K("stopPropagation",L.c[u]);K("preventDefault",L.c.preventDefault);K("hasClass",U);K("addClass",S);K("removeClass",T);K("toggleClass",ia);K("showDiv",L[w].r);K("hideDiv",L[w].k);K("hideDivAfter",L[w].D);K("setDisplay",L[w].i);K("isDisplayed",L[w].q);K("toggleDisplay",L[w].s);K("toggleDisplay2",L[w].s);K("setVisible",L[w].I);L.a.b.m=function(a,b){var c=[],e=a;if(b){for(var f in b)c[m](f+"="+encodeURIComponent(b[f].toString()));if(c[o])e+="?"+
c.join("&")}return e};L.a.b.G=function(a,b,c){var e=c||"";k.location.href=L.a.b.m(a,b)+e};L.a.b.F=function(a,b,c,e,f){var h=j.open(a,b,"height="+c+(",width="+e)+(f?",scrollbars=1":""));if(h&&!h.opener)h.opener=j;j.focus&&h.focus();return g};K("buildUrl",L.a.b.m);K("redirect",L.a.b.G);K("openPopup",L.a.b.F);j.__eventsPageTracker=null;j.__gaTrackers={};L.a.b.P=function(){};L.a.b.Q=function(){if(!j.gIsGoogleAnalyticsEnabled)return;if(!j.gLoadedPage)j.onLoadFunctionList[m](function(){})};L.a.b.M=function(a,
b,c,e){var f=j.__gaTrackers[a];if(!f){if(!j.__eventsPageTracker)return;f=j.__eventsPageTracker._createEventTracker(a);j.__gaTrackers[a]=f}f._trackEvent(b,c||undefined,e||undefined)};K("urchinTracker",L.a.b.P);K("urchinTrackerDefer",L.a.b.Q);K("trackEvent",L.a.b.M);K("canPlayV9Swf",L.n.t);L.a.b.g={};L.a.b.J=function(a,b,c,e){L.a.b.h();var f=L.a.b.g;f.id=b;f.parentId=c||Z(b)[E].id;f.eventType=e||"click";L.c[u](a);L[w].r(f.id);S(Z(f.parentId),"show-dropdown")};L.a.b.h=function(){var a=L.a.b.g;if(a.id){L[w].k(a.id);
T(Z(a.parentId),"show-dropdown");L.a.b.g={}}};L.c.l(k,"click",L.a.b.h);L.c.l(k,"mouseover",function(a){var b=L.c.C(a),c=L.a.b.g;c&&c.eventType&&c.parentId&&a.type[v](c.eventType)!=-1&&!L.e.p(b,c.parentId)&&L.a.b.h()});K("dropdown",L.a.b.J);K("hideDropdown",L.a.b.h);L.a.b.L=function(a,b){a=Z(a);while(a){if(U(a,"tooltip-wrapper-box")){L[w].i(a,b);break}a=a.nextSibling}};K("toggleSimpleTooltip",L.a.b.L);L.a.b.v=function(a,b){a=Z(a);if(a){a.disabled=i;if(b)a.onclick=null}};L.a.b.N=function(a,b){return ua(a,
b||30)};K("disableButton",L.a.b.v);K("truncate",L.a.b.N);
})();
function UTRating(ratingElementId,maxStars,objectName,formName,ratingMessageId,componentSuffix,size,messages,starCount,callback)
{
this.ratingElementId=ratingElementId;
this.maxStars=maxStars;
this.objectName=objectName;
this.formName=formName;
this.ratingMessageId=ratingMessageId
this.componentSuffix=componentSuffix
this.messages=messages;
this.callback=callback;
this.starTimer=null;
this.starCount=0;
if(starCount){
this.starCount=starCount;
var that=this;
onLoadFunctionList.push(function(){that.drawStars(that.starCount,true);});
}
if(size=='S'){
UTRating.ut_rating_img='icn_star_full_11x11'
UTRating.ut_rating_img_half='icn_star_half_11x11'
UTRating.ut_rating_img_bg='icn_star_empty_11x11'
}
}
UTRating.prototype.ratingElementId=null;
UTRating.prototype.maxStars=null;
UTRating.prototype.objectName=null;
UTRating.prototype.formName=null;
UTRating.prototype.ratingMessageId=null;
UTRating.prototype.componentSuffix=null;
UTRating.prototype.messages=null;
UTRating.prototype.callback=null;
UTRating.prototype.starTimer=null;
UTRating.prototype.starCount=null;
UTRating.prototype.savedMessage=null;
UTRating.prototype.showStars=function(starNum,skipMessageUpdate){
this.clearStarTimer();
this.greyStars();
this.colorStars(starNum);
if(!skipMessageUpdate)
this.setMessage(starNum,this.messages);
}
UTRating.prototype.setMessage=function(starNum){
if(starNum>0){
if(!this.savedMessage){
this.savedMessage=_gel(this.ratingMessageId).innerHTML;
}
_gel(this.ratingMessageId).innerHTML=this.messages[starNum-1];
}else if(this.savedMessage){
_gel(this.ratingMessageId).innerHTML=this.savedMessage;
}
}
UTRating.prototype.colorStars=function(starNum){
var fullStars=Math.floor(starNum+0.25);
var halfStar=(starNum-fullStars>0.25);
for(var i=0;i<fullStars;i++){
removeClass(_gel('star_'+this.componentSuffix+"_"+(i+1)),UTRating.ut_rating_img_half);
removeClass(_gel('star_'+this.componentSuffix+"_"+(i+1)),UTRating.ut_rating_img_bg);
addClass(_gel('star_'+this.componentSuffix+"_"+(i+1)),UTRating.ut_rating_img);
}
if(halfStar){
removeClass(_gel('star_'+this.componentSuffix+"_"+(i+1)),UTRating.ut_rating_img);
removeClass(_gel('star_'+this.componentSuffix+"_"+(i+1)),UTRating.ut_rating_img_bg);
addClass(_gel('star_'+this.componentSuffix+"_"+(i+1)),UTRating.ut_rating_img_half);
}
}
UTRating.prototype.greyStars=function(){
for(var i=0;i<this.maxStars;i++){
removeClass(_gel('star_'+this.componentSuffix+"_"+(i+1)),UTRating.ut_rating_img);
removeClass(_gel('star_'+this.componentSuffix+"_"+(i+1)),UTRating.ut_rating_img_half);
addClass(_gel('star_'+this.componentSuffix+"_"+(i+1)),UTRating.ut_rating_img_bg);
}
}
UTRating.prototype.setStars=function(starNum){
this.starCount=starNum;
this.drawStars(starNum);
document.forms[this.formName]['rating'].value=this.starCount;
var ratingElementId=this.ratingElementId;
var that=this;
var callback=function(req){
_gel(ratingElementId).innerHTML=req.responseText;
var pmsTokenNode=_gel('rating_notify_token');
var pmsToken=pmsTokenNode&&pmsTokenNode.value;
if(that.callback){
that.callback();
}
if(typeof pmsForwarder!='undefined'&&pmsToken){
pmsForwarder.ratedVideo(pmsToken);
}
};
var form=document.forms[this.formName];
ajaxRequest(form.action,{postBody:extractFormData(form),onComplete:callback});
}
UTRating.prototype.drawStars=function(starNum,skipMessageUpdate){
this.starCount=starNum;
this.showStars(starNum,skipMessageUpdate);
}
UTRating.prototype.clearStars=function(){
this.starTimer=window.setTimeout(this.objectName+".resetStars()",300);
}
UTRating.prototype.resetStars=function(){
this.clearStarTimer();
if(this.starCount)
this.drawStars(this.starCount);
else
this.greyStars();
this.setMessage(0);
}
UTRating.prototype.clearStarTimer=function(){
if(this.starTimer){
window.clearTimeout(this.starTimer);
this.starTimer=null;
}
}
UTRating.ut_rating_img='icn_star_full_large';
UTRating.ut_rating_img_half='icn_star_half_large';
UTRating.ut_rating_img_bg='icn_star_empty_large';
function ajaxRequest(url,options){
var method=options.method||"POST";
var postBody=options.postBody||null;
var async=options.async||true;
var onComplete=options.onComplete||null;
var onException=options.onException||null;
var onStateChange=options.onStateChange||null;
var update=options.update||null;
var json=options.json||false;
var xmlHttpReq=window.XMLHttpRequest?new XMLHttpRequest():(window.ActiveXObject?new ActiveXObject('Microsoft.XMLHTTP'):null);
if(!xmlHttpReq){
return;
}
xmlHttpReq.onreadystatechange=function(){
if(onStateChange){
onStateChange(xmlHttpReq);
}
if(xmlHttpReq.readyState==4&&xmlHttpReq.status==200){
if(isResponseXMLAvailable(xmlHttpReq)){
var returnCode=getNodeValue(getRootNode(xmlHttpReq),'return_code');
if(returnCode==0){
if(update){
_gel(update).innerHTML=getNodeValue(xmlHttpReq.responseXML,"html_content");
}
handleStylesheetAndJavascriptContent(xmlHttpReq);
}
}
if(onComplete){
ytXMLResponseCallback(xmlHttpReq,onComplete,onException,json);
}
}
};
xmlHttpReq.open(method,url,async);
if(method=="POST"){
xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
}
xmlHttpReq.send(postBody);
}
function isResponseXMLAvailable(xmlHttpReq){
return xmlHttpReq.responseXML!=null&&getRootNode(xmlHttpReq);
}
function getRootNode(xmlHttpReq){
return xmlHttpReq.responseXML.getElementsByTagName('root')[0];
}
function getNodeValue(obj,tag){
var node=obj.getElementsByTagName(tag);
if(node!=null&&node.length>0&&node[0].firstChild){
return node[0].firstChild.nodeValue;
}else{
return null;
}
}
function ytXMLResponseCallback(xmlHttpReq,successCallback,errorCallback,json){
if(!isResponseXMLAvailable(xmlHttpReq)){
if(xmlHttpReq.responseText){
successCallback(xmlHttpReq);
return;
}
alert("An error occured while performing this operation.");
return;
}
var rootNode=getRootNode(xmlHttpReq);
var returnCode=getNodeValue(rootNode,'return_code');
var redirectUrl=getNodeValue(rootNode,'redirect_on_success');
if(returnCode&&redirectUrl!=null){
window.location=redirectUrl;
return;
}
var message=getNodeValue(rootNode,returnCode==0?'success_message':'error_message');
if(message!=null){
alert(message);
}
var callbackParameter=json?eval(getNodeValue(getRootNode(xmlHttpReq),"html_content")):xmlHttpReq;
if(returnCode==0){
successCallback(callbackParameter);
}else{
if(errorCallback){
errorCallback(callbackParameter);
}else if(!message){
alert("An error occured while performing this operation.");
}
}
}
function handleStylesheetAndJavascriptContent(req){
var rootNode=getRootNode(req);
var css=rootNode.getElementsByTagName('css_content');
if(css.length){
css=getNodeValue(rootNode,'css_content');
var styleElement=document.createElement('style');
styleElement.setAttribute("type","text/css");
if(styleElement.styleSheet){
styleElement.styleSheet.cssText=css;
}else{
styleElement.appendChild(document.createTextNode(css));
}
document.getElementsByTagName('head')[0].appendChild(styleElement);
}
var js=rootNode.getElementsByTagName('js_content');
if(js.length){
js=getNodeValue(rootNode,'js_content');
var scriptElement=document.createElement('script');
scriptElement.text=js;
document.getElementsByTagName('head')[0].appendChild(scriptElement);
}
}
function urlEncodeDict(dict){
var result="";
for(var i=0;i<dict.length;i++){
result+="&"+encodeURIComponent(dict[i].name)+"="+encodeURIComponent(dict[i].value);
}
return result;
}
function extractFormData(form){
var formVars=new Array();
for(var i=0;i<form.elements.length;i++){
var formElement=form.elements[i];
if((formElement.type=='radio'||formElement.type=='checkbox')&&!formElement.checked){
continue;
}
var v=new Object;
v.name=formElement.name;
v.value=formElement.value;
formVars.push(v);
}
return urlEncodeDict(formVars);
}
function setFlashVars(myObjName){
var pvaTag=_gel("pvaTag").value;
_gel("FLASH_"+myObjName).SetVariable("myAdTag",pvaTag);
var canv=_gel("canv").value;
_gel("FLASH_"+myObjName).SetVariable("canv",canv);
var burl=_gel("burl").value;
_gel("FLASH_"+myObjName).SetVariable("dc_PVAurl",burl);
var hl=_gel("pvaHl").value;
_gel("FLASH_"+myObjName).SetVariable("hl",hl);
var yeurl=_gel("yeurl").value;
_gel("FLASH_"+myObjName).SetVariable("yeurl",yeurl);
var plord=_gel("plord").value;
_gel("FLASH_"+myObjName).SetVariable("plord",plord);
var tdl=_gel("tdl").value;
_gel("FLASH_"+myObjName).SetVariable("BASE_YT_URL",tdl);
_gel("FLASH_"+myObjName).SetVariable("rtg","1");
}
function pyv_google_ad_request_done(ads){
if(window.pyv_google_ad_rendered)return;
var sv_label=window.pyv_google_ad_sv_label||"Sponsored Videos";
var placeholder_id=window.pyv_google_ad_placeholder_id||"pyv-yva-placeholder";
var collapse_id=window.pyv_google_ad_collapse_id||false;
var html='';
for(var i=0;i<ads.length;i++){
var ad=ads[i],
mtd={};
if(ad.media_template_data){
for(var k=0;k<ad.media_template_data.length;k++){
if(ad.media_template_data[k].imageUrl){
mtd=ad.media_template_data[k];
}
}
}else{
mtd={
'headline':ad['line1'],
'description1':ad['line2'],
'description2':ad['line3']
};
mtd['channelName']=ad['visible_url'].substring(ad['visible_url'].lastIndexOf('/')+1);
var m=ad['url'].match(/http:\/\/www.youtube.com\/watch%3Fv%3D([\w|-]*)[%26|&]/);
var n=ad['url'].match(/%3Ffeature%3Dpyv%26v%3D([\w|-]*)[%26|&]/);
if(m&&m[1]){
var video_id=m[1];
var subdomain=1+Math.floor(Math.random()*4);
mtd['imageUrl']="http://i"+subdomain+".ytimg.com/vi/"+video_id+"/default.jpg";
}else if(n&&n[1]){
var video_id=n[1];
var subdomain=1+Math.floor(Math.random()*4);
mtd['imageUrl']="http://i"+subdomain+".ytimg.com/vi/"+video_id+"/default.jpg";
}else{
mtd['imageUrl']="http://www.youtube.com/profile_photo?username="+mtd['channelName'];
}
}
if(ads.length>1){
html+='<div'+(i<ads.length-1?' style="margin-bottom: 20px;"':'')+'>'
+'<table width="100%" cellspacing="0" cellpadding="0">'
+'<tr style="vertical-align: top;"><td class="spons-vid-thumb">'
+'<div class="v120WrapperOuter"><div class="v120WrapperInner">'
+'<a title="'+mtd['headline']+'" href="'+ad['url']+'">'
+'<img src="'+mtd['imageUrl']+'" alt="'+mtd['headline']+'" class="vimg120"/></a>'
+'<div class="addtoQL90"><a href="'+ad['url']+'">'
+'<img src="http://s.ytimg.com/yt/img/play_all-vfl69806.png"/></a></div>'
+'</div></div>'
+'</td><td style="width: 4px;"></td><td valign="top" style="padding-top: 2px;">'
+'<a style="font-weight: bold;" href="'+ad['url']+'">'+mtd['headline']+'</a><br/>'
+'<div>'+mtd['description1']+'&nbsp;'+mtd['description2']+'</div>'
+'<a href="'+ad['url']+'" style="font-size: 11px;">'+mtd['channelName']+'</a>'
+'</td></tr></tbody></table></div>';
}else if(ads.length==1){
if(mtd['imageUrl'].indexOf("/vi/")!=-1){
mtd['imageUrl']=mtd['imageUrl'].replace(/\/default.jpg/,'/hqdefault.jpg');
mtd['imageUrl']=mtd['imageUrl'].replace(/\/(\d{1}).jpg$/,'/hq$1.jpg');
}
html+='<a class="big-thumb" title="'+mtd['headline']+'" href="'+ad['url']+'">'
+'<img src="'+mtd['imageUrl']+'" alt="'+mtd['headline']+'" width="298" height="223"/>'
+'<div class="video-time"><span>Watch this video</span></div>'
+'</a>'
+'<div style="padding: 0 6px 15px 6px;">'
+'<a style="font-weight: bold;" href="'+ad['url']+'">'+mtd['headline']+'</a><br/>'
+'<div>'+mtd['description1']+'<br>'+mtd['description2']+'</div>'
+'<a href="'+ad['url']+'" style="font-size: 11px;">'+mtd['channelName']+'</a>'
+'</div>';
}
}
if(collapse_id){
hideDiv(collapse_id);
}
var pypel=document.getElementById(placeholder_id);
if(html.length&&pypel){
if(ads.length>1){
html='<div class="pyv-multiple">'+html+'</div>';
}else if(ads.length==1){
html='<div class="pyv-single">'+html+'</div>';
}
pypel.innerHTML=html+'<div class="alignC grayText" style="font-size: 10px; padding: 3px 0 15px 0">'+sv_label+'</div>';
window.pyv_google_ad_rendered=true;
}
}
function requestPyvAfsAds(){
hideDiv('ad_creative_1');
if(!is_pyv_allowed||!in_pyv_afs_exp){
return;
}
document.write('<script language="JavaScript" src="/pyv_ads" type="text/javascript"></script>');
}
function pyvAfsRequestCallback(pyv_ad_html){
var pyv_yva_div=document.getElementById('pyv-yva-placeholder');
if(pyv_ad_html.length&&pyv_yva_div){
pyv_yva_div.innerHTML=pyv_ad_html+'<div class="alignC grayText" style="font-size: 10px; padding: 3px 0 15px 0">Sponsored Videos</div>';
}
}
function requestPyvAfcAds(){
hideDiv('ad_creative_1');
if(!is_pyv_allowed){
return;
}
document.write('<script language="JavaScript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');
}
function requestPyvAds(){
if(in_pyv_afs_exp){
requestPyvAfsAds();
}else{
requestPyvAfcAds();
}
}
function showCommentReplyForm_js(form_id,reply_parent_id,is_main_comment_form,messages){
if(!isLoggedIn){
window.location="/login?next="+encodeURIComponent(window.location.href);
return false;
}
printCommentReplyForm(form_id,reply_parent_id,is_main_comment_form);
}
var commentPreviewEnabled=commentPreviewEnabled||false;
function printCommentReplyForm_js(form_id,reply_parent_id,is_main_comment_form,comment_type,bidiSupport,id_field_name,id_field_value,comment_xsrf_token,maxChars,messages){
var div_id="div_"+form_id;
var reply_id="reply_"+form_id;
var reply_comment_form="comment_form"+form_id;
var maxCharLabelId="maxCharLabel"+form_id;
var charCountId="charCount"+form_id;
var discard_visible="";
if(is_main_comment_form)
discard_visible="style='display: none'";
var previewVisible="";
if(commentPreviewEnabled){
previewVisible="display: inline;";
}else{
previewVisible="display: none;";
}
var innerHTMLContent='\
<form name="' + reply_comment_form + '" id="' + reply_comment_form + '" onSubmit="return false" method="post" action="/comment_servlet?add_comment=1&comment_type='+comment_type+'">\
<input type="hidden" name="' + id_field_name +'" value="' + id_field_value + '">\
' + comment_xsrf_token +'\
<input type="hidden" name="form_id" value="' + reply_comment_form + '">\
<input type="hidden" name="reply_parent_id" value="' + reply_parent_id + '">\
<textarea name="comment" \
cols="46" rows="5" onkeyup="updateCharCount(\'' + charCountId + '\', \'' + maxCharLabelId + '\', this); ' + bidiSupport + '"\
onpaste="updateCharCount(\'' + charCountId + '\', \'' + maxCharLabelId + '\', this);"\
oninput="updateCharCount(\'' + charCountId + '\', \'' + maxCharLabelId + '\', this);"\
></textarea>\
<input style="vertical-align:top; margin-left: 10px;' + previewVisible + '" align="left" type="button" name="preview_comment_button" \
value="Audio Preview" \
onclick="previewComment(\'' + reply_comment_form + '\');">\
<br/>\
<div style="float:left;clear:left">\
<input align="left" type="button" name="add_comment_button"\
value="' + messages['post'] + '"\
onclick="postThreadedComment(\'' + reply_comment_form + '\');" style="margin-right: 10px">\
<input align="left" type="button" name="discard_comment_button"\
value="' + messages['discard'] + '" ' + discard_visible + '\
onclick="hideCommentReplyForm(\'' + form_id + '\',false);" style="margin-right: 10px">\
<span id="' + maxCharLabelId + '">' + messages["remaining"] + '</span><input readonly="true" class="watch-comment-char-count" type="text" id="' + charCountId + '" value=' + maxChars + '>\
</div>\
</form><br style="clear:both"><br>';
if(!is_main_comment_form){
hideDiv(reply_id);
if(reply_parent_id&&_gel("comment_body_"+reply_parent_id).style.display=="none"){
displayHideCommentLink(reply_parent_id);
}
}
_gel(div_id).innerHTML=innerHTMLContent;
showDiv(div_id);
}
function updateCharCount_js(charCount_id,label_id,textArea,maxChars,messages){
if(textArea.value.length>maxChars){
if(_gel(label_id).innerHTML!=messages["exceeded"]){
_gel(label_id).innerHTML=messages["exceeded"];
}
_gel(charCount_id).value=textArea.value.length-maxChars;
}else{
if(_gel(label_id).innerHTML!=messages["remaining"]){
_gel(label_id).innerHTML=messages["remaining"];
}
_gel(charCount_id).value=maxChars-textArea.value.length;
}
}
function hideCommentReplyForm(form_id){
var div_id="div_"+form_id;
var reply_id="reply_"+form_id;
showDiv(reply_id);
hideDiv(div_id);
}
function postThreadedComment_js(comment_form_id,messages){
if(isLoggedIn==false)
return false;
var form=document.forms[comment_form_id];
if(ThreadedCommentHandler(form,comment_form_id)){
var add_button=form.add_comment_button;
add_button.value=messages["add"];
form.comment.disabled=true;
add_button.disabled=true;
}
}
function ThreadedCommentHandler_js(comment_form,comment_form_id,messages){
var comment=comment_form.comment;
var comment_button=comment_form.comment_button;
if(comment.value.length==0||comment.value==null)
{
alert(messages["empty"]);
comment.disabled=false;
comment.focus();
return false;
}
if(comment.value.length>500)
{
alert(messages["toolong"]);
comment.disabled=false;
comment.focus();
return false;
}
ajaxRequest(comment_form.action,{postBody:extractFormData(comment_form),onComplete:commentResponse});
return true;
}
function commentResponse_js(xmlHttpRequest,messages){
var response_str=xmlHttpRequest.responseText;
var response_str_tokens=response_str.split(' ');
var response_code=response_str_tokens[0];
var form_id=response_str_tokens[1];
var pms_token=response_str_tokens[2];
var form=document.forms[form_id];
var dstDiv=form.add_comment_button;
var discard_button=form.discard_comment_button;
var commentDiv=form.comment;
if(response_code=="OK"){
dstDiv.value=messages["ok"];
dstDiv.disabled=true;
discard_button.disabled=true;
discard_button.style.display="none";
if(typeof pmsForwarder!='undefined'&&pms_token){
pmsForwarder.commentedVideo(pms_token);
}
}else if(response_code=="PENDING"){
dstDiv.value=messages["pending"]
dstDiv.disabled=true;
discard_button.disabled=true;
discard_button.style.display="none";
}else if(response_code=="LOGIN"){
dstDiv.disabled=false;
}else if(response_code=="EMAIL"){
if(confirm(messages["email"])){
window.location="/email_confirm"
}
dstDiv.disabled=false;
}else{
if(response_code=="BLOCKED"){
dstDiv.disabled=true;
}else if(response_code=="TOOSOON"){
dstDiv.disabled=false;
alert(messages["toosoon"]);
}else if(response_code=="TOOLONG"){
alert(messages["toolong"]);
dstDiv.disabled=false;
commentDiv.disabled=false;
}else if(response_code=="TOOSHORT"){
alert(messages["tooshort"]);
dstDiv.disabled=false;
commentDiv.disabled=false;
commentDiv.focus();
}else if(response_code=="FAILED"){
dstDiv.disabled=true;
}else if(response_code=="FAILADDED"){
dstDiv.disabled=true;
}else if(response_code=="CAPTCHAFAIL"){
alert(messages["catpchaFail"]);
dstDiv.disabled=false;
}else{
dstDiv.disabled=false;
}
dstDiv.value=messages["default"];
}
}
function spam(comment_id,vid_id){
ajaxRequest('/comment_servlet?mark_comment_as_spam='+comment_id+"&entity_id="+vid_id,{postBody:""});
displayShowCommentLink(comment_id);
hideSpam(comment_id);
}
function hideSpam(cid){
if(_gel('reply_comment_form_id_'+cid)){
_gel('reply_comment_form_id_'+cid).style.display='none';
}
if(_gel('comment_body_'+cid)){
_gel('comment_body_'+cid).style.display='none';
}
if(_gel('comment_spam_bug_'+cid)){
_gel('comment_spam_bug_'+cid).style.display='inline';
}
}
function loginMsg_js(div_id,display_val,messages){
var login_msg_div_id="comment_msg_"+div_id;
if(display_val==1){
_gel(login_msg_div_id).innerHTML=messages["login"];
}else{
_gel(login_msg_div_id).innerHTML='';
}
}
function voteComment(comment_id,vid_id,comment_ref_id,increment){
var url_string="/comment_voting?a="+increment+"&id="+comment_id+"&video_id="+vid_id+"&old_vote="+comment_ref_id;
var vote_div_id="comment_vote_"+comment_id;
var comment_body="comment_body_"+comment_id;
var hide_link_id="hide_link_"+comment_id;
var show_link_id="show_link_"+comment_id;
if(_gel(vote_div_id).className=='watch-comment-voting-off'){
return;
}
ajaxRequest(url_string,{method:"GET",update:vote_div_id});
if(increment<0){
hideDiv(comment_body);
displayShowCommentLink(comment_id);
}
showLoadingIcon(vote_div_id);
}
function showLoadingIcon(div_id){
var temp_HTML='<img src="http://s.ytimg.com/yt/img/icn_loading_animated-vfl24663.gif">';
_gel(div_id).innerHTML=temp_HTML;
}
function voteCommentHidden(comment_id,vid_id,comment_ref_id,increment){
var comment_body_div="comment_body_"+comment_id;
var vote_div_id="comment_vote_"+comment_id;
var hide_link_id="hide_link_"+comment_id;
var show_link_id="show_link_"+comment_id;
if(_gel(vote_div_id).className=='watch-comment-voting-off'){
return;
}
if(_gel(comment_body_div).style.display=='none'){
displayHideCommentLink(comment_id);
}
else{
voteComment(comment_id,vid_id,comment_ref_id,increment);
}
}
function watchExpandComments(comments_url,comments_count){
if(comments_count&&_gel('recent_comments').innerHTML==""){
showLoading('recent_comments');
ajaxRequest(comments_url,{method:"GET",update:'recent_comments'});
}
watchCommentsPanelStateChange();
}
function watchCommentsPanelStateChange(){
yt.UserPrefs.setFlag(yt.UserPrefs.Flags.FLAG_WATCH_COLLAPSE_COMMENTS_PANEL,!isPanelExpanded(_gel('watch-comment-panel')));
yt.UserPrefs.save();
}
function showLoading(div_id){
var temp_HTML="<div style='padding-top: 100px;text-align: center; width: 100%; height: 175px;'><img src='http://s.ytimg.com/yt/img/icn_loading_animated-vfl24663.gif'></div>";
_gel(div_id).innerHTML=temp_HTML;
document.body.focus();
}
function approveComment(comment_id,comment_type,entity_id,token){
if(isLoggedIn==false)
return false;
ajaxRequest("/comment_servlet?field_approve_comment=1",{postBody:"comment_id="+comment_id+"&comment_type="+comment_type+"&entity_id="+entity_id+"&"+token,onComplete:commentApproved});
return false;
}
function removeComment(div_id,deleter_user_id,comment_id,comment_type,entity_id,token){
if(isLoggedIn==false)
return;
var callback=function(){hideDiv(div_id);};
ajaxRequest("/comment_servlet?remove_comment=1&comment_type="+comment_type+"&entity_id="+entity_id,{postBody:"deleter_user_id="+deleter_user_id+"&comment_id="+comment_id+"&"+token,onComplete:callback});
return false;
}
function unretractComment(hide_div_id,show_div_id,comment_id,comment_type,entity_id,token){
if(isLoggedIn==false)
return false;
var callback=function(){
hideDiv(hide_div_id);
showDiv(show_div_id);
};
ajaxRequest("/comment_servlet?unretract_comment=1",{postBody:"comment_id="+comment_id+"&comment_type="+comment_type+"&entity_id="+entity_id+"&v="+entity_id+"&"+token,onComplete:callback});
return false;
}
var previewCommentSwfReady=false;
var previewCommentText="";
function previewComment(form_id){
previewCommentText=_gel(form_id)['comment'].value;
var pcb=_gel(form_id)["preview_comment_button"];
var oldValue=pcb.value;
pcb.value="Audio Preview...";
pcb.disabled=true;
window.setTimeout(function(){
pcb.value=oldValue;
pcb.disabled=false;
previewCommentAvailable=true;
},4000);
if(previewCommentSwfReady){
onPreviewCommentReady();
}else{
var previewSwf=new SWFObject('http://s.ytimg.com/yt/swf/textreader-vfl58814.swf',"preview_comment","1","1",8);
previewSwf.addParam("AllowScriptAccess","always");
if(swfArgs['BASE_YT_URL']){
previewSwf.addVariable('BASE_YT_URL',swfArgs['BASE_YT_URL']);
}
previewSwf.addVariable('t',previewCommentToken);
previewSwf.write(_gel("preview-comment-swf-div"));
}
}
var previewCommentAvailable=true;
function onPreviewCommentReady(){
if(previewCommentAvailable){
previewCommentSwfReady=true;
var text=previewCommentText.split('\n').join(' ');
_gel("preview_comment").speakText(text);
}
}
function displayHideCommentLink(comm_id){
var header_div="comment_header_"+comm_id;
var comment_body_div="comment_body_"+comm_id;
var comment_vote_div="comment_vote_"+comm_id;
var span_hide_id="hide_link_"+comm_id;
var span_show_id="show_link_"+comm_id;
showDiv(comment_body_div);
_gel(span_show_id).style.visibility='hidden';
hideDiv(span_show_id);
showDiv(span_hide_id);
_gel(span_hide_id).style.visibility='visible';
if(_gel(header_div)){
_gel(header_div).className="watch-comment-head";
}
_gel(comment_vote_div).className="watch-comment-voting";
}
function displayShowCommentLink(comm_id){
var header_div="comment_header_"+comm_id;
var comment_body_div="comment_body_"+comm_id;
var comment_vote_div="comment_vote_"+comm_id;
var span_hide_id="hide_link_"+comm_id;
var span_show_id="show_link_"+comm_id;
hideDiv(comment_body_div);
_gel(span_hide_id).style.visibility='hidden';
hideDiv(span_hide_id);
showDiv(span_show_id);
_gel(span_show_id).style.visibility='visible';
if(_gel(header_div)){
_gel(header_div).className="watch-comment-head-hidden opacity80";
}
_gel(comment_vote_div).className="watch-comment-voting-off";
}
var videoResponseCurrentIndex=0;
function rotateVideoResponses(increment,containerId,paneCount,scrollerEffect){
performDelayLoad('video_bar');
var containerBox=_gel('video-bar-container-box-'+containerId);
var longBox=_gel('video-bar-long-box-'+containerId);
var currentMarginLeft=parseInt(longBox.style.marginLeft);
if((increment&&currentMarginLeft==(paneCount-1)*containerBox.clientWidth*-1)||(!increment&&currentMarginLeft==0)){
return;
}
scrollerEffect.custom(currentMarginLeft,currentMarginLeft+(increment?-1:1)*containerBox.clientWidth);
}
function writeMoviePlayer(player_div,force,version_required,opt_callbackName,opt_width,opt_height,opt_color){
var width=opt_width||"480";
var height=opt_height||"385";
var color=opt_color||"#000000";
var v="7";
var useExpressInstall=false;
if(force){
v="0";
}else if(version_required){
v=version_required;
useExpressInstall=true;
}
var fo=new SWFObject(swfUrl,"movie_player",width,height,v,color);
if(useExpressInstall&&typeof(expressInstallUrl)!="undefined"){
fo.useExpressInstall(expressInstallUrl);
}
fo.addParam("allowFullscreen","true");
if(window!=window.top){
function checkRef(ref){
var a=ref.split('/',3);
if(a.length>=3&&a[0]=='http:'&&a[1]==''){
a=a[2].split('.').reverse();
if(a.length<2)return false;
var d0=a[0];
var d1=a[1];
if(d1=='youtube'&&d0=='com')return true;
if(d1=='google')return true;
if(a.length<3)return false;
if(a[2]=='google'&&((d1=='co'&&d0=='uk')||(d1=='com'&&d0=='au')))return true;
}
return false;
}
var frameref=document.referrer.substring(0,128);
if(!checkRef(frameref)){
swfArgs.framer=encodeURIComponent(frameref);
}
}
for(var x in swfArgs){
fo.addVariable(x,swfArgs[x]);
}
if(watchGamUrl!=null){
fo.addVariable("gam",watchGamUrl);
}
if(watchDCUrl!=null){
fo.addVariable("ad_tag",watchDCUrl);
}
if(!watchIsPlayingAll){
fo.addVariable("playnext",0);
}
if(watchSetWmode){
fo.addParam("wmode","opaque");
}
if(ad_eurl){
fo.addVariable("ad_eurl",ad_eurl);
}
fo.addVariable("enablejsapi",1);
if(opt_callbackName){
fo.addVariable("jsapicallback",opt_callbackName);
}
fo.addParam("AllowScriptAccess","always");
player_written=fo.write(player_div);
return fo;
}
function openFull(){
var fs=window.open(fullscreenUrl,
"FullScreenVideo","toolbar=no,width="+screen.availWidth+",height="+screen.availHeight
+",status=no,resizable=yes,fullscreen=yes,scrollbars=no");
fs.focus();
}
function checkCurrentVideo(videoId,offset){
if(playnextFrom&&watchIsPlayingAll){
if(window.randomVideoId){
if(pageVideoId!=randomVideoId){
var newUrl=window.location.href.replace(/v=[^&#]*/,"v="+videoId);
newUrl=newUrl.replace(/&index=[0-9]*/,'');
window.location=newUrl;
}
}else{
var row;
if(typeof(offset)!="undefined"){
row=getNextListRow(false,offset);
}else{
row=findPlaylistRowByVideoId(videoId,playnextFrom);
}
window.location=getUrlFromPlaylistRow(row);
}
}else{
if(pageVideoId!=videoId){
window.location.href="/watch?v="+videoId;
}
}
}
function trackAnnotationsEvent(action,opt_label,opt_value){
annotationsTracker._trackEvent(action,opt_label,opt_value);
}
var g_YouTubePlayerIsReady=false;
function onYouTubePlayerReady(playerId){
g_YouTubePlayerIsReady=true;
var player=_gel("movie_player");
player.addEventListener("onStateChange","handleWatchPagePlayerStateChange");
player.addEventListener("onPlaybackQualityChange","onPlayerFormatChanged");
onPlayerFormatChanged(player.getPlaybackQuality());
}
function handleWatchPagePlayerStateChange(newState){
if(newState==0){
try{
autoGotoNextVideoOnVideoDone();
}catch(err){
if(watchIsPlayingAll){
gotoNext();
}
}
}
}
var widePlayerMode=false;
function toggleWidePlayer(newMode){
var thisVidDiv=_gel('watch-this-vid');
var otherVidsDiv=_gel('watch-other-vids');
if(newMode!=widePlayerMode){
widePlayerMode=newMode;
if(widePlayerMode){
addClass(thisVidDiv,"watch-wide-mode");
addClass(otherVidsDiv,"watch-wide-mode");
}else{
removeClass(thisVidDiv,"watch-wide-mode");
removeClass(otherVidsDiv,"watch-wide-mode");
}
}
}
yt.VideoQualityConstants={
AUTO:0,
LOW:1,
HIGH:2
}
var videoQualityDisplayEnabled=false;
var lastReportedVideoQuality=null;
function enableVideoQualityDisplay(){
videoQualityDisplayEnabled=true;
if(lastReportedVideoQuality!=null){
onPlayerFormatChanged(lastReportedVideoQuality);
}
}
function onPlayerFormatChanged(vq){
if(!videoQualityDisplayEnabled){
lastReportedVideoQuality=vq;
return;
}
switch(vq){
case yt.VideoQualityConstants.LOW:
urchinTracker('/Events/VideoWatch/QualityChangeToLow');
break;
case yt.VideoQualityConstants.HIGH:
urchinTracker('/Events/VideoWatch/QualityChangeToHigh');
break;
}
if(isHDAvailable){
toggleWidePlayer(vq==yt.VideoQualityConstants.HIGH);
}
}
function movie_player_DoFSCommand(command,args){
if(command=="onPlayerFormatChanged"){
onPlayerFormatChanged(args);
}
}
function seekTo(time){
var p=_gel("movie_player");
p.seekTo(time,true);
smoothScrollIntoView(p,50);
p.playVideo();
}
var g_currentHashValue='';
var g_currentHashArgs={};
function pollLocationHash(){
if(!g_YouTubePlayerIsReady){
return;
}
var newHashValue=document.location.hash.substr(1);
if(newHashValue!=g_currentHashValue){
g_currentHashValue=newHashValue;
var newHashArgs=parseHashArgs(newHashValue);
if(newHashArgs['t']&&newHashArgs['t']!=g_currentHashArgs['t']){
var time=hashTextToTime(newHashArgs['t']);
if(time!=null){
var p=_gel("movie_player");
p.seekTo(time,true);
p.playVideo();
}
}
g_currentHashArgs=newHashArgs;
}
}
window.setInterval(pollLocationHash,1000);
function parseHashArgs(hashText){
var parts=hashText.split("&");
var args={};
for(var i=0;i<parts.length;i++){
var nameValue=parts[i].split('=');
if(nameValue.length==2){
args[nameValue[0]]=nameValue[1];
}
}
return args;
}
function hashTextToTime(hashText){
var hashTime=0;
var temp;
if(hashText.indexOf('h')!=-1){
temp=hashText.split('h');
hashTime=(temp[0]*60*60);
hashText=temp[1];
}
if(hashText.indexOf('m')!=-1){
temp=hashText.split('m');
hashTime=(temp[0]*60)+hashTime;
hashText=temp[1];
}
if(hashText.indexOf('s')!=-1){
temp=hashText.split('s');
hashTime=(temp[0]*1)+hashTime;
}else{
hashTime=(hashText*1)+hashTime;
}
return hashTime;
}
function watchSelectTab(tab){
var el=tab.parentNode.firstChild;
while(el){
removeClass(el,'watch-tab-sel');
el=el.nextSibling;
}
addClass(tab,'watch-tab-sel');
el=_gel(tab.id+'-body').parentNode.firstChild;
while(el){
removeClass(el,'watch-tab-sel');
el=el.nextSibling;
}
addClass(_gel(tab.id+'-body'),'watch-tab-sel');
var anchor=tab.getElementsByTagName('A');
anchor[0].blur();
}
function resetSharing(){
hideDiv('watch-share-video-div');
hideDiv('shareMessageQuickDiv');
hideDiv('watch-share-blog-quick');
showDiv('aggregationServicesDiv');
toggleMoreShare('fewer-options','more-options');
}
function toggleMoreShare(hide,show){
hideDiv(hide);
showDiv(show);
}
function processShareVideo(eVideoID,divID,component,opt_logging){
shareVideo(eVideoID,divID,component);
showDiv('aggregationServicesDiv');
toggleMoreShare('more-options','fewer-options');
ajaxRequest("/sharing_services?name=MORE_SHARING_OPTIONS&v="+eVideoID+(opt_logging?'&'+opt_logging:''),{method:"GET"});
return false;
}
function shareVideo(videoId,divID,component,opt_blogInfoID){
var locale=window.ytLocale||'en_US';
var el=_gel(divID);
var action='video_id='+videoId;
if(component=='all'&&locale){
closeShareAll(divID);
toggleDisplay(divID);
toggleMoreShare('more-options','fewer-options');
action=action+'&locale='+locale+'&action_get_share_video_component=1';
}else if(component=='email'){
closeMoreShareIfOpen();
closeShareAll(divID);
toggleDisplay(divID);
action=action+'&action_get_share_message_component=1';
}else if(component=='blog'&&opt_blogInfoID){
closeMoreShareIfOpen();
closeShareAll(divID);
toggleDisplay(divID);
action=action+'&blog_info_id='+opt_blogInfoID+'&action_get_share_blog_component=1';
}
showDiv('aggregationServicesDiv');
if(el.style.display!="none"){
if(el.loaded===undefined){
var onSuccess=function(){
el.loaded=true;
if(opt_blogInfoID){
el.currBlog=opt_blogInfoID;
}
}
var onFailure=function(){
el.loaded=undefined;
hideDiv(divID);
}
ajaxRequest('/watch_ajax?'+action,{method:"GET",onComplete:onSuccess,onException:onFailure,update:divID});
}
else if(opt_blogInfoID){
if(el.currBlog!=opt_blogInfoID){
ajaxRequest('/watch_ajax?'+action,{method:"GET",update:divID});
el.currBlog=opt_blogInfoID;
}
}
urchinTracker('/Events/VideoWatch/ShareVideo/'+component);
}
if(isLoggedIn){
urchinTracker('/Events/VideoWatch/ActionTab/ShareVideo/Loggedin');
}else{
urchinTracker('/Events/VideoWatch/ActionTab/ShareVideo/Loggedout');
}
}
function closeShareAll(except){
var divs=['watch-share-video-div','watch-share-blog-quick','shareMessageQuickDiv','shareVideoEmailDiv'];
for(var i=0;i<divs.length;i++){
if((divs[i]!=except)&&(_gel(divs[i]))){
var theDiv=_gel(divs[i]);
if(theDiv){
theDiv.style.display="none";
}
}
}
}
function closeMoreShareIfOpen(){
if((_gel('watch-share-video-div').style.display!='none')){
toggleMoreShare('fewer-options','more-options');
}
}
function shareVideoClose(){
if(_gel('watch-share-video-div').style.display!="none"){
toggleDisplay('watch-share-video-div');
}else{
toggleDisplay('shareMessageQuickDiv');
}
toggleMoreShare('fewer-options','more-options');
toggleDisplay('shareVideoResult');
hideDivAfter('shareVideoResult',3000);
}
function recordServiceUsage(service_name,video_id,locale,opt_logging){
ajaxRequest("/sharing_services?name="+encodeURIComponent(service_name)+"&v="+video_id+"&locale="+locale+(opt_logging?'&'+opt_logging:''),{method:"GET"});
}
function shareVideoFromFlash(){
watchSelectTab(_gel('watch-tab-share'));
urchinTracker('/Events/VideoWatch/ShareVideoFromFlash');
if(hasClass(_gel('watch-tab-share'),'watch-tab-sel')&&_gel('watch-share-video-div').style.display!='block'){
processShareVideo(pageVideoId,'watch-share-video-div','all');
}else{
resetSharing();
}
smoothScrollIntoView(_gel("watch-share-video-div"),20);
}
function smoothScrollIntoView(node,padding){
if(!padding){
padding=0;
}
var nodeTop=getPageOffsetTop(node);
window.scrollTo(0,nodeTop-padding);
}
function getPageOffsetTop(element){
if(document.documentElement["getBoundingClientRect"]){
var bound=element.getBoundingClientRect();
return bound.top;
}else{
var curtop=0;
if(element.offsetParent){
curtop=element.offsetTop;
while(element=element.offsetParent){
curtop+=element.offsetTop;
}
}
return curtop;
}
}
function addToFaves(formName,event){
watchSelectTab(_gel('watch-tab-favorite'));
if(isLoggedIn){
showDiv('watch-add-faves-loading');
hideDiv('watch-add-faves-result');
hideDiv('watch-remove-faves');
hideDiv('watch-add-faves');
hideDiv('watch-add-to-faves-switch');
hideDiv('watch-remove-faves-wrapper');
hideDiv('watch-add-faves-wrapper');
var onSuccess=function(xmlHttpReq){
var pms_token=getNodeValue(getRootNode(xmlHttpReq),"notify_token");
if(typeof pmsForwarder!='undefined'&&pms_token){
pmsForwarder.favoritedVideo(pms_token);
}
hideDiv('watch-add-faves-div');
showDiv('watch-add-faves-result');
showDiv('watch-remove-faves');
hideDiv('watch-add-faves');
showDiv('watch-add-to-faves-switch');
showDiv('watch-remove-faves-wrapper');
hideDiv('watch-add-faves-wrapper');
hideDiv('watch-add-faves-loading');
};
var onFailure=function(){
hideDiv('watch-add-faves-div');
hideDiv('watch-add-faves');
hideDiv('watch-add-faves-wrapper');
hideDiv('watch-add-faves-loading');
watchSelectTab(_gel('watch-tab-share'));
};
var form=document.forms[formName];
ajaxRequest(form.action,{postBody:extractFormData(form),onComplete:onSuccess,onException:onFailure});
_gel('watch-action-favorite-link').blur();
urchinTracker('/Events/VideoWatch/ActionTab/AddToFavs/Loggedin');
}
else{
showDiv('addToFavesLogin');
urchinTracker('/Events/VideoWatch/ActionTab/AddToFavs/Loggedout');
}
}
function removeFromFaves(formName,event){
showDiv('watch-add-faves');
hideDiv('watch-remove-faves');
showDiv('watch-add-faves-wrapper');
hideDiv('watch-remove-faves-wrapper');
var callback=function(xhr){hideDiv('watch-remove-faves-div');};
var form=document.forms[formName];
ajaxRequest(form.action,{postBody:extractFormData(form),onComplete:callback,onException:callback});
_gel('watch-action-favorite-link').blur();
urchinTracker('/Events/VideoWatch/ActionTab/RemoveFromFavs/Loggedin');
}
var gWatchPlaylistLoading='';
function addToPlaylist(videoId,event){
watchSelectTab(_gel('watch-tab-playlists'));
if(isLoggedIn){
if(!gWatchPlaylistLoading){
gWatchPlaylistLoading=_gel('addToPlaylistDiv').innerHTML;
}else{
_gel('addToPlaylistDiv').innerHTML=gWatchPlaylistLoading;
}
showDiv('addToPlaylistDiv');
ajaxRequest('/watch_ajax?video_id='+videoId+'&action_get_playlists_component=1',{method:"GET",update:'addToPlaylistDiv'});
urchinTracker('/Events/VideoWatch/ActionTab/AddToPlaylists/Loggedin');
}else{
showDiv('addToPlaylistLogin');
urchinTracker('/Events/VideoWatch/ActionTab/AddToPlaylists/Loggedout');
}
}
function reportConcern(videoId,event){
var divs=['reportConcernResult1','reportConcernResult2','reportConcernResult3','reportConcernResult4','reportConcernResult5'];
for(var i=0;i<divs.length;i++){
var theDiv=_gel(divs[i]);
if(theDiv){
theDiv.style.display='none';
}
}
watchSelectTab(_gel('watch-tab-flag'));
if(isLoggedIn){
showDiv('inappropriateVidDiv');
if(_gel('inappropriateVidDiv').innerHTML.toLowerCase().indexOf('<div')!=-1){
return;
}
var callback=function(){
_gel('inappropriateMsgsDiv').innerHTML=_gel('inappropriateMsgs').innerHTML;
_gel('inappropriateMsgs').innerHTML='';
showDiv('inappropriateMsgsDiv');
};
ajaxRequest('/watch_ajax?video_id='+videoId+'&action_get_flag_video_component=1',{method:"GET",onComplete:callback,update:'inappropriateVidDiv'});
urchinTracker('/Events/VideoWatch/ActionTab/Flag/Loggedin');
}
else{
showDiv('inappropriateMsgsLogin');
urchinTracker('/Events/VideoWatch/ActionTab/Flag/Loggedout');
}
}
function showDownloadVideo(videoId,event){
watchSelectTab(_gel('watch-tab-download'));
showDiv('watch-tab-download-body');
}
function watchExpandStatBody(){
if(_gel('watch-tab-stats-body').innerHTML.toLowerCase().indexOf('<div')==-1){
ajaxRequest(additionalStatsHonorsUrl,{method:"GET",update:'watch-tab-stats-body'});
}
}
var subscribeTimer;
function subscribe(username,token,show_recommendations,show_sub_channels){
if(isLoggedIn){
window.clearTimeout(subscribeTimer);
var callback=function(result){
var subscribeMsgNode=_gel('subscribeMessage');
subscribeMsgNode.innerHTML=getNodeValue(getRootNode(result),'html_content');
subscribeMsgNode.style.display='block';
addClass(_gel('subscribeDiv'),'hid');
removeClass(_gel('unsubscribeDiv'),'hid');
if(!show_recommendations&&!show_sub_channels){
subscribeTimer=window.setTimeout("hideDiv('subscribeMessage')",5000);
}
};
ajaxRequest('/ajax_subscriptions?subscribe_to_user='+username,{postBody:'session_token='+token+(show_recommendations?'&show_recommendations':'')+(show_sub_channels?'&show_sub_channels':''),onComplete:callback});
urchinTracker('/Events/VideoWatch/Subscription/'+username+'/Loggedin');
}else{
var subscribeMsgNode=_gel('subscribeLoginInvite');
subscribeMsgNode.style.display='block';
urchinTracker('/Events/VideoWatch/Subscription/'+username+'/Loggedout');
}
}
function unsubscribe(username,token){
window.clearTimeout(subscribeTimer);
var callback=function(result){
var subscribeMsgNode=_gel('subscribeMessage');
subscribeMsgNode.innerHTML=getNodeValue(getRootNode(result),'html_content');
subscribeMsgNode.style.display='block';
removeClass(_gel('subscribeDiv'),'hid');
addClass(_gel('unsubscribeDiv'),'hid');
subscribeTimer=window.setTimeout("hideDiv('subscribeMessage')",5000);
};
ajaxRequest('/ajax_subscriptions?unsubscribe_from_user='+username,{postBody:'session_token='+token,onComplete:callback});
}
function customizeEmbed(isWidescreenVideo,forceShow){
var loadHtml=false;
if(forceShow){
setDisplay('watch-customize-embed-div',true);
loadHtml=true;
}else{
toggleDisplay('watch-customize-embed-div');
loadHtml=isDisplayed('watch-customize-embed-div');
}
if(loadHtml){
if(_gel('watch-customize-embed-div').innerHTML.toLowerCase().indexOf('<div')!=-1){
return;
}
ajaxRequest('/watch_ajax?action_customize_embed=1'+(isWidescreenVideo?'&wide=1':''),{method:"GET",onComplete:function(){applyUserPrefs();},update:'watch-customize-embed-div'});
}
}
function generateEmbed(){
var query='';
if(yt.UserPrefs.getFlag(yt.UserPrefs.Flags.FLAG_EMBED_NO_RELATED_VIDEOS)){
query+='&rel=0';
}
var color=yt.UserPrefs.get('emt');
if(color!='blank'&&color!=''){
var hexColors=gCustomEmbedThemes[color].split(' ');
query+='&color1=0x'+hexColors[0]+'&color2=0x'+hexColors[1];
}
embedUrl=yt.UserPrefs.getFlag2(yt.UserPrefs.Flags.FLAG2_EMBED_DELAYED_COOKIES)?embedUrl.replace("youtube.com","youtube-nocookie.com"):embedUrl.replace("youtube-nocookie.com","youtube.com");
var showBorder=yt.UserPrefs.getFlag(yt.UserPrefs.Flags.FLAG_EMBED_SHOW_BORDER);
query+=showBorder?'&border=1':'';
var embedSizes=getEmbedSize();
var width=embedSizes[0];
var height=embedSizes[1];
var embedCode='<object width="'+width+'" height="'+height+'"><param name="movie" value="'+embedUrl+query+'"><\/param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'+embedUrl+query+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+width+'" height="'+height+'"><\/embed><\/object>';
document.embedForm.embed_code.value=embedCode;
}
function getEmbedSize(opt_size){
var embedSize=yt.UserPrefs.get('ems')||'default';
if(opt_size){
embedSize=opt_size;
}
var customEmbedSizes=(isWidescreen)?gCustomEmbedSizesWide:gCustomEmbedSizes;
var showBorder=yt.UserPrefs.getFlag(yt.UserPrefs.Flags.FLAG_EMBED_SHOW_BORDER);
var width=parseInt(customEmbedSizes[embedSize].split(" ")[0]);
var height=parseInt(customEmbedSizes[embedSize].split(" ")[1]);
if(showBorder){
width+=20;
height+=20;
}
return[width,height];
}
var delayLoadRegistry=delayLoadRegistry||[];
var delayLoadCompleted=delayLoadCompleted||[];
function delayLoad(id,img,src){
delayLoadRegistry[delayLoadRegistry.length]=[id,img,src];
delayLoadCompleted[id]=false;
}
function performDelayLoad(id){
if(!delayLoadCompleted[id]){
delayLoadCompleted[id]=true;
for(var i=0;i<delayLoadRegistry.length;i++){
if(delayLoadRegistry[i][0]==id){
delayLoadRegistry[i][1].onload="";
delayLoadRegistry[i][1].src=delayLoadRegistry[i][2];
}
}
}
}
function toggleChannelVideos(username){
if(!_gel('watch-channel-video-list-loading-div')){
ajaxRequest('/watch_ajax?user='+username+'&video_id='+pageVideoId+'&action_channel_videos',{method:"GET",update:'watch-channel-vids-body'});
}
return false;
}
function showRelatedAsList(doAjaxCall){
if(doAjaxCall){
_gel('watch-related-vids-body').innerHTML=MSG_Loading;
ajaxRequest(relatedVideoListUrl,{method:"GET",update:'watch-related-vids-body'});
}
}
var first_time=1;
function changeBanner(img_url,ref_url,is_flash){
var e=_gel("gad_leaderboardAd");
if(first_time){
e.style.height="90px";
first_time=0;
}
var url="";
if(is_flash=="true"){
url+="<object width='72"+"8' height='9"+"0'>";
url+="<"+"param value='clickTAG="+encodeURIComponent(ref_url)+"' /"+">";
url+="<"+"embed src='"+img_url+"'";
url+=" type='application/x-shockwave-flash' wmode='transparent'";
url+=" flashvars='clickTAG="+encodeURIComponent(ref_url)+"'";
url+=" width='72"+"8' height='9"+"0' /"+">";
url+="</object>";
}else{
url="<"+"a href='"+ref_url+"' target='_blank'>";
url+="<img src='"+img_url+"'>";
url+="</a>";
}
e.innerHTML=url;
}
var dartOrd=Math.floor(Math.random()*10000000);
function setCompanionAndOrd(ad_tag,show_ad){
ad_tag=ad_tag+'ord='+dartOrd;
setCompanion(ad_tag,show_ad);
}
function setCompanion(ad_tag,show_ad){
if(show_ad=='true'){
ad_tag=ad_tag+'?';
showDiv("watch-channel-brand-div");
_gel("ad300x250").innerHTML='<iframe src="'+ad_tag+'" name="ifr_300x250ad" id="ifr_300x250ad" width="300" height="250" marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no>'+'<'+'/iframe>';
setJSReadyState();
}
}
function setInstreamCompanion(ad_tag){
ad_tag=ad_tag+'?';
showDiv("watch-longform-ad");
_gel("watch-longform-ad-placeholder").innerHTML='<iframe src="'+ad_tag+'" name="ifr_300x60ad" id="ifr_300x60ad" width="300" height="60" marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no>'+'<'+'/iframe>';
}
var flashPlayerReadyState=false;
function setFlashPlayerReadyState(){
flashPlayerReadyState=true;
if(jsReadyState){
setReadyToGoInFlash();
}
}
var jsReadyState=false;
function setJSReadyState(){
jsReadyState=true;
if(flashPlayerReadyState){
setReadyToGoInFlash();
}
}
function setReadyToGoInFlash(){
_gel("movie_player").SetVariable("dartOrd",dartOrd);
_gel("movie_player").SetVariable("dcRtg","1");
}
function closeInPageAdIframe(){
hideDiv("ad300x250");
_gel("google_companion_ad_div").style.height="250px";
}
function setLongformCompanion(linkedImg){
var adDiv=_gel("watch-longform-ad");
var adholder=_gel("watch-longform-ad-placeholder");
if(linkedImg){
adDiv.style.visibility='visible';
adholder.innerHTML=linkedImg;
}else{
adDiv.style.visibility='hidden';
}
}
function setFreewheelCompanion(type,content){
var fwContent=unescape(content);
_gel("ad300x250").innerHTML='<iframe name="fw_300x250ad" id="fw_300x250ad" width="300" height="250" marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no>'+'<'+'/iframe>';
var targetFrame=document.getElementById("fw_300x250ad");
targetFrame=(targetFrame.contentWindow)?targetFrame.contentWindow:(targetFrame.contentDocument.document)?targetFrame.contentDocument.document:targetFrame.contentDocument;
var userAgent=navigator.userAgent.toLowerCase()
var isIe=(userAgent.indexOf("msie")!=-1);
var isOpera=(userAgent.indexOf("opera")!=-1);
var isFirefox=(userAgent.indexOf("firefox")!=-1);
if(0&&isFirefox&&fwContent.length<2000){
var ec=escape(fwContent);
var fw_iframe_url="http://m2.feiwei.tv/g/lib/template/echo.html?s="+ec;
document.getElementById("fw_300x250ad").src=fw_iframe_url;
}else{
targetFrame.document.open();
targetFrame.document.write(fwContent);
if(isIe||isOpera){
frameDoc=targetFrame;
setTimeout(function(){fw_close(frameDoc)},7500);
}else{
targetFrame.document.close()
}
}
showDiv("watch-channel-brand-div");
}
function fw_close(theFrame){
theFrame.document.close();
}
function performPyvClick(pyvCookieName){
var pyvAdUrl=readCookie(pyvCookieName);
if(!pyvAdUrl){
return;
}
if(!verifyPyvAdUrl(pyvAdUrl)){
eraseCookie(pyvCookieName);
return;
}
pingUrlViaImage(pyvAdUrl);
eraseCookie(pyvCookieName);
}
function verifyPyvAdUrl(ad_url){
var matches=ad_url.match(/.*\/aclk.*q=([^&]*)/);
var landing_url=matches&&matches[1];
if(!landing_url){
return false;
}
var curr_id=extractCurrentVideoId()||extractCurrentChannel();
if(!curr_id){
return false;
}
if(landing_url.indexOf(curr_id)>0){
return true;
}
return false;
}
function extractCurrentVideoId(){
var matches=window.location.href.match(/.*\.com\/watch.*v=([^&]*)/);
return matches&&matches[1];
}
function extractCurrentChannel(){
var matches=window.location.href.match(/.*\.com\/(?:user\/)?([a-zA-Z0-9]*)/);
return matches&&matches[1];
}
function pingUrlViaImage(dest_url){
var img=new Image();
img.src=dest_url;
img.height=1;
img.width=1;
document.body.appendChild(img);
}
function reportFlashTiming(timings,opt_fmt){
if(typeof opt_fmt!='undefined'){
window['jstiming']['fmt']=opt_fmt;
}
var timingsCount=timings.length/ 2;
var action=window['jstiming']['default_action'];
for(var i=0;i<timingsCount;i++){
window['jstiming']['timers'][action][timings[2*i]]=timings[2*i+1];
}
if(csiMaybeSendReport){
csiMaybeSendReport();
}
}
function toggleAdvSearch(search_query,geo_name,geo_latlong,search_duration,search_hl,search_categories,search_sort,search_uploaded){
toggleClass(_gel('search-advanced-form'),'hid');
if(_gel('search-advanced-form').innerHTML.toLowerCase().indexOf('<form')!=-1){
return false;
}
var params=new Object();
params['action_advanced']='1';
params['search_query']=search_query;
params['geo_name']=geo_name;
params['geo_latlong']=geo_latlong;
params['search_duration']=search_duration;
params['search_hl']=search_hl;
params['search_sort']=search_sort;
params['search_uploaded']=search_uploaded;
var url=buildUrl('/results_ajax',params);
var categories=search_categories.split(',');
for(var i=0;i<categories.length;i++){
url+='&search_category='+categories[i];
}
var callback=function(){
var flg=yt.UserPrefs.Flags;
var setting=yt.UserPrefs.getFlag(flg.FLAG_SAFE_SEARCH);
_gel('search-filter-checkbox').checked=setting;
setting=gGoogleSuggest||yt.UserPrefs.getFlag(flg.FLAG_SUGGEST_ENABLED);
_gel('search-suggest-checkbox').checked=setting;
function getFlg2(bit){
return yt.UserPrefs.getFlag2(bit);
}
setting=!(getFlg2(flg.FLAG2_HD_TIP_DEMOTE)||
getFlg2(flg.FLAG2_NEWS_TIP_DEMOTE)||
getFlg2(flg.FLAG2_UPLOAD_RESTRICT_TIP_DEMOTE));
_gel('search-tip-checkbox').checked=setting;
};
ajaxRequest(url,{method:"GET",onComplete:callback,update:'search-advanced-form'});
return false;
}
var videolist=new Array();
function append_token_for_queue(queryParams){
queryParams=queryParams||"";
return queryParams+'&'+gXSRF_ql_pair;
}
function mouseOverQuickAdd(img){
if(!img.className.match('Done')){
removeClass(img,'QLIconImg');
removeClass(img,'QLIconImgDone');
addClass(img,'QLIconImgOver');
}
}
function mouseOutQuickAdd(img){
if(!img.className.match('Done')){
removeClass(img,'QLIconImgOver');
removeClass(img,'QLIconImgDone');
addClass(img,'QLIconImg');
}
}
function quicklistAddedUpdateImage(img){
removeClass(img,'QLIconImg');
removeClass(img,'QLIconImgOver');
addClass(img,'QLIconImgDone');
img.blur();
hideDiv(img);
showDiv(getQuicklistInlist(img));
}
function getQuicklistUtility(){
return self.utilLinksFrame?self.utilLinksFrame.document.getElementById('quicklist-utility'):_gel('quicklist-utility');
}
function getQuicklistInlist(img){
return(getElementsByTagNameAndClass('DIV','quicklist-inlist',img.parentNode.parentNode))[0];
}
var gQuicklistTimeoutId=null;
function updateQuicklistMasthead(increaseBy){
var qUtil=getQuicklistUtility();
if(qUtil){
if(increaseBy==0){
qUtil.innerHTML="0";
}else{
qUtil.innerHTML=parseInt(qUtil.innerHTML)+increaseBy;
}
}else{
return;
}
if(gQuicklistTimeoutId){
window.clearTimeout(gQuicklistTimeoutId);
gQuicklistTimeoutId=null;
}
quicklistMastheadBlinkHelper(1);
}
function quicklistMastheadBlinkHelper(on){
var qUtil=getQuicklistUtility();
qUtil.style.backgroundColor=on%2?'#ff0':'#fff';
++on;
if(on<=10){
gQuicklistTimeoutId=window.setTimeout(function(){quicklistMastheadBlinkHelper(on);},500);
}
}
function onQuickAddClick(imgClicked,encryptedId,thumbSrc,thumbTitle){
if(isPlaylistCssAndJsLoaded){
onQuickAddClickCallback(imgClicked,encryptedId,thumbSrc,thumbTitle);
}else{
isPlaylistCssAndJsLoaded=true;
var scriptElement=document.createElement('script');
scriptElement.src='http://s.ytimg.com/yt/js/watch_queue2-vfl86041.js';
document.getElementsByTagName('head')[0].appendChild(scriptElement);
function jsCallback(imgClicked,encryptedId,thumbSrc,thumbTitle){
if(typeof(onQuickAddClickCallback)!='undefined'){
onQuickAddClickCallback(imgClicked,encryptedId,thumbSrc,thumbTitle);
}else{
var func=function(){jsCallback(imgClicked,encryptedId,thumbSrc,thumbTitle)};
window.setTimeout(func,100);
}
}
var callback=function(req){
jsCallback(imgClicked,encryptedId,thumbSrc,thumbTitle);
};
ajaxRequest('/watch_ajax?action_get_playlist_css=1',{method:"GET",onComplete:callback});
}
return false;
}
var quicklistVideoIds=[];
function clicked_add_icon(imgClicked,videoId,fromRelated,thumbSrc,thumbTitle){
for(var x=0;x<quicklistVideoIds.length;++x){
if(quicklistVideoIds[x]==videoId){
return;
}
}
updateQuicklistMasthead(1);
if(typeof(toolbarEnabled)!='undefined'&&toolbarEnabled){
toolbar.addToQueue(imgClicked,videoId,thumbSrc,thumbTitle);
}
quicklistVideoIds.push(videoId);
add_to_watch_queue(videoId);
quicklistAddedUpdateImage(imgClicked);
}
function add_to_watch_queue(videoId){
videolist.push(videoId);
post_videos_to_server();
}
function post_videos_to_server(){
if(videolist.length>0){
ajaxRequest("/watch_queue_ajax?action_add_to_queue&video_id="+videolist[videolist.length-1],{postBody:append_token_for_queue(),onComplete:videoQueued});
videolist.pop();
}
}
function videoQueued(xmlHttpRequest){
var xmlObj=xmlHttpRequest.responseXML;
if(xmlObj!=null&&getNodeValue(xmlObj,"msg")!="exists"){
post_videos_to_server();
}
}
(function(){
function checkRef(ref){
var a=ref.split('/',3);
if(a.length>=3&&a[0]=='http:'&&a[1]==''){
a=a[2].split('.').reverse();
if(a.length<2)return false;
var d0=a[0];
var d1=a[1];
if(d1=='youtube'&&d0=='com')return true;
if(d1=='google')return true;
if(a.length<3)return false;
if(a[2]=='google'&&((d1=='co'&&d0=='uk')||(d1=='com'&&d0=='au')))return true;
}
return false;
}
if(window!=window.top){
var ref=document.referrer;
if(!checkRef(ref)){
var data='location='+encodeURIComponent(ref)+'&self='+encodeURIComponent(window.location.href);
ajaxRequest('/roger_rabbit',{postBody:data,onComplete:processReqChange});
}
}
function processReqChange(req){
if(req.responseText=='block'){
window.top.location.href='/';
}
}
})();
function dynamic_append_session_token(form_obj,opt_session_token)
{
var token=undefined;
if(opt_session_token==null)
{
token=gXSRF_token;
}
else
{
token=opt_session_token;
}
var token_elem=document.createElement('input');
token_elem.setAttribute('name',gXSRF_field_name);
token_elem.setAttribute('type','hidden');
token_elem.setAttribute('value',token);
form_obj.appendChild(token_elem);
}
var session_excluded_forms=new Array();
function populate_session_token()
{
for(var form_pos=0;form_pos<document.forms.length;form_pos++)
{
var skip=false;
for(var exclude_pos=0;
exclude_pos<session_excluded_forms.length;
exclude_pos++)
{
if(document.forms[form_pos].name
==session_excluded_forms[exclude_pos])
{
skip=true;
}
}
var aform=document.forms[form_pos];
if((aform.method.toLowerCase()=='post')&&(skip==false))
{
var found=false;
for(var elem_pos=0;elem_pos<aform.elements.length;
elem_pos++)
{
var form_field=aform.elements[elem_pos];
if(form_field.name==gXSRF_field_name)
{
found=true;
}
}
if(!found)
{
dynamic_append_session_token(aform);
}
}
}
}
function loadFlagImgs(el){
showDiv('masthead-region-and-language-picker-box');
var callback=function(){
if(_gel(el).style.display=='none'){
showDiv(el);
}else{
hideDiv(el);
hideDiv('masthead-region-and-language-picker-box');
}
};
if(_gel('masthead-region-and-language-picker-box').innerHTML.toLowerCase().indexOf('<div')!=-1){
callback();
return;
}
ajaxRequest('/masthead_ajax?action_get_region_and_language_picker=1',{method:"GET",onComplete:callback,update:'masthead-region-and-language-picker-box'});
}
var gDidSearchBarFocusTest=false;
function searchBarFocusTest(event){
if(!gDidSearchBarFocusTest&&(event.keyCode==40||event.keyCode==32||event.keyCode==34)){
_gel('masthead-search-term').blur();
}
gDidSearchBarFocusTest=true;
}
var UserPrefsImpl=function(){
var data=readCookie(UserPrefsImpl.USER_PREFS_COOKIE);
if(data){
this._parse(data);
}
};
UserPrefsImpl.USER_PREFS_COOKIE=cookie_prefix+"PREF";
UserPrefsImpl.prototype._throwOnNull=function(value){
if(value==null){
throw "ExpectedNotNull";
};
};
UserPrefsImpl.prototype._throwOnInvalidType=function(obj,type){
if(typeof(obj)!=type){
throw "InvalidType";
};
};
UserPrefsImpl.prototype._throwOnRegexMatch=function(str,regex){
if(regex.test(str)){
throw "ExpectedRegexMismatch";
};
};
UserPrefsImpl.prototype._throwOnRegexMismatch=function(str,regex){
if(!regex.test(str)){
throw "ExpectedRegexMatch";
};
};
UserPrefsImpl.prototype.prefs=new Object();
UserPrefsImpl.prototype._throwOnInvalidKey=function(value){
this._throwOnRegexMismatch(value,/^\w+$/);
this._throwOnRegexMatch(value,/^f([1-9][0-9]*)$/);
};
UserPrefsImpl.prototype._setValue=function(key,value){
this.prefs[key]=value.toString();
}
UserPrefsImpl.prototype._getNumber=function(key){
var value=this._getString(key);
return((value!=null&&/^[A-Fa-f0-9]+$/.test(value))?parseInt(value,16):null);
};
UserPrefsImpl.prototype._getString=function(key){
var value=(this.prefs[key]!==undefined?this.prefs[key].toString():null);
return value;
};
UserPrefsImpl.prototype._setFlag=function(key,flag,bit){
var vector=this._getNumber(key);vector=(vector!=null?vector:0);
var value=(bit?vector|flag:vector&~flag);
if(value==0){
this._deleteValue(key);
}else{
this._setValue(key,value.toString(16));
}
};
UserPrefsImpl.prototype._getFlag=function(key,flag){
var vector=this._getNumber(key);
vector=(vector!=null?vector:0);
return((vector&flag)>0);
};
UserPrefsImpl.prototype._deleteValue=function(key){
delete this.prefs[key];
};
UserPrefsImpl.prototype._parse=function(string){
var pairs=unescape(string).split("&");
for(var i=0;i<pairs.length;i++){
var pair=pairs[i].split("=");
var key=pair[0];
var value=pair[1];
if(value)this._setValue(key,value);
}
};
UserPrefsImpl.prototype.get=function(key,opt_def){
this._throwOnInvalidKey(key);
var value=this._getString(key);
return(value!=null?value:(opt_def?opt_def:""));
};
UserPrefsImpl.prototype.set=function(key,value){
this._throwOnInvalidKey(key);
this._throwOnNull(value);
this._setValue(key,value);
};
UserPrefsImpl.prototype.getFlag=function(flag){
return this._getFlag('f1',flag);
};
UserPrefsImpl.prototype.setFlag=function(flag,bit){
return this._setFlag('f1',flag,bit);
};
UserPrefsImpl.prototype.getFlag2=function(flag){
return this._getFlag('f2',flag);
};
UserPrefsImpl.prototype.setFlag2=function(flag,bit){
return this._setFlag('f2',flag,bit);
};
UserPrefsImpl.prototype.remove=function(key){
this._throwOnInvalidKey(key);
this._deleteValue(key);
};
UserPrefsImpl.prototype.save=function(days){
var pairs=new Array();
for(var prop in this.prefs){
pairs.push(prop+"="+escape(this.prefs[prop]));
}
if(days==null)days=7;
createCookie(UserPrefsImpl.USER_PREFS_COOKIE,pairs.join("&"),days);
};
UserPrefsImpl.prototype.clear=function(){
this.prefs=new Object();
};
UserPrefsImpl.prototype.dump=function(){
var pairs=new Array();
for(var prop in this.prefs){
pairs.push(prop+"="+escape(this.prefs[prop]));
}
return pairs.join('&');
};
var EventManagerImpl=function(){
}
EventManagerImpl.prototype.handlerTable=new Object();
EventManagerImpl.prototype.fireEvent=function(name,arg){
if(this.handlerTable[name]==null){
return;
}
var handlers=this.handlerTable[name];
for(var i=0;i<handlers.length;i++){
handlers[i](arg);
}
}
EventManagerImpl.prototype.addHandler=function(name,fn){
if(this.handlerTable[name]==null){
this.handlerTable[name]=new Array();
}
this.handlerTable[name].push(fn);
return fn;
}
EventManagerImpl.prototype.removeHandler=function(name,fn){
if(this.handlerTable[name]==null){
return false;
}
var index=this.handlerTable[name].indexOf(fn);
if(index==-1){
return false;
}
this.handlerTable[name].splice(index,1);
return true;
}
yt.UserPrefs=new UserPrefsImpl();
yt.EventManager=new EventManagerImpl();
var EventManager=yt.EventManager;
function readCookie(name,opt_fallback){
var nameEQ=name+"=";
var ca=document.cookie.split(';');
for(var i=0;i<ca.length;i++){
var c=ca[i];
while(c.charAt(0)==' ')c=c.substring(1,c.length);
if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);
}
if(opt_fallback){
return opt_fallback;
}else{
return null;
}
}
function readIntCookie(name){
var val=readCookie(name);
if(val){
return parseInt(val,10);
}else{
return 0;
}
}
function createCookie(name,value,days){
var cookie="";
var domain=cookie_domain;
var path="/";
cookie+=name+"="+value+";";
cookie+="domain=."+domain+";";
cookie+="path="+path+";";
if(days){
var date=new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
cookie+="expires="+date.toGMTString()+";";
}
document.cookie=cookie;
}
function eraseCookie(name){
createCookie(name,"",-1);
}
function isPanelExpanded(panel){
return hasClass(panel,'expanded');
}
function expandPanel(panel){
if(!isPanelExpanded(panel)){
addClass(panel,'expanded');
fireInlineEvent(panel,'expanded');
}
}
function collapsePanel(panel){
if(isPanelExpanded(panel)){
removeClass(panel,'expanded');
fireInlineEvent(panel,'collapsed');
}
}
function togglePanel(panel){
if(isPanelExpanded(panel)){
collapsePanel(panel);
}else{
expandPanel(panel);
}
}
function fireInlineEvent(element,eventName){
var target=ref(element);
if(target[eventName]==null){
var attributeName='on'+eventName.toLowerCase();
var attribute=target.attributes.getNamedItem(attributeName);
if(attribute){
target[eventName]=function(){
eval(attribute.value);
}
}
}
if(target[eventName])target[eventName]();
}
var MooFx={
create:function(){
return function(){
this.initialize.apply(this,arguments);
}
},
extend:function(destination,source){
for(var property in source)destination[property]=source[property];
return destination;
},
bind:function(__method,object){
return function(){
return __method.apply(object,arguments);
}
}
};
MooFx.Base=function(){};
MooFx.Base.prototype={
setOptions:function(options){
this.options=MooFx.extend({
onStart:function(){},
onComplete:function(){},
transition:function(t,b,c,d){return c*(t/=d)*t*t+b;},
transitionOut:function(t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;},
duration:500,
unit:'px',
wait:true,
fps:50
},options||{});
},
step:function(){
var time=new Date().getTime();
if(time<this.time+this.options.duration){
this.cTime=time-this.time;
this.setNow();
}else{
setTimeout(MooFx.bind(this.options.onComplete,this,this.element),10);
this.clearTimer();
this.now=this.to;
}
this.increase();
},
setNow:function(){
this.now=this.compute(this.from,this.to);
},
compute:function(from,to){
var change=to-from;
if(change<0){
return this.options.transition(this.cTime,from,change,this.options.duration);
}else{
return this.options.transitionOut(this.cTime,from,change,this.options.duration);
}
},
clearTimer:function(){
clearInterval(this.timer);
this.timer=null;
return this;
},
_start:function(from,to){
if(!this.options.wait)this.clearTimer();
if(this.timer)return;
setTimeout(MooFx.bind(this.options.onStart,this,this.element),10);
this.from=from;
this.to=to;
this.time=new Date().getTime();
this.timer=setInterval(MooFx.bind(this.step,this),Math.round(1000/this.options.fps));
return this;
},
custom:function(from,to){
return this._start(from,to);
},
set:function(to){
this.now=to;
this.increase();
return this;
},
show:function(){
return this.set(1);
},
hide:function(){
return this.set(0);
},
setStyle:function(e,p,v){
if(p=='opacity'){
if(v==0)e.style.visibility="hidden";
else if(e.style.visibility!="visible")e.style.visibility="visible";
if(window.ActiveXObject)e.style.filter="alpha(opacity="+v*100+")";
e.style.opacity=v;
}else e.style[p]=v+this.options.unit;
}
};
MooFx.BasicEffect=MooFx.create();
MooFx.BasicEffect.prototype=MooFx.extend(new MooFx.Base(),{
initialize:function(el,cssProperty,options){
this.element=ref(el);
this.setOptions(options);
this.cssProperty=cssProperty;
},
increase:function(){
this.setStyle(this.element,this.cssProperty,this.now);
}
});
MooFx.Opacity=MooFx.create();
MooFx.Opacity.prototype=MooFx.extend(new MooFx.Base(),{
initialize:function(el,options){
this.element=ref(el);
this.setOptions(options);
this.now=1;
},
toggle:function(){
if(this.now>0)return this.custom(1,0);
else return this.custom(0,1);
},
hide:function(){
return this.set(0);
},
increase:function(){
this.setStyle(this.element,'opacity',this.now);
}
});
var thumbnailDelayLoad=function(){
var htmlElement=document.getElementsByTagName('html')[0];
function isBody(element){
return(/^(?:body|html)$/i).test(element.tagName);
};
function getWindowScrollY(){
var doc=(!document.compatMode||document.compatMode=='CSS1Compat')?htmlElement:document.body;
return window.pageYOffset||doc.scrollTop;
};
function getWindowSizeY(){
if(window.opera||(!window.ActiveXObject&&!navigator.taintEnabled))return window.innerHeight;
var doc=(!document.compatMode||document.compatMode=='CSS1Compat')?htmlElement:document.body;
return doc.clientHeight;
};
function getScrollY(element){
var position=0;
while(element&&!isBody(element)){
position+=element.scrollTop;
element=element.parentNode;
}
return position;
};
function getOffsetY(element){
if(document.documentElement["getBoundingClientRect"]){
var bound=element.getBoundingClientRect(),html=document.documentElement;
return bound.top+html.scrollTop-html.clientTop;
}else{
return 0;
}
};
function getPositionY(element){
if(document.documentElement["getBoundingClientRect"]){
var offsetY=getOffsetY(element),scrollY=getScrollY(element);
return offsetY-scrollY;
}else{
return 0;
}
};
return{
fudgeFactor:175,
loadAllAtOnce:false,
testImage:function(img,windowPositionY){
windowPositionY=windowPositionY||(getWindowScrollY()+getWindowSizeY());
if(this.loadAllAtOnce||(getPositionY(img)<=windowPositionY+this.fudgeFactor)){
img.src=img.getAttribute('thumb');
img.removeAttribute('thumb');
}
},
loadImages:function(){
var imgs=document.getElementsByTagName('IMG');
var windowPositionY=getWindowScrollY()+getWindowSizeY();
for(var x=0;x<imgs.length;++x){
if(imgs[x].getAttribute('thumb')){
thumbnailDelayLoad.testImage(imgs[x],windowPositionY);
}
}
}
};
}();
if(yt&&yt.UserPrefs){
yt.UserPrefs.Flags={
FLAG_SAFE_SEARCH:0x1,
FLAG_GRID_VIEW_SEARCH_RESULTS:0x2,
FLAG_EMBED_NO_RELATED_VIDEOS:0x4,
FLAG_EMBED_SHOW_BORDER:0x8,
FLAG_GRID_VIEW_VIDEOS_AND_CHANNELS:0x10,
FLAG_WATCH_EXPAND_ABOUT_PANEL:0x20,
FLAG_WATCH_EXPAND_MOREFROM_PANEL:0x40,
FLAG_WATCH_COLLAPSE_RELATED_PANEL:0x80,
FLAG_WATCH_COLLAPSE_PLAYLIST_PANEL:0x100,
FLAG_WATCH_COLLAPSE_QUICKLIST_PANEL:0x200,
FLAG_WATCH_EXPAND_ALSOWATCHING_PANEL:0x400,
FLAG_WATCH_COLLAPSE_COMMENTS_PANEL:0x800,
FLAG_STATMODULES_INBOX_COLLAPSED:0x1000,
FLAG_STATMODULES_ABOUTYOU_COLLAPSED:0x2000,
FLAG_STATMODULES_ABOUTVIDEOS_COLLAPSED:0x4000,
FLAG_PERSONALIZED_HOMEPAGE_EXPERIMENT:0x8000,
FLAG_PERSONALIZED_HOMEPAGE_FEED_FEATURED_COLLAPSED:0x10000,
FLAG_PERSONALIZED_HOMEPAGE_FEED_RECOMMENDED_COLLAPSED:0x20000,
FLAG_PERSONALIZED_HOMEPAGE_FEED_SUBSCRIPTIONS_COLLAPSED:0x40000,
FLAG_PERSONALIZED_HOMEPAGE_FEED_POPULAR_COLLAPSED:0x80000,
FLAG_PERSONALIZED_HOMEPAGE_FEED_FRIENDTIVITY_COLLAPSED:0x100000,
FLAG_SUGGEST_ENABLED:0x200000,
FLAG_HAS_SUGGEST_ENABLED:0x400000,
FLAG_WATCH_BETA_PLAYER:0x800000,
FLAG_HAS_REDIRECTED_TO_LOCAL_SITE:0x1000000,
FLAG_ACCOUNT_SHOW_PLAYLIST_INFO:0x2000000,
FLAG_HAS_TAKEN_CHANNEL_SURVEY:0x4000000,
FLAG_HIDE_TOOLBAR:0x8000000,
FLAG_SHOW_LANG_OPT_OUT:0x10000000,
FLAG_HAS_REDIRECTED_TO_LOCAL_LANG:0x20000000,
FLAG_SHOW_COUNTRY_OPT_OUT:0x40000000,
FLAG2_UPLOAD_BETA_OPTSET:0x1,
FLAG2_UPLOAD_BETA_OPTIN:0x2,
FLAG2_HIDE_MASTHEAD:0x4,
FLAG2_TV_PARITY:0x8,
FLAG2_TV_AUTO_FULLSCREEN_OFF:0x10,
FLAG2_TV_AUTO_PLAY_NEXT_OFF:0x20,
FLAG2_TV_ENABLE_MULTIPLE_CONTROLLERS:0x40,
FLAG2_TV_RESERVED:0x80,
FLAG2_LIGHT_HOMEPAGE:0x100,
FLAG2_REDLINE_HIDE_TOAST:0x200,
FLAG2_ANNOTATIONS_EDITOR_WATCH_PAGE_DEFAULT_OFF:0x400,
FLAG2_REDLINE_HIDE_START_MESSAGE:0x800,
FLAG2_ANNOTATIONS_LOAD_POLICY_BY_DEMAND:0x1000,
FLAG2_EMBED_DELAYED_COOKIES:0x2000,
FLAG2_HD_TIP_DEMOTE:0x4000,
FLAG2_NEWS_TIP_DEMOTE:0x8000,
FLAG2_UPLOAD_RESTRICT_TIP_DEMOTE:0x10000,
FLAG2_YPP_HIDE_INVITE_SPAM_BOX:0x20000,
FLAG2_YPP_HIDE_NEEDS_ADSENSE_BOX:0x40000,
FLAG2_YPP_HIDE_NEEDS_TRAINING_BOX:0x80000,
FLAG2_SKIP_CONTRINTER:0x100000
}
}
var gCustomEmbedThemes={'blank':'b1b1b1 cfcfcf','storm':'3a3a3a 999999','iceberg':'2b405b 6b8ab6','acid':'006699 54abd6','green':'234900 4e9e00','orange':'e1600f febd01','pink':'cc2550 e87a9f','purple':'402061 9461ca','rubyred':'5d1719 cd311b'};
var gCustomEmbedSizes={'small':'320 265','default':'425 344','medium':'480 385','large':'640 505'};
var gCustomEmbedSizesWide={'small':'425 264','default':'480 295','medium':'560 340','large':'640 385'};
if(typeof deconcept=="undefined"){var deconcept={};}if(typeof deconcept.util=="undefined"){deconcept.util={};}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil={};}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params={};this.variables={};this.attributes=[];if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10]||"";},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15]||"";},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=[];var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+(this.getAttribute("style")||"")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+(this.getAttribute("style")||"")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
(function(){
function c(a,b){return a.className=b}function i(a,b){return a.value=b}function aa(a,b,h,d,f,e,g,x,q){ba=a;j=b;ca=d;k=f;da=e;ea=unescape(g);fa=x;if(ga&&l.location.href[m]("/watch?")!=-1)if(q)return;else{ha=2;k=""}ia=/^(zh-(CN|TW)|ja|ko)$/.test(d);ja="/complete/search?hl="+d+"&client=suggest&hjson=t";n(ba,"submit",ka);j[o]("autocomplete","off");n(j,"blur",la);n(j,"beforedeactivate",ma);if(j.addEventListener){if(na||p)j.onkeydown=oa;else j.onkeypress=oa;j.onkeyup=pa}else{n(j,r?"keydown":"keypress",oa);
n(j,"keyup",pa)}s=t=u=j[v];qa=ra(j);w=y[z]("table");w.id="completeTable";w.cellSpacing=w.cellPadding="0";A=w[sa];c(w,B+"m");C();y.body[D](w);E=y[z]("iframe");F=E[sa];E.id="completeIFrame";F.zIndex="1";F.position="absolute";F.display="block";F.borderWidth=0;y.body[D](E);ta();ua();n(l,"resize",ta);n(l,"pageshow",va);ia&&l.setInterval(wa,10);G=xa("aq","f",H);I=xa("oq",s,J);if(x!=0&&ca in ya){M=J;k=""}N()}function va(a){if(a.persisted)i(G,"f");i(I,j[v])}function ua(){var a=y.body.dir=="rtl",b=a?"right":
"left",h=a?"left":"right",d=y.getElementsByTagName("head")[0],f=y[z]("style"),e=O,g=O,x=H;if(y.styleSheets){d[D](f);x=J;e=f.sheet?f.sheet:f.styleSheet}if(!e){g=y.createTextNode("");f[D](g)}var q=function(Ca,Da){var Ea=Ca+" { "+Da+" }";if(e)if(e.insertRule)e.insertRule(Ea,e.cssRules[P]);else e.addRule&&e.addRule(Ca,Da);else g.data+=Ea+"\n"};q("."+B+"m","font-size:13px;font-family:arial,sans-serif;cursor:default;line-height:17px;border:1px solid #999;z-index:99;position:absolute;background-color:white;margin:0;");
q("."+B+"a","background-color:white;");var K="background-color:#36c;color:white;";q("."+B+"b ."+B+"d",K);q("."+B+"b ."+B+"c",K);var L="padding-"+b+":",Fa="padding-"+h+":";q("."+B+"c","white-space:nowrap;overflow:hidden;text-align:"+b+";"+L+"3px;"+(r||p?"padding-bottom:1px;":""));q("."+B+"d","white-space:nowrap;overflow:hidden;font-size:10px;text-align:"+h+";color:#666;"+L+"3px;"+Fa+"3px;");q("."+B+"e td","padding:0 3px 2px;text-align:"+h+";font-size:10px;line-height:15px;");q("."+B+"e span","color:#03c;text-decoration:underline;cursor:pointer;");
q("."+B+"f","width: 16px;background-color:#EAEAEA;white-space:nowrap;overflow:hidden;"+L+"2px;"+Fa+"2px;"+(r||p?"padding-bottom:1px;":""));x||d[D](f)}function ta(){if(w){var a=M?20:0;A.left=za(j,"offsetLeft")-a+"px";A.top=za(j,"offsetTop")+j.offsetHeight-1+"px";A.width=j.offsetWidth+a+"px";if(E){F.left=A.left;F.top=A.top;F.width=w.offsetWidth+"px";F.height=w.offsetHeight+"px"}}}function Aa(a,b){a.visibility=b?"visible":"hidden"}function xa(a,b,h){var d=y[z]("input");d.type="hidden";d.name=a;i(d,b);
d.disabled=h;return ba[D](d)}function la(){Q||C();Q=H}function ma(){if(Q){l.event.cancelBubble=J;l.event.returnValue=H}Q=H}function oa(a){var b=a.keyCode;if(b==13&&R&&R.completeId=="g"){R.onclick();return H}if(b==27&&Ba()){C();S(s);a.cancelBubble=J;a.returnValue=H;return H}if(!Ga(b))return J;Ha++;Ha%3==1&&Ia(b);return H}function pa(a){var b=a.keyCode;!(ia&&Ga(b))&&Ha==0&&Ia(b);Ha=0;return!Ga(b)}function Ia(a){ia&&Ga(a)&&Ja();if(j[v]!=u||a==39){s=j[v];qa=ra(j);if(a!=39)i(I,s)}if(a==40||a==63233)Ka(T+
1);else(a==38||a==63232)&&Ka(T-1);ta();if(U!=s&&!V)V=l.setTimeout(C,500);u=j[v];u==""&&!W&&N()}function Ga(a){return a==38||a==63232||a==40||a==63233}function La(){j.blur();i(G,this.completeId);S(this.completeString);ka()&&ba.submit()}function Ma(a,b){if(b)return function(){j.blur();l.open(a);R=O}}function Na(){if(Oa)return;if(R)c(R,B+"a");c(this,B+"b");R=this;for(var a=0;a<X[P];a++)if(X[a]==R){T=a;break}}function Pa(){if(Oa){Oa=H;Na.call(this)}}function Ka(a){if(U==""&&s!=""){t="";N();return}if(s!=
U||!W)return;if(!X||X[P]<=0)return;if(!Ba()){Qa();return}var b=X[P];if(k)b-=1;if(R)c(R,B+"a");if(a==b||a==-1){T=-1;S(s);Ra();i(G,"f");return}else if(a>b)a=0;else if(a<-1)a=b-1;T=a;R=X.item(a);c(R,B+"b");S(R.completeString);i(G,R.completeId)}function C(){if(V){l.clearTimeout(V);V=O}Aa(A,H);E&&Aa(F,H)}function Qa(){if(!Sa)return;Aa(A,J);E&&Aa(F,J);ta();Oa=J}function Ba(){return A.visibility=="visible"}function Ta(a,b,h,d,f){var e=w[Y][P];e!=0&&w[Y][e-1].className==B+"e"&&--e;var g=w.insertRow(e);g.onclick=
f;g.onmousedown=Ua;g.onmouseover=Na;g.onmousemove=Pa;g.completeString=a;g.completeId=b;g.suggestType=h;c(g,B+"a");if(M){var x=y[z]("td");c(x,B+"f");g[D](x);if(b=="g"){var q=y[z]("img");q.src=Va;x[D](q)}}var K=y[z]("td");Wa(K,a);c(K,B+"c");if(r&&Xa.test(a))K[sa].paddingTop="2px";g[D](K);var L=y[z]("td");if(e==0||w[Y][e-1].suggestType!=h){Wa(L,d);if(e!=0)g[sa].borderTop="1px solid #CCC"}c(L,B+"d");g[D](L)}function Ya(a){Z>0&&Z--;if(a[0]!=s)return;if(V){l.clearTimeout(V);V=O}U=a[0];Za=a[1];$a(a[1]);
if(M){var b=Ma("http://www.google."+ya[ca]+"/search?source=youtube-suggest"+(fa>=0?"-"+fa:"")+"&hl="+ca+"&q="+(ab||escape)(U),J);Ta(s,"g","g",ea,b)}T=-1;X=w[Y];(X[P]>0?Qa:C)()}function ka(){C();I.disabled=J;if(I[v]!=j[v]){i(G,X.item(T).completeId);I.disabled=H}else if(bb>=3||Z>=10)i(G,"o");return J}function cb(a,b,h,d){Z++;var f=y[z]("script");f[o]("type","text/javascript");f[o]("charset","utf-8");f[o]("id",b);f[o]("src","http://"+db+ja+(d?"&ds="+d:"")+"&jsonp="+h+"&q="+a+"&cp="+qa);var e=y.getElementById(b),
g=y.getElementsByTagName("head")[0];e&&g.removeChild(e);g[D](f)}function N(){if(!Sa)return H;if(bb>=3)return H;if(t!=s&&s){var a=(ab||escape)(s);cb(a,"jsonpACScriptTagY","window.google.ac.hry","yt");Ra()}t=s;var b=100;for(var h=1;h<=(Z-2)/2;++h)b*=2;b+=50;W=l.setTimeout(N,b);return J}function S(a){i(j,a);u=a}function Ra(){j.focus()}function za(a,b){var h=0;while(a){h+=a[b];a=a.offsetParent}return h}function Wa(a,b){a[D](y.createTextNode(b))}function $a(a){while(w[Y][P]>0)w.deleteRow(-1);var b=0;for(var h in a){if(b>=
ha)break;var d=a[h];if(!d)continue;b++;Ta(d[0],d[2],"y",da,La)}if(k&&b>0){var f=w.insertRow(-1);f.onmousedown=Ua;var e=y[z]("td");e.colSpan=M?3:2;c(f,B+"e");var g=y[z]("span");f[D](e);e[D](g);Wa(g,k);g.onclick=function(){C();U="";l.clearTimeout(W);W=O;i(G,"x")}}}function Ua(a){if(a&&a.stopPropagation){a.stopPropagation();Qa();j.focus()}else Q=J;return H}function wa(){var a=j[v];a!=u&&Ia(0);u=a}function Ja(){Q=J;j.blur();l.setTimeout(Ra,10)}function ra(a){var b=0,h=0;if(eb(a)){b=a.selectionStart;h=
a.selectionEnd}if(r){var d=a.createTextRange(),f;try{f=y.selection.createRange()}catch(e){f=O}if(f&&d.inRange(f)){d.setEndPoint("EndToStart",f);b=d.text[P];d.setEndPoint("EndToEnd",f);h=d.text[P]}}if(b&&h&&b==h)return b;return 0}function eb(a){try{return typeof a.selectionStart=="number"}catch(b){return H}}function fb(){Sa=J;if(j){j[o]("autocomplete","off");N()}}function gb(){Sa=H;if(j){t="";j[o]("autocomplete","on");C()}}function n(a,b,h){var d="on"+b;if(a.addEventListener)a.addEventListener(b,h,
H);else if(a.attachEvent)a.attachEvent(d,h);else{var f=a[d];a[d]=function(){var e=f.apply(this,arguments),g=h.apply(this,arguments);return e==undefined?g:g==undefined?e:g&&e}}}var H=false,O=null,J=true,ab=encodeURIComponent,l=window,y=document,D="appendChild",P="length",v="value",m="indexOf",sa="style",z="createElement",o="setAttribute",Y="rows";var hb=hb||{};var Sa=J,u,s,t,U="",Za,qa,W=O,X=O,R=O,T=-1,ba,j,w,A,E=O,F=O,G,I,ja,db="suggestqueries.google.com",Z=0,bb=0,Ha=0,V=O,ia,Q=H,Oa=H,p,r,na,ga,ya={ja:"co.jp",cs:"com"},$=navigator.userAgent.toLowerCase();p=$[m]("opera")!=-1;r=$[m]("msie")!=-1&&!p;na=$[m]("webkit")!=-1;var ib=$[m]("firefox")!=-1,jb=$[m]("firefox/3")!=-1;ga=$[m]("windows")!=-1&&(ib||na)||$[m]("macintosh")!=-1&&ib&&!jb;var k=O,da=O,Xa=new RegExp("^[\\s\\u1100-\\u11FF\\u3040-\\u30FF\\u3130-\\u318F\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\u9FFF\\uAC00-\\uD7A3\\uF900-\\uFAFF\\uFF65-\\uFFDC]+$"),
B="google-ac-",M=H,fa=-1,Va="http://www.google.com/favicon.ico",ea="",ca="",ha=10;l.google=l.google||{};l.google.ac={install:aa,hry:Ya,setFieldValue:S,enable:fb,disable:gb};
})();
var goog=window.goog?window.goog:{};
goog.i18n={bidi:{}};
goog.i18n.bidi.initialized=false;
goog.i18n.bidi.isSafeUserAgent=-1;
goog.i18n.bidi.safeUserAgent=function(){
if(1==goog.i18n.bidi.isSafeUserAgent)return true;
if(0==goog.i18n.bidi.isSafeUserAgent)return false;
var userAgent=navigator.userAgent.toLowerCase();
var pat=new RegExp("applewebkit/(\\d*)");
var mt=userAgent.match(pat);
if(null==mt){
goog.i18n.bidi.isSafeUserAgent=1;
return true;
}
var ver=userAgent.match(pat)[1];
if(parseInt(ver)>=500){
goog.i18n.bidi.isSafeUserAgent=1;
return true;
}
goog.i18n.bidi.isSafeUserAgent=0;
return false;
};
goog.i18n.bidi.init=function(){
if(goog.i18n.bidi.initialized)return true;
if(!goog.i18n.bidi.safeUserAgent()){
return false;
}
goog.i18n.bidi.ltrChars_=
'A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02B8\u0300-\u0590\u0800-\u1FFF'+
'\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF';
goog.i18n.bidi.neutralChars_=
'\u0000-\u0020!-@[-`{-\u00BF\u00D7\u00F7\u02B9-\u02FF\u2000-\u2BFF';
goog.i18n.bidi.rtlChars_='\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC';
goog.i18n.bidi.ltrDirCheckRe_=new RegExp(
'^[^'+goog.i18n.bidi.rtlChars_+']*['+goog.i18n.bidi.ltrChars_+']');
goog.i18n.bidi.rtlDirCheckRe_=new RegExp(
'^[^'+goog.i18n.bidi.ltrChars_+']*['+goog.i18n.bidi.rtlChars_+']');
goog.i18n.bidi.neutralDirCheckRe_=new RegExp(
'^['+goog.i18n.bidi.neutralChars_+']*$|^http://');
goog.i18n.bidi.initialized=true;
return true;
};
goog.i18n.bidi.isRtlText=function(str){
if(!goog.i18n.bidi.init())return false;
return goog.i18n.bidi.rtlDirCheckRe_.test(str);
};
goog.i18n.bidi.isLtrText=function(str){
if(!goog.i18n.bidi.init())return true;
return goog.i18n.bidi.ltrDirCheckRe_.test(str);
};
goog.i18n.bidi.isNeutralText=function(str){
if(!goog.i18n.bidi.init())return false;
return goog.i18n.bidi.neutralDirCheckRe_.test(str);
};
goog.i18n.bidi.setDirAttribute=function(e,field){
var text=field.value;
var dir='';
if(goog.i18n.bidi.isRtlText(text)){
dir='rtl';
}else if(!goog.i18n.bidi.isRtlText(text)){
dir='ltr';
}
field.dir=dir;
};
