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

// Custom JavaScript Document

$(document).ready(function(){  
  
  $('head').append('<link rel="shortcut icon" type="image/x-icon" href="http://cdn.myld.com.au/2/504/myld-training-2_93ede3191c.ico">');
  
  $('.nav li:nth-child(3)').append(' <ul>\
                                              <li><a href="security-management">Security Management</a></li>\
                                              <li><a href="crowd-safety">Crowd Safety</a></li>\
                                              <li><a href="alarm-response">Alarm Response</a></li>\
                                              <li><a href="event-management">Event Management</a></li>\
                                              </ul>');
$('#logo').html('<a class="brand" href="/" title=""><img src="http://cdn.myld.com.au/2/503/myld-training-2_374fb7cb5a.png"></a>').prependTo('.logo-here');
$('.navbar').prependTo('.nav-here');
$('#header').prependTo('body');
$('body').children('#header, section, div').wrapAll('  <div id="wrapper" class="container"></div>');
$('#sponsors').appendTo('#wrapper');

  //********Windows IE8 and below popup*********//   		     		
	$("body").browserDetect( {     	
		name: "G&T Security",     
		logo: " http://cdn.myld.com.au/2/502/myld-training-2_d10f24202d.jpg",      
		phone: ": (07) 4723 5615",     //optional
		fax: "(07) 4723 5615",      //optional
		email: "admin@gtsecurity.com.au",      //optional
		address: "14 Golf Links Drive, Kirwan, Townsville, Queensland, Australia 4817",  //optional	
		ldprofile: "http://www.localdirectories.com.au/Townsville-Area,QLD/G-T-Security/profile/KzYh"  
	});  

	//********Mobile Telephone*********//  
	mobileTel(413188313); //edit phone number
  
  
  var is_chrome = navigator.userAgent.indexOf('Chrome') > -1;
  var is_explorer = navigator.userAgent.indexOf('MSIE') > -1;
  var is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
  var is_safari = navigator.userAgent.indexOf("Safari") > -1;
  var is_Opera = navigator.userAgent.indexOf("Presto") > -1;
  if ((is_chrome)&&(is_safari)) {is_safari=false;}
  if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
    $('#need_aligning').css({
      position: 'relative',
      top: '12px'
    });
  }
  if ( $.browser.msie ) {
    var ua = parseInt(jQuery.browser.version.substring(0, 2));
    if ( ua > 8 ) {
      $('.navbar .nav').css({
        minHeight: '65px'
      });
      $('#testimonials .sponsors .grid-2, #our-clients .sponsors .grid-2').css({
        margin: '0 1.3%'
      });
    }
  }
	
  
  //Background slideshow
// You may also attach Backstretch to a block-level element
$("body").backstretch("http://cdn.myld.com.au/2/504/myld-training-2_1f70dc9978.jpg");

$('.flexslider').flexslider({
	randomize: true,
  prevText: " ",           //String: Set the text for the "previous" directionNav item
  nextText: " ",
});

$('.flex-prev, .flex-next').text('');

$('#custom_form').formValidation({ 
  validateText: ["first-name","last-name","phone","state"],
  validateEmail: ["email"],
  validateSpam: true
}); 


function mapcanvas() {
  var myLatlng = new google.maps.LatLng(-19.31618, 146.71076);
  var mapOptions = {
    zoom: 13,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  
  if ($('#map-canvas').length > 0) {
      var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
      var image = 'http://cdn.myld.com.au/2/479/myld-training-2_d7a31b67c1.png';
    
      var marker = new google.maps.Marker({
          position: myLatlng,
          map: map,
          icon: image
      });
  }
}

google.maps.event.addDomListener(window, 'load', mapcanvas);

});