function openCPAPreferral()
{
	var screenx = (screen.width- 900)/2
	var screeny = (screen.Height - 600)/2
	
	var referralForm = window.open("CPAPreferral.html", "SurveyWin", "width=900, height=600, top=" + screeny + ", left=" + screenx + ",scrollbars, toolbars=no");
	referralForm.focus();
}

function openForm()
{
	var screenx = (screen.width- 800)/2
	var screeny = (screen.Height - 600)/2
	
	var referralForm = window.open("referral.html", "ReferralWin", "width=800, height=600, top=" + screeny + ", left=" + screenx + ",scrollbars, toolbars=no");
	referralForm.focus();
}

function openPPT()
{
	var screenx = (screen.width- 480)/2
	var screeny = (screen.Height - 260)/2
	
	var pptWin = window.open("ppt/ppt.htm", "PayerPPT", "width=480, height=385, top=" + screeny + ", left=" + screenx + ",toolbars=no");
	pptWin.focus();

}

function openSurvey()
{
	var screenx = (screen.width- 800)/2
	var screeny = (screen.Height - 600)/2
	
	var referralForm = window.open("survey.html", "SurveyWin", "width=800, height=600, top=" + screeny + ", left=" + screenx + ",scrollbars, toolbars=no");
	referralForm.focus();
}

function resetForm()
{
	document.frmReferral.reset()
}

function resetSurvey()
{
	document.frmSurvey.reset()
}

/* Trim Functions */
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;
	}
	} //End Function

	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;

	} //End While
	return strTemp;

	} //End Function

	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;
	} //End While
	return strTemp;
	} //End Function

	function getRadioValue(radioSet)
	{
		selectedOption = -1

		for ( i = 0; i < radioSet.length; i++)
		{
			if (radioSet[i].checked)
			{
				selectedOption = i
			}
		}
		return selectedOption
	}
	
	
	/* openQuestionnaire */
	
	function openQuestionnaire()
	{
		var screenx = (screen.width- 800)/2
		var screeny = (screen.Height - 600)/2
	
		var questForm = window.open("scale.html", "QuestWin", "width=800, height=600, top=" + screeny + ", left=" + screenx + ",scrollbars, toolbars=no");
		questForm.focus();	
	}