/* function IniciaBotao(ImgPath, IncPath, css) 
   Função para gerar botões ativos
   ================================================================
   Parâmetros: 	ImgPath - Caminho ou pasta onde estarão as imagens
				IncPath - Caminho ou pasta onde estarão os includes
				css	  	- Nome do respectivo arquivo de folha de estilo
   Adaptado por: Josafá Alves Beserra
		  Data: Fortaleza, 08 de setembro de 2006
=================================================================*/
function IniciaBotao(ImgPath, IncPath, css) {
  //Setando as variáveis  
  ImagesPath = ImgPath;
  IncludesPath = IncPath;
  cssFile = css;
	
  //Verificando qual o tipo de browser
  var ua = navigator.userAgent.toLowerCase();
  isIE = ((ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1)); 
  if (isIE) {
    document.onmouseover = raiseButton;
    document.onmouseout  = normalButton;
    document.onmousedown = lowerButton;
    document.onmouseup   = raiseButton;
  }
  document.writeln('<style type="text/css">@import "' + IncludesPath + 'Botao.css";</style>');
}

function raiseButton(e) {
  //IE-Only Function
  //Acrescentado para proteger o pressionamento do botão direito do mouse
  if (document.all) {
    if (event.button == 2) {
      //alert('Uso não permitido.');
      return false;
    }
  }
  if (document.layers) {
    if (e.which == 3) {
      //alert('Uso não permitido.');
      return false;
    }
  }
  //Até aqui ============================================================
  var el = window.event.srcElement;
  if (el != null){className = el.className;}else{className = '';}
  if (className == 'BotaoImage' || className == 'BotaoImageLowered') {
    el.className = 'BotaoImageRaised';
  }
  if (className == 'BotaoNeutro' || className == 'BotaoNeutroLowered') {
    el.className = 'BotaoNeutroRaised';
  }
  if (className == 'BotaoRealce' || className == 'BotaoRealceLowered') {
    el.className = 'BotaoRealceRaised';
  }
}

function normalButton(e) {
  //IE-Only Function
  //Acrescentado para proteger o pressionamento do botão direito do mouse
  if (document.all) {
    if (event.button == 2) {
      //alert('Uso não permitido.');
        return false;
    }
  }
  if (document.layers) {
    if (e.which == 3) {
      //alert('Uso não permitido.');
      return false;
    }
  }
  //Até aqui ============================================================
  var el = window.event.srcElement;
  if (el != null){className = el.className;}else{className = '';}
  if (className == 'BotaoImageRaised' || className == 'BotaoImageLowered') {
    el.className = 'BotaoImage';
  }
  if (className == 'BotaoNeutroRaised' || className == 'BotaoNeutroLowered') {
    el.className = 'BotaoNeutro';
  }
  if (className == 'BotaoRealceRaised' || className == 'BotaoRealceLowered') {
    el.className = 'BotaoRealce';
  }
}

function lowerButton(e) {
  //IE-Only Function
  //Acrescentado para proteger o pressionamento do botão direito do mouse
  if (document.all) {
    if (event.button == 2) {
      //alert('Uso não permitido.');
        return false;
    }
  }
  if (document.layers) {
    if (e.which == 3) {
      //alert('Uso não permitido.');
      return false;
    }
  }
  //Até aqui ============================================================
  var el = window.event.srcElement;
  if (el != null){className = el.className;}else{className = '';}
  if (className == 'BotaoImage' || className == 'BotaoImageRaised') {
    el.className = 'BotaoImageLowered';
  }
  if (className == 'BotaoNeutro' || className == 'BotaoNeutroRaised') {
    el.className = 'BotaoNeutroLowered';
  }
  if (className == 'BotaoRealce' || className == 'BotaoRealceRaised') {
    el.className = 'BotaoRealceLowered';
  }
}

