// Stilo para file upload
jQuery(function() {
      jQuery("input.fileUp").filestyle({ 
          image: "img/elementos/upload1.jpg",
          imagewidth : 86,
          imageheight : 22,
          width:60
      });
});                                               

jQuery(function() {
      jQuery("input.fileUp2").filestyle({ 
          image: "img/bgs/botao-trocas-file.jpg",
          imagewidth : 26,
          imageheight : 28,
          width:60,
          ClassInp : 'arquivo1'
      });
});

//////////////////////////  HOME
function mycarousel_initCallback(carousel) {
    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

// Ride the carousel...
jQuery(document).ready(function() {
    jQuery("#mycarousel").jcarousel({
        visible: 5,
        scroll: 2,
        animation: 500,
        initCallback: mycarousel_initCallback,
        wrap: 'both',
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

////////////////////////// REVISTA
function boxrevista_materias_initCallback1(carousel) {
    jQuery('#boxrevista_materias-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#boxrevista_materias-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#boxrevista_materias").jcarousel({
        visible: 3,
        scroll: 1,
        animation: 500,
        initCallback: boxrevista_materias_initCallback1,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

//////////////////////////  BUSCA
function busca_mycarousel_initCallback(carousel) {
    jQuery('.busca_jcarousel-control1 a').bind('click', function() {
        jQuery(".busca_jcarousel-control1 a").addClass("inativo").removeClass("ativo");
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        jQuery(this).addClass("ativo").removeClass("inativo");
        return false;
    });
};

function busca_mycarousel_itemVisibleInCallbackAfterAnimation(carousel, item, idx, state) {
    jQuery(".busca_jcarousel-control1 a").addClass("inativo").removeClass("ativo");
    jQuery('.busca_jcarousel-control1 a').eq((idx - 1)).addClass("ativo").removeClass("inativo");
};

jQuery(document).ready(function() {
    jQuery("#busca_mycarousel1").jcarousel({
        visible: 5,
        scroll: 1,
        animation: 500,
        initCallback: busca_mycarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null,
        itemVisibleInCallback: {
            onAfterAnimation:  busca_mycarousel_itemVisibleInCallbackAfterAnimation
        }
    });
});

//////////////////////////  GRAVIDEZ > PARTO > 10 SINAIS DE QUE É HORA DE IR PARA MATERNIDADE
function mycarousel_initCallback2(carousel) {
    jQuery('.paginacao-parto a').bind('click', function() {
        jQuery(".paginacao-parto a").addClass("inativo").removeClass("ativo");
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text().replace("Nasceu!",11)));
        jQuery(this).addClass("ativo").removeClass("inativo");
        return false;
    });
                                  
    jQuery('#mycarousel1-parto-sinais-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel1-parto-sinais-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

function mycarousel_itemVisibleInCallbackAfterAnimation2(carousel, item, idx, state) {
    jQuery(".paginacao-parto a").addClass("inativo").removeClass("ativo");
    jQuery('.paginacao-parto a').eq((idx - 1)).addClass("ativo").removeClass("inativo");
};

jQuery(document).ready(function() {
    jQuery("#mycarousel1-parto-sinais").jcarousel({
        visible: 1,
        scroll: 1,
        animation: 500,
        initCallback: mycarousel_initCallback2,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null,
        itemVisibleInCallback: {
            onAfterAnimation:  mycarousel_itemVisibleInCallbackAfterAnimation2
        }
    });
});

//////////////////////////  GUIA DE ESPECIALISTAS
function mycarousel_initCallback3(carousel) {
    jQuery('#guia-especialistas-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#guia-especialistas-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#guia-especialistas").jcarousel({
        visible: 1,
        scroll: 1,
        animation: 500,
        initCallback: mycarousel_initCallback3,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

//////////////////////////  QUEM SOMOS
function mycarousel_initCallback4(carousel) {
    jQuery('#quem-somos-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#quem-somos-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#quem-somos").jcarousel({
        visible: 1,
        scroll: 1,
        animation: 500,
        initCallback: mycarousel_initCallback4,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

//////////////////////////  RECEM-NASCIDO
function mycarousel_initCallback5(carousel) {
    jQuery('#recem-nascido-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#recem-nascido-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#recem-nascido").jcarousel({
        visible: 5,
        scroll: 1,
        animation: 500,
        initCallback: mycarousel_initCallback5,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

//////////////////////////  FOTOS DE PARTO
function mycarousel_initCallback6(carousel) {
    jQuery('#foto-parto-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#foto-parto-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#foto-parto").jcarousel({
        visible: 10,
        scroll: 5,
        animation: 500,
        initCallback: mycarousel_initCallback6,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

//////////////////////////  QUEM ESPERA
function mycarousel_initCallback7(carousel) {
    jQuery('#quem-espera-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#quem-espera-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#quem-espera").jcarousel({
        visible: 8,
        scroll: 5,
        animation: 500,
        initCallback: mycarousel_initCallback7,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

//////////////////////////  TROCA
function mycarousel_initCallback8(carousel) {
    jQuery('#troca-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#troca-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#troca").jcarousel({
        visible: 1,
        scroll: 1,
        animation: 500,
        initCallback: mycarousel_initCallback8,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});
 
//////////////////////////  La em casa é assim
function mycarousel_initCallback9(carousel) {
    jQuery('#laemcasa-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#laemcasa-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#laemcasa").jcarousel({
        visible: 6,
        scroll: 1,
        animation: 500,
        initCallback: mycarousel_initCallback9,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

//////////////////////////  Album de quarto
function mycarousel_initCallback10(carousel) {
    jQuery('#album-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#album-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#album").jcarousel({
        visible: 6,
        scroll: 1,
        animation: 500,
        initCallback: mycarousel_initCallback10,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

//////////////////////////  Decoracao
function mycarousel_initCallback15(carousel) {
    jQuery('#decoracao-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#decoracao-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#decoracao").jcarousel({
        visible:6,
        scroll: 1,
        animation: 500,
        initCallback: mycarousel_initCallback15,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

//////////////////////////  Hits
function mycarousel_initCallback11(carousel) {
    jQuery('#hits-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#hits-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#hits-carrocel").jcarousel({
        visible: 6,
        scroll: 1,
        animation: 500,
        initCallback: mycarousel_initCallback11,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

//////////////////////////  Moda infantil
function mycarousel_initCallback12(carousel) {
    jQuery('#moda-infantil-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#moda-infantil-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#moda-infantil").jcarousel({
        visible: 6,
        scroll: 1,
        animation: 500,
        initCallback: mycarousel_initCallback12,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

//////////////////////////  Revista
function mycarousel_initCallback13(carousel) {
    jQuery('#revista-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#revista-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#revista").jcarousel({
        visible: 14,
        scroll: 4,
        animation: 500,
        initCallback: mycarousel_initCallback13,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

//////////////////////////  Revista
function mycarousel_initCallback14(carousel) {
    jQuery('#capa-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#capa-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#capa").jcarousel({
        visible: 1,
        scroll: 1,
        animation: 500,
        initCallback: mycarousel_initCallback14,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

//////////////////////////  Galeria
function mycarousel_initCallback16(carousel) {
    jQuery('#galeria-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#galeria-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
    jQuery("#galeria").jcarousel({
        visible:9,
        scroll: 1,
        animation: 500,
        initCallback: mycarousel_initCallback16,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

jQuery(document).ready(function() {
    jQuery("#galeria2").jcarousel({
        visible:6,
        scroll: 1,
        animation: 500,
        initCallback: mycarousel_initCallback16,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});



///// Monta Swf - JQuery 1.0
jQuery(document).ready(function() {  
    
    var now = new Date();    
    var dia = now.getDay();
    var mes = now.getMonth();
    var ano = now.getFullYear();
    var hora = now.getHours();
    var mintuto = now.getMinutes();
    var segundo = now.getSeconds();
    var data = ano+""+mes+""+dia+""+hora; 

        $(".monta-swf").each(function () {
            var arquivo = $(this).find("#arquivo").text();
            var largura = $(this).find("#largura").text();;
            var altura = $(this).find("#altura").text();;
            var action = $(this).find("#action").text();;  
            
            var swf = "";
            swf += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + largura + '" height="' + altura + '">';
            swf += '<param name="movie" value="swf/'+ arquivo +'.swf?ieSux='+ data +'" />';
            swf += '<param name="quality" value="high" />';
            swf += '<param name="menu" value="false" />';
            swf += '<param name="wmode" value="transparent" />';
            swf += '<param name="FlashVars" value="'+ action +'&clearCache='+ data +'" />';
            swf += '<embed FlashVars="'+ action +'&clearCache='+ data +'" wmode="transparent" menu="false" src="swf/'+ arquivo +'.swf?ieSux='+ data +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + largura + '" height="' + altura + '"></embed>';
            swf += "</object>"
            
            $(this).html(swf);
        });
});
                                
// DatePicker  --- sistema de calendario
jQuery(document).ready(function() {
    var X = new Date();
    var ano = X.getFullYear();
    jQuery(function() {
        jQuery('#datepicker').datepicker({
            changeMonth: true,
            changeYear: true,
            yearRange:  (ano-1) +':'+ (ano),
            onSelect: function(dateText, inst) { SetaData($('#datepicker').datepicker( 'getDate' )) }
        });
    });
     jQuery(function() {
        SetaData(jQuery('#datepicker').datepicker( 'getDate' ))
     });
});



function SetaData()
{
    var X = new Date(arguments[0]);
    var dia = X.getDate();
    var mes = X.getMonth()+1;
    var ano = X.getFullYear();
    
    jQuery('#txtData').val(ano+"-"+mes+"-"+dia);
}
