function setErrorBox(fieldname, text, active){
	var actBox = document.getElementById(fieldname + '_error');
	var fieldbox = document.getElementById(fieldname).parentNode;
	var field = $(fieldname);
	if (!actBox && active){
		actBox = new Element('div'); 
		actBox.addClass('errorbox');
		actBox.setStyle('position','absolute');
		actBox.id = fieldname + '_error';
		actBox.setText(text);
		
		var ua = window.navigator.userAgent;
    var msie = ua.indexOf ( "MSIE " );
		if (msie > 0) {
	
		}
		else {
		
			var pos = $(fieldname).getPosition();
			var parentPos = $(fieldname).getParent().getPosition();
			var fieldsize = $(fieldname).getSize();
			var boxpos = pos['x'] - parentPos['x'] + fieldsize.size['x'] + 7;
			actBox.setStyle('margin-left', boxpos);
		}
		fieldbox.appendChild(actBox);
		field.addEvent('change', function(){setErrorBox(fieldname,'',false)});
		 
	}
	else {
		if(actBox && !active){
			actBox.remove();
			field.removeEvent('change');
		}
	}
	if(active)
		document.location.href='#'+  fieldname;
}


