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

//Javascripts
$(document).ready(function(){ 
  $.favicon('http://cdn.myld.com.au/2/1861/readycut-screens-doors_e209738b3e.png');
	
	menu.contactDetails({
		
		phone: '0889470471', //optional, can have multiple values[array] 
		mobile: '0438844661', //optional, can have multiple values[array]
		email: 'admin@ntreadycut.com.au', //optional, can have multiple values[array] 
		address: '90 Connawarra Rd Winnellie, NT 0821', //optional, single value
		hours: [['Mon to Fri','7:00am-4:30pm']] //optional
		
	});
    
    
    // View section_1
    $('#view_section_1').insertBefore('.footer');

    // View error div
    $('#error').insertBefore('.footer');
    
    // Slider
    $("#slider").backstretch([
      "http://cdn.myld.com.au/2/1861/readycut-screens-doors_0dd4a3f86e.jpg",
      "http://cdn.myld.com.au/2/1861/readycut-screens-doors_0c3ffb8423.jpg"    
    ], {duration: 3000, fade: 750, random: true});    
    
    $('.match').matchHeight();
    
    // Products
    if ( $("body#products").is("*") ) {
        
        // 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
            });

        }
        
    }
    
    
    // CONTACT
    if ( $("body#contact-us").is("*") ) {
        
        $('#footer-top').removeClass().remove();

        // 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(-12.43110, 130.88244);
          var image = 'http://cdn.myld.com.au/2/1861/readycut-screens-doors_ac05da48ed.png';
          var mapOptions = {
            scrollwheel: false,
            zoom: 8,
            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 {
        //Contact FORM
        $('#contact_form').formValidation({ 
          validateText: ["name","phone","enquiry"],
          validateEmail: ["email"],
          validateSpam: true,
          captchaTheme: 'dark'
        });      
        
        $('#footer_form').smartCaptcha({
            validateText: ["name","phone","message"],
            validateEmail: ["email"],
            redirectLink: null,
            validateStyle: "default"
        });
        
        
    }
    
    
     
}); 

$(window).load(function() {
    $('#jmm-content').css({"background": "transparent"});
});
