// JavaScript Document
var itemWidth = document.getElementById('showcase').offsetWidth;
var itemAnim = new YAHOO.util.Motion('wrapper', {
points: { by: [0,0] } 
}, .3, YAHOO.util.Easing.easeOut);

d = document.getElementsByTagName("div");
itemNum = 0;
for (a=0;a<d.length;a++) {
	itemNum = (d[a].className == 'item') ? itemNum + 1 : itemNum;
}

document.getElementById('wrapper').style.width = itemNum*itemWidth+'px';

function previtem() {
	b = (document.getElementById('wrapper').offsetLeft == 0) ? -(itemNum-1)*itemWidth : itemWidth;
	itemAnim.attributes.points = { by: [b,0] };
	itemAnim.animate();
}

function nextitem() {
	b = (document.getElementById('wrapper').offsetLeft == -(itemNum-1)*itemWidth) ? (itemNum-1)*itemWidth : -itemWidth;
	itemAnim.attributes.points = { by: [b,0] };
	itemAnim.animate();
}