var botaoClicado = '';
var mensagem = '';
function startFx(){
	var status = {
		'true': 'open',
		'false': 'close'
	};
	var myVerticalSlide = new Fx.Slide('box-login');
	myVerticalSlide.hide();
	$('bt-webmail').addEvent('click', function(e){
		e.stop();
		myVerticalSlide.slideIn();
	});
	$('bt-projetos').addEvent('click', function(e){
		e.stop();
		myVerticalSlide.slideIn();
	});	
	$('bt-direct').addEvent('click', function(e){
		e.stop();
		myVerticalSlide.slideIn();
	});	
	myVerticalSlide.addEvent('complete', function() {
		//if(status[myVerticalSlide.open]=='open')
			//document.getElementById('usuario').focus();
	});
	
	var myHorizontalSlide = new Fx.Slide('ok', {mode: 'horizontal'});
	
	myHorizontalSlide.hide();	
	
	$('usuario').addEvent('focus', function(e){
		e.stop();
		myHorizontalSlide.slideIn();
	});	
	
	$('senha').addEvent('focus', function(e){
		e.stop();
		myHorizontalSlide.slideIn();
	});

	/*
	$('senha').addEvent('blur', function(e){
		e.stop();
		myHorizontalSlide.slideOut();
	});	
	*/
	myHorizontalSlide.addEvent('complete', function() {
		if(status[myHorizontalSlide.open]=='open')
			document.getElementById('bt-abrir').src = "images/bt_abrir_off.png";
		else
			document.getElementById('bt-abrir').src = "images/bt_abrir.png";		
	});	
}

function swapImage(thi){
	if(botaoClicado == 'web'){
		thi.src = "images/bt_webmail_on.jpg";
		document.getElementById('bt-projetos').src = "images/bt_projetos.jpg";
		document.getElementById('bt-direct').src = "images/bt_direct.jpg";
		this.document.forms['formLogin'].secao.value = 'web';
	}else if(botaoClicado == 'proj'){
		thi.src = "images/bt_projetos_on.jpg";
		document.getElementById('bt-webmail').src = "images/bt_webmail.jpg";	
		document.getElementById('bt-direct').src = "images/bt_direct.jpg";
		this.document.forms['formLogin'].secao.value = 'projetos';
	}else if(botaoClicado == 'dir'){
		thi.src = "images/bt_direct_on.jpg";
		document.getElementById('bt-projetos').src = "images/bt_projetos.jpg";
		document.getElementById('bt-webmail').src = "images/bt_webmail.jpg";	
		this.document.forms['formLogin'].secao.value = 'direct';
	}
}

function startMooRd(){
		// MOO.RD ALERT
	var alertUsuario = new Custom.Alert('<span class="warning">Atenção</span>', '<span class="little">Preencha o nome de usúario.</span>', {
			content: 'html',
			text: {
				buttonText: '',
				closeButtonText: ''
			},
			opacify:true,
			draggable: true,
			zones: {
				alertbox: 'box4',
				alerthead: 'head4',
				alertbody: 'body4',
				buttonBox: 'buttonBox4'
			},
			buttons: {
				closeButton: 'cancelButton4',
				confirmButton: 'confirmButton4'
			},
			overlay: '#676767'
	});
	var alertSenha = new Custom.Alert('<span class="warning">Atenção</span>', '<span class="little">Preencha a senha de usúario.</span>', {
			content: 'html',
			text: {
				buttonText: '',
				closeButtonText: ''
			},
			opacify:true,
			draggable: true,
			zones: {
				alertbox: 'box4',
				alerthead: 'head4',
				alertbody: 'body4',
				buttonBox: 'buttonBox4'
			},
			buttons: {
				closeButton: 'cancelButton4',
				confirmButton: 'confirmButton4'
			},
			overlay: '#676767'
	});	
	$('bt_ok').addEvent('click', function(event) {
		event.preventDefault();
		
		if(document.getElementById('usuario').value == ''){
			alertUsuario.create();			
		}else if(document.getElementById('senha').value == ''){
			alertSenha.create();
		}else{
			document.formLogin.submit();
		}
		alertUsuario.setLight(false);	
		alertSenha.setLight(false);			
	});	
}
