function redirectionate(){
//    alert(document.form2.selectPage.options[document.form2.selectPage.selectedIndex].value);
    location.href=document.form2.selectPage.options[document.form2.selectPage.selectedIndex].value;
  }
  function checkLabel(){
    var acc_sel = document.getElementById('sel_acc');
    var acc_type = acc_sel.options[acc_sel.selectedIndex].value;
    var show_login = false;
    if(acc_type == 'parent'){
      document.getElementById('user_lbl').innerHTML = 'Email';
      show_login = true;
    }
    if(acc_type == 'affiliate'){
      document.getElementById('user_lbl').innerHTML = 'Username';
      show_login = true;
    }
  }
  
  function validateLog(){
    var acc_sel = document.getElementById('sel_acc');
    var acc_type = acc_sel.options[acc_sel.selectedIndex].value;
    var uname = document.getElementById('username');
    var pass = document.getElementById('password');
    var country_sel = document.getElementById('country');
    var country_name = country_sel.options[country_sel.selectedIndex].value;
    if(acc_type == ''){
      alert("Please select User Type");
      return false;
    }
    
    if(acc_type == 'parent' && uname.value == ''){
       alert("Please complete the Email field");
       return false;
    }
    if(acc_type == 'affiliate' && uname.value == ''){
       alert("Please complete the Username field");
       return false;
    }
    if(pass.value == ''){
      alert("Please complete the Password field");
      return false;
    }
    
    if(country_name == ''){
      alert("Please select the Country");
      return false;
    }
    return true;
  }
  function showLogin(){
    checkLabel();
    document.getElementById('lightbox2').style.display='none';
    document.getElementById('overlay').style.display='block';
    document.getElementById('overlay').style.width = '100%';
    document.getElementById('lightbox1').style.display='block';
  }
  function closeLogin(){
    document.getElementById('overlay').style.display='none';
    document.getElementById('lightbox1').style.display='none';
    document.getElementById('lightbox2').style.display='none';
  }
  function pwdRecovery(){
    checkLabelPwd();
    document.getElementById('lightbox2').style.display='block';
    document.getElementById('overlay').style.display='block';
    document.getElementById('lightbox1').style.display='none';
    //document.getElementById('pwdRecoveryContainer').style.width = '247px';
  }
  
  function validatePwdRecovery(){
    var acc_sel = document.getElementById('sel_acc_pwd');
    var acc_type = acc_sel.options[acc_sel.selectedIndex].value;
    var uname = document.getElementById('username_pwd');
    var country_sel = document.getElementById('country_pwd');
    var country_name = country_sel.options[country_sel.selectedIndex].value;
    if(acc_type == ''){
      alert("Please select User Type");
      return false;
    }
    
    if(acc_type == 'parent' && uname.value == ''){
       alert("Please complete the Email field");
       return false;
    }
    if(acc_type == 'affiliate' && uname.value == ''){
       alert("Please complete the Username field");
       return false;
    }
    
    if(country_name == ''){
      alert("Please select the Country");
      return false;
    }
    return true;
  }
  
  function checkLabelPwd(){
    var acc_sel = document.getElementById('sel_acc_pwd');
    var acc_type = acc_sel.options[acc_sel.selectedIndex].value;
    var show_login = false;
    document.getElementById('parent_text_sent').style.display = 'none';
    document.getElementById('affiliate_text_error').style.display = 'none';
    document.getElementById('affiliate_text_sent').style.display = 'none';
    document.getElementById('formRecover').style.display = 'block';
    if(acc_type == 'parent'){
      document.getElementById('user_lbl_pwd').innerHTML = 'Email';
      document.getElementById('parent_text').style.display = 'block';
      document.getElementById('parent_text_error').style.display = 'none';
      document.getElementById('pwdRecoveryContainer').style.width = '350px';
      show_login = true; 
    }
    if(acc_type == 'affiliate'){
      document.getElementById('user_lbl_pwd').innerHTML = 'Username';
      document.getElementById('parent_text').style.display = 'none';
      document.getElementById('parent_text_error').style.display = 'none';
      document.getElementById('pwdRecoveryContainer').style.width = '247px';
      document.getElementById('parent_text_error').style.display = 'none';
      show_login = true;
    }
    
    if(show_login){
      document.getElementById('tr_username_pwd').style.display = 'block';
      document.getElementById('tr_country_pwd').style.display = 'block';
      document.getElementById('tr_submit').style.display = 'block';
      document.getElementById('blank_tr').style.display = 'none';
      document.getElementById('blank_tr1').style.display = 'none';
    }
    else{
      document.getElementById('pwdRecoveryContainer').style.width = '247px';
      document.getElementById('tr_username_pwd').style.display = 'none';
      document.getElementById('tr_country_pwd').style.display = 'none';
      document.getElementById('parent_text').style.display = 'none';
      document.getElementById('tr_submit').style.display = 'none';
      document.getElementById('blank_tr').style.display = 'block';
      document.getElementById('blank_tr1').style.display = 'block';
    }
  }