$(document).ready(function(){

    // ROLLOVER PEDIDOS
    $('.list-pedidos li').mouseover(function(){

        $('.list-pedidos li div').hide();
        $(this).css({'position':'relative'});
        $(this).children('div').show();
    }).mouseout(function(){
        $('.list-pedidos li').css({'position':''});
        $('.list-pedidos li div').hide();
    });

    //ABRIR CHAMADO
    $('#bt-cha').click(function(){
        var error ='';
        if($('#tel').val() == 'Telefone*')
        {
            error = 'Informe seu telefone.<br />';
        }
       if($('#descricao').val() == 'Descrição(Defeito)*')
        {
            error += 'Informe a decrição.<br />';
        }
        if(error.length >0)
        {
            $('#error-chama').html(error);
            return false;
        }

    });
    $('#bt-req').click(function(){
        var error ='';
        if($('#tel_sup').val() == 'Telefone*')
        {
            error = 'Informe seu telefone.<br />';
        }
       if($('#msm_sup').val() == 'Descrição(Quais suprimentos?)*')
        {
            error += 'Informe a decrição.<br />';
        }
        if(error.length >0)
        {
            $('#error-req').html(error);
            return false;
        }

    });

	//$('.pic_det *').lightBox();
	// LABEL DOS INPUTS
	$(":text").labelify();
	$(":textarea").labelify();

	// RECOMENDAR PRODUTO
	$('#recon_pro').click(function(){
		$('#recon').css({ display: 'block', top:'20%', margin:'-300px 0 0 0' });
		return false;
	});

	$('#close_recon').click(function(){
		$('#recon').hide(400);
		return false;
	});

	//COMPORTAMENTO DOS BOTÕES DE DADOS DO EQUIPAMENTO
	$('#box-desc').hide();
	$('#nav_dados a').click(function(){

		$('#nav_dados a').removeClass('active');
		$(this).addClass('active');

		$('#dados_side div').hide();

		var target = $(this).attr('href');
		$(target).show();
		return false;

	});

	// THUMBS DE DESTALHES DO EQUIPAMENTO
	$('.list_pics a').click(function(){
		var tbm = $(this).attr('rel')+"_md.jpg";
		var big = $(this).attr('rel')+"_gd.jpg";
		$('.pic_det').html('<img class="tbm" src="'+tbm+'" alt="" />');
		//alert(rel);
		return false;
	});

	// COMPORTAMENTOS DOS BOTÕES DO MENU DE EQUIPAMENTOS E SUPRIMENTOS
	/*var m = $('#center_cate h2 a');
	var menu = $('#center_cate h2 a').attr('class');
	if(!menu)
	{

	}
	else
	{
		m.parents('li').children('ul').show();
	}*/
	$('#center_cate h2 a').click(function(){

		var classe = $(this).attr('class');
		$(this).parents('li').children('ul').toggle();


		if(!classe)
		{
			$(this).addClass('active');
		}
		else
		{
			$(this).removeClass('active');
		}
		return false;
	});






$(function(){
	// Galeria -----------------------------------------------------------

	$('#gal-foto').jcarousel({ visible: 1, start: 1, scroll: 1, wrap: "both" });

	// Load de Imagens e Vídeos
	var container = $("#gal-foto");
	var thumbnail = $("#gal-foto a");
	var currFoto = $("#gal-foto");
	var currFotoSrc = $("#gal-foto img").attr("src");

	$(thumbnail).each(function(){
		$(this).click(function(){
			var href = $(this).attr("href");
			$("#gal-foto img").attr("src",href);
			return false;
		});
	});

});


});
