/* Include general.js */
var s;
s = "<script language=\"javascript\" type=\"text/javascript\" src=\"/inc/general.js\"></script>";		
document.write(s);

/*******************************************************************************************************************
										GLOBAL FUNCTIONS
*******************************************************************************************************************/

function DisableControl(bControl) {
	bControl.disabled=true;
}

/* Used for Futures App */
function cancelApp() {
	var cancel = window.confirm("Are you sure you want to cancel the Futures Application?");
	
	if(cancel) {
		window.close();
	}
}

// Show/Hide functionality for checkboxes.
function chkShowHide(chkBox, id, bChecked) {
	obj = chkBox;
	
	if (bChecked == "") { // Additional argument in case I want to reverse functionality.
		bChecked =  false;
	}
	
	if (obj.checked != bChecked) {
		document.getElementById(id).style.display = 'none';
		document.getElementById(id).className = 'hide';
	} else {
		document.getElementById(id).style.display = 'inline';
		document.getElementById(id).className = '';
	}
}

function ImgShowHide(ImgID, DivID) {
	var s;
	var current=(document.getElementById(DivID).style.display == 'block') ? 'none' : 'block';		

	document.getElementById(DivID).style.display = current;	
	if (current=='block') {
		s="document." + ImgID + ".src='images/minus_new_acct.gif'"
	}
	else {
		s="document." + ImgID + ".src='images/plus_new_acct.gif'"
	}
	eval(s);
}

function notValidAge() {
	if (document.frmNewAccnt.txtDOB1!=null) {
		var datDOB = new Date(document.frmNewAccnt.txtDOB1.value+'/'+document.frmNewAccnt.txtDOB2.value+'/'+document.frmNewAccnt.txtDOB3.value);
		var today=new Date();
		var difference=0;
		var days;
		var minAge;
		
		difference=today-datDOB;
		days=difference/(1000*60*60*24);
		minAge=365*18+4;
		if (days>=minAge) {
			return(false);
		}
		else {
			return(true);
		}
	}
	else {
		return(false);
	}
}

// Moving cursor to next field
/*
function moveTab(theControl){
	if (theControl.value.length==theControl.maxLength){
		alert("2");	
		if (theControl.id=='txtSSN1'){
			if (document.frmNewAccnt.txtSSN2!=null) {
				document.frmNewAccnt.txtSSN2.focus();
			}
		}
		else if (theControl.id=='txtSSN2'){
			if (document.frmNewAccnt.txtSSN3!=null) {
				document.frmNewAccnt.txtSSN3.focus(); 
			}
		}
		else if (theControl.id=='txtJointSSN1'){
			if (document.frmNewAccnt.txtJointSSN2!=null) {
				document.frmNewAccnt.txtJointSSN2.focus();
			}
		}
		else if (theControl.id=='txtJointSSN2'){
			if (document.frmNewAccnt.txtJointSSN3!=null) {
				document.frmNewAccnt.txtJointSSN3.focus(); 
			}
		}
		else if (theControl.id=='txtTaxID1'){
			if (document.frmNewAccnt.txtTaxID2!=null) {
				document.frmNewAccnt.txtTaxID2.focus();
			}
		}
		else if (theControl.id=='txtDOB1'){
			if (document.frmNewAccnt.txtDOB2!=null) {
				document.frmNewAccnt.txtDOB2.focus();
			}
		}
		else if (theControl.id=='txtDOB2'){
			if (document.frmNewAccnt.txtDOB3!=null) {
				document.frmNewAccnt.txtDOB3.focus();
			}
		}
		else if (theControl.id=='txtJointDOB1'){
			if (document.frmNewAccnt.txtJointDOB2!=null) {
				document.frmNewAccnt.txtJointDOB2.focus();
			}
		}
		else if (theControl.id=='txtJointDOB2'){
			if (document.frmNewAccnt.txtJointDOB3!=null) {
				document.frmNewAccnt.txtJointDOB3.focus();
			}
		}
		else if (theControl.id=='txtDayPhone1'){
			if (document.frmNewAccnt.txtDayPhone2!=null) {
				document.frmNewAccnt.txtDayPhone2.focus();
			}
		}
		else if (theControl.id=='txtDayPhone2'){
			if (document.frmNewAccnt.txtDayPhone3!=null) {
				document.frmNewAccnt.txtDayPhone3.focus();
			}
		}
		else if (theControl.id=='txtEvePhone1'){
			if (document.frmNewAccnt.txtEvePhone2!=null) {
				document.frmNewAccnt.txtEvePhone2.focus();
			}
		}
		else if (theControl.id=='txtEvePhone2'){
			if (document.frmNewAccnt.txtEvePhone3!=null) {
				document.frmNewAccnt.txtEvePhone3.focus();
			}
		}
		else if (theControl.id=='txtFax1'){
			if (document.frmNewAccnt.txtFax2!=null) {
				document.frmNewAccnt.txtFax2.focus();
			}
		}
		else if (theControl.id=='txtFax2'){
			if (document.frmNewAccnt.txtFax3!=null) {
				document.frmNewAccnt.txtFax3.focus();
			}
		}
		else if (theControl.id=='txtEmployerPhone1'){
			if (document.frmNewAccnt.txtEmployerPhone2!=null) {
				document.frmNewAccnt.txtEmployerPhone2.focus();
			}
		}
		else if (theControl.id=='txtEmployerPhone2'){
			if (document.frmNewAccnt.txtEmployerPhone3!=null) {
				document.frmNewAccnt.txtEmployerPhone3.focus();
			}
		}
		else if (theControl.id=='txtMobilePhone1'){
			if (document.frmNewAccnt.txtMobilePhone2!=null) {
				document.frmNewAccnt.txtMobilePhone2.focus();
			}
		}
		else if (theControl.id=='txtMobilePhone2'){
			if (document.frmNewAccnt.txtMobilePhone3!=null) {
				document.frmNewAccnt.txtMobilePhone3.focus();
			}
		}		
	}
}
*/
/*******************************************************************************************************************
										END GLOBAL FUNCTIONS
*******************************************************************************************************************/

/*******************************************************************************************************************
										FIRST PAGE FUNCTIONS
*******************************************************************************************************************/

<!--var IND_MAIN=0; ind main-->
var IND=0; <!--ind-->
var JNT=1; <!--jnt-->
<!--var TRS_MAIN=8; trs main-->
var TRS=2; <!--trs-->
var KEOGH=3; <!--trs/keogh-->
var PSP=4; <!--trs/psp-->
var MPP=5; <!--trs/mpp-->
<!--var CRP_MAIN=10; crp main--> 
var CRP=6; <!--crp--> 
var PRT=7; <!--prt-->
var CLB=8; <!--prt/clb-->
<!--var CST_MAIN=13; cst main-->
var CST=9; <!--cst-->
var CIE=10; <!--cst/ira/edu-->
var CIR=11; <!--cst/ira/roth-->
var CIT=12; <!--cst/ira/roth-->
<!--var IRA_MAIN=3; ira main-->
var IRAT=13; <!--ira/trad-->
var IRATR=14; <!--ira/trad/ro-->
var IRAR=15; <!--ira/roth-->
var IRAS=16; <!--ira/sep-->
var IRASI=17; <!--ira/simple-->

var C=1;
var M=2;
var CO=3;
var CMO=4;

function AccntEntitySet() {
	var i=0;
	var bChanged = false;
	
	if (document.frmNewAccnt.txtAccountEntity.value!="") {
		//SB DT 14043 added two new account entities
		for (i=0;i<=IRASI;i++) {
			//alert(document.frmNewAccnt.radAccntEntity[i].value);
			if (document.frmNewAccnt.radAccntEntity[i].value==document.frmNewAccnt.txtAccountEntity.value) {			
				document.frmNewAccnt.radAccntEntity[i].checked=true;
				bChanged = true;
			}
			else {
				document.frmNewAccnt.radAccntEntity[i].checked=false;
			}
		}
		if (bChanged) {
			validateAccntTypeOptions();
		}
	}
}

function validateAccntTypeOptions() {
	var nAccntEntity=0;
	var i=0;

	//SB DT 14043 added two new account entities	
	for (i=0;i<=IRASI;i++) {
		if (document.frmNewAccnt.radAccntEntity[i] && document.frmNewAccnt.radAccntEntity[i].checked) {			
			nAccntEntity=i;
			break;
		}
	}
	if ((nAccntEntity>=IRAT && nAccntEntity<=IRASI) || (nAccntEntity>=CST && nAccntEntity<IRAT)) {
		document.frmNewAccnt.radTypeID[0].checked=true;
		document.frmNewAccnt.radTypeID[1].disabled=true;
		if(document.frmNewAccnt.radTypeID[2] != null){
			document.frmNewAccnt.radTypeID[2].disabled=true;
		}
	} 
	else {
		//document.frmNewAccnt.radTypeID[1].checked=true;
		document.frmNewAccnt.radTypeID[1].disabled=false;
		if(document.frmNewAccnt.radTypeID[2] != null){
			document.frmNewAccnt.radTypeID[2].disabled=false;
		}
	}
	//HideUnSelected(nAccntEntity);
	setAccntTypeID();
}

function HideUnSelected(nID) {
	if (nID>=IND_MAIN && nID<IRA_MAIN) {
		document.getElementById('divGeneral').style.display='block';
	}
	else {
		document.getElementById('divGeneral').style.display='none';
	}
	
	if (nID>=IRA_MAIN && nID<TRS_MAIN) {
		document.getElementById('divRetirement').style.display='block';
	}
	else {
		document.getElementById('divRetirement').style.display='none';
	}
	
	if (nID>=TRS_MAIN && nID<CRP_MAIN) {
		document.getElementById('divTrust').style.display='block';
	}
	else {
		document.getElementById('divTrust').style.display='none';
	}
	
	if (nID>=CRP_MAIN && nID<CST_MAIN) {
		document.getElementById('divBusiness').style.display='block';
	}
	else {
		document.getElementById('divBusiness').style.display='none';
	}
	
	if (nID>=CST_MAIN) {
		document.getElementById('divMinor').style.display='block';
	}
	else {
		document.getElementById('divMinor').style.display='none';
	}
	
	document.frmNewAccnt.radAccntEntity[nID].checked=true;
}

