$(document).ready(function() {
	
    /**estilizando os campos de radio na tela de enquete**/
    $(".poll .styleRadio input:radio").styleRadioCheckbox({
        classChecked:"inputRadioChecked",
        classFocus:"inputFocus"
    });
	
    /**separando a listagem de kits apenas nos itens impares**/
    $('.kits li:nth-child(2n-1)').css('marginRight','60px')
	
    /**aplicando modal as lojas participantes**/
    $('.nyroModal').nyroModal();
	
    /**select personalizado**/
    $("div.styleAssuntos div.select select").styleCombobox({
        classFocus:"comboboxFocus"
    });
	
    /**centralizar imagens dos produtos principais no ie7**/
    if(navigator.userAgent.indexOf('MSIE 7.0') != -1) {
        $(".imgProduto img").each(
            function(){
                var height = (365 - $(this).height()) /2;
                $(this).css('marginTop',height);
            });
    }
	
    /**centralizar imagens dos produtos na listagem no ie7**/
    if(navigator.userAgent.indexOf('MSIE 7.0') != -1) {
        $("ul.produtos li div.imgProduto img").each(
            function(){
                var height = (215 - $(this).height()) /2;
                $(this).css('marginTop',height);
            });
    }
	
    /**insere uma borda a esquerda do primeiro numero na paginacao**/
    $(".navigation span a.numero:first").css({
        'line-height':'15px',
        'border-left':'1px solid #BC620E'
    });
    $(".navigation span.current:nth-child(2)").css({
        'border-left':'1px solid #BC620E',
        'border-right':'none'
    });

    /****
		esconde os botoes de navegacao do carrossel se o 
		numero de categorias for menor ou igual a 8
	****/
    var qtdItens = 0;
    $("div.categorias ul.carrossel li").each(function(){
        qtdItens++;
    });
    if (qtdItens <= 8) {
        $("div.categorias button.anterior, div.categorias button.proximo").css('display','none');
        $("div.categorias div.boxCarrossel div.carrossel").css('margin','0 50px');
    }
	
    /** retira o "sublinhado" do texto dos botoes "btMaisPrecos", "btComprar" e "btCompreNoSite" **/
    $("button.btMaisPrecos").parent().css('text-decoration','none');
    $("button.btComprar").parent().css('text-decoration','none');
    $("button.btCompreNoSite").parent().css('text-decoration','none');
	
        
    function randomizaBannerPrincipal(){
        $('#bannerPrimario a').hide();
        $('#bannerPrimario div').prepend($('#bannerPrimario a:last'));
        $('#bannerPrimario a').eq(0).show();
        setTimeout(randomizaBannerPrincipal,5000);
    }
     
    function randomizaBannerCima(){
        $('.bannerSecundarioCima a').hide();
        $('.bannerSecundarioCima div').prepend($('.bannerSecundarioCima a:last'));
        $('.bannerSecundarioCima a').eq(0).show();
        setTimeout(randomizaBannerCima,5000);
    }
        
       
    function randomizaBannerbaixo(){
        $('.bannerSecundarioBaixo a').hide();
        $('.bannerSecundarioBaixo div').prepend($('.bannerSecundarioBaixo a:last'));
        $('.bannerSecundarioBaixo a').eq(0).show();
        setTimeout(randomizaBannerbaixo,5000);
    }
    randomizaBannerPrincipal();
    randomizaBannerCima();
    randomizaBannerbaixo();
    
    if(navigator.userAgent.indexOf('MSIE 7.0') != -1) {
        $("#bannerPrimario a img").each(function(i) {
            var height = (119 - $(this).height()) /2;
            $(this).css('marginTop',height);
        });
    }
    
        if(navigator.userAgent.indexOf('MSIE 7.0') != -1) {
        $("#bannerPrimario a img").each(function(i) {
            var height = (119 - $(this).height()) /2;
            $(this).css('marginTop',height);
        });
    }
	/***************************************
	     função responsavel para 
		 expandir o banner no momento 
		 em q o mouse repousa sobre ele
		 assim como ele volta ao 
		 normal assim q se retira o mouse
	****************************************/
	$("#bannerPrimario").hover(
		function() {
			$(this).css({
					"width":"957px",
					"position":"absolute",
					"zIndex":6
			});
			
			$(this).parent().css('height','255px')
			
		},
		function() {
			$(this).width('631px');
		});
});
