function showProjTitle(project) {
	var newsrc = "images/" + project + "-title.gif";
	$(project).src = newsrc;
}

function showProjThumb(project) {
	var newsrc = "images/" + project + "-1sm.jpg";
	$(project).src = newsrc;
}

YAHOO.scroller = function() {
	var $D = YAHOO.util.Dom;
	var $E = YAHOO.util.Event;
	var $M = YAHOO.util.Motion;
	var $ = $D.get;
	var pos = { 'single-family': 0,
		    'multi-family': 0,
	            'commercial': 0,
		    'parks-plazas' : 0,
		    'on-the-boards' : 0 };
	return {
    		init : function() { $E.on(['single-family-left', 'single-family-rght',
					   'multi-family-left', 'multi-family-rght',
                                           'commercial-left', 'commercial-rght',	
                                           'parks-plazas-left', 'parks-plazas-rght',	
					   'on-the-boards-left', 'on-the-boards-rght'], 'click', this.move);
				    if ( sectCounts['single-family'] <= 4 ) { $('single-family-rght').style.display = 'none'; }
				    if ( sectCounts['multi-family'] <= 4 ) { $('multi-family-rght').style.display = 'none'; }
				    if ( sectCounts['commercial'] <= 4 ) { $('commercial-rght').style.display = 'none'; }
				    if ( sectCounts['parks-plazas'] <= 4 ) { $('parks-plazas-rght').style.display = 'none'; }
				    if ( sectCounts['on-the-boards'] <= 4 ) { $('on-the-boards-rght').style.display = 'none'; }
				 },
    		move : function(e) { 
      			$E.stopEvent(e);
			var sect = this.id.slice(0, -5); 
			var dir = this.id.slice(-4);
			switch( dir ) {
				case 'left':
					if ( pos[sect] === 0 ) { return; }
					$(sect+'-rght').style.display = 'inline';
					var toMove = sect;
					var attributes = { points : { by : [ 97, 0 ] } }
					pos[sect]--;
					if ( pos[sect] === 0 ) { $(sect+'-left').style.display = 'none'; }	
				break;
				case 'rght':
					if ( pos[sect] === (sectCounts[sect] - 4) ) { return; }
					$(sect+'-left').style.display = 'inline';	
					var toMove = sect;
					var attributes = { points : { by : [ -97, 0 ] } }
					pos[sect]++;
					if ( pos[sect] === (sectCounts[sect] - 4) ) { $(sect+'-rght').style.display = 'none'; }
				break;
			}
			var anim = new $M(toMove, attributes, 0.1, YAHOO.util.Easing.easeOut);
			anim.animate();
		}
  	};
}();

YAHOO.util.Event.onAvailable('portfolioholder',YAHOO.scroller.init, YAHOO.scroller, true);
