jQuery(document).ready(function() {
	jQuery('a').click(function(e) {
        if(jQuery(this).attr('href') == '#'){
            e.preventDefault();
        }
    });

    //Hotspots
    jQuery('.hotspots li.item1').hover(function() {
    	jQuery(this).parent().parent().parent().children('.hotspots-content').children('.item1').addClass('active');
    }, function() {
    	jQuery(this).parent().parent().parent().children('.hotspots-content').children('.item1').removeClass('active');
    });
    jQuery('.hotspots li.item2').hover(function() {
        jQuery(this).parent().parent().parent().children('.hotspots-content').children('.item2').addClass('active');
    }, function() {
        jQuery(this).parent().parent().parent().children('.hotspots-content').children('.item2').removeClass('active');
    });

		jQuery('.hotspots li.item3').hover(function() {
        jQuery(this).parent().parent().parent().children('.hotspots-content').children('.item3').addClass('active');
    }, function() {
        jQuery(this).parent().parent().parent().children('.hotspots-content').children('.item3').removeClass('active');
    });

    //Animate
    $(window).load(function() {
        jQuery('header .parallax-layer').parallax({
            mouseport: jQuery('.parallax-area'),
            xparallax: false
        });
    });

    $(".slider").owlCarousel({
        autoplay:true,
        autoplayTimeout:6000,
        autoplayHoverPause:true,
        loop:true,
        margin:15,
        items: 3,
        nav:true
    });

		$(".slider2").owlCarousel({
        autoplay:true,
        autoplayTimeout:6000,
        autoplayHoverPause:true,
        loop:true,
        margin:15,
        items: 3,
        nav:true
    });

     /*=================================
    =            Analytics            =
    =================================*/
    $('.parallax-layer').hover(function(event) {
        _gaq.push(['_trackEvent', 'Animação', 'Mão recarregando impressora']);
    });
    $('a.appstore').click(function(event) {
        _gaq.push(['_trackEvent', 'Link', 'Apple App Store']);
    });
    $('a.google-play').click(function(event) {
        _gaq.push(['_trackEvent', 'Link', 'Google Play Store']);
    });
    /*Hotspots*/
    $('.hotspots a').hover(function() {
        var theTitle = $(this).parent().parent().parent().parent().find('.hotspots-content img').attr('title');
        _gaq.push(['_trackEvent', 'Hotspots', theTitle]);
    });
});

// Função Timer
function contador4000(){
    //Counter
    $('.timer4000').countTo({
        from: 1000,
        to: 4500,
        speed: 200,
        refreshInterval: 1,
        onComplete: function (value) {
            setTimeout(contador4000, 2000)
        }
    });
}
function contador6500(){
    //Counter
    $('.timer6500').countTo({
        from: 1000,
        to: 7500,
        speed: 200,
        refreshInterval: 1,
        onComplete: function (value) {
            setTimeout(contador6500, 2000)
        }
    });
}
var isIE11 = !!navigator.userAgent.match(/Trident.*rv\:11\./);
if( $.browser.msie || isIE11 ) {//Fix IE
    // Função Timer
    function contador4000(){
        //Counter
        $('.timer4000').countTo({
            from: 0,
            to: 4500,
            speed: 200,
            refreshInterval: 2,
            onComplete: function (value) {
                setTimeout(contador4000, 2600)
            }
        });
    }
    function contador6500(){
        //Counter
        $('.timer6500').countTo({
            from: 0,
            to: 7500,
            speed: 200,
            refreshInterval: 3,
            onComplete: function (value) {
                setTimeout(contador6500, 6000)
            }
        });
    }
    $(window).load(function() {
        $('.preload').attr('src', function(i,a){
            $(this).attr('src','')
                .removeClass('preload')
                .attr('src',a);
        });
        //Counter
        contador4000();
        setTimeout(contador6500, 100);
    });
}
else{
    $(window).load(function() {
        $('.preload').attr('src', function(i,a){
            $(this).attr('src','')
                .removeClass('preload')
                .attr('src',a);
        });
        //Counter
        contador4000();
        setTimeout(contador6500, 100);
    });
}
