/* csakcsajoknak.hu
  common.js
  prototype version
*/

// initalize auto form labels
document.observe("dom:loaded", function() {
	$$("#columnLeft label, .articleform label").each(function(e) {
		if($F(e.readAttribute('for')) === '') {
			classes = 'overlay';
		} else {
			classes = 'overlay inspace';
		}
		e.addClassName(classes);
	});

	$$('#columnLeft input, #columnLeft textarea, .articleform input, .articleform textarea').each(function(e){
		$(e).observe('focus', function(){
			$$('label[for="' + this.readAttribute('id') + '"]').invoke('addClassName', 'inspace');
		});
		$(e).observe('blur', function(){
			if($F(this) == ''){
				$$('label[for="' + this.readAttribute('id') + '"]').invoke('removeClassName', 'inspace');
			}
		});
	});
});

