/* This myFOX KickApps Javascript file was developed Tracy DeLatte in Dallas.
   Last update on Jan. 17, 2008.
   The following scripts are needed for writing extra elements onto various pages on your KickApps site. Note that you will need to modify URLs in the scripts if you plan to use them on your site. You may need a basic understanding of Javascript to adapt these scripts for your site. E-mail questions to tracy.delatte@foxtv.com. */

// Add Tabs
 function addTab(){
    if($('ka_messageBoardsTab')){
      /* add a new <li> to the main navbar */
      var NewTab1 = document.createElement('li');
      NewTab1.id = 'ka_backTab';
      $('ka_messageBoardsTab').parentNode.appendChild(NewTab1);
      /* write the link into the new <li> */
      $('ka_backTab').innerHTML = '<a href="http://www.myfoxmemphis.com/">myFOX home</a>';
      /* add a new <li> to the main navbar */
      var NewTab2 = document.createElement('li');
      NewTab2.id = 'ka_chatTab';
      $('ka_messageBoardsTab').parentNode.appendChild(NewTab2);
      /* write the link into the new <li> */
      $('ka_chatTab').innerHTML = '<a href="http://www.myfoxmemphis.com/generic/video/streaming_1/Live_Stream_1">watch & chat</a>';
	  /* change the ordering */
	  $('ka_backTab').parentNode.insertBefore($('ka_backTab'),$('ka_homeTab'));
	}         
  }  
  Ka.addDOMLoadEvent(addTab);
  
  
// Categories Drop Down
 function switchcat(categories){
  var cat = $j('#category_dropdown option:selected').html();
  if(cat!==''){ window.location="http://affiliate.kickapps.com/service/searchEverything.kickAction?keywords="+cat+" +&includeVideo=on&includeAudio=on&includePhoto=on&includeBlog=on&includeUser=on&includeMessages=on&as=80520";
 }
 }


// Add Registration Element
  function addRegisterElement(){
    if($('ka_register')){
      //add a new <div> to the page
      var newDiv2 = document.createElement('div'); 
      newDiv2.id = 'register_extraDiv'; 
      $('ka_contentContainer').parentNode.appendChild(newDiv2); 
      // add HTML to the new <div>
      $('register_extraDiv').innerHTML = '<img src="http://media.myfoxmemphis.com/community/graphics/register.png">';              
    }          
  }   
  Ka.addDOMLoadEvent(addRegisterElement); 
  

// Play Page Move Elements
  function moveModules(){
  if($('ka_playPage')){
  // insert <div> inside another element
  $j('#ka_playPageDetails').prependTo('#ka_playPageStats');}
  }
  Ka.addDOMLoadEvent(moveModules); 