﻿document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;

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 PopUpInfo(sTitle, sInfo)
{
  sTitle = sTitle.replace('*', '');
  document.getElementById('infodiv').style.display = 'inline';
  document.getElementById('infodiv').style.top = (tempY + 25) + 'px';
  document.getElementById('infodiv').style.left = (tempX - 115) + 'px';
  document.getElementById('infodiv').innerHTML = '<table class="infodivcontent" cellspacing="0"><tr class="infodivtitle"><td>' + sTitle + '</td></tr><tr class="infodivmsg"><td>' + sInfo + '</td></tr></table>';
}

function HidePopUp()
{
  document.getElementById('infodiv').style.display = 'none';
}

function onloadglobal()
{
  chkkvkreq();
  initForm('frmregister', 'txtUsername');
}

function chkkvkreq()
{
  //Checks wheather the kvk textbox has to be displayed or not
  var oCmbOrg = document.getElementById('cmbOrganisationType');
  var iRes = -1
  
  if(oCmbOrg)
  {
    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';
    }
  }
}

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = (event.x + document.body.scrollLeft) + 150;
    tempY = (event.y + document.body.scrollTop) + 120;
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX;
    tempY = e.pageY;
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  

  return true
}
