$(document).ready(function() {
	var ext = $('input[class=txtnumcart]');
	$(".txtnumcart").keypress(function (e)  
	{ 
	  if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))
	  {
		return false;
	  }		  
	});	
	// ignore these keys
	var ignore = [8,9,13,33,34,35,36,37,38,39,40];
	// use keypress instead of keydown as that's the only place you can cancel key strokes in Opera
	var eventName = 'keypress';
	// handle keydown event on textareas with maxlength attribute
	$('input[maxlength]').bind(eventName, function(event) {
		var self = $(this),
			maxlength = self.attr('maxlength'),
			code = event.keyCode || event.which;
	
		// check if maxlength has a value. The value must be greater than 0
		if (maxlength && maxlength > 0) {
			// continue with this key stroke if maxlength not reached or one of the ignored keys were pressed.
			return (self.val().length < maxlength || $.inArray(code, ignore) !== -1);
		}
	});						   
	$('.buttonaddwishlist2').click(function(){
		window.location.href=path_ajax_script+'/addcart/'+this.id;
	});
	$('#continueshop').click(function(){
		window.location.href=path_ajax_script+'/shop';
	});
	$('.delItem').click(function(){
		$(this).parents("td:first").parents("tr:first").html('');
	});
	$('#checkout').click(function(){
		window.location.href=path_ajax_script+'/thanh-toan';
	});
});
