﻿$(document).ready(function(){

  //Focus action:
  $('input:text,input:password,input:radio,input:checkbox,select,textarea').focus(function(){
    var oLabel = this.parentNode.parentNode.getElementsByTagName('td')[0];
    
    oLabel = oLabel.getElementsByTagName('label');
    $(oLabel).attr({'class': 'focus'});
    $(this).attr({'class': 'focus'});
   });
  
  //Lost focus action:
  $('input:text,input:password,input:radio,input:checkbox,select,textarea').blur(function(){
    var oLabel = this.parentNode.parentNode.getElementsByTagName('td')[0];
    
    oLabel = oLabel.getElementsByTagName('label');
    $(oLabel).removeAttr('class');
    $(this).removeAttr('class');
  });
});

function onloadglobal()
{
  chkkvkreq();
 
}

function CopyTextFields()
{
  document.getElementById('txtVisAddress').value = document.getElementById('txtInvAddress').value;
  document.getElementById('txtVisPostal').value = document.getElementById('txtInvPostal').value;
  document.getElementById('txtVisCity').value = document.getElementById('txtInvCity').value;
  document.getElementById('cmbVisCountry').value = document.getElementById('cmbInvCountry').value;
}

function chkkvkreq()
{
  //Checks wheather the kvk textbox has to be displayed or not
  var oCmbOrg = document.getElementById('cmbOrganisationType');
  var iRes = -1
  
  iRes = oCmbOrg.value.substring(0, 1);
  
  if(iRes == '0')
  {
    //Display kvkbox
    if (IE) {
      document.getElementById('hdkvk').style.display = 'block';
    } else {
      document.getElementById('hdkvk').style.display = 'table-row';
    }
  } else {
    //Hide kvkbox
    document.getElementById('hdkvk').style.display = 'none';
  }
}