var intFormGroupIndex = 1 

var FormFunctions = new function()
{
    this.NextPage = function()
    {
        this.Hide('group' + intFormGroupIndex, true);
        intFormGroupIndex++;
        this.Show('group' + intFormGroupIndex, true)
    }    
    
    this.PreviousPage = function()
    {
        this.Hide('group' + intFormGroupIndex, true);
        intFormGroupIndex--;
        this.Show('group' + intFormGroupIndex, true);
    }
    
   this.Show = function(strLayer, blnToggleDisplay)
    {
        if (blnToggleDisplay == true) { document.getElementById(strLayer).style.display = "block" }
        document.getElementById(strLayer).style.visibility = 'visible'
    }

    this.Hide = function(strLayer, blnToggleDisplay)
    {
    if (blnToggleDisplay == true) { document.getElementById(strLayer).style.display = "none" }
    document.getElementById(strLayer).style.visibility = 'hidden'
    }
}

function bedrijfAanmeldenSubmit()
{
   if (Validate('bedrijfaanmelden'))
   { 
      document.bedrijfaanmelden.submit(); 
   }
   else
   {
      return false;
   }
}

function sollicitatieSubmit()
{
   if (Validate('sollicitatie'))
   { 
      document.sollicitatie.submit(); 
   }
   else
   {
      return false;
   }
}
function FormSubmit(FormElement, blnShowAlert, strAlertLabel)
{
    if(blnShowAlert == undefined){blnShowAlert = false}
    if(strAlertLabel == undefined){strAlertLabel = '[' + FormElement + ']'}
   if (Validate(FormElement))
   { 
      if(blnShowAlert == true){window.confirm('Uw aanvraag voor '+ strAlertLabel +' is verstuurd.')}
      eval('document.' + FormElement + '.submit()'); 
   }
   else
   {
      return false;
   }
}

function printScreen()
{
   window.print()
}

function downloadPDF(strURL)
{
   window.open('pdf/createpdf.aspx?url=' + escape(strURL));
}

function showOpleidingField(intIndex)
{
   document.getElementById('opleidingcount').value = parseInt(document.getElementById('opleidingcount').value) + 1;
   loadOpleidingFields();
}

function hideOpleidingField(intIndex)
{
   document.getElementById('opleidingcount').value = parseInt(document.getElementById('opleidingcount').value) - 1;
   document.getElementById('opleiding' + intIndex + 'naam').value = '';
   document.getElementById('opleiding' + intIndex + 'beginjaar').selectedIndex = 0;
   document.getElementById('opleiding' + intIndex + 'beginmaand').selectedIndex = 0;
   document.getElementById('opleiding' + intIndex + 'eindjaar').selectedIndex = 0;
   document.getElementById('opleiding' + intIndex + 'eindmaand').selectedIndex = 0;
   document.getElementById('opleiding' + intIndex + 'diplomagehaalddefault').checked = true
   Hide('opleiding' + intIndex + 'div', true);
}

function loadOpleidingFields()
{
   intCount = parseInt(document.getElementById('opleidingcount').value)
   
   for (var i = 1; i < (intCount + 1); i ++)
   {
      Show('opleiding' + i + 'div', true);
   }
}

function showCursusField(intIndex)
{
   document.getElementById('cursuscount').value = parseInt(document.getElementById('cursuscount').value) + 1;
   loadCursusFields();
}

function hideCursusField(intIndex)
{
   document.getElementById('cursuscount').value = parseInt(document.getElementById('cursuscount').value) - 1;
   document.getElementById('cursus' + intIndex + 'naam').value = '';
   document.getElementById('cursus' + intIndex + 'beginjaar').selectedIndex = 0;
   document.getElementById('cursus' + intIndex + 'beginmaand').selectedIndex = 0;
   document.getElementById('cursus' + intIndex + 'eindjaar').selectedIndex = 0;
   document.getElementById('cursus' + intIndex + 'eindmaand').selectedIndex = 0;
   document.getElementById('cursus' + intIndex + 'diplomagehaalddefault').checked = true
   Hide('cursus' + intIndex + 'div', true);
}

function loadCursusFields()
{
   intCount = parseInt(document.getElementById('cursuscount').value)
   
   for (var i = 1; i < (intCount + 1); i ++)
   {
      Show('cursus' + i + 'div', true);
   }
}

function showFunctieField(intIndex)
{
   document.getElementById('functiecount').value = parseInt(document.getElementById('functiecount').value) + 1;
   loadFunctieFields();
}

function hideFunctieField(intIndex)
{
   document.getElementById('functiecount').value = parseInt(document.getElementById('functiecount').value) - 1;
   document.getElementById('functie' + intIndex + 'beginjaar').selectedIndex = 0;
   document.getElementById('functie' + intIndex + 'beginmaand').selectedIndex = 0;
   document.getElementById('functie' + intIndex + 'eindjaar').selectedIndex = 0;
   document.getElementById('functie' + intIndex + 'eindmaand').selectedIndex = 0;
   document.getElementById('functie' + intIndex + 'werkgever').value = '';
   document.getElementById('functie' + intIndex + 'plaats').value = '';
   document.getElementById('functie' + intIndex + 'functie').value = '';
   document.getElementById('functie' + intIndex + 'taakbeschrijving').value = '';
   Hide('werkervaring' + intIndex + 'div', true);
}

function loadFunctieFields()
{
   intCount = parseInt(document.getElementById('functiecount').value)
   
   for (var i = 1; i < (intCount + 1); i ++)
   {
      Show('werkervaring' + i + 'div', true);
   }
}



