jquery regex expressions alert box
===

i have this code which validates fields using regex expressions. at this moment it makes a popup in case something is wrong. i'd like to let go of this and to show a message maybe next to the field or above it. any help please?

here is the code:

    <script>
    function validate(form) {
	
    var pwd = form.elements.pasa.value;
	var eml = form.elements.pasa2.value;
	
    
   	
	if(5 > pwd.length || pwd.length > 25){
        alert("error");
        return false;
    }

    var rgx = /[a-zA-Z]|\d+/;
    if(!rgx.test(pwd)){
        alert("error");
        return false;
    }

    
    rgx = /\s/;
    if(rgx.test(pwd)){
        alert("error");
        return false;
    }
	
	if(8 > eml.length || eml.length > 40){
        alert("error");
        return false;
    }

    var rgx = /^\s*[a-z\d_]+(\.[a-z\d_]+)*@[a-z\d\-]{1,255}\.[a-z]{2,6}\s*$/;
    if(!rgx.test(eml)){
        alert("error");
        return false;
    }
	
    rgx = /\s/;
    if(rgx.test(eml)){
        alert("error");
        return false;
    }


    return true;
    }

    </script>

and the form:

    <form name="Form1" method="post" action="action1.php" language="javascript" onSubmit="return      validate(this);" id="Form1">
    <input name="pasa" class="field" type="text">
    <input name="pasa2" class="field" type="text">
    <input type="submit">
    </form>


  thanks