function _gel(id)
{
return document.getElementById(id);
}
function _pick(){
for(var i=0;i<arguments.length;i++){
if(arguments[i]!==undefined&&arguments[i]!=null){
return arguments[i];
}
}
return null;
}
function _chop(str){
if(str==null||typeof str!='string')return null;
if(str=="")return "";
return str.substring(0,str.length-1);
}
function showSheet(content)
{
var sheet=document.getElementById('sheet');
var sheetContent=document.getElementById('sheetContent');
sheetContent.innerHTML=content;
sheet.style.visibility='visible';
return false;
}
var GlobalEvents=new function(){
var handlerTable=new Object();
this.fireEvent=function(name,arg){
if(handlerTable[name]==null)return;
var handlers=handlerTable[name];
for(var i=0;i<handlers.length;i++){
handlers[i](arg);
}
}
this.addHandler=function(name,fn){
if(handlerTable[name]==null)handlerTable[name]=new Array();
handlerTable[name].push(fn);
return fn;
}
this.removeHandler=function(name,fn){
if(handlerTable[name]==null)return false;
var index=handlerTable[name].indexOf(fn);
if(index==-1)return false;
handlerTable[name].splice(index,1);
return true;
}
};
function toggleClass(element,className){
var e=ref(element);
if(hasClass(e,className)){
removeClass(e,className);
}else{
addClass(e,className);
}
}
function toggleVisibility(whichForm,setVisible)
{
var newstate="none"
if(setVisible==true)
newstate=""
if(document.getElementById)
{
var style2=document.getElementById(whichForm).style;
style2.display=newstate;
}
else if(document.all)
{
var style2=document.all[whichForm].style;
style2.display=newstate;
}
else if(document.layers)
{
var style2=document.layers[whichForm].style;
style2.display=newstate;
}
}
function setInnerHTML(div_id,value)
{
var dstDiv=document.getElementById(div_id);
dstDiv.innerHTML=value;
}
function openPopup(url,name,height,width)
{
var newwindow=window.open(url,name,'height='+height+',width='+width);
if(window.focus){newwindow.focus()}
return false;
}
function openDiv(elName){
var theElemenet=document.getElementById(elName);
if(theElemenet){
theElemenet.style.display="block";
}
}
function closeDiv(elName){
var theElemenet=document.getElementById(elName);
if(theElemenet){
theElemenet.style.display="none";
}
}
function showInline(elName){
var theElemenet=document.getElementById(elName);
if(theElemenet){
theElemenet.style.display="inline";
}
}
function hideInline(elName){
var theElemenet=document.getElementById(elName);
if(theElemenet){
theElemenet.style.display="none";
}
}
function blurElement(elName){
var theElement=document.getElementById(elName);
if(theElement){
theElement.blur();
}
}
function selectLink(elName){
var theElement=document.getElementById(elName);
if(theElement){
theElement.className="selectedNavLink";
}
}
function unSelectLink(elName){
var theElement=document.getElementById(elName);
if(theElement){
theElement.className="unSelectedNavLink";
}
}
function toggleDisplay(divName){
var tempDiv=document.getElementById(divName);
if(!tempDiv){
return false;
}
if((tempDiv.style.display=="block")||(tempDiv.style.display==""&&tempDiv.className.indexOf("hid")==0)){
tempDiv.style.display="none";
return false;
}else if((tempDiv.style.display=="none")||(tempDiv.className.indexOf("hid")!=0)){
tempDiv.style.display="block";
return true;
}
}
function toggleDisplay2(){
var elements=Array.prototype.slice.call(arguments);
arrayEach(elements,function(arg){
var element=ref(arg);
if(element){
element.style.display=(element.style.display!="none"?"none":"");
}
});
}
function setVisible(divName,onOrOff){
var tempDiv=document.getElementById(divName);
if(!tempDiv){
return;
}
if(onOrOff){
tempDiv.style.visibility="visible";
}else{
tempDiv.style.visibility="hidden";
}
}
function hasClass(element,_className){
if(!element){
return;
}
var upperClass=_className.toUpperCase();
if(element.className){
var classes=element.className.split(' ');
for(var i=0;i<classes.length;i++){
if(classes[i].toUpperCase()==upperClass){
return true;
}
}
}
return false;
}
function addClass(element,_class){
if(!hasClass(element,_class)){
element.className+=element.className?(" "+_class):_class;
}
}
function getClassList(element){
if(element.className){
return element.className.split(' ');
}else{
return[];
}
}
function removeClass(element,_class){
var upperClass=_class.toUpperCase();
var remainingClasses=[];
if(element.className){
var classes=element.className.split(' ');
for(var i=0;i<classes.length;i++){
if(classes[i].toUpperCase()!=upperClass){
remainingClasses[remainingClasses.length]=classes[i];
}
}
element.className=remainingClasses.join(' ');
}
}
function toggleClass(element,className){
var el=ref(element);
if(el){
if(hasClass(el,className)){
removeClass(el,className);
}else{
addClass(el,className);
}
}
}
function getDisplayStyleByTagName(o){
var n=o.nodeName.toLowerCase();
return(n=="span"||n=="img"||n=="a")?"inline":"block";
}
function hideDiv(divName){
var tempDiv=document.getElementById(divName);
if(!tempDiv){
return;
}
if(tempDiv.style.display=="inline"){
addClass(tempDiv,"wasinline");
}else if(tempDiv.style.display=="block"){
addClass(tempDiv,"wasblock");
}
tempDiv.style.display="none";
}
function showDiv(divName){
var tempDiv=document.getElementById(divName);
if(!tempDiv){
return;
}
if(hasClass(tempDiv,"wasinline")){
tempDiv.style.display="inline";
removeClass(tempDiv,"wasinline");
}else if(hasClass(tempDiv,"wasblock")){
tempDiv.style.display="block";
removeClass(tempDiv,"block");
}else{
tempDiv.style.display=getDisplayStyleByTagName(tempDiv);
}
}
function toggleShowDiv(divId){
var tempDiv=document.getElementById(divId);
if(tempDiv&&tempDiv.style.display=="none"){
showDiv(divId);
}else{
hideDiv(divId);
}
}
function changeBGcolor(tempDiv,onOrOff){
if(onOrOff==1){tempDiv.style.backgroundColor='#DDD';tempDiv.style.cursor='pointer';tempDiv.style.cursor='hand';}
else{tempDiv.style.backgroundColor='#FFF'}
}
function imgRollover(imgIdArr)
{
if(navigator.userAgent.match(/Opera(\S+)/)){
var operaVersion=parseInt(navigator.userAgent.match(/Opera(\S+)/)[1]);
}
if(!document.getElementById||operaVersion<7)return;
var i=0;
var imgId='';
var imgEle='';
var imgArr=new Array;
for(i=0;i<imgIdArr.length;i++)
{
if(document.getElementById(imgIdArr[i]))
{
imgArr.push(document.getElementById(imgIdArr[i]));
}
}
var imgPreload=new Array();
var imgSrc=new Array();
var imgClass=new Array();
for(i=0;i<imgArr.length;i++)
{
if(imgArr[i].className.indexOf('rollover')>-1)
{
imgSrc[i]=imgArr[i].getAttribute('src');
imgClass[i]=imgArr[i].className;
imgPreload[i]=new Image();
if(imgClass[i].match(/rollover(\S+)/))
{
imgPreload[i].src='/img/'+imgClass[i].match(/rollover(\S+)/)[1];
}
imgArr[i].setAttribute('rsrc',imgSrc[i]);
imgArr[i].onmouseover=function()
{
this.setAttribute('src','/img/'+this.className.match(/rollover(\S+)/)[1])
}
imgArr[i].onmouseout=function()
{
this.setAttribute('src',this.getAttribute('rsrc'))
}
}
else if(imgArr[i].tagName=='A')
{
imgArr[i].onmouseover=function()
{
var imgObj=document.getElementById(this.id.match(/_(\S+)/)[1]);
imgObj.setAttribute('src','/img/'+imgObj.className.match(/rollover(\S+)/)[1])
}
imgArr[i].onmouseout=function()
{
var imgObj=document.getElementById(this.id.match(/_(\S+)/)[1]);
imgObj.setAttribute('src',imgObj.getAttribute('rsrc'))
}
}
}
}
function validateURL(inputField){
if(inputField.value.indexOf("http://")==0){
return false;
}else{
inputField.value="http://"+inputField.value;
return true;
}
}
function getDivHeight(div){
if(div.clientHeight){
return div.clientHeight;
}else if(div.offsetHeight){
return div.offsetHeight;
}
}
var addListener=function(){
if(window.addEventListener){
return function(el,type,fn){
el.addEventListener(type,fn,false);
};
}
else if(window.attachEvent){
return function(el,type,fn){
var f=function(){
fn.call(el,window.event);
};
el.attachEvent('on'+type,f);
};
}
else{
return function(el,type,fn){
el['on'+type]=fn;
}
}
}();
function ref(instance_or_id){
return(typeof(instance_or_id)=="string")?document.getElementById(instance_or_id):instance_or_id;
}
function extendInputSelect(select)
{
if(select!=null&&select._isExtended===undefined){
select.maxItems=-1;
select.setMaxItems=function(count){this.maxItems=(count>=0)?count:-1;}
select.moveSelectedTo=function(list){
while(this.selectedIndex>=0)
{
if(!list.addWithCheck(this.options[this.selectedIndex]))break;
this.options[this.selectedIndex]=null;
}
}
select.moveAllTo=function(list){
while(this.options.length>0)
{
if(!list.addWithCheck(this.options[0]))break;
this.options[0]=null;
}
}
select.addWithCheck=function(option){
if(this.maxItems==-1||this.options.length<this.maxItems){
var newOption=new Option();
newOption.text=option.text;
newOption.value=option.value;
newOption.selected=option.selected;
if(this.isSorted){
this.addSorted(newOption);
}
else{
this.addAppend(newOption);
}
return true;
}
return false;
}
select.addAppend=function(option){
this.addInsert(option,this.options.length);
}
select.addInsert=function(option,index){
if(index>=0&&index<=this.options.length){;
for(var i=this.options.length;i>index;i--){
this.options[i]=new Option();
this.options[i].text=this.options[i-1].text;
this.options[i].value=this.options[i-1].value;
this.options[i].selected=this.options[i-1].selected;
}
this.options[index]=option;
}
}
select.addSorted=function(option){
if(!this.isSorted)this.setSorted(true);
var index=this.options.length;
for(var i=0;i<this.options.length;i++){
if(this.options[i].text>option.text){
index=i;
break;
}
}
this.addInsert(option,index);
}
select.importOption=function(option){
var newOption=new Option();
newOption.text=option.text;
newOption.value=option.value;
newOption.selected=option.selected;
return newOption();
}
select.sort=function(){
if(this.options.length<2)return;
for(var i=0;i<this.options.length-1;i++){
if(this.options[i].text>this.options[i+1].text){
var swap=new Option();
swap.text=this.options[i].text;
swap.value=this.options[i].value;
swap.selected=this.options[i].selected;
this.options[i].text=this.options[i+1].text;
this.options[i].value=this.options[i+1].value;
this.options[i].selected=this.options[i+1].selected;
this.options[i+1].text=swap.text;
this.options[i+1].value=swap.value;
this.options[i+1].selected=swap.selected;
i=-1;
}
}
}
select.isSorted=false;
select.setSorted=function(bit){
this.isSorted=bit;
if(this.isSorted){
this.sort();
}
}
select.getSelectedValue=function(){
if(this.selectedIndex<0)return null;
return this.options[this.selectedIndex].value;
}
select._isExtended=true;
}
}
function DualListBoxController(left,right)
{
this.left=ref(left);
this.right=ref(right);
extendInputSelect(this.left);
extendInputSelect(this.right);
this.moveAllRight=function(){this.left.moveAllTo(this.right);}
this.moveSelectedRight=function(){this.left.moveSelectedTo(this.right);}
this.moveAllLeft=function(){this.right.moveAllTo(this.left);}
this.moveSelectedLeft=function(){this.right.moveSelectedTo(this.left);}
}
function each(array,func){
for(var i=0;i<array.length;i++)func(array[i]);
}
var arrayEach=each;
function focusSearchField(){
if(document.searchForm.search_query){
document.searchForm.search_query.focus();
}
}
function showLoadingIcon(div_id){
var temp_HTML="<img src=/img/icn_loading_animated.gif>";
document.getElementById(div_id).innerHTML=temp_HTML;
}
function showLoading(div_id){
var temp_HTML="<br><br><br><br><br><center><img src=/img/icn_loading_animated.gif></center><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>";
document.getElementById(div_id).innerHTML=temp_HTML;
document.body.focus();
}
function displayHideCommentLink(comm_id){
var header_div="comment_header_"+comm_id;
var icn_up_div="comment_up_"+comm_id;
var icn_down_div="comment_down_"+comm_id;
var comment_body_div="comment_body_"+comm_id;
var span_hide_id="hide_link_"+comm_id;
var span_show_id="show_link_"+comm_id;
showDiv(comment_body_div);
document.getElementById(span_show_id).style.visibility='hidden';
hideDiv(span_show_id);
showDiv(span_hide_id);
document.getElementById(span_hide_id).style.visibility='visible';
if(document.getElementById(header_div)){
document.getElementById(header_div).className="commentHead";
}
if(document.getElementById(icn_up_div))document.getElementById(icn_up_div).className="opacity80";
if(document.getElementById(icn_down_div))document.getElementById(icn_down_div).className="opacity80";
}
function displayShowCommentLink(comm_id){
var header_div="comment_header_"+comm_id;
var icn_up_div="comment_up_"+comm_id;
var icn_down_div="comment_down_"+comm_id;
var comment_body_div="comment_body_"+comm_id;
var span_hide_id="hide_link_"+comm_id;
var span_show_id="show_link_"+comm_id;
hideDiv(comment_body_div);
document.getElementById(span_hide_id).style.visibility='hidden';
hideDiv(span_hide_id);
showDiv(span_show_id);
document.getElementById(span_show_id).style.visibility='visible';
if(document.getElementById(header_div)){
document.getElementById(header_div).className="commentHeadHidden opacity80";
}
if(document.getElementById(icn_up_div))document.getElementById(icn_up_div).className="opacity30";
if(document.getElementById(icn_down_div))document.getElementById(icn_down_div).className="opacity30";
}
function showMsg(msg){
return overlib(msg,WIDTH,300);
}
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="CommentVote"+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;
getUrlXMLResponseAndFillDiv(url_string,vote_div_id);
if(increment<0){
hideDiv(comment_body);
displayShowCommentLink(comment_id);
}
showLoadingIcon(vote_div_id);
}
function voteCommentHidden(comment_id,vid_id,comment_ref_id,increment){
var comment_body_div="comment_body_"+comment_id;
var hide_link_id="hide_link_"+comment_id;
var show_link_id="show_link_"+comment_id;
if(document.getElementById(comment_body_div).style.display=='none'){
displayHideCommentLink(comment_id);
}
else{
voteComment(comment_id,vid_id,comment_ref_id,increment);
}
}
function spam(comment_id,vid_id){
var url_string="&mark_comment_as_spam="+comment_id+"&entity_id="+vid_id;
postUrlXMLResponse('/comment_servlet',url_string,null);
displayShowCommentLink(comment_id);
hideSpam(comment_id);
}
function hasAncestor(element,ancestor){
var el=ref(element);
var an=ref(ancestor);
while(el!=document&&el!=null){
if(el==an)return true;
el=el.parentNode;
}
return false;
}
var gMenuTimer=0;
var gMenuTimer2=0;
function showHiddenMenu(e,el,now){
cancelCloseHiddenMenu();
if(now){
showHiddenMenu2(e,el);
}else{
showHiddenMenu2(e,el);
}
}
function showHiddenMenu2(e,el){
if(el!='videoTime'&&_gel('videoTime')){
addClass(_gel('videoTime'),'hid');
}
if(el!='videoLists'&&_gel('videoLists')){
addClass(_gel('videoLists'),'hid');
}
if(el!='videoCategories'&&_gel('videoCategories')){
addClass(_gel('videoCategories'),'hid');
}
removeClass(_gel(el),'hid');
if(!e)var e=window.event;
e.cancelBubble=true;
if(e.stopPropagation)e.stopPropagation();
}
function cancelCloseHiddenMenu(){
if(gMenuTimer){
window.clearTimeout(gMenuTimer);
gMenuTimer=null;
}
}
function closeHiddenMenu(el){
addClass(_gel(el),'hid');
}
function callOnChangeClick(){
var inputs=document.getElementsByTagName('input');
var selects=document.getElementsByTagName('select');
for(var i=0;i<inputs.length;++i){
if(inputs[i].type!='submit'&&inputs[i].type!='button'&&inputs[i].onclick)
inputs[i].onclick();
}
for(var i=0;i<selects.length;++i){
if(selects[i].onchange)
selects[i].onchange();
}
}
function getBodyScrollTop(){
if(window.innerHeight){
return window.pageYOffset;
}else if(document&&document.documentElement&&document.documentElement.scrollTop){
return document.documentElement.scrollTop;
}else if(document&&document.body){
return document.body.scrollTop;
}
}
var scrollStep=100;
var scrollStepDelay=50;
function smoothScrollIntoView(node,padding){
if(!padding)
padding=0;
smoothScrollIntoViewWorker(node,padding,null);
}
function smoothScrollIntoViewWorker(node,padding,lastTop){
var nodeTop=getPageOffsetTop(node);
var currentTop=getBodyScrollTop();
var deltaTop=Math.min(nodeTop-currentTop-padding,scrollStep);
window.scrollBy(0,deltaTop);
if(currentTop!=lastTop){
setTimeout(function(){smoothScrollIntoViewWorker(node,padding,currentTop)},scrollStepDelay);
}
}
function getPageOffsetTop(element){
var curtop=0;
if(element.offsetParent){
curtop=element.offsetTop
while(element=element.offsetParent){
curtop+=element.offsetTop
}
}
return curtop;
}
function getAncestorWithClass(node,className){
while(node&&!hasClass(node,className)){
node=node.parentNode;
}
return node;
}
function isBladeMutex(blade){
return hasClass(blade,'mutex');
}
function isBladeExpanded(blade){
return hasClass(blade,'expanded');
}
function isBladeHidden(blade){
return hasClass(blade,'hidden');
}
function expandBlade(blade){
if(!isBladeExpanded(blade)){
if(isBladeMutex(blade)){
each(blade.parentNode.childNodes,function(item){
if(blade!=item&&isBladeMutex(item)){
collapseBlade(item);
}
});
}
addClass(blade,'expanded');
fireBladeEvent(blade,'expanded');
}
}
function collapseBlade(blade){
if(isBladeExpanded(blade)){
removeClass(blade,'expanded');
fireBladeEvent(blade,'collapsed');
}
}
function toggleBlade(blade){
if(isBladeExpanded(blade)){
collapseBlade(blade);
}else{
expandBlade(blade);
}
}
function fireBladeEvent(blade,eventName){
if(blade[eventName]==null){
var attributeName='on'+eventName.toLowerCase();
var attribute=blade.attributes.getNamedItem(attributeName);
if(attribute){
blade[eventName]=function(){
eval(attribute.value);
}
}
}
if(blade[eventName])blade[eventName]();
}
function findAncestorByClass(element,className){
var temp=element;
while(temp!=document){
if(hasClass(temp,className))return temp;
temp=temp.parentNode;
}
return null;
}
function findChildByClass(element,className){
for(var i=0;i<element.childNodes.length;i++){
if(hasClass(element.childNodes[i],className))return element.childNodes[i];
}
return null;
}
function findChildrenByClass(element,className){
var result=new Array();
for(var i=0;i<element.childNodes.length;i++){
if(hasClass(element.childNodes[i],className))result.push(element.childNodes[i]);
}
return result;
}
function onBladeClick(trigger){
var blade=findAncestorByClass(trigger,'blade');
if(blade){
toggleBlade(blade);
saveAccordionState(blade.parentNode);
}
return false;
}
var FLAG_HIDDEN=0x1;
var FLAG_EXPANDED=0x2;
function saveAccordionState(accordion){
var result=0;
var ac=ref(accordion);
if(ac){
var blades=findChildrenByClass(ac,'blade');
for(var i=0;i<blades.length;i++){
var blade=blades[i];
if(isBladeHidden(blade))result=result|(FLAG_HIDDEN<<(i*2));
if(isBladeExpanded(blade))result=result|(FLAG_EXPANDED<<(i*2));
}
}
createCookie('MY_YOUTUBE',result,0);
}
function applyAccordionState(accordion){
var ac=ref(accordion);
if(ac){
var state=readIntCookie('MY_YOUTUBE');
var blades=findChildrenByClass(ac,'blade');
for(var i=0;i<blades.length;i++){
var blade=blades[i];
if(state&(FLAG_EXPANDED<<(i*2))){
expandBlade(blade);
}else{
collapseBlade(blade);
}
}
}
}
addListener(window,'load',function(){
var accordion=ref('accordion');
if(accordion){applyAccordionState(accordion);}
});
function removeAccQuicklistItem(video,node){
getUrlXMLResponse('/watch_queue_ajax?action_remove_from_queue&video_id='+video);
if(node)node.parentNode.removeChild(node);
GlobalEvents.fireEvent("QLItemRemoved",video);
}
function playAllAccQuicklistItems(){
var videosNode=_gel("acc-quicklist-videos");
var firstVideo=findChildByClass(videosNode,"video");
if(firstVideo){
var state=new StateBag(firstVideo.attributes['state']);
location.href="/watch?v="+escape(state.getValue("video_id"))+"&playnext=1";
}
}
GlobalEvents.addHandler("QLItemRemoved",function(arg){
var countNode=_gel("acc-quicklist-count");
var count=parseInt(countNode.innerHTML);
count=(!isNaN(count)?count-1:0);
if(count==0){
addClass(_gel("acc-quicklist-content"),"is-empty");
}
else if(count<5){
addClass(_gel("acc-quicklist-videos"),"shrink");
}
countNode.innerHTML=count.toString();
});
function closeLoginPicker(){
var loginBox=_gel('loginBoxZ');
if(loginBox){
if(loginBox.style.display!='none')
loginBox.style.display='none';
}
}
addListener(document,'click',function(e){
var element=e.target||e.srcElement;
if(!hasAncestor(element,'loginBoxZ')&&element.className.indexOf('loginBoxZ')==-1){
closeLoginPicker();
}
});
function openLoginBox(){
toggleDisplay('loginBoxZ');
if(_gel('loginNextZ').value=='/signup'){
_gel('loginNextZ').value="/index";
}else if(_gel('loginNextZ').value.indexOf('/signup')==0){
_gel('loginNextZ').value=_gel('loginNextZ').value.substring(13);
}
if(_gel('loginBoxZ').style.display!='none'){
_gel('loginUserZ').focus();
}
_hbLink('LogIn','UtilityLinks');
return false;
}
onLoadFunctionList=new Array();
function performOnLoadFunctions()
{
for(var i=0;i<onLoadFunctionList.length;i++)
{
onLoadFunctionList[i]();
}
}
function readCookie(name,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(fallback){
return fallback;
}else{
return null;
}
}
function readIntCookie(name){
val=readCookie(name);
if(val){
return parseInt(val);
}else{
return 0;
}
}
function createCookie(name,value,days){
if(days){
var date=new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires="; expires="+date.toGMTString();
}
else var expires="";
document.cookie=name+"="+value+expires+"; path=/";
}
function selectLocale(loc){
var current_url,next_url;
current_url=location.href;
if(current_url.indexOf('?locale=')!=-1){
url_array=current_url.split("?locale=");
current_url=url_array[0];
}else if(current_url.indexOf('&locale=')!=-1){
url_array=current_url.split("&locale=");
current_url=url_array[0];
}
next_url=current_url+(current_url.indexOf('?')==-1?"?":"&")+"locale="+loc+"&persist_locale=1";
window.location=next_url;
}
flagImgsLoaded=false;
function loadFlagImgs(){
if(flagImgsLoaded){
return;
}
var flags=_gel('flagDiv').getElementsByTagName('img');
for(var x=0;x<flags.length;++x){
addClass(flags[x],"flag_"+flags[x].getAttribute('locale'));
}
flagImgsLoaded=true;
}
function closeLocalePicker(){
var localePickerBox=document.getElementById('localePickerBox');
if(!localePickerBox){
localePickerBox=document.getElementById('localePickerBoxProfile');
}
if(localePickerBox){
if(localePickerBox.style.display!='none'){
localePickerBox.style.display='none';
}
}
}
addListener(document,'click',function(e){
var element=e.target||e.srcElement;
if(element.className.indexOf('localePickerLink')==-1&&element.className.indexOf('currentFlag')==-1){
closeLocalePicker();
}
});
function UserPrefs(){
var prefs=new StateBag();
var cookie="_user_prefs";
var data=readCookie(cookie);
if(data){
prefs.parse(unescape(data));
}
this.setPref=function(key,value){
prefs.setValue(key,value);
};
this.getPref=function(key,def){
return prefs.getValue(key,def);
};
this.savePrefs=function(days){
if(days===undefined)days=7;
createCookie(cookie,escape(prefs.toString()),days);
};
}
function StateBag(){
var state={};
this.setValue=function(key,value){
if(value==null){
delete state[key];
return;
}
state[key]=value.toString();
}
this.getValue=function(key,def){
if(state[key]===undefined)return def||null;
return state[key];
}
this.toString=function(){
var result="";
for(prop in state){
result+=prop;
result+="=";
result+=escape(state[prop]);
result+="&";
}
result=_chop(result);
return result;
}
this.parse=function(str){
var pairs=str.split(/&/g);
for(var i=0;i<pairs.length;i++){
var pair=pairs[i].split(/=/);
this.setValue(pair[0],unescape(pair[1]));
}
}
if(arguments.length>0){
var arg=arguments[0];
if(typeof arg.value=="string"){
this.parse(arg.value);
}
}
}
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 addQLIcons(el){
var img=(el?el:document).getElementsByTagName('img');
for(var x=0;x<img.length;++x){
var vId=img[x].getAttribute("qlicon");
var vId2=img[x].getAttribute("qliconalt");
if(!vId&&!vId2){
continue;
}
img[x].parentNode.parentNode.innerHTML+=
'<div class="addtoQL90">'
+'<a href="#" rel="nofollow">'
+'<img id="add_button_'+(vId?vId:vId2)+'" class="QLIconImg" src="http://static.youtube.com/yt/img/pixel-vfl73.gif" border="0" '
+(vId?'onclick="onQuickAddClick(this, \''+vId+'\')" '
:'onclick="clicked_add_icon(\''+vId2+'\', 0);_hbLink(\'QuickList+AddTo\',\'na\');return false;" ')
+'onmouseover="return mouseOverQuickAdd(this)" '
+'onmouseout="return mouseOutQuickAdd(this)">'
+'</a>'
+'</div>';
img[x].removeAttribute("qlicon");
img[x].removeAttribute("qliconalt");
}
}
onLoadFunctionList.push(addQLIcons);
function setDisabled(objects,disabled){
for(var i in objects){
objects[i].disabled=disabled;
if(disabled){
document.getElementById(objects[i].id+"_label").style.color="#CCC";
}else{
document.getElementById(objects[i].id+"_label").style.color="";
}
}
}
function browseViewType(viewType){
hideInline(viewType=='L'?"relatedNotList":"relatedList");
showInline(viewType=='L'?"relatedList":"relatedNotList");
hideInline(viewType=='L'?"relatedGrid":"relatedNotGrid");
showInline(viewType=='L'?"relatedNotGrid":"relatedGrid");
removeClass(_gel('video_grid'),viewType=='L'?'browseGridView':'browseListView');
addClass(_gel('video_grid'),viewType=='L'?'browseListView':'browseGridView');
createCookie('bvt',viewType,365);
return false;
}
function membersViewType(viewType){
hideInline(viewType=='L'?"relatedNotList":"relatedList");
showInline(viewType=='L'?"relatedList":"relatedNotList");
hideInline(viewType=='L'?"relatedGrid":"relatedNotGrid");
showInline(viewType=='L'?"relatedNotGrid":"relatedGrid");
removeClass(_gel('video_grid'),viewType=='L'?'membersGridView':'membersListView');
addClass(_gel('video_grid'),viewType=='L'?'membersListView':'membersGridView');
createCookie('bvt',viewType,365);
return false;
}
function getXmlHttpRequest()
{
var httpRequest=null;
try
{
httpRequest=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
httpRequest=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
httpRequest=null;
}
}
if(!httpRequest&&typeof XMLHttpRequest!="undefined")
{
httpRequest=new XMLHttpRequest();
}
return httpRequest;
}
function getUrlSync(url)
{
return getUrl(url,false,null);
}
function getUrlAsync(url,handleStateChange)
{
return getUrl(url,true,handleStateChange);
}
function getUrl(url,async,handleStateChange){
var xmlHttpReq=getXmlHttpRequest();
if(!xmlHttpReq)
return;
if(handleStateChange)
{
xmlHttpReq.onreadystatechange=function()
{
handleStateChange(xmlHttpReq);
};
}
else
{
xmlHttpReq.onreadystatechange=function(){;}
}
xmlHttpReq.open("GET",url,async);
xmlHttpReq.send(null);
}
function postUrl(url,data,async,stateChangeCallback)
{
var xmlHttpReq=getXmlHttpRequest();
if(!xmlHttpReq)
return;
xmlHttpReq.open("POST",url,async);
xmlHttpReq.onreadystatechange=function()
{
stateChangeCallback(xmlHttpReq);
};
xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlHttpReq.send(data);
}
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 execOnSuccess(stateChangeCallback,successCallback,div_id)
{
return function(xmlHttpReq)
{
if(xmlHttpReq.readyState==4&&
xmlHttpReq.status==200){
if(div_id){
stateChangeCallback(xmlHttpReq,successCallback,div_id);
}else{
stateChangeCallback(xmlHttpReq,successCallback);
}
}
};
}
function postFormByForm(form,async,successCallback){
var formVars=new Array();
for(var i=0;i<form.elements.length;i++)
{
var formElement=form.elements[i];
if(formElement.type=='checkbox'&&!formElement.checked){
continue;
}
var v=new Object;
v.name=formElement.name;
v.value=formElement.value;
formVars.push(v);
}
postUrl(form.action,urlEncodeDict(formVars),async,execOnSuccess(successCallback));
}
function postForm(formName,async,successCallback)
{
var form=document.forms[formName];
return postFormByForm(form,async,successCallback);
}
function replaceDivContents(xmlHttpRequest,dstDivId)
{
var dstDiv=document.getElementById(dstDivId);
dstDiv.innerHTML=xmlHttpRequest.responseText;
}
function getUrlXMLResponseCallback(xmlHttpReq,successCallback){
if(xmlHttpReq.responseXML==null){
alert("Error while processing your request.");
return;
}
var root_node=getRootNode(xmlHttpReq);
var return_code=getNodeValue(root_node,'return_code');
if(return_code==0){
redirect_val=getNodeValue(root_node,'redirect_on_success');
if(redirect_val!=null){
window.location=redirect_val;
}else{
success_message=getNodeValue(root_node,'success_message');
if(success_message!=null){
alert(success_message);
}
if(successCallback!=null){
successCallback(xmlHttpReq);
}
}
}else{
var error_msg=getNodeValue(root_node,'error_message');
if(error_msg==null||error_msg.length==0){
error_msg="An error occured while performing this operation.";
}
alert(error_msg)
}
}
function getUrlXMLResponseCallbackFillDiv(xmlHttpReq,successCallback,div_id){
getUrlXMLResponseCallback(xmlHttpReq,successCallback);
document.getElementById(div_id).innerHTML=getNodeValue(xmlHttpReq.responseXML,"html_content");
}
function getUrlXMLResponseCallbackJSON(xmlHttpReq,successCallback){
getUrlXMLResponseCallback(xmlHttpReq);
successCallback(eval(getNodeValue(getRootNode(xmlHttpReq),"html_content")));
}
function getNodeValue(obj,tag)
{
node=obj.getElementsByTagName(tag);
if(node!=null&&node.length>0){
return node[0].firstChild.nodeValue;
}else{
return null;
}
}
function getRootNode(xmlHttpReq){
return xmlHttpReq.responseXML.getElementsByTagName('root')[0];
}
function getUrlXMLResponse(url,successCallback){
getUrl(url,true,execOnSuccess(getUrlXMLResponseCallback,successCallback))
}
function getUrlXMLResponseAndFillDiv(url,div_id,successCallback){
getUrl(url,true,execOnSuccess(getUrlXMLResponseCallbackFillDiv,successCallback,div_id))
}
function getUrlXMLResponseJSON(url,successCallback){
getUrl(url,true,execOnSuccess(getUrlXMLResponseCallbackJSON,successCallback))
}
getUrlXMLResponseJSON.prototype.getUrlXMLResponseCallbackJSON=getUrlXMLResponseCallbackJSON;
getUrlXMLResponseJSON.prototype.getUrlXMLResponseCallback=getUrlXMLResponseCallback;
function postUrlXMLResponse(url,data,successCallback){
postUrl(url,data,true,execOnSuccess(getUrlXMLResponseCallback,successCallback))
}
function confirmAndPostUrlXMLResponse(url,confirmMessage,data,successCallback){
if(confirm(confirmMessage)){
postUrlXMLResponse(url,data,successCallback);
}
}
function postFormXMLResponse(formName,successCallback){
postForm(formName,true,execOnSuccess(getUrlXMLResponseCallback,successCallback))
}
function toogleWatcher(token,current_video_id,stringOn,stringOff)
{
if(!self.sharing_active)
{
enableWatcherShare(token,current_video_id,stringOn);
}
else
{
disableWatcherShare(token,current_video_id,stringOff);
}
}
function enableWatcherShare(token,current_video_id,stringOn)
{
fadein();
var varg="";
if(current_video_id)
varg="&v="+current_video_id;
getUrlXMLResponse("/watcher?action_start_share=1"+varg+"&t="+token,showEnabledWatcher(stringOn));
}
function disableWatcherShare(token,current_video_id,stringOff)
{
var varg="";
if(current_video_id)
varg="&v="+current_video_id;
getUrlXMLResponse("/watcher?action_stop_share=1"+varg+"&t="+token,showDisabledWatcher(stringOff));
}
function showEnabledWatcher(newString)
{
self.sharing_active=true;
var img=document.getElementById("sharingImg");
removeClass(img,'activeSharingRed');
addClass(img,'activeSharingGreen');
alert(newString);
img.title=newString;
fadeout();
if(document.getElementById("activesharing_start_button")){
hideDiv('activesharing_start_button');
showDiv('activesharing_stop_button');
}
}
function showDisabledWatcher(newString)
{
self.sharing_active=false;
var img=document.getElementById("sharingImg");
removeClass(img,'activeSharingGreen');
addClass(img,'activeSharingRed');
alert(newString);
img.title=newString;
if(document.getElementById("activesharing_start_button")){
showDiv('activesharing_start_button');
hideDiv('activesharing_stop_button');
}
}
function makearray(n){
this.length=n;
for(var i=1;i<=n;i++)
this[i]=0;
return this;
}
hexa=new makearray(16);
for(var i=0;i<10;i++)
hexa[i]=i;
hexa[10]="a";hexa[11]="b";hexa[12]="c";
hexa[13]="d";hexa[14]="e";hexa[15]="f";
function hex(i){
if(i<0)
return "00";
else if(i>255)
return "ff";
else
return ""+hexa[Math.floor(i/16)]+hexa[i%16];
}
function setbgColor(r,g,b){
var hr=hex(r);var hg=hex(g);var hb=hex(b);
document.getElementById('shareSpan').style.backgroundColor="#"+hr+hg+hb;
}
function fade(sr,sg,sb,er,eg,eb,step){
for(var i=0;i<=step;i++){
setbgColor(
Math.floor(sr*((step-i)/step)+er*(i/step)),
Math.floor(sg*((step-i)/step)+eg*(i/step)),
Math.floor(sb*((step-i)/step)+eb*(i/step)));
}
}
function fadein(){
fade(255,255,255,102,204,0,825);
}
function fadeout(){
setTimeout("fade(102,204,0, 255,255,255,2025)",800)
}
function stripNonNumber(val){
return val.replace(/[^\d]/g,'')
}
var videolist=new Array();
var removelist=new Array();
function clear_watch_queue()
{
postUrlXMLResponse("/watch_queue_ajax","&action_clear_queue",self.queueClearedReloadPage);
}
function clear_watch_queue_watch_page()
{
postUrlXMLResponse("/watch_queue_ajax","&action_clear_queue",self.queueCleared);
var watchqueue_div=document.getElementById('watchqueue');
var watchqueue_new_div=document.getElementById('watchqueueStartNew');
if(watchqueue_div){
closeDiv('watchqueue');
}
if(watchqueue_new_div){
closeDiv('watchqueueStartNew');
}
var wt=document.getElementById("watchlist_table").tBodies[0];
if(wt){
for(var i=wt.rows.length-1;i>=0;i--){
var row_id=wt.rows[i].getAttribute('id');
if(row_id!=null&&row_id!=''&&row_id.match('^vid_row_')){
wt.removeChild(document.getElementById(row_id));
}
}
}
quicklist_count=0;
document.getElementById('play_all_numb').innerHTML=quicklist_count+" ";
}
function add_to_watch_queue(video_id)
{
videolist.push(video_id);
post_videos_to_server();
return false;
}
function remove_from_watch_queue(video_id)
{
removelist.push(video_id);
delete_videos_from_server();
return false;
}
function set_pop_status(pop_status)
{
postUrlXMLResponse("/watch_queue_ajax","action_set_pop_status&pop_videos="+pop_status,self.popStatusSet)
}
function popStatusSet(){
}
function post_videos_to_server(){
if(videolist.length>0){
postUrlXMLResponse("/watch_queue_ajax","&action_add_to_queue&video_id="+videolist[videolist.length-1],self.videoQueued);
videolist.pop();
}
}
function delete_videos_from_server(){
if(removelist.length>0){
postUrlXMLResponse("/watch_queue_ajax","&action_remove_from_queue&video_id="+removelist[removelist.length-1],self.videoRemoved);
removelist.pop();
}
}
function queueCleared(xmlHttpRequest)
{
window.location=window.location.href;
}
function queueClearedReloadPage(xmlHttpRequest)
{
window.location="watch_queue?all";
}
function videoQueued(xmlHttpRequest)
{
xmlObj=xmlHttpRequest.responseXML;
if(xmlObj!=null&&getNodeValue(xmlObj,"msg")!="exists"){
post_videos_to_server();
}
}
function videoRemoved(xmlHttpRequest)
{
delete_videos_from_server();
}
function clicked_add_icon(video_ID,fromRelated){
if(video_exists_in_quickList(video_ID))return;
add_to_watch_queue(video_ID);
quicklist_count++;
if(fromRelated==1){
showQuickList_first_add();
document.getElementById('play_all_numb').innerHTML=quicklist_count+'&nbsp;';
if(document.getElementById('show_all_video_number')){
document.getElementById('show_all_video_number').innerHTML=quicklist_count;
}
}
var button_name='add_button_'+video_ID;
removeClass(document.getElementById(button_name),'QLIconImg');
removeClass(document.getElementById(button_name),'QLIconImgOver');
addClass(document.getElementById(button_name),'QLIconImgDone');
document.getElementById(button_name).blur();
}
function mouse_over_add_icon(video_ID){
mouse_over_add_icon_element(_gel('add_button_'+video_ID));
}
function mouse_over_add_icon_element(el){
if(el.className.match('Done')){
removeClass(el,'QLIconImg');
removeClass(el,'QLIconImgOver');
addClass(el,'QLIconImgDone');
}else{
removeClass(el,'QLIconImg');
removeClass(el,'QLIconImgDone');
addClass(el,'QLIconImgOver');
}
}
function mouse_out_add_icon(video_ID){
mouse_out_add_icon_element(_gel('add_button_'+video_ID));
}
function mouse_out_add_icon_element(el){
if(el.className.match('Done')){
removeClass(el,'QLIconImg');
removeClass(el,'QLIconImgOver');
addClass(el,'QLIconImgDone');
}else{
removeClass(el,'QLIconImgDone');
removeClass(el,'QLIconImgOver');
addClass(el,'QLIconImg');
}
}
function showQuickList_first_add(){
if(document.getElementById('watchqueueStartNew')){
openDiv('watchqueueStartNew');
}
if(getQuickCookie()=='yes'){
openDiv('watchlist_container');
openDiv('save_row');
}
if(document.getElementById('quicklist_intro')){
closeDiv('quicklist_intro');
}
}
function removeVideo(video_id){
var row_id="vid_row_"+video_id;
remove_from_watch_queue(video_id);
var tbody=document.getElementById("watchlist_table").tBodies[0];
var total_rows=tbody.rows.length-1;
var current_row=tbody.rows[row_id].cells[0].innerHTML;
var current_row_in_table=tbody.rows[row_id].rowIndex-1;
for(i=total_rows;i>current_row_in_table;i--){
tbody.rows[i].cells[0].innerHTML=tbody.rows[i].cells[0].innerHTML-1;
}
tbody.removeChild(document.getElementById(row_id));
quicklist_count--;
document.getElementById('play_all_numb').innerHTML=quicklist_count+" ";
if(document.getElementById('show_all_video_number')){
document.getElementById('show_all_video_number').innerHTML=quicklist_count;
}
}
var first_video_id;
var first_video_url;
var first_video_image_url;
var first_video_title;
function video_exists_in_quickList(video_id){
return document.getElementById("vid_row_"+video_id)?true:false;
}
function print_quicklist_video(img_url,vid_title,username,vid_id,runtime){
if(video_exists_in_quickList(vid_id))return;
var vid_number=document.getElementById('watchlist_table').rows.length;
if(document.getElementById('watchlist_table').rows.length<2){
showQuickList_first_add();
}
var new_video_number=quicklist_count;
var temp_vid_title=unescape(vid_title);
var div_id_1="1_"+vid_id;
var div_id_2="2_"+vid_id;
var div_id_3="3_"+vid_id;
var div_id_4="4_"+vid_id;
var div_content_1=new_video_number;
var div_content_2='<a href="/watch?v='+vid_id+'"><img src="'+img_url+'" width="43" height="33" border="0" style="padding:3px;" align="middle"></a>';
var div_content_3='<div onClick=\'window.location="/watch?v='+vid_id+'";\' style="cursor:hand;cursor:pointer;"><div class="vtitle"><a href="/watch?v='+vid_id+'" >'+temp_vid_title+'</a></div><div class="vfacets"><span class="grayText">From: '+username+'</span></div></div>';
var div_content_4='<span class="grayText smallText">'+runtime+'</span> &nbsp;<span class="grayText"><a href="#" onClick="removeVideo(\''+vid_id+'\');return false;" title="Remove Video From QuickList"><img src="http://static.youtube.com/yt/img/icn_trash_10x12-vfl11600.gif" valign="middle" alt="Remove Video" border="0" /></a>&nbsp;';
var tbody=document.getElementById("watchlist_table").tBodies[0];
var row=document.createElement("TR");
row.setAttribute("id","vid_row_"+vid_id);
var cell1=document.createElement("TD");
cell1.setAttribute("id","1_"+vid_id);
cell1.setAttribute("width","8");
cell1.setAttribute("class","grayText");
var cell2=document.createElement("TD");
var tempDiv_2=document.createElement("DIV");
tempDiv_2.setAttribute("id","2_"+vid_id);
tempDiv_2.setAttribute("width","55");
var cell3=document.createElement("TD");
var tempDiv_3=document.createElement("DIV");
tempDiv_3.setAttribute("id","3_"+vid_id);
tempDiv_3.setAttribute("align","left");
tempDiv_3.setAttribute("width","313");
var cell4=document.createElement("TD");
cell4.setAttribute("align","right");
var tempDiv_4=document.createElement("DIV");
tempDiv_4.setAttribute("id","4_"+vid_id);
tempDiv_4.setAttribute("width","50");
cell2.appendChild(tempDiv_2);
cell3.appendChild(tempDiv_3);
cell4.appendChild(tempDiv_4);
row.appendChild(cell1);
row.appendChild(cell2);
row.appendChild(cell3);
row.appendChild(cell4);
tbody.appendChild(row);
if(document.getElementById('now_playing_end')){
if(document.getElementById('watchlist_table').rows.length>6){
setTimeout("jumpToNowPlaying(1);",200);
}
else{
if(quicklist_count>5){
jumpToNowPlaying(1);
}
}
}
document.getElementById(div_id_1).innerHTML=div_content_1;
document.getElementById(div_id_2).innerHTML=div_content_2;
document.getElementById(div_id_3).innerHTML=div_content_3;
document.getElementById(div_id_4).innerHTML=div_content_4;
if(document.getElementById('watchlist_table').rows.length<3){
first_video_id=vid_id;
first_video_url="/watch?v="+vid_id;
first_video_image_url=img_url;
first_video_title=temp_vid_title.substring(0,30);
document.getElementById('next_video_url_1').href=first_video_url;
document.getElementById('next_video_url_2').href=first_video_url;
document.getElementById('next_video_title').innerHTML=first_video_title;
document.getElementById('next_video_image_url').src=first_video_image_url;
document.getElementById('play_all_buttton').src="http://static.youtube.com/yt/img/btn_play_quicklist_33x25-vfl11985.gif";
}
}
function play_all_start_new(){
tempURL='/watch?v='+first_video_id+'&playnext=1';
window.location=tempURL;
document.getElementById('play_all_buttton').blur();
}
function showQuickList(){
if(getQuickCookie()=='no'){
closeDiv('watchlist_container');
closeDiv('save_row');
document.getElementById('watch_queue_show_hide').src='http://static.youtube.com/yt/img/btn_watchqueue_show_33x25-vfl11985.gif';
}
}
function jumpToNowPlaying(endOfList){
if(navigator.appName=='Microsoft Internet Explorer'){
pixelsFromTop=document.documentElement.scrollTop;
}
else{
pixelsFromTop=window.pageYOffset;
}
if(navigator.userAgent.indexOf('Safari')==-1){
if(endOfList==1){
if(document.getElementById('now_playing_end')){
location.href='#now_playing_end';
}
}
else{
if(document.getElementById('now_playing')){
location.href='#now_playing';
}
}
window.scrollTo(0,pixelsFromTop);
}
}
function clickedHideShowButton(){
if(document.getElementById('watch_queue_show_hide').src.match('show')){
document.getElementById('watch_queue_show_hide').src='http://static.youtube.com/yt/img/btn_watchqueue_hide_33x25-vfl11985.gif';
openDiv('watchlist_container');
openDiv('save_row');
setQuickCookie('yes');
}
else{
document.getElementById('watch_queue_show_hide').src='http://static.youtube.com/yt/img/btn_watchqueue_show_33x25-vfl11985.gif';
closeDiv('watchlist_container');
closeDiv('save_row');
setQuickCookie('no');
}
document.getElementById('watch_queue_show_hide').blur();
}
function setQuickCookie(yesNo)
{
var today=new Date();
var expire=new Date();
expire.setTime(today.getTime()+7*24*3600000);
document.cookie="quicklist="+yesNo+";expires="+expire.toGMTString()+";domain=youtube.com";
}
function getQuickCookie()
{
if(document.cookie.length>0)
{
var cookiename="quicklist";
var quickStart=document.cookie.indexOf(cookiename+"=");
if(quickStart!=-1)
{
quickStart+=cookiename.length+1;
quickEnd=document.cookie.indexOf(";",quickStart);
if(quickEnd==-1)quickEnd=document.cookie.length;
return document.cookie.substring(quickStart,quickEnd);
}
}
return null;
}
(function(){
YTHovercard=function(){
this.html_=
"<div id='hovercard'>"+
"  <iframe id='hovercard_iframe' width='350' height='150' frameborder='0' allowtransparency='true' scrolling='no'>"+
"  </iframe>"+
"</div>";
this.container=document.createElement("div");
this.container.innerHTML=this.html_;
this.container.style.overflow="hidden";
this.container.style.zIndex=100;
this.container.id="hvcd";
this.container.style.display="none";
this.container.style.position="absolute";
this.container.style.zIndex="100";
this.timer=null;
this.show_delay_ms=250;
this.htimer=null;
this.hide_delay_ms=250;
};
YTHovercard.prototype.setShowDelayMs=function(delay){
this.show_delay_ms=delay;
};
YTHovercard.prototype.setHideDelayMs=function(delay){
this.hide_delay_ms=delay;
};
YTHovercard.prototype.hideContainer=function(){
this.container.style.display="none";
};
function getObjectCoordinates(currentElem){
var offsetLeft=0;
var offsetTop=0;
while(currentElem){
offsetLeft+=currentElem.offsetLeft;
offsetTop+=currentElem.offsetTop;
currentElem=currentElem.offsetParent;
}
if(navigator.userAgent.indexOf("Mac")!=-1&&
typeof document.body.leftMargin!="undefined"){
offsetLeft+=document.body.leftMargin;
offsetTop+=document.body.topMargin;
}
return{left:offsetLeft,top:offsetTop};
}
var YTHovercard_singleton=null;
function pop_hovercard(){
try{
var hovercard=YTHovercard_singleton.container;
hovercard.style.display="";
}catch(e){
}
}
function hide_hovercard(){
try{
var hovercard=YTHovercard_singleton.container;
hovercard.style.display="none";
}catch(e){
}
}
window._popup_hovercard=function(element,username){
return;
if(YTHovercard_singleton==null){
YTHovercard_singleton=new YTHovercard();
document.body.appendChild(YTHovercard_singleton.container);
}
var hovercard=YTHovercard_singleton.container;
try{
var position=getObjectCoordinates(element);
var browserWidth=document.body.scrollWidth;
var overSize=position.left+350-browserWidth+4;
if(overSize>0){
position.left-=overSize;
}
hovercard.style.display="none";
var internal_iframe=document.getElementById("hovercard_iframe");
internal_iframe.src="/hovercard?user="+username;
internal_iframe.style.height="0px";
hovercard.style.top=(position.top+10)+"px";
hovercard.style.left=position.left+"px";
hovercard.style.position="absolute";
}catch(e){
}
YTHovercard_singleton.timer=
setTimeout(pop_hovercard,YTHovercard_singleton.show_delay_ms);
element.onmouseout=function(){
YTHovercard_singleton.htimer=
setTimeout(hide_hovercard,YTHovercard_singleton.hide_delay_ms);
};
hovercard.onmouseout=function(){
YTHovercard_singleton.htimer=
setTimeout(hide_hovercard,YTHovercard_singleton.hide_delay_ms);
}
hovercard.onmouseover=function(){
clearTimeout(YTHovercard_singleton.htimer);
}
};
})();
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;
if((navigator.appVersion.indexOf('MSIE')>-1)&&(typeof window.XMLHttpRequest=='undefined')){
imgExt='gif';
}
else
{
imgExt='png';
}
var UT_RATING_IMG='icn_star_full_19x20'+imgExt;
var UT_RATING_IMG_HOVER='http://static.youtube.com/yt/img/star_hover-vfl2056.gif';
var UT_RATING_IMG_HALF='icn_star_half_19x20'+imgExt;
var UT_RATING_IMG_BG='icn_star_empty_19x20'+imgExt;
var UT_RATING_IMG_REMOVED='http://static.youtube.com/yt/img/star_removed-vfl2028.gif';
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;
that=this;
onLoadFunctionList.push(function(){that.drawStars(that.starCount,true);});
}
if(size=='S'){
UT_RATING_IMG='icn_star_full_11x11gif'
UT_RATING_IMG_HALF='icn_star_half_11x11gif'
UT_RATING_IMG_BG='icn_star_empty_11x11gif'
}
function showStars(starNum,skipMessageUpdate){
this.clearStarTimer();
this.greyStars();
this.colorStars(starNum);
if(!skipMessageUpdate)
this.setMessage(starNum,messages);
}
function setMessage(starNum){
if(starNum>0){
if(!this.savedMessage){
this.savedMessage=document.getElementById(this.ratingMessageId).innerHTML;
}
document.getElementById(this.ratingMessageId).innerHTML=this.messages[starNum-1];
}else if(this.savedMessage){
document.getElementById(this.ratingMessageId).innerHTML=this.savedMessage;
}
}
function colorStars(starNum){
for(var i=0;i<starNum;i++){
removeClass(document.getElementById('star_'+this.componentSuffix+"_"+(i+1)),UT_RATING_IMG_HALF);
removeClass(document.getElementById('star_'+this.componentSuffix+"_"+(i+1)),UT_RATING_IMG_BG);
addClass(document.getElementById('star_'+this.componentSuffix+"_"+(i+1)),UT_RATING_IMG);
}
}
function greyStars(){
for(var i=0;i<this.maxStars;i++)
if(i<=this.starCount){
removeClass(document.getElementById('star_'+this.componentSuffix+"_"+(i+1)),UT_RATING_IMG);
removeClass(document.getElementById('star_'+this.componentSuffix+"_"+(i+1)),UT_RATING_IMG_HALF);
addClass(document.getElementById('star_'+this.componentSuffix+"_"+(i+1)),UT_RATING_IMG_BG);
}
else
{
removeClass(document.getElementById('star_'+this.componentSuffix+"_"+(i+1)),UT_RATING_IMG);
removeClass(document.getElementById('star_'+this.componentSuffix+"_"+(i+1)),UT_RATING_IMG_HALF);
addClass(document.getElementById('star_'+this.componentSuffix+"_"+(i+1)),UT_RATING_IMG_BG);
}
}
function setStars(starNum){
this.starCount=starNum;
this.drawStars(starNum);
document.forms[this.formName]['rating'].value=this.starCount;
var ratingElementId=this.ratingElementId;
that=this;
postForm(this.formName,true,function(req){
replaceDivContents(req,ratingElementId);
if(that.callback){
that.callback();
}
});
}
function drawStars(starNum,skipMessageUpdate){
this.starCount=starNum;
this.showStars(starNum,skipMessageUpdate);
}
function clearStars(){
this.starTimer=setTimeout(this.objectName+".resetStars()",300);
}
function resetStars(){
this.clearStarTimer();
if(this.starCount)
this.drawStars(this.starCount);
else
this.greyStars();
this.setMessage(0);
}
function clearStarTimer(){
if(this.starTimer){
clearTimeout(this.starTimer);
this.starTimer=null;
}
}
this.clearStars=clearStars;
this.clearStarTimer=clearStarTimer;
this.greyStars=greyStars;
this.colorStars=colorStars;
this.resetStars=resetStars;
this.setStars=setStars;
this.drawStars=drawStars;
this.showStars=showStars;
this.setMessage=setMessage;
}
ratingHoverTimers=[]
function ratingHoverOver(componentSuffix){
if(componentSuffix==""){
componentSuffix=="reserved"
}
_clearHoverTimer(componentSuffix);
hideDiv('defaultRatingMessage'+componentSuffix);
showDiv('hoverMessage'+componentSuffix);
}
function ratingHoverOut(componentSuffix){
if(componentSuffix==""){
componentSuffix=="reserved"
}
ratingHoverTimers[componentSuffix]=setTimeout(function(){_ratingHoverClear(componentSuffix);},300);
}
function _ratingHoverClear(componentSuffix){
if(componentSuffix==""){
componentSuffix=="reserved"
}
_clearHoverTimer();
hideDiv('hoverMessage');
showDiv('defaultRatingMessage');
}
function _clearHoverTimer(componentSuffix){
if(componentSuffix==""){
componentSuffix=="reserved"
}
if(ratingHoverTimers[componentSuffix]){
clearTimeout(ratingHoverTimers[componentSuffix]);
ratingHoverTimers[componentSuffix]=null;
}
}
function approveComment(comment_id,comment_type,entity_id,token)
{
if(CheckLogin()==false)
return false;
postUrlXMLResponse("/comment_servlet","&field_approve_comment=1&comment_id="+comment_id+"&comment_type="+comment_type+"&entity_id="+entity_id+"&"+token,self.commentApproved);
return false;
}
function removeComment(div_id,deleter_user_id,comment_id,comment_type,entity_id,token)
{
self.div_id=div_id
self.commentRemoved=commentRemoved
if(CheckLogin()==false)
return;
postUrlXMLResponse("/comment_servlet","deleter_user_id="+deleter_user_id+"&remove_comment&comment_id="+comment_id+"&comment_type="+comment_type+"&entity_id="+entity_id+"&"+token,self.commentRemoved);
return false;
}
function commentRemoved(xmlHttpRequest)
{
toggleVisibility(self.div_id,false);
return;
}
function hideCommentReplyForm(form_id){
var div_id="div_"+form_id;
var reply_id="reply_"+form_id;
toggleVisibility(reply_id,true);
toggleVisibility(div_id,false);
}
function handleStateChange(xmlHttpReq){
document.getElementById("all_comments_content").innerHTML=getNodeValue(xmlHttpReq.responseXML,"html_content");
style2=document.getElementById("recent_comments").style;
style2.display="none";
var style2=document.getElementById("all_comments").style;
style2.display="";
}
function showAjaxDivLoggedIn(divName,url,callback){
getUrlXMLResponse(url,showAjaxDivResponseLater(divName,callback));
}
function showAjaxPostDivLoggedIn(divName,url,data,callback){
postUrlXMLResponse(url,data,showAjaxDivResponseLater(divName,callback));
}
function showAjaxDiv(divName,url){
if(isLoggedIn){
showAjaxDivLoggedIn(divName,url)
}else{
alert(MSG_Login);
}
}
function showAjaxPostDiv(divName,url,data){
if(isLoggedIn){
showAjaxPostDivLoggedIn(divName,url,data)
}else{
alert(MSG_Login);
}
}
function showAjaxDivResponseLater(divName,callback){
return function(req){
_gel(divName).innerHTML=getNodeValue(req.responseXML,"html_content");
if(callback&&typeof callback=="function"){
callback();
}
};
}
function showAjaxDivResponse(req,divName){
_gel(divName).innerHTML=getNodeValue(req.responseXML,"html_content");
openDiv(divName);
}
function postAjaxForm(divName,formName,successCallback){
postFormXMLResponse(formName,closeAjaxDivLater(divName,successCallback));
}
function closeAjaxDivLater(divName,successCallback){
return function(req){
closeDiv(divName);
if(successCallback){
successCallback();
}
}
}
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;
}
function actionOver(div){
div.className='actionOver';
}
function actionOut(div){
div.className='actionRow';
}
function actionClick(div){
div.className='actionClicked';
}
function actionOverBottom(div){
div.className='actionOverBottom';
}
function actionOutBottom(div){
div.className='actionRowBottom';
}
function actionClickBottom(div){
div.className='actionClickedBottom';
}
function closeDisplay(div){
if(_gel(div)){
_gel(div).style.display="none";
}
}
function shareVideoFromFlash(){
shareVideo(pageVideoId);
smoothScrollIntoView(_gel("shareVideoDiv"),20);
}
function closeAll(except){
var divs=['addToFavesDiv','addToPlaylistDiv','shareVideoDiv','inappropriateVidDiv','customizeEmbedDiv','shareVideoEmailDiv','loginPleaseDiv','reportConcernResult1','reportConcernResult2','reportConcernResult3','reportConcernResult4','reportConcernResult5'];
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 postResponse(){
if(isLoggedIn){
closeAll('postResponseDiv');
toggleDisplay('postResponseDiv');
}
else
{
alert(MSG_LoginPostResponse);
}
}
function closeAfter(divName,delay){
setTimeout(function(){
closeDisplay(divName)
},delay);
}
function postResponseClose(){
toggleDisplay('postResponseDiv');
toggleDisplay('postResponseResult');
closeAfter('postResponseResult',3000);
}
function customizeEmbed(){
closeAll('customizeEmbedDiv');
toggleDisplay('customizeEmbedDiv');
}
function loginPlease(){
closeAll('loginPleaseDiv');
toggleDisplay('loginPleaseDiv');
if(_gel('loginPleaseDiv').style.display=="block"){
_gel('loginPleaseUser').focus();
}
}
function addToFaves(formName){
if(isLoggedIn){
closeAll('addToFavesResult');
toggleDisplay('addToFavesResult');
postAjaxForm('addToFavesDiv',formName);
_hbLink('Save+To+Favorites','Watch3');
addClass(_gel('a2_i2'),'disabled');
setTimeout("closeDisplay('addToFavesResult')",3000);
}
else{
loginPlease();
}
}
var gWatchLoading='';
function addToPlaylist(videoId){
if(isLoggedIn){
if(!gWatchLoading){
gWatchLoading=_gel('addToPlaylistDiv').innerHTML;
}else{
_gel('addToPlaylistDiv').innerHTML=gWatchLoading;
}
closeAll('addToPlaylistDiv');
if(toggleDisplay('addToPlaylistDiv')){
showAjaxDivLoggedIn('addToPlaylistDiv','/watch_ajax?video_id='+videoId+'&action_get_new_playlists_component=1',true);
_hbLink('Add+To+Playlists','Watch3');
}
}
else{
loginPlease();
}
}
function submitToBlog(self){
_gel('submitToBlogBtn').disabled=true;
postAjaxForm('shareVideoDiv',self.name,addToBlogClose);
}
function addToBlogClose(){
toggleDisplay('addToBlogResult');
closeAfter('addToBlogResult',3000);
_gel('submitToBlogBtn').disabled=false;
}
function submitToPlaylist(self){
if(!self.form.playlist_id.value){
return;
}
self.disabled=true;
postAjaxForm('addToPlaylistDiv',self.form.name,addToPlaylistClose);
}
function addToPlaylistClose(){
toggleDisplay('addToPlaylistResult');
closeAfter('addToPlaylistResult',3000);
}
function reportConcern(videoId){
if(isLoggedIn){
closeAll('inappropriateVidDiv');
if(toggleDisplay('inappropriateVidDiv')){
if(_gel('inappropriateVidDiv').innerHTML.indexOf('<div')!=-1){
return;
}
showAjaxDivLoggedIn('inappropriateVidDiv','/watch_ajax?video_id='+videoId+'&action_get_flag_video_component=1',true);
_hbLink('Flag+Inappropriate','Watch3');
}
}
else{
loginPlease();
}
}
function reportConcernClose(){
toggleDisplay('inappropriateVidDiv');
toggleDisplay('reportConcernResult');
closeAfter('reportConcernResult',3000);
}
function shareVideo(videoId){
closeAll('shareVideoDiv');
toggleDisplay('shareVideoDiv');
if(_gel('shareVideoDiv').style.display!="none"){
if(this.loaded===undefined){
showAjaxDivLoggedIn('shareVideoDiv','/watch_ajax?video_id='+videoId+'&action_get_share_video_component=1',true);
this.loaded=true;
}
_hbLink('Share+Video','Watch3');
}
}
function shareVideoEmail(videoId){
toggleDisplay('shareVideoEmailDiv');
}
function shareVideoClose(){
toggleDisplay('shareVideoDiv');
toggleDisplay('shareVideoResult');
closeAfter('shareVideoResult',3000);
}
function shareWorld(){
closeAll('shareWorldDiv');
toggleDisplay('shareVideoDiv');
toggleDisplay('shareWorldDiv');
}
function shareWorldClose(){
toggleDisplay('shareWorldDiv');
toggleDisplay('shareWorldResult');
setTimeout("closeDisplay('shareWorldResult')",3000);
}
function embedIt(){
closeAll('embedItDiv');
toggleDisplay('embedItDiv');
}
function showHonorsContent(){
getAndShowNavContent('honors',honorsLink);
}
function writeAcdcMoviePlayer(div,state){
var s=_pick(state,new Object());
var p=null;
var swfUrl=_pick(s.swfUrl);
var force=_pick(s.forceSwfVersion,false);
var fo=new SWFObject(swfUrl,"movie_player","480","395",(force?"7":"0"),"#FFFFFF");
fo.addParam("allowFullScreen","true");
var swfArgs=_pick(s.swfArgs,new Object());
for(var swfArg in swfArgs){fo.addVariable(swfArg,swfArgs[swfArg]);}
p=_pick(s.sourceId);
if(p!=null)fo.addVariable("sourceid",p);
p=_pick(s.sourceDetail);
if(p!=null)fo.addVariable("sdetail",p);
p=_pick(s.watchQuery);
if(p!=null)fo.addVariable("q",p);
p=_pick(s.trackingId);
if(p!=null)fo.addVariable("plid",p);
p=_pick(s.gamUrl);
if(p!=null)fo.addVariable("gam",p);
p=_pick(s.dcUrl);
if(p!=null)fo.addVariable("ad_tag",p);
p=_pick(s.playAll);
if(p!=null)fo.addVariable("playnext",p);
p=_pick(s.border);
fo.addVariable("border",(!!p?1:0));
p=_pick(s.videoId);
if(p!=null)fo.addVariable("video_id",p);
p=_pick(s.videoQuery);
if(p!=null)fo.addVariable("video_query",p);
p=_pick(s.docKey);
if(p!=null)fo.addVariable("doc_key",p);
p=_pick(s.autoplay);
if(p!=null)fo.addVariable("autoplay",p);
p=_pick(s.rel);
if(p!=null)fo.addVariable("rel",p);
p=_pick(s.videoPubId);
if(p!=null)fo.addVariable("video_pub_id",p);
p=_pick(s.channelId);
if(p!=null)fo.addVariable("channel_id",p);
p=_pick(s.wmode);
if(p!=null)fo.addParam("wmode",p);
p=_pick(s.allowScriptAccess);
if(p!=null)fo.addParam("allowscriptaccess",p);
fo.write(div);
}
function writeMoviePlayer(player_div,force){
var v="7";
if(force)
v="0";
var fo=new SWFObject(swfUrl,"movie_player","480","395",v,"#FFFFFF");
fo.addParam("allowFullscreen","true");
for(var x in swfArgs){
fo.addVariable(x,swfArgs[x]);
}
if(watchSourceId){
fo.addVariable("sourceid",watchSourceId);
}
if(watchSourceDetail){
fo.addVariable("sdetail",watchSourceDetail);
}
if(watchQuery){
fo.addVariable("q",watchQuery);
}
if(watchPlayerTrackingId){
fo.addVariable("plid",watchPlayerTrackingId);
}
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");
}
player_written=fo.write(player_div);
}
function setSWFVersion(version_from_swf)
{
if(watchTrackWithHitbox){
_hbPageView("WatchSWFTracker/"+player_written,"FlashTracker3");
}
if(!player_written)
writeMoviePlayer("playerDiv",true);
}
function closeFullStats(){
toggleDisplay('fullStats');
if(_gel('showhide')){
_gel('showhide').innerHTML='Show';
}
}
function toggleLinkStats(){
if(_gel('fullStats').style.display!='none'&&_gel('fullStats').style.display){
toggleDisplay('fullStats');
}
toggleDisplay('linkStats');
}
function toggleFullStats(statsContent){
if(statsContent===undefined){
statsContent='honors';
ajaxUrl=additionalStatsHonorsUrl;
_gel('referDiv').style.display='block';
}
else if(statsContent=='audio'){
ajaxUrl=additionalStatsAudioUrl;
_gel('referDiv').style.display='none';
}
var fsd=_gel('fullStats').style.display;
if(fsd=='none'||fsd==''){
showAjaxDivLoggedIn('additionalStatsDiv',ajaxUrl,false);
if(statsContent=='audio'){
_gel('showhide').innerHTML=MSG_Hide;
}
if(_gel('linkStats').style.display!='none'&&_gel('linkStats').style.display){
toggleDisplay('linkStats');
}
toggleDisplay('fullStats');
}
else
{
if(((statsContent=='honors'&&_gel('audioStatHead'))||(statsContent=='audio'&&_gel('honorStatHead'))))
{
showAjaxDivLoggedIn('additionalStatsDiv',ajaxUrl,false);
if(statsContent=='honors'){
_gel('showhide').innerHTML=MSG_Show;
}
else if(statsContent=='audio'){
_gel('showhide').innerHTML=MSG_Hide;
}
}
else
{
toggleDisplay('fullStats');
if(statsContent=='audio'){
_gel('showhide').innerHTML=MSG_Show;
}
}
}
}
function showAllQueuedVideos(){
setInnerHTML('show_all_queued_videos_div',MSG_Loading);
getAndShowNavContent('watchlist_container',watchlistContainerUrl,postShowAllQueuedVideos);
}
function postShowAllQueuedVideos(){
setInnerHTML('show_all_queued_videos_div',MSG_ShowingAll);
jumpToNowPlaying();
}
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 isCurrentlyPlayingVideoInPlaylist(component){
var videosInPlaylist=getPlaylistVideoCount(component);
for(i=0;i<videosInPlaylist;i++){
var currentRow=_gel(getId('playlistRow',playnextFrom,i));
if(hasClass(currentRow,'playlistRowPlaying')){
return true;
}
}
}
function gotoNext(){
if(playnextFrom){
var nextRow=_gel(getId("playlistRow",playnextFrom,0));
var videosInPlaylist=getPlaylistVideoCount(playnextFrom);
for(i=0;i<videosInPlaylist;i++){
var currentRow=_gel(getId('playlistRow',playnextFrom,i));
if(hasClass(currentRow,'playlistRowPlaying')){
if(i+1<videosInPlaylist){
nextRow=_gel(getId('playlistRow',playnextFrom,i+1));
}else{
nextRow=null;
}
break;
}
}
if(nextRow){
window.location=getUrlFromPlaylistRow(nextRow)+"&playnext="+(parseInt(playnextCount)+1)+"&playnext_from="+playnextFrom;
}
}
}
var autoNextComponents=['PL','QL'];
function autoNext(suffix){
playnextFrom=suffix;
for(var i=0;i<autoNextComponents.length;i++){
if(autoNextComponents[i]==suffix){
showDiv(getId("playingall",autoNextComponents[i]));
hideDiv(getId("playall",autoNextComponents[i]));
}else{
hideDiv(getId("playingall",autoNextComponents[i]));
showDiv(getId("playall",autoNextComponents[i]));
}
}
var p=_gel("movie_player");
if(p.GetVariable("movie.is_playing")=="false"&&p.GetVariable("movie.restart")=="true"){
gotoNext();
}else if(!isCurrentlyPlayingVideoInPlaylist(suffix)){
gotoNext();
}else{
p.SetVariable("playnext","1");
}
return false;
}
function autoNextOff(suffix){
playnextFrom="";
_gel("movie_player").SetVariable("playnext","0");
showDiv(getId("playall",suffix));
hideDiv(getId("playingall",suffix));
return false;
}
function CheckLogin(){
return isLoggedIn;
}
function getId(baseId,component,index){
var id=baseId;
if(component!=null)
id+="_"+component;
if(index!=null)
id+="_"+index;
return id;
}
function onQuickAddClick(imgClicked,encryptedId){
imgClicked.onclick=null;
imgClicked.blur();
var suffix='QL';
var videosInPlaylist=getPlaylistVideoCount(suffix);
var alreadyInList=false;
for(var i=0;i<videosInPlaylist;i++){
var videoRow=_gel(getId("playlistRow",suffix,i));
if(encryptedId==getNodeVideoId(videoRow)){
alreadyInList=true;
break;
}
}
if(!alreadyInList){
var newRow=_gel("playlistRow_placeholder_QL").cloneNode(true);
var videoCount=getPlaylistVideoCount("QL");
fillQuicklistRow(newRow,videoCount,"","http://static.youtube.com/yt/img/pixel-vfl73.gif",MSG_Loading,"","");
removeClass(newRow,"hide");
setNodeVideoId(newRow,encryptedId);
addClass(newRow,"loading");
var rows=_gel("playlistRows_QL");
var lastRow=_gel(getId('playlistRow','QL',videoCount-1));
if(lastRow){
rows.insertBefore(newRow,lastRow.nextSibling);
}else{
rows.insertBefore(newRow,rows.firstChild);
}
scrollPlaylistToVideo('QL',videoCount);
if(incrementPlaylistVideoCount('QL',1)>4){
var containerNode=_gel(getId("playlistContainer",'QL'));
removeClass(containerNode,"autoHeight");
addClass(containerNode,"fixedHeight175");
}
GlobalEvents.fireEvent('QLItemAdded',encryptedId);
}
clickedQuickAdd(imgClicked,encryptedId,alreadyInList);
_hbLink('QuickList+AddTo','Watch3');
showDiv('quicklistDiv');
return false;
}
function showPlaylist(component){
showDiv(getId("playlistOpen",component));
hideDiv(getId("playlistClosed",component));
return false;
}
function hidePlaylist(component){
showDiv(getId("playlistClosed",component));
hideDiv(getId("playlistOpen",component));
return false;
}
var delayLoadRegistry=[];
var 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];
}
}
}
}
var showAjaxDivNotLoggedIn=showAjaxDivLoggedIn;
function hideLinkingSitesCallback(){
hideDiv('referersList');
hideInline('hideLinkingSites');
showInline('showLinkingSites');
showInline('linkingSitesDisabled');
}
function hideLinkingSites(){
postUrlXMLResponse('/watch_ajax','action_hide_linking_sites=1&video_id='+pageVideoId+'&'+axc,hideLinkingSitesCallback);
return false;
}
function showLinkingSites(){
hideInline('linkingSitesDisabled');
showInline('hideLinkingSites');
hideInline('showLinkingSites');
showAjaxPostDivLoggedIn('referersList','/watch_ajax','action_show_linking_sites=1&video_id='+pageVideoId+'&'+axc);
return false;
}
function toggleChannelVideos(username){
toggleClass('channel_videos_full','hide');
if(!_gel('more_channel_videos')){
var callback=function(){addQLIcons(_gel('channel_videos_full'));};
showAjaxDivLoggedIn('channel_videos_full','/watch_ajax?user='+username+'&action_channel_videos',callback);
}
return false;
}
function showRelatedAsList(){
setInnerHTML('relatedVidsBody',MSG_Loading);
var callback=function(){addQLIcons(_gel('relatedVidsBody'));};
showAjaxDivLoggedIn('relatedVidsBody',relatedVideoListUrl,callback);
showInline("relatedList");
hideInline("relatedNotList");
showInline("relatedNotGrid");
hideInline("relatedGrid");
return false;
}
function showRelatedAsGrid(){
setInnerHTML('relatedVidsBody',MSG_Loading);
var callback=function(){addQLIcons(_gel('relatedVidsBody'));};
showAjaxDivLoggedIn('relatedVidsBody',relatedVideoGridUrl,callback);
hideInline("relatedList");
showInline("relatedNotList");
hideInline("relatedNotGrid");
showInline("relatedGrid");
return false;
}
var defaultRecipientFieldCount=2;
var recipientFieldNamePrefix="recipient";
var recipientFieldCount=defaultRecipientFieldCount;
var lastRecipientFieldId=recipientFieldNamePrefix+recipientFieldCount;
var maxRecipients=10;
function addRecipientFieldIfNeeded(field){
if(field.id==lastRecipientFieldId&&recipientFieldCount<maxRecipients){
newField=field.cloneNode(true);
recipientFieldCount++;
lastRecipientFieldId=recipientFieldNamePrefix+recipientFieldCount;
newField.id=lastRecipientFieldId;
newField.name=lastRecipientFieldId;
_gel('recipients').appendChild(newField);
}
}
function resetRecipients(){
recipientFieldCount=defaultRecipientFieldCount;
lastRecipientFieldId=recipientFieldNamePrefix+recipientFieldCount;
}
function consolidateRecipients(){
hiddenRecipientsField=_gel('recipients');
for(var i=1;i<=recipientFieldCount;i++){
hiddenRecipientsField.value+=(_gel(recipientFieldNamePrefix+""+i).value+",");
}
}
function readCookie(name,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(fallback){
return fallback;
}else{
return null;
}
}
function readIntCookie(name){
val=readCookie(name);
if(val){
return parseInt(val);
}else{
return 0;
}
}
function createCookie(name,value,days){
if(days){
var date=new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires="; expires="+date.toGMTString();
}
else var expires="";
document.cookie=name+"="+value+expires+"; path=/";
}
function eraseCookie(name){
createCookie(name,"",-1);
}
SHARED_RATINGS_INVITE_SHOW_MAX=5
SHARED_RATINGS_INVITE_REJECT_MAX=2
function displayRecentRatingsInvite(){
if(!readCookie("stop_shared_ratings_invite")){
showDiv("recentRatingsInvite");
var timesShown=parseInt(readCookie("shared_ratings_invite_shown","0"));
timesShown=timesShown+1;
createCookie("shared_ratings_invite_shown",timesShown);
if(timesShown>=SHARED_RATINGS_INVITE_SHOW_MAX){
createCookie("stop_shared_ratings_invite","1");
}
}
}
SHARED_RATINGS_INVITE_SHOW_MAX=5
function rejectRecentRatings(){
var timesRejected=parseInt(readCookie("shared_ratings_invite_rejected","0"));
timesRejected=timesRejected+1;
createCookie("shared_ratings_invite_rejected",timesRejected);
if(timesRejected>=SHARED_RATINGS_INVITE_REJECT_MAX){
createCookie("stop_shared_ratings_invite","1");
}
}
function subscribe(username,token){
postUrlXMLResponse('/ajax_subscriptions','subscribe_to_user='+username+'&session_token='+token,function(result){removeClass(_gel('unsubscribeDiv'),'hid');addClass(_gel('subscribeDiv'),'hid');});
}
function unsubscribe(username,token){
postUrlXMLResponse('/ajax_subscriptions','unsubscribe_from_user='+username+'&session_token='+token,function(){removeClass(_gel('subscribeDiv'),'hid');addClass(_gel('unsubscribeDiv'),'hid');});
}
function flagError(elName,errorText){
if(elName){
_gel(elName).innerHTML=errorText;
toggleDisplay(elName);
}
}
function clearSelectionStyles(elName){
if(elName){
elName.style.backgroundColor='';
elName.style.color='';
}
}
function setSelectionStyles(elName){
if(elName){
elName.style.backgroundColor='#6681ba';
elName.style.color='#fff';
}
}
function flagReasonSelection(selID,reason,subreason){
var selCurrent=_gel('selectedFlagReason')
var selNew=_gel(selID);
if(_gel('flag_id').value){
clearSelectionStyles(_gel(_gel('flag_id').value));
clearSelectionStyles(_gel((_gel('flag_id').value).substring(0,2)));
}
setSelectionStyles(selNew);
if(selID.length==5){
setSelectionStyles(_gel(selID.substring(0,2)));
}
_gel('flag_reason').value=reason;
_gel('flag_sub_reason').value=subreason;
_gel('flag_id').value=selID;
selCurrent.innerHTML=_gel(selID).innerHTML;
setVisible('flag_'+selID.substring(0,2),false);
setVisible('flag_main',false);
closeAllFlagMoreInfo();
}
function closeAllFlagMoreInfo(){
var divs=['flagMoreInfo1','flagMoreInfo2','flagMoreInfo3','flagMoreInfo4','flagMoreInfo5','flagMoreInfo6','flagError'];
for(var i=0;i<divs.length;i++){
var theDiv=_gel(divs[i]);
if(theDiv){
theDiv.style.display='none';
}
}
}
function processFlagForm(elForm){
var formElement=elForm;
if(formElement){
var sel=formElement.flag_id.value;
if(sel){
if(sel=='hc_hv'){
if(formElement.protected_group.options[formElement.protected_group.selectedIndex].value!=''){
toggleDisplay('reportConcernResult3');
}
else{
toggleDisplay('flagError');
return;
}
}
else if(sel=='vc_af'||sel=='sc_su'){
toggleDisplay('reportConcernResult2');
}
else{
toggleDisplay('reportConcernResult1');
}
postAjaxForm('inappropriateVidDiv',elForm.name);
_gel('selectedFlagReason').innerHTML='- '+MSG_FlagDefault+' -';
if(_gel('flag_id').value){
clearSelectionStyles(_gel(_gel('flag_id').value));
clearSelectionStyles(_gel((_gel('flag_id').value).substring(0,2)));
_gel('flag_id').value='';
}
closeAllFlagMoreInfo();
toggleDisplay('inappropriateVidDiv');
addClass(_gel('a4_i4'),'disabled');
}
else{
toggleDisplay('flagError');
}
}
}
function hideLinkingSiteCallback(){
hideInline('referersList');
showInline('referersList');
}
function hideLinkingSite(video_id,site){
showAjaxPostDivLoggedIn('referersList','/watch_ajax','action_hide_linking_site=1&video_id='+video_id+'&url='+site+'&'+axc,hideLinkingSiteCallback);
return false;
}
function showLinkingSite(video_id,site){
showAjaxPostDivLoggedIn('referersList','/watch_ajax','action_show_linking_site=1&video_id='+video_id+'&url='+site+'&'+axc,hideLinkingSiteCallback);
return false;
}
function checkCurrentVideo(videoId)
{
if(pageVideoId!=videoId){
window.location.href="/watch?v="+videoId;
}
}
var selectedThemeColor='blank'
function onChangeColor(color){
var oldTheme=document.getElementById('theme_color_'+selectedThemeColor+'_img');
var newTheme=document.getElementById('theme_color_'+color+'_img');
removeClass(oldTheme,'radio_selected');
addClass(newTheme,'radio_selected');
selectedThemeColor=color;
onUpdatePreviewImage();
return false;
}
function onUpdatePreviewImage(){
var previewImage=document.getElementById('customizeEmbedThemePreview');
var showBorderCheckBox=document.getElementById('show_border_checkbox');
var border=(!showBorderCheckBox.checked?'_nb':'');
previewImage.src='img/preview_embed_'+selectedThemeColor+'_sm'+border+'.gif';
}
var videolist=new Array();
var removelist=new Array();
var qlUIEnabled=false;
function initWatchQueue(isUIEnabled){
qlUIEnabled=isUIEnabled;
}
function clearWatchQueue(){
postUrlXMLResponse("/watch_queue_ajax","&action_clear_queue",queueCleared);
var suffix="QL";
var videosInPlaylist=getPlaylistVideoCount(suffix);
decrementPlaylistVideoCount(suffix,videosInPlaylist);
for(var i=videosInPlaylist-1;i>=0;i--){
var videoRow=_gel(getId("playlistRow",suffix,i));
videoRow.parentNode.removeChild(videoRow);
}
var container=_gel(getId("playlistContainer",suffix));
addClass(container,"autoHeight");
removeClass(container,"fixedHeight175");
videolist=new Array();
removelist=new Array();
for(var i=0;i<quickAddDoneList.length;i++){
removeClass(quickAddDoneList[i],'QLIconImgOver');
removeClass(quickAddDoneList[i],'QLIconImgDone');
addClass(quickAddDoneList[i],'QLIconImg');
}
quickAddDoneList=new Array();
hideDiv("quicklistDiv");
}
function remove_from_watch_queue(video_id){
removelist.push(video_id);
delete_videos_from_server();
return false;
}
function set_pop_status(pop_status){
postUrlXMLResponse("/watch_queue_ajax","action_set_pop_status&pop_videos="+pop_status,self.popStatusSet)
}
function popStatusSet(){
}
var qlIsEditing=false;
function post_videos_to_server(){
if(videolist.length>0&&!qlIsEditing){
qlIsEditing=true;
var queryParams="&action_add_to_queue&video_id="+videolist.shift();
if(qlUIEnabled){
queryParams+="&ui=1"
}
var request=new getUrlXMLResponseJSON("/watch_queue_ajax?"+queryParams,videoQueued);
}
}
var isRemoving=false;
function delete_videos_from_server(){
if(removelist.length>0){
isRemoving=true;
postUrlXMLResponse("/watch_queue_ajax","&action_remove_from_queue&video_id="+removelist[removelist.length-1],self.videoRemoved);
removelist.pop();
}
isRemoving=false;
if(delayedCompletePlaylistLoad){
completePlaylistLoad();
}
}
function queueCleared(xmlHttpRequest){
}
function queueClearedReloadPage(xmlHttpRequest){
window.location="watch_queue?all";
}
function videoQueued(videos){
qlIsEditing=false;
if(qlUIEnabled){
if(videos){
handleWatchQueueGet(videos);
}
}
post_videos_to_server();
}
function videoRemoved(xmlHttpRequest){
delete_videos_from_server();
}
function clicked_add_icon(video_ID,fromRelated){
if(fromRelated==1){
showQuickList_first_add();
_gel('play_all_numb').innerHTML=quicklist_count+'&nbsp;';
if(_gel('show_all_video_number')){
_gel('show_all_video_number').innerHTML=quicklist_count;
}
}
_gel(button_name).blur();
}
var autoScrolledTo=null;
function scrollPlaylistToVideo(suffix,index){
var videoRow=_gel(getId('playlistRow',suffix,index));
_gel(getId("playlistContainer",suffix)).scrollTop=videoRow.offsetTop;
autoScrolledTo=_gel(getId("playlistContainer",suffix)).scrollTop;
}
function registerPlaylistAutoload(component){
if(component=='QL'&&qlAutoscrollDestination>0){
scrollPlaylistToVideo(component,qlAutoscrollDestination);
}
_gel(getId('playlistContainer',component)).onscroll=completePlaylistLoad;
if(autoScrolledTo&&autoScrolledTo!=_gel(getId("playlistContainer",'QL')).scrollTop){
completePlaylistLoad();
}
}
function clickedQuickAdd(img,videoId,alreadyInList){
quickAddDoneList[quickAddDoneList.length]=img;
removeClass(img,'QLIconImg');
removeClass(img,'QLIconImgOver');
addClass(img,'QLIconImgDone');
if(!alreadyInList){
videolist.push(videoId);
post_videos_to_server();
}
}
var quickAddDoneList=new Array();
function getUrlFromPlaylistRow(rowNode){
var links=rowNode.getElementsByTagName('a');
return links[0].href;
}
function removeVideo(suffix,playlistRow){
var playlistRow=getAncestorWithClass(playlistRow,"playlistRow");
var vid=getNodeVideoId(playlistRow);
playlistRow.parentNode.removeChild(playlistRow);
var newIndex=0;
var videos=getPlaylistVideoCount(suffix);
for(var i=0;i<videos;i++){
var row=_gel(getId("playlistRow",suffix,i));
var index=_gel(getId("playlistRowIndex",suffix,i));
if(row){
row.id=getId("playlistRow",suffix,newIndex);
index.id=getId("playlistRowIndex",suffix,newIndex);
index.innerHTML=newIndex+1;
newIndex++;
}
}
var newCount=decrementPlaylistVideoCount(suffix,1);
remove_from_watch_queue(vid);
var containerNode=_gel(getId("playlistContainer",'QL'));
if(newCount==0){
hidePlaylist(suffix);
}else if(newCount<4){
addClass(containerNode,"autoHeight");
removeClass(containerNode,"fixedHeight175");
}
if(containerNode.onscroll){
containerNode.onscroll();
}
}
var delayedCompletePlaylistLoad=false;
function completePlaylistLoad(){
if(!isRemoving){
suffix="QL";
_gel('playlistContainer_'+suffix).onscroll="";
request=new getUrlXMLResponseJSON("/watch_queue_ajax?v="+pageVideoId+"&action_get_all_queue_videos_component=1&all=1&watch3=1",handleWatchQueueGet);
}else{
delayedCompletePlaylistLoad=true;
}
}
function handleWatchQueueGet(videos){
for(var i=0;i<videos.length;i++){
if(videos[i]){
var newRow=_gel("playlistRow_placeholder_QL").cloneNode(true);
removeClass(newRow,"hide");
videos[i].unshift(newRow);
fillQuicklistRow.apply(this,videos[i]);
newRow.id=getId("playlistRow","QL",videos[i][1]);
var oldNode=_gel(newRow.id);
if(hasClass(oldNode,"loading")){
oldNode.parentNode.replaceChild(newRow,oldNode);
}
}
}
}
function getPlaylistVideoCount(component){
return parseInt(_gel('playlistVideoCount_'+component).innerHTML);
}
function incrementPlaylistVideoCount(component,increment_by){
var node=_gel('playlistVideoCount_'+component);
node.innerHTML=parseInt(node.innerHTML)+increment_by;
return parseInt(node.innerHTML);
}
function decrementPlaylistVideoCount(component,decrement_by){
return incrementPlaylistVideoCount(component,-1*decrement_by);
}
function getNodeVideoId(node){
return getStoredValue(node,"v")
}
function setNodeVideoId(node,id){
return setStoredValue(node,"v",id)
}
function getStoredValue(node,name){
var classes=getClassList(node);
var pattern=classNameForNameValue(name,'');
var found=false;
for(var i=0;i<classes.length;i++){
if(classes[i].substr(0,pattern.length)==pattern){
return classes[i].substr(pattern.length,classes[i].length-pattern.length);
}
}
return '';
}
function setStoredValue(node,name,value){
var classes=getClassList(node);
var pattern=classNameForNameValue(name,'');
var found=false;
for(var i=0;i<classes.length;i++){
if(classes[i].substr(0,pattern.length)==pattern){
classes[i]=classNameForNameValue(name,value);
found=true;
}
}
if(!found){
classes.push(classNameForNameValue(name,value));
}
node.className=classes.join(' ');
}
function classNameForNameValue(name,value){
return name+"*"+value;
}
function TemplateParameters(params){
this.addParameter=addParameter;
this.applyToNode=applyToNode;
this.fill=fill;
this.parameters=new Object();
for(var i=0;i<params.length;i++){
this.addParameter(params[i][0],params[i][1],params[i][2]);
}
function Parameter(attrName,value){
this.attrName=attrName;
this.value=value;
}
function addParameter(className,attrName,value){
if(!this.parameters[className]){
this.parameters[className]=new Array();
}
this.parameters[className].push(new Parameter(attrName,value));
}
function applyToNode(node){
var classList=getClassList(node);
for(var i=0;i<classList.length;i++){
var applyList=this.parameters[classList[i]];
if(applyList){
for(var j=0;j<applyList.length;j++){
if(typeof(applyList[j].value)=="function"){
node[applyList[j].attrName]=applyList[j].value();
}else{
node[applyList[j].attrName]=applyList[j].value;
}
}
}
}
}
function fill(node){
for(var i=0;i<node.childNodes.length;i++){
this.fill(node.childNodes[i]);
}
this.applyToNode(node);
}
}
function fillQuicklistRow(rowDiv,index,videoUrl,imgSrc,title,username,duration,videoId){
var params=new TemplateParameters(
[['playlistRow','id',getId("playlistRow","QL",index)],
['playlistRow','class',function(node){setNodeVideoId(rowDiv,videoId)}],
['phIndex','id',getId("playlistRowIndex","QL",index)],
['phIndex','innerHTML',index+1],
['playlistRowLink','href',videoUrl],
['vimg50','src',imgSrc],
['vtitle','innerHTML',title],
['phUsername','innerHTML',username],
['playlistItemDuration','innerHTML',duration]]);
params.fill(rowDiv);
}
var req;
if(window!=window.top){
var ref=document.referrer;
var sel=window.location.href;
req=getXmlHttpRequest();
var data='location='+encodeURIComponent(ref);
data+='&self='+encodeURIComponent(sel);
req.onreadystatechange=processReqChange;
req.open("POST",'/roger_rabbit',true);
req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
req.send(data);
}
function processReqChange(){
if(req.readyState==4){
if(req.status==200){
if(req.responseText=='block'){
window.top.location.href='/';
}
}
}
}
