$(document).ready(function() {
//$('a[rel*=lightbox]').lightBox(); // Select all links that contains lightbox in the attribute rel
//atualizajs();
});
function cadContato() {
if ($('#con_nome').val()=='') {
alert("Preencha seu nome");
$('#con_nome').focus();
return false;
}
if ($('#con_telefone').val()=='') {
alert("Preencha seu telefone com DDD");
$('#con_telefone').focus();
return false;
}
if ($('#con_email').val()=='') {
alert("Preencha seu email para contato");
$('#con_email').focus();
return false;
}
var dadosform = $('form#formcontato').serialize();
$('#btn_contato').prop('disabled',true);
$('#btn_contato').html('Aguarde... enviando!');
$.post('/_cadcontato.php',dadosform, function(r){ $("#contato_resultado").html(r); });
return true;
}
function cadTelefone() {
if ($('#tel_telefone').val()=='') {
alert("Preencha seu telefone com DDD");
$('#tel_telefone').focus();
return false;
}
if ($('#tel_nome').val()=='') {
alert("Preencha seu nome");
$('#tel_nome').focus();
return false;
}
var dadosform = $('form#formtelefone').serialize();
$('#btn_telefone').prop('disabled',true);
$('#btn_telefone').html('Aguarde... enviando!');
$.post('/_cadtelefone.php',dadosform, function(r){ $("#telefone_resultado").html(r); });
return true;
}
function enviabuscadica(txt) {
if (txt.length<3) {
alert("Preencha a busca corretamente");
$('#buscadica').focus();
} else {
var url = '/blog_1__'+txt+'/pg.html';
document.location.href=url;
}
return false;
}
function postaFormPainel(form,pagina,div) {
var dadosform = $('form#'+form).serialize();
$.post(pagina,dadosform, function(r){ $("#"+div).html(r); });
return true;
}
function enviaForm(form,e) {
var scan = getKey(e);
if (scan == 13) {
$('#'+form).submit();
}
return true;
}
function CheckMail(str){ var testresults; var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; if (filter.test(str)) {testresults=false} else {testresults=true} return (testresults)}
function SetF(id, vv) {
try { $(id)[0].type; }
catch(e) {return}
if(!$(id)[0].type) {
var type = $("input[@name="+id.replace("#","")+"]")[0].type;
var o = $("input[@name="+id.replace("#","")+"]");
} else {
var type = $(id)[0].type;
var o = $(id);
}
if(typeof vv == "string" || typeof vv == "number"){
v = [];
v.push(vv);
}
else v = vv;
switch(type) {
case "radio":
case "checkbox":
case "select-multiple":
case "select-one":
o.val(v);
break;
default:
o.val(v.join(','));
}
}
function UnSetF(slist) {
var l = slist.split(',');
for(var i=0; i < l.length; i++) { SetF(l[i],''); }
}
function checap(idcheck) {
if($('#'+idcheck).is(":checked")==false) { $('#'+idcheck).attr('checked',true); }
// if(!$(idcheck).checked){ $(idcheck).checked = "checked"; }
}
function getAJAX(url,parametros,localdiv) {
$("#"+localdiv).html('
');
$.get(url,parametros, function(r){ $("#"+localdiv).html(r); });
}
function getAjaxc(url,parametro,localdiv) {
$.get(url,parametro, function(r){ $("#"+localdiv).html(r); });
}
function checa_tamanho(obj, tamanho) {
if (obj.value.length != tamanho && obj.value != '') {
alert('O campo deve ter '+tamanho+' caracteres');
return false
} else {
return true;
}
}
function checa_tamanho_varia(obj, tamanho1,tamanho2) {
if ((obj.value.length < tamanho1 || obj.value.length > tamanho2) && obj.value != '') {
alert('O campo deve ter entre '+tamanho1+' e '+tamanho2+' de numeros');
return false
} else {
return true;
}
}
function retValChecked(obj) {
if (obj.checked){
return obj.value;
} else {
return "";
}
}
function getPageSize(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}
//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated. All rights reserved.
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function montaFlash(swf, width, height, id, wmode, cache) {
noCache = cache || cache == undefined ? "" : "?" + new Date();
monta_swf = "";
monta_swf += "";
document.write(monta_swf);
}
function apenasNumero(objCampo,e) {
var scan = getKey(e);
var tecla = String.fromCharCode(scan);
var mask = "0123456789"
if (scan == 13 || scan == 8 || scan == 0) return true;
if (mask.indexOf(tecla) == -1) {
return false;
}
return true;
}
function apenasValor(objCampo,e) {
var scan = getKey(e);
var tecla = String.fromCharCode(scan);
var mask = "0123456789."
if (scan == 13 || scan == 8 || scan == 0) return true;
if (mask.indexOf(tecla) == -1) {
return false;
}
return true;
}
function getKey(e)
{
return (window.event) ? event.keyCode : e.which
}
function popWin(URL,NAME,WIDTH,HEIGHT,RESIZE,SCROLL) {
winId = window.open(URL, "popUp","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,screenX=0,screenY=0,left=0,top=0,width="+WIDTH+",height="+HEIGHT);
// window.location = URL;
/*
winId = window.open(URL,NAME,'width='+WIDTH+',height='+HEIGHT+',resizable='+RESIZE+',scrollbars='+SCROLL+',menubar=no,toolbar=no,location=no,directories=no,status=no');
*/
var clientWidth = screen.availWidth;
var clientHeight = screen.availHeight;
var xPos = (clientWidth - WIDTH)/2;
var yPos = (clientHeight - HEIGHT)/2;
winId.moveTo(xPos,yPos);
}