function BlankOrderSummary() 
  {
  with (formIFOrderSummary)
    OrderSummary.location.href = "OrderBlank.html"
  }

function SetupOrderSummary(pSalesOrder)
  {
  if (!document.formIFOrderSummary) return ; 
  with (formIFOrderSummary)
    OrderSummary.location.href = 'OrderSummary.aspx?' + URLTime() + '&SalesOrder=' + pSalesOrder ;
  }

function WindowConfigure(pQuantityField,pPage)
  {
	window.location = pPage + (pPage.search(/\?/) == -1 ? '?' : '&') + URLTime()
	window.Field = pQuantityField
  }

function WindowCustomerMessage()
  {
  var vWidth = 730
  var vHeight = 595
  var vTop = String((Number(screen.availHeight) - vHeight) / 2)
  var vLeft = String((Number(screen.availWidth) - vWidth) / 2)
  var vFeatures = 'resizable=yes,top=' + vTop + ',left=' + vLeft + ',width=' + String(vWidth)
  vFeatures += ',height=' + String(vHeight) + ',scrollbars=yes,menubar=no,status=no' 
  //window.open('CustomerMessageToUser.aspx?' + URLTime(),'Message',vFeatures)
  if (window.location.href.indexOf("CustomerMessageToUser.aspx") == -1)
    window.location = 'CustomerMessageToUser.aspx?' + URLTime();
  }

function WindowOrderUpdateMessage()
{
// Skip over this function for the purpose of the demo.
}
  
function BuyStatusUpdate(elemName, message)
{
	var objToDelete = document.getElementById("BuyStatus");
	if (objToDelete != null) {
	    objToDelete.parentNode.removeChild(objToDelete);
	}
	var objToAppendTo = document.getElementById(elemName);
	if (objToAppendTo != null) {
	    var divtag = document.createElement("span");
	    divtag.setAttribute("id", "BuyStatus");
	    divtag.style["color"] = "red";
	    var msg = document.createTextNode(message);
	    divtag.appendChild(msg);
	    objToAppendTo.appendChild(divtag);
	}
}

function AddMsgLine(objElement, refButton) {

	var elem = document.getElementById(objElement);
	var elem2 = document.getElementById(refButton);
	elem.style["display"] = "inline";
	if (elem2 != null) elem2.style["display"] = "none";
	elem.childNodes[1].focus();
}

function AddMsgLine(objElement) {
	var elem = document.getElementById(objElement);
	elem.style["display"] = "inline";
	elem.childNodes[1].focus();
}

function AddBillingCode(objElement, refButton) {
	var elem = document.getElementById(objElement);
	var elem2 = document.getElementById(refButton);
	elem.style["display"] = "inline";
	if (elem2 != null) elem2.style["display"] = "none";
	elem.childNodes[1].focus();
}

function FavoriteStatusUpdate(elemName, message)
{
	var objToDelete = document.getElementById("FavoriteStatus");
	if (objToDelete != null) {
	    objToDelete.parentNode.removeChild(objToDelete);
	}
	var objToAppendTo = document.getElementById(elemName);
	if (objToAppendTo != null) {
	    var divtag = document.createElement("P");
	    divtag.setAttribute("id", "FavoriteStatus");
	    divtag.style["color"] = "red";
	    var msg = document.createTextNode(message);
	    divtag.appendChild(msg);
	    objToAppendTo.appendChild(divtag);
	}
}

function StockStatusUpdate(elemName, message)
{
	var objToDelete = document.getElementById("StockStatus");
	if (objToDelete != null) {
	    objToDelete.parentNode.removeChild(objToDelete);
	}
	var objToAppendTo = document.getElementById(elemName);
	if (objToAppendTo != null) {
	    var divtag = document.createElement("P");
	    divtag.setAttribute("id", "StockStatus");
	    divtag.style["color"] = "red";
	    var msg = document.createTextNode(message);
	    divtag.appendChild(msg);
	    objToAppendTo.appendChild(divtag);
	}
}

function OldWindowOrderUpdateMessage()
  {
  var vUpdateWindow
  var vWidth = 500
  var vHeight = 180
  var vTop = String((Number(screen.availHeight) - vHeight) / 2)
  var vLeft = String((Number(screen.availWidth) - vWidth) / 2)
  var vFeatures = 'resizable=no,top=' + vTop + ',left=' + vLeft + ',width=' + String(vWidth)
  vFeatures += ',height=' + String(vHeight) + ',scrollbars=no,menubar=no,status=no' 
  vUpdateWindow = window.open('""?' + URLTime(),'MessageUpdate',vFeatures)

  with (vUpdateWindow.document)
    {
    write('<html>');
    write('<head>');
    write('  <title>Cart Update Message</title>');
    write('  <link rel="stylesheet" type="text/css" href="../../Scripts/OrderDesk.css">');
    write('</head>');

    write('<body class="Message">');

    write('<table class="Heading" border="0" cellspacing="0" cellpadding="0" height=100% width=100%>');
    write('  <tr>');
    write('    <td align="center" valign=middle>');

    write('      <table width="100%" border="0" cellspacing="0" cellpadding="0">');
    write('        <tr><td class="Heading" align=center>' + gSalesOrderUpdate + '</td></tr>');
    write('      </table>');

    write('    </td>');
    write('  </tr>');
    write('</table>');

    write('</body>');
    write('</html>');
  	}
  }

function DetailWindow(pPage) 
  {
  //var vWidth = 750
  //var vLeft = String((Number(screen.availWidth) - vWidth) / 2)
  //var vFeatures = 'resizable=yes,top=0,left=' + vLeft + ',scrollbars=yes,width=' + String(vWidth)
  //vFeatures += ',height=' + String(Number(screen.availHeight) - 50) + ',menubar=no,status=no,locationbar=no'
  //gWinDetail = window.open(pPage + (pPage.search(/\?/) == -1 ? '?' : '&') + URLTime(),'Detail',vFeatures)
  window.location = pPage;
  }

function DetailWindow2(pPage) 
  {
  var vWidth = 750
  var vLeft = String((Number(screen.availWidth) - vWidth) / 2)
  var vFeatures = 'resizable=yes,top=0,left=' + vLeft + ',scrollbars=yes,width=' + String(vWidth)
  vFeatures += ',height=' + String(Number(screen.availHeight) - 50) + ',menubar=no,status=no,locationbar=no'
  gWinDetail2 = window.open(pPage + (pPage.search(/\?/) == -1 ? '?' : '&') + URLTime(),'Detail2',vFeatures)
  }
