(function ($) {$.fn.shiftclick = function (fn) {return this[fn ? "bind" : "trigger"]("shiftclick", fn);};$.event.special.shiftclick = {setup:function () {$.event.add(this, extendedClickEvents, extendedClickHandler, {});}, teardown:function () {$.event.remove(this, extendedClickEvents, extendedClickHandler);}};var extendedClickEvents = "click";function extendedClickHandler(event) {if (event.shiftKey) {event.type = "shiftclick";return false;}return true;}})(jQuery);if (jQuery) {(function () {$.extend($.fn, {noContext:function () {$(this).each(function () {$(this)[0].oncontextmenu = function () {return false;};});return $(this);}});})(jQuery);}

function caracInvalidos(pFrm,idi){
var i;
for(i=0;i<pFrm.length;i++){
if (pFrm[i].name.substr(0,7) != 'cptexto'){
if(pFrm[i].value.indexOf("\"")!=-1 || pFrm[i].value.indexOf("'")!=-1 ||
pFrm[i].value.indexOf("<")!=-1 || pFrm[i].value.indexOf(">")!=-1){
if (idi == undefined)
alert("Por favor, não use aspas duplas, aspas simples ou sinais de menor ou maior na caixa de texto.");
else alert(idi);
return false;}}}
return true;}
function validaTexto(pCmp,pTxt,pFoco){
if(Trim(pCmp.value) == ""){
alert(pTxt);
pCmp.focus();
return false;}
return true;}
function validaEmail(pCmp,pTxt){
ValidRegExp = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$/;
if(!ValidRegExp.test(pCmp.value)){
alert(pTxt);
pCmp.focus();
return false;}
return true;}
function validaTam(pCmp,pTam,pTxt){
if (pCmp.value.length > pTam){
alert("Máximo de " + pTam + " caracteres para " + pTxt);
pCmp.focus();
return false;}
return true;}
function validaCNPJ(pCNPJ,pTxt) {
var tCNPJ = pCNPJ.value;
tCNPJ = tCNPJ.replace(".","");
tCNPJ = tCNPJ.replace(".","");
tCNPJ = tCNPJ.replace("-","");
tCNPJ = tCNPJ.replace("/","");
if (tCNPJ.length == 0) return true;
var a = [];
var b = new Number;
var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
for (i=0; i<12; i++){
a[i] = tCNPJ.charAt(i);
b += a[i] * c[i+1];}
if ((x = b % 11) < 2) { a[12] = 0 } else { a[12] = 11-x }
b = 0;
for (y=0; y<13; y++){
b += (a[y] * c[y]);}
if ((x = b % 11) < 2) { a[13] = 0; } else { a[13] = 11-x; }
b = null;
delete b;
c = null;
delete c;
x = null;
delete x;
if ((tCNPJ.charAt(12) != a[12]) || (tCNPJ.charAt(13) != a[13])){
a = null;
delete a;
alert(pTxt);
pCNPJ.focus();
return false;}
else{
a = null;
delete a;
return true;}}
function validaCPF(pCPF,pTxt){
var tCPF = pCPF.value;
tCPF = tCPF.replace(".","");
tCPF = tCPF.replace(".","");
tCPF = tCPF.replace("-","");
tCPF = tCPF.replace("/","");
if (tCPF.length == 0) return true;
if(tCPF == "00000000000" || tCPF == "11111111111" || tCPF == "22222222222" ||
	 tCPF == "33333333333" || tCPF == "44444444444" || tCPF == "55555555555" ||
	 tCPF == "66666666666" || tCPF == "77777777777" || tCPF == "88888888888" || tCPF == "99999999999"){
alert(pTxt);
pCPF.focus();
return false;}
soma = 0;
for(i = 0; i < 9; i++)
soma += parseInt(tCPF.charAt(i)) * (10 - i);
resto = 11 - (soma % 11);
if(resto == 10 || resto == 11)
resto = 0;
if(resto != parseInt(tCPF.charAt(9))){
alert(pTxt);
pCPF.focus();
return false;}
soma = 0;
for(i = 0; i < 10; i ++)
soma += parseInt(tCPF.charAt(i)) * (11 - i);
resto = 11 - (soma % 11);
if(resto == 10 || resto == 11)
resto = 0;
if(resto != parseInt(tCPF.charAt(10))){
alert(pTxt);
pCPF.focus();
return false;}
return true;}
function validaCombo(pCmp,pTxt){
if (pCmp.value == 0){
alert(pTxt);
pCmp.focus();
return false;}
return true;}
function validaMin(pCmp,pTam,pTxt){
if (pCmp.value.length < pTam){
alert(pTxt);
pCmp.focus();
return false;}
return true;}
function Trim(str){return str.replace(/^\s+|\s+$/g,"");}