function setAccntTypeID() {
	var entdescr;
	if(document.frmNewAccnt.radTypeID[0].checked) {
		if(document.frmNewAccnt.chkTradeOption.checked) {
			document.frmNewAccnt.radAccntTypeID.value=CO;
			if(document.frmNewAccnt.txtPortfolioMargin != null){
				document.frmNewAccnt.txtPortfolioMargin.value = "";
			}
		} else {
			document.frmNewAccnt.radAccntTypeID.value=C;
		}
		//DS : 15627 : 3/14/2006 : Hide "Trade Futures" checkbox for "Cash[No minimum]" account type
		if (document.frmNewAccnt.chkTradeFutures!=null){			
			document.frmNewAccnt.chkTradeFutures.checked = false;
			document.frmNewAccnt.chkTradeFutures.disabled=true;
			if(document.getElementById('divFutAllowed') != null){
				document.getElementById('divFutAllowed').style.display = 'none';		
			}
		}			
	} else {
		//window.alert("-");
		if(document.frmNewAccnt.chkTradeOption.checked) {
			//window.alert("T");
			document.frmNewAccnt.radAccntTypeID.value=CMO;
		} else {
			//window.alert("F");
			document.frmNewAccnt.radAccntTypeID.value=M;
		}
		if(document.frmNewAccnt.radTypeID[2] != null){
			if(document.frmNewAccnt.radTypeID[2].checked){
				document.frmNewAccnt.txtPortfolioMargin.value = "1";
			}
			else{
				document.frmNewAccnt.txtPortfolioMargin.value = "";
			}
		}
		//DS : 15627 : 3/14/2006 : Show "Trade Futures" checkbox for "Cash/Margin" account type
		if (document.frmNewAccnt.chkTradeFutures!=null){
			var nAccntEntity=0;
			var i=0;
			for (i=0;i<=IRASI;i++) {
				if (document.frmNewAccnt.radAccntEntity[i] && document.frmNewAccnt.radAccntEntity[i].checked) {			
					nAccntEntity=i;
					break;
				}
			}						
			if ((nAccntEntity==IND)||(nAccntEntity==JNT)||(nAccntEntity==CRP)||(nAccntEntity==PRT)||(nAccntEntity==TRS)) {
				document.frmNewAccnt.chkTradeFutures.disabled=false;
				if(document.frmNewAccnt.chkTradeFutures.checked == true){
					if((nAccntEntity==CRP)||(nAccntEntity==PRT)||(nAccntEntity==TRS)) {
						entdescr = GetEntityDescription(nAccntEntity,false)
						if(document.getElementById('divFutAllowed') != null){
							document.getElementById('divFutAllowed').style.display = 'inline';		
							document.getElementById('divEntity').innerHTML = entdescr; 
						}
					}
					else{
						if(document.getElementById('divFutAllowed') != null){
							document.frmNewAccnt.radFutAllowed[0].checked = false;
							document.frmNewAccnt.radFutAllowed[1].checked = false;
							document.getElementById('divFutAllowed').style.display = 'none';		
						}

					}
				}
				else {
					if(document.getElementById('divFutAllowed') != null){
						document.frmNewAccnt.radFutAllowed[0].checked = false;
						document.frmNewAccnt.radFutAllowed[1].checked = false;
						document.getElementById('divFutAllowed').style.display = 'none';		
					}
				}
			} 
			else {
				document.frmNewAccnt.chkTradeFutures.checked = false;
				document.frmNewAccnt.chkTradeFutures.disabled = true;
				if(document.getElementById('divFutAllowed') != null){
					document.frmNewAccnt.radFutAllowed[0].checked = false;
					document.frmNewAccnt.radFutAllowed[1].checked = false;
					document.getElementById('divFutAllowed').style.display = 'none';		
				}
			}	
		}								
	}
	
}

/*SSLOn called from SubmitForm.*/
function SSLOn() {
	if (document.frmNewAccnt.chkSSL.checked==true){
		var sURL=location.href;
		var RegExp=/http:/i;
		
		sURL=sURL.replace(RegExp, "https:");		
		document.frmNewAccnt.action=sURL;
	} 
	else if (document.frmNewAccnt.chkSSL.checked==false){
		var sURL=location.href;
		var RegExp=/https:/i;
		
		sURL=sURL.replace(RegExp, "http:");		
		document.frmNewAccnt.action=sURL;
	}
	return true;
}

function BodyOnLoad() {
	var sValue;
	var nException=-1;
	var sQueryString=location.search.substring(1);
	var aQueryStringVars=sQueryString.split("&");
	//validateAccntTypeOptions();
	for (var i=0; i<aQueryStringVars.length; i++){
		var nPos=aQueryStringVars[i].indexOf('=');
		var sParamName=aQueryStringVars[i].substring(0,nPos);
		if ((nPos==-1) || (sParamName.toLowerCase()!='remove_frames')) continue;
		sValue=aQueryStringVars[i].substring(nPos+1);
		break;		
	}
	if (sValue!='0')		
		nException=sQueryString.indexOf('FULL_PATH_DISPLAY');
		if (nException==-1) {
			RemoveFrames('new_account.asp');
		}
		else {
			//alert(location.href);
			RemoveFrames(location.href);
		}
		validateAccntTypeOptions();
	return;
}

function SubmitForm() {
	var bSelected=true;
	var selentity = "";
	if (document.frmNewAccnt.lstCountryID.selectedIndex=="0") {
		PromptFocus(document.frmNewAccnt.lstCountryID, "Please select your country of residence.");
		return(false);
	}
	if (document.frmNewAccnt.txtCountryName!=undefined) {
		if(document.frmNewAccnt.txtCountryName.value == "") {
			PromptFocus(document.frmNewAccnt.txtCountryName, "Please enter your country of residence.");
			return(false);
		}
	}	
	if (document.frmNewAccnt.lstBranchManager!=undefined) {
		if (document.frmNewAccnt.lstBranchManager.selectedIndex=="0") {
			bSelected=false;
		}
	}
	if (!bSelected) {
		PromptFocus(document.frmNewAccnt.lstBranchManager, "Please select your branch manager.");
		return(false);		
	}
	
	SSLOn();
	if(validateRadioButtons()){
		selentity = GetSelectedEntity();
		selentity = selentity.substring(0,3);
		if(document.frmNewAccnt.chkTradeFutures != null && selentity != ""){
			if(document.frmNewAccnt.chkTradeFutures.checked == true){
				if(selentity == "crp" || selentity == "prt" || selentity == "trs") {
					if(document.frmNewAccnt.radFutAllowed != null){
						if(document.frmNewAccnt.radFutAllowed[0].checked == false && document.frmNewAccnt.radFutAllowed[1].checked == false){
							PromptFocus(document.frmNewAccnt.radFutAllowed, "Please select if your entity allows for futures trading.");
							return(false);
						}
						if(document.frmNewAccnt.radFutAllowed[0].checked == true){
							PromptFocus(document.frmNewAccnt.radFutAllowed, "You cannot open a futures account if your entity does not allow for futures trading.\n Please uncheck Futures.");
							return(false);
						}
					}
				}
			}
		}

		if(document.frmNewAccnt.radAccntTypeID.value==C) {
			var r=confirm("You are requesting to open an account without the ability to trade options.  If you want to trade options, please click Cancel and add options.  If you do not wish to trade options, click OK to continue");
			return r;

		}

		if(document.frmNewAccnt.radAccntTypeID.value==M) {
			var r=confirm("You are requesting to open an account without the ability to trade options.  If you want to trade options, please click Cancel and add options.  If you do not wish to trade options, click OK to continue");
			return r;
		}
	
		return(true);
	}
}

/**Disable all the CheckBoxes and Radio Buttons if no Country is selected in the First Page. 
Function called onLoad event and when Country has been changed.*/
function disableRadioButtons(){
	var i;	
	var nSelectedEntity;	
	for (i=0;i<=IRASI;i++) {
		if (document.frmNewAccnt.radAccntEntity[i] && document.frmNewAccnt.radAccntEntity[i].checked) {			
			nSelectedEntity=i;
			break;
		}
	}
	if (document.frmNewAccnt.lstCountryID.value == "0" ) {	
		for(i = 0 ; i < document.frmNewAccnt.radAccntEntity.length ; i++){
			document.frmNewAccnt.radAccntEntity[i].disabled = true;
		}

		document.frmNewAccnt.chkTradeOption.disabled = true;
		document.frmNewAccnt.radTypeID[0].disabled = true;
		document.frmNewAccnt.radTypeID[1].disabled = true;
		if(document.frmNewAccnt.radTypeID[2]!=null){
			document.frmNewAccnt.radTypeID[2].disabled = true;
		}
		if (document.frmNewAccnt.lstBranchManager != undefined) {
			document.frmNewAccnt.lstBranchManager.disabled = true;
		}
		if (document.frmNewAccnt.txtCountryName != undefined) {
			document.frmNewAccnt.txtCountryName.disabled = true;
		}
	}
	else {
		for(i = 0 ; i < document.frmNewAccnt.radAccntEntity.length ; i++){
			document.frmNewAccnt.radAccntEntity[i].disabled = false;
		}
		//document.frmNewAccnt.chkTradeOption.disabled = false;
		if ((nSelectedEntity>=IRAT && nSelectedEntity<=IRASI) || (nSelectedEntity>=CST && nSelectedEntity<IRAT)) {
			document.frmNewAccnt.radTypeID[0].checked=true;
			document.frmNewAccnt.radTypeID[1].disabled=true;
			if(document.frmNewAccnt.radTypeID[2] != null){
				document.frmNewAccnt.radTypeID[2].disabled=true;
			}
		}
		else{
			document.frmNewAccnt.radTypeID[0].disabled = false;
			document.frmNewAccnt.radTypeID[1].disabled = false;
			if(document.frmNewAccnt.radTypeID[2]!=null){
				document.frmNewAccnt.radTypeID[2].disabled = false;
			}
			document.frmNewAccnt.radTypeID[1].checked = true;
		}
		/*if (document.frmNewAccnt.lstBranchManager != undefined) {
			if (document.frmNewAccnt.txtBranchManager.value > ""){
				document.frmNewAccnt.lstBranchManager.disabled = true;
			}
			else{
				document.frmNewAccnt.lstBranchManager.disabled = false;
			}
		}*/
		if (document.frmNewAccnt.txtCountryName != undefined) {
			document.frmNewAccnt.txtCountryName.disabled = false;
		}
	}
	
}

