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

//Javascripts
$(document).ready(function(){ 
  $.favicon('http://cdn.myld.com.au/2/1645/cape-byron-glass_810d90ac6f.png');
	
	menu.contactDetails({
		
		phone: '0266858588', //optional, can have multiple values[array] 
		mobile: '0415660801', //optional, can have multiple values[array]
		email: 'info@capebyronglass.com.au', //optional, can have multiple values[array] 
		address: '13E Acacia St NSW Byron Bay, 2481', //optional, single value
		hours: [['Mon to Fri','7:30am-4:00pm'],['Sat to Sun','EMERGENCIES ONLY']] //optional
		
	});
    
    
    // View section_1
    $('#view_section_1').insertBefore('.footer');

    // View error div
    $('#error').insertBefore('.footer');
    
    //nav justify
    $('.navbar .nav').addClass('nav-justified');   
    
    $('.service .phone').click(function(){
        location.href = "tel://0266858588";
    });
    
    $('#scroll-top').click(function(){
        $("html, body").animate({ scrollTop: 0 }, 1000);
    });    
    
    // CONTACT
    if ( $("body#contact").is("*") ) {

        // Contact Form
        $('#contact_form').smartCaptcha({
            validateText: ["name","phone","message"],
            validateEmail: ["email"],
            redirectLink: null,
            validateStyle: "default"
        });

        // Insert Map
        function map() {
          var myLatlng = new google.maps.LatLng(-28.63581, 153.58586);
          var image = 'http://cdn.myld.com.au/2/1646/cape-byron-glass_6693249a61.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();
        });        
        
        
    } else {
        
    }
    
    
     
}); 
