﻿var prevent_submit = false;
		
function AllowSubmit(validationGroup) {		
	if (prevent_submit)
		return false;				
	prevent_submit = true;
	if (typeof(Page_ClientValidate) == 'function') {
		puc_ConfigurationValidation();
		if (Page_ClientValidate(validationGroup) == false) {
			puc_ShowErrors(true);					
			prevent_submit = false;
			return false;
		}
	}
	puc_ShowErrors(false);
	return true;
}

function ResetSubmit() {
	prevent_submit = false;
}

function puc_ConfigurationValidation() {
	var list = $get(PageVariables.ListState);
	var enable = (list.selectedIndex > 0);
	
	ValidatorEnable($get(PageVariables.rfvAddress), enable);
	ValidatorEnable($get(PageVariables.rfvZip), enable);
}

function puc_ShowErrors(display) {
	if (display) {
		$get("errornotify").style.display = 'block';
		$find('popupErrors').show();
	} else {
		$get("errornotify").style.display = 'none';
	}
}

if(typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();