$().ready(function() {
	menu();
	link_top();
	accordion();
	galeria();
});

function menu() {
	$('#logos .mekalquimica, #logos .mekaltintas').hide();

	$('#logos').hover(function(){
		$('.mekalquimica, .mekaltintas', this).stop(false, true).fadeIn(250);
	}, function(){
		$('.mekalquimica, .mekaltintas', this).stop(false, true).fadeOut(250);
	});
	
}

function link_top() {
	$('body').css('backgroundColor', '#1F5987');

	$('.link_top').click(function() {
		$.scrollTo(0, 800, {queue:true});

		return false;
	});
}

function accordion() {
	$(".accordion .texto").hide();

	$(".accordion h3 a").click(function() {
		if($(this).attr("class") == "abre") {
			$(".accordion .texto").slideUp(250);
			$(".accordion h3 a").removeClass("fecha").addClass("abre");

			$(this).parent().parent().find('.texto').slideDown(250);
			$(this).removeClass("abre").addClass("fecha");
		} else if($(this).attr("class") == "fecha") {
			$(this).parent().parent().find('.texto').slideUp(250);
			$(this).removeClass("fecha").addClass("abre");
		}

		return false;
	});

	$(".accordion h3 a.fecha").parent().parent().find('.texto').show();
}

function galeria() {
	$("a[rel^='prettyPhoto']").prettyPhoto({
		animation_speed: 'fast',
		slideshow: 5000,
		autoplay_slideshow: false,
		opacity: 0.80,
		show_title: true,
		default_width: 640,
		default_height: 480,
		counter_separator_label: ' de ',
		theme: 'facebook',
		hideflash: false,
		overlay_gallery: true,
		keyboard_shortcuts: true
	});
}

function showpresence(presence) {
	if(document.getElementById('atendimento_msn')) {
		if(presence.statusText == 'Offline') {
			$("#atendimento_msn").html("<a href=\"?menu=contato\"><span>Atendimento</span><br />OFF-LINE</a>");
		} else {
			$("#atendimento_msn").html("<a href=\"?menu=contato&sub=atendimento_msn\"><span>Atendimento</span><br />ON-LINE</a>");
		}
	}
}

