//======================================
//=== Open Category
function openCategory(argID) {
	var e_cat = $('#cat'+ argID);
	
	if (i_active_category > 0) {
		closeCategory(i_active_category);
		}	
	
	if (e_cat.css('display') == 'block') {
		closeCategory(argID);
		i_active_category = 0
		}
	else {
		$('#titlecat'+ argID).addClass('title active');
		
		e_cat.slideDown(900,'easeout');
		
		i_active_category = argID
		}
	}
	
//======================================
//=== Close Category
function closeCategory(argID) {
	var e_cat = $('#cat'+ argID);
	
	if (e_cat.css('display') == 'none') {
		openCategory(argID);
		}
	else {
		$('#titlecat'+ argID).removeClass('title active');
		$('#titlecat'+ argID).addClass('title');
		
		e_cat.slideUp(900,'easeout');
		}
	}
	
//======================================
//=== Load Sub Category
function loadSubCategory(argID) {
	var e_cat = $('subcat'+ argID);
	
	if (i_active_sub_category > 0)
		closeSubCategory(i_active_sub_category);
	
	e_cat.className = 'active';
	
//	alert('argID='+ argID);
	}
	
//======================================
//=== Close Sub Category
function closeSubCategory(argID) {
	var e_cat = $('subcat'+ argID);
	
	e_cat.className = '';
	}
	
//======================================
//=== Load Page
function loadPage(argID) {
	ASP.ic_template_subpage_portfolio.DisplayPortfolioDetails(argID,loadPage_callback);
	}

function loadPage_callback(res) {
	if(res) {
		if(res.value.Rows.length > 0) {
			$('#portfolio-title').html(res.value.Rows[0]['title']);
			$('#portfolio-website').html(res.value.Rows[0]['website']);
			document.title = res.value.Rows[0]['title'].replace('&nbsp;','') +' - Imulus | An Interactive Agency';
			}
		}
}
	
//======================================
//=== Pause Portfolio
function pausePortfolio() {
	$('#portfolio-container').cycle('pause');
	}

//======================================
//=== Resume Portfolio
function resumePortfolio() {
	$('#portfolio-container').cycle('resume');
	}