/***Submit the selected country ID so as to load the desired Template (ox/oxi) */
function SubmitCountryID(){	
	var s;
	var sBranchManager="";
	var sOfferid="";
	disableRadioButtons();
	s = GetSessionID();
	if(document.frmNewAccnt.txtOfferID != null)
	{
		sOfferid= document.frmNewAccnt.txtOfferID.value;
		
		if(sOfferid == "0")
		{
		  sOfferid = "";
		}
	}
	
	if (document.frmNewAccnt.txtBranchManager != null)
	{
		sBranchManager = document.frmNewAccnt.txtBranchManager.value;
		
	}
	
	if (document.frmNewAccnt.lstCountryID.selectedIndex != 0 )	{
	
		window.location.href = "/new_account.asp?txtCountryID="+document.frmNewAccnt.lstCountryID.value+
			"&PAGE_ID=&DUP="+document.frmNewAccnt.txtDupAccnt.value+"&SessionID="+s+"&INIT_ACCNT_ID="+document.frmNewAccnt.txtInitAccntID.value+
			"&BRANCH_MANAGER="+sBranchManager + "&ASID=" + document.frmNewAccnt.txtAccountSourceID.value + "&SubPageId=" + document.frmNewAccnt.SubPageId.value + "&PROMO=" + sOfferid;		
	}
}

/* Makes sure an account entity is selected before the user continues 
Function called from SubmitForm.*/
function validateRadioButtons() {
	var btnChecked = -1;
	var sString;
	var nIndex;
	
	for (var i = 0; i < document.frmNewAccnt.radAccntEntity.length; i++) {				
		if (document.frmNewAccnt.radAccntEntity[i].checked) {
			sString=document.frmNewAccnt.radAccntEntity[i].value;
			if (sString.indexOf("_main")<0) {			
				btnChecked = i;
				//AV 2/9/2005 - This is to enable lstBranchManager in BX to get the correct branch in case it is disabled
				if (document.frmNewAccnt.txtBranchManager != null && document.frmNewAccnt.txtBranchManager.value > "") {
					if(document.frmNewAccnt.lstBranchManager != null){
						document.frmNewAccnt.lstBranchManager.disabled = false;
					}
				}
				return true;
			}
			else {
				break;
			}
		}	
	}
	
	if (btnChecked == -1) {
		/*if (i==IND_MAIN) {
			window.alert("Please select entity type of General Investing account.");
		}
		else if (i==IRA_MAIN) {
			window.alert("Please select entity type of Retirement Investing account.");
		}
		else if (i==TRS_MAIN) {
			window.alert("Please select entity type of Trust account.");
		}
		else if (i==CRP_MAIN) {
			window.alert("Please select entity type of Business account.");
		}
		else if (i==CST_MAIN) {
			window.alert("Please select entity type of Minor account.");
		}
		else 
			window.alert("Please select an account entity.");
		}*/
						
		window.alert("Please select an account entity.");				
		return false;
	}

}
/** Included for Email App functionality, customer redirected to second page directly, on click back button on the second page, values on the first page needs to be preselected **/
function checkURlAccntType(){

	var urlLanding = location.href;
	urlLanding = urlLanding.toLowerCase();
	var accnttype;
	var urlBranchid ='';
	if(urlLanding.indexOf('type')!=-1 )
		{
			namepairs = new Array();
			var queryString = window.location.href.substring((window.location.href.indexOf('?') + 1));
			var namepairs = queryString.split('&'); 
			var redirectUrl = '';

			for(var i = 0; i < namepairs.length; i++)
				{
					
					
					var tempArray = namepairs[i].split('='); 
					if(tempArray[0].toLowerCase() == 'type')
						{ 
						document.frmNewAccnt.radAccntTypeID.value=tempArray[1];
					}
					
					if(tempArray[0].toLowerCase() == 'branchid')
						{ 
						urlBranchid=tempArray[1];
					}
				}
			accnttype = document.frmNewAccnt.radAccntTypeID.value;
			if (accnttype == C)
				{
					document.frmNewAccnt.radTypeID[0].checked = true;
					document.frmNewAccnt.chkTradeOption.checked = false;
					if (document.frmNewAccnt.chkTradeFutures!=null){
						document.frmNewAccnt.chkTradeFutures.checked = false;
						document.frmNewAccnt.chkTradeFutures.disabled=true;
						if(document.getElementById('divFutAllowed') != null){
						document.getElementById('divFutAllowed').style.display = 'none';		
						}
					}

				}
			if (accnttype == M)
				{
					document.frmNewAccnt.radTypeID[1].checked = true;
					document.frmNewAccnt.chkTradeOption.checked = false;
				}
			if (accnttype == CO)
				{
					document.frmNewAccnt.radTypeID[0].checked = true;
					document.frmNewAccnt.chkTradeOption.checked = true;
					if (document.frmNewAccnt.chkTradeFutures!=null){
						document.frmNewAccnt.chkTradeFutures.checked = false;
						document.frmNewAccnt.chkTradeFutures.disabled=true;
						if(document.getElementById('divFutAllowed') != null){
						document.getElementById('divFutAllowed').style.display = 'none';		
						}
					}

				}		
			if (urlBranchid != '' && document.frmNewAccnt.lstBranchManager!=null)
			{
					
			var listBox = document.getElementById('lstBranchManager');

			for(index1 = 0 ; index1 < listBox.options.length; index1++){ 
				if(listBox[index1].value == urlBranchid)
					{
						listBox[index1].selected=true;
						break; 
					}

				}

			}
					
		}
}

/*******************************************************************************************************************
									END FIRST PAGE FUNCTIONS
*******************************************************************************************************************/




/*******************************************************************************************************************
										SECOND PAGE (LOGIN) FUNCTIONS
*******************************************************************************************************************/

/* moved to /newaccount/ox/login.htm */

/*******************************************************************************************************************
									END SECOND PAGE FUNCTIONS
*******************************************************************************************************************/




/*******************************************************************************************************************
										THIRD PAGE (PERSON) FUNCTIONS
*******************************************************************************************************************/

function disableCountry(){
	if (document.frmNewAccnt.lstCountryID != null) {
		document.frmNewAccnt.lstCountryID.disabled = true;			
	}
	if (document.frmNewAccnt.txtCountryName != null) {
		document.frmNewAccnt.txtCountryName.diabled = true;
	}
}

function DisableStateAndPassport(){
	var nSelIndex=document.frmNewAccnt.txtCountryID.value;
	var sSelectedStatus;
	var state=eval(document.frmNewAccnt.txtPassport);
	var passport=eval(document.frmNewAccnt.txtPassport);

for (i=0;i<document.frmNewAccnt.radCitizenshipStatus.length;i++) {
	if (document.frmNewAccnt.radCitizenshipStatus[i].checked==true) {
		sSelectedStatus=document.frmNewAccnt.radCitizenshipStatus[i].value;
		break;
	}
}
if (nSelIndex<=1){
	EnableButton(state);		
	if (sSelectedStatus!='nr') {
		DisablePassport(passport)
	}
}
else {		
	state.selectedIndex=0;
	DisableButton(state);
	EnablePassport(passport);
}
return;
}

function DisableSSN(sStatus) {
	if (sStatus=="nr") {
		document.frmNewAccnt.txtSSN1.disabled=true;
		document.frmNewAccnt.txtSSN2.disabled=true;
		document.frmNewAccnt.txtSSN3.disabled=true;
	}
	else {
		document.frmNewAccnt.txtSSN1.disabled=false;
		document.frmNewAccnt.txtSSN2.disabled=false;
		document.frmNewAccnt.txtSSN3.disabled=false;
	}
}

/*******************************************************************************************************************
									END THIRD PAGE FUNCTIONS
*******************************************************************************************************************/


/*******************************************************************************************************************
										FOURTH - CONTACT PAGE FUNCTIONS
*******************************************************************************************************************/

