function submitTestPhoneForm(form, type)
{
	form.type.value = type;
	
	if (isTestPhoneValid(form))
	{
		if(!is_submitted) 
		{
			is_submitted = true;
			form.submit();
		}
		else 
		{
			//return false;
		}
	}
	else
	{
		document.location.href = '#errorTestPhone';
		//return false;
	}
}
function isTestPhoneValid(form)
{
	var error = document.getElementById('errorTestPhone');
	error.innerHTML ="";
	var pattren = /^[0-9]+$/;
	var pattren1 = /^[0]/;
	
	var b100;
	var b200
	
	if(pattren.test(form.worldPhoneNumber.value))
	{
		b100 = true;		
	}
	else
	{
		error.innerHTML += "* Error: The phone number is not valid. <br />";
		b100 = false;
	}
	if(pattren1.test(form.worldPhoneNumber.value))
	{
		error.innerHTML += "* Error: The 0 at the beginning of the phone number is not required, please remove it.";
		b200 = false;
				
	}
	else
	{
		b200 = true;
	}
	return (b100 && b200);
}

/*function isTestPhoneValid(form)
{
	var error = document.getElementById('errorTestPhone');
	clearError(error);
	
	var b1 = isValid(error,'You must enter a 10 digit cell phone number.','phone',form.areacode,form.exchange,form.number);
	var b2 = isValid(error,'You must select a carrier.','radio',form.testphonecarrier);

	return (b1 && b2);
}*/


function changeCountryCode(countryCode)
{
	document.getElementById("countryCode").value = countryCode.value;
}

function doNothing(form, type)
{
	form.type.value = type;
	form.submit();
}

function changeCarrier(country)
{
	//alert (country);
	if (country == "canada")
	{
		document.getElementById("canada").style.display = "inline"; 
		document.getElementById("us").style.display = "none";
		document.getElementById("uk").style.display = "none";
	}
	if (country == "us")
	{
		document.getElementById("canada").style.display = "none"; 
		document.getElementById("us").style.display = "inline";
		document.getElementById("uk").style.display = "none";
	}
	if (country == "uk")
	{
		document.getElementById("canada").style.display = "none"; 
		document.getElementById("us").style.display = "none";
		document.getElementById("uk").style.display = "inline";
	}
}


