﻿(function ($) { // Don't pollute the global namespace

  // Share With Us

  var Share = function () {
    function handleIdeaKindChange() {
      var select = $('select#IdeaKind');
      var fieldsets = $('#idea-kinds');
      select.change(function () {
        var storyType = this.options[this.selectedIndex].text.toLowerCase();
        fieldsets.children().hide();
        fieldsets.find('.' + storyType).show();
      }).change();
    }
    
    $(document).ready(handleIdeaKindChange);
  };
  
  var VideoControls = function () {
    function handlePlayLink() {
      $('a.video-play').click(function () {
        if (typeof(ytplayer) != 'undefined') {
          ytplayer.playVideo();
        }
        return false;
      });
    }

    $(document).ready(handlePlayLink);
  };

  // Initialize MyMn objects
    
  new Share();
  new VideoControls();

})(jQuery);