function CheckAll()
{
count = document.frm.elements.length;
    for (i=0; i < count; i++) 
	{
    if(document.frm.elements[i].checked == 0)
    	{ document.frm.elements[i].checked = 1; }
	}
}
function UncheckAll(){
count = document.frm.elements.length;
    for (i=0; i < count; i++) 
	{
    if(document.frm.elements[i].checked == 1)
    	{document.frm.elements[i].checked = 0; }    
	}
}
//======= below function For checking any of check box is checked or not =========================
function callActionPage()
{
		//Code to check if any of the checkbox is selected else the form will not be submitted
		chk_checked = "false";
		if((document.forms[0].chk_all.length)>=2){
			if(document.forms[0].chk_all.length)
			{
				total = document.forms[0].chk_all.length;
				for (i=0;i<total;i++)
				{
					if (document.forms[0].chk_all[i].checked)
					{
						chk_checked = "true";
						break;
					}
				}
			}
		}else{
			if(document.forms[0].chk_all.checked==true){
				 chk_checked = "true";
			}
		}
		return chk_checked;
}
function callActionPage1()
{
		//Code to check if any of the checkbox is selected else the form will not be submitted
		chk_checked = "false";
		if(document.forms[1].chk_all.length)
		{
			total = document.forms[1].chk_all.length;
			for (i=0;i<total;i++)
			{
				if (document.forms[1].chk_all[i].checked)
				{
						
					chk_checked = "true";
					break;
				}
			}
		}
		return chk_checked;
}
function callActionPage2()
{
		//Code to check if any of the checkbox is selected else the form will not be submitted
		chk_checked = "false";
		if(document.forms[2].chk_all.length)
		{
			total = document.forms[2].chk_all.length;
			for (i=0;i<total;i++)
			{
				if (document.forms[2].chk_all[i].checked)
				{
						
					chk_checked = "true";
					break;
				}
			}
		}
		return chk_checked;
}

//======== below function is check all the checkbox on check one common checkbox ===================
//var checkflag = "false";
	function check(field) {
	if (checkflag == "false"){
		for (i = 0; i < field.length; i++) {
			field[i].checked = true;
		}
		checkflag = "true";
		return "Uncheck All"; 
	}else {
		for (i = 0; i < field.length; i++) {
			field[i].checked = false; 
		}
		checkflag = "false";
		return "Check All"; 
	}
}
//============= If delete the record without selecting any records =================
function checkPage()//for form[0]
{
        checked = callActionPage();
		if (checked == "true")
		{
			if (confirm("Do you Really want to delete this Record?"))
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		else if (checked == "false")
		{
			alert("Please select the record(s) to be deleted.");
			return false;
		}
}
function checkPage1()//for form[1]
{
		
        checked = callActionPage1();
		if (checked == "true")
		{
			if (confirm("Do you Really want to delete this Record?"))
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		else if (checked == "false")
		{
			alert("Please select the record(s) to be deleted.");
			return false;
		}
}
function checkPage2()//for form[2]
{
		
        checked = callActionPage2();
		if (checked == "true")
		{
			if (confirm("Do you Really want to delete this Record?"))
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		else if (checked == "false")
		{
			alert("Please select the record(s) to be deleted.");
			return false;
		}
}

function check()
{
if (confirm("Do you Really want to delete this Record?"))
			{
				return true;
			}
			else
			{
				return false;
			}
}
