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

//Javascripts
$(document).ready(function(){ 
    $.favicon('http://cdn.myld.com.au/2/1398/harlequin-hair-studio-one_23bcb85ceb.png');
  	
  	menu.contactDetails({
  		
  		phone: '0755366245', //optional, can have multiple values[array] 
  		mobile: null, //optional, can have multiple values[array]
  		email: 'happyfeetnat@hotmail.com', //optional, can have multiple values[array] 
  		address: '70 Griffith Street, Coolangatta QLD 4225', //optional, single value
  		hours: [['Mon to Fri','8:30am-5:00pm'],['Saturday','8:00am-3:00pm'],['Sunday','Closed']] //optional
  		
  	});

     // View section_1
    $('#view_section_1').insertBefore('.footer');

    // View error div
    $('#error').insertBefore('.footer');
    
    //nav justify
    $('.navbar .nav').addClass('nav-justified');    
    
    // scroll top
    $('.scroll-top').click(function(){
        $("html, body").animate({ scrollTop: 0 }, 1000);
    }); 
    
    
    if ( $("body#contact").is("*") ) {

        // Contact Form
        $('#contact_form').smartCaptcha({
            validateText: ["name","phone","message"],
            validateEmail: ["email"],
            redirectLink: null,
            validateStyle: "default"
        });

        // Insert Map
        $('#map').insertBefore('#intro-wrap .intro');
        
        // Footer
        $('#footer-bottom .content-wrap').removeClass('col-md-3 col-lg-4 col-lg-2').addClass('col-lg-12').css('height', 'auto');
        $('#footer-bottom .map-wrap, #footer-bottom .form-wrap, #footer-bottom .contact-wrap').css('display','none');
        
        
        
    } else {
        
        // Footer Form
        $('#footer_form').smartCaptcha({
            validateText: ["name","phone","message"],
            validateEmail: ["email"],
            redirectLink: null,
            validateStyle: "default"
        });

        
    }    
    
    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
                   }
              }
        });
    }    
    
    // map
    function map() {
      var myLatlng = new google.maps.LatLng(-28.16877, 153.53824);
      var image = 'http://cdn.myld.com.au/2/1398/harlequin-hair-studio-one_2eaf4fb08d.png';
      var mapOptions = {
        scrollwheel: false,
        zoom: 13,
        center: myLatlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      }

      if ($('#map').length > 0) {
          var map = new google.maps.Map(document.getElementById('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(){
        map();
    });    
     
}); 
