function init_portfolio(id, total, width, speed, interval, fade){
	//document.getElementById(id+'_previous_link').style.display="block";
	//document.getElementById(id+'_next_link').style.display="block";
	//document.getElementById(id+'_count').style.display="block";
	document.getElementById(id+'_portfolio_html_wrapper').style.overflow='hidden';
	document.getElementById(id+'_portfolio_html_wrapper').style.width=width+'px';
	window[id+'total']=total;
	window[id+'current']=1;
	window[id+'interval']=interval;
	window[id+'width']=width;
	window[id+'fade']=fade;
	var wrapper=id+'_scrolling_wrapper'
	document.getElementById(wrapper).style.width=width*total+'px';
	document.getElementById(wrapper).style.position="absolute";
	window[id+'_transition'] = new Fx.Tween(wrapper, {duration: speed, transition: Fx.Transitions.Quad.easeInOut});
	for(i=1;i<=total;i++){
		document.getElementById(id+'_portfolio_container_'+i).style.width=window[id+'width']+"px";
		//document.getElementById(id+'_left_'+i).style.width='162px';
		document.getElementById(id+'_portfolio_container_'+i).style.position="absolute";
		document.getElementById(id+'_portfolio_container_'+i).style.float="none";
		document.getElementById(id+'_portfolio_container_'+i).style.top="0px";
		document.getElementById(id+'_portfolio_container_'+i).style.left=(i-1)*window[id+'width']+"px";
	};
	window[id+'auto_interval']=setInterval('auto_portfolio("'+id+'")',window[id+'interval']);
	//check_active_button(id);
}

function previous_portfolio(id){
	if(window[id+'current']!=1){
		clearInterval(window[id+'auto_interval']);
		window[id+'current']=window[id+'current']-1;
		position = ((window[id+'current']-1)*window[id+'width'])*-1 +'px';
		window[id+'_transition'].start('left', position);
		window[id+'auto_interval']=setInterval('auto_portfolio("'+id+'")',window[id+'interval']);
		//check_active_button(id);
	}
}

function next_portfolio(id){
	if(window[id+'current']!=window[id+'total']){
		clearInterval(window[id+'auto_interval']);
		window[id+'current']=window[id+'current']+1;
		position = ((window[id+'current']-1)*window[id+'width'])*-1 +'px';
		window[id+'_transition'].start('left', position);
		window[id+'auto_interval']=setInterval('auto_portfolio("'+id+'")',window[id+'interval']);
		//check_active_button(id);
	};
}

function auto_portfolio(id){
		if(window[id+'current']==window[id+'total']){
			window[id+'modifier']=-1;
		}else if (window[id+'current']==1){
			window[id+'modifier']=1;
		}else{
			window[id+'modifier']=window[id+'modifier'];
		};
		window[id+'current']=window[id+'current']+window[id+'modifier'];
		position = ((window[id+'current']-1)*window[id+'width'])*-1 +'px';
		window[id+'_transition'].start('left', position);
		//check_active_button(id);
}

function jumpto(id,target){
	if(window[id+'current']!=target){
		clearInterval(window[id+'auto_interval']);
		window[id+'current']=target;
		position = ((window[id+'current']-1)*window[id+'width'])*-1 +'px';
		window[id+'_transition'].start('left', position);
		window[id+'auto_interval']=setInterval('auto_portfolio("'+id+'")',window[id+'interval']);
		//check_active_button(id);
	};
}
