//--------------------------------------------------------------------------------------//
// File Name			: Valid1.js														//
// Author Name			: Dilip M P														//
// Date of Creation		: 01-10-2001													//
// Version				: 1.0															//
// Synopsis				: This file contains the functions that check the forms for		//
//						  the entries in the not null fields if the entries are not made//
//						  then a message flashed and the focus returns to that			//
//						  particular field.												//
//																						//
// Procedures Invoked	:               												//
//																						//
// Revision History		:																//
//																						//
// DATE			AUTHOR			VERSION					MODIFICATION					//
//--------------------------------------------------------------------------------------//

//------------------------------------------------------------------------//
// 			FUNCTIONS													  //
//------------------------------------------------------------------------//  
// browser check checks for the version of the browser and the type       //
//------------------------------------------------------------------------//

netBrowser = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) 
ieBrowser = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 ))

//========================================================================================
//========================================================================================

//--------------------------------------------------------------------------------------//
// File Name			: messLoginFormChkNull(me)											//
// Author Name			: Dilip M P														//
// Date of Creation		: 27-03-2001													//
// Version				: 2.0															//
// Synopsis				: This function checks for the username and password field of	//
//						  ordinary user edit form if not present it flashes a message	//
//						  focuses on the particular field								//
// Procedures Invoked	:																//
//																						//
// Revision History		:																//
//																						//
// DATE			AUTHOR			VERSION					MODIFICATION					//
//--------------------------------------------------------------------------------------//
var messLogin_arr = new Array("UserName","Password")
var messLogin_nn = new Array(0,1)

function messLoginFormChkNull(me)
{
	var num = me.length    //number of control elements in the form
	Flag = 0
	for (var n=0; n<num; n++) 
	{
		for(var i=0;i<messLogin_nn.length;i++)
		{
			if(n==messLogin_nn[i])
			{
				// the null field checking block//
				if(me.elements[messLogin_nn[i]].type == "text" || me.elements[messLogin_nn[i]].type == "password")
				{
					if ((me.elements[messLogin_nn[i]].value == null || me.elements[messLogin_nn[i]].value == "")) 
				   	{ 
						Flag = 1
						break 
					}
				}
			}
		}
		if(Flag == 1)
		{
			validFlag = false 
			break
		}
	}
	// the messaging block in case of null field focus returned to the null field //
	if(Flag == 1)
	{
		alert("The " + messLogin_arr[n] + " field cannot be blank. Please enter a value.") 
		me.elements[messLogin_nn[i]].focus()
		return false
	}
}
//--------------------------------------------------------------------------------//

//--------------------------------------------------------------------------------------//
// File Name			: forgotPwdFormChkNull(me)										//
// Author Name			: Dilip M P														//
// Date of Creation		: 01-11-2001													//
// Version				: 2.0															//
// Synopsis				: This function gives the message when no entries are made into //
//						  the not null fields of forgot password form					//
// Procedures Invoked	: message1(Flag)												//
//																						//
// Revision History		:																//
//																						//
// DATE			AUTHOR			VERSION					MODIFICATION					//
//--------------------------------------------------------------------------------------//
var forgotpwd_arr = new Array("UserName")
//var edit_nn = new Array(0,1)

function forgotPwdFormChkNull(me)
{
	var num = me.length    //number of control elements in the form
	Flag = 0
	for (var n=0; n<num; n++) 
	{
		for(var i=0;i<forgotpwd_arr.length;i++)
		{
			if(n==0)
			{
				// the null field checking block//
				if(me.elements[0].type == "text" || me.elements[0].type == "password")
				{
					if ((me.elements[0].value == null || me.elements[0].value == "")) 
				   	{ 
						Flag = 1
						break 
					}
				}
			}
		}
		if(Flag == 1)
		{
			validFlag = false 
			break
		}
	}
	// the messaging block in case of null field focus returned to the null field //
	if(Flag == 1)
	{
		alert("The " + forgotpwd_arr[n] + " field cannot be blank. Please enter a value.") 
		me.elements[0].focus()
		return false
	}
}
//--------------------------------------------------------------------------------//

