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

//Javascripts
$(document).ready(function(){ 
  $.favicon('http://cdn.myld.com.au/2/1556/humpty-doo-dental_6eec4e598e.ico','http://cdn.myld.com.au/2/1556/humpty-doo-dental_7f1b97dcfc.png');
  
  menu.contactDetails({
		phone: '0889885050',
					//optional, can have multiple values['0752212345', ['Head Office', '0752212345']]
		email: 'reception@humptydoodental.com.au',
					//optional, can have multiple values['email@gmail.com', ['Support', 'support@yahoo.com']]
		address: '17 Vereker Street Humpty Doo NT 0836',
					//optional, can have multiple values['Robina, QLD', ['Southport', 'Southport, QLD']]
		 hours: [ 
					['Mon-Fri', '8:00am - 5:00pm']
			] 
			//optional 
	});
	
	//home services links
	$('#htLink1').replaceWith('<a href="contact-us">Speak to our team</a>');
	$('#htLink2').replaceWith('<a href="tel://0889885050">(08) 8988 5050</a>');
	$('#htLink3').replaceWith('<a href="mailto:reception@humptydoodental.com.au">reception@humptydoodental.com.au</a>');
	
	//match
	$('.homeThumb').matchHeight();
     
});

$(window).load(function(){
	mapcanvas();
});

//form validation
$('#custom_form').smartCaptcha({ 
  validateText: ["name", "message", "number"],
  validateEmail: ["email"],
	validateStyle: "default"
});

//map
function mapcanvas() {
  var myLatlng = new google.maps.LatLng(-12.57341, 131.09971);
  var image = 'http://cdn.myld.com.au/2/1556/humpty-doo-dental_f404af1d19.png';
  var mapOptions = {
    zoom: 17,
		scrollwheel: false,
    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,
          icon: image
      });
      
      google.maps.event.addDomListener(window, 'resize', function() {
			map.setCenter(myLatlng);
	  });         
      google.maps.event.addDomListener(window, 'orientationchange', function() {
			map.setCenter(myLatlng);
	  });   
	}
}

//view section 1
$('#view_section_1').insertAfter('#mobileCTA');

//error div
$('#error').insertAfter('#mobileCTA');

//nav justify
$('.navbar .nav').addClass('nav-justified');

//Detect mac
	var Browser = menu.browserDetect('version');
		if (Browser.OS == 'Mac') {
		$('body').addClass('mac');
}