// Add or remove id from cookie
function addCompare(item_id) {
	$("#compare_status").load("compare.php?add_item=" + item_id + "&random=" + Math.random());
	}
	
function removeCompare(item_id) {
	$("#compare_status").load("compare.php?remove_item=" + item_id + "&random=" + Math.random(), function(){
		$("#compare").load("compare_equip.php?random=" + Math.random());
		});
	//hideStuff('lightbox');
	//hideStuff('compare');
	}
	
function clearCompare() {
	$("#compare_status").load("compare.php?clear=y&random=" + Math.random());
	}

function showChart() {
	$("#compare").load("compare_equip.php?random=" + Math.random(), function(){
		hideStuff('dealer_search');
		showStuff('lightbox');
		showStuff('compare');		
		});
	}

function hideChart() {
	hideStuff('compare');
	hideStuff('lightbox');
	showStuff('dealer_search');
	}

// All-purpose hide and show functions
function showStuff(boxid){$("#"+boxid).fadeIn("slow");}
function hideStuff(boxid){$("#"+boxid).fadeOut("slow");}

function vote(item_id,stars,ip) {
	url = "compare_rate.php?ip_address=" + ip + "&item_id=" + item_id + "&rating=" + stars + "&random=" + Math.random();
	$("#stars").fadeOut("fast", function(){
		$("#status").load(url, function(){
			$("#stars").load("compare_stars.php?item_id=" + item_id + "&ip_address=" + ip + "&random=" + Math.random(), function(){
				$("#stars").fadeIn("fast");
				});
			});
		});
	}
