/***********************
*  Site Specific JS   *
************************/

//Javascripts
$(document).ready(function(){
    $.favicon('http://cdn.myld.com.au/2/996/bitz-excavations_70bd687cb5.png');

    menu.contactDetails({

        phone: '0242853100', //optional, can have multiple values[array]
        mobile: null, //optional, can have multiple values[array]
        email: [['David','david@bitzexcavations.com.au'],['Accounts','accounts@bitzexcavations.com.au'],['Workshop','workshop@bitzexcavations.com.au']], //optional, can have multiple values[array]
        address: '5 Pioneer Drive Bellambi, NSW 2518', //optional, single value
        hours: [['Available','24/7']] //optional

    });

    // OVERALL    
    $('#view_section_1').insertAfter('#header');
    $('#error').insertAfter('#header');

    // HOME
    // if ($('body#home').is('*')) {
    //     $('.module').mouseenter(function(){
    //         $(this).find('.thumb').css('display','none');
    //         $(this).find('.thumb-overlay').css('display', 'block');
    //     });
    //     $('.module').mouseleave(function(){
    //         $(this).find('.thumb-overlay').css('display','none');
    //         $(this).find('.thumb').css('display','block');
    //     });
    // }

    // PAST PROJECTS
    if ( $('body#past-projects').is('*') ) {
        // Fancybox Gallery
        if(Modernizr.touch && $(".fancybox").length > 0 )
        {
           var myPhotoSwipe = $(".fancybox").photoSwipe({ enableMouseWheel: false , enableKeyboard: false });
        }
        else
        {
        /* Apply to single image */
            $("a.fancybox").fancybox();

        /* Apply fancybox to multiple items */
            $("a.fancybox[rel='gallery_group']").fancybox({
                'transitionIn'    :    'elastic',
                'transitionOut'    :    'elastic',
                'speedIn'        :    600,
                'speedOut'        :    200
            });

        /* Apply with thumbnails visible */
            $("a.fancybox").fancybox({
                helpers : {
                    thumbs : {
                        width: 200,
                        height: 200
                    }
                }
            });
        }
    }

    // CONTACT US
    if ( $('body#contact').is('*') ) {
        // Map
        function contactmap() {
          var myLatlng = new google.maps.LatLng(-34.36289, 150.91143);
          var image = 'http://cdn.myld.com.au/2/996/bitz-excavations_f29a42b1e2.png';
          var mapOptions = {
            zoom: 13,
            scrollwheel: false,
            center: myLatlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
          }

          if ($('#contact-map').length > 0) {
              var map = new google.maps.Map(document.getElementById('contact-map'), mapOptions);

              var marker = new google.maps.Marker({
                  position: myLatlng,
                  map: map,
                  icon: image
              });

              google.maps.event.addDomListener(window, 'resize', function() {
                    map.setCenter(myLatlng);
              });
              google.maps.event.addDomListener(window, 'orientationchange', function() {
                    map.setCenter(myLatlng);
              });
            }
        }

        $(window).load(function(){
            contactmap();
        });

        // Form
        $('#contact_form').smartCaptcha({
            validateText: ["name","message"],
            validateEmail: ["email"],
            redirectLink: null,
            validateStyle: "default"
        });



    }



});
