function compareProcess(url, vars){
			$.post(
				url, 
				vars,
				function(xmlResponse){
		    		var root = xmlResponse.getElementsByTagName('root');
					var err = xmlResponse.getElementsByTagName('error')[0].childNodes[0].nodeValue;
					var id = xmlResponse.getElementsByTagName('id')[0].childNodes[0].nodeValue;
					var response = xmlResponse.getElementsByTagName('response')[0].childNodes[0].nodeValue;
					var links = xmlResponse.getElementsByTagName('links')[0].childNodes[0].nodeValue;
					
					if(response == 'true'){
						$('#compare_'+id).attr('checked', true);
						$('#cBox_'+id+' .checkbox').css('background-position', '0px -40px');
					}
					else{
						$('#compare_'+id).attr('checked', false);
						$('#cBox_'+id+' .checkbox').css('background-position', '0px 0px');
					}
					
					if(links != 'false'){
						$('div.checkbox-container a').each(function(){
							$(this).attr('class', 'compare-active');
							$(this).attr('href', links);
						});
					}
					else{
						$('div.checkbox-container a').each(function(){
							$(this).attr('class', 'compare-inactive');
							$(this).removeAttr('href');
						});
					}
					
					hideWait();
					
					if(err == 'true'){
						alert('You can\'t compare more than three products');
					}
				}, 
				"xml"
			);
		}
		
		function addToCompare(par){
			showWait();
				
			var url = 'ajax/compare.php';
			var data = par.split("_");
			var vars = 'type=' + encodeURIComponent(data[0]) + '&product_id=' + encodeURIComponent(data[1]);
			
			setTimeout("compareProcess('"+url+"', '"+vars+"')", 1000);
		}
	
		$(document).ready(function(){
			$('div.checkbox-container a').each(function(){
				$(this).click(function(){
					if($(this).attr('class') == 'compare-inactive'){
						alert('Please select at least two products!');
					}
				});
			});
			
			$('div.checkbox-container div.checkbox-box').each(function(){
				$(this).click(function(e){
					addToCompare($(this).attr('id').replace('box_', ''));
					return false;
				});
			});
		});