function getradioValue(referral, risktype)
{
   obj = document.forms[referral][risktype]
   for(i=0;i<obj.length;i++)
      if(obj[i].checked) return obj[i].value;
}

bIsValidCurrency = /^\$?[0-9\,]+(\.\d{2})?$/
function isNumOk(txtValue) {
  return (bIsValidCurrency.test(String(txtValue).replace(/^\s+|\s+$/g, ""))) 
}


function isValid(str){
  if(!str.match(/^c\d{8}$/i))return false;
  var total = 0;
  var digits = str.split('');
  var multiplier = 128;
  for(var i=1; i<8; i++){
    total += digits[i] * multiplier;
    multiplier /= 2;
  }
  return (digits[8]*1 == (11 - (total % 11)));
}

function checkMemeber(){
  CheckDigit(document.rollover.investor_number.value);
}

function CheckDigit(MemberNumber) {
  if(numberPart=(MemberNumber+'').match(/^(\d{5})(\d{6,7})(\d)/)){
    var memberDigit = numberPart[2];
    var checkDigit = numberPart[3];
    var checkSum = 0;
    for(var i=0;i<memberDigit.length;i++){
      checkSum = (checkSum+(memberDigit.charAt(i)*1)) * 2 % 11;
    }
    checkSum = 11 - checkSum;
    checkSum %= 10;
    if(checkSum==checkDigit){
      return true;
    }
  }
  return false;
}


function validate(myForm) {
	if (myForm.investor_number.value.length < 1) {
		hideall();
		document.getElementById('investorError').style.display = "block";
		myForm.investor_number.focus();
		return false;
	}
	if (myForm.lastname.value.length < 1) {
		hideall();
		document.getElementById('lastnameError').style.display = "block";
		myForm.lastname.focus();
		return false;
	}
	if (myForm.day.value.length < 1 || myForm.month.value.length < 1 || myForm.year.value.length < 1) {
		hideall();
		document.getElementById('dobError').style.display = "block";
		if (myForm.day.value.length < 1){
			myForm.day.focus();
		return false;		
		}
		else if (myForm.month.value.length < 1){
			myForm.month.focus();
		return false;		
		}
		else if (myForm.year.value.length < 1){
			myForm.year.focus();
		return false;		
		}
	}
	return true; 
}


function hideall(){
	document.getElementById('lastnameError').style.display = "none";
	document.getElementById('dobError').style.display = "none";
	document.getElementById('investorError').style.display = "none";
}