//--------------------------------------------------------------------------------------//
// File Name			: chgPwdFormChkNull(me)											//
// Author Name			: Dilip M P														//
// Date of Creation		: 01-11-2001													//
// Version				: 2.0															//
// Synopsis				: This function gives the message when no entries are made into //
//						  the not null fields of change password form					//
// Procedures Invoked	: message1(Flag)												//
//																						//
// Revision History		:																//
//																						//
// DATE			AUTHOR			VERSION					MODIFICATION					//
//--------------------------------------------------------------------------------------//
var chgpwd_arr = new Array("Old Password","New Password","Confirm New Password")
var chgpwd_nn = new Array(0,1,2)

function chgPwdFormChkNull(me)
{
	var num = me.length    //number of control elements in the form
	Flag = 0
	for (var n=0; n<num; n++) 
	{
		for(var i=0;i<chgpwd_nn.length;i++)
		{
			if(n==chgpwd_nn[i])
			{
				// the null field checking block//
				if(me.elements[chgpwd_nn[i]].type == "text" || me.elements[chgpwd_nn[i]].type == "password")
				{
					if ((me.elements[chgpwd_nn[i]].value == null || me.elements[chgpwd_nn[i]].value == "")) 
				   	{ 
						Flag = 1
						break 
					}
				}
			}
		}
		if(Flag == 1)
		{
			validFlag = false 
			break
		}
	}
	// the messaging block in case of null field focus returned to the null field //
	if(Flag == 1)
	{
		alert("The " + chgpwd_arr[n] + " field cannot be blank. Please enter a value.") 
		me.elements[chgpwd_nn[i]].focus()
		return false
	}
}

//--------------------------------------------------------------------------------------//
// File Name			: forgotPwdHChkNull(me)											//
// Author Name			: Dilip M P														//
// Date of Creation		: 01-11-2001													//
// Version				: 2.0															//
// Synopsis				: This function gives the message when no entries are made into //
//						  the not null fields of forgot password hint ans form			//
// Procedures Invoked	: message1(Flag)												//
//																						//
// Revision History		:																//
//																						//
// DATE			AUTHOR			VERSION					MODIFICATION					//
//--------------------------------------------------------------------------------------//
var forgotpwdH_arr = new Array("Hint Answer")
//var chgpwd_nn = new Array(0,1,2)

function forgotPwdHChkNull(me)
{
	var num = me.length    //number of control elements in the form
	Flag = 0
	for (var n=0; n<num; n++) 
	{
		for(var i=0;i<forgotpwdH_arr.length;i++)
		{
			if(n==1)
			{
				// the null field checking block//
				if(me.elements[1].type == "text" || me.elements[1].type == "password")
				{
					if ((me.elements[1].value == null || me.elements[1].value == "")) 
				   	{ 
						Flag = 1
						break 
					}
				}
			}
		}
		if(Flag == 1)
		{
			validFlag = false 
			break
		}
	}
	// the messaging block in case of null field focus returned to the null field //
	if(Flag == 1)
	{
		alert("The " + forgotpwdH_arr[i] + " field cannot be blank. Please enter a value.") 
		me.elements[1].focus()
		return false
	}
}

//--------------------------------------------------------------------------------------//
// File Name			: checkConPass(fieldVal,me)										//
// Author Name			: Dilip M P														//
// Date of Creation		: 01-11-2001													//
// Version				: 2.0															//
// Synopsis				: This function checks for the confirm password to be same as	//
//						  the password given, if not smae it flashes a message and puts //
//						  focus back on the confirm password field						//
// Procedures Invoked	:																//
//																						//
// Revision History		:																//
//																						//
// DATE			AUTHOR			VERSION					MODIFICATION					//
//--------------------------------------------------------------------------------------//
function checkConPass(fieldVal,me)
{
	if(!(me.value == null || me.value == "") && !(fieldVal==null || fieldVal==""))
	{
		if(!(fieldVal == me.value))
		{
			// messaging block for the valid email and returning focus to the email field //
			alert("The confirm password and password field values do not match.!Please verify")
			me.focus();
			me.select();
		}
	}
	else if(me.value == null || me.value == "")
	{
		validFlag = false
	}
}

