function form_Join(auto_id) {
	this.DOMConstruct('form_Join', auto_id);
}
form_Join.prototype = new SK_FormHandler({
	name: 'profile_join',
	
	fields: {
		sex: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		},
		username: {
			construct: 
							function($input) {
								var handler = this;
								
								if($input.val()!="" && $input.val()!=handler.lastValue){
									handler.check_username($input);
								}
		
								$input.change(function(){
									handler.changed = true;
								});
													
								$input.blur(function() {
									if($input.val()!="" && $input.val()!=handler.lastValue && handler.changed ){
										handler.check_username($input);
									}
									else{
										$input.parent().find(".success").remove();
									}
								});
							},
			validate: function(value, required) {},
			focus: function() {},
			changed: true,
			lastValue: "",
			check_username: 
							function($input){
							
							var handler = this;
								$.ajax({
										url: "http://www.singletalk.ch/field_responder.php",
										method: "post",
										dataType: "json",
										data: {action: "check_username_exists", username: $input.val()},
										success: function(result){
												$input.parent().find(".success").remove();
												handler.changed = false;
												if (result==2){
													SK_drawError("Sorry, dieser Benutzername wird bereits von einem anderen Single verwendet");
												}
		   										else if(result==1){
		   											$input.after('<span class="success">&nbsp;</span>');
		   										}
		   										else if(result==4) {
		   											SK_drawError("Sorry, dieser Benutzername ist nicht erlaubt");
		   										}
		   										else{
		   											SK_drawError("Bitte Benutzernamen ohne Sonderzeichen eintragen");
		   										}
		  								}
									});
							}
							
		},
		password: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		},
		re_password: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		},
		email: {
			construct: 
							function($input) {
								var handler = this;
								
								this.lastValue = $input.parent().find("input[name=last_value]").val();
								
								if($input.val()!="" && $input.val()!=this.lastValue){
									handler.check_email($input);
								}		
								
								$input.change(function(){
									handler.changed = true;
								});
												
								$input.blur(function() {
									if($input.val()!="" && $input.val()!=handler.lastValue && handler.changed ){
										handler.check_email($input);
									}
									else{
										$input.parent().find(".success").remove();
									}						
								});
							},
			validate: function(value, required) {},
			focus: function() {},
			lastValue: "",
			changed: true,
			check_email: 
							function($input){
							var handler = this;
							
								$.ajax({
										url: "http://www.singletalk.ch/field_responder.php",
										method: "post",
										dataType: "json",
										data: {action: "check_email_exists", email: $input.val()},
										success: function(result){
												$input.parent().find(".success").remove();
												handler.changed = false;
												if (result==2){
													SK_drawError("Sorry, diese Email wird bereits verwendet");
												}
		   										else if(result==1){
		   											$input.after('<span class="success">&nbsp;</span>');
		   										}
		   										else{
		   											SK_drawError("Bitte eine gültige Emailadresse eintragen");
		   										}
		   										
		   										
		  								}
									});
							}
							
		},
		re_email: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		},
		headline: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		},
		i_agree_with_tos: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		},
		vorname: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		},
		nachname: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		},
		strasse___nr_: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		},
		plz___ort: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		},
		land: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		},
		telefon: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		},
		tel_mobil: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		},
		gefunden_durch: {
			construct: function($input, form_handler) {},
			validate: function(value, required) {},
			focus: function() {}
		}
	},
	actions: {
		action_1___: {
		fields: {"sex":true,"username":true,"password":true,"re_password":true,"email":true,"re_email":true,"i_agree_with_tos":true,"vorname":true,"nachname":true,"strasse___nr_":true,"plz___ort":true,"land":true,"telefon":false,"tel_mobil":false,"gefunden_durch":false}
		},
		action_1___1: {
		fields: {"sex":true,"username":true,"password":true,"re_password":true,"email":true,"re_email":true,"i_agree_with_tos":true,"vorname":true,"nachname":true,"strasse___nr_":true,"plz___ort":true,"land":true,"telefon":false,"tel_mobil":false,"gefunden_durch":false}
		},
		action_2___1: {
		fields: {"headline":true}
		},
		action_1___2: {
		fields: {"sex":true,"username":true,"password":true,"re_password":true,"email":true,"re_email":true,"i_agree_with_tos":true,"vorname":true,"nachname":true,"strasse___nr_":true,"plz___ort":true,"land":true,"telefon":false,"tel_mobil":false,"gefunden_durch":false}
		},
		action_2___2: {
		fields: {"headline":true}
		}
	},
	default_action: ''
});

