var currentView 		= '';
var currentCategory 	= '';

function changeView(switchView) {
	currentView = switchView;
	$('.portfolio-content').html('<img src="/images/loading.gif" alt="Loading..." /> Loading ...');
	$.get('/ajax/portfolio.asp', { category: currentCategory, view: currentView }, function( data ) {
		$('.portfolio-content').html(data);
		bindRollovers();
	});
	return false;
}

function changeCategory(switchCategory) {
	currentCategory = switchCategory;
	$('.portfolio-content').html('<img src="/images/loading.gif" alt="Loading..." /> Loading ...');
	$.get('/ajax/portfolio.asp', { category: currentCategory, view: currentView }, function( data ) {
		$('.portfolio-content').html(data);
		bindRollovers();
	});
	return false;
}

function changePage(switchView, switchPage) {
	$('.portfolio-content').html('<img src="/images/loading.gif" alt="Loading..." /> Loading ...');
	$.get('/ajax/portfolio.asp', { category: currentCategory, view: switchView, page: switchPage }, function( data ) {
		$('.portfolio-content').html(data);
		bindRollovers();
	});
	return false;
}

function bindRollovers() {
	$('.portfolio-preview').bind('mouseenter', function() {
		$('.portfolio-preview-overlay', this).css('opacity', '0.8');
		$('.portfolio-preview-overlay', this).show();
	})
	
	$('.portfolio-preview').bind('mouseleave', function () {
		$('.portfolio-preview-overlay', this).hide();
	});
}

$(document).ready(function() {
	changeView('Featured'); 
	currentView  = 'All'; 
});