//--------------------------------------------------------------------------------------//
// File Name			: messBoardSearchChkNull()										//
// Author Name			: Dilip M P														//
// Date of Creation		: 01-11-2001													//
// Version				: 2.0															//
// Synopsis				: This function gives the message when no entries are made into //
//						  the not null fields of forgot password hint ans form			//
// Procedures Invoked	: 												//
//																						//
// Revision History		:																//
//																						//
// DATE			AUTHOR			VERSION					MODIFICATION					//
//--------------------------------------------------------------------------------------//

function messBoardSearchChkNull()
{
	Flag = 0
	if(document.form1.efluidsSearchKeywords.type == "text" || document.form1.efluidsSearchKeywords.type == "password")
	{
		if ((document.form1.efluidsSearchKeywords.value == null || document.form1.efluidsSearchKeywords.value == "")) 
	   	{ 
			alert("The Keywords field cannot be blank. Please enter a value.") 
			document.form1.efluidsSearchKeywords.focus()
			return false
		}
	}
}

//------------------------------------------------------------------------//
//		Post new message array			                                 //
//------------------------------------------------------------------------//
var newMess_arr = new Array("Your Name","Email",0,"Title","Message")

var newMess_nn = new Array(0,1,3,4)

//--------------------------------------------------------------------------------------//
// File Name			: newMessChkNull()												//
// Author Name			: Dilip M P														//
// Date of Creation		: 27-03-2001													//
// Version				: 2.0															//
// Synopsis				: This function checks for the not null fields according to the //
//						  defined above and flashes the corresponding message			//
//																						//
// Procedures Invoked	:																//
//																						//
// Revision History		:																//
//																						//
// DATE			AUTHOR			VERSION					MODIFICATION					//
//--------------------------------------------------------------------------------------//

function newMessChkNull()
{
	var num = document.form2.length    //number of control elements in the form
	Flag = 0
	for (var n=0; n<num; n++) 
	{
		for(var i=0;i<newMess_nn.length;i++)
		{
			if(n==newMess_nn[i])
			{
				// the null field checking block//
				if(document.form2.elements[newMess_nn[i]].type == "text" || document.form2.elements[newMess_nn[i]].type == "password" ||
					document.form2.elements[newMess_nn[i]].type == "textarea"  || document.form2.elements[newMess_nn[i]].type == "file")
				{
					if ((document.form2.elements[newMess_nn[i]].value == null || document.form2.elements[newMess_nn[i]].value == "")) 
				   	{ 
						Flag = 1
						break 
					}
				}
/*				else if(document.form2.elements[newMess_nn[i]].type == "select-one")
				{
					if ((document.form2.elements[newMess_nn[i]].selectedIndex == 0 ) && 
					(document.form2.elements[newMess_nn[i]].type != 'submit' || document.form2.elements[newMess_nn[i]].type != 'reset'))
	 				{ 
						Flag = 2
						break 
					}
				}*/
			}
		}
		if(Flag == 1 || Flag == 2)
		{
			validFlag = false 
			break
		}
	}
	// the messaging block in case of null field focus returned to the null field //
	if(Flag == 1)
	{
		
		alert("The " + newMess_arr[n] + " field cannot be blank. Please enter a value.") 
		document.form2.elements[newMess_nn[i]].focus()
		return false
	}
	if(Flag == 2)
	{

		alert("Please select a value in " + newMess_arr[n] + " field.")
		document.form2.elements[newMess_nn[i]].focus()
		return false
	}
}
//------------------------------------------------------------------------//
