﻿function showHide(id, show)
{
	var el = document.getElementById(id);
    if (show)
		el.style.visibility = 'visible';
    else
		el.style.visibility = 'hidden';
}

function showHideDisplay(id, show)
{
	var el = document.getElementById(id);
    if (el != null)
	{
		if (show)
			el.style.display = '';
		else
			el.style.display = 'none';
	}
}

function setFocus(el)
{
	if (el != null)
	{
	    if (typeof(el.focus) != 'undefined')
		    el.focus();
		if (typeof(el.select) != 'undefined')
			el.select();
	}
}

function enableValidation(el, validate)
{
	if (el != null)
		el.enabled = validate;
}

function maxLength(field, max, countField)
{
	if (field.value.length > max)
		field.value = field.value.substring(0, max);
	else if (countField != null)
		countField.value = max - field.value.length;
}

function showMAF(titel) {
    closeMI();
    closeGA();

    lblMAF.innerHTML = titel;
    hfMAF.value = titel;
    tbMAFVan.value = '';
    tbMAFVanEmail.value = '';
    tbMAFAan.value = '';
    tbMAFAanEmail.value = '';
    tbMAFBericht.value = '';
    
//    enableValidation(rfvMAFVanEmail, true);
//    enableValidation(revMAFVanEmail, true);
//    enableValidation(rfvMAFAanEmail, true);
//    enableValidation(revMAFAanEmail, true);
    
    var div = document.getElementById('divMAF');
    var top = ((document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop) + 75;
    div.style.top = top + 'px';
    
    div.style.display='';

    //pageTracker._trackPageview("/formulier/MAF/Open");
    _gaq.push(['_trackPageview', '/formulier/MAF/Open/' + titel]);
}

function closeMAF() {
        lblMAF.innerHTML = '';
        hfMAF.value = '';
        tbMAFVan.value = '';
        tbMAFVanEmail.value = '';
        tbMAFAan.value = '';
        tbMAFAanEmail.value = '';
        tbMAFBericht.value = '';

    
//    enableValidation(rfvMAFVanEmail, false);
//    enableValidation(revMAFVanEmail, false);
//    enableValidation(rfvMAFAanEmail, false);
//    enableValidation(revMAFAanEmail, false);
    
    var div = document.getElementById('divMAF');

//    if (div.style.display != 'none')
//        //pageTracker._trackPageview("/formulier/MAF/Close");
//        _gaq.push(['_trackPageview', '/formulier/MAF/Close/']);
    
    div.style.display = 'none';
}

function showMI(titel)
{
    closeMAF();
    closeGA();
    
    lblMI.innerHTML = titel;
    hfMI.value = titel;
    tbMIVan.value = '';
    tbMIVanEmail.value = '';
    tbMIBedrijf.value = '';
    tbMIBericht.value = '';
    
//    enableValidation(rfvMIVanEmail, true);
//    enableValidation(revMIVanEmail, true);
    
    var div = document.getElementById('divMI');
    var top = ((document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop) + 75;
    div.style.top = top + 'px';
    
    div.style.display='';

    //pageTracker._trackPageview("/formulier/MI/Open");
    _gaq.push(['_trackPageview', '/formulier/MI/Open/' + titel]);
}

function closeMI()
{
        lblMI.innerHTML = '';
        hfMI.value = '';
        tbMIVan.value = '';
        tbMIVanEmail.value = '';
        tbMIBedrijf.value = '';
        tbMIBericht.value = '';
    
//    enableValidation(rfvMIVanEmail, false);
//    enableValidation(revMIVanEmail, false);
    
    var div = document.getElementById('divMI');

//    if (div.style.display != 'none')
//        //pageTracker._trackPageview("/formulier/MI/Close");
//        _gaq.push(['_trackPageview', '/formulier/MI/Close/']);
        
    div.style.display = 'none';
}

function showGA(titel)
{
    closeMAF();
    closeMI();

    lblGA.innerHTML = titel;
    hfGA.value = titel;
    tbGAVan.value = '';
    tbGAVanEmail.value = '';
    tbGABedrijf.value = '';
    tbGABericht.value = '';

    //    enableValidation(rfvGAVanEmail, true);
    //    enableValidation(revGAVanEmail, true);

    var div = document.getElementById('divGA');
    var top = ((document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop) + 75;
    div.style.top = top + 'px';

    div.style.display = '';

    //pageTracker._trackPageview("/formulier/GA/Open");
    _gaq.push(['_trackPageview', '/formulier/GA/Open/' + titel]);
}

function closeGA()
{
        lblGA.innerHTML = '';
        hfGA.value = '';
        tbGAVan.value = '';
        tbGAVanEmail.value = '';
        tbGABedrijf.value = '';
        tbGABericht.value = '';


    //    enableValidation(rfvGAVanEmail, false);
    //    enableValidation(revGAVanEmail, false);

    var div = document.getElementById('divGA');
    
//    if (div.style.display != 'none')
//        //pageTracker._trackPageview("/formulier/GA/Close");
//        _gaq.push(['_trackPageview', '/formulier/GA/Close/']);
    
    div.style.display = 'none';
}

function showMDW(img, naam, functie, email, tel, tekst)
{
    closeMI();
    closeMAF();
    
    if (img != null && img != '')
		imgMDW.src = img;
	else
		imgMDW.style.visibility = 'hidden';
    lblMDWNaam.innerHTML = naam;
    lblMDWFunctie.innerHTML = functie;
    lblMDWEmail.innerHTML = email;
    lblMDWEmail.innerHTML = '<a href="mailto:' + email + '" style="font-weight:normal;">' + email + '</a>';
    lblMDWTel.innerHTML = tel;
    lblMDWTekst.innerHTML = tekst;
    
    var div = document.getElementById('divMDW');
    var top = ((document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop) + 75;
    div.style.top = top + 'px';
    
    div.style.display='';
}

function closeMDW()
{
    imgMDW.src = '';
    lblMDWNaam.innerHTML = '';
    lblMDWFunctie.innerHTML = '';
    lblMDWEmail.innerHTML = '';
    lblMDWTel.innerHTML = '';
    lblMDWTekst.innerHTML = '';
    
    var div = document.getElementById('divMDW');
    div.style.display = 'none';
}
