function disable(){ 
  if (event.keyCode==122) { 
     window.alert('Tecla de Função Desabilitada') 
             event.keyCode=0
             return false 
  } 
  //if (event.keyCode==116) { 
     //window.alert('Tecla de Função Desabilitada') 
   //          event.keyCode=0
  //           return false 
  //} 

} 
document.onkeydown=disable; 
/*
function verfonte(){
  if (event.button==2){
	 window.alert('Copyright© 2003-2005 Rotnet\n\n\Contato suporte@rotnet.com.br\n\nClique em Ok, para continuar .')
  }
}
document.onmousedown=verfonte


function aStatus() { 
  window.status = ('SISTEMAS INTEGRADOS DE COMERCIO EXTERIOR')
}; 
document.onmouseover=aStatus


var current = 0

var x = 0

var speed = 100

var speed2 = 5

function initArray(n) {

this.length = n;

for (var i =1; i <= n; i++) {

this[i] = ' '

}

}

typ = new initArray(2) //Número de mensagens

typ[0]="SISTEMAS INFORMATIZADOS PARA COMERCIO EXTERIOR"

typ[1]="SISTEMAS INFORMATIZADOS PARA COMERCIO EXTERIOR"


function typewrite() {

var m = typ[current]

window.status = m.substring(0, x++) + ""

if (x == m.length + 1) {

x = 0

current++

if (current > typ.length - 1) {

current = 0

}

setTimeout("typewrite()", speed2)

}

else {

setTimeout("typewrite()", speed)

}

}

typewrite()
*/
function caixaAlta(obj) { 
obj.value = obj.value.toUpperCase(); 
} 

function select(f)
{
ifield.value = f;
top.close();
return false;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function mOvr(src,clrOver) { 
if (!src.contains(event.fromElement)) { 
src.style.cursor = 'hand'; 
src.bgColor = clrOver; 
} 
} 
function mOut(src,clrIn) { 
if (!src.contains(event.toElement)) { 
src.style.cursor = 'default'; 
src.bgColor = clrIn; 
} 
} 

function mClk(src) { 
if(event.srcElement.tagName=='TD') 
src.children.tags('A')[0].click(); 
} 

function NewWindow(mypage, myname, w, h, status, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',statusbars='+status+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function Redireciona(Pagina) { 
if (Pagina == "") { window.document.location.reload() } 
else { window.document.location.href = Pagina } 
} 

function mascara_data(campo)
{ 
      qtdcaracteres = (campo.value).length; 
      if(qtdcaracteres == 2) 
        campo.value = campo.value + "/"; 
      if(qtdcaracteres == 5) 
        campo.value = campo.value + "/";
	  if(campo.value.length == 10){ 
        verifica_data(campo); 
      } 

} 

function mascara_hora(campo)
{ 
      qtdcaracteres = (campo.value).length; 
      if(qtdcaracteres == 2) 
        campo.value = campo.value + ":"; 
      if(qtdcaracteres == 5) 
        campo.value = campo.value + ":";
	  if(campo.value.length == 10){ 
        verifica_data(campo); 
      } 

} 

function verifica_data(campo)
{ 
      dia = campo.value.substring(0,2); 
      mes = campo.value.substring(3,5); 
      ano = campo.value.substring(6,10); 

	  situacao = ""; 
      // verifica o dia valido para cada mes 
      if ((dia < 01)||(dia < 01 || dia > 30) && (  mes == 04 || mes == 06 || mes == 09 || mes == 11 ) || dia > 31) { 
      situacao = "falsa"; 
      } 
      // verifica se o mes e valido 
      if (mes < 01 || mes > 12 ) { 
      situacao = "falsa"; 
      } 
      if (ano.length < 4) { 
      situacao = "falsa"; 
      } 
      // verifica se e ano bissexto 
      if (mes == 2 && ( dia < 01 || dia > 29 || ( dia > 28 && (parseInt(ano / 4) != ano / 4)))) { 
      situacao = "falsabi"; 
      } 
    
      if (campo.value == "") { 
      situacao = "falsa"; 
      } 
   
      if (situacao == "falsa") { 
      alert("Data inválida!"); 
      campo.focus(); 
      } 
      if (situacao == "falsabi") { 
      alert("Data inválida!\n Este ano não é bissexto"); 
      campo.value = '';
	  campo.focus(); 
      } 

} 




function mascara_crt(campo)
{ 
      qtdcaracteres = (campo.value).length; 
      if(qtdcaracteres == 2) 
        campo.value = campo.value + " "; 
      if(qtdcaracteres == 6) 
        campo.value = campo.value + ".";
	  if(campo.value.length == 10){ 
        campo.value = campo.value + ".";
      } 

} 

function mascara_di(campo)
{ 
      qtdcaracteres = (campo.value).length; 
      if(qtdcaracteres == 2) 
        campo.value = campo.value + "/"; 
      if(qtdcaracteres == 10) 
        campo.value = campo.value + "-";
} 


function FormataReais(fld, milSep, decSep, e) {
	var sep = 0;
	var key = '';
	var i = j = 0;
	var len = len2 = 0;
	var strCheck = '0123456789';
	var aux = aux2 = '';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 13) return true;
	key = String.fromCharCode(whichCode); 
	if (strCheck.indexOf(key) == -1) return false; 
	len = fld.value.length;
	for(i = 0; i < len; i++)
	if ((fld.value.charAt(i) != '0&#39') && (fld.value.charAt(i) != decSep)) break;
	aux = '';
	for(; i < len; i++)
	if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);
	aux += key;
	len = aux.length;
	if (len == 0) fld.value = '';
	if (len == 1) fld.value = ''+ decSep + '' + aux;
	if (len == 2) fld.value = ''+ decSep + aux;
	if (len > 2) {
	aux2 = '';
	for (j = 0, i = len - 3; i >= 0; i--) {
	if (j == 3) {
	aux2 += milSep;
	j = 0;
	}
	aux2 += aux.charAt(i);
	j++;
	}
	fld.value = '';
	len2 = aux2.length;
	for (i = len2 - 1; i >= 0; i--)
	fld.value += aux2.charAt(i);
	fld.value += decSep + aux.substr(len - 2, len);
	}
	return false;
}

