// JavaScript Document
var whitespace = " \t\n\r";
function isEmpty(s)
{
  
   return ((s == null) || (s.length == 0))
}


function validate_Report(theForm){
	
	
	var Q = ""; // this block determines lifespan of Q
		
	
	if (isWhitespace(theForm.name.value) || theForm.name.value=="Name")
	{
		Q += "Please Provide Valid Values For:\n";
		Q += " Name \n";
	}

	if (isWhitespace(theForm.email.value) || theForm.email.value=="Email")
	{
		Q += " Email \n";

	}
	
	if (isWhitespace(theForm.comments.value) || theForm.comments.value=="Comments")
	{
		Q += " Comments \n";

	}


		
		if(Q!="")
		{
			alert(Q);
			return false;			
		}

}

function isWhitespace(s)
{  
	

	var i;
	// Is s empty?
	if (isEmpty(s)) return true;
	// Search through string's characters one by one
	// until we find a non-whitespace character.
	// When we do, return false; if we don't, return true.
	for (i=0; i<s.length; i++)
	{   
	// Check that current character isn't whitespace.
		var c = s.charAt(i);
		if (whitespace.indexOf(c) == -1) return false;
	}
	// All characters are whitespace.
	
	return true;
}


function validate_feedback(theForm)
{
	
	//alert("Test");

	
	// alert (Q);
	//return false;		
	
	
	var Q = ""; // this block determines lifespan of Q
		
	var Qwsindent = ""; // this block determines lifespan of Q
	
	var vcheckradio_Content=checkradio_Content(theForm);
	
	if (vcheckradio_Content=="")
	{
	  Qwsindent += "  - Content\n";
	}	
	
	var vcheckradio_design=checkradio_design(theForm);
	
	if (vcheckradio_design=="")
	{
	  Qwsindent += "  - Design\n";
	}	
	
    var vcheckradio_usability=checkradio_usability(theForm);
	
	if (vcheckradio_usability=="")
	{
	  Qwsindent += "  - Usability\n";
	}	
	
	
	var vcheckradio_overall=checkradio_overall(theForm);
	
	if (vcheckradio_overall=="")
	{
	  Qwsindent += "  - Overall\n";
	}	
	
	
	if(Qwsindent!="")
	{
		    Q += "Please Provide valid Value[s] For:\n";
			Q += Qwsindent;
	}
		
		
		
	
	if (isWhitespace(theForm.email.value) || theForm.email.value=="Email")
	{
		Q += "  - Email \n";

	}else if (echeck(theForm.email.value)==false)
	{
	   Q += "Invalid Email Address\n";
	}	
	else if(!isCharsInBag(theForm.email.value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@._-"))
	{
	  Q += "Email Address contains Invalid Characters\n";
	}
	
	if (isWhitespace(theForm.comments.value) || theForm.comments.value=="Comments")
	{
		Q += "  - Comments \n";

	}
	
	



		
		if(Q!="")
		{
			alert(Q);
			return false;			
		}
	
	}
	
function checkradio_Content(theForm){
   var found_it="";
   for (var i=0; i<theForm.content.length; i++)  {
		if (theForm.content[i].checked)  {
		found_it = theForm.content[i].value;
		}
   } 
   return(found_it);
}

function checkradio_design(theForm){
   var found_it="";
   for (var i=0; i<theForm.design.length; i++)  {
		if (theForm.design[i].checked)  {
		found_it = theForm.design[i].value;
		}
   } 
   return(found_it);
}

function checkradio_usability(theForm){
   var found_it="";
   for (var i=0; i<theForm.usability.length; i++)  {
		if (theForm.usability[i].checked)  {
		found_it = theForm.usability[i].value;
		}
   } 
   return(found_it);
}

function checkradio_overall(theForm){
   var found_it="";
   for (var i=0; i<theForm.overall.length; i++)  {
		if (theForm.overall[i].checked)  {
		found_it = theForm.overall[i].value;
		}
   } 
   return(found_it);
}

function validate_callback(theForm)
{
	
	
	
	var Q = ""; // this block determines lifespan of Q
		
	
	if (isWhitespace(theForm.firstName.value) || theForm.firstName.value=="First Name")
	{
		
		Q += " First Name \n";
	}
	
	if (isWhitespace(theForm.lastName.value) || theForm.lastName.value=="Last Name")
	{
		
		Q += " Last Name \n";
	}
	
	if (isWhitespace(theForm.tel.value) || theForm.tel.value=="Telephone Number")
	{
		
		Q += " Contact No \n";
	}
	
	if (isWhitespace(theForm.email.value) || theForm.email.value=="Email")
	{
		Q += " Your Email \n";

	}else if (echeck(theForm.email.value)==false)
	{
	   Q += "Invalid Email Address\n";
	}	
	else if(!isCharsInBag(theForm.email.value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@._-"))
	{
	  Q += "Email Address contains Invalid Characters\n";
	}
	
	
	
	if (isWhitespace(theForm.comments.value) || theForm.comments.value=="Comments")
	{
		Q += " Comments \n";

	}
	
	



		
		if(Q!="")
		{
		
			alert("Please Provide Valid Values For:\n"+Q);
			return false;			
		}
	
	}
	