/**************************************************************************************
 * File Name	:	Feedback.js
 * Description	:	This file contains  the functions which is used for  FeedBack
                    Page Validations in SMBSA application.
 *
 * Modification Log
 * Ver		Date					Author                       Description
 * ------------------------------------------------------------
 * 0.00a  	24-Dec-2004        Abhishek Srivastava				Initail Draft
 **************************************************************************************/
 
 //******************************************************************************
 // Function Name		:	fnValidateFeedback
 // Created Date		:	24-Dec-2004
 // Description			:	Validates the Feedback Screen 
 // Input Parameters	:	None
 // Output Parameters	:   None
//******************************************************************************

function fnValidateFeedback()
{   
    
    var_gen=document.FeedbackForm;
	var el = document.FeedbackForm.elements;
	var itemchecked = false;
	for(var i = 0 ; i < el.length ; ++i)
	{
		if(el[i].type == "radio")
		{
			var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
			
			for(var j = 0 ; j < radiogroup.length ; ++j)
			{
				 if(radiogroup[j].checked)
				  {
					  itemchecked = true;
					  break;
				   }
	                 }
	           
	 	}

     		if (el[i].name=="text_713")//suggestion:modified for Tact#4169 
		{
			elementValue=el[i].value;
			elementSuggestion=el[i];
		}
	}
	//Added by vidrao on 19 Jan 2005 to make compulsary either rating or suggestion
	if(fnIsBlank(elementValue)&&!itemchecked)	
	{
		alert(alertRatingorSuggestion);
		elementSuggestion.focus();
		return false;
	}
	


	// checking for the maximum length of problem details which is maxLength
	if(!fnCheckMaxLength(elementValue, maxLengthfb))
	{
			alert(alertFeedbackMaxLengthCrossed);
			elementSuggestion.focus();
			return false;
	}
	//checking for entry of name
	//Modifications by vidrao dated 7 Jan 2005
	//Removing of the compulsary validation of full name and email address
	//Now checking if email id is correct only if its not empty
	//checking for correct email id
	if(!fnIsBlank(var_gen.email.value)&&!fnIsValidEmail(var_gen.email.value.toString()))
	{
			alert(alertFBIncorrectMailId);
			var_gen.email.focus();
			return false;
	}
	
	return true;
}


