function mv_reg_validateForm()
{$("#firstname_error").empty().hide();$("#lastname_error").empty().hide();$("#email_error").empty().hide();$("#email_confirm_error").empty().hide();$("#password_error").empty().hide();$("#password_confirm_error").empty().hide();var firstname=$("#firstname").val();var lastname=$("#lastname").val();var email=$("#reg_email").val();var email_confirm=$("#email_confirm").val();var password=$("#reg_password").val();var password_confirm=$("#password_confirm").val()
var errors=0;var errorList='<ul class="reddot">\n';if(firstname==null||firstname=='')
{var firstnameMsg="Please enter your first name";$("#firstname_error").show().append(firstnameMsg);$("#firstname").addClass("error");var errorList=errorList+"<li>"+firstnameMsg+"</li>\n";errors++;}else{$("#firstname").removeClass("error");}
if(lastname==null||lastname=='')
{var lastnameMsg="Please enter your surname"
$("#lastname_error").show().append(lastnameMsg);$("#lastname").addClass("error");var errorList=errorList+"<li>"+lastnameMsg+"</li>\n";errors++;}else{$("#lastname").removeClass("error");}
if(email!=email_confirm)
{var emailmatchMsg="Email addresses do not match";$("#reg_email").addClass("error");$("#email_confirm").addClass("error");var errorList=errorList+"<li>"+emailmatchMsg+"</li>\n";errors++;}
if(email==null||email=='')
{var emailMsg="Please enter your email address";$("#email_error").show().append(emailMsg);$("#reg_email").addClass("error");var errorList=errorList+"<li>"+emailMsg+"</li>\n";errors++;}else{$("#reg_email").removeClass("error");}
if(email_confirm==null||email_confirm=='')
{var emailconfirmMsg="Please confirm your email address";$("#email_confirm_error").show().append(emailconfirmMsg);$("#email_confirm").addClass("error");var errorList=errorList+"<li>"+emailconfirmMsg+"</li>\n";errors++;}else{$("#email_confirm").removeClass("error");}
if(password!=password_confirm)
{var passmatchMsg="Passwords do not match";$("#reg_password").addClass("error");$("#password_confirm").addClass("error");var errorList=errorList+"<li>"+passmatchMsg+"</li>\n";errors++;}
if(password==null||password=='')
{var passwordMsg="Please enter a password";$("#password_error").show().append(passwordMsg);$("#reg_password").addClass("error");var errorList=errorList+"<li>"+passwordMsg+"</li>\n";errors++;}else{$("#reg_password").removeClass("error");}
if(password_confirm==null||password_confirm=='')
{var passwordconfirmMsg="Please confirm your password"
$("#password_confirm_error").show().append(passwordconfirmMsg);$("#password_confirm").addClass("error");var errorList=errorList+"<li>"+passwordconfirmMsg+"</li>\n";errors++;}else{$("#password_confirm").removeClass("error");}
var errorList=errorList+"</ul>";if(errors==1)
{jAlert("<p>There is an error in the form:</p>"+errorList+"<p>Please correct and try again</p>","Oops!");return false;}else if(errors>1){jAlert("<p>There are errors in the form:</p>"+errorList+"<p>Please correct and try again</p>","Oops!");return false;}}
function mv_reg_showResponse(responseText,statusText){jAlert(responseText,"myVIVA Registration");}
$(document).ready(function(){$("form .tooltip").each(function(){$(this).after('<img align="top" class="info" src="/media/images/icons/form_info.gif" alt="Information" width="13" height="13" />');});$('#myviva_reg form').append('<input type="hidden" name="ajax" />');var options={type:'post',beforeSubmit:mv_reg_validateForm,url:'/index.php?load=datacapture',success:mv_reg_showResponse};$('#myviva_reg form').ajaxForm(options);$('#myviva_reg *[title]').qtip({show:{solo:true,delay:150,effect:{type:'fade',length:430}},content:{text:false},style:{color:'#ffffff',background:'#D1234B',border:{color:'#D1234B',width:1,radius:3},name:'red'},position:{corner:{target:'bottomMiddle',tooltip:'topMiddle'}}});});
