/*
File: internship/scripts/intern-submit-app-script.js

MAKE SURE YOU KEEP TRACK OF EVERYTHING YOU DO!

Author: Dwight VanTuyl
DD-MMM-YYYY: 14-Mar-2008
Purpose: Form manipulation specifically for the application tab of the submit form.
+++++++++++++
Modifications
+++++++++++++
Editor:		
DD-MMM-YYYY:
Watcha did:	
~~~~~~~~~~~~~
*/



Ext.namespace('Intern.submit');

Intern.submit.app = {
  init: function() {
  
    //show or hide a targetDiv based on whether its 'apply by' checkbox is checked
    $("input.applyBy:checkbox").each(function(){   
      $(this).click(function(){
        if(this.checked){
          $("div#" + $(this).attr('targetDiv')).show();
        }else{
          $("div#" + $(this).attr('targetDiv')).hide();
        }
      });
    });
    
    //show or hide deadline field based on hasDeadline selection
    $("input[name='app_hasDeadline']").click(function(){
      if($(this).val() == 'T'){
        $("span#deadline").show();
        $("span#hasDeadline").hide();
      }else{
        $("span#deadline").hide();
        $("span#hasDeadline").show();
      }
    });
  }
}

Ext.onReady(Intern.submit.app.init, Intern.submit.app);