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

//Javascripts

//Footer Navigation
$('.navbar .nav li').clone().appendTo('.footer-nav');

//Content insert
$('#view_section_1').appendTo('#main-content');

//Error insert
$('#error').appendTo('#main-content');

//Footer Form
if ($('body#contact-us').is('*')) {
    $('#footer-form').html('');
}

$(document).ready(function(){ 
  $.favicon('http://cdn.myld.com.au/2/132/web_dynamic-building-services_ae3a08259b.ico');
  
	menu.contactDetails({
		
		phone: '0414347606', //optional, can have multiple values[array] 
		mobile: null, //optional, can have multiple values[array]
		email: 'admin@dynamicbuildingservices.com.au', //optional, can have multiple values[array] 
		address: 'Unit 3/88 Bundall Rd, Bundall, 4217', //optional, single value
		hours: null //optional
		
	});

	//Slider
    $('.flexslider').flexslider({
        animation: "slide",
        controlNav: false,
        animationLoop: false
    });
    $('#product-slider').flexslider({
        animation: "slide",
        controlNav: false,
    });

    //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 
        });
    }

    //Validation
    $('#custom_form').smartCaptcha({ 
        validateText: ["name"],
        validateEmail: ["email"],
        redirectLink: "http://api.jquery.com/jquery.fn.extend/",
        validateStyle: "default"
    }); 
    $('#contact').smartCaptcha({ 
        validateText: ["name"],
        validateEmail: ["email"],
        redirectLink: "http://api.jquery.com/jquery.fn.extend/",
        validateStyle: "default"
    }); 

     
});  // end declaration

function mapcanvas() {
  var myLatlng = new google.maps.LatLng(-28.00630, 153.41244);
  var mapOptions = {
    zoom: 16,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  
  if ($('#map-canvas').length > 0) {
      var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
    
      var marker = new google.maps.Marker({
          position: myLatlng,
          map: map 
      });
      
      google.maps.event.addDomListener(window, 'resize', function() {
			map.setCenter(myLatlng);
	  });         
      google.maps.event.addDomListener(window, 'orientationchange', function() {
			map.setCenter(myLatlng);
	  });   
	}
}
$(window).load(function(){
	mapcanvas();
});