/* Author: Andy Mabbutt | Map/Directions: Johan van T - http://dreamdealer.nl/tutorials/getting_directions_with_google_maps.html

*/
//51.895904,-4.009375

$(document).ready(function(){
  $("body").removeClass("no-js");
  initialize(); 
});
var directionDisplay;
  var directionsService = new google.maps.DirectionsService();
  function initialize() {
    var latlng = new google.maps.LatLng(51.888783, -3.998594);//
    var pontbren = new google.maps.LatLng(51.895904,-4.009375);
	directionsDisplay = new google.maps.DirectionsRenderer();
    var myOptions = {
      zoom: 14,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      mapTypeControl: false
    };
    var map = new google.maps.Map(document.getElementById("map"),myOptions);
    directionsDisplay.setMap(map);
    directionsDisplay.setPanel(document.getElementById("directionsPanel"));
    var marker = new google.maps.Marker({
      position:pontbren ,//latlng
      map: map,
	  title:"Pontbren Web Services"
      
    });
  }
  
//  function calcRoute() {
//    var start = document.getElementById("routeStart").value;
//    var end = "51.895904,-4.009375";
//    var request = {
//      origin:start,
//      destination:end,
//      travelMode: google.maps.DirectionsTravelMode.DRIVING
//    };
//    directionsService.route(request, function(response, status) {
//      if (status == google.maps.DirectionsStatus.OK) {
//        directionsDisplay.setDirections(response);
//      }
//    });
//  }
  
  
//PORTFOLIO SLIDES  
  $(window).load(function() {
    $('.flexslider').flexslider({
          manualControls: '.custom-controls li a',
          controlsContainer: '.flex-container',
		  slideshow: false
		  //pausePlay: true,
    });

//TABS 
        $('html, body').animate({scrollTop:0});
        $('.features').css({'position':'relative','top':'0','left':'0'});
        $(".features article").hide(); // Hide all content on page load
    var hash = document.URL.split('#')[1];
	if(location.hash) { // Hash present in URL
        $(location.hash).show(); // Show the tab's content
        $(".features>ul li a[href=#"+hash+"]").parent().addClass("active"); // Mark the tab as active
    } else {
        $(".features>ul li:first").addClass("active").show(); //Activate first tab
        $(".features article:first").show(); //Show first tab content
    }
    
        //On Click Event
    $(".features>ul li").click(function() {
        
        $(".features>ul li").removeClass("active"); //Remove any "active" class
        $(this).addClass("active"); //Add "active" class to selected tab
        $(".features article").hide(); //Hide all tab content
        
        var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab content
        location.hash = activeTab; //Add the anchor to the url (for refresh)
        $(activeTab).fadeIn(); //Fade in the active ID content
		return false;
    });

 
  });
  
  



