$(document).ready( function() {
	$('#registration-formular .comp-contact input:text').css({ 'color': '#666666', 'font-style': 'italic', 'font-weight': 'normal' });
    $("#registration-formular .comp-contact").find("input:text").each(function(elem) {
    	this.orgMaxlength = $(this).attr('maxlength');
    	if (this.orgMaxlength <= 0) this.orgMaxlength = 1024;
    	if ($(this).val().length == 0) {
	    	$(this).attr('maxlength', $(this).attr('title').length);
			$(this).val($(this).attr('title'));
		} else {
			$(this).css({ 'color': '#333333', 'font-style': 'normal', 'font-weight': 'bold' });
		}
	});
	$('#registration-formular .comp-contact input:text').bind('focus click', function(event) {
		$(this).unbind();

		$(this).bind('focus click', function(event) {
			if ($(this).val() == $(this).attr('title')) {
				$(this).css({ 'color': '#333333', 'font-style': 'normal', 'font-weight': 'bold' });
		    	$(this).attr('maxlength', this.orgMaxlength);
				$(this).val('');
			}
		});
		$(this).bind('blur', function(event) {
			if ($(this).val().length == 0 || $(this).val() == $(this).attr('title')) {
				$(this).css({ 'color': '#666666', 'font-style': 'italic', 'font-weight': 'normal' });
		    	$(this).attr('maxlength', $(this).attr('title').length);
				$(this).val($(this).attr('title'));
			}
		});

		$(this).focus();
	});

	$('#registration-formular').bind('submit', function(event) {
		$('#registration-formular .comp-contact input:text').each(function(elem) {
			if ($(this).attr('title') == undefined || $(this).val() == $(this).attr('title'))
				$(this).val('');
		});
		return true;
	});
});
