
	var requiredFields = {
		'exixting_customer' : {
			'account_number' : 'engin Account Number',
			'email' : 'Email',
			'comments' : 'Comments'
		},
		'new_customer' : {
			'area_code' : 'Area Code',
			'phone_number' : 'Phone Number',
			'email' : 'Email',
			'comments' : 'Comments'
		}
	};
	var hasExistingAccount;
	function init () {
		hasExistingAccount  = document . getElementById ( 'has_existing_account' );
	}
	function checkExistingAccount ( Yes ) {
		var exixtingCustomerDetails = document . getElementById ( 'exixting_customer_details' );
		var newCustomerDetails = document . getElementById ( 'new_customer_details' );
		var commonDetails = document . getElementById ( 'common_details' );
		init();
		
		if (exixtingCustomerDetails == null) return;
		if (newCustomerDetails == null) return;
		if (commonDetails == null) return;
		
		if ( Yes == 1 ) {
			newCustomerDetails . style . display = 'none';
			exixtingCustomerDetails . style . display = 'block';
			commonDetails . style . display = 'block';
		} else if ( Yes == 0 ) {
			exixtingCustomerDetails . style . display = 'none';
			newCustomerDetails . style . display = 'block';
			commonDetails . style . display = 'block';
		}
		else 
		{
		    exixtingCustomerDetails . style . display = 'none';
			newCustomerDetails . style . display = 'none';
			commonDetails . style . display = 'none';
		}
		
	}
	function validateContactForm ( ) {
		var fields, fieldName, field, requiredAction;
		if ( hasExistingAccount . checked ) {
			fields = requiredFields [ 'exixting_customer' ];
		} else {
			fields = requiredFields [ 'new_customer' ];
		}
		for ( fieldName in fields ) {
			field = document . getElementById ( fieldName );
			if ( field . length ) {
				requiredAction = 'select';
			} else {
				requiredAction = 'enter';
			}
			if ( ! field . value ) {
				alert ( 'You must ' + requiredAction + ' your ' + fields [ fieldName ] + '!' );
				field . focus ( );
				return false;
			}
		}
	}

