function isEmpty(strng)
{
var error = "";
  if (strng.length == 0) {
     return true;
  }
return false;	  
}
function isRadio(rad)
{	
	for(i=rad.length-1;i>-1;i--)
	{	
		if(rad[i].checked)
			return(true);
	}
	return false;
}
function Validate_Feedback_Login()
{
	var bool = true;
	var id = document.feedbacklogin.userid.value;
	var key = document.feedbacklogin.passkey.value;
	var ws = document.feedbacklogin.onea.value;
	if(isEmpty(id) || isEmpty(key))
		bool = false;
	if(id!="pyramid" || key!="liberty"){
		bool = false;
		alert('Invalid ID/Pass');
	}
	if(isEmpty(ws))	
		bool = false;
	
	if(isEmpty(document.feedbacklogin.userid.value)){document.getElementById('userq').style.color ="#cc0000"; document.getElementById('userq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(isEmpty(document.feedbacklogin.passkey.value)){document.getElementById('passq').style.color ="#cc0000"; document.getElementById('passq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(isEmpty(document.feedbacklogin.onea.value)){document.getElementById('oneq').style.color ="#cc0000"; document.getElementById('oneq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	
	if(!isEmpty(document.feedbacklogin.userid.value)){document.getElementById('userq').style.color ="#000000"; document.getElementById('userq').style.fontWeight="normal";}
 	if(!isEmpty(document.feedbacklogin.passkey.value)){document.getElementById('passq').style.color ="#000000"; document.getElementById('passq').style.fontWeight="normal";}
 	if(!isEmpty(document.feedbacklogin.onea.value)){document.getElementById('oneq').style.color ="#000000"; document.getElementById('oneq').style.fontWeight="normal";}
 	
	if(isEmpty(document.feedbacklogin.userid.value)){bool = false;}
	if(isEmpty(document.feedbacklogin.passkey.value)){bool = false;}
	if(isEmpty(document.feedbacklogin.onea.value)){bool = false;}
	
	return(bool);
	

}
function Validate_Feedback()
{
 //ErrorizeFields that are invalid
 ErrorizeFields();
 //Normalize Fields that are valid
 NormalizeFields();
 //Return True/False If all fields valid
 return ValidateFields();
}
function ErrorizeFields()
{
	ErrorizeGeneralFields();
	ErrorizeUtilityFields();
	ErrorizeQualityFields();
	ErrorizeEffectFields();
	ErrorizeGoalFields();
}
function NormalizeFields()
{
 	NormalizeGeneralFields();
	NormalizeUtilityFields();
	NormalizeQualityFields();
	NormalizeEffectFields();
	NormalizeGoalFields();
}
function ValidateFields()
{
	var bool = true;
	
	if(isEmpty(document.feedback.onea.value)){bool = false;}
	if(!isRadio(document.feedback.twoa)){bool = false;}
	if(!isRadio(document.feedback.threea)){bool = false;}
	if(isEmpty(document.feedback.foura.value)){bool = false;}
	if(isEmpty(document.feedback.fivea.value)){bool = false;}
	if(isEmpty(document.feedback.sixa.value)){bool = false;}
	if(isEmpty(document.feedback.sevena.value)){bool = false;}
	if(isEmpty(document.feedback.eighta.value)){bool = false;}
	if(!isRadio(document.feedback.ninea)){bool = false;}
	if(!isRadio(document.feedback.tena)){bool = false;}
	if(!isRadio(document.feedback.elevena)){bool = false;}
	if(!isRadio(document.feedback.twelvea)){bool = false;}
	if(!isRadio(document.feedback.thirteena)){bool = false;}
	if(!isRadio(document.feedback.fourteena)){bool = false;}
	if(!isRadio(document.feedback.fifteena)){bool = false;}
	if(!isRadio(document.feedback.sixteena)){bool = false;}
	if(!isRadio(document.feedback.seventeena)){bool = false;}
	if(!isRadio(document.feedback.eighteena)){bool = false;}
	if(!isRadio(document.feedback.nineteena)){bool = false;}
	if(!isRadio(document.feedback.twentya)){bool = false;}
	if(!isRadio(document.feedback.twentyonea)){bool = false;}
	if(!isRadio(document.feedback.twentytwoa)){bool = false;}
	if(!isRadio(document.feedback.twentythreea)){bool = false;}
	if(!isRadio(document.feedback.twentyfoura)){bool = false;}
	if(!isRadio(document.feedback.twentyfivea)){bool = false;}
	if(!isRadio(document.feedback.twentysixa)){bool = false;}
	if(!isRadio(document.feedback.twentysevena)){bool = false;}
	if(!isRadio(document.feedback.twentyeighta)){bool = false;}
	if(!isRadio(document.feedback.twentyninea)){bool = false;}
	if(!isRadio(document.feedback.thirtya)){bool = false;}
	if(!isRadio(document.feedback.thirtyonea)){bool = false;}
	if(!isRadio(document.feedback.thirtytwoa)){bool = false;}
	if(!isRadio(document.feedback.thirtythreea)){bool = false;}
	if(!isRadio(document.feedback.thirtyfoura)){bool = false;}
	if(!isRadio(document.feedback.thirtyfivea)){bool = false;}
	if(!isRadio(document.feedback.thirtysixa)){bool = false;}
	if(!isRadio(document.feedback.thirtysevena)){bool = false;}
	if(!isRadio(document.feedback.thirtyeighta)){bool = false;}
	if(!isRadio(document.feedback.thirtyninea)){bool = false;}
	if(!isRadio(document.feedback.fortya)){bool = false;}
	if(!isRadio(document.feedback.fortyonea)){bool = false;}
	if(!isRadio(document.feedback.fortytwoa)){bool = false;}
	return bool;
}
function ErrorizeGeneralFields()
{
	if(isEmpty(document.feedback.onea.value)){document.getElementById('oneq').style.color ="#cc0000"; document.getElementById('oneq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.twoa)){document.getElementById('twoq').style.color ="#cc0000"; document.getElementById('twoq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.threea)){document.getElementById('threeq').style.color ="#cc0000"; document.getElementById('threeq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(isEmpty(document.feedback.foura.value)){document.getElementById('fourq').style.color ="#cc0000"; document.getElementById('fourq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(isEmpty(document.feedback.fivea.value)){document.getElementById('fiveq').style.color ="#cc0000"; document.getElementById('fiveq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(isEmpty(document.feedback.sixa.value)){document.getElementById('sixq').style.color ="#cc0000"; document.getElementById('sixq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(isEmpty(document.feedback.sevena.value)){document.getElementById('sevenq').style.color ="#cc0000"; document.getElementById('sevenq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(isEmpty(document.feedback.eighta.value)){document.getElementById('eightq').style.color ="#cc0000"; document.getElementById('eightq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.ninea)){document.getElementById('nineq').style.color ="#cc0000"; document.getElementById('nineq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
}
function ErrorizeUtilityFields()
{
	if(!isRadio(document.feedback.tena)){document.getElementById('tenq').style.color ="#cc0000"; document.getElementById('tenq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.elevena)){document.getElementById('elevenq').style.color ="#cc0000"; document.getElementById('elevenq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.twelvea)){document.getElementById('twelveq').style.color ="#cc0000"; document.getElementById('twelveq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.thirteena)){document.getElementById('thirteenq').style.color ="#cc0000"; document.getElementById('thirteenq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.fourteena)){document.getElementById('fourteenq').style.color ="#cc0000"; document.getElementById('fourteenq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.fifteena)){document.getElementById('fifteenq').style.color ="#cc0000"; document.getElementById('fifteenq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.sixteena)){document.getElementById('sixteenq').style.color ="#cc0000"; document.getElementById('sixteenq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.seventeena)){document.getElementById('seventeenq').style.color ="#cc0000"; document.getElementById('seventeenq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.eighteena)){document.getElementById('eighteenq').style.color ="#cc0000"; document.getElementById('eighteenq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.nineteena)){document.getElementById('nineteenq').style.color ="#cc0000"; document.getElementById('nineteenq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
}
function ErrorizeQualityFields()
{
	if(!isRadio(document.feedback.twentya)){document.getElementById('twentyq').style.color ="#cc0000"; document.getElementById('twentyq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.twentyonea)){document.getElementById('twentyoneq').style.color ="#cc0000"; document.getElementById('twentyoneq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.twentytwoa)){document.getElementById('twentytwoq').style.color ="#cc0000"; document.getElementById('twentytwoq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.twentythreea)){document.getElementById('twentythreeq').style.color ="#cc0000"; document.getElementById('twentythreeq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.twentyfoura)){document.getElementById('twentyfourq').style.color ="#cc0000"; document.getElementById('twentyfourq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.twentyfivea)){document.getElementById('twentyfiveq').style.color ="#cc0000"; document.getElementById('twentyfiveq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.twentysixa)){document.getElementById('twentysixq').style.color ="#cc0000"; document.getElementById('twentysixq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.twentysevena)){document.getElementById('twentysevenq').style.color ="#cc0000"; document.getElementById('twentysevenq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.twentyeighta)){document.getElementById('twentyeightq').style.color ="#cc0000"; document.getElementById('twentyeightq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
}
function ErrorizeEffectFields()
{
	if(!isRadio(document.feedback.twentyninea)){document.getElementById('twentynineq').style.color ="#cc0000"; document.getElementById('twentynineq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.thirtya)){document.getElementById('thirtyq').style.color ="#cc0000"; document.getElementById('thirtyq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.thirtyonea)){document.getElementById('thirtyoneq').style.color ="#cc0000"; document.getElementById('thirtyoneq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.thirtytwoa)){document.getElementById('thirtytwoq').style.color ="#cc0000"; document.getElementById('thirtytwoq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.thirtythreea)){document.getElementById('thirtythreeq').style.color ="#cc0000"; document.getElementById('thirtythreeq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.thirtyfoura)){document.getElementById('thirtyfourq').style.color ="#cc0000"; document.getElementById('thirtyfourq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.thirtyfivea)){document.getElementById('thirtyfiveq').style.color ="#cc0000"; document.getElementById('thirtyfiveq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.thirtysixa)){document.getElementById('thirtysixq').style.color ="#cc0000"; document.getElementById('thirtysixq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.thirtysevena)){document.getElementById('thirtysevenq').style.color ="#cc0000"; document.getElementById('thirtysevenq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.thirtyeighta)){document.getElementById('thirtyeightq').style.color ="#cc0000"; document.getElementById('thirtyeightq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.thirtyninea)){document.getElementById('thirtynineq').style.color ="#cc0000"; document.getElementById('thirtynineq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.fortya)){document.getElementById('fortyq').style.color ="#cc0000"; document.getElementById('fortyq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
}
function ErrorizeGoalFields()
{
	if(!isRadio(document.feedback.fortyonea)){document.getElementById('fortyoneq').style.color ="#cc0000"; document.getElementById('fortyoneq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
	if(!isRadio(document.feedback.fortytwoa)){document.getElementById('fortytwoq').style.color ="#cc0000"; document.getElementById('fortytwoq').style.fontWeight="bold";  
	document.getElementById('error_msg').style.display = "";}
}
function NormalizeGeneralFields()
{
	if(!isEmpty(document.feedback.onea.value)){document.getElementById('oneq').style.color ="#000000"; document.getElementById('oneq').style.fontWeight="normal";}
 	if(isRadio(document.feedback.twoa)){document.getElementById('twoq').style.color ="#000000"; document.getElementById('twoq').style.fontWeight="normal";}
	if(isRadio(document.feedback.threea)){document.getElementById('threeq').style.color ="#000000"; document.getElementById('threeq').style.fontWeight="normal";}
	if(!isEmpty(document.feedback.foura.value)){document.getElementById('fourq').style.color ="#000000"; document.getElementById('fourq').style.fontWeight="normal";}
	if(!isEmpty(document.feedback.fivea.value)){document.getElementById('fiveq').style.color ="#000000"; document.getElementById('fiveq').style.fontWeight="normal"; }
	if(!isEmpty(document.feedback.sixa.value)){document.getElementById('sixq').style.color ="#000000"; document.getElementById('sixq').style.fontWeight="normal";}
	if(!isEmpty(document.feedback.sevena.value)){document.getElementById('sevenq').style.color ="#000000"; document.getElementById('sevenq').style.fontWeight="normal";}
	if(!isEmpty(document.feedback.eighta.value)){document.getElementById('eightq').style.color ="#000000"; document.getElementById('eightq').style.fontWeight="normal";}
	if(isRadio(document.feedback.ninea)){document.getElementById('nineq').style.color ="#000000"; document.getElementById('nineq').style.fontWeight="normal";}
}
function NormalizeUtilityFields()
{
	if(isRadio(document.feedback.tena)){document.getElementById('tenq').style.color ="#000000"; document.getElementById('tenq').style.fontWeight="normal";}
	if(isRadio(document.feedback.elevena)){document.getElementById('elevenq').style.color ="#000000"; document.getElementById('elevenq').style.fontWeight="normal";}
	if(isRadio(document.feedback.twelvea)){document.getElementById('twelveq').style.color ="#000000"; document.getElementById('twelveq').style.fontWeight="normal";}
	if(isRadio(document.feedback.thirteena)){document.getElementById('thirteenq').style.color ="#000000"; document.getElementById('thirteenq').style.fontWeight="normal";}
	if(isRadio(document.feedback.fourteena)){document.getElementById('fourteenq').style.color ="#000000"; document.getElementById('fourteenq').style.fontWeight="normal";}
	if(isRadio(document.feedback.fifteena)){document.getElementById('fifteenq').style.color ="#000000"; document.getElementById('fifteenq').style.fontWeight="normal";}
	if(isRadio(document.feedback.sixteena)){document.getElementById('sixteenq').style.color ="#000000"; document.getElementById('sixteenq').style.fontWeight="normal";}
	if(isRadio(document.feedback.seventeena)){document.getElementById('seventeenq').style.color ="#000000"; document.getElementById('seventeenq').style.fontWeight="normal";}
	if(isRadio(document.feedback.eighteena)){document.getElementById('eighteenq').style.color ="#000000"; document.getElementById('eighteenq').style.fontWeight="normal";}
	if(isRadio(document.feedback.nineteena)){document.getElementById('nineteenq').style.color ="#000000"; document.getElementById('nineteenq').style.fontWeight="normal";}
}
function NormalizeQualityFields()
{
	if(isRadio(document.feedback.twentya)){document.getElementById('twentyq').style.color ="#000000"; document.getElementById('twentyq').style.fontWeight="normal";}
	if(isRadio(document.feedback.twentyonea)){document.getElementById('twentyoneq').style.color ="#000000"; document.getElementById('twentyoneq').style.fontWeight="normal";}
	if(isRadio(document.feedback.twentytwoa)){document.getElementById('twentytwoq').style.color ="#000000"; document.getElementById('twentytwoq').style.fontWeight="normal";}
	if(isRadio(document.feedback.twentythreea)){document.getElementById('twentythreeq').style.color ="#000000"; document.getElementById('twentythreeq').style.fontWeight="normal";}
	if(isRadio(document.feedback.twentyfoura)){document.getElementById('twentyfourq').style.color ="#000000"; document.getElementById('twentyfourq').style.fontWeight="normal";}
	if(isRadio(document.feedback.twentyfivea)){document.getElementById('twentyfiveq').style.color ="#000000"; document.getElementById('twentyfiveq').style.fontWeight="normal";}
	if(isRadio(document.feedback.twentysixa)){document.getElementById('twentysixq').style.color ="#000000"; document.getElementById('twentysixq').style.fontWeight="normal";}
	if(isRadio(document.feedback.twentysevena)){document.getElementById('twentysevenq').style.color ="#000000"; document.getElementById('twentysevenq').style.fontWeight="normal";}
	if(isRadio(document.feedback.twentyeighta)){document.getElementById('twentyeightq').style.color ="#000000"; document.getElementById('twentyeightq').style.fontWeight="normal";}
}
function NormalizeEffectFields()
{
	if(isRadio(document.feedback.twentyninea)){document.getElementById('twentynineq').style.color ="#000000"; document.getElementById('twentynineq').style.fontWeight="normal";}
	if(isRadio(document.feedback.thirtya)){document.getElementById('thirtyq').style.color ="#000000"; document.getElementById('thirtyq').style.fontWeight="normal";}
	if(isRadio(document.feedback.thirtyonea)){document.getElementById('thirtyoneq').style.color ="#000000"; document.getElementById('thirtyoneq').style.fontWeight="normal";}
	if(isRadio(document.feedback.thirtytwoa)){document.getElementById('thirtytwoq').style.color ="#000000"; document.getElementById('thirtytwoq').style.fontWeight="normal";}
	if(isRadio(document.feedback.thirtythreea)){document.getElementById('thirtythreeq').style.color ="#000000"; document.getElementById('thirtythreeq').style.fontWeight="normal";}
	if(isRadio(document.feedback.thirtyfoura)){document.getElementById('thirtyfourq').style.color ="#000000"; document.getElementById('thirtyfourq').style.fontWeight="normal";}
	if(isRadio(document.feedback.thirtyfivea)){document.getElementById('thirtyfiveq').style.color ="#000000"; document.getElementById('thirtyfiveq').style.fontWeight="normal";}
	if(isRadio(document.feedback.thirtysixa)){document.getElementById('thirtysixq').style.color ="#000000"; document.getElementById('thirtysixq').style.fontWeight="normal";}
	if(isRadio(document.feedback.thirtysevena)){document.getElementById('thirtysevenq').style.color ="#000000"; document.getElementById('thirtysevenq').style.fontWeight="normal";}
	if(isRadio(document.feedback.thirtyeighta)){document.getElementById('thirtyeightq').style.color ="#000000"; document.getElementById('thirtyeightq').style.fontWeight="normal";}
	if(isRadio(document.feedback.thirtyninea)){document.getElementById('thirtynineq').style.color ="#000000"; document.getElementById('thirtynineq').style.fontWeight="normal";}
	if(isRadio(document.feedback.fortya)){document.getElementById('fortyq').style.color ="#000000"; document.getElementById('fortyq').style.fontWeight="normal";}
	
}
function NormalizeGoalFields()
{
	if(isRadio(document.feedback.fortyonea)){document.getElementById('fortyoneq').style.color ="#000000"; document.getElementById('fortyoneq').style.fontWeight="normal";}
	if(isRadio(document.feedback.fortytwoa)){document.getElementById('fortytwoq').style.color ="#000000"; document.getElementById('fortytwoq').style.fontWeight="normal";}	
}