// General NEVI JavaScript Document

function showPayment(strSelection) {
  if (strSelection == 'incasso') {
	showElementId('incasso',true);
                showElementId('factuur',false);
  } else if (strSelection == 'factuur') {
                showElementId('incasso',false);
	showElementId('factuur',true);
  }
}

function showNextButton(blnShow) {
	showElementId('nextenabled',blnShow);
	showElementId('nextdisabled',!blnShow);
}

function showEventFields(strSelection) {
  if (strSelection=='member') {
 	showElementId('eventnone',false);
 	showElementId('eventmember',true);
	showElementId('eventuser',false);
  } else if (strSelection=='user') {
 	showElementId('eventnone',false);
 	showElementId('eventmember',false);
	showElementId('eventuser',true);
  } else { 
 	showElementId('eventnone',true);
 	showElementId('eventmember',false);
	showElementId('eventuser',false);
  }
}

function hideIntroduce() {
	showElementId('introduce',false);
}

function switchIntroduce(objSelectbox) {
	showElementId('introduce',objSelectbox.checked);
}

function hideAlternativeEmail() {
	showElementId('alternativemail',false);
}

function switchAlternativeEmail(objSelectbox) {
	showElementId('alternativemail',objSelectbox.checked);
}




function showElementId(strID,blnVisible) {
  if(!document.getElementById) { return; }
  if (document.getElementById(strID)) {
    document.getElementById(strID).style.display = ((blnVisible) ? 'block' : 'none');
  }
}

// Attach the processing function to the window's onLoad event.
// Save existing events and execute those first, so we don't mess up existing scripts.
var previousHandler = window.onload ? window.onload : new Function();
// window.onload = function() { previousHandler(); showPayment('incasso'); showNextButton(false); showEventFields('none'); hideIntroduce(); hideAlternativeEmail(); };
window.onload = function() { previousHandler(); showNextButton(false); };

// For use in forms... tells the Struts action wich submit butten was pressed
function setFormTarget(target){
    document.getElementById("dispatch").value=target;
}

// For use in forms... tells the Struts action if validation should occur
function setFormValidate(value){
    document.getElementById("validate").value=value;
}
// For use in forms... tells the Struts action if validation should occur
function setFormZoekValidate(value){
    document.getElementById("validateZoeken").value=value;
}

// For use with result tabs on search page
function setTabActive(activeTabName) {
	 tabNames = new Array("artikelen", "leden", "evenementen", "links2");
	 for (iTab in tabNames) {
	     if (tabNames[iTab] == activeTabName) {
		document.getElementById(tabNames[iTab]).style.display='inline';
	     } else {
		document.getElementById(tabNames[iTab]).style.display='none';
	     }
	}
	return false;
}