/**
 *  Biblioteca de Tratamento de Eventos do Mouse
 */


//  ============================
//  Tratamento do evento onClick
//  ============================
function mouse_Click(evt)
{
  var objID;
  var objectID = getObjEvento(evt);
alert('OK.');
  switch(objectID)
  {
    case 'bt1':
      objID_1 = findDOM( 'userLogin', 0 );
      objID_2 = findDOM( 'userPass', 0 );
      
      if( objID_1.value == '' || objID_2.value == '' )
      {
        alert('Dados Inválidos');
      }else
      {
        txt = objID_1.value + ' :: ' + objID_2.value;
        Mensage.validUser(txt);
//        alert('bt1: '+txt);
      }// End
      
      break;
    case 'cad1':
    case 'cad2':
      objID = findDOM( 'iFrame1', 0 );
      objID.style.visibility="visible";

      objID.style.top  = winX;
      objID.style.left = winY;

      win_1.location.href="fazerCadastro.php"
      objID = findDOM( 'iFrame_1_titulo', 0 );
      objID.innerHTML="Cadastro";
      break;
      
    case 'help1':
      objID = findDOM( 'iFrame1', 0 );
      objID.style.visibility="visible";
      
      objID.style.top  = winX;
      objID.style.left = winY;

      win_1.location.href="help_RAD.php"
      objID = findDOM( 'iFrame_1_titulo', 0 );
      objID.innerHTML="RAD";
      break;
    case 'help2':
      objID = findDOM( 'iFrame1', 0 );
      objID.style.visibility="visible";

      objID.style.top  = winX;
      objID.style.left = winY;

      win_1.location.href="help_WEB.php"
      objID = findDOM( 'iFrame_1_titulo', 0 );
      objID.innerHTML="Arquitetura WEB";
      break;
    case 'help3':
      objID = findDOM( 'iFrame1', 0 );
      objID.style.visibility="visible";

      objID.style.top  = winX;
      objID.style.left = winY;

      win_1.location.href="help_PHP.php"
      objID = findDOM( 'iFrame_1_titulo', 0 );
      objID.innerHTML="Linguagem PHP";
      break;
    case 'help4':
      objID = findDOM( 'iFrame1', 0 );
      objID.style.visibility="visible";

      objID.style.top  = winX;
      objID.style.left = winY;

      win_1.location.href="help_DHTML.php"
      objID = findDOM( 'iFrame_1_titulo', 0 );
      objID.innerHTML="DHTML";
      break;

    case 'item1':
      objID = findDOM( 'iFrame1', 0 );
      objID.style.visibility="visible";

      objID.style.top  = winX;
      objID.style.left = winY;

      win_1.location.href="produtos.php"
      objID = findDOM( 'iFrame_1_titulo', 0 );
      objID.innerHTML="Produtos";
      break;
    case 'item2':
      objID = findDOM( 'iFrame1', 0 );
      objID.style.visibility="visible";

      objID.style.top  = winX;
      objID.style.left = winY;

      win_1.location.href="tutoriais.php";
      objID = findDOM( 'iFrame_1_titulo', 0 );
      objID.innerHTML="Tutoriais";
      break;
    case 'item3':
      objID = findDOM( 'iFrame1', 0 );
      objID.style.visibility="visible";

      objID.style.top  = winX;
      objID.style.left = winY;

      win_1.location.href="downloads.php"
      objID = findDOM( 'iFrame_1_titulo', 0 );
      objID.innerHTML="Downloads";
      break;
    case 'item4':
      objID = findDOM( 'iFrame1', 0 );
      objID.style.visibility="visible";

      objID.style.top  = winX;
      objID.style.left = winY;

      win_1.location.href="roadmap.php"
      objID = findDOM( 'iFrame_1_titulo', 0 );
      objID.innerHTML="RoadMap (planejamento)";
      break;
    case 'item5':
      objID = findDOM( 'iFrame1', 0 );
      objID.style.visibility="visible";

      objID.style.top  = winX;
      objID.style.left = winY;

      win_1.location.href="faleConosco.php"
      objID = findDOM( 'iFrame_1_titulo', 0 );
      objID.innerHTML="Fale Conosco";
      break;
      


    case 'iFrame_1_fechar':
      objID = findDOM( 'iFrame1', 0 );
      objID.style.visibility="hidden";

      win_1.location.href="emBranco.html"
      objMovDOM = null;
//      posX      = null;
//      posY      = null;
      break;
  }
}// End function mouse_Click()


