function scroll(limit){
	var margin=parseInt($('Association_List').style.marginLeft.replace('px','').replace('-',''));
	if(margin < parseInt(limit) * 150 - 150){
		var sum=margin + 150;
		$('Association_List').style.marginLeft=-(sum)+'px';
	}
}
function scroll_left(limit){
	var margin=parseInt($('Association_List').style.marginLeft.replace('px','').replace('-',''));
	var sum=margin - 150;
	if(margin > 40){
		$('Association_List').style.marginLeft=-(sum)+'px';
	}
}
function add_after(id){
	
}
function remove_after(){
	accessories_close('close',cart);
}

function getAssociatedStock(man,mod,cat,ctid) {
	AssociatedStockButtons(man,mod,cat,ctid);
	CountAssociatedStock(man,mod,cat,ctid)
	var strURL	=url+"site_inc/AssociatedStock.inc.php?Make="+man+"&Model="+mod+"&Cat="+cat+"&ctid="+ctid+"&show=scroller&random="+Math.random();
	var req		= getXMLHTTP();
	var wait = '<div id="wait" style="height:171px;width:100%;text-align:center;font-size:12px;color:#6F6F6F;float:left;"><table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" height=\"100%\"><tr><td valign=\"middle\" style=\"text-align:center;\"><br />Loading Stock</td></tr></table></div>';

	$('associated_stock').innerHTML=wait;
	
	if (req) {
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				$('associated_stock').innerHTML=req.responseText;
			}
		}
		req.open("GET", strURL, true); 
		req.send(null);
	}
}
function CountAssociatedStock(man,mod,cat,ctid) {
	var strURL	=url+"site_inc/AssociatedStock.inc.php?Make="+man+"&Model="+mod+"&Cat="+cat+"&ctid="+ctid+"&show=count&random="+Math.random();
	var req		= getXMLHTTP();
	
	if (req) {
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				$('RightArrow').href="javascript:scroll('"+req.responseText+"');";
				$('LeftArrow').href="javascript:scroll_left('"+req.responseText+"');";
			}
		}
		req.open("GET", strURL, true); 
		req.send(null);
	}
}

function AssociatedStockButtons(man,mod,cat,ctid) {
	var strURL	=url+"site_inc/AssociatedStock.inc.php?Make="+man+"&Model="+mod+"&Cat="+cat+"&ctid="+ctid+"&show=buttons&random="+Math.random();
	var req		= getXMLHTTP();
	
	if (req) {
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				$('Associated_Stock_Buttons').innerHTML=req.responseText;
			}
		}
		req.open("GET", strURL, true); 
		req.send(null);
	}
}

