/*
Site:           devot-ee.com
File:           val_register.js
Last Modified:  Sep 07 2010 rmm 
----------------------------------------------------------- 
ryan masuga, masugadesign.com
ryan@masugadesign.com | Copyright 2009-2010
=========================================================== */
$(document).ready( function(){

	$("#registerform").validate({
	   errorPlacement: function(error, element) {   
	     error.insertBefore(element);  
	   },
	    errorClass: "formError",
			errorElement: "span",
		
			rules: {
				username: "required",
				screen_name: "required",
				email: {
					required: true,
					email: true
				},
				password: "required",
				password_confirm: {
					required: true,
					equalTo: "#password"
				},
				recaptcha_response_field: "required"
			},
		
			messages: {
				username: "Please enter a username",
				screen_name: "Please enter a screen name",
				email: {
					required: "Supply an email address",
					email: "Please enter a valid email address"
				},
				password: "Please enter a password",
				password_confirm: {
				  required: "Please confirm your password",
					equalTo: "Passwords must match"
				},
				recaptcha_response_field: "Please enter the two words above"
			}
		
	});

});


$(window).bind('load', function() {
	
	// recaptcha steals focus, so give it back to username
	$('#registerform #username').focus(); 
	$('#recaptcha_response_field').live(function(){
		$(this).blur();
		});

	//$('#recaptcha_response_field').focus(function(){
	//	$('#registerform #username').focus();
	//});	
      
});