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);
document.getElementById(div_id).innerHTML=getNodeValue(xmlHttpReq.responseXML,
"html_content");
successCallback(xmlHttpReq);
}
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);
}
};
})();
bind=function(fn,self,var_args){
var boundArgs=fn.boundArgs_;
if(arguments.length>2){
var args=Array.prototype.slice.call(arguments,2);
if(boundArgs){
args.unshift.apply(args,boundArgs);
}
boundArgs=args;
}
self=fn.boundSelf_||self;
fn=fn.boundFn_||fn;
var newfn;
if(boundArgs){
newfn=function(){
var args=Array.prototype.slice.call(arguments);
args.unshift.apply(args,boundArgs);
return fn.apply(self,args);
}
}else{
newfn=function(){
return fn.apply(self,arguments);
}
}
newfn.boundArgs_=boundArgs;
newfn.boundSelf_=self;
newfn.boundFn_=fn;
return newfn;
};
Function.prototype.bind=function(self,var_args){
if(arguments.length>1){
var args=Array.prototype.slice.call(arguments,1);
args.unshift(this,self);
return bind.apply(null,args);
}else{
return bind(this,self);
}
};
(function(){
YT_single_tabpane=function(tab,content,opt_url,opt_loading_page){
this.tab_=tab;
this.content_=content;
if(opt_url){
this.url_=opt_url;
}
if(opt_loading_page){
this.loading_page_=opt_loading_page;
}
this.retrieved_url_=false;
}
YT_tabpane=function(element,class_name_base){
this.element_=_gel(element);
this.tabpanes_=new Array();
this.class_name_base_=class_name_base;
};
YT_tabpane.prototype.addPage=function(tab,contents,opt_url,opt_left){
var single_tabpane=new YT_single_tabpane(tab,contents,opt_url);
this.tabpanes_[tab]=single_tabpane;
var tab_element=_gel(tab);
tab_element.onclick=function(){this.handleClick(tab);}.bind(this);
if(opt_left){
this.left_=tab;
}
};
YT_tabpane.prototype.getNewContent=function(tab_id,new_url){
var tab=this.tabpanes_[tab_id];
var url=tab.url_+new_url;
this.retrieveUrl(tab,url);
}
YT_tabpane.prototype.retrieveUrl=function(dest,opt_override_url){
var url=dest.url_;
if(opt_override_url){
url=opt_override_url;
}
if(this.loading_page_){
var content=_gel(dest.content_);
var loading_page=_gel(this.loading_page_);
content.innerHTML=loading_page.innerHTML;
}
getUrl(url,true,function(xmlHttpRequest){
this.handleAjaxResponse(xmlHttpRequest,dest);
}.bind(this)
);
}
YT_tabpane.prototype.handleAjaxResponse=function(xmlHttpRequest,dest){
if(xmlHttpRequest.readyState==4){
if(xmlHttpRequest.status==200){
var content=_gel(dest.content_);
content.innerHTML=xmlHttpRequest.responseText;
dest.retrieved_url_=true;
}else{
if(this.error_page_){
var content=_gel(dest.content_);
var error_page=_gel(this.error_page_);
content.innerHTML=error_page.innerHTML;
dest.retrieved_url_=false;
}
}
}
}
YT_tabpane.prototype.handleClick=function(target){
for(var i in this.tabpanes_){
var tab=_gel(i);
var dest=this.tabpanes_[i];
var content=_gel(dest.content_);
if(i==target){
content.style.display="block";
removeClass(tab,this.class_name_base_+"-unsel");
addClass(tab,this.class_name_base_+"-sel");
if(dest.url_&&!dest.retrieved_url_){
this.retrieveUrl(dest);
}
}else{
content.style.display="none";
removeClass(tab,this.class_name_base_+"-sel");
addClass(tab,this.class_name_base_+"-unsel");
}
}
if(this.left_){
var tab=_gel(this.left_);
addClass(tab,this.class_name_base_+"-left");
}
}
YT_tabpane.prototype.setSelected=function(tab){
this.handleClick(tab);
}
YT_tabpane.prototype.setLoadingPage=function(page){
this.loading_page_=page;
}
YT_tabpane.prototype.setErrorPage=function(error_page){
this.error_page_=error_page;
}
})();
var feed_module_index=Array()
function next_feed_module_item(tab_id,module_id,num_items){
if(feed_module_index[module_id]==undefined)
feed_module_index[module_id]=0;
addClass(_gel('feed-module-'+tab_id+'-'+module_id+'-item-'+feed_module_index[module_id]),'hide');
feed_module_index[module_id]+=1;
feed_module_index[module_id]=feed_module_index[module_id]%num_items;
removeClass(_gel('feed-module-'+tab_id+'-'+module_id+'-item-'+feed_module_index[module_id]),'hide');
}
function previous_feed_module_item(tab_id,module_id,num_items){
if(feed_module_index[module_id]==undefined)
feed_module_index[module_id]=0;
addClass(_gel('feed-module-'+tab_id+'-'+module_id+'-item-'+feed_module_index[module_id]),'hide');
feed_module_index[module_id]+=num_items-1;
feed_module_index[module_id]=feed_module_index[module_id]%num_items;
removeClass(_gel('feed-module-'+tab_id+'-'+module_id+'-item-'+feed_module_index[module_id]),'hide');
}
function select_feed_module_item(tab_id,module_id,new_index,num_items){
if(feed_module_index[module_id]==undefined)
feed_module_index[module_id]=0;
addClass(_gel('feed-module-'+tab_id+'-'+module_id+'-item-'+feed_module_index[module_id]),'hide');
feed_module_index[module_id]=new_index%num_items;
removeClass(_gel('feed-module-'+tab_id+'-'+module_id+'-item-'+feed_module_index[module_id]),'hide');
}
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 newRoadBlock(adTag){
a=adTag.split(';');
if(a.length>0){
for(x=0;x<=a.length-1;x++){
if(a[x].indexOf('sz=')==0){
size=a[x].substring(3);
dims=size.split('x');
height=dims[0];
width=dims[1];
loadRBs('myAd_banner',height,width,adTag);
}
}
}
}
function loadRBs(s,w,h,adTag){
document.getElementById(s).innerHTML=
'<iframe src="'+adTag+'" id="ifr_companion" width="'+w+'" height="'+h+
'" marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no>'+
'</iframe>';
}
function setFlashVars(myObjName){
var pvaTag=document.getElementById("pvaTag").value;
document.getElementById("FLASH_"+myObjName).SetVariable("myAdTag",pvaTag);
var canv=document.getElementById("canv").value;
document.getElementById("FLASH_"+myObjName).SetVariable("canv",canv);
var burl=document.getElementById("burl").value;
document.getElementById("FLASH_"+myObjName).SetVariable("dc_PVAurl",burl);
var hl=document.getElementById("pvaHl").value
document.getElementById("FLASH_"+myObjName).SetVariable("hl",hl);
document.getElementById("FLASH_"+myObjName).SetVariable("rtg","1");
}
function showPVA(){
var banner=document.getElementById("myAd_banner");
if(banner){
banner.style.visibility="visible";
banner.style.height=35;
}
}
var goog={i18n:{bidi:{}}};
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.isRtlText=function(str){
return goog.i18n.bidi.rtlDirCheckRe_.test(str);
}
goog.i18n.bidi.isLtrText=function(str){
return goog.i18n.bidi.ltrDirCheckRe_.test(str);
}
goog.i18n.bidi.isNeutralText=function(str){
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;
}