// AN: Modified to check for special characters 
function CheckContactForm() {
	var sZip;
	var sDayPhone;
	var sEvePhone;
	//var sDomesticMsg = new String();
	if (trim(document.frmNewAccnt.txtAddress1.value)==""){
		PromptFocus(document.frmNewAccnt.txtAddress1, "Please provide your address.");
		return(false);
	}
    if (SpecialCharactersExistAddress(document.frmNewAccnt.txtAddress1.value)){
		PromptFocus(document.frmNewAccnt.txtAddress1, "Please re-enter address.Please do not enter special characters");
		return(false);
	}
	if (SpecialCharactersExistAddress(document.frmNewAccnt.txtAddress2.value)){
		PromptFocus(document.frmNewAccnt.txtAddress2, "Please re-enter address.Please do not enter special characters");
		return(false);
	}
	if (IsPOBox(document.frmNewAccnt.txtAddress1.value)){
		PromptFocus(document.frmNewAccnt.txtAddress1, PO_BOX_CONFIRM_MSG);
		return(false);
	}

	if (trim(document.frmNewAccnt.txtCity.value)==""){
		PromptFocus(document.frmNewAccnt.txtCity, "Please enter your city.");
		return(false);
	}	
	
	if (SpecialCharactersExistName(document.frmNewAccnt.txtCity.value)){
		PromptFocus(document.frmNewAccnt.txtCity, "Please re-enter city.Please do not enter special characters");
		return(false);
	}
	if (document.frmNewAccnt.lstStateID!=null) {
		if (document.frmNewAccnt.lstStateID.selectedIndex=="0" && document.frmNewAccnt.txtCountryID.value=="1"){
			PromptFocus(document.frmNewAccnt.lstStateID, "Please provide your state of residence.");
			return(false);
		}
	}
	/*
	if (trim(document.frmNewAccnt.txtPostalCode.value)==""){
		PromptFocus(document.frmNewAccnt.txtPostalCode, "Please enter your Zip code.");
		return(false);
	}	
	if (document.frmNewAccnt.txtCountryID.value=="1") {
		sZip=document.frmNewAccnt.txtPostalCode.value.substring(0, 5);
		if (!isInteger(sZip) || document.frmNewAccnt.txtPostalCode.value.length<5) {
			PromptFocus(document.frmNewAccnt.txtPostalCode, "Please enter a valid Zip code.");
			return(false);
		}
	}	
	*/
	if(!validatePostalCode(document.frmNewAccnt.txtPostalCode,document.frmNewAccnt.txtCountryID.value,sDomesticMsg)){
		PromptFocus(document.frmNewAccnt.txtPostalCode, "Please enter a valid Zip code." +sDomesticMsg.value);
		return(false);
	}	
	if (document.frmNewAccnt.lstProvinces!=null) {
		if (document.frmNewAccnt.lstProvinces.value=="0") {
			PromptFocus(document.frmNewAccnt.lstProvinces, "Please provide your province of residence.");
			return(false);
		}
	}		
	if (document.frmNewAccnt.lstJointProvinces!=null) {
		if (document.frmNewAccnt.lstJointProvinces.value=="0") {
			PromptFocus(document.frmNewAccnt.lstJointProvinces, "Please provide your province of residence.");
			return(false);
		}
	}
	
	if (document.frmNewAccnt.chkMailingAddress.checked){
		if(trim(document.frmNewAccnt.txtMailAddress1.value)==''){
			PromptFocus(document.frmNewAccnt.txtMailAddress1, "Please enter your mailing address.");
			return(false);
		}
		if(SpecialCharactersExistAddress(document.frmNewAccnt.txtMailAddress1.value)){
			PromptFocus(document.frmNewAccnt.txtMailAddress1, "Please re-enter your mailing address.Please do not enter special characters");
			return(false);
		}
		if(SpecialCharactersExistAddress(document.frmNewAccnt.txtMailAddress2.value)){
			PromptFocus(document.frmNewAccnt.txtMailAddress2, "Please re-enter your mailing address.Please do not enter special characters");
			return(false);
		}
		if (trim(document.frmNewAccnt.txtMailCity.value)==""){
			PromptFocus(document.frmNewAccnt.txtMailCity, "Please enter your mailing address city.");
			return(false);
		}
		if (SpecialCharactersExistName(document.frmNewAccnt.txtMailCity.value)){
			PromptFocus(document.frmNewAccnt.txtMailCity, "Please re-enter your mailing address city.Please do not enter special characters");
			return(false);
		}
		if (document.frmNewAccnt.lstMailStateID){	
			if (document.frmNewAccnt.lstMailStateID.selectedIndex=="0" && document.frmNewAccnt.txtCountryID.value=="1"){
				PromptFocus(document.frmNewAccnt.lstMailStateID, "Please enter your mailing address state.");
				return(false);
			}
		}
		if (document.frmNewAccnt.lstMailProvinces!=null) {
			if (document.frmNewAccnt.lstMailProvinces.value=="0"){
				PromptFocus(document.frmNewAccnt.lstMailProvinces, "Please select your mailing address province.");
				return(false);
			}
		}	
		/*
		if(document.frmNewAccnt.txtMailPostalCode){
			if (document.frmNewAccnt.txtMailPostalCode.value==''){
				PromptFocus(document.frmNewAccnt.txtMailPostalCode, "Please enter your Postal Code.");
				return(false);
			}
		}
		if (document.frmNewAccnt.lstMailCountryID.selectedIndex==0){
			PromptFocus(document.frmNewAccnt.lstMailCountryID, "Please enter your mailing address country.");
			return(false);
		}
		
		if (document.frmNewAccnt.txtMailPostalCode.value=="" && document.frmNewAccnt.lstMailCountryID.selectedIndex=="1"){
			PromptFocus(document.frmNewAccnt.txtMailPostalCode, "Please enter your mailing address zip code.");
			return(false);
		}
		*/
		if(document.frmNewAccnt.txtMailPostalCode){
			if(!validatePostalCode(document.frmNewAccnt.txtMailPostalCode,document.frmNewAccnt.txtCountryID.value,sDomesticMsg)){
				PromptFocus(document.frmNewAccnt.txtMailPostalCode, "Please enter a valid mailing address zip code."+sDomesticMsg.value);
				return(false);	
			}
		}
	}
	else {
		document.frmNewAccnt.txtMailAddress1.value="";
		document.frmNewAccnt.txtMailAddress2.value="";
		document.frmNewAccnt.txtMailCity.value="";
		//document.frmNewAccnt.lstMailCountryID.selectedIndex=0;
		if (document.frmNewAccnt.lstMailStateID!=null) {
			document.frmNewAccnt.lstMailStateID.selectedIndex=0;
		}
		document.frmNewAccnt.txtMailPostalCode.value="";
		if(document.frmNewAccnt.txtMailProvince != null){
			document.frmNewAccnt.txtMailProvince.value="";
		}
		if (document.frmNewAccnt.lstMailProvinces!=null) {
			document.frmNewAccnt.lstMailProvinces.value="0"
		}
	}
	
	if (document.frmNewAccnt.chkComplianceAddress){
		if (checkComplianceAddress()==false){
			return false;
		}
	}
	
	if (document.frmNewAccnt.txtDayPhone != null){
		if (trim(document.frmNewAccnt.txtDayPhone.value)=="" || document.frmNewAccnt.txtDayPhone.value.length<7){
			PromptFocus(document.frmNewAccnt.txtDayPhone, "Please enter your phone number.");
			return(false);
		}
	}	

	if (document.frmNewAccnt.txtEvePhone != null){
		if (trim(document.frmNewAccnt.txtEvePhone.value) != ""){
			if (document.frmNewAccnt.txtDayPhone.value==document.frmNewAccnt.txtEvePhone.value && document.frmNewAccnt.txtDayPhone.value!=""){
				if ((confirm("Are you sure you wish to enter the same number for day and evening phone?"))!=true){
					document.frmNewAccnt.txtEvePhone.select();
					document.frmNewAccnt.txtEvePhone.focus();
					return (false);
				}
			}
		}
	}

	if (document.frmNewAccnt.txtMobilePhone != null){
		if (trim(document.frmNewAccnt.txtMobilePhone.value) != ""){
			if (document.frmNewAccnt.txtDayPhone.value==document.frmNewAccnt.txtMobilePhone.value && document.frmNewAccnt.txtDayPhone.value!=""){
				if ((confirm("Are you sure you wish to enter the same number for day and mobile phone?"))!=true){
					document.frmNewAccnt.txtMobilePhone.select();
					document.frmNewAccnt.txtMobilePhone.focus();
					return (false);
				}
			}
		}
	}

	if (document.frmNewAccnt.txtDayPhone1 != null) {
		sDayPhone = document.frmNewAccnt.txtDayPhone1.value + document.frmNewAccnt.txtDayPhone2.value + document.frmNewAccnt.txtDayPhone3.value;
		if(trim(document.frmNewAccnt.txtDayPhone1.value) == "" || trim(document.frmNewAccnt.txtDayPhone2.value) == "" || trim(document.frmNewAccnt.txtDayPhone3.value) == ""){
			PromptFocus(document.frmNewAccnt.txtDayPhone1, "Please enter Day Phone Number");	
			return(false);
		}
		else if (!checkPhone(document.frmNewAccnt.txtDayPhone1,document.frmNewAccnt.txtDayPhone2,document.frmNewAccnt.txtDayPhone3)){
			PromptFocus(document.frmNewAccnt.txtDayPhone1, "Invalid Day Phone Number");			
				return(false);	
		}
	}
	if (document.frmNewAccnt.txtEvePhone1 != null) {
		sEvePhone = document.frmNewAccnt.txtEvePhone1.value + document.frmNewAccnt.txtEvePhone2.value + document.frmNewAccnt.txtEvePhone3.value;
		if(trim(document.frmNewAccnt.txtEvePhone1.value) != "" || trim(document.frmNewAccnt.txtEvePhone2.value) != "" || trim(document.frmNewAccnt.txtEvePhone3.value) != ""){
			if (!checkPhone(document.frmNewAccnt.txtEvePhone1,document.frmNewAccnt.txtEvePhone2,document.frmNewAccnt.txtEvePhone3)){
				PromptFocus(document.frmNewAccnt.txtEvePhone1, "Invalid Evening Phone Number");			
					return(false);	
			}
		}
		if (sDayPhone==sEvePhone && sDayPhone!=""){
			if ((confirm("Are you sure you wish to enter the same number for day and evening phone?"))!=true){
				document.frmNewAccnt.txtEvePhone1.select();
				document.frmNewAccnt.txtEvePhone1.focus();
				return (false);
			}
		}
	}
		
	if (document.frmNewAccnt.txtMobilePhone1 != null) {
		sEvePhone = document.frmNewAccnt.txtMobilePhone1.value + document.frmNewAccnt.txtMobilePhone2.value + document.frmNewAccnt.txtMobilePhone3.value;
		if(trim(document.frmNewAccnt.txtMobilePhone1.value) != "" || trim(document.frmNewAccnt.txtMobilePhone2.value) != "" || trim(document.frmNewAccnt.txtMobilePhone3.value) != ""){
			if (!checkPhone(document.frmNewAccnt.txtMobilePhone1,document.frmNewAccnt.txtMobilePhone2,document.frmNewAccnt.txtMobilePhone3)){
				PromptFocus(document.frmNewAccnt.txtMobilePhone1, "Invalid Mobile Phone Number");			
					return(false);	
			}
		}
		if (sDayPhone==sEvePhone && sDayPhone!=""){
			if ((confirm("Are you sure you wish to enter the same number for day and mobile phone?"))!=true){
				document.frmNewAccnt.txtMobilePhone1.select();
				document.frmNewAccnt.txtMobilePhone1.focus();
				return (false);
			}
		}
	}

	if (document.frmNewAccnt.txtFax1 != null) {
		if(trim(document.frmNewAccnt.txtFax1.value) != "" || trim(document.frmNewAccnt.txtFax2.value) != "" || trim(document.frmNewAccnt.txtFax3.value) != ""){
			if (!checkPhone(document.frmNewAccnt.txtFax1,document.frmNewAccnt.txtFax2,document.frmNewAccnt.txtFax3)){
				PromptFocus(document.frmNewAccnt.txtFax1, "Invalid Fax Number");			
					return(false);	
			}
		}
	}	
	else {
		DisableControl(document.frmNewAccnt.btnContinue);
		return(true);
	}		
}

