text: // If JavaScript is enabled remove 'no-js' class and give 'js' class
  jQuery('html').removeClass('no-js').addClass('js');
  
  // Add .osx class to html if on Os/x
  if ( navigator.appVersion.indexOf("Mac")!=-1 ) 
  	jQuery('html').addClass('osx');
  
  // When DOM is fully loaded
  jQuery(document).ready(function($) {
  
  /* --------------------------------------------------------	
  	 External Links
     --------------------------------------------------------	*/	
  
  	(function() {
  	    $(window).load(function() {
  			$('a[rel=external]').attr('target','_blank');	
  		});                                            
  	})();  
  
  /* --------------------------------------------------------	
  	 Tooltips
     --------------------------------------------------------	*/	
  
  	(function() {
      $('body').tooltip({
          delay: { show: 300, hide: 0 },
          selector: '[data-toggle=tooltip]:not([disabled])'
      });
    })(); 
     
  /* --------------------------------------------------------	
  	 Responsive Navigation
     --------------------------------------------------------	*/	
  	
  	(function() {
  
  		var $mainNav    = $('.navbar .nav'),
  			responsiveNav = '';
  
  		// Responsive nav
  		$mainNav.find('li').each(function() {
  			var $this   = $(this),
  				$link = $this.children('a'),
  				depth   = $this.parents('ul').length - 1,
  				indent  = '';
  
  			if( depth ) {
  				while( depth > 0 ) {
  					indent += ' - ';
  					depth--;
  				}
  			}
  
  			if ($link.text())
  				responsiveNav += '<option ' + ($this.hasClass('active') ? 'selected="selected"':'') + ' value="' + $link.attr('href') + '">' + indent + ' ' + $link.text() + '</option>';
  
  		}).end().after('<select class="nav-responsive">' + responsiveNav + '</select>');
  
  		$('.nav-responsive').on('change', function() {
  			window.location = $(this).val();
  		});
  			
  	})();      
  
  /* --------------------------------------------------------	
  	 Gallery 
     --------------------------------------------------------	*/	
  
     (function() {
  		$(window).load(function(){
  			// container
  			var $container = $('#portfolio-items');
  			function filter_projects(tag)
  			{
  			  // filter projects
  			  $container.isotope({ filter: tag });
  			  // clear active class
  			  $('li.active').removeClass('active');
  			  // add active class to filter selector
  			  $('#portfolio-filter').find("[data-filter='" + tag + "']").parent().addClass('active');
  			  // update location hash
  			  if (tag!='*')
  				window.location.hash=tag.replace('.','');
  			  if (tag=='*')
  			  	window.location.hash='';
  			}
  			if ($container.length) {
  				// conver data-tags to classes
  				$('.project').each(function(){
  					$this = $(this);
  					var tags = $this.data('tags');
  					if (tags) {
  						var classes = tags.split(',');
  						for (var i = classes.length - 1; i >= 0; i--) {
  							$this.addClass(classes[i]);
  						};
  					}
  				})
  				// initialize isotope
  				$container.isotope({
  				  // options...
  				  itemSelector : '.project',
  				  layoutMode   : 'fitRows'
  				});
  				// filter items
  				$('#portfolio-filter li a').click(function(){
  					var selector = $(this).attr('data-filter');
  					filter_projects(selector);
  					return false;
  				});
  				// filter tags if location.has is available. e.g. http://example.com/work.html#design will filter projects within this category
  				if (window.location.hash!='')
  				{
  					filter_projects( '.' + window.location.hash.replace('#','') );
  				}
  			}
  		})
  
  	})();
  
  /* --------------------------------------------------------	
  	 Footer Contact Form
     --------------------------------------------------------	*/	
  
  	$('#send').click(function(){ // when the button is clicked the code executes
  		$('.error').fadeOut('slow'); // reset the error messages (hides them)
  
  		var error = false; // we will set this true if the form isn't valid
  
  		var name = $('input#name').val(); // get the value of the input field
  		if(name == "" || name == " " || name == "Name") {
  			$('#err-name').fadeIn('slow'); // show the error message
  			error = true; // change the error state to true
  		}
  
  		var email_compare = /^([a-z0-9_.-]+)@([da-z.-]+).([a-z.]{2,6})$/; // Syntax to compare against input
  		var email = $('input#email').val(); // get the value of the input field
  		if (email == "" || email == " " || email == "E-mail") { // check if the field is empty
  			$('#err-email').fadeIn('slow'); // error - empty
  			error = true;
  		}else if (!email_compare.test(email)) { // if it's not empty check the format against our email_compare variable
  			$('#err-emailvld').fadeIn('slow'); // error - not right format
  			error = true;
  		}
      
  		var message = $('textarea#message').val(); // get the value of the input field
  		if(message == "" || message == " " || message == "Message") {
  			$('#err-message').fadeIn('slow'); // show the error message
  			error = true; // change the error state to true
  		} 
  
  		if(error == true) {
  			$('#err-form').slideDown('slow');
  			return false;
  		}
  
  		var data_string = $('#ajax-form').serialize(); // Collect data from form
  		//alert(data_string);
  
  		$.ajax({
  			type: "POST",
  			url: $('#ajax-form').attr('action'),
  			data: data_string,
  			timeout: 6000,
  			error: function(request,error) {
  				if (error == "timeout") {
  					$('#err-timedout').slideDown('slow');
  				}
  				else {
  					$('#err-state').slideDown('slow');
  					$("#err-state").html('An error occurred: ' + error + '');
  				}
  			},
  			success: function() {
  				//$('#ajax-form').slideUp('slow');
  				$('#ajaxsuccess').slideDown('slow');
          $('#ajaxsuccess').delay(4000);
          $('#ajaxsuccess').fadeOut(1000);
  
          $("#name").val('');
          $("#email").val('');
          $("#message").val('');
  			}
  		});
  
  		return false; // stops user browser being directed to the php file
  	}); // end click function
  
  /* --------------------------------------------------------	
  	 Flex Initialize
     --------------------------------------------------------	*/	
  
  $(window).load(function() {
    $('.slider1').flexslider({ 
      animation: "slide",
      start: function(slider){
        $('body').removeClass('loading');
      }, 
    });
  
    $('.slider2').flexslider({
      animation: "slide",
      slideshow: false,
      animationLoop: false    
    });
  });
    
  });
  
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  
    ga('create', 'UA-10146041-21', 'auto');
    ga('send', 'pageview');
  