function insertValueQuery() {
    var myQuery = document.sqlform.sql_query;
    var myListBox = document.sqlform.dummy;

    if(myListBox.options.length > 0) {
        var chaineAj = "";
        var NbSelect = 0;
        for(var i=0; i<myListBox.options.length; i++) {
            if (myListBox.options[i].selected){
                NbSelect++;
                if (NbSelect > 1)
                    chaineAj += ", ";
                chaineAj += myListBox.options[i].value;
            }
        }

        //IE support
        if (document.selection) {
            myQuery.focus();
            sel = document.selection.createRange();
            sel.text = chaineAj;
            document.sqlform.insert.focus();
        }
        //MOZILLA/NETSCAPE support
        else if (document.sqlform.sql_query.selectionStart || document.sqlform.sql_query.selectionStart == "0") {
            var startPos = document.sqlform.sql_query.selectionStart;
            var endPos = document.sqlform.sql_query.selectionEnd;
            var chaineSql = document.sqlform.sql_query.value;

            myQuery.value = chaineSql.substring(0, startPos) + chaineAj + chaineSql.substring(endPos, chaineSql.length);
        } else {
            myQuery.value += chaineAj;
        }
    }
}


function mOvr(src,clrOver) { 
if (!src.contains(event.fromElement)) { 
src.style.cursor = 'hand'; 
src.bgColor = clrOver; 
} 
} 
function mOut(src,clrIn) { 
if (!src.contains(event.toElement)) { 
src.style.cursor = 'default'; 
src.bgColor = clrIn; 
} 
} 
function mClk(src) { 
if(event.srcElement.tagName=='TD') 
src.children.tags('A')[0].click(); 
} 