//DS : 8836 : 4/3/2006
function checkComplianceAddress(){
	if (document.frmNewAccnt.chkComplianceAddress.checked==true){
		if (trim(document.frmNewAccnt.txtComplianceAddrRecipient.value)==""){
			PromptFocus(document.frmNewAccnt.txtComplianceAddrRecipient, "Please provide Recipient Name.");
			return(false);
		}
		if (SpecialCharactersExistName(document.frmNewAccnt.txtComplianceAddrRecipient.value)){
			PromptFocus(document.frmNewAccnt.txtComplianceAddrRecipient, "Please re-enter Recipient Name.Please do not enter special characters");
			return(false);
		}
		if (document.frmNewAccnt.txtComplianceAddrCompany!=null) {
			if (trim(document.frmNewAccnt.txtComplianceAddrCompany.value)==""){
				PromptFocus(document.frmNewAccnt.txtComplianceAddrCompany, "Please provide Company/Department name.");
				return(false);
			}	
		}	
		if (document.frmNewAccnt.txtComplianceAddrFBO!=null) {
			if (trim(document.frmNewAccnt.txtComplianceAddrFBO.value)==""){
				PromptFocus(document.frmNewAccnt.txtComplianceAddrFBO, "Please provide FBO.");
				return(false);
			}	
		}
		if (document.frmNewAccnt.lstComplianceAddrCountry!=null) {
			if (document.frmNewAccnt.lstComplianceAddrCountry.selectedIndex=="0"){
				PromptFocus(document.frmNewAccnt.lstComplianceAddrCountry, "Please enter Country.");
				return(false);
			}
		}	
		if (SpecialCharactersExistAddress(trim(document.frmNewAccnt.txtComplianceAddrAddress.value))){
			PromptFocus(document.frmNewAccnt.txtComplianceAddrAddress, "Please re-enter Address.Please do not enter special characters");
			return(false);
		}
		if (trim(document.frmNewAccnt.txtComplianceAddrCity.value)==""){
			PromptFocus(document.frmNewAccnt.txtComplianceAddrCity, "Please enter City.");
			return(false);
		}	
		if (SpecialCharactersExistName(document.frmNewAccnt.txtComplianceAddrCity.value)){
			PromptFocus(document.frmNewAccnt.txtComplianceAddrCity, "Please re-enter City.Please do not enter special characters");
			return(false);
		}
		
		if (document.frmNewAccnt.lstComplianceAddrState!=null) {
			if (document.frmNewAccnt.lstComplianceAddrState.selectedIndex=="0" && document.frmNewAccnt.lstComplianceAddrCountry.value=="1"){
				PromptFocus(document.frmNewAccnt.lstComplianceAddrState, "Please provide State.");
				return(false);
			}
		}	
		if (document.frmNewAccnt.lstComplianceAddrProvinces!=null) {
			if (document.frmNewAccnt.lstComplianceAddrProvinces.value=="0"){
				PromptFocus(document.frmNewAccnt.lstComplianceAddrProvinces, "Please provide compliance address province.");
				return(false);
			}
		}
		/*
		if (trim(document.frmNewAccnt.txtComplianceAddrZip.value)==""){
			PromptFocus(document.frmNewAccnt.txtComplianceAddrZip, "Please enter Zip code.");
			return(false);
		}	
		if (document.frmNewAccnt.lstComplianceAddrCountry.value=="1") {
			sZip=document.frmNewAccnt.txtComplianceAddrZip.value.substring(0, 5);
			if (!isInteger(sZip) || document.frmNewAccnt.txtComplianceAddrZip.value.length<5) {
				PromptFocus(document.frmNewAccnt.txtComplianceAddrZip, "Please enter a valid Zip code.");
				return(false);
			}
		}		
		*/

		if(!validatePostalCode(document.frmNewAccnt.txtComplianceAddrZip,document.frmNewAccnt.lstComplianceAddrCountry.value,sDomesticMsg)){
			PromptFocus(document.frmNewAccnt.txtComplianceAddrZip, "Please enter a valid Zip code." +sDomesticMsg.value);
			return(false);
		}

		
	}
	else {
		document.frmNewAccnt.txtComplianceAddrRecipient.value = "";
		if (document.frmNewAccnt.txtComplianceAddrFBO!=null) {
			document.frmNewAccnt.txtComplianceAddrFBO.value = "";
		}
		document.frmNewAccnt.txtComplianceAddrAddress.value = "";
		document.frmNewAccnt.txtComplianceAddrCity.value = "";
		if (document.frmNewAccnt.lstComplianceAddrState!=null) {
			document.frmNewAccnt.lstComplianceAddrState.selectedIndex = "0";
		}	
		document.frmNewAccnt.txtComplianceAddrZip.value = "";
		document.frmNewAccnt.lstComplianceAddrCountry.selectedIndex ="0";
		document.frmNewAccnt.lstComplianceAddrCountry.value ="0";
	}
		
}


/*******************************************************************************************************************
										END OF CONTACT PAGE FUNCTIONS
*******************************************************************************************************************/


/*******************************************************************************************************************
										FIFTH - EMPLOYMENT PAGE FUNCTIONS
*******************************************************************************************************************/


