 
function showItem(pNum,pName){
        //alert(pName);
//var htmlcode = window.open(url, "EventPage" ,"top=30,left=30,scrollbars=yes,resizable,width=700,height=500,status=yes",'yes');
window.open("showItem.asp?pName=" + pName + "&pNum=" + pNum, "showItem" ,"top=200,left=200,scrollbars=yes,resizable,width=300,height=300",'yes');
}

function updateWin(pName){
        //alert(pName);
//var htmlcode = window.open(url, "EventPage" ,"top=30,left=30,scrollbars=yes,resizable,width=700,height=500,status=yes",'yes');
window.open("updateProd.asp?pName=" + pName, "showItem" ,"top=200,left=200,'location=yes,scrollbars=yes,resizable,width=750",'yes');
}

function showCat(catimg){
window.open("showCat.asp?catimg=" + catimg, "showCat" ,"top=200,left=200,scrollbars=yes,resizable,width=300,height=220",'yes');
}

function openItemWin(pName,CatNum){
	//alert(CatNum);
window.open("item_list.asp?pName=" + pName + "&CatNum=" + CatNum, "showItem" ,"top=100,left=200,scrollbars=yes,resizable,width=750",'yes');
}

function loadLoginForm(){
//	alert("***");
  document.frmlogin.elements["uid"].focus();
}

function deleteCFM(){
	var cfm;
	cfm = confirm("Are you sure?");
	if(!cfm){
	  return false;
	}
}

function CatCheckField(){
 var lineNum = 1;
 var fieldName = "CatId";
 var strErr="";       
 var obj = document.catFrm.elements[fieldName + lineNum];

 while(obj)                                     
 { 
  //alert(obj.value + '--' + lineNum);
  if(obj.value=='')	  
	  strErr = "Category Id field is required";
  lineNum = lineNum + 1;
  obj = document.catFrm.elements[fieldName + lineNum];
 } 
 if(strErr != ''){
	 alert(strErr);
   return false;
 } 
}

function ProdCheckField(){
  if(obj = document.nailUpdateFrm.elements['ProductId'].value == ''){
      alert("Product Id field is required");
	  return false;
  }
}

function addRow(){

var tbl = document.getElementById('catTbl');
var intLine = tbl.rows.length;
   
var lastLineNum; 
lastLineNum = tbl.rows.length     

var row = tbl.insertRow(tbl.rows.length)   //create one row for the table
if(lastLineNum%2 == 0){
   //row.setAttribute('bgcolor', '#E8E2DA');
   row.style.backgroundColor= "#E8E2DA";
}
var cell0 = row.insertCell(0);
var Node0 = document.createElement('input');
Node0.setAttribute('type', 'text');
Node0.setAttribute('name', 'CatId' + lastLineNum);
Node0.setAttribute('id', 'CatId' + lastLineNum);
Node0.setAttribute('size', '11');
Node0.setAttribute('maxlength', '20');
Node0.style.fontSize= "12px";
Node0.value = "";
//Node0.setAttribute("readOnly", 'true');
//Node0.setAttribute("tabindex", 'tabNum'); 
cell0.appendChild(Node0);
          
var cell1 = row.insertCell(1);   //create second cell for the row
var Node1 = document.createElement('input');
Node1.setAttribute('type', 'text');
Node1.setAttribute('name', 'CatName' + lastLineNum);
//Node1.setAttribute('id', 'CatName + lastLineNum);
Node1.setAttribute('size', '24');
Node1.setAttribute('maxlength', '100');
Node1.style.fontSize= "12px";
Node1.value = "";
//Node0.setAttribute("readOnly", 'true');
//Node0.setAttribute("tabindex", 'tabNum'); 
cell1.appendChild(Node1);

var cell2 = row.insertCell(2);   //create second cell for the row
var Node2 = document.createElement('input');
Node2.setAttribute('type', 'text');
Node2.setAttribute('name', 'CatDesc' + lastLineNum);
//Node2.setAttribute('id', 'CatDesc + lastLineNum);
Node2.setAttribute('size', '24');
Node2.setAttribute('maxlength', '100');
Node2.style.fontSize= "12px";
Node2.value = "";
//Node0.setAttribute("readOnly", 'true');
//Node0.setAttribute("tabindex", 'tabNum'); 
cell2.appendChild(Node2);

var cell3 = row.insertCell(3);   //create second cell for the row
var Node3 = document.createElement('input');
Node3.setAttribute('type', 'text');
Node3.setAttribute('name', 'CatImg' + lastLineNum);
//Node3.setAttribute('id', 'CatImg + lastLineNum);
Node3.setAttribute('size', '11');
Node3.setAttribute('maxlength', '50');
Node3.style.fontSize= "12px";
//Node2.style.backgroundColor= "#cccccc";
Node3.value = "";
//Node0.setAttribute("readOnly", 'true');
//Node0.setAttribute("tabindex", 'tabNum'); 
cell3.appendChild(Node3);

//add a col for delete function
var cell4 = row.insertCell(4);
cell4.setAttribute('align', 'center');
var Node4 = document.createElement('input');
Node4.setAttribute('type', 'checkbox');
Node4.setAttribute('name', 'chkDel' + lastLineNum);
//Node4.setAttribute('id', 'chkDel' + lastLineNum);
Node4.value = 'del'; 
cell4.appendChild(Node4);

    //alert('table total row: ' + intLine);
//get the total number of the rows in the DetailForm 
document.catFrm.elements["totalLine"].value = tbl.rows.length-1;
//alert(document.catFrm.elements["totalLine"].value);
}//function

function getTotal(){
	var tbl = document.getElementById('catTbl');
	document.catFrm.elements["totalLine"].value = tbl.rows.length-1;
	//alert("total");
}


