$(document).ready(function() {
 var nonGameEvents = nonGameEventModule()
 var activeGame = activeGameModule()
 nonGameEvents.dropDown()
 nonGameEvents.bindFadeCardAnnimation()
 nonGameEvents.renderSignUpForm()
 activeGame.getNewCard()
});

// Non Game event module
(function() {
// Nav DropDown
  var dropDown = function() {

    "use strict";

    var $menuContainer = $('.dropdown-container');
    var $eventTrigger = $('#dropdown-listener');

    function displayMenu() {
      $menuContainer.css('display', 'block');
    };

    function hideMenu() {
      $menuContainer.css('display', 'none');
    };

    function triggerDisplay() {
      $eventTrigger.mouseenter(displayMenu);
      $menuContainer.mouseleave(hideMenu);
    };

    triggerDisplay();

  };

  //  Play Screen Card Annimation On Hover

  var bindFadeCardAnnimation = function() {

    "use strict";

    var $triggerContainer = $(".start-container");
    var $cardContainer = $(".play-card-container")

    function cardsFadeIn() {
      $cardContainer.fadeIn("slow");
    };

    function cardsFadeOut() {
      $cardContainer.fadeOut("slow");
    };

    function triggerCardFade() {
      $triggerContainer.mouseenter(cardsFadeIn);
    };

    function triggerCardFadeOut() {
      $triggerContainer.mouseleave(cardsFadeOut);
    };

    $cardContainer.hide();
    triggerCardFadeOut();
    triggerCardFade();

  };

  // Hide and Render sign up sheet for landing page

  var renderSignUpForm = function() {

    "use strict";

    var $formContainer = $('#sign-up-container');
    var $formTrigger = $('#form-trigger');
    var $unRenderFormTrigger = $('#form-un-trigger');

    function renderEventTrigger() {
      $formContainer.fadeIn('slow');
    };

    function unRenderEventTrigger() {
      $formContainer.fadeOut('slow');
    };

    function unRenderForm() {
      $unRenderFormTrigger.on('click', unRenderEventTrigger);
    };

    function renderForm() {
      $formTrigger.on('click', renderEventTrigger);
    };

    $formContainer.hide();
    renderForm();
    unRenderForm();

  };

  this.nonGameEventModule = function() {
    return {
      dropDown: dropDown,
      bindFadeCardAnnimation: bindFadeCardAnnimation,
      renderSignUpForm: renderSignUpForm
    }
  };

})();

// God Game Module >.< sigh lol

(function() {

  var updateGameInfo = function() {

    function ajaxGameInfoCall() {
      $.ajax({
        type: 'put',
        url: '/api/playfj/gameinfo',
        success: function(response) {
          return response;
        }
      })
    };
    // Work on next. Add player hand info to JSON
    ajaxGameInfoCall();

  };

  var getNewCard = function() {

    var $newCardLocation = $('#player-card-container');
    var $hitEventTarget = $('#hit-btn');

    function getCardAjax(callback) {
      $.ajax({
        type: 'put',
        url: '/api/playfj/hit',
        success: function(response) {
          callback(response);
        }
      })
    };

    function appendCard(card) {
      $newCardLocation.append("<li class='cards'><img src='"+card.img_url+"'></li>");
    };

    function renderCardTemplate() {
      $hitEventTarget.on('click', function(event) {
        event.preventDefault();
        getCardAjax(appendCard);
      });
    };

    renderCardTemplate();

  };


  this.activeGameModule = function() {
    return {
      getNewCard: getNewCard,
      updateGameInfo: updateGameInfo
    }
  };

})();


@@ -103,16 +103,49 @@
 odule()%0A
+ nonGameEvents.inititialize()%0A //
  nonGame
@@ -158,24 +158,27 @@
 .dropDown()%0A
+ //
  nonGameEven
@@ -205,16 +205,19 @@
 ation()%0A
+ //
  nonGame
@@ -329,16 +329,31 @@
 pDown%0A  
+%22use strict%22;%0A%0A
 var drop
@@ -373,37 +373,16 @@
 on() %7B%0A%0A
-    %22use strict%22;%0A%0A  
   var $m
@@ -420,26 +420,24 @@
 tainer');%0A  
- 
- 
 var $eventTr
@@ -466,26 +466,24 @@
 istener');%0A%0A
-  
   function d
@@ -493,34 +493,32 @@
 layMenu() %7B%0A    
- 
- 
 $menuContainer.c
@@ -537,34 +537,30 @@
 , 'block');%0A
-  
   %7D;%0A%0A
-  
   function h
@@ -567,26 +567,24 @@
 ideMenu() %7B%0A
-  
     $menuCon
@@ -610,34 +610,30 @@
 ', 'none');%0A
-  
   %7D;%0A%0A
-  
   function t
@@ -646,26 +646,24 @@
 Display() %7B%0A
-  
     $eventTr
@@ -693,18 +693,16 @@
 yMenu);%0A
-  
     $men
@@ -734,26 +734,22 @@
 eMenu);%0A
-  
   %7D;%0A%0A
-  
   trigge
@@ -757,26 +757,24 @@
 Display();%0A%0A
-  
 %7D;%0A%0A  //  Pl
@@ -849,32 +849,35 @@
 unction() %7B%0A%0A   
+ //
  %22use strict%22;%0A%0A
@@ -1491,16 +1491,19 @@
 ) %7B%0A%0A   
+ //
  %22use st
@@ -2085,20 +2085,131 @@
   %7D;%0A%0A  
-this
+var inititialize = function() %7B%0A    dropDown();%0A    bindFadeCardAnnimation();%0A    renderSignUpForm();%0A  %7D%0A%0A  Window
 .nonGame
@@ -2253,16 +2253,19 @@
  %7B%0A     
+ //
  dropDow
@@ -2282,16 +2282,19 @@
 n,%0A     
+ //
  bindFad
@@ -2339,16 +2339,19 @@
 n,%0A     
+ //
  renderS
@@ -2378,16 +2378,50 @@
 nUpForm%0A
+      inititialize: inititialize,%0A
     %7D%0A  

initialize return test