function CheckEmploymentForm() {
	var Occupation;
	var NatureOfBusiness;
	if (document.frmNewAccnt.lstEmploymentStatus!=null){
		Occupation=document.frmNewAccnt.txtOccupation.value;
		NatureOfBusiness=document.frmNewAccnt.txtNatureOfBusiness.value;

		if (document.frmNewAccnt.lstEmploymentStatus.selectedIndex=="0"){
			PromptFocus(document.frmNewAccnt.lstEmploymentStatus, "Please provide your employment status.");
			return(false);
		}
		else if (document.frmNewAccnt.lstEmploymentStatus.selectedIndex=="1"){
				
			if (trim(document.frmNewAccnt.txtEmployerName.value)==""){
				PromptFocus(document.frmNewAccnt.txtEmployerName, "Please enter the name of your employer.");
				return(false);
			}	
			if (SpecialCharactersExist(document.frmNewAccnt.txtEmployerName.value)){ // AN: Added to check for special characters
				PromptFocus(document.frmNewAccnt.txtEmployerName, "Please re-enter employer name.Please do not enter special characters");
				return(false);
			}
			if (NatureOfBusiness.length==0 || trim(document.frmNewAccnt.txtNatureOfBusiness.value) == ""){
				PromptFocus(document.frmNewAccnt.txtNatureOfBusiness, "Please enter the Nature of Business.");
				return(false);	
			}
			if (SpecialCharactersExist(document.frmNewAccnt.txtNatureOfBusiness.value)){
				PromptFocus(document.frmNewAccnt.txtNatureOfBusiness, "Please re-enter the Nature of Business.Please do not enter special characters");
				return(false);	
			}
			if (Occupation.length==0 || trim(document.frmNewAccnt.txtOccupation.value) == ""){
				PromptFocus(document.frmNewAccnt.txtOccupation, "Please enter occupation.");
				return(false);		
			}
			if (SpecialCharactersExist(document.frmNewAccnt.txtOccupation.value)){
				PromptFocus(document.frmNewAccnt.txtOccupation, "Please re-enter occupation.Please do not enter special characters");
				return(false);		
			}
			if (trim(document.frmNewAccnt.txtYearsEmployed.value)==""){
				PromptFocus(document.frmNewAccnt.txtYearsEmployed, "Please enter the number of years employed.");
				return(false);
			}
			else if (!isInteger(document.frmNewAccnt.txtYearsEmployed.value)) {
				if(isFloat(document.frmNewAccnt.txtYearsEmployed.value)){
					document.frmNewAccnt.txtYearsEmployed.value = RoundToDecimalPlaces(document.frmNewAccnt.txtYearsEmployed.value,0);
				}
				else{
					PromptFocus(document.frmNewAccnt.txtYearsEmployed, "Please enter valid number of years employed.");
					return(false);
				}
			}
			

			if (document.frmNewAccnt.lstEmployerCountryID.selectedIndex=="0")		{
				PromptFocus(document.frmNewAccnt.lstEmployerCountryID, "Please select the country of employer.");
				return(false);
			}
			
			 if (trim(document.frmNewAccnt.txtEmployerAddress1.value)==""){
				PromptFocus(document.frmNewAccnt.txtEmployerAddress1, "Please enter the address of your employer.");
				return(false);
			}	
			if (SpecialCharactersExistAddress(document.frmNewAccnt.txtEmployerAddress1.value)){
				PromptFocus(document.frmNewAccnt.txtEmployerAddress1, "Please re-enter the address of your employer.Please do not enter special characters");
				return(false);
			}
			if (SpecialCharactersExistAddress(document.frmNewAccnt.txtEmployerAddress2.value)){
				PromptFocus(document.frmNewAccnt.txtEmployerAddress2, "Please re-enter the address of your employer.Please do not enter special characters");
				return(false);
			}	
			else if (trim(document.frmNewAccnt.txtEmployerCity.value)==""){
				PromptFocus(document.frmNewAccnt.txtEmployerCity, "Please enter the address city of your employer.");
				return(false);
			}
			else if (SpecialCharactersExistName(document.frmNewAccnt.txtEmployerCity.value)){
				PromptFocus(document.frmNewAccnt.txtEmployerCity, "Please re-enter the address city of your employer.Please do not enter special characters");
				return(false);
			}
			//validate employer postcode
			//else if (document.frmNewAccnt.txtEmployerPostalCode.value==""){
			//	PromptFocus(document.frmNewAccnt.txtEmployerPostalCode, "Please enter the postal code of your employer.");
			//	return(false);
			//}
		
			else if (document.frmNewAccnt.lstEmployerStateID != null){
				if (document.frmNewAccnt.lstEmployerStateID.selectedIndex=="0" && document.frmNewAccnt.lstEmployerCountryID.selectedIndex=="1")		{
					PromptFocus(document.frmNewAccnt.lstEmployerStateID, "Please enter the address state of your employer.");
					return(false);
				}
			}
			//Check Province
			if (document.frmNewAccnt.lstEmployerProvinces != null) {
				if (document.frmNewAccnt.lstEmployerProvinces.value=="0") {
					PromptFocus(document.frmNewAccnt.lstEmployerProvinces, "Please select the province of your employer.");
					return(false);
				}
			}		
			/*
			if (document.frmNewAccnt.txtEmployerPostalCode.value=="" && document.frmNewAccnt.lstEmployerCountryID.selectedIndex=="1")		{
				PromptFocus(document.frmNewAccnt.txtEmployerPostalCode, "Please enter the postal code of your employer.");
				return(false);
			}
			*/
			if(!validatePostalCode(document.frmNewAccnt.txtEmployerPostalCode,document.frmNewAccnt.lstEmployerCountryID.value,sDomesticMsg)){
				PromptFocus(document.frmNewAccnt.txtEmployerPostalCode, "Please enter a valid postal code for your employer." +sDomesticMsg.value);
				return(false);
			}
			else if (document.frmNewAccnt.txtEmployerPhone != null){
				if(trim(document.frmNewAccnt.txtEmployerPhone.value)==""){
					PromptFocus(document.frmNewAccnt.txtEmployerPhone, "Please enter the phone number of your employer.");
					return(false);
				}
			}
			if (document.frmNewAccnt.txtEmployerPhone1 != null){
				if(trim(document.frmNewAccnt.txtEmployerPhone1.value)=="" || trim(document.frmNewAccnt.txtEmployerPhone2.value) =="" || trim(document.frmNewAccnt.txtEmployerPhone3.value) ==""){
					PromptFocus(document.frmNewAccnt.txtEmployerPhone1, "Please enter Employer Phone Number");			
					return(false);	
				}
				else if (!checkPhone(document.frmNewAccnt.txtEmployerPhone1,document.frmNewAccnt.txtEmployerPhone2,document.frmNewAccnt.txtEmployerPhone3)){
					PromptFocus(document.frmNewAccnt.txtEmployerPhone1, "Invalid Employer Phone Number");			
					return(false);	
				}
			}
		
			
	
			
			
		}
		else {
			document.frmNewAccnt.txtYearsEmployed.value="0";
			if(document.frmNewAccnt.txtEmployerphone != null){
				document.frmNewAccnt.txtEmployerPhone.value="";
			}
		}
	}
	if (document.frmNewAccnt.radSeniorPoliticalFigure!= null) {
		if(document.frmNewAccnt.radSeniorPoliticalFigure[0].checked==false && document.frmNewAccnt.radSeniorPoliticalFigure[1].checked==false) {
			PromptFocus(document.frmNewAccnt.radSeniorPoliticalFigure, "Please specify if you are a Senior Political Figure.");
			return(false);
		}
	}
	if (document.frmNewAccnt.radEmployedByBroker[0].checked==false && document.frmNewAccnt.radEmployedByBroker[1].checked==false){
		PromptFocus(document.frmNewAccnt.radEmployedByBroker, "Please specify if you are employed by a broker.");
		return(false);
	}
	if (document.frmNewAccnt.chkComplianceAddress != null){		
		if(document.frmNewAccnt.radEmployedByBroker[1].checked==true){
			if (checkComplianceAddress()==false){
				return (false);			
			}
		}
		else if(document.frmNewAccnt.radEmployedByBroker[0].checked==true){
			document.frmNewAccnt.chkComplianceAddress.value="OFF";
			document.frmNewAccnt.chkComplianceAddress.checked=false;
		}
	}	
	if (document.frmNewAccnt.radAffiliatedDirector[0].checked==false && document.frmNewAccnt.radAffiliatedDirector[1].checked==false){
		PromptFocus(document.frmNewAccnt.radAffiliatedDirector, "Please specify if you are an affiliated director.");
		return(false);
	}
	else if (document.frmNewAccnt.radAffiliatedDirector[1].checked && document.frmNewAccnt.txtAffiliatedCompany.value=="")	{
		PromptFocus(document.frmNewAccnt.txtAffiliatedCompany, "Please enter affiliated company's stock symbol.");
		return(false);
	}
	if(document.frmNewAccnt.radAffiliatedDirector[1].checked==true && document.frmNewAccnt.radAffiliatedDirector2){
		if(document.frmNewAccnt.radAffiliatedDirector2[0].checked==false && document.frmNewAccnt.radAffiliatedDirector2[1].checked==false){
			PromptFocus(document.frmNewAccnt.radAffiliatedDirector2, "Please specify if you are a director, 20% shareholder, or policy-making officer.");
			return(false);
		}
		if(document.frmNewAccnt.radAffiliatedDirector2[1].checked==true && document.frmNewAccnt.txtAffiliatedCompany2.value == ''){
			PromptFocus(document.frmNewAccnt.txtAffiliatedCompany2, "Please enter affiliated company's stock symbol for 20% shareholder.");
			return(false);
		}
	}
	if(document.frmNewAccnt.radTradeAuthorization){
		if(document.frmNewAccnt.radTradeAuthorization[0].checked==false && document.frmNewAccnt.radTradeAuthorization[1].checked==false){
			PromptFocus(document.frmNewAccnt.radTradeAuthorization, "Please specify if other persons will have trading authorization over the account.");		
			return(false);
		}
		if(document.frmNewAccnt.radTradeAuthorization[1].checked==true){
			if(document.frmNewAccnt.lstAPAType.value=='-1'){
				PromptFocus(document.frmNewAccnt.lstAPAType, "Please select trading authorization type for authorized person.");		
				return(false);			
			}
			if(document.frmNewAccnt.txtFirstNameAuthorization.value==''){
				PromptFocus(document.frmNewAccnt.txtFirstNameAuthorization, "Please enter first name of person with trading authorization.");		
				return(false);			
			}
			if(SpecialCharactersExistName(document.frmNewAccnt.txtFirstNameAuthorization.value)){
				PromptFocus(document.frmNewAccnt.txtFirstNameAuthorization, "Please re-enter first name.Please do not enter special characters");		
				return(false);			
			}
			if(document.frmNewAccnt.txtLastNameAuthorization.value==''){
				PromptFocus(document.frmNewAccnt.txtLastNameAuthorization, "Please enter last name of person with trading authorization.");		
				return(false);			
			}
			if(SpecialCharactersExistName(document.frmNewAccnt.txtLastNameAuthorization.value)){
				PromptFocus(document.frmNewAccnt.txtLastNameAuthorization, "Please re-enter last name.Please do not enter special characters");		
				return(false);			
			}
		}
		if(document.frmNewAccnt.radTradeAuthorization[0].checked==true){
			resetAuthorizedTraderData(document.frmNewAccnt);	
		}
	}
	if(document.frmNewAccnt.radAdditionalBrokerage){
		if(document.frmNewAccnt.radAdditionalBrokerage[0].checked==false && document.frmNewAccnt.radAdditionalBrokerage[1].checked==false){
			PromptFocus(document.frmNewAccnt.radAdditionalBrokerage, "Please specify if any signatories have any other accounts or control the trading in such accounts with other brokerage firms.");		
			return(false);			
		}
	}
	if(document.frmNewAccnt.radAssociatedAccount){
		if(document.frmNewAccnt.radAssociatedAccount[0].checked==false && document.frmNewAccnt.radAssociatedAccount[1].checked==false){
			PromptFocus(document.frmNewAccnt.radAssociatedAccount, "Please specify if any signatories have other optionsXpress accounts or control trading in such accounts.");		
			return(false);			
		}
		if(document.frmNewAccnt.radAssociatedAccount[1].checked==true){
			if(document.frmNewAccnt.txtAssocAccountNumber.value==''){
				PromptFocus(document.frmNewAccnt.txtAssocAccountNumber, "Please enter account number of additional optionsXpress account.");		
				return(false);	
			}
		}
	}
	if(document.frmNewAccnt.radFutTrading != null){
		if(document.frmNewAccnt.radFutTrading[0].checked==false && document.frmNewAccnt.radFutTrading[1].checked==false){
			PromptFocus(document.frmNewAccnt.radFutTrading,"Please select if any other person will control the trading in this account.");
			return false;
		}
		if(document.frmNewAccnt.radFutTrading[1].checked==true){
			if(document.frmNewAccnt.txtFutTradingName.value == ""){
				PromptFocus(document.frmNewAccnt.txtFutTradingName,"Please enter name.");
				return false;
			}
			if(SpecialCharactersExistName(document.frmNewAccnt.txtFutTradingName.value)){
				PromptFocus(document.frmNewAccnt.txtFutTradingName,"Please re-enter name.Please do not enter special characters");
				return false;
			}
			if(document.frmNewAccnt.txtFutTradingAddress.value == ""){
				PromptFocus(document.frmNewAccnt.txtFutTradingAddress,"Please enter address.");
				return false;
			}
			if(SpecialCharactersExistAddress(document.frmNewAccnt.txtFutTradingAddress.value)){
				PromptFocus(document.frmNewAccnt.txtFutTradingAddress,"Please re-enter address.Please do not enter special characters");
				return false;
			}
			if(document.frmNewAccnt.txtFutTradingCity.value == ""){
				PromptFocus(document.frmNewAccnt.txtFutTradingCity,"Please enter city.");
				return false;
			}
			if(SpecialCharactersExistName(document.frmNewAccnt.txtFutTradingCity.value)){
				PromptFocus(document.frmNewAccnt.txtFutTradingCity,"Please re-enter city.Please do not enter special characters");
				return false;
			}
			if(document.frmNewAccnt.lstFutTradingCountryID.selectedIndex == 0){ 
				PromptFocus(document.frmNewAccnt.lstFutTradingCountryID,"Please select country.");
				return false;
			}
			if(document.frmNewAccnt.lstFutTradingStateID != null){
				if(document.frmNewAccnt.lstFutTradingStateID.selectedIndex  == 0 && document.frmNewAccnt.lstFutTradingCountryID.value ==1){
					PromptFocus(document.frmNewAccnt.lstFutTradingStateID,"Please enter state.");
					return false;
				}
			}
			if(document.frmNewAccnt.lstFutTradingProvinces != null){
				if(document.frmNewAccnt.lstFutTradingProvinces.value=="0"){
					PromptFocus(document.frmNewAccnt.lstFutTradingProvinces,"Please select province.");
					return false;
				}
			}
			if(document.frmNewAccnt.txtFutTradingZip.value == ""){
				PromptFocus(document.frmNewAccnt.txtFutTradingZip,"Please enter postal code.");
				return false;
			}
			if(!validatePostalCode(document.frmNewAccnt.txtFutTradingZip,document.frmNewAccnt.lstFutTradingCountryID.value ,sDomesticMsg)){
				PromptFocus(document.frmNewAccnt.txtFutTradingZip, "Please enter a valid Zip code." +sDomesticMsg.value);
				return(false);
			}	
		}
	}
	if(document.frmNewAccnt.radFutGuarantee != null){
		if(document.frmNewAccnt.radFutGuarantee[0].checked==false && document.frmNewAccnt.radFutGuarantee[1].checked==false){
			PromptFocus(document.frmNewAccnt.radFutGuarantee,"Please select if any other person will gurantee this account.");
			return false;
		}
		if(document.frmNewAccnt.radFutGuarantee[1].checked==true){
			if(document.frmNewAccnt.txtFutGuaranteeName.value == ""){
				PromptFocus(document.frmNewAccnt.txtFutGuaranteeName,"Please enter name.");
				return false;
			}
			if(SpecialCharactersExistName(document.frmNewAccnt.txtFutGuaranteeName.value)){
				PromptFocus(document.frmNewAccnt.txtFutGuaranteeName,"Please re-enter name.Please do not enter special characters");
				return false;
			}
			if(document.frmNewAccnt.txtFutGuaranteeAddress.value == ""){
				PromptFocus(document.frmNewAccnt.txtFutGuaranteeAddress,"Please enter address.");
				return false;
			}
			if(SpecialCharactersExistAddress(document.frmNewAccnt.txtFutGuaranteeAddress.value)){
				PromptFocus(document.frmNewAccnt.txtFutGuaranteeAddress,"Please re-enter address.Please do not enter special characters");
				return false;
			}
			if(document.frmNewAccnt.txtFutGuaranteeCity.value == ""){
				PromptFocus(document.frmNewAccnt.txtFutGuaranteeCity,"Please enter city.");
				return false;
			}
			if(SpecialCharactersExistName(document.frmNewAccnt.txtFutGuaranteeCity.value)){
				PromptFocus(document.frmNewAccnt.txtFutGuaranteeCity,"Please re-enter city.Please do not enter special characters");
				return false;
			}
			if(document.frmNewAccnt.lstFutGuaranteeCountryID.selectedIndex == 0){ 
				PromptFocus(document.frmNewAccnt.lstFutGuaranteeCountryID,"Please select country.");
				return false;
			}
			if(document.frmNewAccnt.lstFutGuaranteeStateID != null){
				if(document.frmNewAccnt.lstFutGuaranteeStateID.selectedIndex  == 0 && document.frmNewAccnt.lstFutGuaranteeCountryID.value ==1){
					PromptFocus(document.frmNewAccnt.lstFutGuaranteeStateID,"Please enter state.");
					return false;
				}
			}
			if(document.frmNewAccnt.lstFutGuaranteeProvinces != null){
				if(document.frmNewAccnt.lstFutGuaranteeProvinces.value=="0"){
					PromptFocus(document.frmNewAccnt.lstFutGuaranteeProvinces,"Please select province.");
					return false;
				}
			}
			if(document.frmNewAccnt.txtFutGuaranteeZip.value == ""){
				PromptFocus(document.frmNewAccnt.txtFutGuaranteeZip,"Please enter postal code.");
				return false;
			}
			if(!validatePostalCode(document.frmNewAccnt.txtFutGuaranteeZip,document.frmNewAccnt.lstFutGuaranteeCountryID.value ,sDomesticMsg)){
				PromptFocus(document.frmNewAccnt.txtFutGuaranteeZip, "Please enter a valid Zip code." +sDomesticMsg.value);
				return(false);
			}	
		}
	}
	if(document.frmNewAccnt.radFutInterest != null){
		if(document.frmNewAccnt.radFutInterest[0].checked==false && document.frmNewAccnt.radFutInterest[1].checked==false){
			PromptFocus(document.frmNewAccnt.radFutInterest,"Please select if any other person have an interest in this account.");
			return false;
		}
		if(document.frmNewAccnt.radFutInterest[1].checked==true){
			if(document.frmNewAccnt.txtFutInterestName.value == ""){
				PromptFocus(document.frmNewAccnt.txtFutInterestName,"Please enter name.");
				return false;
			}
			if(SpecialCharactersExistName(document.frmNewAccnt.txtFutInterestName.value)){
				PromptFocus(document.frmNewAccnt.txtFutInterestName,"Please re-enter name.Please do not enter special characters");
				return false;
			}
			if(document.frmNewAccnt.txtFutInterestAddress.value == ""){
				PromptFocus(document.frmNewAccnt.txtFutInterestAddress,"Please enter address.");
				return false;
			}
			if(SpecialCharactersExistAddress(document.frmNewAccnt.txtFutInterestAddress.value)){
				PromptFocus(document.frmNewAccnt.txtFutInterestAddress,"Please re-enter address.Please do not enter special characters");
				return false;
			}
			if(document.frmNewAccnt.txtFutInterestCity.value == ""){
				PromptFocus(document.frmNewAccnt.txtFutInterestCity,"Please enter city.");
				return false;
			}
			if(SpecialCharactersExistName(document.frmNewAccnt.txtFutInterestCity.value)){
				PromptFocus(document.frmNewAccnt.txtFutInterestCity,"Please re-enter city.Please do not enter special characters");
				return false;
			}
			if(document.frmNewAccnt.lstFutInterestCountryID.selectedIndex == 0){ 
				PromptFocus(document.frmNewAccnt.lstFutInterestCountryID,"Please select country.");
				return false;
			}
			if(document.frmNewAccnt.lstFutInterestStateID != null){
				if(document.frmNewAccnt.lstFutInterestStateID.selectedIndex  == 0 && document.frmNewAccnt.lstFutInterestCountryID.value ==1){
					PromptFocus(document.frmNewAccnt.lstFutInterestStateID,"Please enter state.");
					return false;
				}
			}
			if(document.frmNewAccnt.lstFutInterestProvinces != null){
				if(document.frmNewAccnt.lstFutInterestProvinces.value=="0"){
					PromptFocus(document.frmNewAccnt.lstFutInterestProvinces,"Please select province.");
					return false;
				}
			}
			if(document.frmNewAccnt.txtFutInterestZip.value == ""){
				PromptFocus(document.frmNewAccnt.txtFutInterestZip,"Please enter postal code.");
				return false;
			}
			if(!validatePostalCode(document.frmNewAccnt.txtFutInterestZip,document.frmNewAccnt.lstFutInterestCountryID.value ,sDomesticMsg)){
				PromptFocus(document.frmNewAccnt.txtFutInterestZip, "Please enter a valid Zip code." +sDomesticMsg.value);
				return(false);
			}	
		}
	}
	if(document.frmNewAccnt.radFutSigAccnts != null){
		if(document.frmNewAccnt.radFutSigAccnts[0].checked == false && document.frmNewAccnt.radFutSigAccnts[1].checked == false){
			PromptFocus(document.frmNewAccnt.radFutSigAccnts,"Please select if any other signatories have any other future accounts.");
			return false;
		}
		if(document.frmNewAccnt.radFutSigAccnts[1].checked == true && document.frmNewAccnt.txtFutSigAccnts.value == ""){
			PromptFocus(document.frmNewAccnt.txtFutSigAccnts,"Please enter the names of other future accounts.");
			return false;
		}
	}
	if(document.frmNewAccnt.txtBankName){
		if(trim(document.frmNewAccnt.txtBankName.value)==''){
			PromptFocus(document.frmNewAccnt.txtBankName, "Please enter bank name.");		
			return(false);		
		}
		else if(trim(document.frmNewAccnt.txtBankAccountNumber.value)==''){
			PromptFocus(document.frmNewAccnt.txtBankAccountNumber, "Please enter bank account number.");		
			return(false);		
		}
		else if(trim(document.frmNewAccnt.txtBankAccountTitle.value)==''){
			PromptFocus(document.frmNewAccnt.txtBankAccountTitle, "Please enter bank account title.");		
			return(false);		
		}
	}
	if(document.frmNewAccnt.radBeneficialDisclosure){
		if(!document.frmNewAccnt.radBeneficialDisclosure[0].checked && !document.frmNewAccnt.radBeneficialDisclosure[1].checked){
			PromptFocus(document.frmNewAccnt.radBeneficialDisclosure, "Please indicate if you object to the Disclosure of Beneficial Ownership Information.");
			return(false);
		}
	}
	if(document.frmNewAccnt.radSecurityHolder){
		if(!document.frmNewAccnt.radSecurityHolder[0].checked && !document.frmNewAccnt.radSecurityHolder[1].checked && !document.frmNewAccnt.radSecurityHolder[2].checked){
			PromptFocus(document.frmNewAccnt.radSecurityHolder, "Please indicate if you wish to receive Securityholder Materials");
			return(false);
		}
	}
	if(document.frmNewAccnt.radLanguagePref){
		if(!document.frmNewAccnt.radLanguagePref[0].checked && !document.frmNewAccnt.radLanguagePref[1].checked){
			PromptFocus(document.frmNewAccnt.radLanguagePref, "Please indicate your Preferred Language of Communication.");
			return(false);
		}
	}
	checkLTA();
	if(!Validatew8(document.frmNewAccnt,document.frmNewAccnt.txtAccntEntity.value,'false')){
		return(false);
	}
	DisableControl(document.frmNewAccnt.btnContinue);
	return(true);
}

