function userdelete(id)
{
	if(window.confirm("Are you sure you want to delete this user?"))
		window.location.href="userdelete.aspx?userID="+id;
}

function printpage() 
{
    window.print();  
    self.close();
}

function orderedit(cutoffdatetime, url)
{
    var dtNow = new Date();
    var dtcutoffdatetime = new Date(cutoffdatetime);

    if (dtNow < dtcutoffdatetime) 
    {
        window.location.href=url;
    }
    else
    {
        window.alert("This order cannot be edited because the cut-off for the Required Date has passed");
    }
}

function ordersubmit(cutoffdatetime, printurl, submiturl)
{
    var dtNow = new Date();
    var dtcutoffdatetime = new Date(cutoffdatetime);

    if (dtNow > dtcutoffdatetime) 
    {
        window.alert("You have missed the cutoff time.\nPlease notify the factory that you have submitted a late order.\nFailure to do this may result in your order not being fulfilled.");
    }
    
    orderprint(printurl)
    
    window.location.href = submiturl; 
}

function orderheadercancel()
{
    if(window.confirm("Any changes will be lost. Are you sure you want to cancel?"))
		window.location.href="OrderList.aspx";
}

function orderdetailcancel(url)
{
    if(window.confirm("Any changes will be lost. Are you sure you want to cancel?"))
		window.location.href=url;
}

function orderprint(url)
{
	if(window.confirm("Print this order?"))
		window.open(url)
}

function orderdelete(id)
{
	if(window.confirm("Are you sure you want to delete this order?"))
		window.location.href="orderdelete.aspx?OrderNo=" + id;
}
