function chkupdate()
{
 document.form1._act.value='Update';
 document.form1.submit();
 return true;
}
function ALLsearch()
{
document.form1.letter.value ='';
document.form1.submit();
return true;
 }
function getCheckCount()
{	
	var x=0;
	for(i=0;i < document.form1.elements.length;i++)
	{	if (document.form1.elements[i].id == 'iId' && document.form1.elements[i].checked == true) 
			{x++;}
	}
if(x ==0)
{
alert('Please select a record to enable/disable');
return false;
}
else
{
document.form1._act.value='changestatus';
document.form1.submit();
return true;
}
}



function getCheckCountk()
{	
	var x=0;
	for(i=0;i < document.form1.elements.length;i++)
	{	if (document.form1.elements[i].id == 'iId' && document.form1.elements[i].checked == true) 
			{x++;}
	}
if(x ==0)
{
alert('Please select a record to approve / reject');
return false;
}
else
{
document.form1.action.value='changestatus';
document.form1.submit();
return true;
}
}


function categorydelete(catid,prodno)
{
 var ans;
 if(prodno>0)
{
	if (prodno>1) 
	{ 
		productstr="products"; 
	}
	else 
	{ 
		productstr="product"; 
	}
alert("You are about to delete "+prodno+" "+productstr+" in this category, click ok to proceed ?");
//return false;	
}
else
{
 ans =  confirm("Do you really want to delete this record ?");
if (ans)
{ 
 document.form1.action.value='Delete';
 document.form1.DeleteId.value=catid;
 document.form1.submit();
 return true;
}
}
}


function openWin(id, has_rights)
{	
	if(has_rights==undefined || has_rights=='1')
	{
	 var ans;
	 ans =  confirm("Do you really want to delete this record ?");
		if(ans)
		{ 
		 document.form1.method = "POST";
		 document.form1._act.value='Delete';
		 document.form1.DeleteId.value=id;
		 document.form1.submit();
		 return true;
		}
	}
	else
	{
		alert('You are not authorised to perform this action');
	}
}

function openDeleteWin(id, has_rights)
{	
	if(has_rights==undefined || has_rights=='1')
	{
	 var ans;
	 ans =  confirm("Do you really want to delete this record ?");
		if(ans)
		{
		 document.form1.method = "POST";
		 document.form1._act.value='Delete';
		 document.form1.DeleteId.value=id;
		 document.form1.submit();
		 return true;
		}
	}
	else
	{
		alert('You are not authorised to perform this action');
	}
}


function deleteCategoryPopup(cat_type, id, has_rights)
{
	if(has_rights==undefined || has_rights=='1')
	{
		if(cat_type=='PARENTCAT')
		{
			var msg = "Deletion of category will result in deletion of all the subcategories and products under this category.\n\nClick ok to proceed ?";
		}
		else if(cat_type=='SUBCAT')
		{
			var msg = "Deletion of category will result in deletion of all the products under this category.\n\nClick ok to proceed ?";
		}	
	
		var ans;
		ans =  confirm(msg);
		if(ans)
		{ 
			document.form1.method="POST";
			document.form1._act.value='Delete';
			document.form1.DeleteId.value=id;
			document.form1.submit();
			return true;
		}
	}
	else
	{
		alert('You are not authorised to perform this action');
	}
}

function openWinweekly(id)
{
 var ans;
 ans =  confirm("Do you really want to make weekly poll to this record ?");
if (ans)
{ 
 document.form1.action.value='Weekly';
 document.form1.DeleteId.value=id;
 document.form1.submit();
 return true;
}

}


function deletefrontrecs(id)
{
 var ans;
// ans =  confirm("Do you really want to delete this record ?");
//if (ans)
//{ 
 document.form1.action1.value='Delete';
 document.form1.DeleteId.value=id;
 document.form1.submit();
 return true;
//}

}


function deleterecs(id)
{
 var ans;
 ans =  confirm("Do you really want to delete this record ?");
if (ans)
{ 
 document.form1.action1.value='Delete';
 document.form1.DeleteId.value=id;
 document.form1.submit();
 return true;
}

}

function paging(page)
{
	form1.PageNo.value = page;	 
	//document.form1.search.value = '<?=$search;?>';
    form1.submit();
 }
