$j = jQuery;
/* Funções a executar ao término do carregamento da página */
$j(document).ready(function () {
$j("#loading_site").hide();
$j("#site").show();
//cardSlider.init('#cards', 4);
});
/* ======================================================= */
/* Funções para aumentar e diminuir a fonte do texto */
set_font = function (w) {
if (w == "-") {
$j(".conteudo").each(
function (index, object) {
var o = $j(object),
s = parseInt(o.css('font-size'));
if (s > parseInt($j(document.body).css('font-size'))) o.css('font-size', (s - 1) + 'px');
}
);
}
if (w == "+") {
$j(".conteudo").each(
function (index, object) {
var o = $j(object),
s = parseInt(o.css('font-size'));
if (s < parseInt($j(document.body).css('font-size')) + 6) o.css('font-size', (s + 1) + 'px');
}
);
}
}
/* ================================================= */
/*cargo_mostra = function (id) {
var d = $j('#cargo' + id),
l = $j('#cargo' + id + 'link'),
show = d.css('display') != 'block';
show ? d.slideDown('slow') : d.slideUp('slow');
l.toggleClass('cargo_aberto', show);
}*/
/* Funções para a agenda */
agenda_calendario = function (y, m, d, link_o) {
if (!$j("#div_datas").hasClass("agenda_calendario_loading")) {
$j.ajax( { type: "GET",
url: "agenda_calendario.php",
data: "y=" + y + "&m=" + m + "&d=" + d + "&marca=" + "true" + "&link_setas=" + $j("#link_setas_hidden_field").val() + "&link_dias=" + $j("#link_dias_hidden_field").val(),
dataType: "html",
beforeSend: function () {
$j("#div_datas").addClass("agenda_calendario_loading");
},
success: function (HTML) {
$j("#div_datas").removeClass("agenda_calendario_loading");
$j("#agenda_calendario").html(HTML);
}
} );
}
}
agenda_datas = function (y, m, d, link_o) {
if (!$j("#agenda_datas").hasClass("agenda_loading")) {
$j.ajax( { type: "GET",
url: "agenda_datas.php",
data: "y=" + y + "&m=" + m + "&d=" + d,
dataType: "html",
beforeSend: function () {
$j("#agenda_datas").addClass("agenda_loading");
},
success: function (HTML) {
$j("#agenda_datas").removeClass("agenda_loading");
$j("#agenda_datas").html(HTML);
}
} );
}
}
agenda_mostra = function (what, id, link_obj) {
if (!$j("#agenda_mostra").hasClass("agenda_loading") && (what == "feira" || what == "evento")) {
$j.ajax( { type: "GET",
url: "agenda_mostra.php",
data: "what=" + what + "&id=" + id,
dataType: "html",
beforeSend: function () { $j("#agenda_mostra").toggleClass("agenda_loading", true); },
success: function (HTML) {
$j("#agenda_mostra").toggleClass("agenda_loading", false);
$j("#agenda_mostra").html(HTML);
}
} );
}
}
agenda_paginacao = function (pagina, y, m, d, link_obj) {
$j("#paginacao_loading").show();
$j.ajax( { type: "GET",
url: "agenda_datas.php",
data: "pagina=" + pagina + "&y=" + y + "&m=" + m + "&d=" + d,
dataType: "html",
beforeSend: function () { },
success: function (HTML) {
$j("#agenda_datas").html(HTML);
$j(document).scrollTop($j("#div_datas").position().top);
}
} );
}
/* ===================== */
/* Funções para a parte de notícias */
noticias_mostra = function (id) {
if (!$j("#noticias_mostra").hasClass("noticias_loading")) {
$j.ajax( { type: "GET",
url: "noticias_mostra.php",
data: "id=" + id,
dataType: "html",
beforeSend: function () { $j("#noticias_mostra").toggleClass("noticias_loading", true); },
success: function (HTML) {
$j("#noticias_mostra").html(HTML);
$j("#noticias_mostra").toggleClass("noticias_loading", false);
$j(document).scrollTop($j("#noticias_mostra").position().top);
}
} );
}
}
noticias_paginacao = function (pagina) {
if (!$j("#noticias_paginacao").hasClass("noticias_loading")) {
$j.ajax( { type: "GET",
url: "noticias_paginacao.php",
data: "pagina=" + pagina,
dataType: "html",
beforeSend: function () { $j("#noticias_paginacao").toggleClass("noticias_loading", true); },
success: function (HTML) {
$j("#noticias_paginacao").html(HTML);
$j("#noticias_paginacao").toggleClass("noticias_loading", false);
}
} );
}
}
/* ================================ */
/* Carrega a hierarquia de níveis do site */
niveis_carrega = function (qs) {
$j.ajax( { type: "GET",
url: "niveis.php",
data: qs,
dataType: "html",
success: function (HTML) { $j(".niveis").html(HTML); }
} );
}
/* ====================================== */
/* Funções para a parte de produtos */
produtos_menu_ativa = function (wh, idi) {
$j('.box_produtos a').removeClass('tratores_' + idi + '_over').removeClass('microtratores_' + idi + '_over').removeClass('motores_' + idi + '_over').removeClass('pecas_' + idi + '_over');
$j('#div_produtos_tratores, #div_produtos_tratores_tipos, #div_produtos_microtratores, #div_produtos_microtratores_tipos, #div_produtos_motores, #div_produtos_motores_tipos, #div_produtos_pecas, #div_produtos_pecas_tipos').css('display', 'none');
$j('#link_produtos_' + wh).addClass(wh + '_' + idi + '_over');
$j('#div_produtos_' + wh).css('display', 'block');
//if (wh == 'tratores' || wh == 'motores') $j('#div_produtos_' + wh + '_tipos').css('display', 'block');
$j('#div_produtos_' + wh + '_tipos').css('display', 'block');
niveis_carrega("arquivo=produtos&tipo=" + wh);
$j('.detalhe_categoria_box_produtos div').removeClass('img_categoria_tratores').removeClass('img_categoria_microtratores').removeClass('img_categoria_motores').removeClass('img_categoria_pecas');
$j('.detalhe_categoria_box_produtos div').addClass('img_categoria_' + wh);
$j('.detalhe_categoria_box_produtos p').html(wh);
}
produtos_menu_tratores_ativa = function (wh, idi) {
$j('#div_produtos_tratores a').removeClass('serie_brasil_' + idi + '_over').removeClass('serie_classic_' + idi + '_over').removeClass('industrial_' + idi + '_over');
$j('#div_produtos_tratores_serie_brasil, #div_produtos_tratores_serie_classic, #div_produtos_tratores_industrial').css('display', 'none');
$j('#link_produtos_tratores_' + wh).addClass(wh + '_' + idi + '_over');
$j('#div_produtos_tratores_' + wh).css('display', 'block');
niveis_carrega("arquivo=produtos&tipo=tratores&subtipo=" + wh);
}
produtos_menu_motores_ativa = function (wh, idi) {
$j('#div_produtos_motores a').removeClass('diesel_' + idi + '_over').removeClass('frigorifico_' + idi + '_over').removeClass('maritimo_' + idi + '_over').removeClass('gerador_' + idi + '_over').removeClass('gasolina_' + idi + '_over');
$j('#div_produtos_motores_diesel, #div_produtos_motores_frigorifico, #div_produtos_motores_maritimo, #div_produtos_motores_gerador, #div_produtos_motores_gasolina').css('display', 'none');
$j('#link_produtos_motores_' + wh).addClass(wh + '_' + idi + '_over');
$j('#div_produtos_motores_' + wh).css('display', 'block');
niveis_carrega("arquivo=produtos&tipo=motores&subtipo=" + wh);
}
/* ================================ */
/* Funções para o banco de imagens */
banco_imagens_menu_ativa = function (wh, idi) {
$j('.box_produtos a').removeClass('tratores_' + idi + '_over').removeClass('microtratores_' + idi + '_over').removeClass('motores_' + idi + '_over').removeClass('fabrica_' + idi + '_over');
$j('#div_banco_imagens_tratores, #div_banco_imagens_microtratores, #div_banco_imagens_motores, #div_banco_imagens_motores_tipos, #div_banco_imagens_fabrica').css('display', 'none');
$j('#link_banco_imagens_' + wh).addClass(wh + '_' + idi + '_over');
$j('#div_banco_imagens_' + wh).css('display', 'block');
niveis_carrega("arquivo=banco_imagens&tipo=" + wh);
}
/* =============================== */
/* Funções para mostrar as características da linha de crédito */
linha_credito_folding_mostra = function (p_link, p_div) {
var l = $j(p_link),
d = $j(p_div),
mostra = !d.css("display") || d.css("display") != "block";
if (mostra) {
l.toggleClass('linha_credito_folding_open', true);
d.slideDown('slow');
} else {
d.slideUp('slow', function () { l.toggleClass('linha_credito_folding_open', false); });
}
}
/* =========================================================== */
/* Funções para mostrar as características da linha de crédito */
especificacoes_tecnicas_folding_mostra = function () {
var l = $j('#especificacoes_tecnicas_folding_link'),
d = $j('#especificacoes_tecnicas_folding_div'),
mostra = !d.css("display") || d.css("display") != "block";
if (mostra) {
l.toggleClass('especificacoes_tecnicas_folding_open', true);
d.slideDown('slow');
} else {
d.slideUp('slow', function () { l.toggleClass('especificacoes_tecnicas_folding_open', false); });
}
}
/* =========================================================== */
/* Funções para cadastro de e-mail no newsletter */
historico_abre = function (ano, a) {
$j(".historico_barra_anos a").removeClass("ativo");
$j(a).addClass("ativo");
$j(".historico_conteudo").hide();
$j("#historico_" + ano).show();
}
/* ============================================= */
/* Funções para o "Onde Comprar" */
/*onde_comprar_carrega_UF = function (UF, cidade, CEP, categoria) {
$j.ajax( { type: "GET",
url: "onde_comprar_concessionarias.php",
data:$j("#onde_comprar").serialize(),
dataType: "html",
beforeSend: function () { $j("#onde_comprar_concessionarias").html('
'); },
success: function (HTML) { $j("#onde_comprar_concessionarias").html(HTML); }
} );
niveis_carrega("arquivo=onde_comprar&estado=" + UF);
}*/
/* ============================= */
/* Funções para o "Onde Comprar" */
estado_muda = function (UF, label, show_cidades_select) {
if( jQuery('#estado').val() ) {
try { estado_muda_XMLHTTP.abort(); } catch (e) {}
jQuery('#estado').val(UF);
jQuery('#estado_label').val(label ? label : UF);
if (!show_cidades_select) {
document.getElementById('onde_comprar').cod_cidades.value = '';
document.getElementById('onde_comprar').cidade.value = 'SELECIONE UMA CIDADE';
}
jQuery('.options_cidades').hide();
if (show_cidades_select) jQuery('.loading').show();
estado_muda_XMLHTTP = jQuery.getJSON('cidades.ajax.php?search=',{sigla: jQuery('#estado').val(), nome: jQuery('#cidade').val(), ajax: 'true'}, function(j){
var options = !show_cidades_select ? 'TODAS' : '';
for (var i = 0; i < j.length; i++) options += '' + j[i].nome + '';
jQuery('.options_cidades').html(options);
jQuery('.loading').hide();
if (show_cidades_select) jQuery('.options_cidades').show();
});
} else {
jQuery('.options_cidades').html('');
}
}
jQuery(function(){
var estado = jQuery('#estado').val(),
estado_label = jQuery('#estado_label').val(),
cod_cidades = jQuery('#cod_cidades').val(),
cidade = jQuery('#cidade').val();
jQuery('#estado').change(function(){
estado_muda(estado, estado_label, false);
});
if (estado != '') {
estado_muda(estado, estado_label, false);
}
});
onde_comprar_carrega = function (UF) {
try { onde_comprar_carrega_XMLHTTP.abort(); } catch (e) {}
onde_comprar_carrega_XMLHTTP = $j.ajax( { type: "GET",
url: "onde_comprar_concessionarias.php",
data:$j("#onde_comprar").serialize(),
dataType: "html",
beforeSend: function () {
$j("#onde_comprar_concessionarias").html('
');
},
success: function (HTML) {
$j("#onde_comprar_concessionarias").html(HTML);
$j("html, body").animate({ scrollTop: $j("#onde_comprar_concessionarias").position().top }, 500);
}
} );
//niveis_carrega("arquivo=onde_comprar&estado=" + UF);
}
seta_UF = function (UF) {
try {
with (mapaBR_get('mapaBR')) {
mudaCorBr('0xCCCCCC');
mudaCor('0xFF1409', UF);
}
} catch (e) {}
document.getElementById('estado').value = UF;
estado_muda(jQuery('#estado').val(), jQuery('#estado').val(), false);
onde_comprar_carrega(UF);
}
$j(document).ready(function () {
$j('#select_categoria').toggle(function() {
$j('#select_categoria .options').show();
$j('#select_estado .options').hide();
$j('.options_cidades').hide();
}, function () {
$j('#select_categoria .options').hide();
});
$j('#select_categoria .options a').click(function() {
$j('#select_categoria .options').hide();
});
$j('#select_estado').toggle(function() {
$j('#select_estado .options').show().focus();
$j('.options_cidades').hide();
$j('#select_categoria .options').hide();
}, function () {
$j('#select_estado .options').hide();
}).keypress(function () {
return false;
});
$j('#select_estado .options a').click(function() {
$j('#select_estado .options').hide();
});
$j('#select_cidade').toggle(function() {
$j('.options_cidades').show();
$j('#select_categoria .options').hide();
$j('#select_estado .options').hide();
}, function () {
$j('.options_cidades').hide();
});
$j('.options_cidades a').click(function() {
$j('#select_cidade .options').hide();
});
$j('body').click(function() {
$j('.options').hide();
});
});
altera_categoria = function(categoria) {
var HTML = '
';
$j('.result_category').html(HTML);
if (categoria == 'pecas') {
categoria = 'peças';
var categoria2 = 'peças';
} else var categoria2 = categoria;
document.getElementById('onde_comprar').categoria.value = categoria2;
$j('.result b span').html(categoria);
$j('.result_content').show();
}
/* ============================= */
/* Funções no trabalhe conosco */
$j(document).ready(function () {
$j('.box_plus').click(function() {
$j(this).hide();
$j(this).next().show();
});
$j('.btn_minus').click(function() {
$j('.box_minus').hide();
$j('.box_minus').prev('.box_plus').show();
});
});
/* =========================== */
/* Funções para a mostragem das notícias */
noticias_carousel_mostra = function (what) {
$j('#carousel_noticias').removeClass('carousel_noticias_loading');
$j('#carousel_ultimas').hide();
$j('#botao_ultimas').toggleClass('botao_acionado', false);
$j('#carousel_mais_lidas').hide();
$j('#botao_mais_lidas').toggleClass('botao_acionado', false);
$j('#carousel_botoes').show();
$j('#carousel_' + what).show().jcarousel({ vertical: true,
buttonNextHTML: null,
buttonPrevHTML: null,
initCallback: noticias_carousel_initCallback });
$j('#botao_' + what).toggleClass('botao_acionado', true);
}
noticias_carousel_initCallback = function (carousel) {
$j('#seta_news_external_down').bind('click', function () {
carousel.next();
return false;
});
$j('#seta_news_external_up').bind('click', function () {
carousel.prev();
return false;
});
};
/* ===================================== */
/* Funções para cadastro de e-mail no newsletter */
newsletter_form_envia_hide_timeout = null;
newsletter_form_envia_aviso = function (HTML, timeout) {
var d = $j("#newsletter_resposta");
try { clearTimeout(newsletter_form_envia_hide_timeout); } catch (e) {}
d.show();
d.html(HTML);
//if (timeout) newsletter_form_envia_hide_timeout = setTimeout('$j("#newsletter_resposta").hide()', 3000);
}
newsletter_form_envia = function () {
var f = document.getElementById("form_newsletter");
if (f.nome.value == f.nome.defaultValue) {
newsletter_form_envia_aviso('Preencha o campo "Nome" corretamente', true);
} else {
$j.ajax( { type: "POST",
url: "newsletter_cadastra.php",
data:$j("#form_newsletter").serialize(),
dataType: "html",
beforeSend: function () { newsletter_form_envia_aviso('
', false); },
success: function (HTML) { newsletter_form_envia_aviso(HTML, true); }
} );
}
}
/* ============================================= */
/* Funções para cadastro de e-mail no contato */
contato_form_envia_hide_timeout = null;
contato_form_envia_aviso = function (HTML, timeout) {
var d = $j("#contato_resposta");
try { clearTimeout(contato_form_envia_hide_timeout); } catch (e) {}
d.html(HTML);
//if (timeout) contato_form_envia_hide_timeout = setTimeout('$j("#contato_resposta").html("")', 3000);
}
contato_form_enviando = false;
contato_form_envia = function () {
if (!contato_form_enviando) {
$j.ajax( { type: "POST",
url: "contato_post.php",
data: $j("#form_contact").serialize(),
dataType: "html",
beforeSend: function () {
contato_form_enviando = true;
contato_form_envia_aviso('
', false);
},
success: function (HTML) {
contato_form_enviando = false;
contato_form_envia_aviso(HTML, true);
if (HTML.match(//i)) {
document.getElementById("form_contact").reset();
}
},
error: function () {
var HTML = 'Error! Try again!';
contato_form_enviando = false;
contato_form_envia_aviso(HTML, true);
}
} );
}
}
/* ============================================= */
/* Funções para o formulário "Seja um Revendedor" */
seja_um_revendedor_form_envia = function () {
var f = document.getElementById("seja_um_revendedor_form"),
l = $j("#seja_um_revendedor_form_loading"),
s = $j("#seja_um_revendedor_form_submit");
f.submit();
l.css('display', 'block');
s.css('display', 'none');
return false;
}
/* ============================================== */
/* Funções para envio do formulário de currículo */
trabalhe_conosco_upload_envia = function () {
var f = document.getElementById("trabalhe_conosco_upload"),
c = $j("#trabalhe_conosco_upload_campo"),
s = $j("#trabalhe_conosco_upload_resposta"),
dt;
dt = f.target;
f.target = "trabalhe_conosco_upload_processa";
f.submit();
f.arquivo.value = "";
f.target = dt;
c.css('display', 'none');
s.html('
');
}
trabalhe_conosco_post_enviando = false;
trabalhe_conosco_post = function () {
if (!trabalhe_conosco_post_enviando) {
$j.ajax( { type: "POST",
url: "trabalhe_conosco_post.php",
data: $j("#trabalhe_conosco_form").serialize(),
dataType: "html",
beforeSend: function () {
$j("#trabalhe_conosco_resposta").html('
');
trabalhe_conosco_post_enviando = true;
},
error: function () {
var HTML = "Error! Try again!";
$j("#trabalhe_conosco_resposta").html(HTML);
trabalhe_conosco_post_enviando = false;
},
success: function (HTML) {
$j("#trabalhe_conosco_resposta").html(HTML);
trabalhe_conosco_post_enviando = false;
if (HTML.match(//i)) {
document.getElementById("trabalhe_conosco_form").reset();
}
}
} );
}
}
mostra_campos_formacao = function (v) {
$j('#div_formacao_TE').css('display', v == 'TE' ? 'inline' : 'none');
$j('#div_formacao_GR').css('display', v == 'GR' ? 'inline' : 'none');
$j('#div_formacao_PG').css('display', v == 'PG' ? 'inline' : 'none');
$j('#div_formacao_MB').css('display', v == 'MB' ? 'inline' : 'none');
$j('#div_formacao_ME').css('display', v == 'ME' ? 'inline' : 'none');
$j('#div_formacao_DO').css('display', v == 'DO' ? 'inline' : 'none');
}
mostra_campos_experiencia_profissional = function (v) {
$j('#div_experiencia_profissional').css('display', v == 'S' ? 'block' : 'none');
}
mostra_campos_curso_tecnico = function (v) {
$j('#div_curso_tecnico').css('display', v == 'N' ? 'none' : 'inline');
}
/* =========================================== */
/* Funções para a busca */
busca_autocomplete = function () {
var f = $j("#form_search"),
s = $j("#form_search_s"),
t = document.getElementById('form_search_s'),
x = $j("#form_search_s"),
p = x.position(),
a = $j("#autocomplete_search_results_container");
a.css('left', p.left + 'px');
a.css('top', (p.top + x.outerHeight(true)) + 'px');
try { busca_autocomplete_XMLHTTP.abort(); } catch (e) {}
if(s.val() == t.defaultValue || s.val().length < 3) {
busca_show_results_container(false);
} else {
busca_autocomplete_XMLHTTP = $j.ajax( { type: "POST",
url: "busca_autocomplete.php",
data: f.serialize(),
dataType: "html",
beforeSend: function () {
busca_show_results_container(true, '
');
},
success: function (HTML) {
busca_show_results_container(true, HTML);
}
} );
}
}
busca_autocomplete_timeout = null;
busca_autocomplete_timeout_set = function () {
busca_autocomplete_timeout = setTimeout("busca_autocomplete()", 1000);
}
busca_autocomplete_timeout_cancel = function () {
try {
clearTimeout(busca_autocomplete_timeout);
} catch (e) {
}
}
busca_show_results_container = function (mostra, HTML) {
var a = $j("#autocomplete_search_results_container");
mostra ? a.fadeIn() : a.fadeOut();
if (HTML && HTML.length) a.html(HTML);
}
$j(document).ready(function () {
/* Safely inject CSS3 and give the search results a shadow */
var cssObj = { 'box-shadow' : '#888 5px 10px 10px', // Added when CSS3 is standard
'-webkit-box-shadow' : '#888 5px 10px 10px', // Safari
'-moz-box-shadow' : '#888 5px 10px 10px'}; // Firefox 3.5+
$j("#autocomplete_search_results_container").css(cssObj);
/* ======================================================= */
/* Fade out the suggestions box when not active */
$j("#form_busca_s").blur(function () { setTimeout('busca_show_results_container(false)', 100); });
/* ============================================ */
});
/* ==================== */
/* Funções para o menu */
submenus_ids = new Array('empresa', 'produtos', 'servicos', 'imprensa');
submenu_aparece = function (what, idi, show) {
var classOver = 'menu_' + idi + '_over',
m = $j('#menu_' + what),
s = $j('#submenu_' + what),
f = $j(".conteudo iframe, .conteudo object"),
map = $j(".mapaBR *"),
map_hide = what != 'empresa',
i;
if (show) {
m.addClass(classOver);
f.css('visibility', 'hidden');
if (map_hide) map.hide();
for (i=0; i
');
},
success: function (HTML) {
$j('#mask').html(HTML);
cardSlider.init('#cards', 4);
}
} );
}
cardSlider = {
init: function (divu, perPage) {
try {
this.mask = $$(divu + ' div#mask');
this.group = $$(divu + ' ul');
this.items = $$(divu+ ' ul li');
this.pages = Math.ceil(this.items.length/perPage);
this.page = 1;
this.pageWidth = this.items[1].getSize().x * perPage;
this.direction = "forward";
this.prev = $$(divu + ' a.prev-arrow');
this.next = $$(divu + ' a.next-arrow');
this.anim = new Fx.Scroll('mask', { duration: 500,
transition: Fx.Transitions.Expo.easeInOut,
onStart: function () {
if(cardSlider.direction == "forward"){
//cardSlider.page < cardSlider.pages ? cardSlider.page++ : cardSlider.page = 1;
cardSlider.page < cardSlider.pages ? cardSlider.page++ : cardSlider.page = cardSlider.pages;
}
if(cardSlider.direction == "backward"){
//cardSlider.page > 1 ? cardSlider.page-- : cardSlider.page = 1;
cardSlider.page > 1 ? cardSlider.page-- : cardSlider.page = cardSlider.pages;
}
},
onComplete: function () {
}
} );
this.refreshUI = function () {
var minF = 0.0,
maxF = 1.0;
cardSlider.prev.fade(cardSlider.page == 1 ? minF : maxF);
cardSlider.next.fade(cardSlider.page == cardSlider.pages ? minF : maxF);
}
this.anim.toLeft();
cardSlider.page = 1;
this.group.setStyle('width', cardSlider.items.length * cardSlider.items[1].getSize().x);
this.prev.addEvent('click', function(e){
e = new Event(e).stop();
cardSlider.direction = "backward";
if (cardSlider.page > 1) cardSlider.anim.start((cardSlider.page-2) * cardSlider.pageWidth, 0);
//else cardSlider.anim.start(cardSlider.page * cardSlider.pageWidth, 0);
cardSlider.refreshUI();
});
this.next.addEvent('click', function(e){
e = new Event(e).stop();
cardSlider.direction = "forward";
if (cardSlider.page < cardSlider.pages) cardSlider.anim.start(cardSlider.page * cardSlider.pageWidth, 0);
//else cardSlider.anim.start((cardSlider.page-2) * cardSlider.pageWidth, 0);
cardSlider.refreshUI();
});
this.refreshUI();
} catch (e) {}
}
}
/* =============================== */
/* Função para resize do fundo */
Layout = {
ih: 0,
iw: 0,
iar: 1,
war: 1,
img: '',
GetWindowSize: function(w) {
w = w ? w : window;
var width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
var height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
return [width, height];
},
init: function(e) {
Layout.img = $('bg_sky_0');
Layout.holder = $('bg_sky');
Layout.ih = Layout.img.getHeight();
Layout.iw = Layout.img.getWidth();
Layout.iar = Layout.iw / Layout.ih;
Layout.resize(e);
},
resize: function(e) {
ws = Layout.GetWindowSize(window);
window_width = ws[0];
window_height = ws[1];
window_ratio = window_width / window_height;
image_width = Layout.iw;
image_height = Layout.ih;
image_ratio = Layout.iar;
new_image_width = window_width;
new_image_height = ( new_image_width / image_width ) * image_height;
width_diff = 0;
height_diff = -( new_image_height - window_height ) / 2;
if( new_image_height < window_height ) {
new_image_height = window_height;
new_image_width = ( new_image_height / image_height ) * image_width;
height_diff = 0;
width_diff = -( new_image_width - window_width ) / 2;
}
niw = Math.ceil(new_image_width);
nih = Math.ceil(new_image_height);
/*if (niw < 1280)*/ nih = 560;
try {
container = Layout.holder;
container.setStyle('visibility', 'visible');
container.setStyle('height', nih + 'px');
container.setStyle('top', parseInt($j('#site').outerHeight(false)) + 10 - nih + 'px');
image_to_resize = Layout.img;
image_to_resize.setStyle('width', niw+'px');
image_to_resize.setStyle('height', nih+'px');
//image_to_resize.setStyle('top', height_diff+'px');
image_to_resize.setStyle('left', width_diff+'px');
image_to_resize.setStyle('visibility', niw < 1280 ? 'hidden' : 'visible');
} catch (e) {}
}
}
window.addEvent('resize', function() { Layout.resize(); } );
//window.addEvent('load', function() { pe = setTimeout('Layout.init()', 300); pee = setInterval('Layout.resize()', 7000); });
/* =========================== */
/* Funções para carregamento de produtos com AJAX */
produtos_paginacao = function (pagina, id, link_obj) {
$j.ajax( { type: "GET",
url: "vagas_paginacao.php",
data: "pagina=" + pagina + "&id=" + id,
dataType: "html",
beforeSend: function () { },
success: function (HTML) {
$j("#vagas_disponiveis").html(HTML);
}
} );
}
/* ********************************************* */
$j(document).ready(function() {
var _timeout = 6000;
$j('#slideshow').cycle({
fx: 'fade',
timeout: _timeout,
pager: '#paginator',
slideExpr: 'img'
});
});