function ValidateEditContact(){

	cname	= trim(getValue('edit_contact_name'));

	if (cname.length == 0){
		alert("Enter Contact's Name");
		setFocused('edit_contact_name');
		return false;
	}

	if (String(getValue('cc_11')).substring(0,1) == '0'){
		alert("Error: Country code can not start with 0!\nPlease check Dialing Instructions.");
		return false;
	}

	if (String(getValue('cc_12')).substring(0,1) == '0'){
		alert("Error: Country code can not start with 0!\nPlease check Dialing Instructions.");
		return false;
	}

	if (String(getValue('cc_13')).substring(0,1) == '0'){
		alert("Error: Country code can not start with 0!\nPlease check Dialing Instructions.");
		return false;
	}

	return true;

}

function ValidateSaveNumber(){

	if (getChecked('saveNumberNew')){ // Existed
		cname	= trim(getValue('saveNumberName'));

		if (cname.length == 0){
			alert("Enter Contact's Name");
			setFocused('edit_contact_name');
			return false;
		}

	}

	return true;

}

function ValidateNumbers(){

	var num_1;
	var num_2;

	if ((num_1 = getPhoneNumber(1)) == '') {
			alert("Enter the phone number you are calling from!");
			setFocused('cc_1');
			return false;
	}

	if ((num_2 = getPhoneNumber(2)) == '') {
			alert("Enter a destination phone number!");
			setFocused('cc_2');
			return false;
	}

	if (num_1 == num_2) {
			alert("Your phone number and destination number must be different!");
			setFocused('cc_2');
			return false;
	}

	num_1	= removeNonDigits(num_1);
	num_2	= removeNonDigits(num_2);

	if (String(num_1).substring(0,1) == '0'){
		alert("Error: Country code can not start with 0!\nPlease check Dialing Instructions.");
		setFocused('cc_1');
		return false;
	}

	if (String(num_2).substring(0,1) == '0'){
		alert("Error: Country code can not start with 0!\nPlease check Dialing Instructions.");
		setFocused('cc_2');
		return false;
	}


	return true;
}
