

// hover fade
jQuery(document).ready(function() {
	//prevent to load the fade effect on IE8 (poor quality)
	//add the class "fade-hover" to any element you want to add the Fade effect
	if (!($.browser.msie  && parseInt($.browser.version) < 9)) {
		jQuery(".befla_fade-hover, .featured-image.befla_icon_picture img, .featured-image.befla_icon_video img, .featured-image.befla_icon_html img, .befla_social a").hover(
			function() {
				jQuery(this).fadeTo(300, 0.5, 'easeOutQuad');
			},
			function() {
				jQuery(this).fadeTo(400, 1, 'easeInQuad');
			}
		);
	}
	jQuery(".befla_grayscale_thumb img").hover(
		function() {
			jQuery(this).fadeTo(400, 0, 'easeOutQuad');
		},
		function() {
			jQuery(this).fadeTo(500, 1, 'easeInQuad');
		}
	);
});


/*--- Portfolio Filter ---*/
jQuery(document).ready(function() {
	//start when the link is clicked
	jQuery(".ul-portfolio-categories a").click(function() {
		jQuery(this).css("outline","none");
		jQuery(".ul-portfolio-categories .selected").removeClass("selected");
		jQuery(this).parent().addClass("selected");

		//get the link value
		var preFilterVal = jQuery(this).text();
		//set the path to the AJAX sanitizer
		var sanitizeUrl = 'http://erlach.de/wp-content/themes/befla_delux/includes/sanitize.php';
		//get the sanitized link via AJAX (with sanitize_title() wordpress function) and starts the magic
		jQuery.get(sanitizeUrl, {slug: preFilterVal}, function (data) {
			var filterVal = data;
			//no conflict
			var filterVal = '.skill_' + filterVal;

			//when click All, show all
			if(filterVal == ".skill_alle") {
				jQuery('.befla_portfolio_masonry').isotope({ filter: '*' });
			}

			//show portfolio items by skill
			else {
				jQuery('.befla_portfolio_masonry').isotope({ filter: filterVal });
			}
		});
		return false;
	});
});


/*-------------------------------------------------*/
/*	Custom Javascripts
/*-------------------------------------------------*/

