function updateBoxes()
{
	for (var i = 0; i < blocks.length; i++) {
		if (da[blocks[i]] != undefined) {
			if (da[blocks[i]][da_index[i]] == undefined) {
				if(da_index[i] < 2)
					continue;       
				else
					da_index[i] = 0;
			}
			
			var html = '<a href="car?id=' + da[blocks[i]][da_index[i]].id + '" title="' + da[blocks[i]][da_index[i]].title + '" target="_blank"><img src="';
			if (da[blocks[i]][da_index[i]].img != '') {
				html += da[blocks[i]][da_index[i]].img;
			} else {
				html += 'img/no-car-photo.jpg';
			}
			html += '" width="120" height="90" alt="" title="" /></a>';
            html += '<div class="featured_name">' + da[blocks[i]][da_index[i]].title + '</div>';
            html += '<div class="featured_price">$' + da[blocks[i]][da_index[i]].price + '</div>';
			
			$j('#' + blocks_id[i]).html(html);

			da_index[i]++;
		}
	}
}

function rotateBoxes()
{
	updateBoxes();
	if (da_index != undefined && da_timer != null) {
		clearTimeout(da_timer);
	}
	da_timer = setTimeout(rotateBoxes, da_interval);
}

function initHomePageSpecials()
{
	for (var i = 0; i < blocks.length; i++) {
		if (da[blocks[i]] == undefined) {
			var html = '<img src="img/no-car.jpg" width="120" height="90" alt="" title="" />';
			$j('#' + blocks_id[i]).html(html);
		}
	}
	updateBoxes();
	da_timer = setTimeout(rotateBoxes, da_interval);
}

