function compare(carID,action,type){

 document.getElementById("sidecontent").style.display = "block"; 
 
 if(action=='add'){
	$.ajax({
		type: "GET",
		url: '/compare.cgi?action=checklimit&type='+type+'&carID='+carID,	  cache:false,	  success: function(data) {
			var test=data;
			if(test=='maxlimit'){
				alert("Max Limit of 4 Vehicles Shortlisted Reached. To Add other Vehicles to the Shortlist please delete one of the current ones.");
			}
		},
		dataType: "html"
	
	});

	var barWidthTest="924";
	var speedTest="slow";
	$('#sidecontentslider0').animate({ width: barWidthTest + "px" }, speedTest).addClass("expanded");
}

	if(action=='loadsl'){
		var barWidthTest="924";
		var speedTest="slow";
		$('#sidecontentslider0').animate({ width: barWidthTest + "px" }, speedTest).addClass("expanded");
	}
	
	
	$.ajax({
	 	type: "GET",	  
		url: '/compare.cgi?action='+action+'&type='+type+'&carID='+carID,  cache:false,	  success: function(data) {
				$('.result').html(data);	
			$("a.greybox").click(function(){
	          var t = this.title || $(this).text() || this.href;
	          GB_show(t,this.href,610,610);
	          return false;
	        });	  
			
		
		},
		dataType: "html"	
	});

//	alert(data);
 
}

function opensl(){

	document.getElementById("sidecontent").style.display = "block"; 

	$.ajax({
		type: "GET",
		url: '/compare.cgi?action=&type=&carID=',	  cache:false,	  success: function(data) {
			$('.result').html(data);
			$("a.greybox").click(function(){
	          var t = this.title || $(this).text() || this.href;
	          GB_show(t,this.href,610,610);
	          return false;
	        });	  	
		},
		dataType: "html"
	
	});

	var barWidthTest="924";
	var speedTest="slow";
	$('#sidecontentslider0').animate({ width: barWidthTest + "px" }, speedTest).addClass("expanded");


}


function closesl(){
	var barWidthTest="0";
	var speedTest="slow";
	$('#sidecontentslider0').animate({ width: barWidthTest + "px" }, speedTest).removeClass("expanded");
}
 $(document).ready(function(){
		$("#sidecontent").sidecontent();

  });
