//====================================================================================================
//	File Name		:	login.js
//----------------------------------------------------------------------------------------------------
//						Date				Author					Remark
//						05-May-2005			Nitin rana			Initial Release
//
//====================================================================================================

//====================================================================================================
//	Function Name	:	Form_Submit()
//	Purpose			:	This function will executed when user submits a form. It checks validity of 
//						every field in the form.
//	Parameters		:	frm  - form name
//	Return			:	true or false
//	Author			:	Nitin Rana
//	Creation Date	:	05-May-2005
//----------------------------------------------------------------------------------------------------
function Form_Submit(frm)
{
	with(frm)
    {
		if(!IsEmpty(course_title, 'Please, enter the Course Title.'))
		{
			return false;
		}
        return true;
    }
}
//====================================================================================================
//	Function Name	:	Add_Click()
//	Purpose			:	This function will executed when user submits a form. It checks validity of 
//						every field in the form.
//	Parameters		:	frm  - form name
//	Return			:	true or false
//	Author			:	Nitin Rana
//----------------------------------------------------------------------------------------------------
function Add_Click()
{
	with(document.frmCourse)
	{
		Action.value = "Add";
		submit();
	}
}
//====================================================================================================
//	Function Name	:	Edit_Click()
//	Purpose			:	This function will executed when user submits a form. It checks validity of 
//						every field in the form.
//	Parameters		:	frm  - form name
//	Return			:	true or false
//	Author			:	Nitin Rana
//----------------------------------------------------------------------------------------------------
function Edit_Click(Cat_Id)
{
	with(document.frmCourse)
	{
		Action.value = "Modify";
		course_id.value = Cat_Id;
		submit();
	}
}
//====================================================================================================
//	Function Name	:	Delete_Click()
//	Purpose			:	This function will executed when user submits a form. It checks validity of 
//						every field in the form.
//	Parameters		:	frm  - form name
//	Return			:	true or false
//	Author			:	Nitin Rana
//----------------------------------------------------------------------------------------------------
function Delete_Click(Cat_Id)
{
	with(document.frmCourse)
	{
		if(confirm('Are you sure you want to delete this Category?'))
		{
			Action.value = "Delete";
			course_id.value = Cat_Id;
			submit();
		}
	}
}

function Action_Click(CourseId,ActionValue)
{
	with(document.frmCourse)
	{
		//alert(NotesId);	
		if(CourseId)
		{
			course_id.value = CourseId;
		}
		Action.value = ActionValue;
		submit();
	}
}

function calendarCallback(date, month, year)
{
	//date = date + '/' + month + '/' + year;
	if(month <= 9)
	{ month = '0'+month }
	if(date <= 9)
	{ date = '0'+date }
	
	date =  year +'-' + month + '-' + date ;
	document.all.notes_date.value = date;	// name of the form itself is forms[0]
	document.all.notes_date.focus();
}


function view_record(courseid)
{
	with(document.frmCourse)
	{
		if(courseid == 0)
		{
			alert('You are viewing first hole, click Next');
		}
		else
		{
			course_id.value = courseid;
			Action.value	= 'Show';
			submit();
		}
	}
}


function view_record1(courseid)
{
	with(document.frmCourse)
	{
		if(courseid == 0)
		{
			alert('You are viewing last hole, click Previous');
		}
		else
		{
			course_id.value = courseid;
			Action.value	= 'Show';
			submit();
		}
	}
}



