//Definição de variáveis locais na página!
var post_form
post_form = 0;

function direciona_post(){
	canal = document.form_login.channel.value;
	usuario = document.form_login.txt_login.value;
	senha = document.form_login.txt_senha.value;
	
	if (canal == 'research' || canal == 'suppliers'){
		document.form_login.txtlogin.value = usuario ;
		document.form_login.txtsenha.value = senha ;
	}
	
	if (canal == 'webmail') {
		document.form_login.f_email.value = usuario.replace('@usefashion.com','') ;
		document.form_login.f_pass.value  = senha ;
	}
	
	if (usuario == '') {
		alerta(1);
		document.form_login.txt_login.focus();
	}else if (senha == '') 	{
		alerta(2);
		document.form_login.txt_senha.focus();
	}else{
		return true;
	}
	
}



function submeter_form(){
	if (post_form == 0)	{
		if (direciona_post()){
			document.form_login.ok.disabled = true;
			document.form_login.submit();
			post_form++;		
		}
	}
}

function abrirpresentation(){
	formato = 'top=0,left=0,width=' + (screen.width-10)+ ',height=' + (screen.height-28);
	formato = formato + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,fullscreen=no';
	resultado = window.open('presentation.asp','presentation',formato);
}

function alterar_layout(opc,login){
	if (opc == 'research' || opc == 'suppliers') {
		document.getElementById('dominio').innerHTML = '';
		document.getElementById('login').innerHTML = login + ':';
		document.form_login.txt_login.size = 20;
		alerta(3);
	}
	
	if (opc == 'webmail')	{
		document.getElementById('dominio').innerHTML = '@usefashion.com';
		document.getElementById('login').innerHTML = 'E-mail:';
		document.form_login.txt_login.size = 10;
		alerta(4);
	}
}

function verif_enter(tecla){
	if (tecla == 13)	{
		document.form_login.ok.click();
	}
}

function alerta2(opc,txt,txt_href){
	if (opc == 1 || opc == 2)	{
		alert(txt);
	}else if (opc == 3 || opc == 4)	{
		document.getElementById('extra').innerHTML = txt;
		document.getElementById('link_extra').href = txt_href;
		document.getElementById('link_extra').title = txt;
	}
}
