function valid_search(actPath)
{	
	
	if(Trim(document.frmlist.keyword.value)=="")
	{
		alert("Please Enter keyword for Search.");
		document.frmlist.keyword.value="";
		document.frmlist.keyword.focus();
		return false;
	}
	document.frmlist.keyword.value = Trim(document.frmlist.keyword.value);
	document.frmlist.mode.value="Search";
	if(actPath)
	{
		window.location=actPath +"&option="+document.frmlist.option.value+"&keyword="+document.frmlist.keyword.value;
		return false;
	}
}

function valid(actPath)
{	
	
	if(Trim(document.frmlist.keyword.value)=="")
	{
		alert("Please Enter keyword for Search.");
		document.frmlist.keyword.value="";
		document.frmlist.keyword.focus();
		return false;
	}
	document.frmlist.keyword.value = Trim(document.frmlist.keyword.value);
	document.frmlist.mode.value="Search";
	if(actPath)
	{
		window.location=actPath +"&option="+document.frmlist.option.value+"&keyword="+document.frmlist.keyword.value;
		return false;
	}
}
function btnSearch_click(actPath,check)
{
	if(!check) check='No';
	if(check=='Yes')
	{
		val = event.keyCode;
   		if(val==13)	return valid(actPath);
	}
	else	return valid(actPath);
}//END

function checkAll()
{
	var rs = (document.frmlist.abc.checked)?true:false;
	
	for(i=0;i<document.frmlist.elements.length;i++)
	{
	  	if(document.frmlist.elements[i].id == 'iId')
  		{
			document.frmlist.elements[i].checked = rs;
		}

	}  
}
function sub_checkAll()
{
	var rs = (document.frm_subcription_list.abc.checked)?true:false;
	
	for(i=0;i<document.frm_subcription_list.elements.length;i++)
	{
	  	if(document.frm_subcription_list.elements[i].id == 'iId')
  		{
			document.frm_subcription_list.elements[i].checked = rs;
		}

	}  
}

function checkDelete()
{

	var y=0; var ans;
	y = getCheckCount();
	var actionvalue='Delete';
	if(y>0)
	{	ans = confirm("Confirm Deletion of Selected Record(s) ?");
		if(ans == true)
		{	
			document.frmlist.mode.value=actionvalue;
			return true;
		}
		else
		{return false;}
	}
	else
	{	alert("Please Select a Record(s) to Delete.");	return false;	}
}
function getCheckCount()
{	var x=0;

	for(i=0;i < document.frmlist.elements.length;i++)
	{	if (document.frmlist.elements[i].id == 'iId' && document.frmlist.elements[i].checked == true) 
			{x++;}
	}
	return x;
}

function checkActive()
{
	var y=0; var ans;
	y = getCheckCount();
	
	if(y>0)
	{	ans = confirm("Confirm Active Status of Selected Record(s) ?");
		if(ans == true)
		{	document.frmlist.mode.value="Active";	
			return true;
		}
		else
		{	return false;	}
	}
	else
	{	alert("Please Select a Record(s) to Activate.");	return false;	}
}

function checkPending()
{
	var y=0; var ans;
	y = getCheckCount();
	
	if(y>0)
	{	ans = confirm("Confirm Pending Status of Selected Record(s) ?");
		if(ans == true)
		{	document.frmlist.mode.value="Pending";	
			return true;
		}
		else
		{	return false;	}
	}
	else
	{	alert("Please Select a Record(s) to Pending.");	return false;	}
}

function checkBlocked()
{
	var y=0; var ans;
	y = getCheckCount();
	if(y>0)
	{	ans = confirm("Confirm Blocked Status of Selected Record(s) ?");
		if(ans == true)
		{	
		document.frmlist.mode.value="Block";	
		//document.frmlist.submit();		
		return true;
		}
		else
		{	return false;	}
	}
	else
	{	alert("Please Select a Record(s) for Blocked.");	return false;	}
}

function checkInActive()
{
	var y=0; var ans;
	y = getCheckCount();
	
	if(y>0)
	{	ans = confirm("Confirm Inactive Status of Selected Record(s) ?");
		if(ans == true)
		{	document.frmlist.mode.value="Inactive";	
			return true;
		}
		else
		{	return false;	}
	}
	else
	{	alert("Please Select a Record(s) to Deactivate.");	return false;	}
}

function checkExpired()
{
	var y=0; var ans;
	y = getCheckCount();
	
	if(y>0)
	{	ans = confirm("Confirm Expired Status of Selected Record(s) ?");
		if(ans == true)
		{	document.frmlist.mode.value="Expired";	
			//document.frmlist.submit();		
			return true;
		}
		else
		{	return false;	}
	}
	else
	{	alert("Please Select a Record(s) to make Expired.");	return false;	}
}


