/*
* Validation of code form.
*
* NOTE!!!
* This file is in UTF-8 encoding and when included in the html should be specified.
*
* Copyright BGPrognozi.com (c) 2010
*/

function validateSMSCodeForm(form) {

var code = form.smsCode.value;
code = code.replace(/^\s+|\s+$/g,"");

if (code == "") {
alert(form.smsCodeEmpty.value);
form.smsCode.focus();
return false;
}

var regex = /^\d{4}$/;
if (!regex.test(code)) {
alert(form.smsCodeInvalid.value);
form.smsCode.value = "";
form.smsCode.focus();
return false;
}

return true;
}
