// JavaScript Document

$(document).ready(function() {
	var count=0;
	var pageId;
	var currPageId;
	var leftColumnHeight = $('#left-column').height();
	var rightColumnHeight = $('#right-column').height();
	var maxCatHeight = 0;
	var catThumb =new Array(3);
	
	$('.category').each(function(index) {
		catThumb[index] = $(this).height();
		if (catThumb[index] > maxCatHeight) {
			maxCatHeight = catThumb[index];
		}
	 });
	
	$('.category').css({'min-height':maxCatHeight+'px','height':'auto !important','height':maxCatHeight+'px'})
	
	if(leftColumnHeight < rightColumnHeight) {
		$('#left-column').css({'min-height':rightColumnHeight+'px','height':'auto !important','height':rightColumnHeight+'px'});
	}
						   
	
	$('.add-1').click(function () {
		var inputVal = $(this).parent().children('input.quantity').attr("value"); 
		inputVal = parseInt(inputVal) +1;
		$(this).parent().children('input.quantity').val(inputVal);
		return false;
	});
	
	$('.minus-1').click(function () {
		var inputVal2 = $(this).parent().children('input.quantity').attr("value"); 
		if(inputVal2 > 1) {
			inputVal2 = parseInt(inputVal2) -1;
			$(this).parent().children('input.quantity').val(inputVal2);
		}
		return false;
	});

	// Add to cart
	$("input[name='cart']").click(function() {
		$("#prodId").val($(this).val())
	});

	$("input[name='remove']").click(function() {
		$("#rProdId").val($(this).val())
	});
	
	function selectSameDel() {
	if ($('#deliveryAddress').css('display')=='none') {
		$('#deliveryAddress').show();
	} else {
		$('#deliveryAddress').hide();
	}

}
	
});