function showEnrollment(p_type){
  var elem;
  if (p_type == '') {
    p_type = 'class';
  }
  if (p_type == 'bootcamp'){
    elem = document.getElementById('bootcamp');
    elem.style.display = 'block';
    document.enrollment.type.value = 'bootcamp';
  }
  else if (p_type == 'coaching'){
    elem = document.getElementById('coaching');
    elem.style.display = 'block';
    document.enrollment.type.value = 'coaching';
  }
   else if (p_type == 'intensive'){
    elem = document.getElementById('intensive');
    elem.style.display = 'block';
    document.enrollment.type.value = 'intensive';
  }
  else {
    elem = document.getElementById('class');
    elem.style.display = 'block';
    document.enrollment.type.value = 'class';
  }
}

function checkEnrollment(p_type){
  if (p_type == '') {
    p_type = 'class';
  }
  if (p_type == 'class'){
    if (parseFloat(document.pcapay.amount.value) < 50) {
      alert('Payments must be $50.00 or higher.');
    }
    else {
      document.pcapay.amount.value = '$' + document.pcapay.amount.value;
      document.pcapay.submit();
      document.pcapay.amount.value = '50.00';
    }
  }
  else if (p_type == 'coaching'){
    if (parseFloat(document.pcapcpay.amount.value) < 150) {
      alert('Payments must be $150.00 or higher.');
    }
    else {
      document.pcapcpay.amount.value = '$' + document.pcapcpay.amount.value;
      document.pcapcpay.submit();
      document.pcapcpay.amount.value = '150.00';
    }
  }
  else if (p_type == 'intensive'){
    if (parseFloat(document.pcaintpay.amount.value) < 400) {
      alert('Payments must be $400.00 or higher.');
    }
    else {
      document.pcaintpay.amount.value = '$' + document.pcaintpay.amount.value;
      document.pcaintpay.submit();
      document.pcaintpay.amount.value = '400.00';
    }
  }
  else {
    if (parseFloat(document.pcabcpay.amount.value) < 400) {
      alert('Payments must be $400.00 or higher.');
    }
    else {
      document.pcabcpay.amount.value = '$' + document.pcabcpay.amount.value;
      document.pcabcpay.submit();
      document.pcabcpay.amount.value = '400.00';
    }
  }
}

function submitenter(myfield,e)
{
  var keycode;
  if (window.event) keycode = window.event.keyCode;
  else if (e) keycode = e.which;
  else return true;
  if (keycode == 13)
   {
     checkEnrollment();
     return false;
   }
  else {
   return true;
  }
}

function displayForm() {
  var queryString = window.location.search;
  queryString = queryString.substring(1);
  var arr1 = new Array();
  arr1 = queryString.split("=");
  showEnrollment(arr1[1]);
  //alert(arr1[1]);
}

function pageRedirect(p_loc) {
  location.href = "/academy_enroll.html?t=" + p_loc;
}

function getItem(id)
 {
   var itm = false;
   if(document.getElementById)
     {itm = document.getElementById(id);}
   else if(document.all)
     {itm = document.all[id];}
   else if(document.layers)
     {itm = document.layers[id];}

   return itm;
 }

function showEvents(action,id){
  l_events = getItem(id);
  if (action == 'hide') {
    l_events.style.display = 'none';
    l_events.style.height = '0px';
    l_events.style.zIndex = '-1';
  }
  else {
    l_events.style.display = 'block';
    if (id == 'coach_text') {
      l_events.style.height = '235px';
    }
    else if (id == 'phone_text') {
      l_events.style.height = '200px';
    }
    else {
      l_events.style.height = '350px';
    }
    l_events.style.zIndex = '100';
  }
}

function drawXmasAd(){
  var l_today = new Date();
  var l_month = l_today.getMonth();
  l_month = l_month + 1;
  var l_day = l_today.getDate();
  if ((l_month == 11)||((l_month == 12)&&(l_day < 25))){
    document.writeln('    <img src="/img/wreath.gif" width="125" height="169" alt="Holiday Wreath" align="left" hspace="20" />');
    document.writeln('    <div style="float:left;width:400px;">');
    document.writeln('      <h3>This year give the gift of ');
    document.writeln('        <span class="green">C</span><span class="red">o</span><span class="green">m</span><span class="red">e</span><span class="green">d</span><span class="red">y</span>!');
    document.writeln('      </h3>');
    document.writeln('      <p style="float:left;">Comedy classes make a great gift. <a href="academy_enroll.html">Reserve a semester of classes today</a> for that funny friend or family member as <strong>these classes sell out quickly</strong>.</p>');
    document.writeln('    </div>');
    document.writeln('    <br clear="all" />');
  }
}

function newWin(url_path, win_width, win_height, win_name, win_scroll)
{
  newWindow =
window.open(url_path,win_name,config="resizable=yes,scrollbars="+
win_scroll+",screenX=50,screenY=50,left=50,top=50,width="+
win_width+",height="+win_height);
newWindow.focus();
}

