// JavaScript Document
function fadeout(){
	var t = $(this).effects({transition:Fx.Transitions.Cubic.easeOut, duration:2000});
	t.start({'opacity':0, 'height':0, 'margin-top':0, 'margin-bottom':0, 'padding-top':0, 'padding-bottom':0}).chain(function(){
//		t.start({'margin':0, 'height':0});
	});
}

window.addEvent('domready', function(){

	$$('.fadeout').each(function(e,i){
		fadeout.delay(3000, e);
	});
	
	$$('.textinput').each(function(e,i){
		e.fx = $(e).effects({transition:Fx.Transitions.Cubic.easeOut, duration:200});
		e.setStyle('border-color', '#777777');
		e.setStyle('background-color', '#f5f5f5');
		e.focused = false;
		e.addEvent('mouseover',  function(){
			e.fx.stop();
			e.fx.start({'border-color':'#FF6600'});
		});
		e.addEvent('mouseout',  function(){
			if(!e.focused){
				e.fx.stop();
				e.fx.start({'border-color':'#777777'});
			}
		});
		e.addEvent('focus',  function(){
			e.focused = true;
			e.fx.stop();
			e.fx.start({'border-color':'#FF6600', 'background-color':'#ffffff'});
		});
		e.addEvent('blur', function(){
			e.focused = false;
			e.fx.stop();
			e.fx.start({'border-color':'#777777', 'background-color':'#f5f5f5'});
		});
	});
});

function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}