/* REQUIRE:
   /_js/dom/abbr.js
*/

function SignUpForm() {
	
	var me = this;
	var strFormId = 'wizardform';
	var strButtonConClassName = 'formbuttons-con';
	this.domForm;
	this.arrFormButtons;
	this.initialized = false;

	this.init = function() {
		this.domForm = ge(strFormId);
		this.arrFormButtons = gtc(this.domForm, 'div', strButtonConClassName);
		this.initialized = true;
	}


	this.hideFormButtons = function() {
		if (!me.initialized) {
			me.init();
		}
		for (var ii in me.arrFormButtons) {
			me.arrFormButtons[ii].style.display = 'none';
		}
	}

	this.showFormButtons = function() {
		if (!me.initialized) {
			me.init();
		}
		for (var ii in me.arrFormButtons) {
			me.arrFormButtons[ii].style.display = 'block';
		}
	}

	this.showTip = function(tipName, size, scrollbars) { // size = ['L'|'M'|'S']
		// set tip file path, from tipName
		var filePath = '/Common/SignUp/tips/' + tipName + '.html';
		// set dimensions of popup window
		var dim = { 'L':[600,400], 'M':[400,300], 'S':[200,100] };
		var width = dim[size][0];
		var height = dim[size][1];
		var scrollbarsValue = 'no';
		if (scrollbars) {
			scrollbarsValue = 'yes';
		}
		var popup = window.open(filePath, 'win', 'width='+width.toString()+',height='+height.toString()+',scrollbars='+scrollbarsValue+',status=yes,resizable=yes,tools=no');
		popup.focus();
	}

}


$(document).ready(function() {
	$('div.formbuttons :button').click(function(){
		// run predefined onclick function, if any (see /_com/Wizard/Wizard/FUN_Wizard/writeSubmitButton.cfm)
		// if not returning false, continue to disable the buttons to avoid double-submit
		if (wizardSubmitOnClick() != false) {
			// get both bottons, disable them
			$('div.formbuttons :button').attr("disabled", "disabled");
		}
	});
});