function displayEmpInfo() {
	if(document.frmNewAccnt.lstEmploymentStatus != null){	
	    statusIndex = document.frmNewAccnt.lstEmploymentStatus.selectedIndex;
		if (statusIndex == 1) {
			document.getElementById('empInfo').className = '';
		} 
		else {
			document.getElementById('empInfo').className = 'hide';
		}
	}
}


/*******************************************************************************************************************
										END OF EMPLOYMENT PAGE FUNCTIONS
*******************************************************************************************************************/



/*******************************************************************************************************************
										REVIEW PAGE FUNCTIONS
*******************************************************************************************************************/
 function EditInfo(sFormAction){
	 //alert(document.frmNewAccnt.txtFormAction.value);
	 document.frmNewAccnt.txtFormAction.value = sFormAction;
	 //alert(document.frmNewAccnt.txtFormAction.value);
 	document.frmNewAccnt.action='/new_account.asp';//?PAGE_ID=REVIEW&FORM_ACTION='+sFormAction;
	//alert(document.frmNewAccnt.action);
	document.frmNewAccnt.submit();
 }

 /*******************************************************************************************************************
									END REVIEW PAGE FUNCTIONS
*******************************************************************************************************************/
function confirmSSN (persontype){
	var ssn;
	var ssn1;
	var ssn2;
	var ssn3;
	var verifyssn;
	var verifyssn1;
	var verifyssn2;
	var verifyssn3;
	if(persontype == "jnt" || persontype == "cst"){
		if(document.frmNewAccnt.txtJointSSN1 != null && document.frmNewAccnt.txtVerifyJointSSN1 != null){
			ssn1 = document.frmNewAccnt.txtJointSSN1.value;
			verifyssn1 = document.frmNewAccnt.txtVerifyJointSSN1.value;
			if(document.frmNewAccnt.txtJointSSN2 != null){
				ssn2 = document.frmNewAccnt.txtJointSSN2.value;
			}
			if(document.frmNewAccnt.txtJointSSN3 != null){
				ssn3 = document.frmNewAccnt.txtJointSSN3.value;
			}
			if(document.frmNewAccnt.txtVerifyJointSSN2 != null){
				verifyssn2 = document.frmNewAccnt.txtVerifyJointSSN2.value;
			}
			if(document.frmNewAccnt.txtVerifyJointSSN3 != null){
				verifyssn3 = document.frmNewAccnt.txtVerifyJointSSN3.value;
			}
			if(trim(ssn1) != trim(verifyssn1) || trim(ssn2) != trim(verifyssn2) || trim(ssn3) != trim(verifyssn3)){
				if(persontype=="jnt"){
					alert("Please confirm co-applicant's ssn");
				}
				if(persontype=="cst"){
					alert("Please confirm minor's ssn");
				}
				document.frmNewAccnt.txtVerifyJointSSN1.select();
				return(false);
			}
		}
	}
	if(persontype == "prm"){
		if(document.frmNewAccnt.txtSSN1 != null && document.frmNewAccnt.txtVerifySSN1 != null){
			ssn1 = document.frmNewAccnt.txtSSN1.value;
			verifyssn1 = document.frmNewAccnt.txtVerifySSN1.value;
			if(document.frmNewAccnt.txtSSN2 != null){
				ssn2 = document.frmNewAccnt.txtSSN2.value;
			}
			if(document.frmNewAccnt.txtSSN3 != null){
				ssn3 = document.frmNewAccnt.txtSSN3.value;
			}
			if(document.frmNewAccnt.txtVerifySSN2 != null){
				verifyssn2 = document.frmNewAccnt.txtVerifySSN2.value;
			}
			if(document.frmNewAccnt.txtVerifySSN3 != null){
				verifyssn3 = document.frmNewAccnt.txtVerifySSN3.value;
			}
			if(trim(ssn1) != trim(verifyssn1) || trim(ssn2) != trim(verifyssn2) || trim(ssn3) != trim(verifyssn3)){
				alert("Please confirm your ssn");
				document.frmNewAccnt.txtVerifySSN1.select();
				return(false);
			}
		}
		if(document.frmNewAccnt.txtSSN != null && document.frmNewAccnt.txtVerifySSN != null){
			ssn = document.frmNewAccnt.txtSSN.value;
			verifyssn = document.frmNewAccnt.txtVerifySSN.value;
			if(trim(ssn) != trim(verifyssn)){
				alert("Please confirm your SSN / Tax ID");
				document.frmNewAccnt.txtVerifySSN.select();
				return(false);
			}
		}
	}
	if(persontype == "crp"){
		if(document.frmNewAccnt.txtSSN1 != null && document.frmNewAccnt.txtVerifySSN1 != null){
			ssn1 = document.frmNewAccnt.txtSSN1.value;
			verifyssn1 = document.frmNewAccnt.txtVerifySSN1.value;
			if(document.frmNewAccnt.txtSSN2 != null){
				ssn2 = document.frmNewAccnt.txtSSN2.value;
			}	
			if(document.frmNewAccnt.txtVerifySSN2 != null){
				verifyssn2 = document.frmNewAccnt.txtVerifySSN2.value;
			}
			if(trim(ssn1) != trim(verifyssn1) || trim(ssn2) != trim(verifyssn2)){
				alert("Please confirm Tax ID");
				document.frmNewAccnt.txtVerifySSN1.select();
				return(false);
			}
		}
	}
	return(true);
}

