function POList_submit() {	
	counter = 0;
	if(POList_Form.POList_selectOrderID == null){
	  alert("There is no order to be executed in the list.");
	  return false;
	  }
	if(POList_Form.POList_selectOrderID.length == null){
		if(POList_Form.POList_selectOrderID.checked == true){
			counter += 1;
		}
	}else{
		for (var i=0; i<POList_Form.POList_selectOrderID.length; i++){		
			if (POList_Form.POList_selectOrderID[i].checked == true){
				counter += 1;			
			}
		}
	}

	if(counter < 1){
		alert("Pleae choose order");                
		return;
	}

	if(POList_Form.POList_action.value=="delete"){		
		if(!confirm("Are you sure delete this order?")){
			return;
		}
	}

	if(POList_Form.POList_action.value=="cancel"){		
		if(!confirm("Are you sure cancel this order?")){
			return;
		}
	}

	if(POList_Form.POList_action.value=="merge"){		
		if(counter < 2){
			alert("Please choose two or more orders");                
			return;
		}
		if(!confirm("The invoice and notes of the default order will choose the first order when order combination happens! Are you sure you want to combine the selected orders?")){
			return;
		}
	}
   
	POList_Form.submit();
}

function POList_search()
{				
	 if(POList_SearchForm.POList_startDate.value!="")
		{  
		var isDate1=isDate(POList_SearchForm.POList_startDate.value,true);	
		if(isDate1==false)
			{	 
			alert("Please input the valid starting date!"); 
			return false;
       			}
       		}
       	if(POList_SearchForm.POList_endDate.value!="")
		{  
		var isDate2=isDate(POList_SearchForm.POList_endDate.value,true);	
		if(isDate2==false)
			{	 
			alert("Please input the valid ending date!"); 
			return false;
       			}
       		}						
	
	if(!compareDate(POList_SearchForm.POList_startDate.value, POList_SearchForm.POList_endDate.value))
	{
		alert("The starting date must less than the ending date.");
		return false;
	}
	
	return true;
}

function POList_reset()
{
	POList_SearchForm.POList_orderID.value = "";
	POList_SearchForm.POList_startDate.value = "";
	POList_SearchForm.POList_endDate.value = "";					
}

	
