(function($){

	$(document).ready(function(){
	
		$('.map-container').click(function(){
			$(this).find('iframe').addClass('clicked');
		})
		.mouseleave(function(){
			$(this).find('iframe').removeClass('clicked');
		});
	
		setInterval( "redirect()", 4000 );

		/* Recent Events */
		
		$('#serv_menu li a').removeClass('serv-active');

		if($('body').hasClass('page-id-34')){
			$('#423').addClass('serv-active');
		}
		else if($('body').hasClass('page-id-717')){
			$('#45').addClass('serv-active');
		}
		else if($('body').hasClass('page-id-720')){
			$('#46').addClass('serv-active');
		}
		else if($('body').hasClass('page-id-723')){
			$('#47').addClass('serv-active');
		}
		else if($('body').hasClass('page-id-725')){
			$('#48').addClass('serv-active');
		}
		else if($('body').hasClass('page-id-727')){
			$('#49').addClass('serv-active');
		}

		/* Button */

		$('#intro .btn').on('click',function(){
			$('.more').slideToggle();
		});

		/* AJAX Services */

		/*$('#serv_menu li:nth-child(1) a').addClass('serv-active')

		/*	var target = $('#serv_menu li .serv-active').prop('id');

			console.log(target);

            $.ajax({
				url:url.ajax,
				data: {
					'action':'get_single_service',
					'target' :  target
				},
				success:function(data) {
					// This outputs the result of the ajax request
					$('#single_service .entry-content-wrapper section .avia_codeblock').html(data);

					var single_service_height = jQuery('#single_service .col2-3').outerHeight();
					jQuery('#single_service .col1-3').css('height',single_service_height+'px');
				},
				error: function(errorThrown){
					console.log(errorThrown);
				}
			});
       	 return false;*/


       	 /* SERVICE AJAX ON LOAD */


       	/*$('#serv_menu li:nth-child(1) a').addClass('serv-active');
		var target = $('#serv_menu li a').attr('id');

		console.log(target);

        $.ajax({
			url:url.ajax,
			data: {
				'action':'get_single_service',
				'target' :  target
			},
			success:function(data) {
				// This outputs the result of the ajax request
				$('#single_service .entry-content-wrapper section .avia_codeblock').html(data);

				/*var single_service_height = jQuery('#single_service .col2-3').outerHeight();
				jQuery('#single_service .col1-3').css('height',single_service_height+'px');*/
			/*},
			error: function(errorThrown){
				console.log(errorThrown);
			}
		});



       	 /************************/
        /*$(".serv-click").click(function(e){
			e.preventDefault();
			//$('#single-post-container').html("content loading");
			$('#serv_menu li a').removeClass('serv-active');
			$(this).addClass('serv-active');
			var target = $(this).prop('id');

            $.ajax({
				url:url.ajax,
				data: {
					'action':'get_single_service',
					'target' :  target
				},
				success:function(data) {
					// This outputs the result of the ajax request
					$('#single_service .entry-content-wrapper section .avia_codeblock').html(data);

					/*var single_service_height = jQuery('#single_service .col2-3').outerHeight();
					jQuery('#single_service .col1-3').css('height',single_service_height+'px');*/
				/*},
				error: function(errorThrown){
					console.log(errorThrown);
				}
			});
       	 return false;
        });*/

	});

 })(jQuery); 
 
 function redirect(){
	if (jQuery('body').hasClass('page-id-813')){
		 window.location="https://www.blacksnowevents.co.za";
	};
}

/*function initialize() {

        var myLatLng = {lat: -26.059503, lng: 27.9737186};

        var marker;

        var pin = "http://clientbeta.co.za/clients/www.blacksnowevents2016.co.za/wp-content/themes/enfold/images/map-marker-1.png";
				
		var map = new google.maps.Map(document.getElementById('map'), {
            zoom: 17,
            scrollwheel: false,
            center: myLatLng
		});

		var marker = new google.maps.Marker({
				map: map,
				position: myLatLng,
				draggable: false,
				icon:pin,
				animation: google.maps.Animation.DROP
		});
		
		marker.setMap(map);

// Zoom to 9 when clicking on marker
google.maps.event.addListener(marker,'click',function() {
  map.setZoom(9);
  map.setCenter(marker.getPosition());
  });
}
google.maps.event.addDomListener(window, 'load', initialize);*/
