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

//Javascripts
$(document).ready(function(){ 
  $.favicon('http://cdn.myld.com.au/2/1517/coffs-gas-company_50c2c5d5fb.png');
	
	menu.contactDetails({
		
		phone: '0266522411', //optional, can have multiple values[array] 
		mobile: null, //optional, can have multiple values[array]
		email: 'coffsgas@hotmail.com', //optional, can have multiple values[array] 
		address: '1/92 Industrial Drive, Coffs Harbour NSW 2450', //optional, single value
		hours: [['Mon to Fri','7:30am-4:30pm'],['Saturday','8am-12pm'],['Sunday','Closed']] //optional
		
	});
  
     // View section_1
    $('#view_section_1').insertBefore('.footer');

    // View error div
    $('#error').insertBefore('.footer');  
    
    
    if ( $("body#contact").is("*") ) {

            // Contact Form
            $('#contact_form').smartCaptcha({
                validateText: ["name","phone","message"],
                validateEmail: ["email"],
                redirectLink: null,
                validateStyle: "default"
            });

            // Remove Slider
            $('#slider').remove();
        
            $(window).bind("load resize",function(){
                var width = $(window).width();
                if (width > 991) {
                    $('#map').insertAfter('#top-bar');
                } else {
                    $('#map').insertBefore('#intro-wrap');
                }
            });        

            // Map
            //$('#map').insertAfter('#top-bar');
        
            function map() {
              var myLatlng = new google.maps.LatLng(-30.31651, 153.08400);
              var image = 'http://cdn.myld.com.au/2/1517/coffs-gas-company_bd1cbae0ed.png';
              var mapOptions = {
                scrollwheel: false,
                zoom: 17,
                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();
            });            
        
        
    }    
     
}); 
