//--- 1 - Abrir janela poup-up simples -----------------------------//

// Argumento 1 - Ex: teste.html
// Argumento 2 - Ex: janela1
// Argumento 3 - EX: toolbar=no,location=no,
//					 status=no,menubar=no,scrollbars=no,
//					 resizable=no,width=350,height=250,left=80,top=80
// Argumento 4 - Ex: 1,0

function abre(site,nome,desc,esconde){
	window.open(site,nome,desc);
	if(esconde==1){
		window.blur();
		window.focus();	
	}
}
//--- Fim 1 --------------------------------------------------------//
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
//--- 2 - Abrir janela poup-up centralizada ------------------------//

// Argumento 1 - Ex: teste.html
// Argumento 2 - Ex: janela1
// Argumento 3 - Ex: 300
// Argumento 4 - Ex: 500
// Argumento 5 - Ex: yes ,no
// Argumento 6 - Ex: yes ,no

function abre_centro(site, nome, w, h, scroll, tam){

	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+tam+'';
	win = window.open(site, nome, winprops)
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
		return win;

}
//--- Fim 2 --------------------------------------------------------//
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
//--- 3 - Criar Título Personalizado do site -----------------------//

function titulo_dinamico(a,b,c){
	
	
	var a='Texto1';
	var b='Texto2';
	var c='Texto3';
	
	var t = new Date();
 	s = t.getSeconds();
 	
 	if (s == 10) {
  		document.title = a;}
 	else if (s == 20) {
 		document.title = b;}
 	else if (s == 30) {
 		document.title = c;}
 	else if (s == 40) {
 		document.title = a;}
 	else if (s == 50) {
		document.title = b;}
 	else if (s == 00) {
 		document.title = c;}
 											
 	setTimeout("titulo_dinamico()", 10);
}

//--- Fim 3 --------------------------------------------------------//
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
//--- 4 - Mascarar campos ------------------------------------------//
/*
Itens de Mascara:
	Numérico: "9"
	AlfaNumérico: "#"

EX: onkeydown="mascara(this,event,'99/99/9999 ## 99:99');"> 

*/

function mascara(Campo,teclapres,mascara){ 
    
    var idnumer = "9";
    var idalpha = "#";
	var strtext = Campo.value;
    var tamtext = strtext.length;
    var tammask = mascara.length;
    var arrmask = new Array(tammask);
    
    for (var i = 0 ; i < tammask; i++){ 
        arrmask[i] = mascara.slice(i,i+1) 
    }
    	
    if(tammask < tamtext+1 && (teclapres.keyCode != 8 && teclapres.keyCode != 9 && teclapres.keyCode != 13 && teclapres.keyCode != 37 && teclapres.keyCode != 38 && teclapres.keyCode != 39 && teclapres.keyCode != 40 && teclapres.keyCode != 46)){
    	window.event.returnValue = false;
    }
  
    if(arrmask[tamtext] == idnumer){ 
        if ((teclapres.keyCode >= 37 && teclapres.keyCode <= 40)||(teclapres.keyCode >= 48 && teclapres.keyCode <= 57)||(teclapres.keyCode >= 96 && teclapres.keyCode <= 105)||(teclapres.keyCode == 8)||(teclapres.keyCode == 9) ||(teclapres.keyCode == 46) ||(teclapres.keyCode == 13)){
            verificarMascara(Campo,arrmask[tamtext],teclapres.keyCode,strtext);
        }else{
            window.event.returnValue = false;
        } 
    } 
    
    if(arrmask[tamtext] == idalpha){
    	verificarMascara(Campo,arrmask[tamtext],teclapres.keyCode,strtext);
    }
    
    if(arrmask[tamtext+1]!=idnumer || arrmask[tamtext+1]!=idalpha){
    	verificarMascara(Campo,arrmask[tamtext],teclapres.keyCode,strtext);
    }
}

// Função Auxiliaar de mascara

function verificarMascara(Campo,arrpos,teclapres,strtext){ 
    if (((arrpos == "(") || (arrpos == ")") || (arrpos == "/") || (arrpos == ".") || (arrpos == ",") || (arrpos == ":") || (arrpos == " ") || (arrpos == "-")) && !(teclapres == 8)){
        separador = arrpos;
        masktext = strtext + separador;
        Campo.value = masktext;
    }
}
//--- Fim 4 --------------------------------------------------------//
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
//--- 5 - Mascarar campos ------------------------------------------//

