// JavaScript Document
		function gotoPage(processurl, page){
			//$("#curpage").val() = page;
			$("#listTable").hide();
            $("#loadingTable").show();
            $.post(processurl,
                {activeAjax: 1, curpage: page, numresult: $("#numresult").val(), order: $("#order").val()},
                function(data){
                    $("#listTable").html(data);
                    $("#loadingTable").hide();
					$("#listTable").show();
                }
            );
        };	
		
		function CheckShowhome(processurl, ID, CheckID){
			
			//$("#curpage").val() = page;
			$("#listTable").hide();
            $("#loadingTable").show();
            $.post(processurl,
                {activeAjax: 1, curpage: $("#curpage").val(), numresult: $("#numresult").val(), order: $("#order").val(), ID: ID, CheckID:CheckID},
                function(data){
                    $("#listTable").html(data);
                    $("#loadingTable").hide();
					$("#listTable").show();
                }
            );
        };	
		
		
		function player_video(processurl, videoID){
			var url = processurl+'videoShow.php';
			//$("#curpage").val() = page;
            $.post(url,
                {videoID: videoID},
                function(data){
                    $("#player_select").html(data);
                }
            );
        };	
		
		
		
		function delItems(processurl, delStr){
			if (delStr == undefined)
			{
				calculatechon();
				delStr = document.getElementById("chon").value;
			}
			if (delStr == "") {
				return false;
			}
			if(!confirm("THÔNG BÁO: \n\tBẠN CÓ CHẮC CHẮN XÓA KHÔNG?"))
			{
				return false;
			}		
			//$("#curpage").val() = page;
			$("#listTable").hide();
            $("#loadingTable").show();
            $.post(processurl,
                {activeAjax: 1, curpage: $("#curpage").val(), numresult: $("#numresult").val(), order: $("#order").val(), dlStr: delStr},
                function(data){
                    $("#listTable").html(data);
                    $("#loadingTable").hide();
					$("#listTable").show();
                }
            );
        };
		
		
		
		function copyto(processurl, delStr){

			if (delStr == undefined)
			{
				calculatechon();
				delStr = document.getElementById("chon").value;
			}
			if (delStr == "") {
				alert("Chọn một bài viết để sao chép !!!");
				return false;
			}
						
			//$("#curpage").val() = page;
			$("#listTable").hide();
            $("#loadingTable").show();
            $.post(processurl,
                {activeAjax: 1, curpage: $("#curpage").val(), numresult: $("#numresult").val(), order: $("#order").val(), copyStr: delStr},
                function(data){
                    $("#listTable").html(data);
                    $("#loadingTable").hide();
					$("#listTable").show();
                }
            );
        };
		
		
		function reloadPage(processurl){
			$("#listTable").hide();
            $("#loadingTable").show();
            $.post(processurl,
                {activeAjax: 1, cur_pos: 0, numresult: $("#numresult").val(), order: $("#order").val()},
                function(data){			
                   $("#listTable").html(data);
                    $("#loadingTable").hide();
				$("#listTable").show();
					
                }
            );
		}
		
		function setAction(processurl){
			if (confirm("Bạn có thật sự muốn thay đổi không?")){
				$("#listTable").hide();
				$("#loadingTable").show();
				$.post(processurl,
					{activeAjax: 1, cur_pos: 0, numresult: $("#numresult").val(), order: $("#order").val()},
					function(data){
						alert("Mọi thay đổi đã được cập nhật");
						$("#listTable").html(data);
						$("#loadingTable").hide();
						$("#listTable").show();
					}
				);
			}
		}		
		
		//DEBUG = true;
	//$.log();
	var doing=false;
	function addtoCart(id,url){
		if (doing)
			return;
		doing=true;
		$.post(url + "addtoCart.php", {productID: id}, 
			function(data){ 
				if (data == 1) {
					window.location.href= url + 'viewCart.html';

				} else if (data == 0) {
					window.location.href= url + 'viewCart.html';
				}
				doing=false;
			}
		);
	}
