// validações dos formularios ---

function checkMail(mail){
    var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
    if(typeof(mail) == "string"){
        if(er.test(mail)){ return true; }
    }else if(typeof(mail) == "object"){
        if(er.test(mail.value)){ 
                    return true; 
                }
    }else{
        return false;
        }
}

function valEmail(vl){
	if ((! checkMail(vl)) && (vl.value != "")){
		alert('Email incorreto!');
		vl.focus();
	}	
}

function Numeric(evt){
	var key = evt.keyCode; 
	
	if ((key >= 48) && (key < 58)){
		return true;
	}
	else{
		evt.keyCode = null;
		return false;
	}
}

function notNumeric(evt){
	var key = evt.keyCode; 
	
	if ((key < 48) && (key >= 58)){
		return true;
	}
	else{
		evt.keyCode = null;
		return false;
	}	
}

function maskTel(vl){
	if (vl.value.length == 4 ){
		vl.value +=	'-';
	} 	
}

function Abre_Janela(url, width, height, nome, scrollbars) {
	v_width = screen.width;
	v_height = screen.height;
	var top; var left;
	top = ( (v_height/2) - (height/1.7) )
	left = ( (v_width/2) - (width/2) )
	window.open(url, nome,'width='+width+',height='+height+',scrollbars='+scrollbars+',toolbar=no,location=no,status=no,menubar=no,resizable=no,left='+left+',top='+top);
}