//Validação de Campos e-Ticket TAM
function validaCampos(){	
	if(frm_emiteETKT.Login.value == ""){
	  alert("O campo 'Login' é de preenchimento obrigatório");
	  frm_emiteETKT.Login.focus();
	  return false;
	}
	if(frm_emiteETKT.Senha.value == ""){
	  alert("O campo 'Senha' é de preenchimento obrigatório");
	  frm_emiteETKT.Senha.focus();
	  return false;
	}   
    return true;
}    

//Popup
function openWindow(url, name) {
  popupWin = window.open(url,name,"width=320,height=450,top=0,resizable=no,scrollbars=no");
}

//Redirecionamento para a GAP
function submitOpen(){
	frm_emiteETKT.attributes("action").value="logon.asp?atalho=2"
	if(validaCampos()){	
	  frm_emiteETKT.locTAM.value = ""	
	  frm_emiteETKT.submit()
	}
}

//Funcionalidade do Scroll
var n = (document.layers) ? 1:0
var ie = (document.all) ? 1:0
var range = "";
var styleObj = "";
var mutex = 0;

var yplace = 0;
var ymax = 0;
var ymin = 0;
var xplace = 0;
var speed = 4;                         //velocidade do SCROLL
var newsHeight = 260;                  //Altura do CLIP da layer
var newsId = "texto";                   //nome da LAYER que será movimentada
var newsClipId = "textoClipping";       //nome da LAYER de news

if (ie) {
	range = "all.";
	styleObj = ".style";
}

if (n) newsId = newsClipId + ".document." + newsId;
//
function redraw() {

  if (document.ASMBLR.redraw.winWidth != window.innerWidth  || document.ASMBLR.redraw.winHeight != window.innerHeight) {
    document.location = document.location;
  }
}
//
function redrawInit() {

  if (n) {
   document.ASMBLR = new Object;
   document.ASMBLR.redraw = new Object;
   document.ASMBLR.redraw.winWidth = window.innerWidth;
   document.ASMBLR.redraw.winHeight = window.innerHeight;
   window.onresize = redraw();
  }
}
//
function shiftTo(obj, x, y) {
	if (n) {
		obj.moveTo(x,y);
	} 
	else {
		obj.pixelLeft = x;
		obj.pixelTop = y;
	}
}
//
function getObject(obj) {
	var theObj = eval("document." + range + obj + styleObj);
	return theObj;
} 
//
function scrollUp() {
if (mutex == 1){
  var theObj = getObject(newsId);
  if (yplace < ymax) {
      yplace = yplace + speed;
      if (yplace > ymax) yplace = ymax;
	  shiftTo(theObj, xplace, yplace);
    setTimeout("scrollUp()",25);
  }
}
}
// 
function scrollDown() {
if (mutex == 1){
  var theObj = getObject(newsId);
  if (yplace > ymin) {
      yplace = yplace - speed;
      if (yplace < ymin) yplace = ymin;
	  shiftTo(theObj, xplace, yplace);
    setTimeout("scrollDown()",25);
  }
}
}
//
function init() {
redrawInit();
theObj = getObject(newsId);
if (n) ymin = (theObj.clip.height - newsHeight) * -1;
else {
    styleObj = "";
    theObj = getObject(newsId);
    ymin = (theObj.offsetHeight - newsHeight) * -1;
    styleObj = ".style";
}
}
//

//Popup
function pop(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no'
win = window.open(mypage,myname,settings)
}
//


function checa_formulario(cad){ 

if (cad.nome.value == ""){ 
alert("Campo Nome sem informação! Campo Obrigatório."); 
cad.nome.focus(); 
return (false); 
}

if (cad.empresa.value == ""){ 
alert("Campo Empresa sem informação! Campo Obrigatório."); 
cad.empresa.focus(); 
return (false); 
}

if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(cad.email.value))) 
    { 
        alert("Favor informar um email válido.") ;
        document.cad.email.focus() ;
        return (false); 
    } 

return (true); 
} 

