var vcs_std = new Class.create(vc,{
	type : 'vcs_std',
	valid: function(){
		d('[[new VCS_std]]');

		this.e.value = this.e.value.replace(String.fromCharCode(8211),String.fromCharCode(45));
		var c1 = String.fromCharCode(64,33,35,36,37,94,38,42,243,261,260,263,262,281,280,322,321,324,323,211,347,346,380,379,378,377,126);
		var c2 = String.fromCharCode(9,10,13,32,96,8222,8221,44,60,62,46,47,63,92,124,8364);	//tab,Enter,return,spaca, „”,<>./?\|€ 
		var c3 = String.fromCharCode(59,58,39,34,123,125,91,61,43,95,96,8211);					//;:'"=_+`
		var pattern = new RegExp(new String("[^a-zA-Z0-9\(\)\\\"\\\[\\\]\\\-\\\{\\\}" + c1 + c2 + c3 + "]"),"gi");
		var before = this.e.value;
		var after = this.e.value.replace(pattern,this.p.new_char);
		
		if(before != after){
			this.msg('Nie dozwolone znaki');
		}else{
			this.ok();
		}	
		this.e.value = after;
	}
});
var vcs_simple = new Class.create(vc,{
	type : 'vcs_simple',
	valid: function() {
		d('[[new VCS_simple]]');
		var pattern = new RegExp(new String("[^a-zA-Z0-9_\-]"),"gi");
		var before = this.e.value;
		var after = this.e.value.replace(pattern,this.p.new_char);
		if(before != after){
			this.msg('Bledne znaki');
		}else{
			this.ok();
		}	
		this.e.value = after;
	}
});
/** 
 * Kliencki walidator dlugosci kodu.
 * parametry:
 * min - minimalna dlugosc lancucha
 * max - maksymalna akceptowalna dlugosc lancucha
 */
var vcs_length = new Class.create(vc,{
	type : 'string_length',
	valid : function (){
		d('[[new VCS_length]]');
		if(this.e.value.length < this.p.min){
			this.msg('Za malo znakow od '+this.p.min+' od ' +this.p.max+ ' obecnie: ' + this.e.value.length)
		}else if(this.e.value.length > this.p.max){
			this.msg('Za duzo znakow od '+this.p.min+' od ' +this.p.max + ' obecnie: ' + this.e.value.length);
		}else{
			this.ok('Pole tekstowe od '+this.p.min+' od ' +this.p.max+ ' znakow');
		}
	}
});
/**
 * Walidator loginu zastepujacy znaki domyslne
 * parametry wywolania:
 * new_char - znak zastepujacy. 
 */
var vcs_login = new Class.create(vc,{
	type : 'string_length',
	valid : function (){
		d('[[new VCS_login]]');
		var pattern = new RegExp(new String("[^a-zA-Z0-9_\.\@]"),"gi");
		var before = this.e.value;
		var after = this.e.value.replace(pattern,this.p.new_char);
		if(before != after){
			this.msg('Bledne znaki');
		}else{
			this.ok();
		}	
		this.e.value = after;
	}
});