function testverify()
{
//first clear any yellow backgrounds from previous errors
document.testform.number.style.backgroundColor="ffffff"

var prefix = document.testform.number.value.substr(0,2)
if ((prefix==44) && (document.testform.number.value.length != 12))
{document.testform.number.style.backgroundColor="ffff80"
alert("UK mobile numbers must be 12 digits long")
return false}

var thirdnum = document.testform.number.value.substr(2,1)
if ((prefix==44) && (thirdnum != 7))
{document.testform.number.style.backgroundColor="ffff80"
alert("UK mobile numbers must start with 447")
return false}

if ((prefix==49) && (thirdnum != 1))
{document.testform.number.style.backgroundColor="ffff80"
alert("German mobile numbers must start with 491")
return false}

if ((prefix==33) && (thirdnum != 6))
{document.testform.number.style.backgroundColor="ffff80"
alert("French mobile numbers must start with 336")
return false}

if ((prefix==32) && (thirdnum != 4))
{document.testform.number.style.backgroundColor="ffff80"
alert("Belgian mobile numbers must start with 324")
return false}

if ((prefix==34) && (thirdnum != 6))
{document.testform.number.style.backgroundColor="ffff80"
alert("Spanish mobile numbers must start with 346")
return false}

//10 digit only for denmark, norway thailand
if (((prefix!=47) && (prefix!=45) && (prefix!=53) && (prefix!=66)) && (document.testform.number.value.length == 10))
{document.testform.number.style.backgroundColor="ffff80"
alert("US and Canada numbers start with 1 then area code. Please enter a valid number, starting with country code. If you're sure your international number is only 10 digits, please email us: support@aqmobile.com to override this error check.")
return false}

//9 digit only for djibouti
var threedig = document.testform.number.value.substr(0,3)
if ((threedig!=253) && (document.testform.number.value.length == 9))
{document.testform.number.style.backgroundColor="ffff80"
alert("Number too short. Please enter a valid number, starting with country code. If you're sure your international number is only 9 digits, please email us: support@aqmobile.com to override this error check.")
return false}


var firstnum = document.testform.number.value.substr(0,1)
if ((firstnum==7) && (document.testform.number.value.length == 10))  //this means uk number, left out country code
{document.testform.number.style.backgroundColor="ffff80"
alert("Numbers must start with country code. Use 44 for UK")
return false}

//var re12digit=/^\d{11,13}$/ //regular expression defining an 11/13 digit number
var re12digit=/^[1-9]\d{8,12}$/   //reg expression for 9 (djibouti) to 13 digits, not starting with 0
if (document.testform.number.value.search(re12digit)==-1) //if match failed
{document.testform.number.style.backgroundColor="ffff80"
alert("Please enter your number starting with country code. No + sign. No leading zero. 44 for UK. 1 for US/Canada. 61 for Australia. 64 for New Zealand. 353 for Ireland.")
return false}

var leadingzero=/^(4(0|1|3|4|5|6|7|8|9)0.|3(0|1|2|3|4|6|9)0.|3(5|7|8)[0-9]0|10..|270.|610.|640.).*$/i
if (document.testform.number.value.search(leadingzero)==0) //if match true
{document.testform.number.style.backgroundColor="ffff80"
alert("There should not be a zero after the country code.")
return false}

var oneone=/^11.*$/i
if (document.testform.number.value.search(oneone)==0) //if match true
{document.testform.number.style.backgroundColor="ffff80"
alert("Number invalid. Please check your area code.")
return false}

var usprefix = document.testform.number.value.substr(0,1)
if ((usprefix==1) && (document.testform.number.value.length != 11))
{document.testform.number.style.backgroundColor="ffff80"
alert("North American numbers must be 11 digits long")
return false}


//if no errors, submit
return true
}