//  ============================
//  Tratamento do evento onOver
//  ============================
function mouse_Over(evt)
{
  var objID;
  var objectID = getObjEvento(evt);
  
  objID = findDOM( objectID, 0 );
  switch(objectID)
  {
    case 'help1':
    case 'help2':
    case 'help3':
    case 'help4':
      objID.style.cursor='pointer';
      break;

    case 'cad1':
    case 'cad2':
      objID.style.cursor='pointer';
      break;
    case 'item1':
      objID.style.color="#004080";
      objID.style.cursor='pointer';
      break;
    case 'item2':
      objID.style.color="#004080";
      objID.style.cursor='pointer';
      break;
    case 'item3':
      objID.style.color="#004080";
      objID.style.cursor='pointer';
      break;
    case 'item4':
      objID.style.color="#004080";
      objID.style.cursor='pointer';
      break;
    case 'item5':
      objID.style.color="#004080";
      objID.style.cursor='pointer';
      break;

    case 'iFrame_1_titulo':
      objID.style.cursor='move';
      break;
  }
}// End function mouse_Over()


//  ===============================
//  Tratamento do evento onMouseOut
//  ===============================
function mouse_Out(evt)
{
  var objectID = getObjEvento(evt);
  var objID = findDOM( objectID, 0 );
  
  switch(objectID)
  {
    case 'cad1':
    case 'cad2':
      break;
    case 'item1':
      objID.style.color="#FFFFFF";
      break;
    case 'item2':
      objID.style.color="#FFFFFF";
      break;
    case 'item3':
      objID.style.color="#FFFFFF";
      break;
    case 'item4':
      objID.style.color="#FFFFFF";
      break;
    case 'item5':
      objID.style.color="#FFFFFF";
      break;
    case 'iFrame_1_titulo':
      objMovDOM   = null;

//      posX = null;
//      posY = null;
      event.cancelBubble= true;
      break;
  }
  
}// End function mouse_Out()


//  =============================
//  Tratamento do evento DblClick
//  =============================
function mouse_DblClick()
{
  var objectID = getObjEvento(evt);

  switch(objectID)
  {
  }
  event.returnValue= false;
}// End function mouse_DblClick()


//  ==============================
//  Tratamento do evento MouseDown
//  ==============================
function mouse_Down(evt)
{
  var objectID = getObjEvento(evt);

  switch(objectID)
  {
    case 'iFrame_1_titulo':
      objMovDOM   = findDOM( 'iFrame1', 0 );
      
      posX = event.x;
      posY = event.y;
      break;
  }// End

//  event.returnValue= false;
}// End function mouse_Down()


//  ==============================
//  Tratamento do evento MouseUP
//  ==============================
function mouse_Up(evt)
{
  objMovDOM = null;
  posX      = null;
  posY      = null;
  
  objectID = getObjEvento(evt);
  switch(objectID)
  {
    case '':
      break;
  }// End switch(objectID)
}// End function mouse_Up()


//  ==============================
//  Tratamento do evento MouseMove
//  ==============================
function mouse_Move(evt)
{
  var xAtual = 0;
  var yAtual = 0;

  if(objMovDOM)
  {
    xAtual = objMovDOM.style.left;
    yAtual = objMovDOM.style.top;
//alert('xAtual: ' + xAtual + ' yAtual: '+ yAtual);
    
    if(xAtual.indexOf("px"))
      xAtual = xAtual.substr(0,xAtual.indexOf('px'));
    if(yAtual.indexOf("px"))
      yAtual = yAtual.substr(0,yAtual.indexOf('px'));

    incX = (evt.x - posX) + 1;
    incY = (evt.y - posY) + 1;
    
    newX = parseInt(xAtual) + parseInt(incX);
    newY = parseInt(yAtual) + parseInt(incY);
//alert('evtY:'+evt.y+' posY: '+posY+' incY: '+incY + ' atuY: '+yAtual+' newY: '+newY );

//window.status='atual: '+xAtual+' incX='+incX + ' nova: ' + newX;
window.status='atual: '+yAtual+'   incY='+incY + '   nova: ' + newY;

    if(newX > 0)
    {
      objMovDOM.style.left = newX+'px';
      posX = posX + incX;
    }
    if(newY > 0)
    {
      objMovDOM.style.top  = newY+'px';
      posY = posY + incY;
    }
    
    event.cancelBubble = true;

  }//End if(objMovDOM)

  
  event.returnValue= false;
}// End function mouse_Move()






