function fav(){
var title = "Vivere. Viagens com estilo.";
var url = "http://www.vivere.com.br";
if (window.sidebar){
window.sidebar.addPanel(title, url,"");}
else if( window.external ){
window.external.AddFavorite( url, title);}
else if(window.opera && window.print){
return true;}}
function caracInvalidos(frm){
var i;
for(i=0;i<frm.length;i++){
if (frm[i].name.substr(0,2) != 'ta'){
if(frm[i].value.indexOf("\"")!=-1 || frm[i].value.indexOf("'")!=-1 ||
frm[i].value.indexOf("<")!=-1 || frm[i].value.indexOf(">")!=-1){
alert("Por favor, não use aspas duplas, aspas simples ou sinais de menor ou maior na caixa de texto.");
return false;}}}
return true;}
function validaTexto(pCmp,pTxt,pAba,pFoco){
if(pCmp.value == ""){
alert(pTxt);
if(pAba != undefined)	$('#' + pAba).click();
if(pFoco == undefined) 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 validaCNPJ(pCNPJ,pTxt) {
var tCNPJ = pCNPJ.value;
tCNPJ = tCNPJ.replace(".","");
tCNPJ = tCNPJ.replace(".","");
tCNPJ = tCNPJ.replace("-","");
tCNPJ = tCNPJ.replace("/","");
if (tCNPJ.length == 0){
alert(pTxt);
pCNPJ.focus();
return false;}
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 || 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 validaData(pCmp,pTxt){
ValidRegExp = /^([0]?[1-9]|[1|2][0-9]|[3][0|1])\/([0]?[1-9]|[1][0-2])\/([0-9]{4}|[0-9]{2})$/;
if(!ValidRegExp.test(pCmp.value)){
alert(pTxt);
pCmp.focus();
return false;}
return true;}
function popup(url,ww,hh){
var left = (screen.width - ww)/2;
var top = (screen.height - hh)/2;
newwin=window.open(url,'hotro', 'directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width='+ww+',height='+hh+',top='+(top-20)+',left='+left);
if (window.focus) {newwin.focus()}
return false;}