// JavaScript Document

function checkAll(field) 
	{
	for (i = 0; i < field.length; i++)
		field[i].checked = true ;
	}
	function uncheckAll(field) 
	{
	for (i = 0; i < field.length; i++)
		field[i].checked = false ;
	}
var gridRender = function()
		{
		grid = ColdFusion.Grid.getGridObject('Recruiters');   //Get grid object
		//overwrite existing grid footer with new div, Ext.id() will assign unique id to footer
		var bbar = Ext.DomHelper.overwrite(grid.bbar,{tag:'div',id:Ext.id()},true);
		//Create new PaginToolbar and render it to bbar (grid footer)
		gbbar = new Ext.PagingToolbar({
			renderTo:bbar,
			items: [
							{
							 text:"<b>Check All</b>",
							   cls:"x-btn-text",
							   tooltip:"Select All",
							   handler: function(){checkAll(document.recruiterlist.SendEmail);}
							  },
							'-',
							{
							 text:"<b>Uncheck All</b>",
							   cls:"x-btn-text",
							   tooltip:"Select All",
							   handler: function(){uncheckAll(document.recruiterlist.SendEmail);}
							  },
							'-',
							{
							 text:"<b>Email Checked</b>",
							   cls:"x-btn-text",
							   tooltip:"Email Checked",
							   handler: batchemail
							  }
							],
			store: grid.store,
			pageSize: 12,
			/*displayInfo: true,
			displayMsg: '<b>Showing {0} - {1} out of {2}</b>',
			emptyMsg: "<b>No Records</b>"*/
					});
		};
function submitform(){
  		document.forms["providerretrieve"].submit();
	}
	function valbutton(thisform) {
	// place any other field validations that you require here
	// validate myradiobuttons
	myOption = -1;
	for (i=thisform.question1.length-1; i > -1; i--) {
	if (thisform.question1[i].checked) {
	myOption = i; i = -1;
	}
	}
	if (myOption == -1) {
	alert("You must select an answer for the first question");
	return false;
	}
	myOption = -1;
	for (i=thisform.question2.length-1; i > -1; i--) {
	if (thisform.question2[i].checked) {
	myOption = i; i = -1;
	}
	}
	if (myOption == -1) {
	alert("You must select an answer for the second question");
	return false;
	}
	myOption = -1;
	for (i=thisform.question3.length-1; i > -1; i--) {
	if (thisform.question3[i].checked) {
	myOption = i; i = -1;
	}
	}
	if (myOption == -1) {
	alert("You must select an answer for the third question");
	return false;
	}
	myOption = -1;
	for (i=thisform.question4.length-1; i > -1; i--) {
	if (thisform.question4[i].checked) {
	myOption = i; i = -1;
	}
	}
	if (myOption == -1) {
	alert("You must select an answer for the fourth question");
	return false;
	}
	// place any other field validations that you require here
	submitform(); // this line submits the form after validation
	}
