jQuery(document).ready(function(){
// get the initial (full) list
var jQueryfilterList = jQuery('ul.portfolio-list');
// add unique id's
// i don't like having to write these all in the code
// so i wrote a script to id these for me
for(var i=0; i<jQuery('ul.portfolio-list li').length; i++){
jQuery('ul.portfolio-list li:eq(' + i + ')').attr('id','flitem' + i);
}
// clone first collection to get a second collection
var jQuerydata = jQueryfilterList.clone();
// handle trigger clicks
jQuery('#filterButtons a').click(function(e) {
if(jQuery(this).attr('rel') == 'all') {
// get a group of all items
var jQueryfilteredData = jQuerydata.find('li');
} else {
// get a group of items of a particular class
var jQueryfilteredData = jQuerydata.find('li.' + jQuery(this).attr('rel'));
}
// call quicksand
jQuery('ul.portfolio-list').quicksand(jQueryfilteredData, {
duration: 500,
attribute: function(v) {
// this is the unique id attribute we created above
return jQuery(v).attr('id');
}
}, function() {
		jQuery(document).ready(function(){
			jQuery("a[rel^='portfolio']").prettyPhoto({
                    theme: 'dark_square',
					overlay_gallery: false
                    });

                        });
jQuery(document).ready(function() {
	//On mouse over those thumbnail
	jQuery('.port_item_small, .port_item_large').hover(function() {
		//Display the caption
		jQuery(this).find('div.thumb_caption_small_photo, div.thumb_caption_small_video, div.thumb_caption_large_photo, div.thumb_caption_large_video').stop(false,true).fadeIn(500);
	},
	function() {
		//Reset the image
		jQuery(this).find('img').stop(false,true).animate({'width':jQuery('.port_item_small, .port_item_large').width(), 'height':jQuery('.port_item_small, .port_item_large').height(), 'top':'0', 'left':'0'}, {duration:100});	

		//Hide the caption
		jQuery(this).find('div.thumb_caption_small_photo, div.thumb_caption_small_video, div.thumb_caption_large_photo, div.thumb_caption_large_video').stop(false,true).fadeOut(500);
	});

});
                
});
e.preventDefault();
});
});


function button_hover_shortcode(){
	$('.button_link,button[type=submit],button,input[type=submit],input[type=button],input[type=reset]').hover(
		function() {
				$(this).stop().animate({opacity:0.7},400);
			},
			function() {
				$(this).stop().animate({opacity:1},400);
		});
}

$(document).ready(function() {
	if(!$.browser.msie){button_hover_shortcode();}
	
	});

//tabs and accordions

jQuery(function() { 

	jQuery(".accordion").fptabs("div.pane", {tabs: '.tab', effect: 'slide', initialIndex: 9999});
	jQuery("ul.tabs").fptabs("div.panes > div", {effect: 'fade'});
	

//toggles

jQuery(".toggle_title").toggle(
		function(){
			jQuery(this).addClass('toggle_active');
			jQuery(this).siblings('.toggle_content').slideDown("fast");
		},
		function(){
			jQuery(this).removeClass('toggle_active');
			jQuery(this).siblings('.toggle_content').slideUp("fast");
		}
	);
});


// alsidertext latest tweets

jQuery(document).ready(function(){
		jQuery('.tweets_list').aSliderText({
				updateTime: 5000,
				height: 10,
				element: 'li'
		});
		
	});
	
// superfish menu
		jQuery(function(){
			jQuery('ul.sf-menu').superfish({
			animation: {height:'show'}	
			});
			
		});	


jQuery(document).ready(function(){
			jQuery("a[rel^='portfolio'], a[rel^='gallery_img']").prettyPhoto({
                    theme: 'dark_square',
					overlay_gallery: false
                    });
                });
				
jQuery(document).ready(function(){
			jQuery("a[rel^='gallery_img']").prettyPhoto({
                    theme: 'dark_square',
					overlay_gallery: true
                    });
                });

//tooltip

jQuery(document).ready(function(){  
jQuery(".tool_tip_content").hover(function() {
jQuery(this).next(".tooltip").stop(true, true).animate({opacity: "show", bottom: "20"}, "slow");
}, function() {
jQuery(this).next(".tooltip").animate({opacity: "hide", bottom: "20"}, "fast");
});
   
 });
 
 jQuery(function() {
$('#vertical_tabs').tabs({ fx: [{opacity:'toggle', duration: 90},   // hide option
                        {opacity:'toggle', duration: 90}] }); // show option

});

$(document).ready(function() {
   
    $('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });

});

jQuery(document).ready(function() { //hides image and shows background loading image
    jQuery(".recent_project_loader img, .portfolio_small_thumb_shadow img, .portfolio_large_thumb_shadow img").css("display", "none");
});
jQuery(window).load(function() { //fades in image and hides loading image
    jQuery(".recent_project_loader img, .portfolio_small_thumb_shadow img, .portfolio_large_thumb_shadow img").fadeIn(500);
});


