// simple hide no animation
function hide(id){
    if (document.getElementById){
    obj = document.getElementById(id);
    obj.style.display = "none";
    }     }

// simple show no animation
function show(id){
    if (document.getElementById){
    obj = document.getElementById(id);
    obj.style.display = "";
    }    }

// jquery hide, show and toggle
function ajaxshow(id){	$(id).fadeIn("slow");	}
function ajaxhide(id){	$(id).fadeOut("slow");	}
function toggle(id){	$(id).slideToggle("fast"); }



//quicskand gallery categories filtering
jQuery(document).ready(function($){
 	// clone applications to get a second collection
	var $data = $(".gallery-content .container").clone();
 	//note: only filter on the main portfolio page, not on the subcategory pages
	$('.gallery-main li').click(function(e) {
		$(".filter li").removeClass("current-cat");
		//use the last category class as the category to filter by. This means that multiple categories are not supported (yet)
		var filterClass=$(this).attr('class').split(' ').slice(-1)[0];

		if (filterClass == 'all-items') {
			var $filteredData = $data.find('.gallery-item');
		} else {
			var $filteredData = $data.find('.gallery-item[data-type=' + filterClass + ']');
		}
		$(".gallery-content .container").quicksand($filteredData, {
			duration: 700,
			easing: 'easeInOutQuad'
		}, function(){
				//callback function to re-apply hover effects on cloned elements
                $("img.pthumb").hover(
                function() {  $(this).stop().animate({"opacity": "0.7"}, "slow");  },
                function() {  $(this).stop().animate({"opacity": "1"}, "slow");  });
                $("a[rel^='prettyPhoto']").prettyPhoto();
		});

		$(this).addClass("current-cat");
		return false;
	});
});

