function addClient() {
	var pform = $j('#clientform');
	
	var fields = new Array('owner', 'o_tel', 'o_fax', 'o_email', 'person', 'p_tel', 'p_fax', 'p_email', 'c_name', 'c_contact', 'c_address', 'c_town', 'c_postcode', 'c_country', 'c_tel', 'c_fax', 'c_email', 'i_address', 'i_town', 'i_postcode', 'i_country', 'd_address', 'd_town', 'd_postcode', 'd_country', 'passwd');

	var empty = false;
	for (i = 0; i < fields.length; i++) {
		if (fields[i] == 'passwd' && $j('#act').val() == 'edit')
			continue;
		else {
			if ($j('#'+fields[i]).val() == '') {
				empty = true;
				break;
			} 
				
		}
	}
	
	if ($j('#passwd').val() != $j('#passwd2').val()) 
		alert('Password and password confirmation are not identical'); 
	else {
		if (empty == true) 
			alert('Please fill in all required fields');
		else {
			pform.submit();
		}
	}
	
	return true;

}

function useCompany4Owner(that) {
	if (that.checked) {
		$j('#owner').val($j('#c_contact').val());
		$j('#o_fax').val($j('#c_fax').val());
		$j('#o_tel').val($j('#c_tel').val());
		$j('#o_email').val($j('#c_email').val());
	}
}

function useCompany4Pic(that) {
	if (that.checked) {
		$j('#person').val($j('#c_contact').val());
		$j('#p_fax').val($j('#c_fax').val());
		$j('#p_tel').val($j('#c_tel').val());
		$j('#p_email').val($j('#c_email').val());
	}
}

function useCompany4Aoi(that){
	if (that.checked) {
		$j('#i_address').val($j('#c_address').val());
		$j('#i_postcode').val($j('#c_postcode').val());
		$j('#i_town').val($j('#c_town').val());
		$j('#i_country').val($j('#c_country').val());
	}
}

function useCompany4Aod(that) {
	if (that.checked) {
		$j('#d_address').val($j('#c_address').val());
		$j('#d_postcode').val($j('#c_postcode').val());
		$j('#d_town').val($j('#c_town').val());
		$j('#d_country').val($j('#c_country').val());
	}
}


