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

$(document).ready(function(){
    $.favicon('http://cdn.myld.com.au/2/1501/rebuild-dieseltec-qld_c8b716335b.png');

    menu.contactDetails({

        phone: '(07) 4957 7759', //optional, can have multiple values[array]
        email: 'dtq@dieseltec.com.au', //optional, can have multiple values[array]
        address: '8 Progress Drive Paget QLD 4740', //optional, single value
        hours: [['Mon - Fri','7:00am to 5:00pm'],['Sat','By appointment']] //optional

    }); 
    
    $('h1, h2, h3, h4, h5 , h6').attr('itemprop','name');
    $('p').attr('itemprop','description');
    $('.container').attr('itemtype','http://schema.org/LocalBusiness');
    $('.container-fluid').attr('itemtype','http://schema.org/LocalBusiness');
    $('img').attr('itemprop','image');

    //Contact Page
    if ( $("body#contact").is("*") ) {
      $('#contact_form').smartCaptcha({ 
          validateText: ["name"],
          validateEmail: ["email"],
          validateChar: [{ id: "message", max: null }],
          validateNum: [{ id: "phone", min: 3, max: 13 }],
          validateStyle: "default"
      });
    }
    
    //VIEW SECTION 1
    $('#view_section_1').insertAfter('#header');
    //$('#view_section_1').append('#content-container');

    //VIEW ERROR DIV
    $('#error').insertAfter('#view_section_1');
    //$('#error').append('#content-container');

});


$(window).load(function() {
  $("body").addClass("loaded");
});

function googlemap() {
  var myLatlng = new google.maps.LatLng(-21.17197, 149.17136);
  var image = 'http://cdn.myld.com.au/2/1501/rebuild-dieseltec-qld_769fe946d0.png';
  var mapOptions = {
    zoom: 13,
    center: myLatlng,
    scrollwheel: false,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  
  if ($('#google-map').length > 0) {
      var map = new google.maps.Map(document.getElementById('google-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(){
	googlemap();
});