/*Start of Dropdown menu used for video categories + shows //uses prototype */
var DDMenuController = function() {
  var that = this;
  var index = null;
  var mouseOverList = false;
  var list = null;

  function setIndex(n){ index=n; }
  function showList(){
    if($$('ul.cnnShowList')[index].hasClassName('showList') && (mouseOverList==false)) {
	   document.body.onmousedown = null;
	   $$('ul.cnnShowList')[index].removeClassName('showList');      //hide the list
       //if the parent of this list has a scroll in it, hide it as well
       try{ $$('ul.cnnShowList')[index].next('.cnnCtrls_scroll').style.display = "none"; } catch(e){}
       list.style.display="block";                                     //enable the button
    }
    else {
  	   list.style.display="none";  					                 //disable the button
       try{ $$('ul.cnnShowList')[index].next('.cnnCtrls_scroll').style.display = "block"; popularVids.controls(); } catch(e){}
	   $$('ul.cnnShowList')[index].addClassName('showList');         //show the list
	   document.body.onmousedown = showList;
    }
  }
  function setMouseOvers(){
    Event.observe($$('ul.cnnShowList')[index],'mouseover',function() { mouseOverList = true; });
    Event.observe($$('ul.cnnShowList')[index],'mouseout',function() { mouseOverList = false; });
    try{
      Event.observe($$('.cnnCtrls_scroll')[0],'mouseover',function(){ mouseOverList = true; });
      Event.observe($$('.cnnCtrls_scroll')[0],'mouseout',function(){ mouseOverList = false; });
    }catch(e){}
  }
  this.init = function(el, i) {
    setIndex(i);
    setMouseOvers();
    list = el;
    Event.observe(el, 'click', function(event){ showList(); Event.stop(event); } );
    return this;
  };
}
var DDmenu = function() {
  var ddMenus = [];
  this.init = function(){
    $$('.cnnvideo_showSelect .cnnCtrls_down a.toggleList').each(function(value,index) {
      ddMenus[index] = new DDMenuController().init(value,index);
    });
    return ddMenus;
  };
  return this;
}

try{ var ddMenus = new DDmenu().init(); } catch(e){}

var popularVidsController = function(){
  var slider = null;
  var loaded = 0;
  var processing = 0;
  var scrollInterval = null;
  function setProcessing(n){ processing = n; }
  function setLoaded(n){ loaded=n; }

    //wheel code is from http://www.aldenta.com/examples/script.aculo.us/slider-mouse-wheel.html
	//Lower 
	
	
 