/** 20101220, vfb
 *
 *  Using Javascript/CSS to replace original Flex swf for top of site.
 *  Remove the script links to see how the page degrades if no javascript.
 *  From there, we want to hide the "Play" "Gallery" etc labels except when
 *  user cursor is over an app, and do a little animation. Other than that,
 *  most of the behavior was replaced with CSS, not Javascript.
 *
 *  The main reason for doing this was practice, but it may also help in 
 *  search engine/AdSense consideration. And make the page load faster.
 */

/* mark the document as having been executed javascript - then .css works
   to hide that which should be hidden */
document.documentElement.className = 'js';

var init = function( ) {
  // for each app - do it once because appended class that says did it already
  $('.app:not(.app-processed)').each(function() {
    new appProcessor({ 'root': this });
  }).addClass('app-processed');
};

appProcessor = function(options) {
  var thisApp = this;

  // Merge in the options object. Changes root.
  $.extend(this, options);

  var playTarget = $('.appImage').parent().attr('href');
  // now doing this through CSS
  //   $('.appAction').hide();

  var labelOn = function() { $('.appAction', thisApp.root).show(); }
  var labelOff = function() { $('.appAction', thisApp.root).hide(); }

  $('.appTitle', thisApp.root).hover(labelOn, labelOff);
  $('.appImage', thisApp.root).hover(labelOn, labelOff);
  $('.appButton', thisApp.root).hover(labelOn, labelOff);
  $('.appAction', thisApp.root).hover(labelOn, labelOff);

}

$(document).ready(init) ;
