$j = jQuery; /* Loading */ $j(window).load(function() { $j("#loading_site").hide(); $j("#site-content").show(); }); /* ======= */ /* Lightbox */ $j(document).ready(function () { $j('a[rel="lightbox"]').click(function() { open_lightbox($j(this).attr('href')); return false; }); $j("#lightbox .btn_close, #lightbox .shadow").click( function() { $j("#lightbox").stop().animate({ opacity: "0" }, 200, function() { /*$j(".loading_lightbox1").animate({ width: "230px", height: "110px", marginTop: "130px", marginLeft: "100px" }, 0);*/ $j("#lightbox").stop().hide().css("opacity","1"); }); return false; }); }); open_lightbox = function(img) { $j("html, body").stop().animate({ scrollTop: 0 }, 0); $j('#lightbox .bg img').attr('src', img); //$j("#lightbox .bg").hide(); $j("#lightbox").fadeIn(500); $j("#lightbox .bg").hide(); $j('#lightbox .bg img').load( function() { $j("#lightbox .bg").show(); var bg_width = $j('#lightbox .bg').width(), bg_height = $j('#lightbox .bg').height(); bg_width = '-' + bg_width / 2 + 'px'; bg_height = '-' + bg_height / 2 + 'px'; $j('#lightbox .bg').css('marginLeft', bg_width).css('marginTop', bg_height); }) /*$j("#videos .list_video").hide(); $j("#videos .btn_close").hide(); $j(".loading_lightbox1").stop().animate({ width: "500px", height: "380px", marginTop: "30px", marginLeft: "0" }, 1500, "easeOutExpo", function() { $j(".list_video").hide(); $j(".list_video.list_video" + video).show(); $j("#videos .list_video" + video + ", #videos .btn_close").stop().fadeIn(200); if (document.createElement("video").canPlayType && document.createElement("video").canPlayType("video/mp4").replace(/no/, "")) var canPlay = true; else var canPlay = false; if (canPlay) document.getElementById("video" + video).play(); });*/ } /* ======== */ /* Nivo Slider */ $j(window).load(function() { $j('#slider').nivoSlider({ effect: 'boxRain', // Specify sets like: 'fold,fade,sliceDown' animSpeed: 800, // Slide transition speed pauseTime: 5000, // How long each slide will show startSlide: 0, // Set starting Slide (0 index) directionNav: true, // Next & Prev navigation directionNavHide: true, // Only show on hover controlNavThumbs: false, // Use thumbnails for Control Nav controlNavThumbsFromRel: false, // Use image rel for thumbs controlNavThumbsSearch: '.jpg', // Replace this with... controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src keyboardNav: true, // Use left & right arrows manualAdvance: false, // Force manual transitions prevText: ' ', // Prev directionNav text nextText: ' ' // Next directionNav text }); }); /* =========== */ /*$j(document).ready(function () { var slider = $j('#slider'); $j('.btns_home .btn_aplle').click(function() { slider.data('nivoslider').slideTo(0); return false; }); $j('.btns_home .btn_windows_pc').click(function() { slider.data('nivoslider').slideTo(1); return false; }); $j('.btns_home .btn_softwares').click(function() { slider.data('nivoslider').slideTo(2); return false; }); $j('.btns_home .btn_suporte_tecnico').click(function() { slider.data('nivoslider').slideTo(3); return false; }); }); /* Function form mensagem */ envia_form_mensagem_mensagem = "Enviando mensagem..."; envia_form_mensagem = function () { if ($j("#answer_mensagem").html() != envia_form_mensagem_mensagem) { $j.ajax( { type: "POST", url: "mensagem_post.php", data: $j("#contato_form").serialize() + "&send=enviar", dataType: "html", beforeSend: function () { $j("#answer_mensagem").html(envia_form_mensagem_mensagem); }, success: function (HTML) { $j("#answer_mensagem").html(HTML); } } ); } else { alert("Aguarde enquanto a mensagem está sendo enviada."); } } /* ============================== */ /* Function form orcamento */ envia_form_orcamento_indicado_mensagem = envia_form_orcamento_normal_mensagem = "Enviando orçamento..."; envia_form_orcamento_indicado = function () { if ($j("#answer_orcamento_indicado").html() != envia_form_mensagem_mensagem) { $j.ajax({ type: "POST", url: "orcamento_post.php", data: $j("#orcamento_indicado_form").serialize() + "&orcamento=indicado", dataType: "html", error: function () { alert('Erro!'); }, beforeSend: function () { $j("#answer_orcamento_indicado").html(envia_form_orcamento_indicado_mensagem); }, success: function (HTML) { $j("#answer_orcamento_indicado").html(HTML); } } ); } else { alert("Aguarde enquanto o orçamento está sendo enviado."); } } envia_form_orcamento_normal = function () { if ($j("#answer_orcamento_normal").html() != envia_form_mensagem_mensagem) { $j.ajax({ type: "POST", url: "orcamento_post.php", data: $j("#orcamento_normal_form").serialize() + "&orcamento=normal", dataType: "html", error: function () { alert('Erro!'); }, beforeSend: function () { $j("#answer_orcamento_normal").html(envia_form_orcamento_normal_mensagem); }, success: function (HTML) { $j("#answer_orcamento_normal").html(HTML); } } ); } else { alert("Aguarde enquanto o orçamento está sendo enviado."); } } /* ============================== */ /* Contact scroll effect */ $j(document).ready(function () { $j("#header #menu li a.btn8, #footer .box.right a.contato").click( function() { $j("html, body").animate({ scrollTop: $j("#footer .box.left").position().top }, 2000, "easeOutExpo"); return false; }); }); /* ============================ */ /* Gerencia orcamentos */ orcamento_gerencia = function (acao, id_produto, quantidade) { try { orcamento_gerencia_XMLHTTP.abort(); } catch (e) {} orcamento_gerencia_XMLHTTP = $j.ajax({ type: "POST", url: "orcamento_gerencia.php", data: "&acao=" + acao + "&id_produto=" + id_produto + "&quantidade=" + quantidade, dataType: "html", beforeSend: function () { if (acao == 'clean') $j('#orcamento .box1 .bar1 .column1.align2 a, #orcamento .box1 .bar1.align2').hide(); else if (acao == 'remove') $j('#orcamento .box1 .bar1.orcamento_' + id_produto + ' .column1.align2 a').hide(); }, error: function () { alert("Error!"); }, success: function (HTML) { if (acao == 'clean') { $j('#orcamento .tem_orcamento').fadeOut(800); $j('#orcamento_indicado_form').fadeIn(800); } else if (acao == 'remove') { $j('.orcamento_' + id_produto).fadeOut(800); if (HTML.length > 0) { if (HTML == 0) { $j('#orcamento .tem_orcamento').fadeOut(800); $j('#orcamento_indicado_form').fadeIn(800); } else $j('#orcamento .box1 .bar1.align2 .column1.align1 p').html(HTML); } } else if (HTML.length > 0) alert(HTML); if ((quantidade > 0 /*&& isFinite(quantidade)*/) || acao == 'clean' || acao == 'remove') update_qtd_orcamentos(acao); //if (acao == 'add') update_qtd_orcamentos(acao); //$j('#orcamento .box1 .bar1.align2 .column1.align1 p').html(''); } } ); } orcamento_gerencia_timeout = null; orcamento_gerencia_timeout_set = function (acao, id_produto, quantidade) { if (quantidade != 'qtd.' && quantidade > 0 && isFinite(quantidade) && acao == 'add') { orcamento_gerencia_timeout = setTimeout("orcamento_gerencia('" + acao + "', " + id_produto + ", " + quantidade + ")", 1000); $j('#orcamento .box1 .bar1.align2 .column1.align1 p').html('...'); } } orcamento_gerencia_timeout_cancel = function () { try { clearTimeout(orcamento_gerencia_timeout); } catch (e) { } } /* =================== */ /* Update top quantity */ update_qtd_orcamentos = function(acao) { $j.ajax({ type: "POST", url: "atualiza_orcamentos.php", dataType: "html", beforeSend: function () { if (acao == 'add' || acao == 'update') $j('html, body').animate({ scrollTop: $j('body').position().top }, 800, 'easeOutExpo' ); $j('#header .orcamento .num_itens').hide(); }, success: function (quantidades) { var quantidade = quantidades.split("?"); $j('#header .orcamento .num_itens').html(quantidade[0]).fadeIn(3000); $j('#orcamento .box1 .bar1.align2 .column1.align1 p').html(quantidade[1]); } }); } /* =================== */ /* Ajusta imagens no meio */ adjustImage = function (image) { var x; /*$j(image).css('boder','10px solid red'); var img_height = $j(image).height(); //alert(img_height); img_height = (211 - img_height) + 'px'; alert(img_height + image); $j(image).animate({ marginTop: img_height }, 0);*/ } $j(window).load(function() { /*$j('#home #produtos .produto .img1 img').each( function(){ var img_height = $j(this).height(); img_height = ((211 - img_height) / 2) + 'px'; $j(this).animate({ marginTop: img_height }, 0); });*/ $j('#home #produtos .produto .img1 img.img_to_get_width').each( function(){ var img_width = $j(this).width(); img_width = ((211 - img_width) / 2) + 'px'; $j(this).next('.lazy').animate({ marginLeft: img_width }, 0); }); $j('#eventos .img1 img..img_to_get_width').each( function(){ var img_width = $j(this).width(); img_width = ((198 - img_width) / 2) + 'px'; $j(this).next('.lazy').animate({ marginLeft: img_width }, 0); }); /*$j('#home #produtos .produto .img1 img').load(function() { alert(1); var img_height = $j(this).height(); alert(img_height); img_height = (211 - img_height) + 'px'; alert(img_height); $j(this).animate({ marginTop: img_height }, 0); });*/ }); /* ================= */ /* Lazy Load */ //$j(document).ready(function () { /*$j(window).load(function() { $j('img.lazy').show().lazyload({ effect:'fadeIn' }); }); /* ========= */ /* Mask */ $j(document).ready(function () { $j("#datepicker2").focus(function () { $j(this).mask("99/99/9999"); }); }); /* ==== */