/* This myFOX KickApps Javascript file was developed Tracy DeLatte in Dallas.
   Last updated for MyFoxHouston by Doug Delony on Feb. 5, 2009.
   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.myfoxhouston.com/">MyFoxHouston 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.myfoxhoustonlive.com/">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=82250";
 }
 }


// Add Profile Element
  function addProfileElement(){
    if($('ka_profilePage')){
      // add a new <div> to the page 
      var newDiv = document.createElement('div'); 
      newDiv.id = 'profile_extraDiv'; 
	  var memberName = Ka.Info.PROFILENAME;
      $('ka_profileRight').parentNode.appendChild(newDiv); 
      // add HTML to the new <div>
      $('profile_extraDiv').innerHTML = '<div id="myPhoto_module"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" type="application/x-shockwave-flash" width="270" height="257" id="kickWidget_82250_90524" align="middle"><param name="movie" value="http://serve.a-widget.com/service/getWidgetSwf.kickAction"/><param name="FlashVars" value="affiliateSiteId=82250&widgetId=90524&width=270&height=257&mediaParameters=members%3D' + memberName + '"/><param name="wmode" value="transparent"/><param name="allowFullScreen" value="true"/><param name="menu" value="false"/><param name="allowScriptAccess" value="always"/><embed src="http://serve.a-widget.com/service/getWidgetSwf.kickAction" name="kickWidget_82250_90524" width="270" height="257" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" align="middle" allowScriptAccess="always" alt="KickApps Widget" allowFullScreen="true" FlashVars="affiliateSiteId=82250&widgetId=90524&width=270&height=257&mediaParameters=members%3D' + memberName + '"/></object></div><div id="myVideo_module" style="margin-top:10px;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" type="application/x-shockwave-flash" width="270" height="257" id="kickWidget_82250_90534" align="middle"><param name="movie" value="http://serve.a-widget.com/service/getWidgetSwf.kickAction"/><param name="FlashVars" value="affiliateSiteId=82250&widgetId=90534&width=270&height=257&mediaParameters=members%3D' + memberName + '"/><param name="wmode" value="transparent"/><param name="allowFullScreen" value="true"/><param name="menu" value="false"/><param name="allowScriptAccess" value="always"/><embed src="http://serve.a-widget.com/service/getWidgetSwf.kickAction" name="kickWidget_82250_90534" width="270" height="257" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" align="middle" allowScriptAccess="always" alt="KickApps Widget" allowFullScreen="true" FlashVars="affiliateSiteId=82250&widgetId=90534&width=270&height=257&mediaParameters=members%3D' + memberName + '"/></object></div><div id="myAudio_module" style="margin-top:10px;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" type="application/x-shockwave-flash" width="270" height="257" id="kickWidget_82250_90538" align="middle"><param name="movie" value="http://serve.a-widget.com/service/getWidgetSwf.kickAction"/><param name="FlashVars" value="affiliateSiteId=82250&widgetId=90538&width=270&height=257&mediaParameters=members%3D' + memberName + '"/><param name="wmode" value="transparent"/><param name="allowFullScreen" value="true"/><param name="menu" value="false"/><param name="allowScriptAccess" value="always"/><embed src="http://serve.a-widget.com/service/getWidgetSwf.kickAction" name="kickWidget_82250_90538" width="270" height="257" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" align="middle" allowScriptAccess="always" alt="KickApps Widget" allowFullScreen="true" FlashVars="affiliateSiteId=82250&widgetId=90538&width=270&height=257&mediaParameters=members%3D' + memberName + '"/></object></div>';              
    }          
  }   
  Ka.addDOMLoadEvent(addProfileElement); 


// 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://media2.myfoxhouston.com/interact/register.png">';              
    }          
  }   
  Ka.addDOMLoadEvent(addRegisterElement); 
  
  
 // Add Forums Element
  function addForumsElement(){
    if($('ka_breadcrumbs')){
      //add a new <div> to the page
      var newDiv3 = document.createElement('div'); 
      newDiv3.id = 'forums_extraDiv'; 
      $j(newDiv3).insertAfter('#ka_contentContainer');
      // add HTML to the new <div>
      $('forums_extraDiv').innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" type="application/x-shockwave-flash" width="330" height="524" id="kickWidget_82250_91325" align="middle"><param name="movie" value="http://serve.a-widget.com/service/getWidgetSwf.kickAction"/><param name="FlashVars" value="affiliateSiteId=82250&widgetId=91325&width=330&height=524&revision=1231743711000"/><param name="wmode" value="transparent"/><param name="allowFullScreen" value="true"/><param name="menu" value="false"/><param name="allowScriptAccess" value="always"/><embed src="http://serve.a-widget.com/service/getWidgetSwf.kickAction" name="kickWidget_82250_91325" width="330" height="524" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" align="middle" allowScriptAccess="always" alt="KickApps Widget" allowFullScreen="true" FlashVars="affiliateSiteId=82250&widgetId=91325&width=330&height=524&revision=1231743711000"/></object>';              
    }          
  }   
  Ka.addDOMLoadEvent(addForumsElement); 
  

// Play Page Move Elements
  function moveModules(){
  if($('ka_playPage')){
  // insert <div> inside another element
  $j('#ka_playPageDetails').prependTo('#ka_playPageStats');}
  }
  Ka.addDOMLoadEvent(moveModules); 