Notice: Only variables should be passed by reference in /var/www/eneolica.pt/gz.php on line 5
Warning: ob_start(): Output handler 'ob_gzhandler' conflicts with 'mb_output_handler' in /var/www/eneolica.pt/gz.php on line 16
Notice: ob_start(): Failed to create buffer in /var/www/eneolica.pt/gz.php on line 16
Warning: ob_start(): function "compress" not found or invalid function name in /var/www/eneolica.pt/gz.php on line 17
Notice: ob_start(): Failed to create buffer in /var/www/eneolica.pt/gz.php on line 17
/* ===================================== */
$.ajaxSetup ({
cache: false
});
/* ===================================== */
$(document).ready(function(){
setInterval(function () { $('.default_galeria').resize(); }, 100);
/*------------------------------------------------*/
$(document).on('click', '.inpt_condicoes .box_info .icon', function(e) {
$(this).parent().addClass("show");
return false;
});
/*------------------------------------------------*/
//Check to see if the window is top if not then display button
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.scrollToTop').fadeIn();
} else {
$('.scrollToTop').fadeOut();
}
});
//Click event to scroll to top
$('.scrollToTop').click(function(){
$('html, body').animate({scrollTop : 0},800);
return false;
});
/*------------------------------------------------*/
/*------------------------------------------------*/
$( '#foto_topo' ).sliderPro({
width: '100%',
height: 500,
fade:true,
arrows: true,
buttons: true,
waitForLayers: true,
thumbnailWidth: 200,
thumbnailHeight: 100,
thumbnailPointer: true,
thumbnailArrows: true,
autoplay: true,
loop:false,
reachVideoAction:'playVideo',
endVideoAction:'nextSlide',
/* autoHeight: true,
touchSwipe: false,
arrows: false,*/
breakpoints: {
780: {
height: 300
/*thumbnailWidth: 120,
thumbnailHeight: 50*/
}
}
});
$( '#foto_topo_home' ).sliderPro({
width: '100%',
height: 500,
fade:true,
arrows: true,
buttons: true,
waitForLayers: true,
thumbnailWidth: 200,
thumbnailHeight: 100,
thumbnailPointer: true,
thumbnailArrows: true,
autoplay: true,
loop:false,
reachVideoAction:'playVideo',
endVideoAction:'nextSlide',
/* autoHeight: true,
touchSwipe: false,
arrows: false,*/
breakpoints: {
780: {
height: 300
/*thumbnailWidth: 120,
thumbnailHeight: 50*/
}
}
});
/*------------------------------------------------*/
$( '.default_galeria' ).sliderPro({
width: 600,
fade:true,
autoplay: true,
loop:false,
fadeCaption: false,
autoHeight: false
});
/*------------------------------------------------*/
/*------------------------------------------------*/
// verificar cookies
cookiePolicyBar();
$('.cookie-policy .close').click(function () {
//WHEN CLOSED, CREATE COOKIE TO HIDE THE BAR IN THE FUTURE. Valid across entire site and expires in 30 days
$.cookie('CookieMsg', 'true', { expires: 30, path: '/' });
$('.cookie-policy').remove();
$('#header').removeAttr('style');
return false;
});
/*------------------------------------------------*/
$(".menu-icon").on("click", function(){
if($("#menutopo").hasClass('on')){
$("#menutopo").removeClass("on");
}else{
$("#menutopo").addClass("on");
}
//$("#menutopo").slideToggle("fast");
});
/*------------------------------------------------*/
$('a[data-rel]').each(function() {
$(this).attr('rel', $(this).data('rel'));
});
load_prettyPhoto();
/*------------------------------------------------*/
$(document).on('click', 'a.open_div', function() {
open_id=this.hash;
if ($(open_id).is(":hidden")) {
$(this).addClass("on");
if (open_id == "#linha_newsletter"){$("#linha_pesquisa").slideUp("fast");}
else if (open_id == "#linha_pesquisa") {$("#linha_newsletter").slideUp("fast");}
}else{
$(this).removeClass("on");
}
$(open_id).slideToggle("fast");
return false;
});
/*------------------------------------------------*/
$(document).on('click', '.ajax_open', function(e) {
var div_id=$(this).attr('data-div');
if (div_id=="")return false;
var lk=$(this).attr('href');
if (this.hash){lk=lk.substring( 1 );}
load_myfile(lk, div_id);
return false;
});
/*------------------------------------------------*/
$(document).on('click', '.myAccordion', function() {
open_id=this.hash;
flag_1_open=true;
var my_flag_open=$(open_id).parents(".box_myAccordion").attr('data-open');
if (my_flag_open=="false"){flag_1_open=false;}
flag_show_hash=false;
var my_flag_show_hash=$(open_id).parents(".box_myAccordion").attr('data-showhash');
if (my_flag_show_hash=="true"){flag_show_hash=true;}
if ($(open_id).is(":hidden")) {
$(open_id).parent(".box_myAccordion").find(".myAccordion.on").removeClass("on");
$(open_id).parent(".box_myAccordion").find(".info_myAccordion").slideUp();
$(open_id).parent(".box_myAccordion").find('a[href$="'+open_id+'"]').addClass("on");
if (flag_show_hash){
location.hash = open_id.substring( 1 );
$.scrollTo( $(open_id), 0,{offset: {top:-100}});
}
}else{
if (!flag_1_open){
$(open_id).parents(".box_myAccordion").find(".myAccordion").removeClass("on");
}
if (flag_show_hash){
window.location.hash = '_';
history.pushState('_', document.title, window.location.pathname); // nice and clean
}
}
if (flag_1_open){
$(open_id).slideDown("fast");
}else{
$(open_id).slideToggle("fast", function() {
});
}
$('.default_galeria').sliderPro('resize');
return false;
});
/*------------------------------------------------*/
$("#menutopo li.has-children > a").on("click", function(e){
/*$(this).parent().siblings().find('ul').slideUp(300);
$(this).next('ul').stop(true, false, true).slideToggle(300);*/
$(this).parent().siblings().find('.box_sub_menu').slideUp(300);
$(this).next('.box_sub_menu').stop(true, false, true).slideToggle(300);
return false;
});
/*-----------------------------------------------------------------------*/
/* =Open new window e Mandar Imprimir
-----------------------------------------------------------------------*/
document.onclick = function(e){
var target = e ? e.target : window.event.srcElement; //teste para FF-IE
while (target && !/^(a|body)$/i.test(target.nodeName)){target = target.parentNode;}
//Open new window
if (target && target.getAttribute("rel")&& target.rel == "external"){
var linkExterno = window.open(target.href);
return linkExterno.closed;
}
//Mandar Imprimir
if (target && target.getAttribute("rel")&& target.rel == "print"){
var imprimir = window.print();
return false;
}
}
/*------------------------------------------------*/
$(document).on('click', '.bt_send_form_ajax', function() {
var obj_form=$(this.form);
var bt_form=$(this);
var params_send="";
var my_do_scroll=true;
var url = $(obj_form).attr('action');
$(bt_form).attr('disabled', 'disabled');
$(obj_form).find(".form_hide").css("display","block");
//var div_id = $(obj_form).find("#_mydivform").attr('value');
var div_id = $(obj_form).find("input[name='_mydivform']").attr('value');
var formData = $(obj_form).serialize() + '&' + jQuery.param( params_send );
if ($(bt_form).attr('data-scroll')=='false'){my_do_scroll=false;}
$.ajax({
type: "POST",
url: url,
data: formData, // serializes the form's elements.
error: function(jqXHR, textStatus, errorThrown){
//var msg = jqXHR + " - " + jqXHR.getResponseHeader() + " - " + textStatus + " - " + errorThrown + " - " + errorThrown.message;
var msg = textStatus + " - " + errorThrown;
/* --- mensagem de alerta com o erro --- */
alert(msg);
/*
alertify.alert( msg , function () {
//after clicking OK
/* --- refresh da página --- * /
location.reload();
},'poperro');
*/
$(bt_form).removeAttr('disabled');
$(obj_form).find(".form_hide").css("display","none");
},
success: function(data)
{
$(bt_form).removeAttr('disabled');
$(obj_form).find(".form_hide").css("display","none");
if (isXML(data))
{
var xml = $.parseXML( data );
var objmsg = xml.documentElement.getElementsByTagName("mensagem");
var myurl = objmsg[0].getAttribute("myurl");
window.top.location=myurl;
window.top.location.replace(myurl);
div_id="";
}
if (div_id!=""){
$('#' + div_id).html(data);
var sp_top=get_sptop();
if (my_do_scroll)$.scrollTo('#' + div_id, 800, {offset:sp_top});
}
}
});
return false;
});
/*------------------------------------------------*/
/*$("body").on("click", function(e){
$("#boxlogin").slideUp("fast");
});*/
$(document).on('click', function (e) {
if ($(e.target).closest("#boxlogin").length === 0) {
$("#boxlogin").slideUp("fast");
//$(".box_sub_menu").slideUp("fast");
}
});
$(window).scroll(function(){
$("#boxlogin").slideUp("fast");
//$(".box_sub_menu").slideUp("fast");
/*--Fixar menu Topo--*/
myMenuTop();
});
/*------------------------------------------------*/
$(document).on('change', '.box_sub_menu .box_inpt select', function() {
if (this.value != "0")window.location = this.value;
});
/*------------------------------------------------*/
// Get the header
var myMenu = document.getElementById("linha_menu");
// Get the offset position of the navbar
var stickyMenuTop = myMenu.offsetTop;
// Add the sticky class to the header when you reach its scroll position. Remove "sticky" when you leave the scroll position
function myMenuTop() {
if (window.pageYOffset > stickyMenuTop) {
myMenu.classList.add("sticky");
} else {
myMenu.classList.remove("sticky");
}
}
/*------------------------------------------------*/
$(document).on('click', '.favorito', function() {
var obj = $(this);
var ref = $(this).attr('rel');
$.ajax({
type: "POST",
url: "favorito",
data: { ref: ref},
success: function(resposta){
if (resposta != ""){
$(obj).html(resposta);
}
}
});
});
});
/* ===================================== */
/* ===================================== */
function isXML(xml){
try {
xmlDoc = $.parseXML(xml); //is valid XML
return true;
} catch (err) {
// was not XML
return false;
}
}
/* ===================================== */
$(function(){
var $elems = $('.animateblock');
var winheight = $(window).height();
var fullheight = $(document).height();
$(window).scroll(function(){
animate_elems();
});
function animate_elems() {
wintop = $(window).scrollTop(); // calculate distance from top of window
// loop through each item to check when it animates
$elems.each(function(){
$elm = $(this);
if($elm.hasClass('animated')) { return true; } // if already animated skip to the next item
topcoords = $elm.offset().top; // element's distance from top of page in pixels
if(wintop > (topcoords - (winheight*.75))) {
// animate when top of the window is 3/4 above the element
$elm.addClass('animated');
}
});
} // end animate_elems()
});
/* ===================================== */
$(function(){
var $elems = $('.my_content_readmore');
var def_max_height=450;
$elems.each(function(){
$elm = $(this);
var myH=$elm.attr('data-height');
if (myH > 0)max_height=myH;
else max_height=def_max_height;
if ($elm.height() > max_height){
$elm.css("height",max_height + 'px');
$elm.find(".my_bt_readmore").removeClass("off");
}
});
$(".my_bt_readmore a").on("click", function(){
$elems.css("height",'auto');
$(this).parent(".my_bt_readmore").addClass("off");
return false;
});
});
/* ===================================== */
$(function() {
var $allVideos = $("iframe[src^='//player.vimeo.com'], iframe[src^='//www.youtube.com'], object, embed"),
$fluidEl = $("figure");
$allVideos.each(function() {
$(this)
// jQuery .data does not work on object/embed elements
.attr('data-aspectRatio', this.height / this.width)
.removeAttr('height')
.removeAttr('width');
});
$(window).resize(function() {
var newWidth = $fluidEl.width();
$allVideos.each(function() {
var $el = $(this);
$el
.width(newWidth)
.height(newWidth * $el.attr('data-aspectRatio'));
});
}).resize();
});
/*#####################################################################
#####################################################################*/
function get_sptop()
{
var winwidth = $(window).width();
var sp_top=-90;
//if (winwidth < 960) sp_top=-30;
if (winwidth < 480) sp_top=-110;
return sp_top;
}
/* ===================================== */
function isTouchDevice() {
return "ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch;
}
function cookiePolicyBar() {
if ($.cookie('CookieMsg') != 'true') {
$('.cookie-policy').show();
$('#header').css('margin-top', $('.cookie-policy').height() + 10);
}
}
/* ===================================== */
function load_prettyPhoto(){
$("a[data-rel^='prettyPhoto']").prettyPhoto({
allowresize: true, /* true/false */
overlay_gallery: false,
default_width: 450,
default_height: 380,
social_tools: false,
show_title: false
});
}
/* ===================================== */
function open_ajax_info(id_conteudo,pag_url,n)
{
if (!n)n=false; // limpar conteudo
$('div#loadmoreajaxloader').show();
$.ajax({
url: pag_url + "/",
success: function(html)
{
html.trim();
$('div#loadmoreajaxloader').html('
');
if(html != "" && html != ".")
{
if (n) $("#" + id_conteudo).html(html);
else $("#" + id_conteudo).append(html);
$('div#loadmoreajaxloader').hide();
load_prettyPhoto();
} else {
txt_no_info=$('#txt_no_more_info').text();
$('div#loadmoreajaxloader').html(txt_no_info);
$('#bt_carregar_info').hide();
}
}
});
}
/* ===================================== */
function load_myfile(loadUrl, div_id)
{
var ajax_load = "";
$("#" + div_id).html(ajax_load).load(loadUrl);
}