
function nps_validateForm()
{
	if(Trim(document.npsWS_Form.npsWS_1.value) == "") 
	{	alert("Please choose the category that best describes you.");
		document.npsWS_Form.npsWS_1.focus();
		return false;
	} else 
		if((Trim(document.npsWS_Form.npsWS_1.value) == "9") && (Trim(document.npsWS_Form.npsWS_1other.value) == ""))
		{	alert("Please specify the category that best describes you.");
			document.npsWS_Form.npsWS_1other.focus();
			return false;
		}
	
	if(Trim(document.npsWS_Form.npsWS_2.value) == "") 
	{	alert("Please specify how often do you visit the NPS website.");
		document.npsWS_Form.npsWS_2.focus();
		return false;
	}
	if(Trim(document.npsWS_Form.npsWS_3.value) == "") 
	{	alert("Please specify whether it is easy to navigate to the pages that you want to get to.");
		document.npsWS_Form.npsWS_3.focus();
		return false;
	}
	if(Trim(document.npsWS_Form.npsWS_4.value) == "") 
	{	alert("Please specify whether the search function on the website returns results that are useful to you.");
		document.npsWS_Form.npsWS_4.focus();
		return false;
	}
	if(Trim(document.npsWS_Form.npsWS_5.value) == "") 
	{	alert("Please specify whether the website helps you to understand who NPS is and what they do. ");
		document.npsWS_Form.npsWS_5.focus();
		return false;
	}
	if(Trim(document.npsWS_Form.npsWS_6.value) == "") 
	{	alert("Please specify whether the website provides useful information that has been written for people like you. ");
		document.npsWS_Form.npsWS_6.focus();
		return false;
	}
	if(Trim(document.npsWS_Form.npsWS_7.value) == "") 
	{	alert("Please specify whether the website has clear information about career opportunities at NPS.");
		document.npsWS_Form.npsWS_7.focus();
		return false;
	}
	if(Trim(document.npsWS_Form.npsWS_8.value) == "") 
	{	alert("Please specify whether the website keeps you up-to-date about new medicines.");
		document.npsWS_Form.npsWS_8.focus();
		return false;
	}
	if(Trim(document.npsWS_Form.npsWS_9.value) == "") 
	{	alert("Please specify whether the website offers an easy ordering process for free NPS resources.");
		document.npsWS_Form.npsWS_9.focus();
		return false;
	}
	if(Trim(document.npsWS_Form.npsWS_10.value) == "") 
	{	alert("Please specify whether the website helps you to manage your NPS subscriptions and communications.");
		document.npsWS_Form.npsWS_10.focus();
		return false;
	}
	if(Trim(document.npsWS_Form.npsWS_11.value) == "") 
	{	alert("Please specify whether the website provides useful links to other websites that are of interest to you.");
		document.npsWS_Form.npsWS_11.focus();
		return false;
	}
	if(Trim(document.npsWS_Form.npsWS_12.value) == "") 
	{	alert("Please specify whether the website is visually pleasing.");
		document.npsWS_Form.npsWS_12.focus();
		return false;
	}
	if(Trim(document.npsWS_Form.npsWS_13.value) == "") 
	{	alert("Please specify if you would recommend this web site to others.");
		document.npsWS_Form.npsWS_13.focus();
		return false;
	}
	
	return true;
}

function nps_noEnter(module,obj) //preventing form submit event on pressing enter key
{
  if(window.event && window.event.keyCode == 13)
  {
		processSubmit(module,obj);	
		return false;
	}
	else return true;
}



function Trim(TRIM_VALUE)
{		if(TRIM_VALUE.length < 1)
		{	return"";
		}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE=="")
	{		return "";	
	}
	else
	{		return TRIM_VALUE;
	}
} 

function RTrim(VALUE)
{		var w_space = String.fromCharCode(32);
		var v_length = VALUE.length;
		var strTemp = "";
	if(v_length < 0)
	{	return"";
	}
		var iTemp = v_length -1;
	while(iTemp > -1)
	{	if(VALUE.charAt(iTemp) == w_space)
		{}
		else
		{	strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;
	} 
	return strTemp;
}

function LTrim(VALUE)
{		var w_space = String.fromCharCode(32);
	if(v_length < 1)
	{	return"";
	}
		var v_length = VALUE.length;
		var strTemp = "";
		var iTemp = 0;
	while(iTemp < v_length)
	{	if(VALUE.charAt(iTemp) == w_space)
		{}
		else
		{	strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp = iTemp + 1;
	} 
	return strTemp;
} 


	
