/* ====================================================================

	File Name:	product_select_dhtml.js

	Purpose:	This is a script file for performing DHTML
               		within the Product Selection page

	Developer: 	Rustum Anwar

	Modifications:
	Date		Developer	Change
	------------	---------------	----------------------------
	01/08/2009	Rustum Anwar	Created

   =================================================================
*/

/* -------------------------------------------------------------------
	csv_getField(name)
	PURPOSE: Return field object
	INPUT  : Field Name
	RETURNS: pointer to field
	NOTES  :
--------------------------------------------------------------------  */
 function csv_getField(name)
{

  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
  }
  else if (document.all)
  {
	this.obj = document.all[name];
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
  }

  return this.obj;
}

function showAccountsQuestion()
{
	//Satisfied when the Bank Customer radio button is selected
	var mail_addr_obj = 'AccountsQuestion_table';
	if(csv_getField('bank_customer').checked)
	{
		showHide(mail_addr_obj,'show');
	}
	else
	{
		showHide(mail_addr_obj,'hide');
		if(csv_getField('olb_account'))
		{
			csv_getField('olb_account').checked=false;
		}
		csv_getField('checking_account').checked=false;
		csv_getField('savings_account').checked=false;
		csv_getField('CD_account').checked=false;
		csv_getField('other_account').checked=false;
	}
}


//WR 29344
function check_newcust()
{
	var Error_msgnewcus = '';
	if((csv_getField("OPEN_ROTH").checked == true || csv_getField("OPEN_TRADITIONAL").checked == true) && csv_getField("non_bank_customer").checked == true)
	{
		Error_msgnewcus = 'These products are only available online to existing Bank of America customers. If you would like to purchase one of these products, please visit a banking center near you.';
	}
	return Error_msgnewcus;
}

function radfunc()
{
    var obj = 'error_table';
	if((csv_getField("OPEN_ROTH").checked == true || csv_getField("OPEN_TRADITIONAL").checked == true) && csv_getField("non_bank_customer").checked == true)
	 {
		 showHide(obj,'show');
	 }
        else
	 {
		 showHide(obj,'hide');
	 }

}
//WR 29344


function helpwindow(helpkey,windowHeight,windowWidth){
	var NS4 = (document.layers) ? true : false;
	var NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1) ? true : false;
	var IE4plus = (document.all) ? true : false;
	var adr = 'help.cfm?helpkey=' + helpkey;
	var topPosition;
	var leftPosition;
	var PageHeight;
		if (NS4 || NS6){
		PageHeight = window.innerHeight;
			if (PageHeight < 500){
			topPosition = 253;
			leftPosition = 174;
		} else if (PageHeight < 620){
			topPosition = 253;
			leftPosition = 175;
		} else {
			topPosition = 254;
			leftPosition = 173;
		}
		window.open(adr, '', 'height='+windowHeight+',width='+windowWidth+',screenY='+topPosition+',screenX='+leftPosition+',scrollbars=yes,resizable=yes');
	} else {
		PageHeight = screen.availHeight;
			if (PageHeight < 600){
			topPosition = 238;
			leftPosition = 174;
		} else if (PageHeight < 800){
			topPosition = 237;
			leftPosition = 173;
		} else {
			topPosition = 238;
			leftPosition = 172;
		}
		window.open(adr, '', 'height='+windowHeight+',width='+windowWidth+',top='+topPosition+',left='+leftPosition+',scrollbars=yes,resizable=yes');
	}
}


function check_customer()
{
	var i = 0;
	var Error_msg = '';
	if(document.mainform.per_customer[0].checked == true || document.mainform.per_customer[1].checked == true)
		{
		    if(document.mainform.per_customer[0].checked == true)
		    	if(	document.getElementById('olb_account').checked 		== false &&
		    		document.getElementById('checking_account').checked	== false &&
		    		document.getElementById('savings_account').checked 	== false &&
		    		document.getElementById('CD_account').checked 		== false &&
		    		document.getElementById('other_account').checked 	== false)
					Error_msg = 'Please select what accounts and services you currently have.';
		}
	else
		{
			Error_msg = 'Please select Your Customer Relationship.';
		}
	return Error_msg;
}

