function getUserGroup()
{
//	for (i=0; i<document.loginForm.login.length; i++) 
	//{
		//if (document.loginForm.login[i].checked==true)
        //{
		//	return document.loginForm.login[i].value
        //}
	//}
return document.loginForm.userType.value;
}

function loginSubmitFirstPage()
{
	var group = getUserGroup()+"s";
if (group == "Members") 
	{
		document.loginForm.hiddenAction.value = "memberLogin";
	} else if (group == "Agents"){
		document.loginForm.hiddenAction.value = "agentLogin";
	} else if (group == "Providers"){
  		document.loginForm.hiddenAction.value = "provLogin";
	}

	var pw = (document.loginForm.password.value == "") ? document.loginForm.p_request.value : document.loginForm.password.value;
	document.loginForm.password.value = pw;
	document.loginForm.p_request.value = "";
}

function loginSubmitSecondPage(groupName)
{
	var group = groupName;
	if (group == "member") 
	{
		var hw = parent.frames.s2pFrameMember.window;
		document.loginForm.hiddenAction.value = "memberLogin";
	} else if (group == "agent"){
		var hw = parent.frames.s2pFrameAgent.window;
		document.loginForm.hiddenAction.value = "agentLogin";
	} else if (group == "provider"){
		document.loginForm.hiddenAction.value = "provLogin";
	}
  
	if (group != "provider")
	{
		var hd = hw.document;
		var s2p = hd.forms.freshTokenForm.site2pstoretoken.value;
		document.loginForm.site2pstoretoken.value = s2p;
	}
}

function changeUserType(userType) {
	if(userType == "Provider"){
		var msg = document.getElementById("variable_text");
		var pwmsg = document.getElementById("variable_pw");
		msg.childNodes.item(0).nodeValue = "Tax ID:";
		pwmsg.childNodes.item(0).nodeValue = "State:";
		document.loginForm.state.style.visibility = 'visible';
		document.loginForm.p_request.style.visibility = 'hidden';
		document.loginForm.hiddenAction.value = "provLogin";

		var msg = document.getElementById("aboutL");
		msg.style.visibility = 'hidden';

		var msg = document.getElementById("forgotP");
		msg.style.visibility = 'hidden';

		var msg = document.getElementById("forgotL");
		msg.style.visibility = 'hidden';
		
		var msg = document.getElementById("setupA");
		msg.style.visibility = 'hidden';

		var msg = document.getElementById("aboutText");
		msg.style.visibility = 'hidden';

		var msg = document.getElementById("fieldNameDisplay");
		msg.innerHTML = "Enter your tax ID and state";
		document.loginForm.ssousername.value="";
	}
	else if(userType == "Member"){

		var msg = document.getElementById("variable_text");
		var pwmsg = document.getElementById("variable_pw");
		msg.childNodes.item(0).nodeValue = "Login ID:"
		pwmsg.childNodes.item(0).nodeValue = "Password:";
		document.loginForm.state.style.visibility = 'hidden';
		document.loginForm.p_request.style.visibility = 'visible';

		var msg = document.getElementById("aboutL");
		msg.style.visibility = 'visible';

		var msg = document.getElementById("forgotP");
		msg.style.visibility = 'visible';

		var msg = document.getElementById("forgotL");
		msg.style.visibility = 'visible';

		var msg = document.getElementById("setupA");
		msg.style.visibility = 'visible';

		var msg = document.getElementById("aboutText");
		msg.style.visibility = 'visible';

		var msg = document.getElementById("fieldNameDisplay");
		msg.innerHTML = "Enter your login ID and password";

		document.loginForm.ssousername.value="";
		document.loginForm.p_request.value="";
	}
	else if(userType == "Agent"){

		var msg = document.getElementById("variable_text");
		var pwmsg = document.getElementById("variable_pw");
		msg.childNodes.item(0).nodeValue = "Agent ID:"
		pwmsg.childNodes.item(0).nodeValue = "Pin:";
		document.loginForm.state.style.visibility = 'hidden';
		document.loginForm.p_request.style.visibility = 'visible';

		var msg = document.getElementById("aboutL");
		msg.style.visibility = 'visible';

		var msg = document.getElementById("forgotP");
		msg.style.visibility = 'hidden';

		var msg = document.getElementById("forgotL");
		msg.style.visibility = 'hidden';

		var msg = document.getElementById("setupA");
		msg.style.visibility = 'hidden';

		var msg = document.getElementById("aboutText");
		msg.style.visibility = 'visible';

		var msg = document.getElementById("fieldNameDisplay");

		msg.innerHTML = "Enter your login ID and password";

		document.loginForm.ssousername.value="";
		document.loginForm.p_request.value="";
	}
}

