jQuery(document).ready(
	function(){
		jQuery("#s_username").focus(function(){this.select();});
		jQuery("#s_email").focus(function(){this.select();});
		jQuery("#subscribeForm").validate({

			rules: {
			
				email: {
				
					required: true,
					email:true,
					maxlength:255
				},
				username:{
					required:true,
					maxlength:100,
					donotEqualToValue:notEqual_Name
					
				}
			},
			messages: {
				email: {
				
					required: error_noEmail,
					email:error_notValidEmail,
					maxlength:error_emailTooLong
				
				},
				username:{
					required: error_noName,
					maxlength:error_nameTooLong,
					donotEqualToValue:error_noName
				}
			},
			submitHandler: function(form) {
			   	$.post("/umbraco/Subscribe.aspx", {username:$('#s_username').val(),email:$('#s_email').val(),language:$('#language').val()},function(data){ 
					if(data=="1"){
						alert(info_success);
					}
					else{
						if(data=="-1"){
							alert(info_haveSubscribed);//to be implement
						}else{
							alert(info_fail);
						}
					}
				});
			 }

			
		});
		
		
	}
);
