// Beat Fly JS Core Document
$(document).ready(function() {
	//inizialize equalHeight Function
	equalHeight($(".box"));
	
	//hover effect
	$('.feat_item img').hover(function() {
		$(this).stop().animate({
			opacity : 0.5
		}, 500);
		},
		function(){
		$(this).stop().animate({
			opacity : 1
		}, 500);
	});
	
	//pseudo-class
	$('.col1of4:first-child').addClass('first');
		
	//filter
	$('ul#filter a').click(function() {
		$(this).css('outline','none');
		$('ul#filter .current').removeClass('current');
		$(this).parent().addClass('current');
		
		var filterVal = $(this).text().toLowerCase().replace(' ','-');
				
		if(filterVal == 'all') {
			$('.portfolioThumb.hidden').fadeIn('slow').removeClass('hidden');
		} else {
			
			$('.portfolioThumb').each(function() {
				if(!$(this).hasClass(filterVal)) {
					$(this).fadeOut('normal').addClass('hidden');
				} else {
					$(this).fadeIn('slow').removeClass('hidden');
				}
			});
		}
		
		return false;
	});
		
	//rss feed blog
	$('#blog').rssfeed('http://feeds.feedburner.com/BeatFlyBlog', {
		header: false,
		titletag: 'h6',
		content: false,
		linktarget: '_blank',
		showerror: true,
		errormsg: 'Feed momentaneamente non disponibile!',
		limit: 4
	});
	
	//rss feed elements
	$('#elements').rssfeed('http://www.elements01.net/feed', {
		header: false,
		titletag: 'h6',
		content: false,
		linktarget: '_blank',
		showerror: true,
		errormsg: 'Feed momentaneamente non disponibile!',
		limit: 4
	});
	
	//rss feed laura gatto
	$('#laura').rssfeed('http://www.lauragatto.net/feed/rss', {
		header: false,
		titletag: 'h6',
		content: false,
		linktarget: '_blank',
		showerror: true,
		errormsg: 'Feed momentaneamente non disponibile!',
		limit: 4
	});
		
	//bookmark
	$("a.jQueryBookmark").click(function(e){
		e.preventDefault(); // this will prevent the anchor tag from going the user off to the link
		var bookmarkUrl = this.href;
		var bookmarkTitle = this.title;
		 
		if (window.sidebar) { // For Mozilla Firefox Bookmark
			window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
		} else if( window.external || document.all) { // For IE Favorite
			window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
		} else if(window.opera) { // For Opera Browsers
			$("a.jQueryBookmark").attr("href",bookmarkUrl);
			$("a.jQueryBookmark").attr("title",bookmarkTitle);
			$("a.jQueryBookmark").attr("rel","sidebar");
		} else { // for other browsers which does not support
			 alert('Your browser does not support this bookmark action');
			 return false;
		}
	});
					 		
	//focus form
	$("#name").focus();
	
	//scrolling up
	$('.anchorLink').click(function(){
		$('html, body').animate({
			scrollTop: $("#logo").offset().top
			}, 1000);				   
	});
				
});//end

//equalHeight Function
function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
			if(thisHeight > tallest) {
				tallest = thisHeight;
			}
	});
	group.height(tallest);
}
