function InsertCart(psItemNo){
	window.open('PlaceOrder.aspx?itemno=' + psItemNo, '', 'status=none,toolbar=none,width=800,height=460,top=0,left=0,scrollbars=1,resizable=1');
}
function CopyAddress(){
	window.document.frmAddress.txtSAddr1.value = window.document.frmAddress.txtBAddr1.value;
	window.document.frmAddress.txtSAddr2.value = window.document.frmAddress.txtBAddr2.value;
	window.document.frmAddress.txtSCity.value = window.document.frmAddress.txtBCity.value;
	window.document.frmAddress.txtSState.value = window.document.frmAddress.txtBState.value;
	window.document.frmAddress.txtSZip.value = window.document.frmAddress.txtBZip.value;
	window.document.frmAddress.txtSPhone1.value = window.document.frmAddress.txtBPhone1.value;
	window.document.frmAddress.txtSPhone2.value = window.document.frmAddress.txtBPhone2.value;
}
function CopyAddress2(){
	window.document.frmAddress.txtSCompany.value = window.document.frmAddress.txtBCompany.value;
	window.document.frmAddress.txtSAddr1.value = window.document.frmAddress.txtBAddr1.value;
	window.document.frmAddress.txtSAddr2.value = window.document.frmAddress.txtBAddr2.value;
	window.document.frmAddress.txtSCity.value = window.document.frmAddress.txtBCity.value;
	window.document.frmAddress.txtSState.value = window.document.frmAddress.txtBState.value;
	window.document.frmAddress.txtSZip.value = window.document.frmAddress.txtBZip.value;
	window.document.frmAddress.txtSPhone1.value = window.document.frmAddress.txtBPhone1.value;
	window.document.frmAddress.txtSPhone2.value = window.document.frmAddress.txtBPhone2.value;
}
function gotourl(url,sname,swidth,sheight,sreplace,sclose)
{
	var objNewWin;				
	//if (swidth=="") 
	swidth = "1020";
	//if (sheight=="") 
	sheight = "700";
	if (sreplace=="") sreplace = false;
	if (sclose=="") sclose = false;
	objNewWin = window.open(url,sname,"fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=" + swidth + ",height=" + sheight + ",top=0,left=0",sreplace);	
	if (sclose) window.close();
	objNewWin.focus();	
}
function MassUpdate(){
	window.open('inventory_mupdate.aspx', '', 'status=none,toolbar=none,width=540,height=320');
}
function MarkAll(plChecked, psCtlID, pnColumn){
	var inputs; 
	var chkinput;
	inputs = document.getElementById("dgItemList").rows;
	for (var i=0; i < inputs.length; i++)
	{
		if (inputs[i].cells[pnColumn].getElementsByTagName("INPUT").length>0)
		{
			chkinput = inputs[i].cells[pnColumn].getElementsByTagName("INPUT")[0];
			if (chkinput.id.indexOf(psCtlID)>-1) {
				chkinput.checked = plChecked;
			}
		}
	}
}
function CheckInput(){
	if(event.keyCode<47 || event.keyCode>57)
		event.returnValue=false;
}
function ItemKeyDown(tcOption){
	if (tcOption == 13){ 
		window.document.Form1.txtAction.value="Item";
		window.document.Form1.submit();
	}
	if (tcOption == 118){ 
		window.document.Form1.imgItemLookup.click();
	}
}

function SelectClick(tsPage, tsCtlName)
{
	lcKey = eval("window.document." + tsCtlName + ".value");
	if (tsPage == "soselectitem.aspx"||tsPage == "../admin/soselectitem.aspx")
	{
		if (lcKey=='')
		{
			alert('Blank Item # is not allowed');
			return false;
		}
	}
	if (window.showModalDialog)
	{
		window.showModalDialog(tsPage + "?ctlname=" + tsCtlName + "&key=" + lcKey, this,"dialogWidth=600px;dialogHeight=400px;status=no;help=no");
		if (tsCtlName=='Form1.txtItemNo')
		{
			window.document.Form1.submit();
		}
	}
	else
	{
		window.top.captureEvents(Event.CLICK|Event.FOCUS)
		window.top.onclick=IgnoreEvents
		window.top.onfocus=HandleFocus
		winModalWindow = window.open(tsPage + "?ctlname=" + tsCtlName + "&key=" + lcKey,"ModalChild1","dependent=yes,width=600,height=400,scrollbars=yes")
		winModalWindow.focus();
	}

}