function checkEmailPending()
{
	var y=0; var ans;
	y = getCheckCount();
	
	if(y>0)
	{	ans = confirm("Confirm Email Pending Status of Selected Record(s) ?");
		if(ans == true)
		{	document.frmlist.mode.value="EmailPending";	
			return true;
		}
		else
		{	return false;	}
	}
	else
	{	alert("Please Select a Record(s) to make Email Pending.");	return false;	}
}
function checkPINPending()
{
	var y=0; var ans;
	y = getCheckCount();
	
	if(y>0)
	{	ans = confirm("Confirm PIN Pending Status of Selected Record(s) ?");
		if(ans == true)
		{	document.frmlist.mode.value="PINPending";	
			return true;
		}
		else
		{	return false;	}
	}
	else
	{	alert("Please Select a Record(s) to make PIN Pending.");	return false;	}
}


function todayDate(dt,df)
{
	document.frmlist.elements[dt].value=document.frmlist.today.value;
	document.frmlist.elements[df].value=document.frmlist.today.value;
}
function yesterdayDate(dt,df)
{
	document.frmlist.elements[dt].value=document.frmlist.yesterday.value;
	document.frmlist.elements[df].value=document.frmlist.yesterday.value;	
}
function currentweekDate(dt,df)
{
	document.frmlist.elements[dt].value=document.frmlist.currweekFDate.value;
	document.frmlist.elements[df].value=document.frmlist.currweekTDate.value;	
}
function previousweekDate(dt,df)
{
	document.frmlist.elements[dt].value=document.frmlist.prevweekFDate.value;
	document.frmlist.elements[df].value=document.frmlist.prevweekTDate.value;	
}
function currentmonthDate(dt,df)
{
	document.frmlist.elements[dt].value=document.frmlist.currmonthFDate.value;
	document.frmlist.elements[df].value=document.frmlist.currmonthTDate.value;	
}
function previousmonthDate(dt,df)
{
	document.frmlist.elements[dt].value=document.frmlist.prevmonthFDate.value;
	document.frmlist.elements[df].value=document.frmlist.prevmonthTDate.value;	
}
function currentquarterDate(dt,df)
{
	document.frmlist.elements[dt].value=document.frmlist.currQuarterFDate.value;
	document.frmlist.elements[df].value=document.frmlist.currQuarterTDate.value;	
}
function previousquarterDate(dt,df)
{
	document.frmlist.elements[dt].value=document.frmlist.prevQuarterFDate.value;
	document.frmlist.elements[df].value=document.frmlist.prevQuarterTDate.value;	
}
function currentyearDate(dt,df)
{
	document.frmlist.elements[dt].value=document.frmlist.currYearFDate.value;
	document.frmlist.elements[df].value=document.frmlist.currYearTDate.value;	
}
function previousyearDate(dt,df)
{
	document.frmlist.elements[dt].value=document.frmlist.prevYearFDate.value;
	document.frmlist.elements[df].value=document.frmlist.prevYearTDate.value;	
}
function OrderSearchvalid(actPath)
{	

	Extra='';
	Extra+="&dFromDate="+document.frmlist.dFromDate.value;
	Extra+="&dToDate="+document.frmlist.dToDate.value;
	Extra+="&vOrderNo="+document.frmlist.vOrderNo.value;
	Extra+="&vFirstName="+document.frmlist.vFirstName.value;
	Extra+="&total_qty_sign="+document.frmlist.total_qty_sign.value;
	Extra+="&fTotal="+document.frmlist.fTotal.value;
	Extra+="&eStatus="+document.frmlist.eStatus.value;
	if(document.frmlist.iProductId.value != '')
		Extra+="&iProductId="+document.frmlist.iProductId.value;
	if(document.frmlist.iCustomerId.value != '')
		Extra+="&iCustomerId="+document.frmlist.iCustomerId.value;
	if(document.frmlist.Id.value != '')
		Extra+="&Id="+document.frmlist.Id.value;
	document.frmlist.mode.value="Search";
	if(actPath)
	{
		window.location=actPath + Extra;
		return false;
	}
}

function checkDeleteAll()
{
	var ans;
	var actionvalue='DeleteAll';
	ans = confirm("Sure to delete All Record(s) ?");
	if(ans == true)
	{	
		document.frmlist.mode.value=actionvalue;
		return true;
	}
	else
	{return false;}	
}