function addProduct(thisObj, objValue, cat_id, objType) {
	if((typeof(objType) == "undefined" && thisObj.checked) || objType != null ) {
		if($(".comparisonBoxItemsDiv .comparisonBoxItem").length ==4) {
				alert("Comparable up to 4 products at a time.");
				return;
		}
		if($(".comparisonBoxItemsDiv .comparisonBoxItem").length >1 && cat_id != $(".comparisonBoxItemsDiv #compare_category_id").val()) {
				alert("Please select product from same category.");
				return;
		}		
		$('.comparisonBoxItemsDiv').load('/ajax/litec/compareproduct?currentAction=add&compare_product_id='+ objValue, function() {

});
	}
}

function removeProduct(thisObj) {
	if(thisObj.checked) {
			$('.comparisonBoxItemsDiv').load('/ajax/litec/compareproduct?currentAction=remove&compare_product_id='+ thisObj.value);
	}
}

function removeAllProducts() {
			$('.comparisonBoxItemsDiv').load('/ajax/litec/compareproduct?currentAction=removeAll');
}

function compareNow() {
	if($('.comparisonBoxItemsDiv #compare_product_id').length < 2) {
			alert("Atleast two products required for compare.");
			return;
	}
var queryString	= "";
	$('.comparisonBoxItemsDiv #compare_product_id').each(function(i,e){
		queryString += "&compare_product_id[]=" + $(this).val() ;
	});	
$("#compareNowBtn").attr("href","/ajax/litec/product_comparison?KeepThis=true&height=500&width=800"+queryString+ "&TB_iframe=true");
	$("#compareNowBtn").trigger('click');
}

function searchProducts(product_id,keyIndex) {
	$('#searchResults_'+product_id).show();
			$('#searchResults_'+product_id).load('/ajax/litec/compare_product_search?searchString='+ $("#searchString_"+product_id).val()+"&keyIndex="+keyIndex);
}