function setInvestObj() {
	var accentity;
	var accnttypeid;
	accentity = document.frmNewAccnt.txtAccntEntity.value;
	accnttypeid = document.frmNewAccnt.txtAccntTypeID.value;
	if(accnttypeid == 1){
		document.frmNewAccnt.chkObjective[0].disabled = true;
	}
	else if(accentity.substring(0,3) == "ira" || (accentity.substring(0,3) == "trs" && accentity != "trs") || (accentity.substring(0,3) == "cst" && accentity != "cst")){
		document.frmNewAccnt.chkObjective[0].disabled = true;			
	}
}

function setTradingSrategies() {
	var accnttypeid = document.frmNewAccnt.txtAccntTypeID.value;	
	var accentity = document.frmNewAccnt.txtAccntEntity.value;
	if(accnttypeid == 1 || accnttypeid == 3){
		document.frmNewAccnt.chkTradingStrategiesUtilized[2].disabled = true;
		document.frmNewAccnt.chkTradingStrategiesUtilized[5].disabled = true;
	}
	
	if(accentity == "ira/rrsp" || accentity == "ira/srsp" || accentity == "ira/rrif" || accentity == "ira/tfsa")
	{
		//AN DT :31932 RSP enable only Buy Stock,covered calls and long puts/calls
		document.frmNewAccnt.chkTradingStrategiesUtilized[1].disabled = true;
		document.frmNewAccnt.chkTradingStrategiesUtilized[2].disabled = true;
		document.frmNewAccnt.chkTradingStrategiesUtilized[4].disabled = true;
		document.frmNewAccnt.chkTradingStrategiesUtilized[5].disabled = true;
		document.frmNewAccnt.chkTradingStrategiesUtilized[7].disabled = true;
		
	}
	
}

//SB 02/27/2007
function checkFuturesForm(ofrmObj,sEntity){
	var sJnt;
	var tmp1,tmp2;
	if(sEntity == "jnt"){
		sJnt = "Joint";
	}
	else{
		sJnt = "";
	}	
	tmp2 = "tmp3=document.frmDigitalSignature.chkAgree" + i;
	eval(tmp2);
}

function evalControl(obj){
	var tmp1,tmp2;
	tmp1 = "tmp2=" + obj
	eval(tmp1);
	return tmp2;
}

//SB 09/13/2007 Futures Functions
function resetJointTradingAccntsData(){
	if(document.frmNewAccnt.txtFutJointTradingName != null){
		document.frmNewAccnt.txtFutJointTradingName.value = "";
	}
	if(document.frmNewAccnt.txtJointFutTradingAddress != null){
		document.frmNewAccnt.txtJointFutTradingAddress.value = "";
	}
	if(document.frmNewAccnt.txtJointFutTradingCity != null){
		document.frmNewAccnt.txtJointFutTradingCity.value = "";
	}
	if(document.frmNewAccnt.txtJointFutTradingZip != null){
		document.frmNewAccnt.txtJointFutTradingZip.value = "";
	}
	if(document.frmNewAccnt.lstJointFutTradingStateID != null){
		document.frmNewAccnt.lstJointFutTradingStateID.selectedIndex = 0; 
	}
	if(document.frmNewAccnt.lstJointFutTradingProvinceID != null){
		document.frmNewAccnt.lstJointFutTradingProvinceID.selectedIndex = 0; 
	}
	if(document.frmNewAccnt.lstJointFutTradingCountryID != null){
		document.frmNewAccnt.lstJointFutTradingCountryID.selectedIndex = 0; 
	}
	if(document.frmNewAccnt.txtJointFutTradingProvince != null){
		document.frmNewAccnt.txtJointFutTradingProvince.value = ""; 
	}
}
function resetJointGuaranteeData(){
	if(document.frmNewAccnt.txtJointFutGuaranteeName != null){
		document.frmNewAccnt.txtJointFutGuaranteeName.value = "";
	}
	if(document.frmNewAccnt.txtJointFutGuaranteeAddress != null){
		document.frmNewAccnt.txtJointFutGuaranteeAddress.value = "";
	}
	if(document.frmNewAccnt.txtJointFutGuaranteeCity != null){
		document.frmNewAccnt.txtJointFutGuaranteeCity.value = "";
	}
	if(document.frmNewAccnt.txtJointFutGuaranteeZip != null){
		document.frmNewAccnt.txtJointFutGuaranteeZip.value = "";
	}
	if(document.frmNewAccnt.lstJointFutGuaranteeStateID  != null){
		document.frmNewAccnt.lstJointFutGuaranteeStateID .selectedIndex = 0; 
	}
	if(document.frmNewAccnt.lstJointFutGuaranteeProvinceID != null){
		document.frmNewAccnt.lstJointFutGuaranteeProvinceID.selectedIndex = 0; 
	}
	if(document.frmNewAccnt.lstJointFutGuaranteeCountryID != null){
		document.frmNewAccnt.lstJointFutGuaranteeCountryID.selectedIndex = 0; 
	}
	if(document.frmNewAccnt.txtJointFutGuaranteeProvince != null){
		document.frmNewAccnt.txtJointFutGuaranteeProvince.value = ""; 
	}
}
function resetJointInterestData(){
	if(document.frmNewAccnt.txtJointFutInterestName != null){
		document.frmNewAccnt.txtJointFutInterestName.value = "";
	}
	if(document.frmNewAccnt.txtJointFutInterestAddress != null){
		document.frmNewAccnt.txtJointFutInterestAddress.value = "";
	}
	if(document.frmNewAccnt.txtJointFutInterestCity != null){
		document.frmNewAccnt.txtJointFutInterestCity.value = "";
	}
	if(document.frmNewAccnt.txtJointFutInterestZip != null){
		document.frmNewAccnt.txtJointFutInterestZip.value = "";
	}
	if(document.frmNewAccnt.lstJointFutInterestStateID  != null){
		document.frmNewAccnt.lstJointInterestStateID .selectedIndex = 0; 
	}
	if(document.frmNewAccnt.lstJointFutInterestProvinceID != null){
		document.frmNewAccnt.lstJointFutInterestProvinceID.selectedIndex = 0; 
	}
	if(document.frmNewAccnt.lstJointFutInterestCountryID != null){
		document.frmNewAccnt.lstJointFutInterestCountryID.selectedIndex = 0; 
	}
	if(document.frmNewAccnt.txtJointFutInterestProvince != null){
		document.frmNewAccnt.txtJointFutInterestProvince.value = ""; 
	}
}


//SB 02/13/2008 DT 26797
function DisplayEntityQuestion(){
	var selentity = "";
	var entdescr="";
	selentity = GetSelectedEntity();
	selentity = selentity.substring(0,3);
	
	if(document.frmNewAccnt.chkTradeFutures != null && selentity != ""){
		if(document.frmNewAccnt.chkTradeFutures.checked == true){
			if(selentity == "crp" || selentity == "prt" || selentity == "trs") {
				entdescr = GetEntityDescription(selentity,true);
				if(document.getElementById('divFutAllowed') != null){
					document.getElementById('divFutAllowed').style.display = 'inline';		
					document.getElementById('divEntity').innerHTML = entdescr; 
				}
			}
			else{
				if(document.getElementById('divFutAllowed') != null){
					document.frmNewAccnt.radFutAllowed[0].checked = false;
					document.frmNewAccnt.radFutAllowed[1].checked = false;
					document.getElementById('divFutAllowed').style.display = 'none';		
				}

			}
		}
		else {
			if(document.getElementById('divFutAllowed') != null){
				document.frmNewAccnt.radFutAllowed[0].checked = false;
				document.frmNewAccnt.radFutAllowed[1].checked = false;
				document.getElementById('divFutAllowed').style.display = 'none';		
			}
		}
	}
	
}

function GetEntityDescription(Entity,bIsString){
	var sDescr;
	if(bIsString == true){
		if(Entity == "crp"){
			sDescr = "Company";
		}
		else if(Entity == "prt"){
			sDescr = "Partnership";
		}
		else if(Entity == "trs"){
			sDescr = "Trust";
		}
		else{
			sDescr = "Entity";
		}
	}
	else{
		if(Entity == CRP){
			sDescr = "Company";
		}
		else if(Entity == PRT){
			sDescr = "Partnership";
		}
		else if(Entity == TRS){
			sDescr = "Trust";
		}
		else{
			sDescr = "Entity";
		}	
	}
	return sDescr;
}

function GetSelectedEntity(){
	var selentity = "";
	for (var i=0; i < document.frmNewAccnt.radAccntEntity.length; i++){
		if (document.frmNewAccnt.radAccntEntity[i].checked) {
			selentity = document.frmNewAccnt.radAccntEntity[i].value;
		}
	}
	return selentity;
}
