$(document).ready(function() {
						   
		//Portfolio Images zoom effect
		var zoom_img;
		$(".portfolio_img").hover(function(){
									zoom_img = $(this).children(".zoom");
									zoom_img.stop(true, true).fadeIn();
							},
							function () {
									zoom_img.stop(true, true).fadeOut();
		});

		
		
		
		
		
		
		var $preferences
		jQuery(".content_page").each(function(){
									$preferences = {
												duration: 1000,
												easing: 'easeInOutQuad',
												attribute: function(v) {return $(v).attr('data-id')},
												enhancement: function() {
													if (!jQuery.browser.msie){
														Cufon.replace('h3', {
															fontFamily: 'PT Sans'
														});
													}
													var zoom_img;
												$(".portfolio_img").hover(function(){
																			zoom_img = $(this).children(".zoom");
																			zoom_img.stop(true, true).fadeIn();
																	},
																	function () {
																			zoom_img.stop(true, true).fadeOut();
																	});
												}
									};
		});
		
	  var $applications = $('.portfolio_items');
	// clone applications to get a second collection
	  var $data = $applications.clone();
	
	  // attempt to call Quicksand on every form change
	  jQuery('.source a',this).click(function(e){

					var clicked = $(this);
					
					$(".source a").removeClass("active")
					$(clicked).addClass("active")
	
					var $sorted_data
					e.preventDefault();
					if(jQuery(this).attr('data-value') == 'all'){
								$sorted_data = $data.find('.portfolio');
					}else{
								$sorted_data = $data.find('.portfolio[data-value*='+jQuery(this).attr('data-value')+']');	
					}

					// finally, call quicksand
					$applications.quicksand($sorted_data,$preferences, function() {
														
														$("a[rel^='prettyPhoto']").prettyPhoto({show_title: false});
									
														//Fix for IE Duplicated Text
														if (jQuery.browser.msie){
															//Disable Cufon
															$(".portfolio_info h3").each(function(index) {
																var text = $(this).text();
																$(this).text('');
																$(this).text(text);
																
															});
															//Reable Cufon
															Cufon.replace('h3', {
																fontFamily: 'PT Sans'
															});

														}
												
														
					});

		});
	
			

});
