// JavaScript Document
function viewProduct()
{
	with (window.document.frmListProduct) {
		if (cboCategory.selectedIndex == 0) {
			window.location.href = 'index1.php';
		} else {
			window.location.href = 'index1.php?catId=' + cboCategory.options[cboCategory.selectedIndex].value;
		}
	}
}

function checkAddProductForm()
{
	with (window.document.frmAddProduct) {
		if (isEmpty(txtName, 'Enter Product name')) {
			return;
		} else {
			submit();
		}
	}
}

function checkAddImageForm()
{
	var objUpload=eval("document.getElementById('fleImage')");
    var sUpload=objUpload.value;
    if(sUpload == "")
	{
		alert("Enter Image File");
		return false;
	}
}

function addProduct(catId)
{
	window.location.href = 'index.php?view=add&catId=' + catId;
}

function modifyProduct(productId)
{
	window.location.href = 'index.php?view=modify&productId=' + productId;
}

function deleteProduct(productId, catId)
{
	if (confirm('Delete this product?')) {
		window.location.href = 'processProduct.php?action=deleteProduct&productId=' + productId + '&catId=' + catId;
	}
}

function deleteImage(logoId)
{
	if (confirm('Delete this image')) {
		window.location.href = 'processProduct.php?action=deleteImage&logoId=' + logoId;
	}
}

function deleteWebpage(webId)
{
	if (confirm('Delete this image')) {
		window.location.href = 'processProduct.php?action=deleteWebpage&webId=' + webId;
	}
}