image1 = new Image();
image1.src = "images/home_over.jpg";

image2 = new Image();
image2.src = "images/virt_samp_over.jpg";

image3 = new Image();
image3.src = "images/about_us_over.jpg";

image4 = new Image();
image4.src = "images/general_info_over.jpg";

image5 = new Image();
image5.src = "images/shopping_cart_over.jpg";

image6 = new Image();
image6.src = "images/admin_over.jpg";

image7 = new Image();
image7.src = "images/sales_tools_over.jpg";

function handleCategorySelect(theForm)
{
	var sel = theForm.cboCategories.value;
	var url;

	url = 'Category.asp?cat_id=' + sel;
	theForm.action = url;
	theForm.submit();
}

function flipImage(strDocImage, strNewImage)
{
	document[strDocImage].src = strNewImage
}

function selectProductCategory(theForm, url)
{
	var sel = theForm.cboCategories.value;
	var sPage;
	
	sPage = url + '?cat_id=' + sel;
	theForm.action = sPage;
	theForm.submit();
}

function selectItemCategory(theForm, url)
{
	var selCategory = theForm.cboCategories.value;
	var selItem = theForm.cboItems.value;
	var sPage;
	
	sPage = url + '?cat_id=' + selCategory + '&prod_id=' + selItem;
	theForm.action = sPage;
	theForm.submit();
}

function handleProductDelete(theForm, nCatID, nID)
{
	var url;

	url = 'DeleteProduct.asp?cat_id=' + nCatID + '&prod_id=' + nID;
	theForm.action = url;
}

function handleButtonEnable(theForm)
{
	theForm.btnUpdate.disabled = 0;
	theForm.btnRemove.disabled = 0;
	theForm.btnSalesOrder.disabled = 0;
}

function handleOrderButtonEnable(theForm)
{
	theForm.btnView.disabled = 0;
	theForm.btnRemove.disabled = 0;
}

function openPaperProofWindow(url, width, height)
{
	var w;
	var sParams;
	
	sParams = "width=" + width + ",height=" + height + ",status=yes,resizable=yes";
	w = window.open(url, "paper_proof_win", sParams);
}

function openHelpWindow(url)
{
	var w;
	var sParams;
	
	sParams = "width=500,height=400,status=no,resizable=no,menubar=no,scrollbars=yes";
	w = window.open(url, "help_win", sParams);
}

function openQuoteViewWindow(file)
{
	var w;
	var url;
	var sParams;
	
	sParams = "width=600,height=480,status=no,resizable=yes,menubar=no,scrollbars=yes";
	url = "../quotations/" + file;
	w = window.open(url, "quote_view_win", sParams);
}

function locateCustomer(theForm)
{
	var oTextRange;
	var sParam;
	
	oTextRange = document.body.createTextRange();
	sParam = theForm.txtLocate.value;
	oTextRange.findText(sParam);
}

function confirmCustomerDelete(theForm)
{
	var sMsg;
	var bResult;
	
	sMsg = "Are you sure you want to delete this customer?\n"
	sMsg = sMsg + "Deleted customers can not be retrieved."
	if (confirm(sMsg))
	{
		theForm.action = "RemoveCustomer.asp";
		bResult = true;
	}	
	else
	{
		theForm.action = "";
		bResult = false;
	}	
	return (bResult);
}

function handleCategoryButtonEnable(theForm)
{
	theForm.btnUpdate.disabled = 0;
	theForm.btnRemove.disabled = 0;
}

function confirmCategoryDelete(theForm)
{
	var sMsg;
	var bResult;
	
	sMsg = "Are you sure you want to delete this category?\n"
	sMsg = sMsg + "Deleted category can not be retrieved."
	if (confirm(sMsg))
	{
		theForm.action = "RemoveCategory.asp";
		bResult = true;
	}	
	else
	{
		theForm.action = "";
		bResult = false;
	}	
	return (bResult);
}

function openShipRateWindow(package_box_piece, package_box_weight, package_box_length, package_box_width, package_box_height, width, height)
{
	var w;
	var URL;
	var sParams;
	
	sParams = "width=" + width + ",height=" + height + ",status=yes,resizable=yes";
	URL = "UPSRating.asp?package_piece=" + package_box_piece + "&package_weight=" + package_box_weight + "&package_length=" + package_box_length + "&package_width=" + package_box_width + "&package_height=" + package_box_height;
	
	w = window.open(URL, "ship_rate_win", sParams);
}

function openUploadWindow(form_name, field, path, width, height)
{
	var w;
	var URL;
	var sParams;
	
	sParams = "width=" + width + ",height=" + height + ",status=yes,resizable=yes";
	URL = "Upload.asp?form=" + form_name + "&fld=" + field + "&path=" + path;

	w = window.open(URL, "upload_file", sParams);
}

function openUploadWindowT(form_name, field, path, width, height)
{
	var w;
	var URL;
	var sParams;
	
	sParams = "width=" + width + ",height=" + height + ",status=yes,resizable=yes";
	URL = "UploadImageT.asp?form=" + form_name + "&fld=" + field + "&path=" + path;

	w = window.open(URL, "upload_file", sParams);
}

function confirmSwatchDelete(theForm)
{
	var sMsg;
	var bResult;
	
	sMsg = "Are you sure you want to delete this swatch?\n"
	sMsg = sMsg + "Deleted swatch can not be retrieved."
	if (confirm(sMsg))
	{
		theForm.action = "RemoveSwatch.asp";
		bResult = true;
	}	
	else
	{
		theForm.action = "";
		bResult = false;
	}	
	return (bResult);
}
